css.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 pgid {
  30. union {
  31. __u8 fc; /* SPID function code */
  32. struct path_state ps; /* SNID path state */
  33. } inf;
  34. __u32 cpu_addr : 16; /* CPU address */
  35. __u32 cpu_id : 24; /* CPU identification */
  36. __u32 cpu_model : 16; /* CPU model */
  37. __u32 tod_high; /* high word TOD clock */
  38. } __attribute__ ((packed));
  39. extern struct pgid global_pgid;
  40. #define MAX_CIWS 8
  41. /*
  42. * sense-id response buffer layout
  43. */
  44. struct senseid {
  45. /* common part */
  46. __u8 reserved; /* always 0x'FF' */
  47. __u16 cu_type; /* control unit type */
  48. __u8 cu_model; /* control unit model */
  49. __u16 dev_type; /* device type */
  50. __u8 dev_model; /* device model */
  51. __u8 unused; /* padding byte */
  52. /* extended part */
  53. struct ciw ciw[MAX_CIWS]; /* variable # of CIWs */
  54. } __attribute__ ((packed,aligned(4)));
  55. struct ccw_device_private {
  56. int state; /* device state */
  57. atomic_t onoff;
  58. unsigned long registered;
  59. __u16 devno; /* device number */
  60. __u16 sch_no; /* subchannel number */
  61. __u8 imask; /* lpm mask for SNID/SID/SPGID */
  62. int iretry; /* retry counter SNID/SID/SPGID */
  63. struct {
  64. unsigned int fast:1; /* post with "channel end" */
  65. unsigned int repall:1; /* report every interrupt status */
  66. unsigned int pgroup:1; /* do path grouping */
  67. unsigned int force:1; /* allow forced online */
  68. } __attribute__ ((packed)) options;
  69. struct {
  70. unsigned int pgid_single:1; /* use single path for Set PGID */
  71. unsigned int esid:1; /* Ext. SenseID supported by HW */
  72. unsigned int dosense:1; /* delayed SENSE required */
  73. unsigned int doverify:1; /* delayed path verification */
  74. unsigned int donotify:1; /* call notify function */
  75. unsigned int recog_done:1; /* dev. recog. complete */
  76. unsigned int fake_irb:1; /* deliver faked irb */
  77. } __attribute__((packed)) flags;
  78. unsigned long intparm; /* user interruption parameter */
  79. struct qdio_irq *qdio_data;
  80. struct irb irb; /* device status */
  81. struct senseid senseid; /* SenseID info */
  82. struct pgid pgid; /* path group ID */
  83. struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
  84. struct work_struct kick_work;
  85. wait_queue_head_t wait_q;
  86. struct timer_list timer;
  87. void *cmb; /* measurement information */
  88. struct list_head cmb_list; /* list of measured devices */
  89. u64 cmb_start_time; /* clock value of cmb reset */
  90. void *cmb_wait; /* deferred cmb enable/disable */
  91. };
  92. /*
  93. * A css driver handles all subchannels of one type.
  94. * Currently, we only care about I/O subchannels (type 0), these
  95. * have a ccw_device connected to them.
  96. */
  97. struct css_driver {
  98. unsigned int subchannel_type;
  99. struct device_driver drv;
  100. void (*irq)(struct device *);
  101. int (*notify)(struct device *, int);
  102. void (*verify)(struct device *);
  103. void (*termination)(struct device *);
  104. };
  105. /*
  106. * all css_drivers have the css_bus_type
  107. */
  108. extern struct bus_type css_bus_type;
  109. extern struct css_driver io_subchannel_driver;
  110. extern int css_probe_device(struct subchannel_id);
  111. extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
  112. extern int css_init_done;
  113. #define __MAX_SUBCHANNEL 65535
  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. extern int css_enqueue_subchannel_slow(struct subchannel_id 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