4 #include <linux/wait.h>
5 #include <linux/workqueue.h>
12 #define SPID_FUNC_SINGLE_PATH 0x00
13 #define SPID_FUNC_MULTI_PATH 0x80
14 #define SPID_FUNC_ESTABLISH 0x00
15 #define SPID_FUNC_RESIGN 0x40
16 #define SPID_FUNC_DISBAND 0x20
18 #define SNID_STATE1_RESET 0
19 #define SNID_STATE1_UNGROUPED 2
20 #define SNID_STATE1_GROUPED 3
22 #define SNID_STATE2_NOT_RESVD 0
23 #define SNID_STATE2_RESVD_ELSE 2
24 #define SNID_STATE2_RESVD_SELF 3
26 #define SNID_STATE3_MULTI_PATH 1
27 #define SNID_STATE3_SINGLE_PATH 0
30 __u8 state1 : 2; /* path state value 1 */
31 __u8 state2 : 2; /* path state value 2 */
32 __u8 state3 : 1; /* path state value 3 */
33 __u8 resvd : 3; /* reserved */
34 } __attribute__ ((packed));
38 __u8 fc; /* SPID function code */
39 struct path_state ps; /* SNID path state */
41 __u32 cpu_addr : 16; /* CPU address */
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));
47 extern struct pgid global_pgid;
52 * sense-id response buffer layout
56 __u8 reserved; /* always 0x'FF' */
57 __u16 cu_type; /* control unit type */
58 __u8 cu_model; /* control unit model */
59 __u16 dev_type; /* device type */
60 __u8 dev_model; /* device model */
61 __u8 unused; /* padding byte */
63 struct ciw ciw[MAX_CIWS]; /* variable # of CIWs */
64 } __attribute__ ((packed,aligned(4)));
66 struct ccw_device_private {
67 int state; /* device state */
69 unsigned long registered;
70 __u16 devno; /* device number */
71 __u16 irq; /* subchannel number */
72 __u8 imask; /* lpm mask for SNID/SID/SPGID */
73 int iretry; /* retry counter SNID/SID/SPGID */
75 unsigned int fast:1; /* post with "channel end" */
76 unsigned int repall:1; /* report every interrupt status */
77 unsigned int pgroup:1; /* do path grouping */
78 unsigned int force:1; /* allow forced online */
79 } __attribute__ ((packed)) options;
81 unsigned int pgid_single:1; /* use single path for Set PGID */
82 unsigned int esid:1; /* Ext. SenseID supported by HW */
83 unsigned int dosense:1; /* delayed SENSE required */
84 unsigned int doverify:1; /* delayed path verification */
85 unsigned int donotify:1; /* call notify function */
86 unsigned int recog_done:1; /* dev. recog. complete */
87 } __attribute__((packed)) flags;
88 unsigned long intparm; /* user interruption parameter */
89 struct qdio_irq *qdio_data;
90 struct irb irb; /* device status */
91 struct senseid senseid; /* SenseID info */
92 struct pgid pgid; /* path group ID */
93 struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
94 struct work_struct kick_work;
95 wait_queue_head_t wait_q;
96 struct timer_list timer;
97 void *cmb; /* measurement information */
98 struct list_head cmb_list; /* list of measured devices */
99 u64 cmb_start_time; /* clock value of cmb reset */
100 void *cmb_wait; /* deferred cmb enable/disable */
104 * A css driver handles all subchannels of one type.
105 * Currently, we only care about I/O subchannels (type 0), these
106 * have a ccw_device connected to them.
109 unsigned int subchannel_type;
110 struct device_driver drv;
111 void (*irq)(struct device *);
112 int (*notify)(struct device *, int);
113 void (*verify)(struct device *);
114 void (*termination)(struct device *);
118 * all css_drivers have the css_bus_type
120 extern struct bus_type css_bus_type;
121 extern struct css_driver io_subchannel_driver;
123 int css_probe_device(int irq);
124 extern struct subchannel * get_subchannel_by_schid(int irq);
125 extern unsigned int highest_subchannel;
126 extern int css_init_done;
128 #define __MAX_SUBCHANNELS 65536
130 extern struct bus_type css_bus_type;
131 extern struct device css_bus_device;
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 *);
138 /* Helper functions for vary on/off. */
139 void device_set_waiting(struct subchannel *);
141 /* Machine check helper function. */
142 void device_kill_pending_timer(struct subchannel *);
144 /* Helper functions to build lists for the slow path. */
145 int css_enqueue_subchannel_slow(unsigned long schid);
146 void css_walk_subchannel_slow_list(void (*fn)(unsigned long));
147 void css_clear_subchannel_slow_list(void);
148 int css_slow_subchannels_exist(void);
149 extern int need_rescan;
151 extern struct workqueue_struct *slow_path_wq;
152 extern struct work_struct slow_path_work;