x86: introduce native_set_pte_atomic() on 64-bit too
[wrt350n-kernel.git] / include / asm-s390 / cio.h
blob123b557c3ff4d19c29b42bd1dec2f570787cef36
1 /*
2 * include/asm-s390/cio.h
3 * include/asm-s390x/cio.h
5 * Common interface for I/O on S/390
6 */
7 #ifndef _ASM_S390_CIO_H_
8 #define _ASM_S390_CIO_H_
10 #include <linux/spinlock.h>
11 #include <asm/types.h>
13 #ifdef __KERNEL__
15 #define LPM_ANYPATH 0xff
16 #define __MAX_CSSID 0
18 /**
19 * struct scsw - subchannel status word
20 * @key: subchannel key
21 * @sctl: suspend control
22 * @eswf: esw format
23 * @cc: deferred condition code
24 * @fmt: format
25 * @pfch: prefetch
26 * @isic: initial-status interruption control
27 * @alcc: address-limit checking control
28 * @ssi: suppress-suspended interruption
29 * @zcc: zero condition code
30 * @ectl: extended control
31 * @pno: path not operational
32 * @res: reserved
33 * @fctl: function control
34 * @actl: activity control
35 * @stctl: status control
36 * @cpa: channel program address
37 * @dstat: device status
38 * @cstat: subchannel status
39 * @count: residual count
41 struct scsw {
42 __u32 key : 4;
43 __u32 sctl : 1;
44 __u32 eswf : 1;
45 __u32 cc : 2;
46 __u32 fmt : 1;
47 __u32 pfch : 1;
48 __u32 isic : 1;
49 __u32 alcc : 1;
50 __u32 ssi : 1;
51 __u32 zcc : 1;
52 __u32 ectl : 1;
53 __u32 pno : 1;
54 __u32 res : 1;
55 __u32 fctl : 3;
56 __u32 actl : 7;
57 __u32 stctl : 5;
58 __u32 cpa;
59 __u32 dstat : 8;
60 __u32 cstat : 8;
61 __u32 count : 16;
62 } __attribute__ ((packed));
64 #define SCSW_FCTL_CLEAR_FUNC 0x1
65 #define SCSW_FCTL_HALT_FUNC 0x2
66 #define SCSW_FCTL_START_FUNC 0x4
68 #define SCSW_ACTL_SUSPENDED 0x1
69 #define SCSW_ACTL_DEVACT 0x2
70 #define SCSW_ACTL_SCHACT 0x4
71 #define SCSW_ACTL_CLEAR_PEND 0x8
72 #define SCSW_ACTL_HALT_PEND 0x10
73 #define SCSW_ACTL_START_PEND 0x20
74 #define SCSW_ACTL_RESUME_PEND 0x40
76 #define SCSW_STCTL_STATUS_PEND 0x1
77 #define SCSW_STCTL_SEC_STATUS 0x2
78 #define SCSW_STCTL_PRIM_STATUS 0x4
79 #define SCSW_STCTL_INTER_STATUS 0x8
80 #define SCSW_STCTL_ALERT_STATUS 0x10
82 #define DEV_STAT_ATTENTION 0x80
83 #define DEV_STAT_STAT_MOD 0x40
84 #define DEV_STAT_CU_END 0x20
85 #define DEV_STAT_BUSY 0x10
86 #define DEV_STAT_CHN_END 0x08
87 #define DEV_STAT_DEV_END 0x04
88 #define DEV_STAT_UNIT_CHECK 0x02
89 #define DEV_STAT_UNIT_EXCEP 0x01
91 #define SCHN_STAT_PCI 0x80
92 #define SCHN_STAT_INCORR_LEN 0x40
93 #define SCHN_STAT_PROG_CHECK 0x20
94 #define SCHN_STAT_PROT_CHECK 0x10
95 #define SCHN_STAT_CHN_DATA_CHK 0x08
96 #define SCHN_STAT_CHN_CTRL_CHK 0x04
97 #define SCHN_STAT_INTF_CTRL_CHK 0x02
98 #define SCHN_STAT_CHAIN_CHECK 0x01
101 * architectured values for first sense byte
103 #define SNS0_CMD_REJECT 0x80
104 #define SNS_CMD_REJECT SNS0_CMD_REJEC
105 #define SNS0_INTERVENTION_REQ 0x40
106 #define SNS0_BUS_OUT_CHECK 0x20
107 #define SNS0_EQUIPMENT_CHECK 0x10
108 #define SNS0_DATA_CHECK 0x08
109 #define SNS0_OVERRUN 0x04
110 #define SNS0_INCOMPL_DOMAIN 0x01
113 * architectured values for second sense byte
115 #define SNS1_PERM_ERR 0x80
116 #define SNS1_INV_TRACK_FORMAT 0x40
117 #define SNS1_EOC 0x20
118 #define SNS1_MESSAGE_TO_OPER 0x10
119 #define SNS1_NO_REC_FOUND 0x08
120 #define SNS1_FILE_PROTECTED 0x04
121 #define SNS1_WRITE_INHIBITED 0x02
122 #define SNS1_INPRECISE_END 0x01
125 * architectured values for third sense byte
127 #define SNS2_REQ_INH_WRITE 0x80
128 #define SNS2_CORRECTABLE 0x40
129 #define SNS2_FIRST_LOG_ERR 0x20
130 #define SNS2_ENV_DATA_PRESENT 0x10
131 #define SNS2_INPRECISE_END 0x04
134 * struct ccw1 - channel command word
135 * @cmd_code: command code
136 * @flags: flags, like IDA adressing, etc.
137 * @count: byte count
138 * @cda: data address
140 * The ccw is the basic structure to build channel programs that perform
141 * operations with the device or the control unit. Only Format-1 channel
142 * command words are supported.
144 struct ccw1 {
145 __u8 cmd_code;
146 __u8 flags;
147 __u16 count;
148 __u32 cda;
149 } __attribute__ ((packed,aligned(8)));
151 #define CCW_FLAG_DC 0x80
152 #define CCW_FLAG_CC 0x40
153 #define CCW_FLAG_SLI 0x20
154 #define CCW_FLAG_SKIP 0x10
155 #define CCW_FLAG_PCI 0x08
156 #define CCW_FLAG_IDA 0x04
157 #define CCW_FLAG_SUSPEND 0x02
159 #define CCW_CMD_READ_IPL 0x02
160 #define CCW_CMD_NOOP 0x03
161 #define CCW_CMD_BASIC_SENSE 0x04
162 #define CCW_CMD_TIC 0x08
163 #define CCW_CMD_STLCK 0x14
164 #define CCW_CMD_SENSE_PGID 0x34
165 #define CCW_CMD_SUSPEND_RECONN 0x5B
166 #define CCW_CMD_RDC 0x64
167 #define CCW_CMD_RELEASE 0x94
168 #define CCW_CMD_SET_PGID 0xAF
169 #define CCW_CMD_SENSE_ID 0xE4
170 #define CCW_CMD_DCTL 0xF3
172 #define SENSE_MAX_COUNT 0x20
175 * struct erw - extended report word
176 * @res0: reserved
177 * @auth: authorization check
178 * @pvrf: path-verification-required flag
179 * @cpt: channel-path timeout
180 * @fsavf: failing storage address validity flag
181 * @cons: concurrent sense
182 * @scavf: secondary ccw address validity flag
183 * @fsaf: failing storage address format
184 * @scnt: sense count, if @cons == %1
185 * @res16: reserved
187 struct erw {
188 __u32 res0 : 3;
189 __u32 auth : 1;
190 __u32 pvrf : 1;
191 __u32 cpt : 1;
192 __u32 fsavf : 1;
193 __u32 cons : 1;
194 __u32 scavf : 1;
195 __u32 fsaf : 1;
196 __u32 scnt : 6;
197 __u32 res16 : 16;
198 } __attribute__ ((packed));
201 * struct sublog - subchannel logout area
202 * @res0: reserved
203 * @esf: extended status flags
204 * @lpum: last path used mask
205 * @arep: ancillary report
206 * @fvf: field-validity flags
207 * @sacc: storage access code
208 * @termc: termination code
209 * @devsc: device-status check
210 * @serr: secondary error
211 * @ioerr: i/o-error alert
212 * @seqc: sequence code
214 struct sublog {
215 __u32 res0 : 1;
216 __u32 esf : 7;
217 __u32 lpum : 8;
218 __u32 arep : 1;
219 __u32 fvf : 5;
220 __u32 sacc : 2;
221 __u32 termc : 2;
222 __u32 devsc : 1;
223 __u32 serr : 1;
224 __u32 ioerr : 1;
225 __u32 seqc : 3;
226 } __attribute__ ((packed));
229 * struct esw0 - Format 0 Extended Status Word (ESW)
230 * @sublog: subchannel logout
231 * @erw: extended report word
232 * @faddr: failing storage address
233 * @saddr: secondary ccw address
235 struct esw0 {
236 struct sublog sublog;
237 struct erw erw;
238 __u32 faddr[2];
239 __u32 saddr;
240 } __attribute__ ((packed));
243 * struct esw1 - Format 1 Extended Status Word (ESW)
244 * @zero0: reserved zeros
245 * @lpum: last path used mask
246 * @zero16: reserved zeros
247 * @erw: extended report word
248 * @zeros: three fullwords of zeros
250 struct esw1 {
251 __u8 zero0;
252 __u8 lpum;
253 __u16 zero16;
254 struct erw erw;
255 __u32 zeros[3];
256 } __attribute__ ((packed));
259 * struct esw2 - Format 2 Extended Status Word (ESW)
260 * @zero0: reserved zeros
261 * @lpum: last path used mask
262 * @dcti: device-connect-time interval
263 * @erw: extended report word
264 * @zeros: three fullwords of zeros
266 struct esw2 {
267 __u8 zero0;
268 __u8 lpum;
269 __u16 dcti;
270 struct erw erw;
271 __u32 zeros[3];
272 } __attribute__ ((packed));
275 * struct esw3 - Format 3 Extended Status Word (ESW)
276 * @zero0: reserved zeros
277 * @lpum: last path used mask
278 * @res: reserved
279 * @erw: extended report word
280 * @zeros: three fullwords of zeros
282 struct esw3 {
283 __u8 zero0;
284 __u8 lpum;
285 __u16 res;
286 struct erw erw;
287 __u32 zeros[3];
288 } __attribute__ ((packed));
291 * struct irb - interruption response block
292 * @scsw: subchannel status word
293 * @esw: extened status word, 4 formats
294 * @ecw: extended control word
296 * The irb that is handed to the device driver when an interrupt occurs. For
297 * solicited interrupts, the common I/O layer already performs checks whether
298 * a field is valid; a field not being valid is always passed as %0.
299 * If a unit check occured, @ecw may contain sense data; this is retrieved
300 * by the common I/O layer itself if the device doesn't support concurrent
301 * sense (so that the device driver never needs to perform basic sene itself).
302 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
303 * if applicable).
305 struct irb {
306 struct scsw scsw;
307 union {
308 struct esw0 esw0;
309 struct esw1 esw1;
310 struct esw2 esw2;
311 struct esw3 esw3;
312 } esw;
313 __u8 ecw[32];
314 } __attribute__ ((packed,aligned(4)));
317 * struct ciw - command information word (CIW) layout
318 * @et: entry type
319 * @reserved: reserved bits
320 * @ct: command type
321 * @cmd: command code
322 * @count: command count
324 struct ciw {
325 __u32 et : 2;
326 __u32 reserved : 2;
327 __u32 ct : 4;
328 __u32 cmd : 8;
329 __u32 count : 16;
330 } __attribute__ ((packed));
332 #define CIW_TYPE_RCD 0x0 /* read configuration data */
333 #define CIW_TYPE_SII 0x1 /* set interface identifier */
334 #define CIW_TYPE_RNI 0x2 /* read node identifier */
337 * Flags used as input parameters for do_IO()
339 #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
340 #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
341 #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
342 /* ... for suspended CCWs */
343 /* Device or subchannel gone. */
344 #define CIO_GONE 0x0001
345 /* No path to device. */
346 #define CIO_NO_PATH 0x0002
347 /* Device has appeared. */
348 #define CIO_OPER 0x0004
349 /* Sick revalidation of device. */
350 #define CIO_REVALIDATE 0x0008
353 * struct ccw_dev_id - unique identifier for ccw devices
354 * @ssid: subchannel set id
355 * @devno: device number
357 * This structure is not directly based on any hardware structure. The
358 * hardware identifies a device by its device number and its subchannel,
359 * which is in turn identified by its id. In order to get a unique identifier
360 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
361 * introduced.
363 struct ccw_dev_id {
364 u8 ssid;
365 u16 devno;
369 * ccw_device_id_is_equal() - compare two ccw_dev_ids
370 * @dev_id1: a ccw_dev_id
371 * @dev_id2: another ccw_dev_id
372 * Returns:
373 * %1 if the two structures are equal field-by-field,
374 * %0 if not.
375 * Context:
376 * any
378 static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
379 struct ccw_dev_id *dev_id2)
381 if ((dev_id1->ssid == dev_id2->ssid) &&
382 (dev_id1->devno == dev_id2->devno))
383 return 1;
384 return 0;
387 extern void wait_cons_dev(void);
389 extern void css_schedule_reprobe(void);
391 extern void reipl_ccw_dev(struct ccw_dev_id *id);
393 struct cio_iplinfo {
394 u16 devno;
395 int is_qdio;
398 extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
400 #endif
402 #endif