]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/s390/block/dasd_eckd.h
s390/comments: unify copyright messages and remove file names
[mirror_ubuntu-zesty-kernel.git] / drivers / s390 / block / dasd_eckd.h
CommitLineData
138c014d 1/*
1da177e4 2 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
138c014d 3 * Horst Hummel <Horst.Hummel@de.ibm.com>
1da177e4 4 * Bugreports.to..: <Linux390@de.ibm.com>
a53c8fab 5 * Copyright IBM Corp. 1999, 2000
1da177e4 6 *
1da177e4
LT
7 */
8
9#ifndef DASD_ECKD_H
10#define DASD_ECKD_H
11
12/*****************************************************************************
13 * SECTION: CCW Definitions
14 ****************************************************************************/
15#define DASD_ECKD_CCW_WRITE 0x05
16#define DASD_ECKD_CCW_READ 0x06
17#define DASD_ECKD_CCW_WRITE_HOME_ADDRESS 0x09
18#define DASD_ECKD_CCW_READ_HOME_ADDRESS 0x0a
19#define DASD_ECKD_CCW_WRITE_KD 0x0d
20#define DASD_ECKD_CCW_READ_KD 0x0e
21#define DASD_ECKD_CCW_ERASE 0x11
22#define DASD_ECKD_CCW_READ_COUNT 0x12
23#define DASD_ECKD_CCW_SLCK 0x14
24#define DASD_ECKD_CCW_WRITE_RECORD_ZERO 0x15
25#define DASD_ECKD_CCW_READ_RECORD_ZERO 0x16
26#define DASD_ECKD_CCW_WRITE_CKD 0x1d
27#define DASD_ECKD_CCW_READ_CKD 0x1e
28#define DASD_ECKD_CCW_PSF 0x27
196339f1 29#define DASD_ECKD_CCW_SNID 0x34
1da177e4
LT
30#define DASD_ECKD_CCW_RSSD 0x3e
31#define DASD_ECKD_CCW_LOCATE_RECORD 0x47
20c64468 32#define DASD_ECKD_CCW_SNSS 0x54
1da177e4
LT
33#define DASD_ECKD_CCW_DEFINE_EXTENT 0x63
34#define DASD_ECKD_CCW_WRITE_MT 0x85
35#define DASD_ECKD_CCW_READ_MT 0x86
36#define DASD_ECKD_CCW_WRITE_KD_MT 0x8d
37#define DASD_ECKD_CCW_READ_KD_MT 0x8e
38#define DASD_ECKD_CCW_RELEASE 0x94
e4dbb0f2 39#define DASD_ECKD_CCW_WRITE_FULL_TRACK 0x95
1da177e4
LT
40#define DASD_ECKD_CCW_READ_CKD_MT 0x9e
41#define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d
f3eb5384
SW
42#define DASD_ECKD_CCW_WRITE_TRACK_DATA 0xA5
43#define DASD_ECKD_CCW_READ_TRACK_DATA 0xA6
1da177e4 44#define DASD_ECKD_CCW_RESERVE 0xB4
e4dbb0f2 45#define DASD_ECKD_CCW_READ_TRACK 0xDE
8e09f215 46#define DASD_ECKD_CCW_PFX 0xE7
f3eb5384 47#define DASD_ECKD_CCW_PFX_READ 0xEA
8e09f215 48#define DASD_ECKD_CCW_RSCK 0xF9
a4d26c6a 49#define DASD_ECKD_CCW_RCD 0xFA
1da177e4
LT
50
51/*
40545573 52 * Perform Subsystem Function / Sub-Orders
1da177e4 53 */
40545573
HH
54#define PSF_ORDER_PRSSD 0x18
55#define PSF_ORDER_SSC 0x1D
1da177e4 56
b44b0ab3
SW
57/*
58 * Size that is reportet for large volumes in the old 16-bit no_cyl field
59 */
60#define LV_COMPAT_CYL 0xFFFE
61
ef19298b
SW
62
63#define FCX_MAX_DATA_FACTOR 65536
a4d26c6a 64#define DASD_ECKD_RCD_DATA_SIZE 256
ef19298b
SW
65
66
1da177e4
LT
67/*****************************************************************************
68 * SECTION: Type Definitions
69 ****************************************************************************/
70
71struct eckd_count {
72 __u16 cyl;
73 __u16 head;
74 __u8 record;
75 __u8 kl;
76 __u16 dl;
77} __attribute__ ((packed));
78
79struct ch_t {
80 __u16 cyl;
81 __u16 head;
82} __attribute__ ((packed));
83
84struct chs_t {
85 __u16 cyl;
86 __u16 head;
87 __u32 sector;
88} __attribute__ ((packed));
89
90struct chr_t {
91 __u16 cyl;
92 __u16 head;
93 __u8 record;
94} __attribute__ ((packed));
95
96struct geom_t {
97 __u16 cyl;
98 __u16 head;
99 __u32 sector;
100} __attribute__ ((packed));
101
102struct eckd_home {
103 __u8 skip_control[14];
104 __u16 cell_number;
105 __u8 physical_addr[3];
106 __u8 flag;
107 struct ch_t track_addr;
108 __u8 reserved;
109 __u8 key_length;
110 __u8 reserved2[2];
111} __attribute__ ((packed));
112
113struct DE_eckd_data {
114 struct {
115 unsigned char perm:2; /* Permissions on this extent */
116 unsigned char reserved:1;
117 unsigned char seek:2; /* Seek control */
118 unsigned char auth:2; /* Access authorization */
119 unsigned char pci:1; /* PCI Fetch mode */
120 } __attribute__ ((packed)) mask;
121 struct {
122 unsigned char mode:2; /* Architecture mode */
123 unsigned char ckd:1; /* CKD Conversion */
124 unsigned char operation:3; /* Operation mode */
125 unsigned char cfw:1; /* Cache fast write */
126 unsigned char dfw:1; /* DASD fast write */
127 } __attribute__ ((packed)) attributes;
128 __u16 blk_size; /* Blocksize */
129 __u16 fast_write_id;
130 __u8 ga_additional; /* Global Attributes Additional */
131 __u8 ga_extended; /* Global Attributes Extended */
132 struct ch_t beg_ext;
133 struct ch_t end_ext;
134 unsigned long long ep_sys_time; /* Ext Parameter - System Time Stamp */
135 __u8 ep_format; /* Extended Parameter format byte */
136 __u8 ep_prio; /* Extended Parameter priority I/O byte */
f3eb5384
SW
137 __u8 ep_reserved1; /* Extended Parameter Reserved */
138 __u8 ep_rec_per_track; /* Number of records on a track */
139 __u8 ep_reserved[4]; /* Extended Parameter Reserved */
1da177e4
LT
140} __attribute__ ((packed));
141
142struct LO_eckd_data {
143 struct {
144 unsigned char orientation:2;
145 unsigned char operation:6;
146 } __attribute__ ((packed)) operation;
147 struct {
148 unsigned char last_bytes_used:1;
149 unsigned char reserved:6;
150 unsigned char read_count_suffix:1;
151 } __attribute__ ((packed)) auxiliary;
152 __u8 unused;
153 __u8 count;
154 struct ch_t seek_addr;
155 struct chr_t search_arg;
156 __u8 sector;
157 __u16 length;
158} __attribute__ ((packed));
159
f3eb5384
SW
160struct LRE_eckd_data {
161 struct {
162 unsigned char orientation:2;
163 unsigned char operation:6;
164 } __attribute__ ((packed)) operation;
165 struct {
166 unsigned char length_valid:1;
167 unsigned char length_scope:1;
168 unsigned char imbedded_ccw_valid:1;
169 unsigned char check_bytes:2;
170 unsigned char imbedded_count_valid:1;
171 unsigned char reserved:1;
172 unsigned char read_count_suffix:1;
173 } __attribute__ ((packed)) auxiliary;
174 __u8 imbedded_ccw;
175 __u8 count;
176 struct ch_t seek_addr;
177 struct chr_t search_arg;
178 __u8 sector;
179 __u16 length;
180 __u8 imbedded_count;
181 __u8 extended_operation;
182 __u16 extended_parameter_length;
183 __u8 extended_parameter[0];
184} __attribute__ ((packed));
185
8e09f215
SW
186/* Prefix data for format 0x00 and 0x01 */
187struct PFX_eckd_data {
188 unsigned char format;
189 struct {
f3eb5384 190 unsigned char define_extent:1;
8e09f215
SW
191 unsigned char time_stamp:1;
192 unsigned char verify_base:1;
193 unsigned char hyper_pav:1;
194 unsigned char reserved:4;
195 } __attribute__ ((packed)) validity;
196 __u8 base_address;
197 __u8 aux;
198 __u8 base_lss;
199 __u8 reserved[7];
f3eb5384
SW
200 struct DE_eckd_data define_extent;
201 struct LRE_eckd_data locate_record;
8e09f215
SW
202} __attribute__ ((packed));
203
1da177e4
LT
204struct dasd_eckd_characteristics {
205 __u16 cu_type;
206 struct {
207 unsigned char support:2;
208 unsigned char async:1;
209 unsigned char reserved:1;
210 unsigned char cache_info:1;
211 unsigned char model:3;
212 } __attribute__ ((packed)) cu_model;
213 __u16 dev_type;
214 __u8 dev_model;
215 struct {
216 unsigned char mult_burst:1;
217 unsigned char RT_in_LR:1;
218 unsigned char reserved1:1;
219 unsigned char RD_IN_LR:1;
220 unsigned char reserved2:4;
221 unsigned char reserved3:8;
222 unsigned char defect_wr:1;
138c014d 223 unsigned char XRC_supported:1;
1da177e4
LT
224 unsigned char reserved4:1;
225 unsigned char striping:1;
226 unsigned char reserved5:4;
227 unsigned char cfw:1;
228 unsigned char reserved6:2;
229 unsigned char cache:1;
230 unsigned char dual_copy:1;
231 unsigned char dfw:1;
232 unsigned char reset_alleg:1;
233 unsigned char sense_down:1;
234 } __attribute__ ((packed)) facilities;
235 __u8 dev_class;
236 __u8 unit_type;
237 __u16 no_cyl;
238 __u16 trk_per_cyl;
239 __u8 sec_per_trk;
240 __u8 byte_per_track[3];
241 __u16 home_bytes;
242 __u8 formula;
243 union {
244 struct {
245 __u8 f1;
246 __u16 f2;
247 __u16 f3;
248 } __attribute__ ((packed)) f_0x01;
249 struct {
250 __u8 f1;
251 __u8 f2;
252 __u8 f3;
253 __u8 f4;
254 __u8 f5;
255 } __attribute__ ((packed)) f_0x02;
256 } __attribute__ ((packed)) factors;
257 __u16 first_alt_trk;
258 __u16 no_alt_trk;
259 __u16 first_dia_trk;
260 __u16 no_dia_trk;
261 __u16 first_sup_trk;
262 __u16 no_sup_trk;
263 __u8 MDR_ID;
264 __u8 OBR_ID;
265 __u8 director;
266 __u8 rd_trk_set;
267 __u16 max_rec_zero;
268 __u8 reserved1;
269 __u8 RWANY_in_LR;
270 __u8 factor6;
271 __u8 factor7;
272 __u8 factor8;
273 __u8 reserved2[3];
b44b0ab3
SW
274 __u8 reserved3[6];
275 __u32 long_no_cyl;
1da177e4
LT
276} __attribute__ ((packed));
277
4abb08c2
SW
278/* elements of the configuration data */
279struct dasd_ned {
1da177e4 280 struct {
4abb08c2
SW
281 __u8 identifier:2;
282 __u8 token_id:1;
283 __u8 sno_valid:1;
284 __u8 subst_sno:1;
285 __u8 recNED:1;
286 __u8 emuNED:1;
287 __u8 reserved:1;
288 } __attribute__ ((packed)) flags;
289 __u8 descriptor;
290 __u8 dev_class;
291 __u8 reserved;
292 __u8 dev_type[6];
293 __u8 dev_model[3];
294 __u8 HDA_manufacturer[3];
295 __u8 HDA_location[2];
296 __u8 HDA_seqno[12];
297 __u8 ID;
298 __u8 unit_addr;
299} __attribute__ ((packed));
300
301struct dasd_sneq {
1da177e4 302 struct {
4abb08c2
SW
303 __u8 identifier:2;
304 __u8 reserved:6;
305 } __attribute__ ((packed)) flags;
306 __u8 res1;
307 __u16 format;
308 __u8 res2[4]; /* byte 4- 7 */
309 __u8 sua_flags; /* byte 8 */
310 __u8 base_unit_addr; /* byte 9 */
311 __u8 res3[22]; /* byte 10-31 */
312} __attribute__ ((packed));
313
314struct vd_sneq {
1da177e4 315 struct {
4abb08c2
SW
316 __u8 identifier:2;
317 __u8 reserved:6;
318 } __attribute__ ((packed)) flags;
319 __u8 res1;
320 __u16 format;
321 __u8 res2[4]; /* byte 4- 7 */
322 __u8 uit[16]; /* byte 8-23 */
323 __u8 res3[8]; /* byte 24-31 */
324} __attribute__ ((packed));
325
326struct dasd_gneq {
1da177e4 327 struct {
4abb08c2
SW
328 __u8 identifier:2;
329 __u8 reserved:6;
330 } __attribute__ ((packed)) flags;
7c8faa86
SH
331 __u8 reserved[5];
332 struct {
333 __u8 value:2;
334 __u8 number:6;
335 } __attribute__ ((packed)) timeout;
336 __u8 reserved3;
4abb08c2
SW
337 __u16 subsystemID;
338 __u8 reserved2[22];
1da177e4
LT
339} __attribute__ ((packed));
340
8e09f215
SW
341struct dasd_rssd_features {
342 char feature[256];
343} __attribute__((packed));
344
345
1da177e4 346/*
138c014d 347 * Perform Subsystem Function - Prepare for Read Subsystem Data
1da177e4
LT
348 */
349struct dasd_psf_prssd_data {
350 unsigned char order;
351 unsigned char flags;
352 unsigned char reserved[4];
353 unsigned char suborder;
49fd38bd 354 unsigned char varies[5];
1da177e4
LT
355} __attribute__ ((packed));
356
40545573
HH
357/*
358 * Perform Subsystem Function - Set Subsystem Characteristics
359 */
360struct dasd_psf_ssc_data {
361 unsigned char order;
362 unsigned char flags;
363 unsigned char cu_type[4];
364 unsigned char suborder;
365 unsigned char reserved[59];
366} __attribute__((packed));
367
8e09f215
SW
368
369/*
370 * some structures and definitions for alias handling
371 */
372struct dasd_unit_address_configuration {
373 struct {
374 char ua_type;
375 char base_ua;
376 } unit[256];
377} __attribute__((packed));
378
379
380#define MAX_DEVICES_PER_LCU 256
381
382/* flags on the LCU */
383#define NEED_UAC_UPDATE 0x01
384#define UPDATE_PENDING 0x02
385
386enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV};
387
388
389struct alias_root {
390 struct list_head serverlist;
391 spinlock_t lock;
392};
393
394struct alias_server {
395 struct list_head server;
396 struct dasd_uid uid;
397 struct list_head lculist;
398};
399
400struct summary_unit_check_work_data {
401 char reason;
402 struct dasd_device *device;
403 struct work_struct worker;
404};
405
406struct read_uac_work_data {
407 struct dasd_device *device;
408 struct delayed_work dwork;
409};
410
411struct alias_lcu {
412 struct list_head lcu;
413 struct dasd_uid uid;
414 enum pavtype pav;
415 char flags;
416 spinlock_t lock;
417 struct list_head grouplist;
418 struct list_head active_devices;
419 struct list_head inactive_devices;
420 struct dasd_unit_address_configuration *uac;
421 struct summary_unit_check_work_data suc_data;
422 struct read_uac_work_data ruac_data;
423 struct dasd_ccw_req *rsu_cqr;
f4ac1d02 424 struct completion lcu_setup;
8e09f215
SW
425};
426
427struct alias_pav_group {
428 struct list_head group;
429 struct dasd_uid uid;
430 struct alias_lcu *lcu;
431 struct list_head baselist;
432 struct list_head aliaslist;
433 struct dasd_device *next;
434};
435
8e09f215
SW
436struct dasd_eckd_private {
437 struct dasd_eckd_characteristics rdc_data;
4abb08c2
SW
438 u8 *conf_data;
439 int conf_len;
440 /* pointers to specific parts in the conf_data */
441 struct dasd_ned *ned;
442 struct dasd_sneq *sneq;
443 struct vd_sneq *vdsneq;
444 struct dasd_gneq *gneq;
445
8e09f215
SW
446 struct eckd_count count_area[5];
447 int init_cqr_status;
448 int uses_cdl;
449 struct attrib_data_t attrib; /* e.g. cache operations */
450 struct dasd_rssd_features features;
b44b0ab3 451 u32 real_cyl;
8e09f215
SW
452
453 /* alias managemnet */
454 struct dasd_uid uid;
455 struct alias_pav_group *pavgroup;
456 struct alias_lcu *lcu;
457 int count;
ef19298b
SW
458
459 u32 fcx_max_data;
8e09f215
SW
460};
461
462
463
464int dasd_alias_make_device_known_to_lcu(struct dasd_device *);
465void dasd_alias_disconnect_device_from_lcu(struct dasd_device *);
466int dasd_alias_add_device(struct dasd_device *);
467int dasd_alias_remove_device(struct dasd_device *);
468struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *);
469void dasd_alias_handle_summary_unit_check(struct dasd_device *, struct irb *);
470void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *);
f4ac1d02
SW
471void dasd_alias_lcu_setup_complete(struct dasd_device *);
472void dasd_alias_wait_for_lcu_setup(struct dasd_device *);
501183f2 473int dasd_alias_update_add_device(struct dasd_device *);
1da177e4 474#endif /* DASD_ECKD_H */