1 /* 2 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com> 3 * Bugreports.to..: <Linux390@de.ibm.com> 4 * Copyright IBM Corp. 1999, 2000 5 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008 6 * Author.........: Nigel Hislop <hislop_nigel@emc.com> 7 * 8 * This file is the interface of the DASD device driver, which is exported to user space 9 * any future changes wrt the API will result in a change of the APIVERSION reported 10 * to userspace by the DASDAPIVER-ioctl 11 * 12 */ 13 14 #ifndef DASD_H 15 #define DASD_H 16 #include <linux/types.h> 17 #include <linux/ioctl.h> 18 19 #define DASD_IOCTL_LETTER 'D' 20 21 #define DASD_API_VERSION 6 22 23 /* 24 * struct dasd_information2_t 25 * represents any data about the device, which is visible to userspace. 26 * including foramt and featueres. 27 */ 28 typedef struct dasd_information2_t { 29 unsigned int devno; /* S/390 devno */ 30 unsigned int real_devno; /* for aliases */ 31 unsigned int schid; /* S/390 subchannel identifier */ 32 unsigned int cu_type : 16; /* from SenseID */ 33 unsigned int cu_model : 8; /* from SenseID */ 34 unsigned int dev_type : 16; /* from SenseID */ 35 unsigned int dev_model : 8; /* from SenseID */ 36 unsigned int open_count; 37 unsigned int req_queue_len; 38 unsigned int chanq_len; /* length of chanq */ 39 char type[4]; /* from discipline.name, 'none' for unknown */ 40 unsigned int status; /* current device level */ 41 unsigned int label_block; /* where to find the VOLSER */ 42 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ 43 unsigned int characteristics_size; 44 unsigned int confdata_size; 45 char characteristics[64]; /* from read_device_characteristics */ 46 char configuration_data[256]; /* from read_configuration_data */ 47 unsigned int format; /* format info like formatted/cdl/ldl/... */ 48 unsigned int features; /* dasd features like 'ro',... */ 49 unsigned int reserved0; /* reserved for further use ,... */ 50 unsigned int reserved1; /* reserved for further use ,... */ 51 unsigned int reserved2; /* reserved for further use ,... */ 52 unsigned int reserved3; /* reserved for further use ,... */ 53 unsigned int reserved4; /* reserved for further use ,... */ 54 unsigned int reserved5; /* reserved for further use ,... */ 55 unsigned int reserved6; /* reserved for further use ,... */ 56 unsigned int reserved7; /* reserved for further use ,... */ 57 } dasd_information2_t; 58 59 /* 60 * values to be used for dasd_information_t.format 61 * 0x00: NOT formatted 62 * 0x01: Linux disc layout 63 * 0x02: Common disc layout 64 */ 65 #define DASD_FORMAT_NONE 0 66 #define DASD_FORMAT_LDL 1 67 #define DASD_FORMAT_CDL 2 68 /* 69 * values to be used for dasd_information_t.features 70 * 0x00: default features 71 * 0x01: readonly (ro) 72 * 0x02: use diag discipline (diag) 73 * 0x04: set the device initially online (internal use only) 74 * 0x08: enable ERP related logging 75 * 0x10: allow I/O to fail on lost paths 76 * 0x20: allow I/O to fail when a lock was stolen 77 * 0x40: give access to raw eckd data 78 * 0x80: enable discard support 79 */ 80 #define DASD_FEATURE_DEFAULT 0x00 81 #define DASD_FEATURE_READONLY 0x01 82 #define DASD_FEATURE_USEDIAG 0x02 83 #define DASD_FEATURE_INITIAL_ONLINE 0x04 84 #define DASD_FEATURE_ERPLOG 0x08 85 #define DASD_FEATURE_FAILFAST 0x10 86 #define DASD_FEATURE_FAILONSLCK 0x20 87 #define DASD_FEATURE_USERAW 0x40 88 #define DASD_FEATURE_DISCARD 0x80 89 90 #define DASD_PARTN_BITS 2 91 92 /* 93 * struct dasd_information_t 94 * represents any data about the data, which is visible to userspace 95 */ 96 typedef struct dasd_information_t { 97 unsigned int devno; /* S/390 devno */ 98 unsigned int real_devno; /* for aliases */ 99 unsigned int schid; /* S/390 subchannel identifier */ 100 unsigned int cu_type : 16; /* from SenseID */ 101 unsigned int cu_model : 8; /* from SenseID */ 102 unsigned int dev_type : 16; /* from SenseID */ 103 unsigned int dev_model : 8; /* from SenseID */ 104 unsigned int open_count; 105 unsigned int req_queue_len; 106 unsigned int chanq_len; /* length of chanq */ 107 char type[4]; /* from discipline.name, 'none' for unknown */ 108 unsigned int status; /* current device level */ 109 unsigned int label_block; /* where to find the VOLSER */ 110 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ 111 unsigned int characteristics_size; 112 unsigned int confdata_size; 113 char characteristics[64]; /* from read_device_characteristics */ 114 char configuration_data[256]; /* from read_configuration_data */ 115 } dasd_information_t; 116 117 /* 118 * Read Subsystem Data - Performance Statistics 119 */ 120 typedef struct dasd_rssd_perf_stats_t { 121 unsigned char invalid:1; 122 unsigned char format:3; 123 unsigned char data_format:4; 124 unsigned char unit_address; 125 unsigned short device_status; 126 unsigned int nr_read_normal; 127 unsigned int nr_read_normal_hits; 128 unsigned int nr_write_normal; 129 unsigned int nr_write_fast_normal_hits; 130 unsigned int nr_read_seq; 131 unsigned int nr_read_seq_hits; 132 unsigned int nr_write_seq; 133 unsigned int nr_write_fast_seq_hits; 134 unsigned int nr_read_cache; 135 unsigned int nr_read_cache_hits; 136 unsigned int nr_write_cache; 137 unsigned int nr_write_fast_cache_hits; 138 unsigned int nr_inhibit_cache; 139 unsigned int nr_bybass_cache; 140 unsigned int nr_seq_dasd_to_cache; 141 unsigned int nr_dasd_to_cache; 142 unsigned int nr_cache_to_dasd; 143 unsigned int nr_delayed_fast_write; 144 unsigned int nr_normal_fast_write; 145 unsigned int nr_seq_fast_write; 146 unsigned int nr_cache_miss; 147 unsigned char status2; 148 unsigned int nr_quick_write_promotes; 149 unsigned char reserved; 150 unsigned short ssid; 151 unsigned char reseved2[96]; 152 } __attribute__((packed)) dasd_rssd_perf_stats_t; 153 154 /* 155 * struct profile_info_t 156 * holds the profinling information 157 */ 158 typedef struct dasd_profile_info_t { 159 unsigned int dasd_io_reqs; /* number of requests processed at all */ 160 unsigned int dasd_io_sects; /* number of sectors processed at all */ 161 unsigned int dasd_io_secs[32]; /* histogram of request's sizes */ 162 unsigned int dasd_io_times[32]; /* histogram of requests's times */ 163 unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */ 164 unsigned int dasd_io_time1[32]; /* histogram of time from build to start */ 165 unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */ 166 unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */ 167 unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */ 168 unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */ 169 } dasd_profile_info_t; 170 171 /* 172 * struct format_data_t 173 * represents all data necessary to format a dasd 174 */ 175 typedef struct format_data_t { 176 unsigned int start_unit; /* from track */ 177 unsigned int stop_unit; /* to track */ 178 unsigned int blksize; /* sectorsize */ 179 unsigned int intensity; 180 } format_data_t; 181 182 /* 183 * values to be used for format_data_t.intensity 184 * 0/8: normal format 185 * 1/9: also write record zero 186 * 3/11: also write home address 187 * 4/12: invalidate track 188 */ 189 #define DASD_FMT_INT_FMT_R0 1 /* write record zero */ 190 #define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */ 191 #define DASD_FMT_INT_INVAL 4 /* invalidate tracks */ 192 #define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */ 193 194 /* 195 * struct format_check_t 196 * represents all data necessary to evaluate the format of 197 * different tracks of a dasd 198 */ 199 typedef struct format_check_t { 200 /* Input */ 201 struct format_data_t expect; 202 203 /* Output */ 204 unsigned int result; /* Error indication (DASD_FMT_ERR_*) */ 205 unsigned int unit; /* Track that is in error */ 206 unsigned int rec; /* Record that is in error */ 207 unsigned int num_records; /* Records in the track in error */ 208 unsigned int blksize; /* Blocksize of first record in error */ 209 unsigned int key_length; /* Key length of first record in error */ 210 } format_check_t; 211 212 /* Values returned in format_check_t when a format error is detected: */ 213 /* Too few records were found on a single track */ 214 #define DASD_FMT_ERR_TOO_FEW_RECORDS 1 215 /* Too many records were found on a single track */ 216 #define DASD_FMT_ERR_TOO_MANY_RECORDS 2 217 /* Blocksize/data-length of a record was wrong */ 218 #define DASD_FMT_ERR_BLKSIZE 3 219 /* A record ID is defined by cylinder, head, and record number (CHR). */ 220 /* On mismatch, this error is set */ 221 #define DASD_FMT_ERR_RECORD_ID 4 222 /* If key-length was != 0 */ 223 #define DASD_FMT_ERR_KEY_LENGTH 5 224 225 /* 226 * struct attrib_data_t 227 * represents the operation (cache) bits for the device. 228 * Used in DE to influence caching of the DASD. 229 */ 230 typedef struct attrib_data_t { 231 unsigned char operation:3; /* cache operation mode */ 232 unsigned char reserved:5; /* cache operation mode */ 233 __u16 nr_cyl; /* no of cyliners for read ahaed */ 234 __u8 reserved2[29]; /* for future use */ 235 } __attribute__ ((packed)) attrib_data_t; 236 237 /* definition of operation (cache) bits within attributes of DE */ 238 #define DASD_NORMAL_CACHE 0x0 239 #define DASD_BYPASS_CACHE 0x1 240 #define DASD_INHIBIT_LOAD 0x2 241 #define DASD_SEQ_ACCESS 0x3 242 #define DASD_SEQ_PRESTAGE 0x4 243 #define DASD_REC_ACCESS 0x5 244 245 /* 246 * Perform EMC Symmetrix I/O 247 */ 248 typedef struct dasd_symmio_parms { 249 unsigned char reserved[8]; /* compat with older releases */ 250 unsigned long long psf_data; /* char * cast to u64 */ 251 unsigned long long rssd_result; /* char * cast to u64 */ 252 int psf_data_len; 253 int rssd_result_len; 254 } __attribute__ ((packed)) dasd_symmio_parms_t; 255 256 /* 257 * Data returned by Sense Path Group ID (SNID) 258 */ 259 struct dasd_snid_data { 260 struct { 261 __u8 group:2; 262 __u8 reserve:2; 263 __u8 mode:1; 264 __u8 res:3; 265 } __attribute__ ((packed)) path_state; 266 __u8 pgid[11]; 267 } __attribute__ ((packed)); 268 269 struct dasd_snid_ioctl_data { 270 struct dasd_snid_data data; 271 __u8 path_mask; 272 } __attribute__ ((packed)); 273 274 275 /******************************************************************************** 276 * SECTION: Definition of IOCTLs 277 * 278 * Here ist how the ioctl-nr should be used: 279 * 0 - 31 DASD driver itself 280 * 32 - 239 still open 281 * 240 - 255 reserved for EMC 282 *******************************************************************************/ 283 284 /* Disable the volume (for Linux) */ 285 #define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0) 286 /* Enable the volume (for Linux) */ 287 #define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1) 288 /* Issue a reserve/release command, rsp. */ 289 #define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */ 290 #define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */ 291 #define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */ 292 /* reset profiling information of a device */ 293 #define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5) 294 /* Quiesce IO on device */ 295 #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6) 296 /* Resume IO on device */ 297 #define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7) 298 /* Abort all I/O on a device */ 299 #define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240) 300 /* Allow I/O on a device */ 301 #define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241) 302 303 304 /* retrieve API version number */ 305 #define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int) 306 /* Get information on a dasd device */ 307 #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) 308 /* retrieve profiling information of a device */ 309 #define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t) 310 /* Get information on a dasd device (enhanced) */ 311 #define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t) 312 /* Performance Statistics Read */ 313 #define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t) 314 /* Get Attributes (cache operations) */ 315 #define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t) 316 317 318 /* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */ 319 #define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t) 320 /* Set Attributes (cache operations) */ 321 #define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t) 322 323 /* Get Sense Path Group ID (SNID) data */ 324 #define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data) 325 /* Check device format according to format_check_t */ 326 #define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t) 327 328 #define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t) 329 330 #endif /* DASD_H */ 331 332