1 /* SPDX-License-Identifier: GPL-2.0 */
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
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
55 /* Define Subssystem Function / Orders */
56 #define DSO_ORDER_RAS 0x81
59 * Perform Subsystem Function / Orders
61 #define PSF_ORDER_PRSSD 0x18
62 #define PSF_ORDER_CUIR_RESPONSE 0x1A
63 #define PSF_ORDER_SSC 0x1D
66 * Perform Subsystem Function / Sub-Orders
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 */
73 * CUIR response condition codes
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
89 #define CUIR_QUIESCE 0x01
90 #define CUIR_RESUME 0x02
93 * Out-of-space (OOS) Codes
95 #define REPO_WARN 0x01
96 #define REPO_EXHAUST 0x02
97 #define POOL_WARN 0x03
98 #define POOL_EXHAUST 0x04
99 #define REPO_RELIEVE 0x05
100 #define POOL_RELIEVE 0x06
103 * attention message definitions
105 #define ATTENTION_LENGTH_CUIR 0x0e
106 #define ATTENTION_FORMAT_CUIR 0x01
107 #define ATTENTION_LENGTH_OOS 0x10
108 #define ATTENTION_FORMAT_OOS 0x06
110 #define DASD_ECKD_PG_GROUPED 0x10
113 * Size that is reportet for large volumes in the old 16-bit no_cyl field
115 #define LV_COMPAT_CYL 0xFFFE
118 #define FCX_MAX_DATA_FACTOR 65536
119 #define DASD_ECKD_RCD_DATA_SIZE 256
121 #define DASD_ECKD_PATH_THRHLD 256
122 #define DASD_ECKD_PATH_INTERVAL 300
125 * Maximum number of blocks to be chained
127 #define DASD_ECKD_MAX_BLOCKS 190
128 #define DASD_ECKD_MAX_BLOCKS_RAW 256
130 /*****************************************************************************
131 * SECTION: Type Definitions
132 ****************************************************************************/
140 } __attribute__ ((packed));
145 } __attribute__ ((packed));
151 } __attribute__ ((packed));
153 struct DE_eckd_data {
155 unsigned char perm:2; /* Permissions on this extent */
156 unsigned char reserved:1;
157 unsigned char seek:2; /* Seek control */
158 unsigned char auth:2; /* Access authorization */
159 unsigned char pci:1; /* PCI Fetch mode */
160 } __attribute__ ((packed)) mask;
162 unsigned char mode:2; /* Architecture mode */
163 unsigned char ckd:1; /* CKD Conversion */
164 unsigned char operation:3; /* Operation mode */
165 unsigned char cfw:1; /* Cache fast write */
166 unsigned char dfw:1; /* DASD fast write */
167 } __attribute__ ((packed)) attributes;
168 __u16 blk_size; /* Blocksize */
170 __u8 ga_additional; /* Global Attributes Additional */
171 __u8 ga_extended; /* Global Attributes Extended */
174 unsigned long ep_sys_time; /* Ext Parameter - System Time Stamp */
175 __u8 ep_format; /* Extended Parameter format byte */
176 __u8 ep_prio; /* Extended Parameter priority I/O byte */
177 __u8 ep_reserved1; /* Extended Parameter Reserved */
178 __u8 ep_rec_per_track; /* Number of records on a track */
179 __u8 ep_reserved[4]; /* Extended Parameter Reserved */
180 } __attribute__ ((packed));
182 struct LO_eckd_data {
184 unsigned char orientation:2;
185 unsigned char operation:6;
186 } __attribute__ ((packed)) operation;
188 unsigned char last_bytes_used:1;
189 unsigned char reserved:6;
190 unsigned char read_count_suffix:1;
191 } __attribute__ ((packed)) auxiliary;
194 struct ch_t seek_addr;
195 struct chr_t search_arg;
198 } __attribute__ ((packed));
200 struct LRE_eckd_data {
202 unsigned char orientation:2;
203 unsigned char operation:6;
204 } __attribute__ ((packed)) operation;
206 unsigned char length_valid:1;
207 unsigned char length_scope:1;
208 unsigned char imbedded_ccw_valid:1;
209 unsigned char check_bytes:2;
210 unsigned char imbedded_count_valid:1;
211 unsigned char reserved:1;
212 unsigned char read_count_suffix:1;
213 } __attribute__ ((packed)) auxiliary;
216 struct ch_t seek_addr;
217 struct chr_t search_arg;
221 __u8 extended_operation;
222 __u16 extended_parameter_length;
223 __u8 extended_parameter[];
224 } __attribute__ ((packed));
226 /* Prefix data for format 0x00 and 0x01 */
227 struct PFX_eckd_data {
228 unsigned char format;
230 unsigned char define_extent:1;
231 unsigned char time_stamp:1;
232 unsigned char verify_base:1;
233 unsigned char hyper_pav:1;
234 unsigned char reserved:4;
235 } __attribute__ ((packed)) validity;
240 struct DE_eckd_data define_extent;
241 struct LRE_eckd_data locate_record;
242 } __attribute__ ((packed));
244 struct dasd_eckd_characteristics {
247 unsigned char support:2;
248 unsigned char async:1;
249 unsigned char reserved:1;
250 unsigned char cache_info:1;
251 unsigned char model:3;
252 } __attribute__ ((packed)) cu_model;
256 unsigned char mult_burst:1;
257 unsigned char RT_in_LR:1;
258 unsigned char reserved1:1;
259 unsigned char RD_IN_LR:1;
260 unsigned char reserved2:4;
261 unsigned char reserved3:8;
262 unsigned char defect_wr:1;
263 unsigned char XRC_supported:1;
264 unsigned char reserved4:1;
265 unsigned char striping:1;
266 unsigned char reserved5:4;
268 unsigned char reserved6:2;
269 unsigned char cache:1;
270 unsigned char dual_copy:1;
272 unsigned char reset_alleg:1;
273 unsigned char sense_down:1;
274 } __attribute__ ((packed)) facilities;
280 __u8 byte_per_track[3];
288 } __attribute__ ((packed)) f_0x01;
295 } __attribute__ ((packed)) f_0x02;
296 } __attribute__ ((packed)) factors;
316 } __attribute__ ((packed));
318 /* elements of the configuration data */
328 } __attribute__ ((packed)) flags;
334 __u8 HDA_manufacturer[3];
335 __u8 HDA_location[2];
339 } __attribute__ ((packed));
345 } __attribute__ ((packed)) flags;
348 __u8 res2[4]; /* byte 4- 7 */
349 __u8 sua_flags; /* byte 8 */
350 __u8 base_unit_addr; /* byte 9 */
351 __u8 res3[22]; /* byte 10-31 */
352 } __attribute__ ((packed));
358 } __attribute__ ((packed)) flags;
361 __u8 res2[4]; /* byte 4- 7 */
362 __u8 uit[16]; /* byte 8-23 */
363 __u8 res3[8]; /* byte 24-31 */
364 } __attribute__ ((packed));
370 } __attribute__ ((packed)) flags;
371 __u8 record_selector;
376 } __attribute__ ((packed)) timeout;
380 } __attribute__ ((packed));
382 struct dasd_rssd_features {
384 } __attribute__((packed));
386 struct dasd_rssd_messages {
396 * Read Subsystem Data - Volume Storage Query
398 struct dasd_rssd_vsq {
401 __u8 space_not_available:1;
406 __u16 extent_pool_id;
408 __u8 warn_cap_guaranteed;
410 __u32 limit_capacity;
411 __u32 guaranteed_capacity;
412 __u32 space_allocated;
413 __u32 space_configured;
414 __u32 logical_capacity;
418 * Extent Pool Summary
420 struct dasd_ext_pool_sum {
422 __u8 repo_warn_thrshld;
425 __u8 type:1; /* 0 - CKD / 1 - FB */
426 __u8 track_space_efficient:1;
427 __u8 extent_space_efficient:1;
428 __u8 standard_volume:1;
429 __u8 extent_size_valid:1;
430 __u8 capacity_at_warnlevel:1;
440 } __packed extent_size;
445 * Read Subsystem Data-Response - Logical Configuration Query - Header
447 struct dasd_rssd_lcq {
448 __u16 data_length; /* Length of data returned */
449 __u16 pool_count; /* Count of extent pools returned - Max: 448 */
451 __u8 pool_info_valid:1; /* Detailed Information valid */
452 __u8 pool_id_volume:1;
456 } __packed header_flags;
457 char sfi_type[6]; /* Storage Facility Image Type (EBCDIC) */
458 char sfi_model[3]; /* Storage Facility Image Model (EBCDIC) */
459 __u8 sfi_seq_num[10]; /* Storage Facility Image Sequence Number */
461 struct dasd_ext_pool_sum ext_pool_sum[448];
464 struct dasd_oos_message {
468 __u8 percentage_empty;
475 struct dasd_cuir_message {
483 __u8 record_selector;
486 struct dasd_psf_cuir_response {
499 struct dasd_ckd_path_group_entry {
502 __u8 sysplex_name[8];
508 struct dasd_ckd_host_information {
515 struct dasd_psf_query_host_access {
521 __u8 host_access_information[16394];
525 * Perform Subsystem Function - Prepare for Read Subsystem Data
527 struct dasd_psf_prssd_data {
530 unsigned char reserved1;
531 unsigned char reserved2;
533 unsigned char volume;
534 unsigned char suborder;
535 unsigned char varies[5];
536 } __attribute__ ((packed));
539 * Perform Subsystem Function - Set Subsystem Characteristics
541 struct dasd_psf_ssc_data {
544 unsigned char cu_type[4];
545 unsigned char suborder;
546 unsigned char reserved[59];
547 } __attribute__((packed));
549 /* Maximum number of extents for a single Release Allocated Space command */
550 #define DASD_ECKD_RAS_EXTS_MAX 110U
552 struct dasd_dso_ras_ext_range {
558 * Define Subsytem Operation - Release Allocated Space
560 struct dasd_dso_ras_data {
563 __u8 message:1; /* Must be zero */
565 __u8 vol_type:1; /* 0 - CKD/FBA, 1 - FB */
568 /* Operation Flags to specify scope */
571 /* Release Space by Extent */
572 __u8 by_extent:1; /* 0 - entire volume, 1 - specified extents */
573 __u8 guarantee_init:1;
574 __u8 force_release:1; /* Internal - will be ignored */
581 __u16 nr_exts; /* Defines number of ext_scope - max 110 */
587 * some structures and definitions for alias handling
589 struct dasd_unit_address_configuration {
594 } __attribute__((packed));
597 #define MAX_DEVICES_PER_LCU 256
599 /* flags on the LCU */
600 #define NEED_UAC_UPDATE 0x01
601 #define UPDATE_PENDING 0x02
603 enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV};
607 struct list_head serverlist;
611 struct alias_server {
612 struct list_head server;
614 struct list_head lculist;
617 struct summary_unit_check_work_data {
619 struct dasd_device *device;
620 struct work_struct worker;
623 struct read_uac_work_data {
624 struct dasd_device *device;
625 struct delayed_work dwork;
629 struct list_head lcu;
634 struct list_head grouplist;
635 struct list_head active_devices;
636 struct list_head inactive_devices;
637 struct dasd_unit_address_configuration *uac;
638 struct summary_unit_check_work_data suc_data;
639 struct read_uac_work_data ruac_data;
640 struct dasd_ccw_req *rsu_cqr;
641 struct completion lcu_setup;
644 struct alias_pav_group {
645 struct list_head group;
647 struct alias_lcu *lcu;
648 struct list_head baselist;
649 struct list_head aliaslist;
650 struct dasd_device *next;
653 struct dasd_conf_data {
654 struct dasd_ned neds[5];
656 struct dasd_gneq gneq;
659 struct dasd_eckd_private {
660 struct dasd_eckd_characteristics rdc_data;
664 /* pointers to specific parts in the conf_data */
665 struct dasd_ned *ned;
666 struct dasd_sneq *sneq;
667 struct vd_sneq *vdsneq;
668 struct dasd_gneq *gneq;
670 struct eckd_count count_area[5];
673 struct attrib_data_t attrib; /* e.g. cache operations */
674 struct dasd_rssd_features features;
675 struct dasd_rssd_vsq vsq;
676 struct dasd_ext_pool_sum eps;
679 /* alias managemnet */
681 struct alias_pav_group *pavgroup;
682 struct alias_lcu *lcu;
691 int dasd_alias_make_device_known_to_lcu(struct dasd_device *);
692 void dasd_alias_disconnect_device_from_lcu(struct dasd_device *);
693 int dasd_alias_add_device(struct dasd_device *);
694 int dasd_alias_remove_device(struct dasd_device *);
695 struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *);
696 void dasd_alias_handle_summary_unit_check(struct work_struct *);
697 void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *);
698 int dasd_alias_update_add_device(struct dasd_device *);
699 #endif /* DASD_ECKD_H */