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 sublog - subchannel logout area
85 * @esf: extended status flags
86 * @lpum: last path used mask
87 * @arep: ancillary report
88 * @fvf: field-validity flags
89 * @sacc: storage access code
90 * @termc: termination code
91 * @devsc: device-status check
92 * @serr: secondary error
93 * @ioerr: i/o-error alert
94 * @seqc: sequence code
108 } __attribute__ ((packed));
111 * struct esw0 - Format 0 Extended Status Word (ESW)
112 * @sublog: subchannel logout
113 * @erw: extended report word
114 * @faddr: failing storage address
115 * @saddr: secondary ccw address
118 struct sublog sublog;
122 } __attribute__ ((packed));
125 * struct esw1 - Format 1 Extended Status Word (ESW)
126 * @zero0: reserved zeros
127 * @lpum: last path used mask
128 * @zero16: reserved zeros
129 * @erw: extended report word
130 * @zeros: three fullwords of zeros
138 } __attribute__ ((packed));
141 * struct esw2 - Format 2 Extended Status Word (ESW)
142 * @zero0: reserved zeros
143 * @lpum: last path used mask
144 * @dcti: device-connect-time interval
145 * @erw: extended report word
146 * @zeros: three fullwords of zeros
154 } __attribute__ ((packed));
157 * struct esw3 - Format 3 Extended Status Word (ESW)
158 * @zero0: reserved zeros
159 * @lpum: last path used mask
161 * @erw: extended report word
162 * @zeros: three fullwords of zeros
170 } __attribute__ ((packed));
173 * struct irb - interruption response block
174 * @scsw: subchannel status word
175 * @esw: extened status word, 4 formats
176 * @ecw: extended control word
178 * The irb that is handed to the device driver when an interrupt occurs. For
179 * solicited interrupts, the common I/O layer already performs checks whether
180 * a field is valid; a field not being valid is always passed as %0.
181 * If a unit check occurred, @ecw may contain sense data; this is retrieved
182 * by the common I/O layer itself if the device doesn't support concurrent
183 * sense (so that the device driver never needs to perform basic sene itself).
184 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
196 } __attribute__ ((packed,aligned(4)));
199 * struct ciw - command information word (CIW) layout
201 * @reserved: reserved bits
204 * @count: command count
212 } __attribute__ ((packed));
214 #define CIW_TYPE_RCD 0x0 /* read configuration data */
215 #define CIW_TYPE_SII 0x1 /* set interface identifier */
216 #define CIW_TYPE_RNI 0x2 /* read node identifier */
219 * Flags used as input parameters for do_IO()
221 #define DOIO_ALLOW_SUSPEND 0x0001 /* allow for channel prog. suspend */
222 #define DOIO_DENY_PREFETCH 0x0002 /* don't allow for CCW prefetch */
223 #define DOIO_SUPPRESS_INTER 0x0004 /* suppress intermediate inter. */
224 /* ... for suspended CCWs */
225 /* Device or subchannel gone. */
226 #define CIO_GONE 0x0001
227 /* No path to device. */
228 #define CIO_NO_PATH 0x0002
229 /* Device has appeared. */
230 #define CIO_OPER 0x0004
231 /* Sick revalidation of device. */
232 #define CIO_REVALIDATE 0x0008
233 /* Device did not respond in time. */
234 #define CIO_BOXED 0x0010
237 * struct ccw_dev_id - unique identifier for ccw devices
238 * @ssid: subchannel set id
239 * @devno: device number
241 * This structure is not directly based on any hardware structure. The
242 * hardware identifies a device by its device number and its subchannel,
243 * which is in turn identified by its id. In order to get a unique identifier
244 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
253 * ccw_device_id_is_equal() - compare two ccw_dev_ids
254 * @dev_id1: a ccw_dev_id
255 * @dev_id2: another ccw_dev_id
257 * %1 if the two structures are equal field-by-field,
262 static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
263 struct ccw_dev_id *dev_id2)
265 if ((dev_id1->ssid == dev_id2->ssid) &&
266 (dev_id1->devno == dev_id2->devno))
271 extern void wait_cons_dev(void);
273 extern void css_schedule_reprobe(void);
275 extern void reipl_ccw_dev(struct ccw_dev_id *id);
282 extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
284 /* Function from drivers/s390/cio/chsc.c */
285 int chsc_sstpc(void *page, unsigned int op, u16 ctrl);
286 int chsc_sstpi(void *page, void *result, size_t size);