]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blob - arch/s390/include/asm/cio.h
ARM: davinci: da850: generate dtbs for da850 boards
[can-eth-gw-linux.git] / arch / s390 / include / asm / cio.h
1 /*
2  * Common interface for I/O on S/390
3  */
4 #ifndef _ASM_S390_CIO_H_
5 #define _ASM_S390_CIO_H_
6
7 #include <linux/spinlock.h>
8 #include <asm/types.h>
9
10 #define LPM_ANYPATH 0xff
11 #define __MAX_CSSID 0
12
13 #include <asm/scsw.h>
14
15 /**
16  * struct ccw1 - channel command word
17  * @cmd_code: command code
18  * @flags: flags, like IDA addressing, etc.
19  * @count: byte count
20  * @cda: data address
21  *
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.
25  */
26 struct ccw1 {
27         __u8  cmd_code;
28         __u8  flags;
29         __u16 count;
30         __u32 cda;
31 } __attribute__ ((packed,aligned(8)));
32
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
40
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
53
54 #define SENSE_MAX_COUNT         0x20
55
56 /**
57  * struct erw - extended report word
58  * @res0: reserved
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
67  * @res16: reserved
68  */
69 struct erw {
70         __u32 res0  : 3;
71         __u32 auth  : 1;
72         __u32 pvrf  : 1;
73         __u32 cpt   : 1;
74         __u32 fsavf : 1;
75         __u32 cons  : 1;
76         __u32 scavf : 1;
77         __u32 fsaf  : 1;
78         __u32 scnt  : 6;
79         __u32 res16 : 16;
80 } __attribute__ ((packed));
81
82 /**
83  * struct erw_eadm - EADM Subchannel extended report word
84  * @b: aob error
85  * @r: arsb error
86  */
87 struct erw_eadm {
88         __u32 : 16;
89         __u32 b : 1;
90         __u32 r : 1;
91         __u32  : 14;
92 } __packed;
93
94 /**
95  * struct sublog - subchannel logout area
96  * @res0: reserved
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
107  */
108 struct sublog {
109         __u32 res0  : 1;
110         __u32 esf   : 7;
111         __u32 lpum  : 8;
112         __u32 arep  : 1;
113         __u32 fvf   : 5;
114         __u32 sacc  : 2;
115         __u32 termc : 2;
116         __u32 devsc : 1;
117         __u32 serr  : 1;
118         __u32 ioerr : 1;
119         __u32 seqc  : 3;
120 } __attribute__ ((packed));
121
122 /**
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
128  */
129 struct esw0 {
130         struct sublog sublog;
131         struct erw erw;
132         __u32  faddr[2];
133         __u32  saddr;
134 } __attribute__ ((packed));
135
136 /**
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
143  */
144 struct esw1 {
145         __u8  zero0;
146         __u8  lpum;
147         __u16 zero16;
148         struct erw erw;
149         __u32 zeros[3];
150 } __attribute__ ((packed));
151
152 /**
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
159  */
160 struct esw2 {
161         __u8  zero0;
162         __u8  lpum;
163         __u16 dcti;
164         struct erw erw;
165         __u32 zeros[3];
166 } __attribute__ ((packed));
167
168 /**
169  * struct esw3 - Format 3 Extended Status Word (ESW)
170  * @zero0: reserved zeros
171  * @lpum: last path used mask
172  * @res: reserved
173  * @erw: extended report word
174  * @zeros: three fullwords of zeros
175  */
176 struct esw3 {
177         __u8  zero0;
178         __u8  lpum;
179         __u16 res;
180         struct erw erw;
181         __u32 zeros[3];
182 } __attribute__ ((packed));
183
184 /**
185  * struct esw_eadm - EADM Subchannel Extended Status Word (ESW)
186  * @sublog: subchannel logout
187  * @erw: extended report word
188  */
189 struct esw_eadm {
190         __u32 sublog;
191         struct erw_eadm erw;
192         __u32 : 32;
193         __u32 : 32;
194         __u32 : 32;
195 } __packed;
196
197 /**
198  * struct irb - interruption response block
199  * @scsw: subchannel status word
200  * @esw: extened status word
201  * @ecw: extended control word
202  *
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,
210  * if applicable).
211  */
212 struct irb {
213         union scsw scsw;
214         union {
215                 struct esw0 esw0;
216                 struct esw1 esw1;
217                 struct esw2 esw2;
218                 struct esw3 esw3;
219                 struct esw_eadm eadm;
220         } esw;
221         __u8   ecw[32];
222 } __attribute__ ((packed,aligned(4)));
223
224 /**
225  * struct ciw - command information word  (CIW) layout
226  * @et: entry type
227  * @reserved: reserved bits
228  * @ct: command type
229  * @cmd: command code
230  * @count: command count
231  */
232 struct ciw {
233         __u32 et       :  2;
234         __u32 reserved :  2;
235         __u32 ct       :  4;
236         __u32 cmd      :  8;
237         __u32 count    : 16;
238 } __attribute__ ((packed));
239
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 */
243
244 /*
245  * Flags used as input parameters for do_IO()
246  */
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
261
262 /**
263  * struct ccw_dev_id - unique identifier for ccw devices
264  * @ssid: subchannel set id
265  * @devno: device number
266  *
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
271  * introduced.
272  */
273 struct ccw_dev_id {
274         u8 ssid;
275         u16 devno;
276 };
277
278 /**
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
282  * Returns:
283  *  %1 if the two structures are equal field-by-field,
284  *  %0 if not.
285  * Context:
286  *  any
287  */
288 static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
289                                       struct ccw_dev_id *dev_id2)
290 {
291         if ((dev_id1->ssid == dev_id2->ssid) &&
292             (dev_id1->devno == dev_id2->devno))
293                 return 1;
294         return 0;
295 }
296
297 extern void wait_cons_dev(void);
298
299 extern void css_schedule_reprobe(void);
300
301 extern void reipl_ccw_dev(struct ccw_dev_id *id);
302
303 struct cio_iplinfo {
304         u16 devno;
305         int is_qdio;
306 };
307
308 extern int cio_get_iplinfo(struct cio_iplinfo *iplinfo);
309
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);
313
314 #endif