xref: /openbmc/linux/arch/s390/include/uapi/asm/dasd.h (revision 8fd575200db5b53f6ea6818dd017f1b43190db12)
19807f759SDavid Howells /*
29807f759SDavid Howells  * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
39807f759SDavid Howells  * Bugreports.to..: <Linux390@de.ibm.com>
49807f759SDavid Howells  * Copyright IBM Corp. 1999, 2000
59807f759SDavid Howells  * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
69807f759SDavid Howells  * Author.........: Nigel Hislop <hislop_nigel@emc.com>
79807f759SDavid Howells  *
89807f759SDavid Howells  * This file is the interface of the DASD device driver, which is exported to user space
99807f759SDavid Howells  * any future changes wrt the API will result in a change of the APIVERSION reported
109807f759SDavid Howells  * to userspace by the DASDAPIVER-ioctl
119807f759SDavid Howells  *
129807f759SDavid Howells  */
139807f759SDavid Howells 
149807f759SDavid Howells #ifndef DASD_H
159807f759SDavid Howells #define DASD_H
169807f759SDavid Howells #include <linux/types.h>
179807f759SDavid Howells #include <linux/ioctl.h>
189807f759SDavid Howells 
199807f759SDavid Howells #define DASD_IOCTL_LETTER 'D'
209807f759SDavid Howells 
219807f759SDavid Howells #define DASD_API_VERSION 6
229807f759SDavid Howells 
239807f759SDavid Howells /*
249807f759SDavid Howells  * struct dasd_information2_t
259807f759SDavid Howells  * represents any data about the device, which is visible to userspace.
269807f759SDavid Howells  *  including foramt and featueres.
279807f759SDavid Howells  */
289807f759SDavid Howells typedef struct dasd_information2_t {
299807f759SDavid Howells         unsigned int devno;         /* S/390 devno */
309807f759SDavid Howells         unsigned int real_devno;    /* for aliases */
319807f759SDavid Howells         unsigned int schid;         /* S/390 subchannel identifier */
329807f759SDavid Howells         unsigned int cu_type  : 16; /* from SenseID */
339807f759SDavid Howells         unsigned int cu_model :  8; /* from SenseID */
349807f759SDavid Howells         unsigned int dev_type : 16; /* from SenseID */
359807f759SDavid Howells         unsigned int dev_model : 8; /* from SenseID */
369807f759SDavid Howells         unsigned int open_count;
379807f759SDavid Howells         unsigned int req_queue_len;
389807f759SDavid Howells         unsigned int chanq_len;     /* length of chanq */
399807f759SDavid Howells         char type[4];               /* from discipline.name, 'none' for unknown */
409807f759SDavid Howells         unsigned int status;        /* current device level */
419807f759SDavid Howells         unsigned int label_block;   /* where to find the VOLSER */
429807f759SDavid Howells         unsigned int FBA_layout;    /* fixed block size (like AIXVOL) */
439807f759SDavid Howells         unsigned int characteristics_size;
449807f759SDavid Howells         unsigned int confdata_size;
459807f759SDavid Howells         char characteristics[64];   /* from read_device_characteristics */
469807f759SDavid Howells         char configuration_data[256]; /* from read_configuration_data */
479807f759SDavid Howells         unsigned int format;          /* format info like formatted/cdl/ldl/... */
489807f759SDavid Howells         unsigned int features;        /* dasd features like 'ro',...            */
499807f759SDavid Howells         unsigned int reserved0;       /* reserved for further use ,...          */
509807f759SDavid Howells         unsigned int reserved1;       /* reserved for further use ,...          */
519807f759SDavid Howells         unsigned int reserved2;       /* reserved for further use ,...          */
529807f759SDavid Howells         unsigned int reserved3;       /* reserved for further use ,...          */
539807f759SDavid Howells         unsigned int reserved4;       /* reserved for further use ,...          */
549807f759SDavid Howells         unsigned int reserved5;       /* reserved for further use ,...          */
559807f759SDavid Howells         unsigned int reserved6;       /* reserved for further use ,...          */
569807f759SDavid Howells         unsigned int reserved7;       /* reserved for further use ,...          */
579807f759SDavid Howells } dasd_information2_t;
589807f759SDavid Howells 
599807f759SDavid Howells /*
609807f759SDavid Howells  * values to be used for dasd_information_t.format
619807f759SDavid Howells  * 0x00: NOT formatted
629807f759SDavid Howells  * 0x01: Linux disc layout
639807f759SDavid Howells  * 0x02: Common disc layout
649807f759SDavid Howells  */
659807f759SDavid Howells #define DASD_FORMAT_NONE 0
669807f759SDavid Howells #define DASD_FORMAT_LDL  1
679807f759SDavid Howells #define DASD_FORMAT_CDL  2
689807f759SDavid Howells /*
699807f759SDavid Howells  * values to be used for dasd_information_t.features
709807f759SDavid Howells  * 0x00: default features
719807f759SDavid Howells  * 0x01: readonly (ro)
729807f759SDavid Howells  * 0x02: use diag discipline (diag)
739807f759SDavid Howells  * 0x04: set the device initially online (internal use only)
749807f759SDavid Howells  * 0x08: enable ERP related logging
759807f759SDavid Howells  * 0x20: give access to raw eckd data
769807f759SDavid Howells  */
779807f759SDavid Howells #define DASD_FEATURE_DEFAULT	     0x00
789807f759SDavid Howells #define DASD_FEATURE_READONLY	     0x01
799807f759SDavid Howells #define DASD_FEATURE_USEDIAG	     0x02
809807f759SDavid Howells #define DASD_FEATURE_INITIAL_ONLINE  0x04
819807f759SDavid Howells #define DASD_FEATURE_ERPLOG	     0x08
829807f759SDavid Howells #define DASD_FEATURE_FAILFAST	     0x10
839807f759SDavid Howells #define DASD_FEATURE_FAILONSLCK      0x20
849807f759SDavid Howells #define DASD_FEATURE_USERAW	     0x40
859807f759SDavid Howells 
869807f759SDavid Howells #define DASD_PARTN_BITS 2
879807f759SDavid Howells 
889807f759SDavid Howells /*
899807f759SDavid Howells  * struct dasd_information_t
909807f759SDavid Howells  * represents any data about the data, which is visible to userspace
919807f759SDavid Howells  */
929807f759SDavid Howells typedef struct dasd_information_t {
939807f759SDavid Howells         unsigned int devno;         /* S/390 devno */
949807f759SDavid Howells         unsigned int real_devno;    /* for aliases */
959807f759SDavid Howells         unsigned int schid;         /* S/390 subchannel identifier */
969807f759SDavid Howells         unsigned int cu_type  : 16; /* from SenseID */
979807f759SDavid Howells         unsigned int cu_model :  8; /* from SenseID */
989807f759SDavid Howells         unsigned int dev_type : 16; /* from SenseID */
999807f759SDavid Howells         unsigned int dev_model : 8; /* from SenseID */
1009807f759SDavid Howells         unsigned int open_count;
1019807f759SDavid Howells         unsigned int req_queue_len;
1029807f759SDavid Howells         unsigned int chanq_len;     /* length of chanq */
1039807f759SDavid Howells         char type[4];               /* from discipline.name, 'none' for unknown */
1049807f759SDavid Howells         unsigned int status;        /* current device level */
1059807f759SDavid Howells         unsigned int label_block;   /* where to find the VOLSER */
1069807f759SDavid Howells         unsigned int FBA_layout;    /* fixed block size (like AIXVOL) */
1079807f759SDavid Howells         unsigned int characteristics_size;
1089807f759SDavid Howells         unsigned int confdata_size;
1099807f759SDavid Howells         char characteristics[64];   /* from read_device_characteristics */
1109807f759SDavid Howells         char configuration_data[256]; /* from read_configuration_data */
1119807f759SDavid Howells } dasd_information_t;
1129807f759SDavid Howells 
1139807f759SDavid Howells /*
1149807f759SDavid Howells  * Read Subsystem Data - Performance Statistics
1159807f759SDavid Howells  */
1169807f759SDavid Howells typedef struct dasd_rssd_perf_stats_t {
1179807f759SDavid Howells 	unsigned char  invalid:1;
1189807f759SDavid Howells 	unsigned char  format:3;
1199807f759SDavid Howells 	unsigned char  data_format:4;
1209807f759SDavid Howells 	unsigned char  unit_address;
1219807f759SDavid Howells 	unsigned short device_status;
1229807f759SDavid Howells 	unsigned int   nr_read_normal;
1239807f759SDavid Howells 	unsigned int   nr_read_normal_hits;
1249807f759SDavid Howells 	unsigned int   nr_write_normal;
1259807f759SDavid Howells 	unsigned int   nr_write_fast_normal_hits;
1269807f759SDavid Howells 	unsigned int   nr_read_seq;
1279807f759SDavid Howells 	unsigned int   nr_read_seq_hits;
1289807f759SDavid Howells 	unsigned int   nr_write_seq;
1299807f759SDavid Howells 	unsigned int   nr_write_fast_seq_hits;
1309807f759SDavid Howells 	unsigned int   nr_read_cache;
1319807f759SDavid Howells 	unsigned int   nr_read_cache_hits;
1329807f759SDavid Howells 	unsigned int   nr_write_cache;
1339807f759SDavid Howells 	unsigned int   nr_write_fast_cache_hits;
1349807f759SDavid Howells 	unsigned int   nr_inhibit_cache;
1359807f759SDavid Howells 	unsigned int   nr_bybass_cache;
1369807f759SDavid Howells 	unsigned int   nr_seq_dasd_to_cache;
1379807f759SDavid Howells 	unsigned int   nr_dasd_to_cache;
1389807f759SDavid Howells 	unsigned int   nr_cache_to_dasd;
1399807f759SDavid Howells 	unsigned int   nr_delayed_fast_write;
1409807f759SDavid Howells 	unsigned int   nr_normal_fast_write;
1419807f759SDavid Howells 	unsigned int   nr_seq_fast_write;
1429807f759SDavid Howells 	unsigned int   nr_cache_miss;
1439807f759SDavid Howells 	unsigned char  status2;
1449807f759SDavid Howells 	unsigned int   nr_quick_write_promotes;
1459807f759SDavid Howells 	unsigned char  reserved;
1469807f759SDavid Howells 	unsigned short ssid;
1479807f759SDavid Howells 	unsigned char  reseved2[96];
1489807f759SDavid Howells } __attribute__((packed)) dasd_rssd_perf_stats_t;
1499807f759SDavid Howells 
1509807f759SDavid Howells /*
1519807f759SDavid Howells  * struct profile_info_t
1529807f759SDavid Howells  * holds the profinling information
1539807f759SDavid Howells  */
1549807f759SDavid Howells typedef struct dasd_profile_info_t {
1559807f759SDavid Howells         unsigned int dasd_io_reqs;	 /* number of requests processed at all */
1569807f759SDavid Howells         unsigned int dasd_io_sects;	 /* number of sectors processed at all */
1579807f759SDavid Howells         unsigned int dasd_io_secs[32];	 /* histogram of request's sizes */
1589807f759SDavid Howells         unsigned int dasd_io_times[32];	 /* histogram of requests's times */
1599807f759SDavid Howells         unsigned int dasd_io_timps[32];	 /* histogram of requests's times per sector */
1609807f759SDavid Howells         unsigned int dasd_io_time1[32];	 /* histogram of time from build to start */
1619807f759SDavid Howells         unsigned int dasd_io_time2[32];	 /* histogram of time from start to irq */
1629807f759SDavid Howells         unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
1639807f759SDavid Howells         unsigned int dasd_io_time3[32];	 /* histogram of time from irq to end */
1649807f759SDavid Howells         unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
1659807f759SDavid Howells } dasd_profile_info_t;
1669807f759SDavid Howells 
1679807f759SDavid Howells /*
1689807f759SDavid Howells  * struct format_data_t
1699807f759SDavid Howells  * represents all data necessary to format a dasd
1709807f759SDavid Howells  */
1719807f759SDavid Howells typedef struct format_data_t {
1729807f759SDavid Howells 	unsigned int start_unit; /* from track */
1739807f759SDavid Howells 	unsigned int stop_unit;  /* to track */
1749807f759SDavid Howells 	unsigned int blksize;	 /* sectorsize */
1759807f759SDavid Howells 	unsigned int intensity;
1769807f759SDavid Howells } format_data_t;
1779807f759SDavid Howells 
1789807f759SDavid Howells /*
1799807f759SDavid Howells  * values to be used for format_data_t.intensity
1809807f759SDavid Howells  * 0/8: normal format
1819807f759SDavid Howells  * 1/9: also write record zero
1829807f759SDavid Howells  * 3/11: also write home address
1839807f759SDavid Howells  * 4/12: invalidate track
1849807f759SDavid Howells  */
1859807f759SDavid Howells #define DASD_FMT_INT_FMT_R0 1 /* write record zero */
1869807f759SDavid Howells #define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
1879807f759SDavid Howells #define DASD_FMT_INT_INVAL  4 /* invalidate tracks */
1889807f759SDavid Howells #define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
1899807f759SDavid Howells 
190*8fd57520SJan Höppner /*
191*8fd57520SJan Höppner  * struct format_check_t
192*8fd57520SJan Höppner  * represents all data necessary to evaluate the format of
193*8fd57520SJan Höppner  * different tracks of a dasd
194*8fd57520SJan Höppner  */
195*8fd57520SJan Höppner typedef struct format_check_t {
196*8fd57520SJan Höppner 	/* Input */
197*8fd57520SJan Höppner 	struct format_data_t expect;
198*8fd57520SJan Höppner 
199*8fd57520SJan Höppner 	/* Output */
200*8fd57520SJan Höppner 	unsigned int result;		/* Error indication (DASD_FMT_ERR_*) */
201*8fd57520SJan Höppner 	unsigned int unit;		/* Track that is in error */
202*8fd57520SJan Höppner 	unsigned int rec;		/* Record that is in error */
203*8fd57520SJan Höppner 	unsigned int num_records;	/* Records in the track in error */
204*8fd57520SJan Höppner 	unsigned int blksize;		/* Blocksize of first record in error */
205*8fd57520SJan Höppner 	unsigned int key_length;	/* Key length of first record in error */
206*8fd57520SJan Höppner } format_check_t;
207*8fd57520SJan Höppner 
208*8fd57520SJan Höppner /* Values returned in format_check_t when a format error is detected: */
209*8fd57520SJan Höppner /* Too few records were found on a single track */
210*8fd57520SJan Höppner #define DASD_FMT_ERR_TOO_FEW_RECORDS	1
211*8fd57520SJan Höppner /* Too many records were found on a single track */
212*8fd57520SJan Höppner #define DASD_FMT_ERR_TOO_MANY_RECORDS	2
213*8fd57520SJan Höppner /* Blocksize/data-length of a record was wrong */
214*8fd57520SJan Höppner #define DASD_FMT_ERR_BLKSIZE		3
215*8fd57520SJan Höppner /* A record ID is defined by cylinder, head, and record number (CHR). */
216*8fd57520SJan Höppner /* On mismatch, this error is set */
217*8fd57520SJan Höppner #define DASD_FMT_ERR_RECORD_ID		4
218*8fd57520SJan Höppner /* If key-length was != 0 */
219*8fd57520SJan Höppner #define DASD_FMT_ERR_KEY_LENGTH		5
2209807f759SDavid Howells 
2219807f759SDavid Howells /*
2229807f759SDavid Howells  * struct attrib_data_t
2239807f759SDavid Howells  * represents the operation (cache) bits for the device.
2249807f759SDavid Howells  * Used in DE to influence caching of the DASD.
2259807f759SDavid Howells  */
2269807f759SDavid Howells typedef struct attrib_data_t {
2279807f759SDavid Howells 	unsigned char operation:3;     /* cache operation mode */
2289807f759SDavid Howells 	unsigned char reserved:5;      /* cache operation mode */
2299807f759SDavid Howells 	__u16         nr_cyl;          /* no of cyliners for read ahaed */
2309807f759SDavid Howells 	__u8          reserved2[29];   /* for future use */
2319807f759SDavid Howells } __attribute__ ((packed)) attrib_data_t;
2329807f759SDavid Howells 
2339807f759SDavid Howells /* definition of operation (cache) bits within attributes of DE */
2349807f759SDavid Howells #define DASD_NORMAL_CACHE  0x0
2359807f759SDavid Howells #define DASD_BYPASS_CACHE  0x1
2369807f759SDavid Howells #define DASD_INHIBIT_LOAD  0x2
2379807f759SDavid Howells #define DASD_SEQ_ACCESS    0x3
2389807f759SDavid Howells #define DASD_SEQ_PRESTAGE  0x4
2399807f759SDavid Howells #define DASD_REC_ACCESS    0x5
2409807f759SDavid Howells 
2419807f759SDavid Howells /*
2429807f759SDavid Howells  * Perform EMC Symmetrix I/O
2439807f759SDavid Howells  */
2449807f759SDavid Howells typedef struct dasd_symmio_parms {
2459807f759SDavid Howells 	unsigned char reserved[8];	/* compat with older releases */
2469807f759SDavid Howells 	unsigned long long psf_data;	/* char * cast to u64 */
2479807f759SDavid Howells 	unsigned long long rssd_result; /* char * cast to u64 */
2489807f759SDavid Howells 	int psf_data_len;
2499807f759SDavid Howells 	int rssd_result_len;
2509807f759SDavid Howells } __attribute__ ((packed)) dasd_symmio_parms_t;
2519807f759SDavid Howells 
2529807f759SDavid Howells /*
2539807f759SDavid Howells  * Data returned by Sense Path Group ID (SNID)
2549807f759SDavid Howells  */
2559807f759SDavid Howells struct dasd_snid_data {
2569807f759SDavid Howells 	struct {
2579807f759SDavid Howells 		__u8 group:2;
2589807f759SDavid Howells 		__u8 reserve:2;
2599807f759SDavid Howells 		__u8 mode:1;
2609807f759SDavid Howells 		__u8 res:3;
2619807f759SDavid Howells 	} __attribute__ ((packed)) path_state;
2629807f759SDavid Howells 	__u8 pgid[11];
2639807f759SDavid Howells } __attribute__ ((packed));
2649807f759SDavid Howells 
2659807f759SDavid Howells struct dasd_snid_ioctl_data {
2669807f759SDavid Howells 	struct dasd_snid_data data;
2679807f759SDavid Howells 	__u8 path_mask;
2689807f759SDavid Howells } __attribute__ ((packed));
2699807f759SDavid Howells 
2709807f759SDavid Howells 
2719807f759SDavid Howells /********************************************************************************
2729807f759SDavid Howells  * SECTION: Definition of IOCTLs
2739807f759SDavid Howells  *
2749807f759SDavid Howells  * Here ist how the ioctl-nr should be used:
2759807f759SDavid Howells  *    0 -   31   DASD driver itself
2769807f759SDavid Howells  *   32 -  239   still open
2779807f759SDavid Howells  *  240 -  255   reserved for EMC
2789807f759SDavid Howells  *******************************************************************************/
2799807f759SDavid Howells 
2809807f759SDavid Howells /* Disable the volume (for Linux) */
2819807f759SDavid Howells #define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
2829807f759SDavid Howells /* Enable the volume (for Linux) */
2839807f759SDavid Howells #define BIODASDENABLE  _IO(DASD_IOCTL_LETTER,1)
2849807f759SDavid Howells /* Issue a reserve/release command, rsp. */
2859807f759SDavid Howells #define BIODASDRSRV    _IO(DASD_IOCTL_LETTER,2) /* reserve */
2869807f759SDavid Howells #define BIODASDRLSE    _IO(DASD_IOCTL_LETTER,3) /* release */
2879807f759SDavid Howells #define BIODASDSLCK    _IO(DASD_IOCTL_LETTER,4) /* steal lock */
2889807f759SDavid Howells /* reset profiling information of a device */
2899807f759SDavid Howells #define BIODASDPRRST   _IO(DASD_IOCTL_LETTER,5)
2909807f759SDavid Howells /* Quiesce IO on device */
2919807f759SDavid Howells #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
2929807f759SDavid Howells /* Resume IO on device */
2939807f759SDavid Howells #define BIODASDRESUME  _IO(DASD_IOCTL_LETTER,7)
2945ea34a01SHannes Reinecke /* Abort all I/O on a device */
2955ea34a01SHannes Reinecke #define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240)
2965ea34a01SHannes Reinecke /* Allow I/O on a device */
2975ea34a01SHannes Reinecke #define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241)
2989807f759SDavid Howells 
2999807f759SDavid Howells 
3009807f759SDavid Howells /* retrieve API version number */
3019807f759SDavid Howells #define DASDAPIVER     _IOR(DASD_IOCTL_LETTER,0,int)
3029807f759SDavid Howells /* Get information on a dasd device */
3039807f759SDavid Howells #define BIODASDINFO    _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
3049807f759SDavid Howells /* retrieve profiling information of a device */
3059807f759SDavid Howells #define BIODASDPRRD    _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
3069807f759SDavid Howells /* Get information on a dasd device (enhanced) */
3079807f759SDavid Howells #define BIODASDINFO2   _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
3089807f759SDavid Howells /* Performance Statistics Read */
3099807f759SDavid Howells #define BIODASDPSRD    _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
3109807f759SDavid Howells /* Get Attributes (cache operations) */
3119807f759SDavid Howells #define BIODASDGATTR   _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
3129807f759SDavid Howells 
3139807f759SDavid Howells 
3149807f759SDavid Howells /* #define BIODASDFORMAT  _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
3159807f759SDavid Howells #define BIODASDFMT     _IOW(DASD_IOCTL_LETTER,1,format_data_t)
3169807f759SDavid Howells /* Set Attributes (cache operations) */
3179807f759SDavid Howells #define BIODASDSATTR   _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
3189807f759SDavid Howells 
3199807f759SDavid Howells /* Get Sense Path Group ID (SNID) data */
3209807f759SDavid Howells #define BIODASDSNID    _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)
321*8fd57520SJan Höppner /* Check device format according to format_check_t */
322*8fd57520SJan Höppner #define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t)
3239807f759SDavid Howells 
3249807f759SDavid Howells #define BIODASDSYMMIO  _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)
3259807f759SDavid Howells 
3269807f759SDavid Howells #endif				/* DASD_H */
3279807f759SDavid Howells 
328