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 __u16 devno; /* device number */
70 __u16 irq; /* subchannel number */
71 __u8 imask; /* lpm mask for SNID/SID/SPGID */
72 int iretry; /* retry counter SNID/SID/SPGID */
74 unsigned int fast:1; /* post with "channel end" */
75 unsigned int repall:1; /* report every interrupt status */
76 unsigned int pgroup:1; /* do path grouping */
77 unsigned int force:1; /* allow forced online */
78 } __attribute__ ((packed)) options;
80 unsigned int pgid_single:1; /* use single path for Set PGID */
81 unsigned int esid:1; /* Ext. SenseID supported by HW */
82 unsigned int dosense:1; /* delayed SENSE required */
83 unsigned int doverify:1; /* delayed path verification */
84 unsigned int donotify:1; /* call notify function */
85 unsigned int recog_done:1; /* dev. recog. complete */
86 } __attribute__((packed)) flags;
87 unsigned long intparm; /* user interruption parameter */
88 struct qdio_irq *qdio_data;
89 struct irb irb; /* device status */
90 struct senseid senseid; /* SenseID info */
91 struct pgid pgid; /* path group ID */
92 struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
93 struct work_struct kick_work;
94 wait_queue_head_t wait_q;
95 struct timer_list timer;
96 void *cmb; /* measurement information */
97 struct list_head cmb_list; /* list of measured devices */
98 u64 cmb_start_time; /* clock value of cmb reset */
99 void *cmb_wait; /* deferred cmb enable/disable */
103 * A css driver handles all subchannels of one type.
104 * Currently, we only care about I/O subchannels (type 0), these
105 * have a ccw_device connected to them.
108 unsigned int subchannel_type;
109 struct device_driver drv;
110 void (*irq)(struct device *);
111 int (*notify)(struct device *, int);
112 void (*verify)(struct device *);
113 void (*termination)(struct device *);
117 * all css_drivers have the css_bus_type
119 extern struct bus_type css_bus_type;
120 extern struct css_driver io_subchannel_driver;
122 int css_probe_device(int irq);
123 extern struct subchannel * get_subchannel_by_schid(int irq);
124 extern unsigned int highest_subchannel;
125 extern int css_init_done;
127 #define __MAX_SUBCHANNELS 65536
129 extern struct bus_type css_bus_type;
130 extern struct device css_bus_device;
132 /* Some helper functions for disconnected state. */
133 int device_is_disconnected(struct subchannel *);
134 void device_set_disconnected(struct subchannel *);
135 void device_trigger_reprobe(struct subchannel *);
137 /* Helper functions for vary on/off. */
138 void device_set_waiting(struct subchannel *);
139 void device_call_nopath_notify(struct subchannel *);
141 /* Helper functions to build lists for the slow path. */
142 int css_enqueue_subchannel_slow(unsigned long schid);
143 void css_walk_subchannel_slow_list(void (*fn)(unsigned long));
144 void css_clear_subchannel_slow_list(void);
145 int css_slow_subchannels_exist(void);
146 extern int need_rescan;