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