dasd_eckd.h revision 4abb08c24b5fa7b6ad0807c07077f0f216f6788b
1/* 2 * File...........: linux/drivers/s390/block/dasd_eckd.h 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 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000 7 * 8 */ 9 10#ifndef DASD_ECKD_H 11#define DASD_ECKD_H 12 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_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_READ_CKD_MT 0x9e 40#define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d 41#define DASD_ECKD_CCW_RESERVE 0xB4 42#define DASD_ECKD_CCW_PFX 0xE7 43#define DASD_ECKD_CCW_RSCK 0xF9 44 45/* 46 * Perform Subsystem Function / Sub-Orders 47 */ 48#define PSF_ORDER_PRSSD 0x18 49#define PSF_ORDER_SSC 0x1D 50 51/***************************************************************************** 52 * SECTION: Type Definitions 53 ****************************************************************************/ 54 55struct eckd_count { 56 __u16 cyl; 57 __u16 head; 58 __u8 record; 59 __u8 kl; 60 __u16 dl; 61} __attribute__ ((packed)); 62 63struct ch_t { 64 __u16 cyl; 65 __u16 head; 66} __attribute__ ((packed)); 67 68struct chs_t { 69 __u16 cyl; 70 __u16 head; 71 __u32 sector; 72} __attribute__ ((packed)); 73 74struct chr_t { 75 __u16 cyl; 76 __u16 head; 77 __u8 record; 78} __attribute__ ((packed)); 79 80struct geom_t { 81 __u16 cyl; 82 __u16 head; 83 __u32 sector; 84} __attribute__ ((packed)); 85 86struct eckd_home { 87 __u8 skip_control[14]; 88 __u16 cell_number; 89 __u8 physical_addr[3]; 90 __u8 flag; 91 struct ch_t track_addr; 92 __u8 reserved; 93 __u8 key_length; 94 __u8 reserved2[2]; 95} __attribute__ ((packed)); 96 97struct DE_eckd_data { 98 struct { 99 unsigned char perm:2; /* Permissions on this extent */ 100 unsigned char reserved:1; 101 unsigned char seek:2; /* Seek control */ 102 unsigned char auth:2; /* Access authorization */ 103 unsigned char pci:1; /* PCI Fetch mode */ 104 } __attribute__ ((packed)) mask; 105 struct { 106 unsigned char mode:2; /* Architecture mode */ 107 unsigned char ckd:1; /* CKD Conversion */ 108 unsigned char operation:3; /* Operation mode */ 109 unsigned char cfw:1; /* Cache fast write */ 110 unsigned char dfw:1; /* DASD fast write */ 111 } __attribute__ ((packed)) attributes; 112 __u16 blk_size; /* Blocksize */ 113 __u16 fast_write_id; 114 __u8 ga_additional; /* Global Attributes Additional */ 115 __u8 ga_extended; /* Global Attributes Extended */ 116 struct ch_t beg_ext; 117 struct ch_t end_ext; 118 unsigned long long ep_sys_time; /* Ext Parameter - System Time Stamp */ 119 __u8 ep_format; /* Extended Parameter format byte */ 120 __u8 ep_prio; /* Extended Parameter priority I/O byte */ 121 __u8 ep_reserved[6]; /* Extended Parameter Reserved */ 122} __attribute__ ((packed)); 123 124struct LO_eckd_data { 125 struct { 126 unsigned char orientation:2; 127 unsigned char operation:6; 128 } __attribute__ ((packed)) operation; 129 struct { 130 unsigned char last_bytes_used:1; 131 unsigned char reserved:6; 132 unsigned char read_count_suffix:1; 133 } __attribute__ ((packed)) auxiliary; 134 __u8 unused; 135 __u8 count; 136 struct ch_t seek_addr; 137 struct chr_t search_arg; 138 __u8 sector; 139 __u16 length; 140} __attribute__ ((packed)); 141 142/* Prefix data for format 0x00 and 0x01 */ 143struct PFX_eckd_data { 144 unsigned char format; 145 struct { 146 unsigned char define_extend:1; 147 unsigned char time_stamp:1; 148 unsigned char verify_base:1; 149 unsigned char hyper_pav:1; 150 unsigned char reserved:4; 151 } __attribute__ ((packed)) validity; 152 __u8 base_address; 153 __u8 aux; 154 __u8 base_lss; 155 __u8 reserved[7]; 156 struct DE_eckd_data define_extend; 157 struct LO_eckd_data locate_record; 158 __u8 LO_extended_data[4]; 159} __attribute__ ((packed)); 160 161struct dasd_eckd_characteristics { 162 __u16 cu_type; 163 struct { 164 unsigned char support:2; 165 unsigned char async:1; 166 unsigned char reserved:1; 167 unsigned char cache_info:1; 168 unsigned char model:3; 169 } __attribute__ ((packed)) cu_model; 170 __u16 dev_type; 171 __u8 dev_model; 172 struct { 173 unsigned char mult_burst:1; 174 unsigned char RT_in_LR:1; 175 unsigned char reserved1:1; 176 unsigned char RD_IN_LR:1; 177 unsigned char reserved2:4; 178 unsigned char reserved3:8; 179 unsigned char defect_wr:1; 180 unsigned char XRC_supported:1; 181 unsigned char reserved4:1; 182 unsigned char striping:1; 183 unsigned char reserved5:4; 184 unsigned char cfw:1; 185 unsigned char reserved6:2; 186 unsigned char cache:1; 187 unsigned char dual_copy:1; 188 unsigned char dfw:1; 189 unsigned char reset_alleg:1; 190 unsigned char sense_down:1; 191 } __attribute__ ((packed)) facilities; 192 __u8 dev_class; 193 __u8 unit_type; 194 __u16 no_cyl; 195 __u16 trk_per_cyl; 196 __u8 sec_per_trk; 197 __u8 byte_per_track[3]; 198 __u16 home_bytes; 199 __u8 formula; 200 union { 201 struct { 202 __u8 f1; 203 __u16 f2; 204 __u16 f3; 205 } __attribute__ ((packed)) f_0x01; 206 struct { 207 __u8 f1; 208 __u8 f2; 209 __u8 f3; 210 __u8 f4; 211 __u8 f5; 212 } __attribute__ ((packed)) f_0x02; 213 } __attribute__ ((packed)) factors; 214 __u16 first_alt_trk; 215 __u16 no_alt_trk; 216 __u16 first_dia_trk; 217 __u16 no_dia_trk; 218 __u16 first_sup_trk; 219 __u16 no_sup_trk; 220 __u8 MDR_ID; 221 __u8 OBR_ID; 222 __u8 director; 223 __u8 rd_trk_set; 224 __u16 max_rec_zero; 225 __u8 reserved1; 226 __u8 RWANY_in_LR; 227 __u8 factor6; 228 __u8 factor7; 229 __u8 factor8; 230 __u8 reserved2[3]; 231 __u8 reserved3[10]; 232} __attribute__ ((packed)); 233 234/* elements of the configuration data */ 235struct dasd_ned { 236 struct { 237 __u8 identifier:2; 238 __u8 token_id:1; 239 __u8 sno_valid:1; 240 __u8 subst_sno:1; 241 __u8 recNED:1; 242 __u8 emuNED:1; 243 __u8 reserved:1; 244 } __attribute__ ((packed)) flags; 245 __u8 descriptor; 246 __u8 dev_class; 247 __u8 reserved; 248 __u8 dev_type[6]; 249 __u8 dev_model[3]; 250 __u8 HDA_manufacturer[3]; 251 __u8 HDA_location[2]; 252 __u8 HDA_seqno[12]; 253 __u8 ID; 254 __u8 unit_addr; 255} __attribute__ ((packed)); 256 257struct dasd_sneq { 258 struct { 259 __u8 identifier:2; 260 __u8 reserved:6; 261 } __attribute__ ((packed)) flags; 262 __u8 res1; 263 __u16 format; 264 __u8 res2[4]; /* byte 4- 7 */ 265 __u8 sua_flags; /* byte 8 */ 266 __u8 base_unit_addr; /* byte 9 */ 267 __u8 res3[22]; /* byte 10-31 */ 268} __attribute__ ((packed)); 269 270struct vd_sneq { 271 struct { 272 __u8 identifier:2; 273 __u8 reserved:6; 274 } __attribute__ ((packed)) flags; 275 __u8 res1; 276 __u16 format; 277 __u8 res2[4]; /* byte 4- 7 */ 278 __u8 uit[16]; /* byte 8-23 */ 279 __u8 res3[8]; /* byte 24-31 */ 280} __attribute__ ((packed)); 281 282struct dasd_gneq { 283 struct { 284 __u8 identifier:2; 285 __u8 reserved:6; 286 } __attribute__ ((packed)) flags; 287 __u8 reserved[7]; 288 __u16 subsystemID; 289 __u8 reserved2[22]; 290} __attribute__ ((packed)); 291 292struct dasd_eckd_path { 293 __u8 opm; 294 __u8 ppm; 295 __u8 npm; 296}; 297 298struct dasd_rssd_features { 299 char feature[256]; 300} __attribute__((packed)); 301 302 303/* 304 * Perform Subsystem Function - Prepare for Read Subsystem Data 305 */ 306struct dasd_psf_prssd_data { 307 unsigned char order; 308 unsigned char flags; 309 unsigned char reserved[4]; 310 unsigned char suborder; 311 unsigned char varies[9]; 312} __attribute__ ((packed)); 313 314/* 315 * Perform Subsystem Function - Set Subsystem Characteristics 316 */ 317struct dasd_psf_ssc_data { 318 unsigned char order; 319 unsigned char flags; 320 unsigned char cu_type[4]; 321 unsigned char suborder; 322 unsigned char reserved[59]; 323} __attribute__((packed)); 324 325 326/* 327 * some structures and definitions for alias handling 328 */ 329struct dasd_unit_address_configuration { 330 struct { 331 char ua_type; 332 char base_ua; 333 } unit[256]; 334} __attribute__((packed)); 335 336 337#define MAX_DEVICES_PER_LCU 256 338 339/* flags on the LCU */ 340#define NEED_UAC_UPDATE 0x01 341#define UPDATE_PENDING 0x02 342 343enum pavtype {NO_PAV, BASE_PAV, HYPER_PAV}; 344 345 346struct alias_root { 347 struct list_head serverlist; 348 spinlock_t lock; 349}; 350 351struct alias_server { 352 struct list_head server; 353 struct dasd_uid uid; 354 struct list_head lculist; 355}; 356 357struct summary_unit_check_work_data { 358 char reason; 359 struct dasd_device *device; 360 struct work_struct worker; 361}; 362 363struct read_uac_work_data { 364 struct dasd_device *device; 365 struct delayed_work dwork; 366}; 367 368struct alias_lcu { 369 struct list_head lcu; 370 struct dasd_uid uid; 371 enum pavtype pav; 372 char flags; 373 spinlock_t lock; 374 struct list_head grouplist; 375 struct list_head active_devices; 376 struct list_head inactive_devices; 377 struct dasd_unit_address_configuration *uac; 378 struct summary_unit_check_work_data suc_data; 379 struct read_uac_work_data ruac_data; 380 struct dasd_ccw_req *rsu_cqr; 381}; 382 383struct alias_pav_group { 384 struct list_head group; 385 struct dasd_uid uid; 386 struct alias_lcu *lcu; 387 struct list_head baselist; 388 struct list_head aliaslist; 389 struct dasd_device *next; 390}; 391 392 393struct dasd_eckd_private { 394 struct dasd_eckd_characteristics rdc_data; 395 u8 *conf_data; 396 int conf_len; 397 /* pointers to specific parts in the conf_data */ 398 struct dasd_ned *ned; 399 struct dasd_sneq *sneq; 400 struct vd_sneq *vdsneq; 401 struct dasd_gneq *gneq; 402 403 struct dasd_eckd_path path_data; 404 struct eckd_count count_area[5]; 405 int init_cqr_status; 406 int uses_cdl; 407 struct attrib_data_t attrib; /* e.g. cache operations */ 408 struct dasd_rssd_features features; 409 410 /* alias managemnet */ 411 struct dasd_uid uid; 412 struct alias_pav_group *pavgroup; 413 struct alias_lcu *lcu; 414 int count; 415}; 416 417 418 419int dasd_alias_make_device_known_to_lcu(struct dasd_device *); 420void dasd_alias_disconnect_device_from_lcu(struct dasd_device *); 421int dasd_alias_add_device(struct dasd_device *); 422int dasd_alias_remove_device(struct dasd_device *); 423struct dasd_device *dasd_alias_get_start_dev(struct dasd_device *); 424void dasd_alias_handle_summary_unit_check(struct dasd_device *, struct irb *); 425void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *); 426 427#endif /* DASD_ECKD_H */ 428