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 * attention message definitions
95 #define ATTENTION_LENGTH_CUIR 0x0e
96 #define ATTENTION_FORMAT_CUIR 0x01
98 #define DASD_ECKD_PG_GROUPED 0x10
101 * Size that is reportet for large volumes in the old 16-bit no_cyl field
103 #define LV_COMPAT_CYL 0xFFFE
106 #define FCX_MAX_DATA_FACTOR 65536
107 #define DASD_ECKD_RCD_DATA_SIZE 256
109 #define DASD_ECKD_PATH_THRHLD 256
110 #define DASD_ECKD_PATH_INTERVAL 300
113 * Maximum number of blocks to be chained
115 #define DASD_ECKD_MAX_BLOCKS 190
116 #define DASD_ECKD_MAX_BLOCKS_RAW 256
118 /*****************************************************************************
119 * SECTION: Type Definitions
120 ****************************************************************************/
128 } __attribute__ ((packed
));
133 } __attribute__ ((packed
));
139 } __attribute__ ((packed
));
141 struct DE_eckd_data
{
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
;
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 */
158 __u8 ga_additional
; /* Global Attributes Additional */
159 __u8 ga_extended
; /* Global Attributes Extended */
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
));
170 struct LO_eckd_data
{
172 unsigned char orientation
:2;
173 unsigned char operation
:6;
174 } __attribute__ ((packed
)) operation
;
176 unsigned char last_bytes_used
:1;
177 unsigned char reserved
:6;
178 unsigned char read_count_suffix
:1;
179 } __attribute__ ((packed
)) auxiliary
;
182 struct ch_t seek_addr
;
183 struct chr_t search_arg
;
186 } __attribute__ ((packed
));
188 struct LRE_eckd_data
{
190 unsigned char orientation
:2;
191 unsigned char operation
:6;
192 } __attribute__ ((packed
)) operation
;
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
;
204 struct ch_t seek_addr
;
205 struct chr_t search_arg
;
209 __u8 extended_operation
;
210 __u16 extended_parameter_length
;
211 __u8 extended_parameter
[0];
212 } __attribute__ ((packed
));
214 /* Prefix data for format 0x00 and 0x01 */
215 struct PFX_eckd_data
{
216 unsigned char format
;
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
;
228 struct DE_eckd_data define_extent
;
229 struct LRE_eckd_data locate_record
;
230 } __attribute__ ((packed
));
232 struct dasd_eckd_characteristics
{
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
;
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;
256 unsigned char reserved6
:2;
257 unsigned char cache
:1;
258 unsigned char dual_copy
:1;
260 unsigned char reset_alleg
:1;
261 unsigned char sense_down
:1;
262 } __attribute__ ((packed
)) facilities
;
268 __u8 byte_per_track
[3];
276 } __attribute__ ((packed
)) f_0x01
;
283 } __attribute__ ((packed
)) f_0x02
;
284 } __attribute__ ((packed
)) factors
;
304 } __attribute__ ((packed
));
306 /* elements of the configuration data */
316 } __attribute__ ((packed
)) flags
;
322 __u8 HDA_manufacturer
[3];
323 __u8 HDA_location
[2];
327 } __attribute__ ((packed
));
333 } __attribute__ ((packed
)) flags
;
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
));
346 } __attribute__ ((packed
)) flags
;
349 __u8 res2
[4]; /* byte 4- 7 */
350 __u8 uit
[16]; /* byte 8-23 */
351 __u8 res3
[8]; /* byte 24-31 */
352 } __attribute__ ((packed
));
358 } __attribute__ ((packed
)) flags
;
359 __u8 record_selector
;
364 } __attribute__ ((packed
)) timeout
;
368 } __attribute__ ((packed
));
370 struct dasd_rssd_features
{
372 } __attribute__((packed
));
374 struct dasd_rssd_messages
{
384 * Read Subsystem Data - Volume Storage Query
386 struct dasd_rssd_vsq
{
389 __u8 space_not_available
:1;
394 __u16 extent_pool_id
;
396 __u8 warn_cap_guaranteed
;
398 __u32 limit_capacity
;
399 __u32 guaranteed_capacity
;
400 __u32 space_allocated
;
401 __u32 space_configured
;
402 __u32 logical_capacity
;
406 * Extent Pool Summary
408 struct dasd_ext_pool_sum
{
410 __u8 repo_warn_thrshld
;
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;
428 } __packed extent_size
;
433 * Read Subsystem Data-Response - Logical Configuration Query - Header
435 struct dasd_rssd_lcq
{
436 __u16 data_length
; /* Length of data returned */
437 __u16 pool_count
; /* Count of extent pools returned - Max: 448 */
439 __u8 pool_info_valid
:1; /* Detailed Information valid */
440 __u8 pool_id_volume
:1;
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 */
449 struct dasd_ext_pool_sum ext_pool_sum
[448];
452 struct dasd_cuir_message
{
460 __u8 record_selector
;
463 struct dasd_psf_cuir_response
{
476 struct dasd_ckd_path_group_entry
{
479 __u8 sysplex_name
[8];
485 struct dasd_ckd_host_information
{
492 struct dasd_psf_query_host_access
{
498 __u8 host_access_information
[16394];
502 * Perform Subsystem Function - Prepare for Read Subsystem Data
504 struct dasd_psf_prssd_data
{
507 unsigned char reserved1
;
508 unsigned char reserved2
;
510 unsigned char volume
;
511 unsigned char suborder
;
512 unsigned char varies
[5];
513 } __attribute__ ((packed
));
516 * Perform Subsystem Function - Set Subsystem Characteristics
518 struct dasd_psf_ssc_data
{
521 unsigned char cu_type
[4];
522 unsigned char suborder
;
523 unsigned char reserved
[59];
524 } __attribute__((packed
));
526 /* Maximum number of extents for a single Release Allocated Space command */
527 #define DASD_ECKD_RAS_EXTS_MAX 110U
529 struct dasd_dso_ras_ext_range
{
535 * Define Subsytem Operation - Release Allocated Space
537 struct dasd_dso_ras_data
{
540 __u8 message
:1; /* Must be zero */
542 __u8 vol_type
:1; /* 0 - CKD/FBA, 1 - FB */
545 /* Operation Flags to specify scope */
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 */
558 __u16 nr_exts
; /* Defines number of ext_scope - max 110 */
564 * some structures and definitions for alias handling
566 struct dasd_unit_address_configuration
{
571 } __attribute__((packed
));
574 #define MAX_DEVICES_PER_LCU 256
576 /* flags on the LCU */
577 #define NEED_UAC_UPDATE 0x01
578 #define UPDATE_PENDING 0x02
580 enum pavtype
{NO_PAV
, BASE_PAV
, HYPER_PAV
};
584 struct list_head serverlist
;
588 struct alias_server
{
589 struct list_head server
;
591 struct list_head lculist
;
594 struct summary_unit_check_work_data
{
596 struct dasd_device
*device
;
597 struct work_struct worker
;
600 struct read_uac_work_data
{
601 struct dasd_device
*device
;
602 struct delayed_work dwork
;
606 struct list_head lcu
;
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
;
621 struct alias_pav_group
{
622 struct list_head group
;
624 struct alias_lcu
*lcu
;
625 struct list_head baselist
;
626 struct list_head aliaslist
;
627 struct dasd_device
*next
;
630 struct dasd_conf_data
{
631 struct dasd_ned neds
[5];
633 struct dasd_gneq gneq
;
636 struct dasd_eckd_private
{
637 struct dasd_eckd_characteristics rdc_data
;
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
;
647 struct eckd_count count_area
[5];
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
;
656 /* alias managemnet */
658 struct alias_pav_group
*pavgroup
;
659 struct alias_lcu
*lcu
;
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 */