1 /* 2 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> 3 * Horst Hummel <Horst.Hummel@de.ibm.com> 4 * Bugreports.to..: <Linux390@de.ibm.com> 5 * Copyright IBM Corp. 1999, 2000 6 * 7 */ 8 9 #ifndef DASD_ECKD_H 10 #define DASD_ECKD_H 11 12 /***************************************************************************** 13 * SECTION: CCW Definitions 14 ****************************************************************************/ 15 #define DASD_ECKD_CCW_WRITE 0x05 16 #define DASD_ECKD_CCW_READ 0x06 17 #define DASD_ECKD_CCW_WRITE_HOME_ADDRESS 0x09 18 #define DASD_ECKD_CCW_READ_HOME_ADDRESS 0x0a 19 #define DASD_ECKD_CCW_WRITE_KD 0x0d 20 #define DASD_ECKD_CCW_READ_KD 0x0e 21 #define DASD_ECKD_CCW_ERASE 0x11 22 #define DASD_ECKD_CCW_READ_COUNT 0x12 23 #define DASD_ECKD_CCW_SLCK 0x14 24 #define DASD_ECKD_CCW_WRITE_RECORD_ZERO 0x15 25 #define DASD_ECKD_CCW_READ_RECORD_ZERO 0x16 26 #define DASD_ECKD_CCW_WRITE_CKD 0x1d 27 #define DASD_ECKD_CCW_READ_CKD 0x1e 28 #define DASD_ECKD_CCW_PSF 0x27 29 #define DASD_ECKD_CCW_SNID 0x34 30 #define DASD_ECKD_CCW_RSSD 0x3e 31 #define DASD_ECKD_CCW_LOCATE_RECORD 0x47 32 #define DASD_ECKD_CCW_SNSS 0x54 33 #define DASD_ECKD_CCW_DEFINE_EXTENT 0x63 34 #define DASD_ECKD_CCW_WRITE_MT 0x85 35 #define DASD_ECKD_CCW_READ_MT 0x86 36 #define DASD_ECKD_CCW_WRITE_KD_MT 0x8d 37 #define DASD_ECKD_CCW_READ_KD_MT 0x8e 38 #define DASD_ECKD_CCW_RELEASE 0x94 39 #define DASD_ECKD_CCW_WRITE_FULL_TRACK 0x95 40 #define DASD_ECKD_CCW_READ_CKD_MT 0x9e 41 #define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d 42 #define DASD_ECKD_CCW_WRITE_TRACK_DATA 0xA5 43 #define DASD_ECKD_CCW_READ_TRACK_DATA 0xA6 44 #define DASD_ECKD_CCW_RESERVE 0xB4 45 #define DASD_ECKD_CCW_READ_TRACK 0xDE 46 #define DASD_ECKD_CCW_PFX 0xE7 47 #define DASD_ECKD_CCW_PFX_READ 0xEA 48 #define DASD_ECKD_CCW_RSCK 0xF9 49 #define DASD_ECKD_CCW_RCD 0xFA 50 51 /* 52 * Perform Subsystem Function / Sub-Orders 53 */ 54 #define PSF_ORDER_PRSSD 0x18 55 #define PSF_ORDER_SSC 0x1D 56 57 /* 58 * Size that is reportet for large volumes in the old 16-bit no_cyl field 59 */ 60 #define LV_COMPAT_CYL 0xFFFE 61 62 63 #define FCX_MAX_DATA_FACTOR 65536 64 #define DASD_ECKD_RCD_DATA_SIZE 256 65 66 67 /***************************************************************************** 68 * SECTION: Type Definitions 69 ****************************************************************************/ 70 71 struct eckd_count { 72 __u16 cyl; 73 __u16 head; 74 __u8 record; 75 __u8 kl; 76 __u16 dl; 77 } __attribute__ ((packed)); 78 79 struct ch_t { 80 __u16 cyl; 81 __u16 head; 82 } __attribute__ ((packed)); 83 84 struct chs_t { 85 __u16 cyl; 86 __u16 head; 87 __u32 sector; 88 } __attribute__ ((packed)); 89 90 struct chr_t { 91 __u16 cyl; 92 __u16 head; 93 __u8 record; 94 } __attribute__ ((packed)); 95 96 struct geom_t { 97 __u16 cyl; 98 __u16 head; 99 __u32 sector; 100 } __attribute__ ((packed)); 101 102 struct eckd_home { 103 __u8 skip_control[14]; 104 __u16 cell_number; 105 __u8 physical_addr[3]; 106 __u8 flag; 107 struct ch_t track_addr; 108 __u8 reserved; 109 __u8 key_length; 110 __u8 reserved2[2]; 111 } __attribute__ ((packed)); 112 113 struct DE_eckd_data { 114 struct { 115 unsigned char perm:2; /* Permissions on this extent */ 116 unsigned char reserved:1; 117 unsigned char seek:2; /* Seek control */ 118 unsigned char auth:2; /* Access authorization */ 119 unsigned char pci:1; /* PCI Fetch mode */ 120 } __attribute__ ((packed)) mask; 121 struct { 122 unsigned char mode:2; /* Architecture mode */ 123 unsigned char ckd:1; /* CKD Conversion */ 124 unsigned char operation:3; /* Operation mode */ 125 unsigned char cfw:1; /* Cache fast write */ 126 unsigned char dfw:1; /* DASD fast write */ 127 } __attribute__ ((packed)) attributes; 128 __u16 blk_size; /* Blocksize */ 129 __u16 fast_write_id; 130 __u8 ga_additional; /* Global Attributes Additional */ 131 __u8 ga_extended; /* Global Attributes Extended */ 132 struct ch_t beg_ext; 133 struct ch_t end_ext; 134 unsigned long long ep_sys_time; /* Ext Parameter - System Time Stamp */ 135 __u8 ep_format; /* Extended Parameter format byte */ 136 __u8 ep_prio; /* Extended Parameter priority I/O byte */ 137 __u8 ep_reserved1; /* Extended Parameter Reserved */ 138 __u8 ep_rec_per_track; /* Number of records on a track */ 139 __u8 ep_reserved[4]; /* Extended Parameter Reserved */ 140 } __attribute__ ((packed)); 141 142 struct LO_eckd_data { 143 struct { 144 unsigned char orientation:2; 145 unsigned char operation:6; 146 } __attribute__ ((packed)) operation; 147 struct { 148 unsigned char last_bytes_used:1; 149 unsigned char reserved:6; 150 unsigned char read_count_suffix:1; 151 } __attribute__ ((packed)) auxiliary; 152 __u8 unused; 153 __u8 count; 154 struct ch_t seek_addr; 155 struct chr_t search_arg; 156 __u8 sector; 157 __u16 length; 158 } __attribute__ ((packed)); 159 160 struct LRE_eckd_data { 161 struct { 162 unsigned char orientation:2; 163 unsigned char operation:6; 164 } __attribute__ ((packed)) operation; 165 struct { 166 unsigned char length_valid:1; 167 unsigned char length_scope:1; 168 unsigned char imbedded_ccw_valid:1; 169 unsigned char check_bytes:2; 170 unsigned char imbedded_count_valid:1; 171 unsigned char reserved:1; 172 unsigned char read_count_suffix:1; 173 } __attribute__ ((packed)) auxiliary; 174 __u8 imbedded_ccw; 175 __u8 count; 176 struct ch_t seek_addr; 177 struct chr_t search_arg; 178 __u8 sector; 179 __u16 length; 180 __u8 imbedded_count; 181 __u8 extended_operation; 182 __u16 extended_parameter_length; 183 __u8 extended_parameter[0]; 184 } __attribute__ ((packed)); 185 186 /* Prefix data for format 0x00 and 0x01 */ 187 struct PFX_eckd_data { 188 unsigned char format; 189 struct { 190 unsigned char define_extent:1; 191 unsigned char time_stamp:1; 192 unsigned char verify_base:1; 193 unsigned char hyper_pav:1; 194 unsigned char reserved:4; 195 } __attribute__ ((packed)) validity; 196 __u8 base_address; 197 __u8 aux; 198 __u8 base_lss; 199 __u8 reserved[7]; 200 struct DE_eckd_data define_extent; 201 struct LRE_eckd_data locate_record; 202 } __attribute__ ((packed)); 203 204 struct dasd_eckd_characteristics { 205 __u16 cu_type; 206 struct { 207 unsigned char support:2; 208 unsigned char async:1; 209 unsigned char reserved:1; 210 unsigned char cache_info:1; 211 unsigned char model:3; 212 } __attribute__ ((packed)) cu_model; 213 __u16 dev_type; 214 __u8 dev_model; 215 struct { 216 unsigned char mult_burst:1; 217 unsigned char RT_in_LR:1; 218 unsigned char reserved1:1; 219 unsigned char RD_IN_LR:1; 220 unsigned char reserved2:4; 221 unsigned char reserved3:8; 222 unsigned char defect_wr:1; 223 unsigned char XRC_supported:1; 224 unsigned char reserved4:1; 225 unsigned char striping:1; 226 unsigned char reserved5:4; 227 unsigned char cfw:1; 228 unsigned char reserved6:2; 229 unsigned char cache:1; 230 unsigned char dual_copy:1; 231 unsigned char dfw:1; 232 unsigned char reset_alleg:1; 233 unsigned char sense_down:1; 234 } __attribute__ ((packed)) facilities; 235 __u8 dev_class; 236 __u8 unit_type; 237 __u16 no_cyl; 238 __u16 trk_per_cyl; 239 __u8 sec_per_trk; 240 __u8 byte_per_track[3]; 241 __u16 home_bytes; 242 __u8 formula; 243 union { 244 struct { 245 __u8 f1; 246 __u16 f2; 247 __u16 f3; 248 } __attribute__ ((packed)) f_0x01; 249 struct { 250 __u8 f1; 251 __u8 f2; 252 __u8 f3; 253 __u8 f4; 254 __u8 f5; 255 } __attribute__ ((packed)) f_0x02; 256 } __attribute__ ((packed)) factors; 257 __u16 first_alt_trk; 258 __u16 no_alt_trk; 259 __u16 first_dia_trk; 260 __u16 no_dia_trk; 261 __u16 first_sup_trk; 262 __u16 no_sup_trk; 263 __u8 MDR_ID; 264 __u8 OBR_ID; 265 __u8 director; 266 __u8 rd_trk_set; 267 __u16 max_rec_zero; 268 __u8 reserved1; 269 __u8 RWANY_in_LR; 270 __u8 factor6; 271 __u8 factor7; 272 __u8 factor8; 273 __u8 reserved2[3]; 274 __u8 reserved3[6]; 275 __u32 long_no_cyl; 276 } __attribute__ ((packed)); 277 278 /* elements of the configuration data */ 279 struct dasd_ned { 280 struct { 281 __u8 identifier:2; 282 __u8 token_id:1; 283 __u8 sno_valid:1; 284 __u8 subst_sno:1; 285 __u8 recNED:1; 286 __u8 emuNED:1; 287 __u8 reserved:1; 288 } __attribute__ ((packed)) flags; 289 __u8 descriptor; 290 __u8 dev_class; 291 __u8 reserved; 292 __u8 dev_type[6]; 293 __u8 dev_model[3]; 294 __u8 HDA_manufacturer[3]; 295 __u8 HDA_location[2]; 296 __u8 HDA_seqno[12]; 297 __u8 ID; 298 __u8 unit_addr; 299 } __attribute__ ((packed)); 300 301 struct dasd_sneq { 302 struct { 303 __u8 identifier:2; 304 __u8 reserved:6; 305 } __attribute__ ((packed)) flags; 306 __u8 res1; 307 __u16 format; 308 __u8 res2[4]; /* byte 4- 7 */ 309 __u8 sua_flags; /* byte 8 */ 310 __u8 base_unit_addr; /* byte 9 */ 311 __u8 res3[22]; /* byte 10-31 */ 312 } __attribute__ ((packed)); 313 314 struct vd_sneq { 315 struct { 316 __u8 identifier:2; 317 __u8 reserved:6; 318 } __attribute__ ((packed)) flags; 319 __u8 res1; 320 __u16 format; 321 __u8 res2[4]; /* byte 4- 7 */ 322 __u8 uit[16]; /* byte 8-23 */ 323 __u8 res3[8]; /* byte 24-31 */ 324 } __attribute__ ((packed)); 325 326 struct dasd_gneq { 327 struct { 328 __u8 identifier:2; 329 __u8 reserved:6; 330 } __attribute__ ((packed)) flags; 331 __u8 reserved[5]; 332 struct { 333 __u8 value:2; 334 __u8 number:6; 335 } __attribute__ ((packed)) timeout; 336 __u8 reserved3; 337 __u16 subsystemID; 338 __u8 reserved2[22]; 339 } __attribute__ ((packed)); 340 341 struct dasd_rssd_features { 342 char feature[256]; 343 } __attribute__((packed)); 344 345 346 /* 347 * Perform Subsystem Function - Prepare for Read Subsystem Data 348 */ 349 struct dasd_psf_prssd_data { 350 unsigned char order; 351 unsigned char flags; 352 unsigned char reserved[4]; 353 unsigned char suborder; 354 unsigned char varies[5]; 355 } __attribute__ ((packed)); 356 357 /* 358 * Perform Subsystem Function - Set Subsystem Characteristics 359 */ 360 struct dasd_psf_ssc_data { 361 unsigned char order; 362 unsigned char flags; 363 unsigned char cu_type[4]; 364 unsigned char suborder; 365 unsigned char reserved[59]; 366 } __attribute__((packed)); 367 368 369 /* 370 * some structures and definitions for alias handling 371 */ 372 struct dasd_unit_address_configuration { 373 struct { 374 char ua_type; 375 char base_ua; 376 } unit[256]; 377 } __attribute__((packed)); 378 379 380 #define MAX_DEVICES_PER_LCU 256 381 382 /* flags on the LCU */ 383 #define NEED_UAC_UPDATE 0x01 384 #define UPDATE_PENDING 0x02 385 386 enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV}; 387 388 389 struct alias_root { 390 struct list_head serverlist; 391 spinlock_t lock; 392 }; 393 394 struct alias_server { 395 struct list_head server; 396 struct dasd_uid uid; 397 struct list_head lculist; 398 }; 399 400 struct summary_unit_check_work_data { 401 char reason; 402 struct dasd_device *device; 403 struct work_struct worker; 404 }; 405 406 struct read_uac_work_data { 407 struct dasd_device *device; 408 struct delayed_work dwork; 409 }; 410 411 struct alias_lcu { 412 struct list_head lcu; 413 struct dasd_uid uid; 414 enum pavtype pav; 415 char flags; 416 spinlock_t lock; 417 struct list_head grouplist; 418 struct list_head active_devices; 419 struct list_head inactive_devices; 420 struct dasd_unit_address_configuration *uac; 421 struct summary_unit_check_work_data suc_data; 422 struct read_uac_work_data ruac_data; 423 struct dasd_ccw_req *rsu_cqr; 424 struct completion lcu_setup; 425 }; 426 427 struct alias_pav_group { 428 struct list_head group; 429 struct dasd_uid uid; 430 struct alias_lcu *lcu; 431 struct list_head baselist; 432 struct list_head aliaslist; 433 struct dasd_device *next; 434 }; 435 436 struct dasd_eckd_private { 437 struct dasd_eckd_characteristics rdc_data; 438 u8 *conf_data; 439 int conf_len; 440 /* pointers to specific parts in the conf_data */ 441 struct dasd_ned *ned; 442 struct dasd_sneq *sneq; 443 struct vd_sneq *vdsneq; 444 struct dasd_gneq *gneq; 445 446 struct eckd_count count_area[5]; 447 int init_cqr_status; 448 int uses_cdl; 449 struct attrib_data_t attrib; /* e.g. cache operations */ 450 struct dasd_rssd_features features; 451 u32 real_cyl; 452 453 /* alias managemnet */ 454 struct dasd_uid uid; 455 struct alias_pav_group *pavgroup; 456 struct alias_lcu *lcu; 457 int count; 458 459 u32 fcx_max_data; 460 }; 461 462 463 464 int dasd_alias_make_device_known_to_lcu(struct dasd_device *); 465 void dasd_alias_disconnect_device_from_lcu(struct dasd_device *); 466 int dasd_alias_add_device(struct dasd_device *); 467 int dasd_alias_remove_device(struct dasd_device *); 468 struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *); 469 void dasd_alias_handle_summary_unit_check(struct dasd_device *, struct irb *); 470 void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *); 471 void dasd_alias_lcu_setup_complete(struct dasd_device *); 472 void dasd_alias_wait_for_lcu_setup(struct dasd_device *); 473 int dasd_alias_update_add_device(struct dasd_device *); 474 #endif /* DASD_ECKD_H */ 475