Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 2 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 4 | * Horst Hummel <Horst.Hummel@de.ibm.com> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * Bugreports.to..: <Linux390@de.ibm.com> |
Heiko Carstens | a53c8fa | 2012-07-20 11:15:04 +0200 | [diff] [blame] | 6 | * Copyright IBM Corp. 1999, 2000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | */ |
| 9 | |
| 10 | #ifndef DASD_ECKD_H |
| 11 | #define DASD_ECKD_H |
| 12 | |
| 13 | /***************************************************************************** |
| 14 | * SECTION: CCW Definitions |
| 15 | ****************************************************************************/ |
Stefan Haberland | 32ff8ce | 2022-09-20 21:26:16 +0200 | [diff] [blame] | 16 | #define DASD_ECKD_CCW_NOP 0x03 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Stefan Weinhuber | 196339f | 2010-10-29 16:50:43 +0200 | [diff] [blame] | 31 | #define DASD_ECKD_CCW_SNID 0x34 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #define DASD_ECKD_CCW_RSSD 0x3e |
| 33 | #define DASD_ECKD_CCW_LOCATE_RECORD 0x47 |
Jan Höppner | 45f186b | 2017-03-14 11:10:16 +0100 | [diff] [blame] | 34 | #define DASD_ECKD_CCW_LOCATE_RECORD_EXT 0x4b |
Stefan Weinhuber | 20c6446 | 2006-03-24 03:15:25 -0800 | [diff] [blame] | 35 | #define DASD_ECKD_CCW_SNSS 0x54 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Jan Höppner | 8fd5752 | 2015-08-19 13:41:20 +0200 | [diff] [blame] | 41 | #define DASD_ECKD_CCW_READ_COUNT_MT 0x92 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #define DASD_ECKD_CCW_RELEASE 0x94 |
Stefan Haberland | e4dbb0f | 2011-01-05 12:48:06 +0100 | [diff] [blame] | 43 | #define DASD_ECKD_CCW_WRITE_FULL_TRACK 0x95 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #define DASD_ECKD_CCW_READ_CKD_MT 0x9e |
| 45 | #define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 46 | #define DASD_ECKD_CCW_WRITE_TRACK_DATA 0xA5 |
| 47 | #define DASD_ECKD_CCW_READ_TRACK_DATA 0xA6 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | #define DASD_ECKD_CCW_RESERVE 0xB4 |
Stefan Haberland | e4dbb0f | 2011-01-05 12:48:06 +0100 | [diff] [blame] | 49 | #define DASD_ECKD_CCW_READ_TRACK 0xDE |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 50 | #define DASD_ECKD_CCW_PFX 0xE7 |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 51 | #define DASD_ECKD_CCW_PFX_READ 0xEA |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 52 | #define DASD_ECKD_CCW_RSCK 0xF9 |
Stefan Weinhuber | a4d26c6 | 2011-01-05 12:48:03 +0100 | [diff] [blame] | 53 | #define DASD_ECKD_CCW_RCD 0xFA |
Jan Höppner | 91dc4a1 | 2018-07-23 11:13:30 +0200 | [diff] [blame] | 54 | #define DASD_ECKD_CCW_DSO 0xF7 |
| 55 | |
Bhaskar Chowdhury | be4f361 | 2021-04-28 17:35:21 +0200 | [diff] [blame] | 56 | /* Define Subsystem Function / Orders */ |
Jan Höppner | 91dc4a1 | 2018-07-23 11:13:30 +0200 | [diff] [blame] | 57 | #define DSO_ORDER_RAS 0x81 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | /* |
Jan Höppner | 461db0e | 2018-05-29 17:03:10 +0200 | [diff] [blame] | 60 | * Perform Subsystem Function / Orders |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | */ |
Stefan Haberland | 5db8440 | 2014-10-01 14:39:47 +0200 | [diff] [blame] | 62 | #define PSF_ORDER_PRSSD 0x18 |
| 63 | #define PSF_ORDER_CUIR_RESPONSE 0x1A |
| 64 | #define PSF_ORDER_SSC 0x1D |
| 65 | |
| 66 | /* |
Jan Höppner | 461db0e | 2018-05-29 17:03:10 +0200 | [diff] [blame] | 67 | * Perform Subsystem Function / Sub-Orders |
| 68 | */ |
| 69 | #define PSF_SUBORDER_QHA 0x1C /* Query Host Access */ |
Stefan Haberland | 3f217cc | 2022-09-20 21:26:11 +0200 | [diff] [blame] | 70 | #define PSF_SUBORDER_PPRCEQ 0x50 /* PPRC Extended Query */ |
Jan Höppner | c729696 | 2018-05-29 16:58:03 +0200 | [diff] [blame] | 71 | #define PSF_SUBORDER_VSQ 0x52 /* Volume Storage Query */ |
| 72 | #define PSF_SUBORDER_LCQ 0x53 /* Logical Configuration Query */ |
Jan Höppner | 461db0e | 2018-05-29 17:03:10 +0200 | [diff] [blame] | 73 | |
| 74 | /* |
Stefan Haberland | 3f217cc | 2022-09-20 21:26:11 +0200 | [diff] [blame] | 75 | * PPRC Extended Query Scopes |
| 76 | */ |
| 77 | #define PPRCEQ_SCOPE_4 0x04 /* Scope 4 for PPRC Extended Query */ |
| 78 | |
| 79 | /* |
Stefan Haberland | 5db8440 | 2014-10-01 14:39:47 +0200 | [diff] [blame] | 80 | * CUIR response condition codes |
| 81 | */ |
| 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 |
| 92 | |
| 93 | /* |
| 94 | * CUIR codes |
| 95 | */ |
| 96 | #define CUIR_QUIESCE 0x01 |
| 97 | #define CUIR_RESUME 0x02 |
| 98 | |
| 99 | /* |
Jan Höppner | 9e12e54 | 2018-07-03 10:56:51 +0200 | [diff] [blame] | 100 | * Out-of-space (OOS) Codes |
| 101 | */ |
| 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 |
| 108 | |
| 109 | /* |
Stefan Haberland | 5db8440 | 2014-10-01 14:39:47 +0200 | [diff] [blame] | 110 | * attention message definitions |
| 111 | */ |
| 112 | #define ATTENTION_LENGTH_CUIR 0x0e |
| 113 | #define ATTENTION_FORMAT_CUIR 0x01 |
Jan Höppner | 9e12e54 | 2018-07-03 10:56:51 +0200 | [diff] [blame] | 114 | #define ATTENTION_LENGTH_OOS 0x10 |
| 115 | #define ATTENTION_FORMAT_OOS 0x06 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | |
Stefan Haberland | 5a3b7b1 | 2016-03-18 09:42:13 +0100 | [diff] [blame] | 117 | #define DASD_ECKD_PG_GROUPED 0x10 |
| 118 | |
Stefan Weinhuber | b44b0ab3 | 2009-03-26 15:23:47 +0100 | [diff] [blame] | 119 | /* |
Bhaskar Chowdhury | be4f361 | 2021-04-28 17:35:21 +0200 | [diff] [blame] | 120 | * Size that is reported for large volumes in the old 16-bit no_cyl field |
Stefan Weinhuber | b44b0ab3 | 2009-03-26 15:23:47 +0100 | [diff] [blame] | 121 | */ |
| 122 | #define LV_COMPAT_CYL 0xFFFE |
| 123 | |
Stefan Weinhuber | ef19298b | 2011-01-05 12:48:02 +0100 | [diff] [blame] | 124 | |
| 125 | #define FCX_MAX_DATA_FACTOR 65536 |
Stefan Weinhuber | a4d26c6 | 2011-01-05 12:48:03 +0100 | [diff] [blame] | 126 | #define DASD_ECKD_RCD_DATA_SIZE 256 |
Stefan Weinhuber | ef19298b | 2011-01-05 12:48:02 +0100 | [diff] [blame] | 127 | |
Stefan Haberland | a521b04 | 2016-08-08 15:56:54 +0200 | [diff] [blame] | 128 | #define DASD_ECKD_PATH_THRHLD 256 |
| 129 | #define DASD_ECKD_PATH_INTERVAL 300 |
Stefan Weinhuber | ef19298b | 2011-01-05 12:48:02 +0100 | [diff] [blame] | 130 | |
Jan Höppner | a0610a8 | 2018-04-27 16:55:27 +0200 | [diff] [blame] | 131 | /* |
| 132 | * Maximum number of blocks to be chained |
| 133 | */ |
| 134 | #define DASD_ECKD_MAX_BLOCKS 190 |
| 135 | #define DASD_ECKD_MAX_BLOCKS_RAW 256 |
| 136 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 137 | /***************************************************************************** |
| 138 | * SECTION: Type Definitions |
| 139 | ****************************************************************************/ |
| 140 | |
| 141 | struct eckd_count { |
| 142 | __u16 cyl; |
| 143 | __u16 head; |
| 144 | __u8 record; |
| 145 | __u8 kl; |
| 146 | __u16 dl; |
| 147 | } __attribute__ ((packed)); |
| 148 | |
| 149 | struct ch_t { |
| 150 | __u16 cyl; |
| 151 | __u16 head; |
| 152 | } __attribute__ ((packed)); |
| 153 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | struct chr_t { |
| 155 | __u16 cyl; |
| 156 | __u16 head; |
| 157 | __u8 record; |
| 158 | } __attribute__ ((packed)); |
| 159 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | struct DE_eckd_data { |
| 161 | struct { |
| 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; |
| 168 | struct { |
| 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 */ |
| 176 | __u16 fast_write_id; |
| 177 | __u8 ga_additional; /* Global Attributes Additional */ |
| 178 | __u8 ga_extended; /* Global Attributes Extended */ |
| 179 | struct ch_t beg_ext; |
| 180 | struct ch_t end_ext; |
Jan Höppner | 7bf76f01 | 2017-08-15 16:40:18 +0200 | [diff] [blame] | 181 | unsigned long ep_sys_time; /* Ext Parameter - System Time Stamp */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | __u8 ep_format; /* Extended Parameter format byte */ |
| 183 | __u8 ep_prio; /* Extended Parameter priority I/O byte */ |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 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 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | } __attribute__ ((packed)); |
| 188 | |
| 189 | struct LO_eckd_data { |
| 190 | struct { |
| 191 | unsigned char orientation:2; |
| 192 | unsigned char operation:6; |
| 193 | } __attribute__ ((packed)) operation; |
| 194 | struct { |
| 195 | unsigned char last_bytes_used:1; |
| 196 | unsigned char reserved:6; |
| 197 | unsigned char read_count_suffix:1; |
| 198 | } __attribute__ ((packed)) auxiliary; |
| 199 | __u8 unused; |
| 200 | __u8 count; |
| 201 | struct ch_t seek_addr; |
| 202 | struct chr_t search_arg; |
| 203 | __u8 sector; |
| 204 | __u16 length; |
| 205 | } __attribute__ ((packed)); |
| 206 | |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 207 | struct LRE_eckd_data { |
| 208 | struct { |
| 209 | unsigned char orientation:2; |
| 210 | unsigned char operation:6; |
| 211 | } __attribute__ ((packed)) operation; |
| 212 | struct { |
| 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; |
| 221 | __u8 imbedded_ccw; |
| 222 | __u8 count; |
| 223 | struct ch_t seek_addr; |
| 224 | struct chr_t search_arg; |
| 225 | __u8 sector; |
| 226 | __u16 length; |
| 227 | __u8 imbedded_count; |
| 228 | __u8 extended_operation; |
| 229 | __u16 extended_parameter_length; |
Gustavo A. R. Silva | fa226f1 | 2020-02-21 09:06:12 -0600 | [diff] [blame] | 230 | __u8 extended_parameter[]; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 231 | } __attribute__ ((packed)); |
| 232 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 233 | /* Prefix data for format 0x00 and 0x01 */ |
| 234 | struct PFX_eckd_data { |
| 235 | unsigned char format; |
| 236 | struct { |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 237 | unsigned char define_extent:1; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 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; |
| 243 | __u8 base_address; |
| 244 | __u8 aux; |
| 245 | __u8 base_lss; |
| 246 | __u8 reserved[7]; |
Stefan Weinhuber | f3eb538 | 2009-03-26 15:23:48 +0100 | [diff] [blame] | 247 | struct DE_eckd_data define_extent; |
| 248 | struct LRE_eckd_data locate_record; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 249 | } __attribute__ ((packed)); |
| 250 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | struct dasd_eckd_characteristics { |
| 252 | __u16 cu_type; |
| 253 | struct { |
| 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; |
| 260 | __u16 dev_type; |
| 261 | __u8 dev_model; |
| 262 | struct { |
| 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; |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 270 | unsigned char XRC_supported:1; |
Stefan Haberland | a91ff09d | 2022-09-20 21:26:12 +0200 | [diff] [blame] | 271 | unsigned char PPRC_enabled:1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | unsigned char striping:1; |
| 273 | unsigned char reserved5:4; |
| 274 | unsigned char cfw:1; |
| 275 | unsigned char reserved6:2; |
| 276 | unsigned char cache:1; |
| 277 | unsigned char dual_copy:1; |
| 278 | unsigned char dfw:1; |
| 279 | unsigned char reset_alleg:1; |
| 280 | unsigned char sense_down:1; |
| 281 | } __attribute__ ((packed)) facilities; |
| 282 | __u8 dev_class; |
| 283 | __u8 unit_type; |
| 284 | __u16 no_cyl; |
| 285 | __u16 trk_per_cyl; |
| 286 | __u8 sec_per_trk; |
| 287 | __u8 byte_per_track[3]; |
| 288 | __u16 home_bytes; |
| 289 | __u8 formula; |
| 290 | union { |
| 291 | struct { |
| 292 | __u8 f1; |
| 293 | __u16 f2; |
| 294 | __u16 f3; |
| 295 | } __attribute__ ((packed)) f_0x01; |
| 296 | struct { |
| 297 | __u8 f1; |
| 298 | __u8 f2; |
| 299 | __u8 f3; |
| 300 | __u8 f4; |
| 301 | __u8 f5; |
| 302 | } __attribute__ ((packed)) f_0x02; |
| 303 | } __attribute__ ((packed)) factors; |
| 304 | __u16 first_alt_trk; |
| 305 | __u16 no_alt_trk; |
| 306 | __u16 first_dia_trk; |
| 307 | __u16 no_dia_trk; |
| 308 | __u16 first_sup_trk; |
| 309 | __u16 no_sup_trk; |
| 310 | __u8 MDR_ID; |
| 311 | __u8 OBR_ID; |
| 312 | __u8 director; |
| 313 | __u8 rd_trk_set; |
| 314 | __u16 max_rec_zero; |
| 315 | __u8 reserved1; |
| 316 | __u8 RWANY_in_LR; |
| 317 | __u8 factor6; |
| 318 | __u8 factor7; |
| 319 | __u8 factor8; |
| 320 | __u8 reserved2[3]; |
Stefan Weinhuber | b44b0ab3 | 2009-03-26 15:23:47 +0100 | [diff] [blame] | 321 | __u8 reserved3[6]; |
| 322 | __u32 long_no_cyl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | } __attribute__ ((packed)); |
| 324 | |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 325 | /* elements of the configuration data */ |
| 326 | struct dasd_ned { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | struct { |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 328 | __u8 identifier:2; |
| 329 | __u8 token_id:1; |
| 330 | __u8 sno_valid:1; |
| 331 | __u8 subst_sno:1; |
| 332 | __u8 recNED:1; |
| 333 | __u8 emuNED:1; |
| 334 | __u8 reserved:1; |
| 335 | } __attribute__ ((packed)) flags; |
| 336 | __u8 descriptor; |
| 337 | __u8 dev_class; |
| 338 | __u8 reserved; |
| 339 | __u8 dev_type[6]; |
| 340 | __u8 dev_model[3]; |
| 341 | __u8 HDA_manufacturer[3]; |
Kees Cook | 2b7a8dc | 2021-07-01 16:22:21 +0200 | [diff] [blame] | 342 | struct { |
| 343 | __u8 HDA_location[2]; |
| 344 | __u8 HDA_seqno[12]; |
| 345 | } serial; |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 346 | __u8 ID; |
| 347 | __u8 unit_addr; |
| 348 | } __attribute__ ((packed)); |
| 349 | |
| 350 | struct dasd_sneq { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | struct { |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 352 | __u8 identifier:2; |
| 353 | __u8 reserved:6; |
| 354 | } __attribute__ ((packed)) flags; |
| 355 | __u8 res1; |
| 356 | __u16 format; |
| 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)); |
| 362 | |
| 363 | struct vd_sneq { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | struct { |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 365 | __u8 identifier:2; |
| 366 | __u8 reserved:6; |
| 367 | } __attribute__ ((packed)) flags; |
| 368 | __u8 res1; |
| 369 | __u16 format; |
| 370 | __u8 res2[4]; /* byte 4- 7 */ |
| 371 | __u8 uit[16]; /* byte 8-23 */ |
| 372 | __u8 res3[8]; /* byte 24-31 */ |
| 373 | } __attribute__ ((packed)); |
| 374 | |
| 375 | struct dasd_gneq { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | struct { |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 377 | __u8 identifier:2; |
| 378 | __u8 reserved:6; |
| 379 | } __attribute__ ((packed)) flags; |
Stefan Haberland | b179b03 | 2015-08-07 13:20:16 +0200 | [diff] [blame] | 380 | __u8 record_selector; |
| 381 | __u8 reserved[4]; |
Stefan Haberland | 7c8faa8 | 2010-08-09 18:13:00 +0200 | [diff] [blame] | 382 | struct { |
| 383 | __u8 value:2; |
| 384 | __u8 number:6; |
| 385 | } __attribute__ ((packed)) timeout; |
| 386 | __u8 reserved3; |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 387 | __u16 subsystemID; |
| 388 | __u8 reserved2[22]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | } __attribute__ ((packed)); |
| 390 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 391 | struct dasd_rssd_features { |
| 392 | char feature[256]; |
| 393 | } __attribute__((packed)); |
| 394 | |
Stefan Haberland | 5db8440 | 2014-10-01 14:39:47 +0200 | [diff] [blame] | 395 | struct dasd_rssd_messages { |
| 396 | __u16 length; |
| 397 | __u8 format; |
| 398 | __u8 code; |
| 399 | __u32 message_id; |
| 400 | __u8 flags; |
| 401 | char messages[4087]; |
| 402 | } __packed; |
| 403 | |
Jan Höppner | c729696 | 2018-05-29 16:58:03 +0200 | [diff] [blame] | 404 | /* |
| 405 | * Read Subsystem Data - Volume Storage Query |
| 406 | */ |
| 407 | struct dasd_rssd_vsq { |
| 408 | struct { |
| 409 | __u8 tse:1; |
| 410 | __u8 space_not_available:1; |
| 411 | __u8 ese:1; |
| 412 | __u8 unused:5; |
| 413 | } __packed vol_info; |
| 414 | __u8 unused1; |
| 415 | __u16 extent_pool_id; |
| 416 | __u8 warn_cap_limit; |
| 417 | __u8 warn_cap_guaranteed; |
| 418 | __u16 unused2; |
| 419 | __u32 limit_capacity; |
| 420 | __u32 guaranteed_capacity; |
| 421 | __u32 space_allocated; |
| 422 | __u32 space_configured; |
| 423 | __u32 logical_capacity; |
| 424 | } __packed; |
| 425 | |
| 426 | /* |
| 427 | * Extent Pool Summary |
| 428 | */ |
| 429 | struct dasd_ext_pool_sum { |
| 430 | __u16 pool_id; |
| 431 | __u8 repo_warn_thrshld; |
| 432 | __u8 warn_thrshld; |
| 433 | struct { |
| 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; |
| 440 | __u8 pool_oos:1; |
| 441 | __u8 unused0:1; |
| 442 | __u8 unused1; |
| 443 | } __packed flags; |
| 444 | struct { |
| 445 | __u8 reserved0:1; |
| 446 | __u8 size_1G:1; |
| 447 | __u8 reserved1:5; |
| 448 | __u8 size_16M:1; |
| 449 | } __packed extent_size; |
| 450 | __u8 unused; |
| 451 | } __packed; |
| 452 | |
| 453 | /* |
| 454 | * Read Subsystem Data-Response - Logical Configuration Query - Header |
| 455 | */ |
| 456 | struct dasd_rssd_lcq { |
| 457 | __u16 data_length; /* Length of data returned */ |
| 458 | __u16 pool_count; /* Count of extent pools returned - Max: 448 */ |
| 459 | struct { |
| 460 | __u8 pool_info_valid:1; /* Detailed Information valid */ |
| 461 | __u8 pool_id_volume:1; |
| 462 | __u8 pool_id_cec:1; |
| 463 | __u8 unused0:5; |
| 464 | __u8 unused1; |
| 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 */ |
| 469 | __u8 reserved[7]; |
| 470 | struct dasd_ext_pool_sum ext_pool_sum[448]; |
| 471 | } __packed; |
| 472 | |
Jan Höppner | 9e12e54 | 2018-07-03 10:56:51 +0200 | [diff] [blame] | 473 | struct dasd_oos_message { |
| 474 | __u16 length; |
| 475 | __u8 format; |
| 476 | __u8 code; |
| 477 | __u8 percentage_empty; |
| 478 | __u8 reserved; |
| 479 | __u16 ext_pool_id; |
| 480 | __u16 token; |
| 481 | __u8 unused[6]; |
| 482 | } __packed; |
| 483 | |
Stefan Haberland | 5db8440 | 2014-10-01 14:39:47 +0200 | [diff] [blame] | 484 | struct dasd_cuir_message { |
| 485 | __u16 length; |
| 486 | __u8 format; |
| 487 | __u8 code; |
| 488 | __u32 message_id; |
| 489 | __u8 flags; |
| 490 | __u8 neq_map[3]; |
| 491 | __u8 ned_map; |
| 492 | __u8 record_selector; |
| 493 | } __packed; |
| 494 | |
| 495 | struct dasd_psf_cuir_response { |
| 496 | __u8 order; |
| 497 | __u8 flags; |
| 498 | __u8 cc; |
| 499 | __u8 chpid; |
| 500 | __u16 device_nr; |
| 501 | __u16 reserved; |
| 502 | __u32 message_id; |
| 503 | __u64 system_id; |
| 504 | __u8 cssid; |
| 505 | __u8 ssid; |
| 506 | } __packed; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 507 | |
Stefan Haberland | 5a3b7b1 | 2016-03-18 09:42:13 +0100 | [diff] [blame] | 508 | struct dasd_ckd_path_group_entry { |
| 509 | __u8 status_flags; |
| 510 | __u8 pgid[11]; |
| 511 | __u8 sysplex_name[8]; |
| 512 | __u32 timestamp; |
| 513 | __u32 cylinder; |
| 514 | __u8 reserved[4]; |
| 515 | } __packed; |
| 516 | |
| 517 | struct dasd_ckd_host_information { |
| 518 | __u8 access_flags; |
| 519 | __u8 entry_size; |
| 520 | __u16 entry_count; |
| 521 | __u8 entry[16390]; |
| 522 | } __packed; |
| 523 | |
| 524 | struct dasd_psf_query_host_access { |
| 525 | __u8 access_flag; |
| 526 | __u8 version; |
| 527 | __u16 CKD_length; |
| 528 | __u16 SCSI_length; |
| 529 | __u8 unused[10]; |
| 530 | __u8 host_access_information[16394]; |
| 531 | } __packed; |
| 532 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | /* |
Horst Hummel | 138c014 | 2006-06-29 14:58:12 +0200 | [diff] [blame] | 534 | * Perform Subsystem Function - Prepare for Read Subsystem Data |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | */ |
| 536 | struct dasd_psf_prssd_data { |
| 537 | unsigned char order; |
| 538 | unsigned char flags; |
Stefan Haberland | 5a3b7b1 | 2016-03-18 09:42:13 +0100 | [diff] [blame] | 539 | unsigned char reserved1; |
| 540 | unsigned char reserved2; |
| 541 | unsigned char lss; |
| 542 | unsigned char volume; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | unsigned char suborder; |
Stefan Weinhuber | 49fd38b | 2008-08-21 19:46:38 +0200 | [diff] [blame] | 544 | unsigned char varies[5]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 545 | } __attribute__ ((packed)); |
| 546 | |
Horst Hummel | 4054557 | 2006-06-29 15:08:18 +0200 | [diff] [blame] | 547 | /* |
| 548 | * Perform Subsystem Function - Set Subsystem Characteristics |
| 549 | */ |
| 550 | struct dasd_psf_ssc_data { |
| 551 | unsigned char order; |
| 552 | unsigned char flags; |
| 553 | unsigned char cu_type[4]; |
| 554 | unsigned char suborder; |
| 555 | unsigned char reserved[59]; |
| 556 | } __attribute__((packed)); |
| 557 | |
Jan Höppner | 91dc4a1 | 2018-07-23 11:13:30 +0200 | [diff] [blame] | 558 | /* Maximum number of extents for a single Release Allocated Space command */ |
| 559 | #define DASD_ECKD_RAS_EXTS_MAX 110U |
| 560 | |
| 561 | struct dasd_dso_ras_ext_range { |
| 562 | struct ch_t beg_ext; |
| 563 | struct ch_t end_ext; |
| 564 | } __packed; |
| 565 | |
| 566 | /* |
Bhaskar Chowdhury | be4f361 | 2021-04-28 17:35:21 +0200 | [diff] [blame] | 567 | * Define Subsystem Operation - Release Allocated Space |
Jan Höppner | 91dc4a1 | 2018-07-23 11:13:30 +0200 | [diff] [blame] | 568 | */ |
| 569 | struct dasd_dso_ras_data { |
| 570 | __u8 order; |
| 571 | struct { |
| 572 | __u8 message:1; /* Must be zero */ |
| 573 | __u8 reserved1:2; |
| 574 | __u8 vol_type:1; /* 0 - CKD/FBA, 1 - FB */ |
| 575 | __u8 reserved2:4; |
| 576 | } __packed flags; |
| 577 | /* Operation Flags to specify scope */ |
| 578 | struct { |
| 579 | __u8 reserved1:2; |
| 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 */ |
| 584 | __u16 reserved2:11; |
| 585 | } __packed op_flags; |
| 586 | __u8 lss; |
| 587 | __u8 dev_addr; |
| 588 | __u32 reserved1; |
| 589 | __u8 reserved2[10]; |
| 590 | __u16 nr_exts; /* Defines number of ext_scope - max 110 */ |
| 591 | __u16 reserved3; |
| 592 | } __packed; |
| 593 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 594 | |
| 595 | /* |
| 596 | * some structures and definitions for alias handling |
| 597 | */ |
| 598 | struct dasd_unit_address_configuration { |
| 599 | struct { |
| 600 | char ua_type; |
| 601 | char base_ua; |
| 602 | } unit[256]; |
| 603 | } __attribute__((packed)); |
| 604 | |
| 605 | |
| 606 | #define MAX_DEVICES_PER_LCU 256 |
| 607 | |
| 608 | /* flags on the LCU */ |
| 609 | #define NEED_UAC_UPDATE 0x01 |
| 610 | #define UPDATE_PENDING 0x02 |
| 611 | |
| 612 | enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV}; |
| 613 | |
| 614 | |
| 615 | struct alias_root { |
| 616 | struct list_head serverlist; |
| 617 | spinlock_t lock; |
| 618 | }; |
| 619 | |
| 620 | struct alias_server { |
| 621 | struct list_head server; |
| 622 | struct dasd_uid uid; |
| 623 | struct list_head lculist; |
| 624 | }; |
| 625 | |
| 626 | struct summary_unit_check_work_data { |
| 627 | char reason; |
| 628 | struct dasd_device *device; |
| 629 | struct work_struct worker; |
| 630 | }; |
| 631 | |
| 632 | struct read_uac_work_data { |
| 633 | struct dasd_device *device; |
| 634 | struct delayed_work dwork; |
| 635 | }; |
| 636 | |
| 637 | struct alias_lcu { |
| 638 | struct list_head lcu; |
| 639 | struct dasd_uid uid; |
| 640 | enum pavtype pav; |
| 641 | char flags; |
| 642 | spinlock_t lock; |
| 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; |
Stefan Weinhuber | f4ac1d0 | 2009-12-07 12:51:53 +0100 | [diff] [blame] | 650 | struct completion lcu_setup; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 651 | }; |
| 652 | |
| 653 | struct alias_pav_group { |
| 654 | struct list_head group; |
| 655 | struct dasd_uid uid; |
| 656 | struct alias_lcu *lcu; |
| 657 | struct list_head baselist; |
| 658 | struct list_head aliaslist; |
| 659 | struct dasd_device *next; |
| 660 | }; |
| 661 | |
Stefan Haberland | b179b03 | 2015-08-07 13:20:16 +0200 | [diff] [blame] | 662 | struct dasd_conf_data { |
| 663 | struct dasd_ned neds[5]; |
| 664 | u8 reserved[64]; |
| 665 | struct dasd_gneq gneq; |
| 666 | } __packed; |
| 667 | |
Stefan Haberland | 542e30c | 2021-10-20 13:51:22 +0200 | [diff] [blame] | 668 | struct dasd_conf { |
| 669 | u8 *data; |
| 670 | int len; |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 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; |
Stefan Haberland | 542e30c | 2021-10-20 13:51:22 +0200 | [diff] [blame] | 676 | }; |
| 677 | |
| 678 | struct dasd_eckd_private { |
| 679 | struct dasd_eckd_characteristics rdc_data; |
| 680 | struct dasd_conf conf; |
Stefan Weinhuber | 4abb08c | 2008-08-01 16:39:09 +0200 | [diff] [blame] | 681 | |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 682 | struct eckd_count count_area[5]; |
| 683 | int init_cqr_status; |
| 684 | int uses_cdl; |
| 685 | struct attrib_data_t attrib; /* e.g. cache operations */ |
| 686 | struct dasd_rssd_features features; |
Jan Höppner | c729696 | 2018-05-29 16:58:03 +0200 | [diff] [blame] | 687 | struct dasd_rssd_vsq vsq; |
| 688 | struct dasd_ext_pool_sum eps; |
Stefan Weinhuber | b44b0ab3 | 2009-03-26 15:23:47 +0100 | [diff] [blame] | 689 | u32 real_cyl; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 690 | |
Bhaskar Chowdhury | be4f361 | 2021-04-28 17:35:21 +0200 | [diff] [blame] | 691 | /* alias management */ |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 692 | struct dasd_uid uid; |
| 693 | struct alias_pav_group *pavgroup; |
| 694 | struct alias_lcu *lcu; |
| 695 | int count; |
Stefan Weinhuber | ef19298b | 2011-01-05 12:48:02 +0100 | [diff] [blame] | 696 | |
| 697 | u32 fcx_max_data; |
Stefan Haberland | 59a9ed5 | 2016-02-23 10:15:27 +0100 | [diff] [blame] | 698 | char suc_reason; |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 699 | }; |
| 700 | |
| 701 | |
| 702 | |
| 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 *); |
Stefan Haberland | 59a9ed5 | 2016-02-23 10:15:27 +0100 | [diff] [blame] | 708 | void dasd_alias_handle_summary_unit_check(struct work_struct *); |
Stefan Weinhuber | 8e09f21 | 2008-01-26 14:11:23 +0100 | [diff] [blame] | 709 | void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *); |
Stefan Haberland | 501183f | 2010-05-17 10:00:10 +0200 | [diff] [blame] | 710 | int dasd_alias_update_add_device(struct dasd_device *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 711 | #endif /* DASD_ECKD_H */ |