device.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef S390_DEVICE_H
  2. #define S390_DEVICE_H
  3. #include <asm/ccwdev.h>
  4. #include <asm/atomic.h>
  5. #include <linux/wait.h>
  6. /*
  7. * states of the device statemachine
  8. */
  9. enum dev_state {
  10. DEV_STATE_NOT_OPER,
  11. DEV_STATE_SENSE_PGID,
  12. DEV_STATE_SENSE_ID,
  13. DEV_STATE_OFFLINE,
  14. DEV_STATE_VERIFY,
  15. DEV_STATE_ONLINE,
  16. DEV_STATE_W4SENSE,
  17. DEV_STATE_DISBAND_PGID,
  18. DEV_STATE_BOXED,
  19. /* states to wait for i/o completion before doing something */
  20. DEV_STATE_CLEAR_VERIFY,
  21. DEV_STATE_TIMEOUT_KILL,
  22. DEV_STATE_QUIESCE,
  23. /* special states for devices gone not operational */
  24. DEV_STATE_DISCONNECTED,
  25. DEV_STATE_DISCONNECTED_SENSE_ID,
  26. DEV_STATE_CMFCHANGE,
  27. DEV_STATE_CMFUPDATE,
  28. /* last element! */
  29. NR_DEV_STATES
  30. };
  31. /*
  32. * asynchronous events of the device statemachine
  33. */
  34. enum dev_event {
  35. DEV_EVENT_NOTOPER,
  36. DEV_EVENT_INTERRUPT,
  37. DEV_EVENT_TIMEOUT,
  38. DEV_EVENT_VERIFY,
  39. /* last element! */
  40. NR_DEV_EVENTS
  41. };
  42. struct ccw_device;
  43. /*
  44. * action called through jumptable
  45. */
  46. typedef void (fsm_func_t)(struct ccw_device *, enum dev_event);
  47. extern fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS];
  48. static inline void
  49. dev_fsm_event(struct ccw_device *cdev, enum dev_event dev_event)
  50. {
  51. dev_jumptable[cdev->private->state][dev_event](cdev, dev_event);
  52. }
  53. /*
  54. * Delivers 1 if the device state is final.
  55. */
  56. static inline int
  57. dev_fsm_final_state(struct ccw_device *cdev)
  58. {
  59. return (cdev->private->state == DEV_STATE_NOT_OPER ||
  60. cdev->private->state == DEV_STATE_OFFLINE ||
  61. cdev->private->state == DEV_STATE_ONLINE ||
  62. cdev->private->state == DEV_STATE_BOXED);
  63. }
  64. extern struct workqueue_struct *ccw_device_work;
  65. extern struct workqueue_struct *ccw_device_notify_work;
  66. extern wait_queue_head_t ccw_device_init_wq;
  67. extern atomic_t ccw_device_init_count;
  68. void io_subchannel_recog_done(struct ccw_device *cdev);
  69. int ccw_device_cancel_halt_clear(struct ccw_device *);
  70. int ccw_device_register(struct ccw_device *);
  71. void ccw_device_do_unreg_rereg(void *);
  72. void ccw_device_call_sch_unregister(void *);
  73. int ccw_device_recognition(struct ccw_device *);
  74. int ccw_device_online(struct ccw_device *);
  75. int ccw_device_offline(struct ccw_device *);
  76. /* Function prototypes for device status and basic sense stuff. */
  77. void ccw_device_accumulate_irb(struct ccw_device *, struct irb *);
  78. void ccw_device_accumulate_basic_sense(struct ccw_device *, struct irb *);
  79. int ccw_device_accumulate_and_sense(struct ccw_device *, struct irb *);
  80. int ccw_device_do_sense(struct ccw_device *, struct irb *);
  81. /* Function prototypes for sense id stuff. */
  82. void ccw_device_sense_id_start(struct ccw_device *);
  83. void ccw_device_sense_id_irq(struct ccw_device *, enum dev_event);
  84. void ccw_device_sense_id_done(struct ccw_device *, int);
  85. /* Function prototypes for path grouping stuff. */
  86. void ccw_device_sense_pgid_start(struct ccw_device *);
  87. void ccw_device_sense_pgid_irq(struct ccw_device *, enum dev_event);
  88. void ccw_device_sense_pgid_done(struct ccw_device *, int);
  89. void ccw_device_verify_start(struct ccw_device *);
  90. void ccw_device_verify_irq(struct ccw_device *, enum dev_event);
  91. void ccw_device_verify_done(struct ccw_device *, int);
  92. void ccw_device_disband_start(struct ccw_device *);
  93. void ccw_device_disband_irq(struct ccw_device *, enum dev_event);
  94. void ccw_device_disband_done(struct ccw_device *, int);
  95. int ccw_device_call_handler(struct ccw_device *);
  96. int ccw_device_stlck(struct ccw_device *);
  97. /* qdio needs this. */
  98. void ccw_device_set_timeout(struct ccw_device *, int);
  99. extern struct subchannel_id ccw_device_get_subchannel_id(struct ccw_device *);
  100. /* Channel measurement facility related */
  101. void retry_set_schib(struct ccw_device *cdev);
  102. void cmf_retry_copy_block(struct ccw_device *);
  103. int cmf_reenable(struct ccw_device *);
  104. #endif