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