css.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. #ifndef _CSS_H
  2. #define _CSS_H
  3. #include <linux/wait.h>
  4. #include <linux/workqueue.h>
  5. #include <asm/cio.h>
  6. /*
  7. * path grouping stuff
  8. */
  9. #define SPID_FUNC_SINGLE_PATH 0x00
  10. #define SPID_FUNC_MULTI_PATH 0x80
  11. #define SPID_FUNC_ESTABLISH 0x00
  12. #define SPID_FUNC_RESIGN 0x40
  13. #define SPID_FUNC_DISBAND 0x20
  14. #define SNID_STATE1_RESET 0
  15. #define SNID_STATE1_UNGROUPED 2
  16. #define SNID_STATE1_GROUPED 3
  17. #define SNID_STATE2_NOT_RESVD 0
  18. #define SNID_STATE2_RESVD_ELSE 2
  19. #define SNID_STATE2_RESVD_SELF 3
  20. #define SNID_STATE3_MULTI_PATH 1
  21. #define SNID_STATE3_SINGLE_PATH 0
  22. struct path_state {
  23. __u8 state1 : 2; /* path state value 1 */
  24. __u8 state2 : 2; /* path state value 2 */
  25. __u8 state3 : 1; /* path state value 3 */
  26. __u8 resvd : 3; /* reserved */
  27. } __attribute__ ((packed));
  28. struct pgid {
  29. union {
  30. __u8 fc; /* SPID function code */
  31. struct path_state ps; /* SNID path state */
  32. } inf;
  33. __u32 cpu_addr : 16; /* CPU address */
  34. __u32 cpu_id : 24; /* CPU identification */
  35. __u32 cpu_model : 16; /* CPU model */
  36. __u32 tod_high; /* high word TOD clock */
  37. } __attribute__ ((packed));
  38. extern struct pgid global_pgid;
  39. #define MAX_CIWS 8
  40. /*
  41. * sense-id response buffer layout
  42. */
  43. struct senseid {
  44. /* common part */
  45. __u8 reserved; /* always 0x'FF' */
  46. __u16 cu_type; /* control unit type */
  47. __u8 cu_model; /* control unit model */
  48. __u16 dev_type; /* device type */
  49. __u8 dev_model; /* device model */
  50. __u8 unused; /* padding byte */
  51. /* extended part */
  52. struct ciw ciw[MAX_CIWS]; /* variable # of CIWs */
  53. } __attribute__ ((packed,aligned(4)));
  54. struct ccw_device_private {
  55. int state; /* device state */
  56. atomic_t onoff;
  57. unsigned long registered;
  58. __u16 devno; /* device number */
  59. __u16 irq; /* subchannel number */
  60. __u8 imask; /* lpm mask for SNID/SID/SPGID */
  61. int iretry; /* retry counter SNID/SID/SPGID */
  62. struct {
  63. unsigned int fast:1; /* post with "channel end" */
  64. unsigned int repall:1; /* report every interrupt status */
  65. unsigned int pgroup:1; /* do path grouping */
  66. unsigned int force:1; /* allow forced online */
  67. } __attribute__ ((packed)) options;
  68. struct {
  69. unsigned int pgid_single:1; /* use single path for Set PGID */
  70. unsigned int esid:1; /* Ext. SenseID supported by HW */
  71. unsigned int dosense:1; /* delayed SENSE required */
  72. unsigned int doverify:1; /* delayed path verification */
  73. unsigned int donotify:1; /* call notify function */
  74. unsigned int recog_done:1; /* dev. recog. complete */
  75. unsigned int fake_irb:1; /* deliver faked irb */
  76. } __attribute__((packed)) flags;
  77. unsigned long intparm; /* user interruption parameter */
  78. struct qdio_irq *qdio_data;
  79. struct irb irb; /* device status */
  80. struct senseid senseid; /* SenseID info */
  81. struct pgid pgid; /* path group ID */
  82. struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
  83. struct work_struct kick_work;
  84. wait_queue_head_t wait_q;
  85. struct timer_list timer;
  86. void *cmb; /* measurement information */
  87. struct list_head cmb_list; /* list of measured devices */
  88. u64 cmb_start_time; /* clock value of cmb reset */
  89. void *cmb_wait; /* deferred cmb enable/disable */
  90. };
  91. /*
  92. * A css driver handles all subchannels of one type.
  93. * Currently, we only care about I/O subchannels (type 0), these
  94. * have a ccw_device connected to them.
  95. */
  96. struct css_driver {
  97. unsigned int subchannel_type;
  98. struct device_driver drv;
  99. void (*irq)(struct device *);
  100. int (*notify)(struct device *, int);
  101. void (*verify)(struct device *);
  102. void (*termination)(struct device *);
  103. };
  104. /*
  105. * all css_drivers have the css_bus_type
  106. */
  107. extern struct bus_type css_bus_type;
  108. extern struct css_driver io_subchannel_driver;
  109. int css_probe_device(int irq);
  110. extern struct subchannel * get_subchannel_by_schid(int irq);
  111. extern unsigned int highest_subchannel;
  112. extern int css_init_done;
  113. #define __MAX_SUBCHANNELS 65536
  114. extern struct bus_type css_bus_type;
  115. extern struct device css_bus_device;
  116. /* Some helper functions for disconnected state. */
  117. int device_is_disconnected(struct subchannel *);
  118. void device_set_disconnected(struct subchannel *);
  119. void device_trigger_reprobe(struct subchannel *);
  120. /* Helper functions for vary on/off. */
  121. int device_is_online(struct subchannel *);
  122. void device_set_waiting(struct subchannel *);
  123. /* Machine check helper function. */
  124. void device_kill_pending_timer(struct subchannel *);
  125. /* Helper functions to build lists for the slow path. */
  126. int css_enqueue_subchannel_slow(unsigned long schid);
  127. void css_walk_subchannel_slow_list(void (*fn)(unsigned long));
  128. void css_clear_subchannel_slow_list(void);
  129. int css_slow_subchannels_exist(void);
  130. extern int need_rescan;
  131. extern struct workqueue_struct *slow_path_wq;
  132. extern struct work_struct slow_path_work;
  133. #endif