]> git.ipfire.org Git - people/ms/linux.git/blob - drivers/s390/block/dasd_eckd.h
13112ba9f93f6ef4adc386fa6447f780366650c7
[people/ms/linux.git] / drivers / s390 / block / dasd_eckd.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Horst Hummel <Horst.Hummel@de.ibm.com>
5 * Bugreports.to..: <Linux390@de.ibm.com>
6 * Copyright IBM Corp. 1999, 2000
7 *
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
30 #define DASD_ECKD_CCW_SNID 0x34
31 #define DASD_ECKD_CCW_RSSD 0x3e
32 #define DASD_ECKD_CCW_LOCATE_RECORD 0x47
33 #define DASD_ECKD_CCW_LOCATE_RECORD_EXT 0x4b
34 #define DASD_ECKD_CCW_SNSS 0x54
35 #define DASD_ECKD_CCW_DEFINE_EXTENT 0x63
36 #define DASD_ECKD_CCW_WRITE_MT 0x85
37 #define DASD_ECKD_CCW_READ_MT 0x86
38 #define DASD_ECKD_CCW_WRITE_KD_MT 0x8d
39 #define DASD_ECKD_CCW_READ_KD_MT 0x8e
40 #define DASD_ECKD_CCW_READ_COUNT_MT 0x92
41 #define DASD_ECKD_CCW_RELEASE 0x94
42 #define DASD_ECKD_CCW_WRITE_FULL_TRACK 0x95
43 #define DASD_ECKD_CCW_READ_CKD_MT 0x9e
44 #define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d
45 #define DASD_ECKD_CCW_WRITE_TRACK_DATA 0xA5
46 #define DASD_ECKD_CCW_READ_TRACK_DATA 0xA6
47 #define DASD_ECKD_CCW_RESERVE 0xB4
48 #define DASD_ECKD_CCW_READ_TRACK 0xDE
49 #define DASD_ECKD_CCW_PFX 0xE7
50 #define DASD_ECKD_CCW_PFX_READ 0xEA
51 #define DASD_ECKD_CCW_RSCK 0xF9
52 #define DASD_ECKD_CCW_RCD 0xFA
53 #define DASD_ECKD_CCW_DSO 0xF7
54
55 /* Define Subssystem Function / Orders */
56 #define DSO_ORDER_RAS 0x81
57
58 /*
59 * Perform Subsystem Function / Orders
60 */
61 #define PSF_ORDER_PRSSD 0x18
62 #define PSF_ORDER_CUIR_RESPONSE 0x1A
63 #define PSF_ORDER_SSC 0x1D
64
65 /*
66 * Perform Subsystem Function / Sub-Orders
67 */
68 #define PSF_SUBORDER_QHA 0x1C /* Query Host Access */
69 #define PSF_SUBORDER_VSQ 0x52 /* Volume Storage Query */
70 #define PSF_SUBORDER_LCQ 0x53 /* Logical Configuration Query */
71
72 /*
73 * CUIR response condition codes
74 */
75 #define PSF_CUIR_INVALID 0x00
76 #define PSF_CUIR_COMPLETED 0x01
77 #define PSF_CUIR_NOT_SUPPORTED 0x02
78 #define PSF_CUIR_ERROR_IN_REQ 0x03
79 #define PSF_CUIR_DENIED 0x04
80 #define PSF_CUIR_LAST_PATH 0x05
81 #define PSF_CUIR_DEVICE_ONLINE 0x06
82 #define PSF_CUIR_VARY_FAILURE 0x07
83 #define PSF_CUIR_SOFTWARE_FAILURE 0x08
84 #define PSF_CUIR_NOT_RECOGNIZED 0x09
85
86 /*
87 * CUIR codes
88 */
89 #define CUIR_QUIESCE 0x01
90 #define CUIR_RESUME 0x02
91
92 /*
93 * attention message definitions
94 */
95 #define ATTENTION_LENGTH_CUIR 0x0e
96 #define ATTENTION_FORMAT_CUIR 0x01
97
98 #define DASD_ECKD_PG_GROUPED 0x10
99
100 /*
101 * Size that is reportet for large volumes in the old 16-bit no_cyl field
102 */
103 #define LV_COMPAT_CYL 0xFFFE
104
105
106 #define FCX_MAX_DATA_FACTOR 65536
107 #define DASD_ECKD_RCD_DATA_SIZE 256
108
109 #define DASD_ECKD_PATH_THRHLD 256
110 #define DASD_ECKD_PATH_INTERVAL 300
111
112 /*
113 * Maximum number of blocks to be chained
114 */
115 #define DASD_ECKD_MAX_BLOCKS 190
116 #define DASD_ECKD_MAX_BLOCKS_RAW 256
117
118 /*****************************************************************************
119 * SECTION: Type Definitions
120 ****************************************************************************/
121
122 struct eckd_count {
123 __u16 cyl;
124 __u16 head;
125 __u8 record;
126 __u8 kl;
127 __u16 dl;
128 } __attribute__ ((packed));
129
130 struct ch_t {
131 __u16 cyl;
132 __u16 head;
133 } __attribute__ ((packed));
134
135 struct chr_t {
136 __u16 cyl;
137 __u16 head;
138 __u8 record;
139 } __attribute__ ((packed));
140
141 struct DE_eckd_data {
142 struct {
143 unsigned char perm:2; /* Permissions on this extent */
144 unsigned char reserved:1;
145 unsigned char seek:2; /* Seek control */
146 unsigned char auth:2; /* Access authorization */
147 unsigned char pci:1; /* PCI Fetch mode */
148 } __attribute__ ((packed)) mask;
149 struct {
150 unsigned char mode:2; /* Architecture mode */
151 unsigned char ckd:1; /* CKD Conversion */
152 unsigned char operation:3; /* Operation mode */
153 unsigned char cfw:1; /* Cache fast write */
154 unsigned char dfw:1; /* DASD fast write */
155 } __attribute__ ((packed)) attributes;
156 __u16 blk_size; /* Blocksize */
157 __u16 fast_write_id;
158 __u8 ga_additional; /* Global Attributes Additional */
159 __u8 ga_extended; /* Global Attributes Extended */
160 struct ch_t beg_ext;
161 struct ch_t end_ext;
162 unsigned long ep_sys_time; /* Ext Parameter - System Time Stamp */
163 __u8 ep_format; /* Extended Parameter format byte */
164 __u8 ep_prio; /* Extended Parameter priority I/O byte */
165 __u8 ep_reserved1; /* Extended Parameter Reserved */
166 __u8 ep_rec_per_track; /* Number of records on a track */
167 __u8 ep_reserved[4]; /* Extended Parameter Reserved */
168 } __attribute__ ((packed));
169
170 struct LO_eckd_data {
171 struct {
172 unsigned char orientation:2;
173 unsigned char operation:6;
174 } __attribute__ ((packed)) operation;
175 struct {
176 unsigned char last_bytes_used:1;
177 unsigned char reserved:6;
178 unsigned char read_count_suffix:1;
179 } __attribute__ ((packed)) auxiliary;
180 __u8 unused;
181 __u8 count;
182 struct ch_t seek_addr;
183 struct chr_t search_arg;
184 __u8 sector;
185 __u16 length;
186 } __attribute__ ((packed));
187
188 struct LRE_eckd_data {
189 struct {
190 unsigned char orientation:2;
191 unsigned char operation:6;
192 } __attribute__ ((packed)) operation;
193 struct {
194 unsigned char length_valid:1;
195 unsigned char length_scope:1;
196 unsigned char imbedded_ccw_valid:1;
197 unsigned char check_bytes:2;
198 unsigned char imbedded_count_valid:1;
199 unsigned char reserved:1;
200 unsigned char read_count_suffix:1;
201 } __attribute__ ((packed)) auxiliary;
202 __u8 imbedded_ccw;
203 __u8 count;
204 struct ch_t seek_addr;
205 struct chr_t search_arg;
206 __u8 sector;
207 __u16 length;
208 __u8 imbedded_count;
209 __u8 extended_operation;
210 __u16 extended_parameter_length;
211 __u8 extended_parameter[0];
212 } __attribute__ ((packed));
213
214 /* Prefix data for format 0x00 and 0x01 */
215 struct PFX_eckd_data {
216 unsigned char format;
217 struct {
218 unsigned char define_extent:1;
219 unsigned char time_stamp:1;
220 unsigned char verify_base:1;
221 unsigned char hyper_pav:1;
222 unsigned char reserved:4;
223 } __attribute__ ((packed)) validity;
224 __u8 base_address;
225 __u8 aux;
226 __u8 base_lss;
227 __u8 reserved[7];
228 struct DE_eckd_data define_extent;
229 struct LRE_eckd_data locate_record;
230 } __attribute__ ((packed));
231
232 struct dasd_eckd_characteristics {
233 __u16 cu_type;
234 struct {
235 unsigned char support:2;
236 unsigned char async:1;
237 unsigned char reserved:1;
238 unsigned char cache_info:1;
239 unsigned char model:3;
240 } __attribute__ ((packed)) cu_model;
241 __u16 dev_type;
242 __u8 dev_model;
243 struct {
244 unsigned char mult_burst:1;
245 unsigned char RT_in_LR:1;
246 unsigned char reserved1:1;
247 unsigned char RD_IN_LR:1;
248 unsigned char reserved2:4;
249 unsigned char reserved3:8;
250 unsigned char defect_wr:1;
251 unsigned char XRC_supported:1;
252 unsigned char reserved4:1;
253 unsigned char striping:1;
254 unsigned char reserved5:4;
255 unsigned char cfw:1;
256 unsigned char reserved6:2;
257 unsigned char cache:1;
258 unsigned char dual_copy:1;
259 unsigned char dfw:1;
260 unsigned char reset_alleg:1;
261 unsigned char sense_down:1;
262 } __attribute__ ((packed)) facilities;
263 __u8 dev_class;
264 __u8 unit_type;
265 __u16 no_cyl;
266 __u16 trk_per_cyl;
267 __u8 sec_per_trk;
268 __u8 byte_per_track[3];
269 __u16 home_bytes;
270 __u8 formula;
271 union {
272 struct {
273 __u8 f1;
274 __u16 f2;
275 __u16 f3;
276 } __attribute__ ((packed)) f_0x01;
277 struct {
278 __u8 f1;
279 __u8 f2;
280 __u8 f3;
281 __u8 f4;
282 __u8 f5;
283 } __attribute__ ((packed)) f_0x02;
284 } __attribute__ ((packed)) factors;
285 __u16 first_alt_trk;
286 __u16 no_alt_trk;
287 __u16 first_dia_trk;
288 __u16 no_dia_trk;
289 __u16 first_sup_trk;
290 __u16 no_sup_trk;
291 __u8 MDR_ID;
292 __u8 OBR_ID;
293 __u8 director;
294 __u8 rd_trk_set;
295 __u16 max_rec_zero;
296 __u8 reserved1;
297 __u8 RWANY_in_LR;
298 __u8 factor6;
299 __u8 factor7;
300 __u8 factor8;
301 __u8 reserved2[3];
302 __u8 reserved3[6];
303 __u32 long_no_cyl;
304 } __attribute__ ((packed));
305
306 /* elements of the configuration data */
307 struct dasd_ned {
308 struct {
309 __u8 identifier:2;
310 __u8 token_id:1;
311 __u8 sno_valid:1;
312 __u8 subst_sno:1;
313 __u8 recNED:1;
314 __u8 emuNED:1;
315 __u8 reserved:1;
316 } __attribute__ ((packed)) flags;
317 __u8 descriptor;
318 __u8 dev_class;
319 __u8 reserved;
320 __u8 dev_type[6];
321 __u8 dev_model[3];
322 __u8 HDA_manufacturer[3];
323 __u8 HDA_location[2];
324 __u8 HDA_seqno[12];
325 __u8 ID;
326 __u8 unit_addr;
327 } __attribute__ ((packed));
328
329 struct dasd_sneq {
330 struct {
331 __u8 identifier:2;
332 __u8 reserved:6;
333 } __attribute__ ((packed)) flags;
334 __u8 res1;
335 __u16 format;
336 __u8 res2[4]; /* byte 4- 7 */
337 __u8 sua_flags; /* byte 8 */
338 __u8 base_unit_addr; /* byte 9 */
339 __u8 res3[22]; /* byte 10-31 */
340 } __attribute__ ((packed));
341
342 struct vd_sneq {
343 struct {
344 __u8 identifier:2;
345 __u8 reserved:6;
346 } __attribute__ ((packed)) flags;
347 __u8 res1;
348 __u16 format;
349 __u8 res2[4]; /* byte 4- 7 */
350 __u8 uit[16]; /* byte 8-23 */
351 __u8 res3[8]; /* byte 24-31 */
352 } __attribute__ ((packed));
353
354 struct dasd_gneq {
355 struct {
356 __u8 identifier:2;
357 __u8 reserved:6;
358 } __attribute__ ((packed)) flags;
359 __u8 record_selector;
360 __u8 reserved[4];
361 struct {
362 __u8 value:2;
363 __u8 number:6;
364 } __attribute__ ((packed)) timeout;
365 __u8 reserved3;
366 __u16 subsystemID;
367 __u8 reserved2[22];
368 } __attribute__ ((packed));
369
370 struct dasd_rssd_features {
371 char feature[256];
372 } __attribute__((packed));
373
374 struct dasd_rssd_messages {
375 __u16 length;
376 __u8 format;
377 __u8 code;
378 __u32 message_id;
379 __u8 flags;
380 char messages[4087];
381 } __packed;
382
383 /*
384 * Read Subsystem Data - Volume Storage Query
385 */
386 struct dasd_rssd_vsq {
387 struct {
388 __u8 tse:1;
389 __u8 space_not_available:1;
390 __u8 ese:1;
391 __u8 unused:5;
392 } __packed vol_info;
393 __u8 unused1;
394 __u16 extent_pool_id;
395 __u8 warn_cap_limit;
396 __u8 warn_cap_guaranteed;
397 __u16 unused2;
398 __u32 limit_capacity;
399 __u32 guaranteed_capacity;
400 __u32 space_allocated;
401 __u32 space_configured;
402 __u32 logical_capacity;
403 } __packed;
404
405 /*
406 * Extent Pool Summary
407 */
408 struct dasd_ext_pool_sum {
409 __u16 pool_id;
410 __u8 repo_warn_thrshld;
411 __u8 warn_thrshld;
412 struct {
413 __u8 type:1; /* 0 - CKD / 1 - FB */
414 __u8 track_space_efficient:1;
415 __u8 extent_space_efficient:1;
416 __u8 standard_volume:1;
417 __u8 extent_size_valid:1;
418 __u8 capacity_at_warnlevel:1;
419 __u8 pool_oos:1;
420 __u8 unused0:1;
421 __u8 unused1;
422 } __packed flags;
423 struct {
424 __u8 reserved0:1;
425 __u8 size_1G:1;
426 __u8 reserved1:5;
427 __u8 size_16M:1;
428 } __packed extent_size;
429 __u8 unused;
430 } __packed;
431
432 /*
433 * Read Subsystem Data-Response - Logical Configuration Query - Header
434 */
435 struct dasd_rssd_lcq {
436 __u16 data_length; /* Length of data returned */
437 __u16 pool_count; /* Count of extent pools returned - Max: 448 */
438 struct {
439 __u8 pool_info_valid:1; /* Detailed Information valid */
440 __u8 pool_id_volume:1;
441 __u8 pool_id_cec:1;
442 __u8 unused0:5;
443 __u8 unused1;
444 } __packed header_flags;
445 char sfi_type[6]; /* Storage Facility Image Type (EBCDIC) */
446 char sfi_model[3]; /* Storage Facility Image Model (EBCDIC) */
447 __u8 sfi_seq_num[10]; /* Storage Facility Image Sequence Number */
448 __u8 reserved[7];
449 struct dasd_ext_pool_sum ext_pool_sum[448];
450 } __packed;
451
452 struct dasd_cuir_message {
453 __u16 length;
454 __u8 format;
455 __u8 code;
456 __u32 message_id;
457 __u8 flags;
458 __u8 neq_map[3];
459 __u8 ned_map;
460 __u8 record_selector;
461 } __packed;
462
463 struct dasd_psf_cuir_response {
464 __u8 order;
465 __u8 flags;
466 __u8 cc;
467 __u8 chpid;
468 __u16 device_nr;
469 __u16 reserved;
470 __u32 message_id;
471 __u64 system_id;
472 __u8 cssid;
473 __u8 ssid;
474 } __packed;
475
476 struct dasd_ckd_path_group_entry {
477 __u8 status_flags;
478 __u8 pgid[11];
479 __u8 sysplex_name[8];
480 __u32 timestamp;
481 __u32 cylinder;
482 __u8 reserved[4];
483 } __packed;
484
485 struct dasd_ckd_host_information {
486 __u8 access_flags;
487 __u8 entry_size;
488 __u16 entry_count;
489 __u8 entry[16390];
490 } __packed;
491
492 struct dasd_psf_query_host_access {
493 __u8 access_flag;
494 __u8 version;
495 __u16 CKD_length;
496 __u16 SCSI_length;
497 __u8 unused[10];
498 __u8 host_access_information[16394];
499 } __packed;
500
501 /*
502 * Perform Subsystem Function - Prepare for Read Subsystem Data
503 */
504 struct dasd_psf_prssd_data {
505 unsigned char order;
506 unsigned char flags;
507 unsigned char reserved1;
508 unsigned char reserved2;
509 unsigned char lss;
510 unsigned char volume;
511 unsigned char suborder;
512 unsigned char varies[5];
513 } __attribute__ ((packed));
514
515 /*
516 * Perform Subsystem Function - Set Subsystem Characteristics
517 */
518 struct dasd_psf_ssc_data {
519 unsigned char order;
520 unsigned char flags;
521 unsigned char cu_type[4];
522 unsigned char suborder;
523 unsigned char reserved[59];
524 } __attribute__((packed));
525
526 /* Maximum number of extents for a single Release Allocated Space command */
527 #define DASD_ECKD_RAS_EXTS_MAX 110U
528
529 struct dasd_dso_ras_ext_range {
530 struct ch_t beg_ext;
531 struct ch_t end_ext;
532 } __packed;
533
534 /*
535 * Define Subsytem Operation - Release Allocated Space
536 */
537 struct dasd_dso_ras_data {
538 __u8 order;
539 struct {
540 __u8 message:1; /* Must be zero */
541 __u8 reserved1:2;
542 __u8 vol_type:1; /* 0 - CKD/FBA, 1 - FB */
543 __u8 reserved2:4;
544 } __packed flags;
545 /* Operation Flags to specify scope */
546 struct {
547 __u8 reserved1:2;
548 /* Release Space by Extent */
549 __u8 by_extent:1; /* 0 - entire volume, 1 - specified extents */
550 __u8 guarantee_init:1;
551 __u8 force_release:1; /* Internal - will be ignored */
552 __u16 reserved2:11;
553 } __packed op_flags;
554 __u8 lss;
555 __u8 dev_addr;
556 __u32 reserved1;
557 __u8 reserved2[10];
558 __u16 nr_exts; /* Defines number of ext_scope - max 110 */
559 __u16 reserved3;
560 } __packed;
561
562
563 /*
564 * some structures and definitions for alias handling
565 */
566 struct dasd_unit_address_configuration {
567 struct {
568 char ua_type;
569 char base_ua;
570 } unit[256];
571 } __attribute__((packed));
572
573
574 #define MAX_DEVICES_PER_LCU 256
575
576 /* flags on the LCU */
577 #define NEED_UAC_UPDATE 0x01
578 #define UPDATE_PENDING 0x02
579
580 enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV};
581
582
583 struct alias_root {
584 struct list_head serverlist;
585 spinlock_t lock;
586 };
587
588 struct alias_server {
589 struct list_head server;
590 struct dasd_uid uid;
591 struct list_head lculist;
592 };
593
594 struct summary_unit_check_work_data {
595 char reason;
596 struct dasd_device *device;
597 struct work_struct worker;
598 };
599
600 struct read_uac_work_data {
601 struct dasd_device *device;
602 struct delayed_work dwork;
603 };
604
605 struct alias_lcu {
606 struct list_head lcu;
607 struct dasd_uid uid;
608 enum pavtype pav;
609 char flags;
610 spinlock_t lock;
611 struct list_head grouplist;
612 struct list_head active_devices;
613 struct list_head inactive_devices;
614 struct dasd_unit_address_configuration *uac;
615 struct summary_unit_check_work_data suc_data;
616 struct read_uac_work_data ruac_data;
617 struct dasd_ccw_req *rsu_cqr;
618 struct completion lcu_setup;
619 };
620
621 struct alias_pav_group {
622 struct list_head group;
623 struct dasd_uid uid;
624 struct alias_lcu *lcu;
625 struct list_head baselist;
626 struct list_head aliaslist;
627 struct dasd_device *next;
628 };
629
630 struct dasd_conf_data {
631 struct dasd_ned neds[5];
632 u8 reserved[64];
633 struct dasd_gneq gneq;
634 } __packed;
635
636 struct dasd_eckd_private {
637 struct dasd_eckd_characteristics rdc_data;
638 u8 *conf_data;
639 int conf_len;
640
641 /* pointers to specific parts in the conf_data */
642 struct dasd_ned *ned;
643 struct dasd_sneq *sneq;
644 struct vd_sneq *vdsneq;
645 struct dasd_gneq *gneq;
646
647 struct eckd_count count_area[5];
648 int init_cqr_status;
649 int uses_cdl;
650 struct attrib_data_t attrib; /* e.g. cache operations */
651 struct dasd_rssd_features features;
652 struct dasd_rssd_vsq vsq;
653 struct dasd_ext_pool_sum eps;
654 u32 real_cyl;
655
656 /* alias managemnet */
657 struct dasd_uid uid;
658 struct alias_pav_group *pavgroup;
659 struct alias_lcu *lcu;
660 int count;
661
662 u32 fcx_max_data;
663 char suc_reason;
664 };
665
666
667
668 int dasd_alias_make_device_known_to_lcu(struct dasd_device *);
669 void dasd_alias_disconnect_device_from_lcu(struct dasd_device *);
670 int dasd_alias_add_device(struct dasd_device *);
671 int dasd_alias_remove_device(struct dasd_device *);
672 struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *);
673 void dasd_alias_handle_summary_unit_check(struct work_struct *);
674 void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *);
675 int dasd_alias_update_add_device(struct dasd_device *);
676 #endif /* DASD_ECKD_H */