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>
13 #define LPM_ANYPATH 0xff
19 * struct ccw1 - channel command word
20 * @cmd_code: command code
21 * @flags: flags, like IDA addressing, etc.
25 * The ccw is the basic structure to build channel programs that perform
26 * operations with the device or the control unit. Only Format-1 channel
27 * command words are supported.
34 } __attribute__ ((packed,aligned(8)));
36 #define CCW_FLAG_DC 0x80
37 #define CCW_FLAG_CC 0x40
38 #define CCW_FLAG_SLI 0x20
39 #define CCW_FLAG_SKIP 0x10
40 #define CCW_FLAG_PCI 0x08
41 #define CCW_FLAG_IDA 0x04
42 #define CCW_FLAG_SUSPEND 0x02
44 #define CCW_CMD_READ_IPL 0x02
45 #define CCW_CMD_NOOP 0x03
46 #define CCW_CMD_BASIC_SENSE 0x04
47 #define CCW_CMD_TIC 0x08
48 #define CCW_CMD_STLCK 0x14
49 #define CCW_CMD_SENSE_PGID 0x34
50 #define CCW_CMD_SUSPEND_RECONN 0x5B
51 #define CCW_CMD_RDC 0x64
52 #define CCW_CMD_RELEASE 0x94
53 #define CCW_CMD_SET_PGID 0xAF
54 #define CCW_CMD_SENSE_ID 0xE4
55 #define CCW_CMD_DCTL 0xF3
57 #define SENSE_MAX_COUNT 0x20
60 * struct erw - extended report word
62 * @auth: authorization check
63 * @pvrf: path-verification-required flag
64 * @cpt: channel-path timeout
65 * @fsavf: failing storage address validity flag
66 * @cons: concurrent sense
67 * @scavf: secondary ccw address validity flag
68 * @fsaf: failing storage address format
69 * @scnt: sense count, if @cons == %1
83 } __attribute__ ((packed));
86 * struct sublog - subchannel logout area
88 * @esf: extended status flags
89 * @lpum: last path used mask
90 * @arep: ancillary report
91 * @fvf: field-validity flags
92 * @sacc: storage access code
93 * @termc: termination code
94 * @devsc: device-status check
95 * @serr: secondary error
96 * @ioerr: i/o-error alert
97 * @seqc: sequence code
111 } __attribute__ ((packed));
114 * struct esw0 - Format 0 Extended Status Word (ESW)
115 * @sublog: subchannel logout
116 * @erw: extended report word
117 * @faddr: failing storage address
118 * @saddr: secondary ccw address
121 struct sublog sublog;
125 } __attribute__ ((packed));
128 * struct esw1 - Format 1 Extended Status Word (ESW)
129 * @zero0: reserved zeros
130 * @lpum: last path used mask
131 * @zero16: reserved zeros
132 * @erw: extended report word
133 * @zeros: three fullwords of zeros
141 } __attribute__ ((packed));
144 * struct esw2 - Format 2 Extended Status Word (ESW)
145 * @zero0: reserved zeros
146 * @lpum: last path used mask
147 * @dcti: device-connect-time interval
148 * @erw: extended report word
149 * @zeros: three fullwords of zeros
157 } __attribute__ ((packed));
160 * struct esw3 - Format 3 Extended Status Word (ESW)
161 * @zero0: reserved zeros
162 * @lpum: last path used mask
164 * @erw: extended report word
165 * @zeros: three fullwords of zeros
173 } __attribute__ ((packed));
176 * struct irb - interruption response block
177 * @scsw: subchannel status word
178 * @esw: extened status word, 4 formats
179 * @ecw: extended control word
181 * The irb that is handed to the device driver when an interrupt occurs. For
182 * solicited interrupts, the common I/O layer already performs checks whether
183 * a field is valid; a field not being valid is always passed as %0.
184 * If a unit check occurred, @ecw may contain sense data; this is retrieved
185 * by the common I/O layer itself if the device doesn't support concurrent
186 * sense (so that the device driver never needs to perform basic sene itself).
187 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
199 } __attribute__ ((packed,aligned(4)));
202 * struct ciw - command information word (CIW) layout
204 * @reserved: reserved bits
207 * @count: command count
215 } __attribute__ ((packed));
217 #define CIW_TYPE_RCD 0x0 /* read configuration data */
218 #define CIW_TYPE_SII 0x1 /* set interface identifier */
219 #define CIW_TYPE_RNI 0x2 /* read node identifier */
222 * Flags used as input parameters for do_IO()
224 #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
225 #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
226 #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
227 /* ... for suspended CCWs */
228 /* Device or subchannel gone. */
229 #define CIO_GONE 0x0001
230 /* No path to device. */
231 #define CIO_NO_PATH 0x0002
232 /* Device has appeared. */
233 #define CIO_OPER 0x0004
234 /* Sick revalidation of device. */
235 #define CIO_REVALIDATE 0x0008
236 /* Device did not respond in time. */
237 #define CIO_BOXED 0x0010
240 * struct ccw_dev_id - unique identifier for ccw devices
241 * @ssid: subchannel set id
242 * @devno: device number
244 * This structure is not directly based on any hardware structure. The
245 * hardware identifies a device by its device number and its subchannel,
246 * which is in turn identified by its id. In order to get a unique identifier
247 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
256 * ccw_device_id_is_equal() - compare two ccw_dev_ids
257 * @dev_id1: a ccw_dev_id
258 * @dev_id2: another ccw_dev_id
260 * %1 if the two structures are equal field-by-field,
265 static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
266 struct ccw_dev_id *dev_id2)
268 if ((dev_id1->ssid == dev_id2->ssid) &&
269 (dev_id1->devno == dev_id2->devno))
274 extern void wait_cons_dev(void);
276 extern void css_schedule_reprobe(void);
278 extern void reipl_ccw_dev(struct ccw_dev_id *id);
285 extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
287 /* Function from drivers/s390/cio/chsc.c */
288 int chsc_sstpc(void *page, unsigned int op, u16 ctrl);
289 int chsc_sstpi(void *page, void *result, size_t size);