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