aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-s390/ccwdev.h75
-rw-r--r--include/asm-s390/ccwgroup.h32
-rw-r--r--include/asm-s390/cio.h288
3 files changed, 260 insertions, 135 deletions
diff --git a/include/asm-s390/ccwdev.h b/include/asm-s390/ccwdev.h
index 1aeda27d5a8b..8e961aa4b394 100644
--- a/include/asm-s390/ccwdev.h
+++ b/include/asm-s390/ccwdev.h
@@ -67,36 +67,53 @@ ccw_device_id_match(const struct ccw_device_id *array,
67 return NULL; 67 return NULL;
68} 68}
69 69
70/* The struct ccw device is our replacement for the globally accessible 70/**
71 * ioinfo array. ioinfo will mutate into a subchannel device later. 71 * struct ccw_device - channel attached device
72 * @ccwlock: pointer to device lock
73 * @id: id of this device
74 * @drv: ccw driver for this device
75 * @dev: embedded device structure
76 * @online: online status of device
77 * @handler: interrupt handler
72 * 78 *
73 * Reference: Documentation/s390/driver-model.txt */ 79 * @handler is a member of the device rather than the driver since a driver
80 * can have different interrupt handlers for different ccw devices
81 * (multi-subchannel drivers).
82 */
74struct ccw_device { 83struct ccw_device {
75 spinlock_t *ccwlock; 84 spinlock_t *ccwlock;
85/* private: */
76 struct ccw_device_private *private; /* cio private information */ 86 struct ccw_device_private *private; /* cio private information */
77 struct ccw_device_id id; /* id of this device, driver_info is 87/* public: */
78 set by ccw_find_driver */ 88 struct ccw_device_id id;
79 struct ccw_driver *drv; /* */ 89 struct ccw_driver *drv;
80 struct device dev; /* */ 90 struct device dev;
81 int online; 91 int online;
82 /* This is sick, but a driver can have different interrupt handlers
83 for different ccw_devices (multi-subchannel drivers)... */
84 void (*handler) (struct ccw_device *, unsigned long, struct irb *); 92 void (*handler) (struct ccw_device *, unsigned long, struct irb *);
85}; 93};
86 94
87 95
88/* Each ccw driver registers with the ccw root bus */ 96/**
97 * struct ccw driver - device driver for channel attached devices
98 * @owner: owning module
99 * @ids: ids supported by this driver
100 * @probe: function called on probe
101 * @remove: function called on remove
102 * @set_online: called when setting device online
103 * @set_offline: called when setting device offline
104 * @notify: notify driver of device state changes
105 * @driver: embedded device driver structure
106 * @name: device driver name
107 */
89struct ccw_driver { 108struct ccw_driver {
90 struct module *owner; /* for automatic MOD_INC_USE_COUNT */ 109 struct module *owner;
91 struct ccw_device_id *ids; /* probe driver with these devs */ 110 struct ccw_device_id *ids;
92 int (*probe) (struct ccw_device *); /* ask driver to probe dev */ 111 int (*probe) (struct ccw_device *);
93 void (*remove) (struct ccw_device *); 112 void (*remove) (struct ccw_device *);
94 /* device is no longer available */
95 int (*set_online) (struct ccw_device *); 113 int (*set_online) (struct ccw_device *);
96 int (*set_offline) (struct ccw_device *); 114 int (*set_offline) (struct ccw_device *);
97 int (*notify) (struct ccw_device *, int); 115 int (*notify) (struct ccw_device *, int);
98 struct device_driver driver; /* higher level structure, don't init 116 struct device_driver driver;
99 this from your driver */
100 char *name; 117 char *name;
101}; 118};
102 119
@@ -124,36 +141,10 @@ extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
124/* Allow forced onlining of boxed devices. */ 141/* Allow forced onlining of boxed devices. */
125#define CCWDEV_ALLOW_FORCE 0x0008 142#define CCWDEV_ALLOW_FORCE 0x0008
126 143
127/*
128 * ccw_device_start()
129 *
130 * Start a S/390 channel program. When the interrupt arrives, the
131 * IRQ handler is called, either immediately, delayed (dev-end missing,
132 * or sense required) or never (no IRQ handler registered).
133 * Depending on the action taken, ccw_device_start() returns:
134 * 0 - Success
135 * -EBUSY - Device busy, or status pending
136 * -ENODEV - Device not operational
137 * -EINVAL - Device invalid for operation
138 */
139extern int ccw_device_start(struct ccw_device *, struct ccw1 *, 144extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
140 unsigned long, __u8, unsigned long); 145 unsigned long, __u8, unsigned long);
141/*
142 * ccw_device_start_timeout()
143 *
144 * This function notifies the device driver if the channel program has not
145 * completed during the specified time. If a timeout occurs, the channel
146 * program is terminated via xsch(), hsch() or csch().
147 */
148extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *, 146extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *,
149 unsigned long, __u8, unsigned long, int); 147 unsigned long, __u8, unsigned long, int);
150/*
151 * ccw_device_start_key()
152 * ccw_device_start_key_timeout()
153 *
154 * Same as ccw_device_start() and ccw_device_start_timeout(), except a
155 * storage key != default key can be provided for the I/O.
156 */
157extern int ccw_device_start_key(struct ccw_device *, struct ccw1 *, 148extern int ccw_device_start_key(struct ccw_device *, struct ccw1 *,
158 unsigned long, __u8, __u8, unsigned long); 149 unsigned long, __u8, __u8, unsigned long);
159extern int ccw_device_start_timeout_key(struct ccw_device *, struct ccw1 *, 150extern int ccw_device_start_timeout_key(struct ccw_device *, struct ccw1 *,
diff --git a/include/asm-s390/ccwgroup.h b/include/asm-s390/ccwgroup.h
index 925b3ddfa141..7109c7cab87e 100644
--- a/include/asm-s390/ccwgroup.h
+++ b/include/asm-s390/ccwgroup.h
@@ -4,19 +4,41 @@
4struct ccw_device; 4struct ccw_device;
5struct ccw_driver; 5struct ccw_driver;
6 6
7/**
8 * struct ccwgroup_device - ccw group device
9 * @creator_id: unique number of the driver
10 * @state: online/offline state
11 * @count: number of attached slave devices
12 * @dev: embedded device structure
13 * @cdev: variable number of slave devices, allocated as needed
14 */
7struct ccwgroup_device { 15struct ccwgroup_device {
8 unsigned long creator_id; /* unique number of the driver */ 16 unsigned long creator_id;
9 enum { 17 enum {
10 CCWGROUP_OFFLINE, 18 CCWGROUP_OFFLINE,
11 CCWGROUP_ONLINE, 19 CCWGROUP_ONLINE,
12 } state; 20 } state;
21/* private: */
13 atomic_t onoff; 22 atomic_t onoff;
14 struct mutex reg_mutex; 23 struct mutex reg_mutex;
15 unsigned int count; /* number of attached slave devices */ 24/* public: */
16 struct device dev; /* master device */ 25 unsigned int count;
17 struct ccw_device *cdev[0]; /* variable number, allocate as needed */ 26 struct device dev;
27 struct ccw_device *cdev[0];
18}; 28};
19 29
30/**
31 * struct ccwgroup_driver - driver for ccw group devices
32 * @owner: driver owner
33 * @name: driver name
34 * @max_slaves: maximum number of slave devices
35 * @driver_id: unique id
36 * @probe: function called on probe
37 * @remove: function called on remove
38 * @set_online: function called when device is set online
39 * @set_offline: function called when device is set offline
40 * @driver: embedded driver structure
41 */
20struct ccwgroup_driver { 42struct ccwgroup_driver {
21 struct module *owner; 43 struct module *owner;
22 char *name; 44 char *name;
@@ -28,7 +50,7 @@ struct ccwgroup_driver {
28 int (*set_online) (struct ccwgroup_device *); 50 int (*set_online) (struct ccwgroup_device *);
29 int (*set_offline) (struct ccwgroup_device *); 51 int (*set_offline) (struct ccwgroup_device *);
30 52
31 struct device_driver driver; /* this driver */ 53 struct device_driver driver;
32}; 54};
33 55
34extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver); 56extern int ccwgroup_driver_register (struct ccwgroup_driver *cdriver);
diff --git a/include/asm-s390/cio.h b/include/asm-s390/cio.h
index 1982fb344164..2f08c16e44ad 100644
--- a/include/asm-s390/cio.h
+++ b/include/asm-s390/cio.h
@@ -15,30 +15,50 @@
15#define LPM_ANYPATH 0xff 15#define LPM_ANYPATH 0xff
16#define __MAX_CSSID 0 16#define __MAX_CSSID 0
17 17
18/* 18/**
19 * subchannel status word 19 * struct scsw - subchannel status word
20 * @key: subchannel key
21 * @sctl: suspend control
22 * @eswf: esw format
23 * @cc: deferred condition code
24 * @fmt: format
25 * @pfch: prefetch
26 * @isic: initial-status interruption control
27 * @alcc: adress-limit checking control
28 * @ssi: supress-suspended interruption
29 * @zcc: zero condition code
30 * @ectl: extended control
31 * @pno: path not operational
32 * @res: reserved
33 * @fctl: function control
34 * @actl: activity control
35 * @stctl: status control
36 * @cpa: channel program address
37 * @dstat: device status
38 * @cstat: subchannel status
39 * @count: residual count
20 */ 40 */
21struct scsw { 41struct scsw {
22 __u32 key : 4; /* subchannel key */ 42 __u32 key : 4;
23 __u32 sctl : 1; /* suspend control */ 43 __u32 sctl : 1;
24 __u32 eswf : 1; /* ESW format */ 44 __u32 eswf : 1;
25 __u32 cc : 2; /* deferred condition code */ 45 __u32 cc : 2;
26 __u32 fmt : 1; /* format */ 46 __u32 fmt : 1;
27 __u32 pfch : 1; /* prefetch */ 47 __u32 pfch : 1;
28 __u32 isic : 1; /* initial-status interruption control */ 48 __u32 isic : 1;
29 __u32 alcc : 1; /* address-limit checking control */ 49 __u32 alcc : 1;
30 __u32 ssi : 1; /* supress-suspended interruption */ 50 __u32 ssi : 1;
31 __u32 zcc : 1; /* zero condition code */ 51 __u32 zcc : 1;
32 __u32 ectl : 1; /* extended control */ 52 __u32 ectl : 1;
33 __u32 pno : 1; /* path not operational */ 53 __u32 pno : 1;
34 __u32 res : 1; /* reserved */ 54 __u32 res : 1;
35 __u32 fctl : 3; /* function control */ 55 __u32 fctl : 3;
36 __u32 actl : 7; /* activity control */ 56 __u32 actl : 7;
37 __u32 stctl : 5; /* status control */ 57 __u32 stctl : 5;
38 __u32 cpa; /* channel program address */ 58 __u32 cpa;
39 __u32 dstat : 8; /* device status */ 59 __u32 dstat : 8;
40 __u32 cstat : 8; /* subchannel status */ 60 __u32 cstat : 8;
41 __u32 count : 16; /* residual count */ 61 __u32 count : 16;
42} __attribute__ ((packed)); 62} __attribute__ ((packed));
43 63
44#define SCSW_FCTL_CLEAR_FUNC 0x1 64#define SCSW_FCTL_CLEAR_FUNC 0x1
@@ -110,11 +130,22 @@ struct scsw {
110#define SNS2_ENV_DATA_PRESENT 0x10 130#define SNS2_ENV_DATA_PRESENT 0x10
111#define SNS2_INPRECISE_END 0x04 131#define SNS2_INPRECISE_END 0x04
112 132
133/**
134 * struct ccw1 - channel command word
135 * @cmd_code: command code
136 * @flags: flags, like IDA adressing, etc.
137 * @count: byte count
138 * @cda: data address
139 *
140 * The ccw is the basic structure to build channel programs that perform
141 * operations with the device or the control unit. Only Format-1 channel
142 * command words are supported.
143 */
113struct ccw1 { 144struct ccw1 {
114 __u8 cmd_code; /* command code */ 145 __u8 cmd_code;
115 __u8 flags; /* flags, like IDA addressing, etc. */ 146 __u8 flags;
116 __u16 count; /* byte count */ 147 __u16 count;
117 __u32 cda; /* data address */ 148 __u32 cda;
118} __attribute__ ((packed,aligned(8))); 149} __attribute__ ((packed,aligned(8)));
119 150
120#define CCW_FLAG_DC 0x80 151#define CCW_FLAG_DC 0x80
@@ -140,102 +171,162 @@ struct ccw1 {
140 171
141#define SENSE_MAX_COUNT 0x20 172#define SENSE_MAX_COUNT 0x20
142 173
174/**
175 * struct erw - extended report word
176 * @res0: reserved
177 * @auth: authorization check
178 * @pvrf: path-verification-required flag
179 * @cpt: channel-path timeout
180 * @fsavf: failing storage address validity flag
181 * @cons: concurrent sense
182 * @scavf: secondary ccw address validity flag
183 * @fsaf: failing storage address format
184 * @scnt: sense count, if @cons == %1
185 * @res16: reserved
186 */
143struct erw { 187struct erw {
144 __u32 res0 : 3; /* reserved */ 188 __u32 res0 : 3;
145 __u32 auth : 1; /* Authorization check */ 189 __u32 auth : 1;
146 __u32 pvrf : 1; /* path-verification-required flag */ 190 __u32 pvrf : 1;
147 __u32 cpt : 1; /* channel-path timeout */ 191 __u32 cpt : 1;
148 __u32 fsavf : 1; /* Failing storage address validity flag */ 192 __u32 fsavf : 1;
149 __u32 cons : 1; /* concurrent-sense */ 193 __u32 cons : 1;
150 __u32 scavf : 1; /* Secondary ccw address validity flag */ 194 __u32 scavf : 1;
151 __u32 fsaf : 1; /* Failing storage address format */ 195 __u32 fsaf : 1;
152 __u32 scnt : 6; /* sense count if cons == 1 */ 196 __u32 scnt : 6;
153 __u32 res16 : 16; /* reserved */ 197 __u32 res16 : 16;
154} __attribute__ ((packed)); 198} __attribute__ ((packed));
155 199
156/* 200/**
157 * subchannel logout area 201 * struct sublog - subchannel logout area
202 * @res0: reserved
203 * @esf: extended status flags
204 * @lpum: last path used mask
205 * @arep: ancillary report
206 * @fvf: field-validity flags
207 * @sacc: storage access code
208 * @termc: termination code
209 * @devsc: device-status check
210 * @serr: secondary error
211 * @ioerr: i/o-error alert
212 * @seqc: sequence code
158 */ 213 */
159struct sublog { 214struct sublog {
160 __u32 res0 : 1; /* reserved */ 215 __u32 res0 : 1;
161 __u32 esf : 7; /* extended status flags */ 216 __u32 esf : 7;
162 __u32 lpum : 8; /* last path used mask */ 217 __u32 lpum : 8;
163 __u32 arep : 1; /* ancillary report */ 218 __u32 arep : 1;
164 __u32 fvf : 5; /* field-validity flags */ 219 __u32 fvf : 5;
165 __u32 sacc : 2; /* storage access code */ 220 __u32 sacc : 2;
166 __u32 termc : 2; /* termination code */ 221 __u32 termc : 2;
167 __u32 devsc : 1; /* device-status check */ 222 __u32 devsc : 1;
168 __u32 serr : 1; /* secondary error */ 223 __u32 serr : 1;
169 __u32 ioerr : 1; /* i/o-error alert */ 224 __u32 ioerr : 1;
170 __u32 seqc : 3; /* sequence code */ 225 __u32 seqc : 3;
171} __attribute__ ((packed)); 226} __attribute__ ((packed));
172 227
173/* 228/**
174 * Format 0 Extended Status Word (ESW) 229 * struct esw0 - Format 0 Extended Status Word (ESW)
230 * @sublog: subchannel logout
231 * @erw: extended report word
232 * @faddr: failing storage address
233 * @saddr: secondary ccw address
175 */ 234 */
176struct esw0 { 235struct esw0 {
177 struct sublog sublog; /* subchannel logout */ 236 struct sublog sublog;
178 struct erw erw; /* extended report word */ 237 struct erw erw;
179 __u32 faddr[2]; /* failing storage address */ 238 __u32 faddr[2];
180 __u32 saddr; /* secondary ccw address */ 239 __u32 saddr;
181} __attribute__ ((packed)); 240} __attribute__ ((packed));
182 241
183/* 242/**
184 * Format 1 Extended Status Word (ESW) 243 * struct esw1 - Format 1 Extended Status Word (ESW)
244 * @zero0: reserved zeros
245 * @lpum: last path used mask
246 * @zero16: reserved zeros
247 * @erw: extended report word
248 * @zeros: three fullwords of zeros
185 */ 249 */
186struct esw1 { 250struct esw1 {
187 __u8 zero0; /* reserved zeros */ 251 __u8 zero0;
188 __u8 lpum; /* last path used mask */ 252 __u8 lpum;
189 __u16 zero16; /* reserved zeros */ 253 __u16 zero16;
190 struct erw erw; /* extended report word */ 254 struct erw erw;
191 __u32 zeros[3]; /* 2 fullwords of zeros */ 255 __u32 zeros[3];
192} __attribute__ ((packed)); 256} __attribute__ ((packed));
193 257
194/* 258/**
195 * Format 2 Extended Status Word (ESW) 259 * struct esw2 - Format 2 Extended Status Word (ESW)
260 * @zero0: reserved zeros
261 * @lpum: last path used mask
262 * @dcti: device-connect-time interval
263 * @erw: extended report word
264 * @zeros: three fullwords of zeros
196 */ 265 */
197struct esw2 { 266struct esw2 {
198 __u8 zero0; /* reserved zeros */ 267 __u8 zero0;
199 __u8 lpum; /* last path used mask */ 268 __u8 lpum;
200 __u16 dcti; /* device-connect-time interval */ 269 __u16 dcti;
201 struct erw erw; /* extended report word */ 270 struct erw erw;
202 __u32 zeros[3]; /* 2 fullwords of zeros */ 271 __u32 zeros[3];
203} __attribute__ ((packed)); 272} __attribute__ ((packed));
204 273
205/* 274/**
206 * Format 3 Extended Status Word (ESW) 275 * struct esw3 - Format 3 Extended Status Word (ESW)
276 * @zero0: reserved zeros
277 * @lpum: last path used mask
278 * @res: reserved
279 * @erw: extended report word
280 * @zeros: three fullwords of zeros
207 */ 281 */
208struct esw3 { 282struct esw3 {
209 __u8 zero0; /* reserved zeros */ 283 __u8 zero0;
210 __u8 lpum; /* last path used mask */ 284 __u8 lpum;
211 __u16 res; /* reserved */ 285 __u16 res;
212 struct erw erw; /* extended report word */ 286 struct erw erw;
213 __u32 zeros[3]; /* 2 fullwords of zeros */ 287 __u32 zeros[3];
214} __attribute__ ((packed)); 288} __attribute__ ((packed));
215 289
216/* 290/**
217 * interruption response block 291 * struct irb - interruption response block
292 * @scsw: subchannel status word
293 * @esw: extened status word, 4 formats
294 * @ecw: extended control word
295 *
296 * The irb that is handed to the device driver when an interrupt occurs. For
297 * solicited interrupts, the common I/O layer already performs checks whether
298 * a field is valid; a field not being valid is always passed as %0.
299 * If a unit check occured, @ecw may contain sense data; this is retrieved
300 * by the common I/O layer itself if the device doesn't support concurrent
301 * sense (so that the device driver never needs to perform basic sene itself).
302 * For unsolicited interrupts, the irb is passed as-is (expect for sense data,
303 * if applicable).
218 */ 304 */
219struct irb { 305struct irb {
220 struct scsw scsw; /* subchannel status word */ 306 struct scsw scsw;
221 union { /* extended status word, 4 formats */ 307 union {
222 struct esw0 esw0; 308 struct esw0 esw0;
223 struct esw1 esw1; 309 struct esw1 esw1;
224 struct esw2 esw2; 310 struct esw2 esw2;
225 struct esw3 esw3; 311 struct esw3 esw3;
226 } esw; 312 } esw;
227 __u8 ecw[32]; /* extended control word */ 313 __u8 ecw[32];
228} __attribute__ ((packed,aligned(4))); 314} __attribute__ ((packed,aligned(4)));
229 315
230/* 316/**
231 * command information word (CIW) layout 317 * struct ciw - command information word (CIW) layout
318 * @et: entry type
319 * @reserved: reserved bits
320 * @ct: command type
321 * @cmd: command code
322 * @count: command count
232 */ 323 */
233struct ciw { 324struct ciw {
234 __u32 et : 2; /* entry type */ 325 __u32 et : 2;
235 __u32 reserved : 2; /* reserved */ 326 __u32 reserved : 2;
236 __u32 ct : 4; /* command type */ 327 __u32 ct : 4;
237 __u32 cmd : 8; /* command */ 328 __u32 cmd : 8;
238 __u32 count : 16; /* coun */ 329 __u32 count : 16;
239} __attribute__ ((packed)); 330} __attribute__ ((packed));
240 331
241#define CIW_TYPE_RCD 0x0 /* read configuration data */ 332#define CIW_TYPE_RCD 0x0 /* read configuration data */
@@ -258,11 +349,32 @@ struct ciw {
258/* Sick revalidation of device. */ 349/* Sick revalidation of device. */
259#define CIO_REVALIDATE 0x0008 350#define CIO_REVALIDATE 0x0008
260 351
352/**
353 * struct ccw_dev_id - unique identifier for ccw devices
354 * @ssid: subchannel set id
355 * @devno: device number
356 *
357 * This structure is not directly based on any hardware structure. The
358 * hardware identifies a device by its device number and its subchannel,
359 * which is in turn identified by its id. In order to get a unique identifier
360 * for ccw devices across subchannel sets, @struct ccw_dev_id has been
361 * introduced.
362 */
261struct ccw_dev_id { 363struct ccw_dev_id {
262 u8 ssid; 364 u8 ssid;
263 u16 devno; 365 u16 devno;
264}; 366};
265 367
368/**
369 * ccw_device_id_is_equal() - compare two ccw_dev_ids
370 * @dev_id1: a ccw_dev_id
371 * @dev_id2: another ccw_dev_id
372 * Returns:
373 * %1 if the two structures are equal field-by-field,
374 * %0 if not.
375 * Context:
376 * any
377 */
266static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1, 378static inline int ccw_dev_id_is_equal(struct ccw_dev_id *dev_id1,
267 struct ccw_dev_id *dev_id2) 379 struct ccw_dev_id *dev_id2)
268{ 380{