2 * include/asm-s390/cio.h
3 * include/asm-s390x/cio.h
5 * Common interface for I/O on S/390
7 #ifndef _ASM_S390_CIO_H_
8 #define _ASM_S390_CIO_H_
10 #include <linux/spinlock.h>
11 #include <asm/types.h>
15 #define LPM_ANYPATH 0xff
19 * struct scsw - subchannel status word
20 * @key: subchannel key
21 * @sctl: suspend control
23 * @cc: deferred condition code
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
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
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.
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.
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
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
198 } __attribute__ ((packed));
201 * struct sublog - subchannel logout area
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
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
236 struct sublog sublog;
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
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
272 } __attribute__ ((packed));
275 * struct esw3 - Format 3 Extended Status Word (ESW)
276 * @zero0: reserved zeros
277 * @lpum: last path used mask
279 * @erw: extended report word
280 * @zeros: three fullwords of zeros
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,
314 } __attribute__ ((packed,aligned(4)));
317 * struct ciw - command information word (CIW) layout
319 * @reserved: reserved bits
322 * @count: command count
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
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
373 * %1 if the two structures are equal field-by-field,
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))
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);
398 extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
400 /* Function from drivers/s390/cio/chsc.c */
401 int chsc_sstpc(void *page, unsigned int op, u16 ctrl);
402 int chsc_sstpi(void *page, void *result, size_t size);