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
12 #define __MAX_SUBCHANNEL 65535
18 * struct ccw1 - channel command word
19 * @cmd_code: command code
20 * @flags: flags, like IDA addressing, etc.
24 * The ccw is the basic structure to build channel programs that perform
25 * operations with the device or the control unit. Only Format-1 channel
26 * command words are supported.
33 } __attribute__ ((packed
,aligned(8)));
35 #define CCW_FLAG_DC 0x80
36 #define CCW_FLAG_CC 0x40
37 #define CCW_FLAG_SLI 0x20
38 #define CCW_FLAG_SKIP 0x10
39 #define CCW_FLAG_PCI 0x08
40 #define CCW_FLAG_IDA 0x04
41 #define CCW_FLAG_SUSPEND 0x02
43 #define CCW_CMD_READ_IPL 0x02
44 #define CCW_CMD_NOOP 0x03
45 #define CCW_CMD_BASIC_SENSE 0x04
46 #define CCW_CMD_TIC 0x08
47 #define CCW_CMD_STLCK 0x14
48 #define CCW_CMD_SENSE_PGID 0x34
49 #define CCW_CMD_SUSPEND_RECONN 0x5B
50 #define CCW_CMD_RDC 0x64
51 #define CCW_CMD_RELEASE 0x94
52 #define CCW_CMD_SET_PGID 0xAF
53 #define CCW_CMD_SENSE_ID 0xE4
54 #define CCW_CMD_DCTL 0xF3
56 #define SENSE_MAX_COUNT 0x20
59 * struct erw - extended report word
61 * @auth: authorization check
62 * @pvrf: path-verification-required flag
63 * @cpt: channel-path timeout
64 * @fsavf: failing storage address validity flag
65 * @cons: concurrent sense
66 * @scavf: secondary ccw address validity flag
67 * @fsaf: failing storage address format
68 * @scnt: sense count, if @cons == %1
82 } __attribute__ ((packed
));
85 * struct erw_eadm - EADM Subchannel extended report word
97 * struct sublog - subchannel logout area
99 * @esf: extended status flags
100 * @lpum: last path used mask
101 * @arep: ancillary report
102 * @fvf: field-validity flags
103 * @sacc: storage access code
104 * @termc: termination code
105 * @devsc: device-status check
106 * @serr: secondary error
107 * @ioerr: i/o-error alert
108 * @seqc: sequence code
122 } __attribute__ ((packed
));
125 * struct esw0 - Format 0 Extended Status Word (ESW)
126 * @sublog: subchannel logout
127 * @erw: extended report word
128 * @faddr: failing storage address
129 * @saddr: secondary ccw address
132 struct sublog sublog
;
136 } __attribute__ ((packed
));
139 * struct esw1 - Format 1 Extended Status Word (ESW)
140 * @zero0: reserved zeros
141 * @lpum: last path used mask
142 * @zero16: reserved zeros
143 * @erw: extended report word
144 * @zeros: three fullwords of zeros
152 } __attribute__ ((packed
));
155 * struct esw2 - Format 2 Extended Status Word (ESW)
156 * @zero0: reserved zeros
157 * @lpum: last path used mask
158 * @dcti: device-connect-time interval
159 * @erw: extended report word
160 * @zeros: three fullwords of zeros
168 } __attribute__ ((packed
));
171 * struct esw3 - Format 3 Extended Status Word (ESW)
172 * @zero0: reserved zeros
173 * @lpum: last path used mask
175 * @erw: extended report word
176 * @zeros: three fullwords of zeros
184 } __attribute__ ((packed
));
187 * struct esw_eadm - EADM Subchannel Extended Status Word (ESW)
188 * @sublog: subchannel logout
189 * @erw: extended report word
200 * struct irb - interruption response block
201 * @scsw: subchannel status word
202 * @esw: extended status word
203 * @ecw: extended control word
205 * The irb that is handed to the device driver when an interrupt occurs. For
206 * solicited interrupts, the common I/O layer already performs checks whether
207 * a field is valid; a field not being valid is always passed as %0.
208 * If a unit check occurred, @ecw may contain sense data; this is retrieved
209 * by the common I/O layer itself if the device doesn't support concurrent
210 * sense (so that the device driver never needs to perform basic sene itself).
211 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
221 struct esw_eadm eadm
;
224 } __attribute__ ((packed
,aligned(4)));
227 * struct ciw - command information word (CIW) layout
229 * @reserved: reserved bits
232 * @count: command count
240 } __attribute__ ((packed
));
242 #define CIW_TYPE_RCD 0x0 /* read configuration data */
243 #define CIW_TYPE_SII 0x1 /* set interface identifier */
244 #define CIW_TYPE_RNI 0x2 /* read node identifier */
247 * Flags used as input parameters for do_IO()
249 #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
250 #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
251 #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
252 /* ... for suspended CCWs */
253 /* Device or subchannel gone. */
254 #define CIO_GONE 0x0001
255 /* No path to device. */
256 #define CIO_NO_PATH 0x0002
257 /* Device has appeared. */
258 #define CIO_OPER 0x0004
259 /* Sick revalidation of device. */
260 #define CIO_REVALIDATE 0x0008
261 /* Device did not respond in time. */
262 #define CIO_BOXED 0x0010
265 * struct ccw_dev_id - unique identifier for ccw devices
266 * @ssid: subchannel set id
267 * @devno: device number
269 * This structure is not directly based on any hardware structure. The
270 * hardware identifies a device by its device number and its subchannel,
271 * which is in turn identified by its id. In order to get a unique identifier
272 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
281 * ccw_device_id_is_equal() - compare two ccw_dev_ids
282 * @dev_id1: a ccw_dev_id
283 * @dev_id2: another ccw_dev_id
285 * %1 if the two structures are equal field-by-field,
290 static inline int ccw_dev_id_is_equal(struct ccw_dev_id
*dev_id1
,
291 struct ccw_dev_id
*dev_id2
)
293 if ((dev_id1
->ssid
== dev_id2
->ssid
) &&
294 (dev_id1
->devno
== dev_id2
->devno
))
299 void channel_subsystem_reinit(void);
300 extern void css_schedule_reprobe(void);
302 extern void reipl_ccw_dev(struct ccw_dev_id
*id
);
309 extern int cio_get_iplinfo(struct cio_iplinfo
*iplinfo
);
311 /* Function from drivers/s390/cio/chsc.c */
312 int chsc_sstpc(void *page
, unsigned int op
, u16 ctrl
);
313 int chsc_sstpi(void *page
, void *result
, size_t size
);