Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
0004  * Bugreports.to..: <Linux390@de.ibm.com>
0005  * Copyright IBM Corp. 1999, 2000
0006  * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
0007  * Author.........: Nigel Hislop <hislop_nigel@emc.com>
0008  *
0009  * This file is the interface of the DASD device driver, which is exported to user space
0010  * any future changes wrt the API will result in a change of the APIVERSION reported
0011  * to userspace by the DASDAPIVER-ioctl
0012  *
0013  */
0014 
0015 #ifndef DASD_H
0016 #define DASD_H
0017 #include <linux/types.h>
0018 #include <linux/ioctl.h>
0019 
0020 #define DASD_IOCTL_LETTER 'D'
0021 
0022 #define DASD_API_VERSION 6
0023 
0024 /*
0025  * struct dasd_information2_t
0026  * represents any data about the device, which is visible to userspace.
0027  *  including foramt and featueres.
0028  */
0029 typedef struct dasd_information2_t {
0030     unsigned int devno;     /* S/390 devno */
0031     unsigned int real_devno;    /* for aliases */
0032     unsigned int schid;     /* S/390 subchannel identifier */
0033     unsigned int cu_type  : 16; /* from SenseID */
0034     unsigned int cu_model :  8; /* from SenseID */
0035     unsigned int dev_type : 16; /* from SenseID */
0036     unsigned int dev_model : 8; /* from SenseID */
0037     unsigned int open_count;
0038     unsigned int req_queue_len;
0039     unsigned int chanq_len;     /* length of chanq */
0040     char type[4];           /* from discipline.name, 'none' for unknown */
0041     unsigned int status;        /* current device level */
0042     unsigned int label_block;   /* where to find the VOLSER */
0043     unsigned int FBA_layout;    /* fixed block size (like AIXVOL) */
0044     unsigned int characteristics_size;
0045     unsigned int confdata_size;
0046     char characteristics[64];   /* from read_device_characteristics */
0047     char configuration_data[256]; /* from read_configuration_data */
0048     unsigned int format;          /* format info like formatted/cdl/ldl/... */
0049     unsigned int features;        /* dasd features like 'ro',...        */
0050     unsigned int reserved0;       /* reserved for further use ,...      */
0051     unsigned int reserved1;       /* reserved for further use ,...      */
0052     unsigned int reserved2;       /* reserved for further use ,...      */
0053     unsigned int reserved3;       /* reserved for further use ,...      */
0054     unsigned int reserved4;       /* reserved for further use ,...      */
0055     unsigned int reserved5;       /* reserved for further use ,...      */
0056     unsigned int reserved6;       /* reserved for further use ,...      */
0057     unsigned int reserved7;       /* reserved for further use ,...      */
0058 } dasd_information2_t;
0059 
0060 /*
0061  * values to be used for dasd_information_t.format
0062  * 0x00: NOT formatted
0063  * 0x01: Linux disc layout
0064  * 0x02: Common disc layout
0065  */
0066 #define DASD_FORMAT_NONE 0
0067 #define DASD_FORMAT_LDL  1
0068 #define DASD_FORMAT_CDL  2
0069 /*
0070  * values to be used for dasd_information_t.features
0071  * 0x100: default features
0072  * 0x001: readonly (ro)
0073  * 0x002: use diag discipline (diag)
0074  * 0x004: set the device initially online (internal use only)
0075  * 0x008: enable ERP related logging
0076  * 0x010: allow I/O to fail on lost paths
0077  * 0x020: allow I/O to fail when a lock was stolen
0078  * 0x040: give access to raw eckd data
0079  * 0x080: enable discard support
0080  * 0x100: enable autodisable for IFCC errors (default)
0081  */
0082 #define DASD_FEATURE_READONLY         0x001
0083 #define DASD_FEATURE_USEDIAG          0x002
0084 #define DASD_FEATURE_INITIAL_ONLINE   0x004
0085 #define DASD_FEATURE_ERPLOG       0x008
0086 #define DASD_FEATURE_FAILFAST         0x010
0087 #define DASD_FEATURE_FAILONSLCK       0x020
0088 #define DASD_FEATURE_USERAW       0x040
0089 #define DASD_FEATURE_DISCARD          0x080
0090 #define DASD_FEATURE_PATH_AUTODISABLE 0x100
0091 #define DASD_FEATURE_DEFAULT          DASD_FEATURE_PATH_AUTODISABLE
0092 
0093 #define DASD_PARTN_BITS 2
0094 
0095 /*
0096  * struct dasd_information_t
0097  * represents any data about the data, which is visible to userspace
0098  */
0099 typedef struct dasd_information_t {
0100     unsigned int devno;     /* S/390 devno */
0101     unsigned int real_devno;    /* for aliases */
0102     unsigned int schid;     /* S/390 subchannel identifier */
0103     unsigned int cu_type  : 16; /* from SenseID */
0104     unsigned int cu_model :  8; /* from SenseID */
0105     unsigned int dev_type : 16; /* from SenseID */
0106     unsigned int dev_model : 8; /* from SenseID */
0107     unsigned int open_count;
0108     unsigned int req_queue_len;
0109     unsigned int chanq_len;     /* length of chanq */
0110     char type[4];           /* from discipline.name, 'none' for unknown */
0111     unsigned int status;        /* current device level */
0112     unsigned int label_block;   /* where to find the VOLSER */
0113     unsigned int FBA_layout;    /* fixed block size (like AIXVOL) */
0114     unsigned int characteristics_size;
0115     unsigned int confdata_size;
0116     char characteristics[64];   /* from read_device_characteristics */
0117     char configuration_data[256]; /* from read_configuration_data */
0118 } dasd_information_t;
0119 
0120 /*
0121  * Read Subsystem Data - Performance Statistics
0122  */
0123 typedef struct dasd_rssd_perf_stats_t {
0124     unsigned char  invalid:1;
0125     unsigned char  format:3;
0126     unsigned char  data_format:4;
0127     unsigned char  unit_address;
0128     unsigned short device_status;
0129     unsigned int   nr_read_normal;
0130     unsigned int   nr_read_normal_hits;
0131     unsigned int   nr_write_normal;
0132     unsigned int   nr_write_fast_normal_hits;
0133     unsigned int   nr_read_seq;
0134     unsigned int   nr_read_seq_hits;
0135     unsigned int   nr_write_seq;
0136     unsigned int   nr_write_fast_seq_hits;
0137     unsigned int   nr_read_cache;
0138     unsigned int   nr_read_cache_hits;
0139     unsigned int   nr_write_cache;
0140     unsigned int   nr_write_fast_cache_hits;
0141     unsigned int   nr_inhibit_cache;
0142     unsigned int   nr_bybass_cache;
0143     unsigned int   nr_seq_dasd_to_cache;
0144     unsigned int   nr_dasd_to_cache;
0145     unsigned int   nr_cache_to_dasd;
0146     unsigned int   nr_delayed_fast_write;
0147     unsigned int   nr_normal_fast_write;
0148     unsigned int   nr_seq_fast_write;
0149     unsigned int   nr_cache_miss;
0150     unsigned char  status2;
0151     unsigned int   nr_quick_write_promotes;
0152     unsigned char  reserved;
0153     unsigned short ssid;
0154     unsigned char  reseved2[96];
0155 } __attribute__((packed)) dasd_rssd_perf_stats_t;
0156 
0157 /*
0158  * struct profile_info_t
0159  * holds the profinling information
0160  */
0161 typedef struct dasd_profile_info_t {
0162     unsigned int dasd_io_reqs;   /* number of requests processed at all */
0163     unsigned int dasd_io_sects;  /* number of sectors processed at all */
0164     unsigned int dasd_io_secs[32];   /* histogram of request's sizes */
0165     unsigned int dasd_io_times[32];  /* histogram of requests's times */
0166     unsigned int dasd_io_timps[32];  /* histogram of requests's times per sector */
0167     unsigned int dasd_io_time1[32];  /* histogram of time from build to start */
0168     unsigned int dasd_io_time2[32];  /* histogram of time from start to irq */
0169     unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
0170     unsigned int dasd_io_time3[32];  /* histogram of time from irq to end */
0171     unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
0172 } dasd_profile_info_t;
0173 
0174 /*
0175  * struct format_data_t
0176  * represents all data necessary to format a dasd
0177  */
0178 typedef struct format_data_t {
0179     unsigned int start_unit; /* from track */
0180     unsigned int stop_unit;  /* to track */
0181     unsigned int blksize;    /* sectorsize */
0182     unsigned int intensity;
0183 } format_data_t;
0184 
0185 /*
0186  * values to be used for format_data_t.intensity
0187  * 0/8: normal format
0188  * 1/9: also write record zero
0189  * 3/11: also write home address
0190  * 4/12: invalidate track
0191  */
0192 #define DASD_FMT_INT_FMT_R0 1   /* write record zero */
0193 #define DASD_FMT_INT_FMT_HA 2   /* write home address, also set FMT_R0 ! */
0194 #define DASD_FMT_INT_INVAL  4   /* invalidate tracks */
0195 #define DASD_FMT_INT_COMPAT 8   /* use OS/390 compatible disk layout */
0196 #define DASD_FMT_INT_FMT_NOR0   16  /* remove permission to write record zero */
0197 #define DASD_FMT_INT_ESE_FULL   32  /* release space for entire volume */
0198 
0199 /*
0200  * struct format_check_t
0201  * represents all data necessary to evaluate the format of
0202  * different tracks of a dasd
0203  */
0204 typedef struct format_check_t {
0205     /* Input */
0206     struct format_data_t expect;
0207 
0208     /* Output */
0209     unsigned int result;        /* Error indication (DASD_FMT_ERR_*) */
0210     unsigned int unit;      /* Track that is in error */
0211     unsigned int rec;       /* Record that is in error */
0212     unsigned int num_records;   /* Records in the track in error */
0213     unsigned int blksize;       /* Blocksize of first record in error */
0214     unsigned int key_length;    /* Key length of first record in error */
0215 } format_check_t;
0216 
0217 /* Values returned in format_check_t when a format error is detected: */
0218 /* Too few records were found on a single track */
0219 #define DASD_FMT_ERR_TOO_FEW_RECORDS    1
0220 /* Too many records were found on a single track */
0221 #define DASD_FMT_ERR_TOO_MANY_RECORDS   2
0222 /* Blocksize/data-length of a record was wrong */
0223 #define DASD_FMT_ERR_BLKSIZE        3
0224 /* A record ID is defined by cylinder, head, and record number (CHR). */
0225 /* On mismatch, this error is set */
0226 #define DASD_FMT_ERR_RECORD_ID      4
0227 /* If key-length was != 0 */
0228 #define DASD_FMT_ERR_KEY_LENGTH     5
0229 
0230 /*
0231  * struct attrib_data_t
0232  * represents the operation (cache) bits for the device.
0233  * Used in DE to influence caching of the DASD.
0234  */
0235 typedef struct attrib_data_t {
0236     unsigned char operation:3;     /* cache operation mode */
0237     unsigned char reserved:5;      /* cache operation mode */
0238     __u16         nr_cyl;          /* no of cyliners for read ahaed */
0239     __u8          reserved2[29];   /* for future use */
0240 } __attribute__ ((packed)) attrib_data_t;
0241 
0242 /* definition of operation (cache) bits within attributes of DE */
0243 #define DASD_NORMAL_CACHE  0x0
0244 #define DASD_BYPASS_CACHE  0x1
0245 #define DASD_INHIBIT_LOAD  0x2
0246 #define DASD_SEQ_ACCESS    0x3
0247 #define DASD_SEQ_PRESTAGE  0x4
0248 #define DASD_REC_ACCESS    0x5
0249 
0250 /*
0251  * Perform EMC Symmetrix I/O
0252  */
0253 typedef struct dasd_symmio_parms {
0254     unsigned char reserved[8];  /* compat with older releases */
0255     unsigned long long psf_data;    /* char * cast to u64 */
0256     unsigned long long rssd_result; /* char * cast to u64 */
0257     int psf_data_len;
0258     int rssd_result_len;
0259 } __attribute__ ((packed)) dasd_symmio_parms_t;
0260 
0261 /*
0262  * Data returned by Sense Path Group ID (SNID)
0263  */
0264 struct dasd_snid_data {
0265     struct {
0266         __u8 group:2;
0267         __u8 reserve:2;
0268         __u8 mode:1;
0269         __u8 res:3;
0270     } __attribute__ ((packed)) path_state;
0271     __u8 pgid[11];
0272 } __attribute__ ((packed));
0273 
0274 struct dasd_snid_ioctl_data {
0275     struct dasd_snid_data data;
0276     __u8 path_mask;
0277 } __attribute__ ((packed));
0278 
0279 
0280 /********************************************************************************
0281  * SECTION: Definition of IOCTLs
0282  *
0283  * Here ist how the ioctl-nr should be used:
0284  *    0 -   31   DASD driver itself
0285  *   32 -  239   still open
0286  *  240 -  255   reserved for EMC
0287  *******************************************************************************/
0288 
0289 /* Disable the volume (for Linux) */
0290 #define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
0291 /* Enable the volume (for Linux) */
0292 #define BIODASDENABLE  _IO(DASD_IOCTL_LETTER,1)
0293 /* Issue a reserve/release command, rsp. */
0294 #define BIODASDRSRV    _IO(DASD_IOCTL_LETTER,2) /* reserve */
0295 #define BIODASDRLSE    _IO(DASD_IOCTL_LETTER,3) /* release */
0296 #define BIODASDSLCK    _IO(DASD_IOCTL_LETTER,4) /* steal lock */
0297 /* reset profiling information of a device */
0298 #define BIODASDPRRST   _IO(DASD_IOCTL_LETTER,5)
0299 /* Quiesce IO on device */
0300 #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
0301 /* Resume IO on device */
0302 #define BIODASDRESUME  _IO(DASD_IOCTL_LETTER,7)
0303 /* Abort all I/O on a device */
0304 #define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240)
0305 /* Allow I/O on a device */
0306 #define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241)
0307 
0308 
0309 /* retrieve API version number */
0310 #define DASDAPIVER     _IOR(DASD_IOCTL_LETTER,0,int)
0311 /* Get information on a dasd device */
0312 #define BIODASDINFO    _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
0313 /* retrieve profiling information of a device */
0314 #define BIODASDPRRD    _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
0315 /* Get information on a dasd device (enhanced) */
0316 #define BIODASDINFO2   _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
0317 /* Performance Statistics Read */
0318 #define BIODASDPSRD    _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
0319 /* Get Attributes (cache operations) */
0320 #define BIODASDGATTR   _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
0321 
0322 
0323 /* #define BIODASDFORMAT  _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
0324 #define BIODASDFMT     _IOW(DASD_IOCTL_LETTER,1,format_data_t)
0325 /* Set Attributes (cache operations) */
0326 #define BIODASDSATTR   _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
0327 /* Release Allocated Space */
0328 #define BIODASDRAS     _IOW(DASD_IOCTL_LETTER, 3, format_data_t)
0329 
0330 /* Get Sense Path Group ID (SNID) data */
0331 #define BIODASDSNID    _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)
0332 /* Check device format according to format_check_t */
0333 #define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t)
0334 
0335 #define BIODASDSYMMIO  _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)
0336 
0337 #endif              /* DASD_H */
0338