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_NOP 0x03
17 #define DASD_ECKD_CCW_WRITE 0x05
18 #define DASD_ECKD_CCW_READ 0x06
19 #define DASD_ECKD_CCW_WRITE_HOME_ADDRESS 0x09
20 #define DASD_ECKD_CCW_READ_HOME_ADDRESS 0x0a
21 #define DASD_ECKD_CCW_WRITE_KD 0x0d
22 #define DASD_ECKD_CCW_READ_KD 0x0e
23 #define DASD_ECKD_CCW_ERASE 0x11
24 #define DASD_ECKD_CCW_READ_COUNT 0x12
25 #define DASD_ECKD_CCW_SLCK 0x14
26 #define DASD_ECKD_CCW_WRITE_RECORD_ZERO 0x15
27 #define DASD_ECKD_CCW_READ_RECORD_ZERO 0x16
28 #define DASD_ECKD_CCW_WRITE_CKD 0x1d
29 #define DASD_ECKD_CCW_READ_CKD 0x1e
30 #define DASD_ECKD_CCW_PSF 0x27
31 #define DASD_ECKD_CCW_SNID 0x34
32 #define DASD_ECKD_CCW_RSSD 0x3e
33 #define DASD_ECKD_CCW_LOCATE_RECORD 0x47
34 #define DASD_ECKD_CCW_LOCATE_RECORD_EXT 0x4b
35 #define DASD_ECKD_CCW_SNSS 0x54
36 #define DASD_ECKD_CCW_DEFINE_EXTENT 0x63
37 #define DASD_ECKD_CCW_WRITE_MT 0x85
38 #define DASD_ECKD_CCW_READ_MT 0x86
39 #define DASD_ECKD_CCW_WRITE_KD_MT 0x8d
40 #define DASD_ECKD_CCW_READ_KD_MT 0x8e
41 #define DASD_ECKD_CCW_READ_COUNT_MT 0x92
42 #define DASD_ECKD_CCW_RELEASE 0x94
43 #define DASD_ECKD_CCW_WRITE_FULL_TRACK 0x95
44 #define DASD_ECKD_CCW_READ_CKD_MT 0x9e
45 #define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d
46 #define DASD_ECKD_CCW_WRITE_TRACK_DATA 0xA5
47 #define DASD_ECKD_CCW_READ_TRACK_DATA 0xA6
48 #define DASD_ECKD_CCW_RESERVE 0xB4
49 #define DASD_ECKD_CCW_READ_TRACK 0xDE
50 #define DASD_ECKD_CCW_PFX 0xE7
51 #define DASD_ECKD_CCW_PFX_READ 0xEA
52 #define DASD_ECKD_CCW_RSCK 0xF9
53 #define DASD_ECKD_CCW_RCD 0xFA
54 #define DASD_ECKD_CCW_DSO 0xF7
56 /* Define Subsystem Function / Orders */
57 #define DSO_ORDER_RAS 0x81
60 * Perform Subsystem Function / Orders
62 #define PSF_ORDER_PRSSD 0x18
63 #define PSF_ORDER_CUIR_RESPONSE 0x1A
64 #define PSF_ORDER_SSC 0x1D
67 * Perform Subsystem Function / Sub-Orders
69 #define PSF_SUBORDER_QHA 0x1C /* Query Host Access */
70 #define PSF_SUBORDER_PPRCEQ 0x50 /* PPRC Extended Query */
71 #define PSF_SUBORDER_VSQ 0x52 /* Volume Storage Query */
72 #define PSF_SUBORDER_LCQ 0x53 /* Logical Configuration Query */
75 * PPRC Extended Query Scopes
77 #define PPRCEQ_SCOPE_4 0x04 /* Scope 4 for PPRC Extended Query */
80 * CUIR response condition codes
82 #define PSF_CUIR_INVALID 0x00
83 #define PSF_CUIR_COMPLETED 0x01
84 #define PSF_CUIR_NOT_SUPPORTED 0x02
85 #define PSF_CUIR_ERROR_IN_REQ 0x03
86 #define PSF_CUIR_DENIED 0x04
87 #define PSF_CUIR_LAST_PATH 0x05
88 #define PSF_CUIR_DEVICE_ONLINE 0x06
89 #define PSF_CUIR_VARY_FAILURE 0x07
90 #define PSF_CUIR_SOFTWARE_FAILURE 0x08
91 #define PSF_CUIR_NOT_RECOGNIZED 0x09
96 #define CUIR_QUIESCE 0x01
97 #define CUIR_RESUME 0x02
100 * Out-of-space (OOS) Codes
102 #define REPO_WARN 0x01
103 #define REPO_EXHAUST 0x02
104 #define POOL_WARN 0x03
105 #define POOL_EXHAUST 0x04
106 #define REPO_RELIEVE 0x05
107 #define POOL_RELIEVE 0x06
110 * attention message definitions
112 #define ATTENTION_LENGTH_CUIR 0x0e
113 #define ATTENTION_FORMAT_CUIR 0x01
114 #define ATTENTION_LENGTH_OOS 0x10
115 #define ATTENTION_FORMAT_OOS 0x06
117 #define DASD_ECKD_PG_GROUPED 0x10
120 * Size that is reported for large volumes in the old 16-bit no_cyl field
122 #define LV_COMPAT_CYL 0xFFFE
125 #define FCX_MAX_DATA_FACTOR 65536
126 #define DASD_ECKD_RCD_DATA_SIZE 256
128 #define DASD_ECKD_PATH_THRHLD 256
129 #define DASD_ECKD_PATH_INTERVAL 300
132 * Maximum number of blocks to be chained
134 #define DASD_ECKD_MAX_BLOCKS 190
135 #define DASD_ECKD_MAX_BLOCKS_RAW 256
137 /*****************************************************************************
138 * SECTION: Type Definitions
139 ****************************************************************************/
147 } __attribute__ ((packed
));
152 } __attribute__ ((packed
));
158 } __attribute__ ((packed
));
160 struct DE_eckd_data
{
162 unsigned char perm
:2; /* Permissions on this extent */
163 unsigned char reserved
:1;
164 unsigned char seek
:2; /* Seek control */
165 unsigned char auth
:2; /* Access authorization */
166 unsigned char pci
:1; /* PCI Fetch mode */
167 } __attribute__ ((packed
)) mask
;
169 unsigned char mode
:2; /* Architecture mode */
170 unsigned char ckd
:1; /* CKD Conversion */
171 unsigned char operation
:3; /* Operation mode */
172 unsigned char cfw
:1; /* Cache fast write */
173 unsigned char dfw
:1; /* DASD fast write */
174 } __attribute__ ((packed
)) attributes
;
175 __u16 blk_size
; /* Blocksize */
177 __u8 ga_additional
; /* Global Attributes Additional */
178 __u8 ga_extended
; /* Global Attributes Extended */
181 unsigned long ep_sys_time
; /* Ext Parameter - System Time Stamp */
182 __u8 ep_format
; /* Extended Parameter format byte */
183 __u8 ep_prio
; /* Extended Parameter priority I/O byte */
184 __u8 ep_reserved1
; /* Extended Parameter Reserved */
185 __u8 ep_rec_per_track
; /* Number of records on a track */
186 __u8 ep_reserved
[4]; /* Extended Parameter Reserved */
187 } __attribute__ ((packed
));
189 struct LO_eckd_data
{
191 unsigned char orientation
:2;
192 unsigned char operation
:6;
193 } __attribute__ ((packed
)) operation
;
195 unsigned char last_bytes_used
:1;
196 unsigned char reserved
:6;
197 unsigned char read_count_suffix
:1;
198 } __attribute__ ((packed
)) auxiliary
;
201 struct ch_t seek_addr
;
202 struct chr_t search_arg
;
205 } __attribute__ ((packed
));
207 struct LRE_eckd_data
{
209 unsigned char orientation
:2;
210 unsigned char operation
:6;
211 } __attribute__ ((packed
)) operation
;
213 unsigned char length_valid
:1;
214 unsigned char length_scope
:1;
215 unsigned char imbedded_ccw_valid
:1;
216 unsigned char check_bytes
:2;
217 unsigned char imbedded_count_valid
:1;
218 unsigned char reserved
:1;
219 unsigned char read_count_suffix
:1;
220 } __attribute__ ((packed
)) auxiliary
;
223 struct ch_t seek_addr
;
224 struct chr_t search_arg
;
228 __u8 extended_operation
;
229 __u16 extended_parameter_length
;
230 __u8 extended_parameter
[];
231 } __attribute__ ((packed
));
233 /* Prefix data for format 0x00 and 0x01 */
234 struct PFX_eckd_data
{
235 unsigned char format
;
237 unsigned char define_extent
:1;
238 unsigned char time_stamp
:1;
239 unsigned char verify_base
:1;
240 unsigned char hyper_pav
:1;
241 unsigned char reserved
:4;
242 } __attribute__ ((packed
)) validity
;
247 struct DE_eckd_data define_extent
;
248 struct LRE_eckd_data locate_record
;
249 } __attribute__ ((packed
));
251 struct dasd_eckd_characteristics
{
254 unsigned char support
:2;
255 unsigned char async
:1;
256 unsigned char reserved
:1;
257 unsigned char cache_info
:1;
258 unsigned char model
:3;
259 } __attribute__ ((packed
)) cu_model
;
263 unsigned char mult_burst
:1;
264 unsigned char RT_in_LR
:1;
265 unsigned char reserved1
:1;
266 unsigned char RD_IN_LR
:1;
267 unsigned char reserved2
:4;
268 unsigned char reserved3
:8;
269 unsigned char defect_wr
:1;
270 unsigned char XRC_supported
:1;
271 unsigned char PPRC_enabled
:1;
272 unsigned char striping
:1;
273 unsigned char reserved5
:4;
275 unsigned char reserved6
:2;
276 unsigned char cache
:1;
277 unsigned char dual_copy
:1;
279 unsigned char reset_alleg
:1;
280 unsigned char sense_down
:1;
281 } __attribute__ ((packed
)) facilities
;
287 __u8 byte_per_track
[3];
295 } __attribute__ ((packed
)) f_0x01
;
302 } __attribute__ ((packed
)) f_0x02
;
303 } __attribute__ ((packed
)) factors
;
323 } __attribute__ ((packed
));
325 /* elements of the configuration data */
335 } __attribute__ ((packed
)) flags
;
341 __u8 HDA_manufacturer
[3];
343 __u8 HDA_location
[2];
348 } __attribute__ ((packed
));
354 } __attribute__ ((packed
)) flags
;
357 __u8 res2
[4]; /* byte 4- 7 */
358 __u8 sua_flags
; /* byte 8 */
359 __u8 base_unit_addr
; /* byte 9 */
360 __u8 res3
[22]; /* byte 10-31 */
361 } __attribute__ ((packed
));
367 } __attribute__ ((packed
)) flags
;
370 __u8 res2
[4]; /* byte 4- 7 */
371 __u8 uit
[16]; /* byte 8-23 */
372 __u8 res3
[8]; /* byte 24-31 */
373 } __attribute__ ((packed
));
379 } __attribute__ ((packed
)) flags
;
380 __u8 record_selector
;
385 } __attribute__ ((packed
)) timeout
;
389 } __attribute__ ((packed
));
391 struct dasd_rssd_features
{
393 } __attribute__((packed
));
395 struct dasd_rssd_messages
{
405 * Read Subsystem Data - Volume Storage Query
407 struct dasd_rssd_vsq
{
410 __u8 space_not_available
:1;
415 __u16 extent_pool_id
;
417 __u8 warn_cap_guaranteed
;
419 __u32 limit_capacity
;
420 __u32 guaranteed_capacity
;
421 __u32 space_allocated
;
422 __u32 space_configured
;
423 __u32 logical_capacity
;
427 * Extent Pool Summary
429 struct dasd_ext_pool_sum
{
431 __u8 repo_warn_thrshld
;
434 __u8 type
:1; /* 0 - CKD / 1 - FB */
435 __u8 track_space_efficient
:1;
436 __u8 extent_space_efficient
:1;
437 __u8 standard_volume
:1;
438 __u8 extent_size_valid
:1;
439 __u8 capacity_at_warnlevel
:1;
449 } __packed extent_size
;
454 * Read Subsystem Data-Response - Logical Configuration Query - Header
456 struct dasd_rssd_lcq
{
457 __u16 data_length
; /* Length of data returned */
458 __u16 pool_count
; /* Count of extent pools returned - Max: 448 */
460 __u8 pool_info_valid
:1; /* Detailed Information valid */
461 __u8 pool_id_volume
:1;
465 } __packed header_flags
;
466 char sfi_type
[6]; /* Storage Facility Image Type (EBCDIC) */
467 char sfi_model
[3]; /* Storage Facility Image Model (EBCDIC) */
468 __u8 sfi_seq_num
[10]; /* Storage Facility Image Sequence Number */
470 struct dasd_ext_pool_sum ext_pool_sum
[448];
473 struct dasd_oos_message
{
477 __u8 percentage_empty
;
484 struct dasd_cuir_message
{
492 __u8 record_selector
;
495 struct dasd_psf_cuir_response
{
508 struct dasd_ckd_path_group_entry
{
511 __u8 sysplex_name
[8];
517 struct dasd_ckd_host_information
{
524 struct dasd_psf_query_host_access
{
530 __u8 host_access_information
[16394];
534 * Perform Subsystem Function - Prepare for Read Subsystem Data
536 struct dasd_psf_prssd_data
{
539 unsigned char reserved1
;
540 unsigned char reserved2
;
542 unsigned char volume
;
543 unsigned char suborder
;
544 unsigned char varies
[5];
545 } __attribute__ ((packed
));
548 * Perform Subsystem Function - Set Subsystem Characteristics
550 struct dasd_psf_ssc_data
{
553 unsigned char cu_type
[4];
554 unsigned char suborder
;
555 unsigned char reserved
[59];
556 } __attribute__((packed
));
558 /* Maximum number of extents for a single Release Allocated Space command */
559 #define DASD_ECKD_RAS_EXTS_MAX 110U
561 struct dasd_dso_ras_ext_range
{
567 * Define Subsystem Operation - Release Allocated Space
569 struct dasd_dso_ras_data
{
572 __u8 message
:1; /* Must be zero */
574 __u8 vol_type
:1; /* 0 - CKD/FBA, 1 - FB */
577 /* Operation Flags to specify scope */
580 /* Release Space by Extent */
581 __u8 by_extent
:1; /* 0 - entire volume, 1 - specified extents */
582 __u8 guarantee_init
:1;
583 __u8 force_release
:1; /* Internal - will be ignored */
590 __u16 nr_exts
; /* Defines number of ext_scope - max 110 */
596 * some structures and definitions for alias handling
598 struct dasd_unit_address_configuration
{
603 } __attribute__((packed
));
606 #define MAX_DEVICES_PER_LCU 256
608 /* flags on the LCU */
609 #define NEED_UAC_UPDATE 0x01
610 #define UPDATE_PENDING 0x02
612 enum pavtype
{NO_PAV
, BASE_PAV
, HYPER_PAV
};
616 struct list_head serverlist
;
620 struct alias_server
{
621 struct list_head server
;
623 struct list_head lculist
;
626 struct summary_unit_check_work_data
{
628 struct dasd_device
*device
;
629 struct work_struct worker
;
632 struct read_uac_work_data
{
633 struct dasd_device
*device
;
634 struct delayed_work dwork
;
638 struct list_head lcu
;
643 struct list_head grouplist
;
644 struct list_head active_devices
;
645 struct list_head inactive_devices
;
646 struct dasd_unit_address_configuration
*uac
;
647 struct summary_unit_check_work_data suc_data
;
648 struct read_uac_work_data ruac_data
;
649 struct dasd_ccw_req
*rsu_cqr
;
650 struct completion lcu_setup
;
653 struct alias_pav_group
{
654 struct list_head group
;
656 struct alias_lcu
*lcu
;
657 struct list_head baselist
;
658 struct list_head aliaslist
;
659 struct dasd_device
*next
;
662 struct dasd_conf_data
{
663 struct dasd_ned neds
[5];
665 struct dasd_gneq gneq
;
671 /* pointers to specific parts in the conf_data */
672 struct dasd_ned
*ned
;
673 struct dasd_sneq
*sneq
;
674 struct vd_sneq
*vdsneq
;
675 struct dasd_gneq
*gneq
;
678 struct dasd_eckd_private
{
679 struct dasd_eckd_characteristics rdc_data
;
680 struct dasd_conf conf
;
682 struct eckd_count count_area
[5];
685 struct attrib_data_t attrib
; /* e.g. cache operations */
686 struct dasd_rssd_features features
;
687 struct dasd_rssd_vsq vsq
;
688 struct dasd_ext_pool_sum eps
;
691 /* alias management */
693 struct alias_pav_group
*pavgroup
;
694 struct alias_lcu
*lcu
;
703 int dasd_alias_make_device_known_to_lcu(struct dasd_device
*);
704 void dasd_alias_disconnect_device_from_lcu(struct dasd_device
*);
705 int dasd_alias_add_device(struct dasd_device
*);
706 int dasd_alias_remove_device(struct dasd_device
*);
707 struct dasd_device
*dasd_alias_get_start_dev(struct dasd_device
*);
708 void dasd_alias_handle_summary_unit_check(struct work_struct
*);
709 void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req
*);
710 int dasd_alias_update_add_device(struct dasd_device
*);
711 #endif /* DASD_ECKD_H */