css.h 5.1 KB

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