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