]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * include/asm-s390/cio.h | |
3 | * include/asm-s390x/cio.h | |
4 | * | |
5 | * Common interface for I/O on S/390 | |
6 | */ | |
7 | #ifndef _ASM_S390_CIO_H_ | |
8 | #define _ASM_S390_CIO_H_ | |
9 | ||
10 | #include <linux/spinlock.h> | |
11 | #include <asm/types.h> | |
12 | ||
13 | #ifdef __KERNEL__ | |
14 | ||
15 | #define LPM_ANYPATH 0xff | |
e5854a58 | 16 | #define __MAX_CSSID 0 |
1da177e4 | 17 | |
62733e5a | 18 | #include <asm/scsw.h> |
1da177e4 | 19 | |
b2ffd8e9 CH |
20 | /** |
21 | * struct ccw1 - channel command word | |
22 | * @cmd_code: command code | |
3ad2f3fb | 23 | * @flags: flags, like IDA addressing, etc. |
b2ffd8e9 CH |
24 | * @count: byte count |
25 | * @cda: data address | |
26 | * | |
27 | * The ccw is the basic structure to build channel programs that perform | |
28 | * operations with the device or the control unit. Only Format-1 channel | |
29 | * command words are supported. | |
30 | */ | |
1da177e4 | 31 | struct ccw1 { |
b2ffd8e9 CH |
32 | __u8 cmd_code; |
33 | __u8 flags; | |
34 | __u16 count; | |
35 | __u32 cda; | |
1da177e4 LT |
36 | } __attribute__ ((packed,aligned(8))); |
37 | ||
38 | #define CCW_FLAG_DC 0x80 | |
39 | #define CCW_FLAG_CC 0x40 | |
40 | #define CCW_FLAG_SLI 0x20 | |
41 | #define CCW_FLAG_SKIP 0x10 | |
42 | #define CCW_FLAG_PCI 0x08 | |
43 | #define CCW_FLAG_IDA 0x04 | |
44 | #define CCW_FLAG_SUSPEND 0x02 | |
45 | ||
46 | #define CCW_CMD_READ_IPL 0x02 | |
47 | #define CCW_CMD_NOOP 0x03 | |
48 | #define CCW_CMD_BASIC_SENSE 0x04 | |
49 | #define CCW_CMD_TIC 0x08 | |
50 | #define CCW_CMD_STLCK 0x14 | |
51 | #define CCW_CMD_SENSE_PGID 0x34 | |
52 | #define CCW_CMD_SUSPEND_RECONN 0x5B | |
53 | #define CCW_CMD_RDC 0x64 | |
54 | #define CCW_CMD_RELEASE 0x94 | |
55 | #define CCW_CMD_SET_PGID 0xAF | |
56 | #define CCW_CMD_SENSE_ID 0xE4 | |
57 | #define CCW_CMD_DCTL 0xF3 | |
58 | ||
59 | #define SENSE_MAX_COUNT 0x20 | |
60 | ||
b2ffd8e9 CH |
61 | /** |
62 | * struct erw - extended report word | |
63 | * @res0: reserved | |
64 | * @auth: authorization check | |
65 | * @pvrf: path-verification-required flag | |
66 | * @cpt: channel-path timeout | |
67 | * @fsavf: failing storage address validity flag | |
68 | * @cons: concurrent sense | |
69 | * @scavf: secondary ccw address validity flag | |
70 | * @fsaf: failing storage address format | |
71 | * @scnt: sense count, if @cons == %1 | |
72 | * @res16: reserved | |
73 | */ | |
1da177e4 | 74 | struct erw { |
b2ffd8e9 CH |
75 | __u32 res0 : 3; |
76 | __u32 auth : 1; | |
77 | __u32 pvrf : 1; | |
78 | __u32 cpt : 1; | |
79 | __u32 fsavf : 1; | |
80 | __u32 cons : 1; | |
81 | __u32 scavf : 1; | |
82 | __u32 fsaf : 1; | |
83 | __u32 scnt : 6; | |
84 | __u32 res16 : 16; | |
1da177e4 LT |
85 | } __attribute__ ((packed)); |
86 | ||
b2ffd8e9 CH |
87 | /** |
88 | * struct sublog - subchannel logout area | |
89 | * @res0: reserved | |
90 | * @esf: extended status flags | |
91 | * @lpum: last path used mask | |
92 | * @arep: ancillary report | |
93 | * @fvf: field-validity flags | |
94 | * @sacc: storage access code | |
95 | * @termc: termination code | |
96 | * @devsc: device-status check | |
97 | * @serr: secondary error | |
98 | * @ioerr: i/o-error alert | |
99 | * @seqc: sequence code | |
1da177e4 LT |
100 | */ |
101 | struct sublog { | |
b2ffd8e9 CH |
102 | __u32 res0 : 1; |
103 | __u32 esf : 7; | |
104 | __u32 lpum : 8; | |
105 | __u32 arep : 1; | |
106 | __u32 fvf : 5; | |
107 | __u32 sacc : 2; | |
108 | __u32 termc : 2; | |
109 | __u32 devsc : 1; | |
110 | __u32 serr : 1; | |
111 | __u32 ioerr : 1; | |
112 | __u32 seqc : 3; | |
1da177e4 LT |
113 | } __attribute__ ((packed)); |
114 | ||
b2ffd8e9 CH |
115 | /** |
116 | * struct esw0 - Format 0 Extended Status Word (ESW) | |
117 | * @sublog: subchannel logout | |
118 | * @erw: extended report word | |
119 | * @faddr: failing storage address | |
120 | * @saddr: secondary ccw address | |
1da177e4 LT |
121 | */ |
122 | struct esw0 { | |
b2ffd8e9 CH |
123 | struct sublog sublog; |
124 | struct erw erw; | |
125 | __u32 faddr[2]; | |
126 | __u32 saddr; | |
1da177e4 LT |
127 | } __attribute__ ((packed)); |
128 | ||
b2ffd8e9 CH |
129 | /** |
130 | * struct esw1 - Format 1 Extended Status Word (ESW) | |
131 | * @zero0: reserved zeros | |
132 | * @lpum: last path used mask | |
133 | * @zero16: reserved zeros | |
134 | * @erw: extended report word | |
135 | * @zeros: three fullwords of zeros | |
1da177e4 LT |
136 | */ |
137 | struct esw1 { | |
b2ffd8e9 CH |
138 | __u8 zero0; |
139 | __u8 lpum; | |
140 | __u16 zero16; | |
141 | struct erw erw; | |
142 | __u32 zeros[3]; | |
1da177e4 LT |
143 | } __attribute__ ((packed)); |
144 | ||
b2ffd8e9 CH |
145 | /** |
146 | * struct esw2 - Format 2 Extended Status Word (ESW) | |
147 | * @zero0: reserved zeros | |
148 | * @lpum: last path used mask | |
149 | * @dcti: device-connect-time interval | |
150 | * @erw: extended report word | |
151 | * @zeros: three fullwords of zeros | |
1da177e4 LT |
152 | */ |
153 | struct esw2 { | |
b2ffd8e9 CH |
154 | __u8 zero0; |
155 | __u8 lpum; | |
156 | __u16 dcti; | |
157 | struct erw erw; | |
158 | __u32 zeros[3]; | |
1da177e4 LT |
159 | } __attribute__ ((packed)); |
160 | ||
b2ffd8e9 CH |
161 | /** |
162 | * struct esw3 - Format 3 Extended Status Word (ESW) | |
163 | * @zero0: reserved zeros | |
164 | * @lpum: last path used mask | |
165 | * @res: reserved | |
166 | * @erw: extended report word | |
167 | * @zeros: three fullwords of zeros | |
1da177e4 LT |
168 | */ |
169 | struct esw3 { | |
b2ffd8e9 CH |
170 | __u8 zero0; |
171 | __u8 lpum; | |
172 | __u16 res; | |
173 | struct erw erw; | |
174 | __u32 zeros[3]; | |
1da177e4 LT |
175 | } __attribute__ ((packed)); |
176 | ||
b2ffd8e9 CH |
177 | /** |
178 | * struct irb - interruption response block | |
179 | * @scsw: subchannel status word | |
180 | * @esw: extened status word, 4 formats | |
181 | * @ecw: extended control word | |
182 | * | |
183 | * The irb that is handed to the device driver when an interrupt occurs. For | |
184 | * solicited interrupts, the common I/O layer already performs checks whether | |
185 | * a field is valid; a field not being valid is always passed as %0. | |
186 | * If a unit check occured, @ecw may contain sense data; this is retrieved | |
187 | * by the common I/O layer itself if the device doesn't support concurrent | |
188 | * sense (so that the device driver never needs to perform basic sene itself). | |
189 | * For unsolicited interrupts, the irb is passed as-is (expect for sense data, | |
190 | * if applicable). | |
1da177e4 LT |
191 | */ |
192 | struct irb { | |
23d805b6 | 193 | union scsw scsw; |
b2ffd8e9 | 194 | union { |
1da177e4 LT |
195 | struct esw0 esw0; |
196 | struct esw1 esw1; | |
197 | struct esw2 esw2; | |
198 | struct esw3 esw3; | |
199 | } esw; | |
b2ffd8e9 | 200 | __u8 ecw[32]; |
1da177e4 LT |
201 | } __attribute__ ((packed,aligned(4))); |
202 | ||
b2ffd8e9 CH |
203 | /** |
204 | * struct ciw - command information word (CIW) layout | |
205 | * @et: entry type | |
206 | * @reserved: reserved bits | |
207 | * @ct: command type | |
208 | * @cmd: command code | |
209 | * @count: command count | |
1da177e4 LT |
210 | */ |
211 | struct ciw { | |
b2ffd8e9 CH |
212 | __u32 et : 2; |
213 | __u32 reserved : 2; | |
214 | __u32 ct : 4; | |
215 | __u32 cmd : 8; | |
216 | __u32 count : 16; | |
1da177e4 LT |
217 | } __attribute__ ((packed)); |
218 | ||
219 | #define CIW_TYPE_RCD 0x0 /* read configuration data */ | |
220 | #define CIW_TYPE_SII 0x1 /* set interface identifier */ | |
221 | #define CIW_TYPE_RNI 0x2 /* read node identifier */ | |
222 | ||
223 | /* | |
224 | * Flags used as input parameters for do_IO() | |
225 | */ | |
226 | #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */ | |
227 | #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */ | |
228 | #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */ | |
229 | /* ... for suspended CCWs */ | |
230 | /* Device or subchannel gone. */ | |
231 | #define CIO_GONE 0x0001 | |
232 | /* No path to device. */ | |
233 | #define CIO_NO_PATH 0x0002 | |
234 | /* Device has appeared. */ | |
235 | #define CIO_OPER 0x0004 | |
236 | /* Sick revalidation of device. */ | |
237 | #define CIO_REVALIDATE 0x0008 | |
47593bfa SO |
238 | /* Device did not respond in time. */ |
239 | #define CIO_BOXED 0x0010 | |
1da177e4 | 240 | |
b2ffd8e9 CH |
241 | /** |
242 | * struct ccw_dev_id - unique identifier for ccw devices | |
243 | * @ssid: subchannel set id | |
244 | * @devno: device number | |
245 | * | |
246 | * This structure is not directly based on any hardware structure. The | |
247 | * hardware identifies a device by its device number and its subchannel, | |
248 | * which is in turn identified by its id. In order to get a unique identifier | |
249 | * for ccw devices across subchannel sets, @struct ccw_dev_id has been | |
250 | * introduced. | |
251 | */ | |
ff6b8ea6 MH |
252 | struct ccw_dev_id { |
253 | u8 ssid; | |
254 | u16 devno; | |
255 | }; | |
256 | ||
b2ffd8e9 CH |
257 | /** |
258 | * ccw_device_id_is_equal() - compare two ccw_dev_ids | |
259 | * @dev_id1: a ccw_dev_id | |
260 | * @dev_id2: another ccw_dev_id | |
261 | * Returns: | |
262 | * %1 if the two structures are equal field-by-field, | |
263 | * %0 if not. | |
264 | * Context: | |
265 | * any | |
266 | */ | |
78964268 CH |
267 | static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, |
268 | struct ccw_dev_id *dev_id2) | |
269 | { | |
ce26a853 CH |
270 | if ((dev_id1->ssid == dev_id2->ssid) && |
271 | (dev_id1->devno == dev_id2->devno)) | |
272 | return 1; | |
273 | return 0; | |
78964268 CH |
274 | } |
275 | ||
1da177e4 LT |
276 | extern void wait_cons_dev(void); |
277 | ||
40154b82 PO |
278 | extern void css_schedule_reprobe(void); |
279 | ||
ff6b8ea6 MH |
280 | extern void reipl_ccw_dev(struct ccw_dev_id *id); |
281 | ||
6fc321fd HC |
282 | struct cio_iplinfo { |
283 | u16 devno; | |
284 | int is_qdio; | |
285 | }; | |
286 | ||
287 | extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo); | |
288 | ||
a806170e HC |
289 | /* Function from drivers/s390/cio/chsc.c */ |
290 | int chsc_sstpc(void *page, unsigned int op, u16 ctrl); | |
291 | int chsc_sstpi(void *page, void *result, size_t size); | |
292 | ||
1da177e4 LT |
293 | #endif |
294 | ||
295 | #endif |