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>
8 #include <linux/bitops.h>
11 #define LPM_ANYPATH 0xff
13 #define __MAX_SUBCHANNEL 65535
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 erw_eadm - EADM Subchannel extended report word
98 * struct sublog - subchannel logout area
100 * @esf: extended status flags
101 * @lpum: last path used mask
102 * @arep: ancillary report
103 * @fvf: field-validity flags
104 * @sacc: storage access code
105 * @termc: termination code
106 * @devsc: device-status check
107 * @serr: secondary error
108 * @ioerr: i/o-error alert
109 * @seqc: sequence code
123 } __attribute__ ((packed
));
126 * struct esw0 - Format 0 Extended Status Word (ESW)
127 * @sublog: subchannel logout
128 * @erw: extended report word
129 * @faddr: failing storage address
130 * @saddr: secondary ccw address
133 struct sublog sublog
;
137 } __attribute__ ((packed
));
140 * struct esw1 - Format 1 Extended Status Word (ESW)
141 * @zero0: reserved zeros
142 * @lpum: last path used mask
143 * @zero16: reserved zeros
144 * @erw: extended report word
145 * @zeros: three fullwords of zeros
153 } __attribute__ ((packed
));
156 * struct esw2 - Format 2 Extended Status Word (ESW)
157 * @zero0: reserved zeros
158 * @lpum: last path used mask
159 * @dcti: device-connect-time interval
160 * @erw: extended report word
161 * @zeros: three fullwords of zeros
169 } __attribute__ ((packed
));
172 * struct esw3 - Format 3 Extended Status Word (ESW)
173 * @zero0: reserved zeros
174 * @lpum: last path used mask
176 * @erw: extended report word
177 * @zeros: three fullwords of zeros
185 } __attribute__ ((packed
));
188 * struct esw_eadm - EADM Subchannel Extended Status Word (ESW)
189 * @sublog: subchannel logout
190 * @erw: extended report word
201 * struct irb - interruption response block
202 * @scsw: subchannel status word
203 * @esw: extended status word
204 * @ecw: extended control word
206 * The irb that is handed to the device driver when an interrupt occurs. For
207 * solicited interrupts, the common I/O layer already performs checks whether
208 * a field is valid; a field not being valid is always passed as %0.
209 * If a unit check occurred, @ecw may contain sense data; this is retrieved
210 * by the common I/O layer itself if the device doesn't support concurrent
211 * sense (so that the device driver never needs to perform basic sene itself).
212 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
222 struct esw_eadm eadm
;
225 } __attribute__ ((packed
,aligned(4)));
228 * struct ciw - command information word (CIW) layout
230 * @reserved: reserved bits
233 * @count: command count
241 } __attribute__ ((packed
));
243 #define CIW_TYPE_RCD 0x0 /* read configuration data */
244 #define CIW_TYPE_SII 0x1 /* set interface identifier */
245 #define CIW_TYPE_RNI 0x2 /* read node identifier */
248 * Flags used as input parameters for do_IO()
250 #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
251 #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
252 #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
253 /* ... for suspended CCWs */
254 /* Device or subchannel gone. */
255 #define CIO_GONE 0x0001
256 /* No path to device. */
257 #define CIO_NO_PATH 0x0002
258 /* Device has appeared. */
259 #define CIO_OPER 0x0004
260 /* Sick revalidation of device. */
261 #define CIO_REVALIDATE 0x0008
262 /* Device did not respond in time. */
263 #define CIO_BOXED 0x0010
266 * struct ccw_dev_id - unique identifier for ccw devices
267 * @ssid: subchannel set id
268 * @devno: device number
270 * This structure is not directly based on any hardware structure. The
271 * hardware identifies a device by its device number and its subchannel,
272 * which is in turn identified by its id. In order to get a unique identifier
273 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
282 * ccw_device_id_is_equal() - compare two ccw_dev_ids
283 * @dev_id1: a ccw_dev_id
284 * @dev_id2: another ccw_dev_id
286 * %1 if the two structures are equal field-by-field,
291 static inline int ccw_dev_id_is_equal(struct ccw_dev_id
*dev_id1
,
292 struct ccw_dev_id
*dev_id2
)
294 if ((dev_id1
->ssid
== dev_id2
->ssid
) &&
295 (dev_id1
->devno
== dev_id2
->devno
))
301 * pathmask_to_pos() - find the position of the left-most bit in a pathmask
302 * @mask: pathmask with at least one bit set
304 static inline u8
pathmask_to_pos(u8 mask
)
306 return 8 - ffs(mask
);
309 void channel_subsystem_reinit(void);
310 extern void css_schedule_reprobe(void);
312 extern void reipl_ccw_dev(struct ccw_dev_id
*id
);
320 extern int cio_get_iplinfo(struct cio_iplinfo
*iplinfo
);
322 /* Function from drivers/s390/cio/chsc.c */
323 int chsc_sstpc(void *page
, unsigned int op
, u16 ctrl
);
324 int chsc_sstpi(void *page
, void *result
, size_t size
);