2 * Common interface for I/O on S/390
4 #ifndef _ASM_S390_CIO_H_
5 #define _ASM_S390_CIO_H_
7 #include <linux/spinlock.h>
10 #define LPM_ANYPATH 0xff
16 * struct ccw1 - channel command word
17 * @cmd_code: command code
18 * @flags: flags, like IDA addressing, etc.
22 * The ccw is the basic structure to build channel programs that perform
23 * operations with the device or the control unit. Only Format-1 channel
24 * command words are supported.
31 } __attribute__ ((packed,aligned(8)));
33 #define CCW_FLAG_DC 0x80
34 #define CCW_FLAG_CC 0x40
35 #define CCW_FLAG_SLI 0x20
36 #define CCW_FLAG_SKIP 0x10
37 #define CCW_FLAG_PCI 0x08
38 #define CCW_FLAG_IDA 0x04
39 #define CCW_FLAG_SUSPEND 0x02
41 #define CCW_CMD_READ_IPL 0x02
42 #define CCW_CMD_NOOP 0x03
43 #define CCW_CMD_BASIC_SENSE 0x04
44 #define CCW_CMD_TIC 0x08
45 #define CCW_CMD_STLCK 0x14
46 #define CCW_CMD_SENSE_PGID 0x34
47 #define CCW_CMD_SUSPEND_RECONN 0x5B
48 #define CCW_CMD_RDC 0x64
49 #define CCW_CMD_RELEASE 0x94
50 #define CCW_CMD_SET_PGID 0xAF
51 #define CCW_CMD_SENSE_ID 0xE4
52 #define CCW_CMD_DCTL 0xF3
54 #define SENSE_MAX_COUNT 0x20
57 * struct erw - extended report word
59 * @auth: authorization check
60 * @pvrf: path-verification-required flag
61 * @cpt: channel-path timeout
62 * @fsavf: failing storage address validity flag
63 * @cons: concurrent sense
64 * @scavf: secondary ccw address validity flag
65 * @fsaf: failing storage address format
66 * @scnt: sense count, if @cons == %1
80 } __attribute__ ((packed));
83 * struct erw_eadm - EADM Subchannel extended report word
95 * struct sublog - subchannel logout area
97 * @esf: extended status flags
98 * @lpum: last path used mask
99 * @arep: ancillary report
100 * @fvf: field-validity flags
101 * @sacc: storage access code
102 * @termc: termination code
103 * @devsc: device-status check
104 * @serr: secondary error
105 * @ioerr: i/o-error alert
106 * @seqc: sequence code
120 } __attribute__ ((packed));
123 * struct esw0 - Format 0 Extended Status Word (ESW)
124 * @sublog: subchannel logout
125 * @erw: extended report word
126 * @faddr: failing storage address
127 * @saddr: secondary ccw address
130 struct sublog sublog;
134 } __attribute__ ((packed));
137 * struct esw1 - Format 1 Extended Status Word (ESW)
138 * @zero0: reserved zeros
139 * @lpum: last path used mask
140 * @zero16: reserved zeros
141 * @erw: extended report word
142 * @zeros: three fullwords of zeros
150 } __attribute__ ((packed));
153 * struct esw2 - Format 2 Extended Status Word (ESW)
154 * @zero0: reserved zeros
155 * @lpum: last path used mask
156 * @dcti: device-connect-time interval
157 * @erw: extended report word
158 * @zeros: three fullwords of zeros
166 } __attribute__ ((packed));
169 * struct esw3 - Format 3 Extended Status Word (ESW)
170 * @zero0: reserved zeros
171 * @lpum: last path used mask
173 * @erw: extended report word
174 * @zeros: three fullwords of zeros
182 } __attribute__ ((packed));
185 * struct esw_eadm - EADM Subchannel Extended Status Word (ESW)
186 * @sublog: subchannel logout
187 * @erw: extended report word
198 * struct irb - interruption response block
199 * @scsw: subchannel status word
200 * @esw: extened status word
201 * @ecw: extended control word
203 * The irb that is handed to the device driver when an interrupt occurs. For
204 * solicited interrupts, the common I/O layer already performs checks whether
205 * a field is valid; a field not being valid is always passed as %0.
206 * If a unit check occurred, @ecw may contain sense data; this is retrieved
207 * by the common I/O layer itself if the device doesn't support concurrent
208 * sense (so that the device driver never needs to perform basic sene itself).
209 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
219 struct esw_eadm eadm;
222 } __attribute__ ((packed,aligned(4)));
225 * struct ciw - command information word (CIW) layout
227 * @reserved: reserved bits
230 * @count: command count
238 } __attribute__ ((packed));
240 #define CIW_TYPE_RCD 0x0 /* read configuration data */
241 #define CIW_TYPE_SII 0x1 /* set interface identifier */
242 #define CIW_TYPE_RNI 0x2 /* read node identifier */
245 * Flags used as input parameters for do_IO()
247 #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
248 #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
249 #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
250 /* ... for suspended CCWs */
251 /* Device or subchannel gone. */
252 #define CIO_GONE 0x0001
253 /* No path to device. */
254 #define CIO_NO_PATH 0x0002
255 /* Device has appeared. */
256 #define CIO_OPER 0x0004
257 /* Sick revalidation of device. */
258 #define CIO_REVALIDATE 0x0008
259 /* Device did not respond in time. */
260 #define CIO_BOXED 0x0010
263 * struct ccw_dev_id - unique identifier for ccw devices
264 * @ssid: subchannel set id
265 * @devno: device number
267 * This structure is not directly based on any hardware structure. The
268 * hardware identifies a device by its device number and its subchannel,
269 * which is in turn identified by its id. In order to get a unique identifier
270 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
279 * ccw_device_id_is_equal() - compare two ccw_dev_ids
280 * @dev_id1: a ccw_dev_id
281 * @dev_id2: another ccw_dev_id
283 * %1 if the two structures are equal field-by-field,
288 static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
289 struct ccw_dev_id *dev_id2)
291 if ((dev_id1->ssid == dev_id2->ssid) &&
292 (dev_id1->devno == dev_id2->devno))
297 extern void wait_cons_dev(void);
299 extern void css_schedule_reprobe(void);
301 extern void reipl_ccw_dev(struct ccw_dev_id *id);
308 extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
310 /* Function from drivers/s390/cio/chsc.c */
311 int chsc_sstpc(void *page, unsigned int op, u16 ctrl);
312 int chsc_sstpi(void *page, void *result, size_t size);