device.h 3.3 KB

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