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
21 * struct ccw1 - channel command word
22 * @cmd_code: command code
23 * @flags: flags, like IDA addressing, etc.
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.
36 } __attribute__ ((packed
,aligned(8)));
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
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
59 #define SENSE_MAX_COUNT 0x20
62 * struct erw - extended report word
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
85 } __attribute__ ((packed
));
88 * struct sublog - subchannel logout area
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
113 } __attribute__ ((packed
));
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
123 struct sublog sublog
;
127 } __attribute__ ((packed
));
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
143 } __attribute__ ((packed
));
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
159 } __attribute__ ((packed
));
162 * struct esw3 - Format 3 Extended Status Word (ESW)
163 * @zero0: reserved zeros
164 * @lpum: last path used mask
166 * @erw: extended report word
167 * @zeros: three fullwords of zeros
175 } __attribute__ ((packed
));
178 * struct irb - interruption response block
179 * @scsw: subchannel status word
180 * @esw: extened status word, 4 formats
181 * @ecw: extended control word
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 occurred, @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,
201 } __attribute__ ((packed
,aligned(4)));
204 * struct ciw - command information word (CIW) layout
206 * @reserved: reserved bits
209 * @count: command count
217 } __attribute__ ((packed
));
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 */
224 * Flags used as input parameters for do_IO()
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
238 /* Device did not respond in time. */
239 #define CIO_BOXED 0x0010
242 * struct ccw_dev_id - unique identifier for ccw devices
243 * @ssid: subchannel set id
244 * @devno: device number
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
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
262 * %1 if the two structures are equal field-by-field,
267 static inline int ccw_dev_id_is_equal(struct ccw_dev_id
*dev_id1
,
268 struct ccw_dev_id
*dev_id2
)
270 if ((dev_id1
->ssid
== dev_id2
->ssid
) &&
271 (dev_id1
->devno
== dev_id2
->devno
))
276 extern void wait_cons_dev(void);
278 extern void css_schedule_reprobe(void);
280 extern void reipl_ccw_dev(struct ccw_dev_id
*id
);
287 extern int cio_get_iplinfo(struct cio_iplinfo
*iplinfo
);
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
);