16f52b16cSGreg 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 71ddc1c945SStefan Haberland * 0x100: default features 72ddc1c945SStefan Haberland * 0x001: readonly (ro) 73ddc1c945SStefan Haberland * 0x002: use diag discipline (diag) 74ddc1c945SStefan Haberland * 0x004: set the device initially online (internal use only) 75ddc1c945SStefan Haberland * 0x008: enable ERP related logging 76ddc1c945SStefan Haberland * 0x010: allow I/O to fail on lost paths 77ddc1c945SStefan Haberland * 0x020: allow I/O to fail when a lock was stolen 78ddc1c945SStefan Haberland * 0x040: give access to raw eckd data 79ddc1c945SStefan Haberland * 0x080: enable discard support 80ddc1c945SStefan Haberland * 0x100: enable autodisable for IFCC errors (default) 819807f759SDavid Howells */ 82ddc1c945SStefan Haberland #define DASD_FEATURE_READONLY 0x001 83ddc1c945SStefan Haberland #define DASD_FEATURE_USEDIAG 0x002 84ddc1c945SStefan Haberland #define DASD_FEATURE_INITIAL_ONLINE 0x004 85ddc1c945SStefan Haberland #define DASD_FEATURE_ERPLOG 0x008 86ddc1c945SStefan Haberland #define DASD_FEATURE_FAILFAST 0x010 87ddc1c945SStefan Haberland #define DASD_FEATURE_FAILONSLCK 0x020 88ddc1c945SStefan Haberland #define DASD_FEATURE_USERAW 0x040 89ddc1c945SStefan Haberland #define DASD_FEATURE_DISCARD 0x080 90ddc1c945SStefan Haberland #define DASD_FEATURE_PATH_AUTODISABLE 0x100 91ddc1c945SStefan Haberland #define DASD_FEATURE_DEFAULT DASD_FEATURE_PATH_AUTODISABLE 929807f759SDavid Howells 939807f759SDavid Howells #define DASD_PARTN_BITS 2 949807f759SDavid Howells 959807f759SDavid Howells /* 969807f759SDavid Howells * struct dasd_information_t 979807f759SDavid Howells * represents any data about the data, which is visible to userspace 989807f759SDavid Howells */ 999807f759SDavid Howells typedef struct dasd_information_t { 1009807f759SDavid Howells unsigned int devno; /* S/390 devno */ 1019807f759SDavid Howells unsigned int real_devno; /* for aliases */ 1029807f759SDavid Howells unsigned int schid; /* S/390 subchannel identifier */ 1039807f759SDavid Howells unsigned int cu_type : 16; /* from SenseID */ 1049807f759SDavid Howells unsigned int cu_model : 8; /* from SenseID */ 1059807f759SDavid Howells unsigned int dev_type : 16; /* from SenseID */ 1069807f759SDavid Howells unsigned int dev_model : 8; /* from SenseID */ 1079807f759SDavid Howells unsigned int open_count; 1089807f759SDavid Howells unsigned int req_queue_len; 1099807f759SDavid Howells unsigned int chanq_len; /* length of chanq */ 1109807f759SDavid Howells char type[4]; /* from discipline.name, 'none' for unknown */ 1119807f759SDavid Howells unsigned int status; /* current device level */ 1129807f759SDavid Howells unsigned int label_block; /* where to find the VOLSER */ 1139807f759SDavid Howells unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ 1149807f759SDavid Howells unsigned int characteristics_size; 1159807f759SDavid Howells unsigned int confdata_size; 1169807f759SDavid Howells char characteristics[64]; /* from read_device_characteristics */ 1179807f759SDavid Howells char configuration_data[256]; /* from read_configuration_data */ 1189807f759SDavid Howells } dasd_information_t; 1199807f759SDavid Howells 1209807f759SDavid Howells /* 1219807f759SDavid Howells * Read Subsystem Data - Performance Statistics 1229807f759SDavid Howells */ 1239807f759SDavid Howells typedef struct dasd_rssd_perf_stats_t { 1249807f759SDavid Howells unsigned char invalid:1; 1259807f759SDavid Howells unsigned char format:3; 1269807f759SDavid Howells unsigned char data_format:4; 1279807f759SDavid Howells unsigned char unit_address; 1289807f759SDavid Howells unsigned short device_status; 1299807f759SDavid Howells unsigned int nr_read_normal; 1309807f759SDavid Howells unsigned int nr_read_normal_hits; 1319807f759SDavid Howells unsigned int nr_write_normal; 1329807f759SDavid Howells unsigned int nr_write_fast_normal_hits; 1339807f759SDavid Howells unsigned int nr_read_seq; 1349807f759SDavid Howells unsigned int nr_read_seq_hits; 1359807f759SDavid Howells unsigned int nr_write_seq; 1369807f759SDavid Howells unsigned int nr_write_fast_seq_hits; 1379807f759SDavid Howells unsigned int nr_read_cache; 1389807f759SDavid Howells unsigned int nr_read_cache_hits; 1399807f759SDavid Howells unsigned int nr_write_cache; 1409807f759SDavid Howells unsigned int nr_write_fast_cache_hits; 1419807f759SDavid Howells unsigned int nr_inhibit_cache; 1429807f759SDavid Howells unsigned int nr_bybass_cache; 1439807f759SDavid Howells unsigned int nr_seq_dasd_to_cache; 1449807f759SDavid Howells unsigned int nr_dasd_to_cache; 1459807f759SDavid Howells unsigned int nr_cache_to_dasd; 1469807f759SDavid Howells unsigned int nr_delayed_fast_write; 1479807f759SDavid Howells unsigned int nr_normal_fast_write; 1489807f759SDavid Howells unsigned int nr_seq_fast_write; 1499807f759SDavid Howells unsigned int nr_cache_miss; 1509807f759SDavid Howells unsigned char status2; 1519807f759SDavid Howells unsigned int nr_quick_write_promotes; 1529807f759SDavid Howells unsigned char reserved; 1539807f759SDavid Howells unsigned short ssid; 1549807f759SDavid Howells unsigned char reseved2[96]; 1559807f759SDavid Howells } __attribute__((packed)) dasd_rssd_perf_stats_t; 1569807f759SDavid Howells 1579807f759SDavid Howells /* 1589807f759SDavid Howells * struct profile_info_t 1599807f759SDavid Howells * holds the profinling information 1609807f759SDavid Howells */ 1619807f759SDavid Howells typedef struct dasd_profile_info_t { 1629807f759SDavid Howells unsigned int dasd_io_reqs; /* number of requests processed at all */ 1639807f759SDavid Howells unsigned int dasd_io_sects; /* number of sectors processed at all */ 1649807f759SDavid Howells unsigned int dasd_io_secs[32]; /* histogram of request's sizes */ 1659807f759SDavid Howells unsigned int dasd_io_times[32]; /* histogram of requests's times */ 1669807f759SDavid Howells unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */ 1679807f759SDavid Howells unsigned int dasd_io_time1[32]; /* histogram of time from build to start */ 1689807f759SDavid Howells unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */ 1699807f759SDavid Howells unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */ 1709807f759SDavid Howells unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */ 1719807f759SDavid Howells unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */ 1729807f759SDavid Howells } dasd_profile_info_t; 1739807f759SDavid Howells 1749807f759SDavid Howells /* 1759807f759SDavid Howells * struct format_data_t 1769807f759SDavid Howells * represents all data necessary to format a dasd 1779807f759SDavid Howells */ 1789807f759SDavid Howells typedef struct format_data_t { 1799807f759SDavid Howells unsigned int start_unit; /* from track */ 1809807f759SDavid Howells unsigned int stop_unit; /* to track */ 1819807f759SDavid Howells unsigned int blksize; /* sectorsize */ 1829807f759SDavid Howells unsigned int intensity; 1839807f759SDavid Howells } format_data_t; 1849807f759SDavid Howells 1859807f759SDavid Howells /* 1869807f759SDavid Howells * values to be used for format_data_t.intensity 1879807f759SDavid Howells * 0/8: normal format 1889807f759SDavid Howells * 1/9: also write record zero 1899807f759SDavid Howells * 3/11: also write home address 1909807f759SDavid Howells * 4/12: invalidate track 1919807f759SDavid Howells */ 1929807f759SDavid Howells #define DASD_FMT_INT_FMT_R0 1 /* write record zero */ 1939807f759SDavid Howells #define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */ 1949807f759SDavid Howells #define DASD_FMT_INT_INVAL 4 /* invalidate tracks */ 1959807f759SDavid Howells #define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */ 196*d7a4434dSJan Höppner #define DASD_FMT_INT_FMT_NOR0 16 /* remove permission to write record zero */ 1979807f759SDavid Howells 1988fd57520SJan Höppner /* 1998fd57520SJan Höppner * struct format_check_t 2008fd57520SJan Höppner * represents all data necessary to evaluate the format of 2018fd57520SJan Höppner * different tracks of a dasd 2028fd57520SJan Höppner */ 2038fd57520SJan Höppner typedef struct format_check_t { 2048fd57520SJan Höppner /* Input */ 2058fd57520SJan Höppner struct format_data_t expect; 2068fd57520SJan Höppner 2078fd57520SJan Höppner /* Output */ 2088fd57520SJan Höppner unsigned int result; /* Error indication (DASD_FMT_ERR_*) */ 2098fd57520SJan Höppner unsigned int unit; /* Track that is in error */ 2108fd57520SJan Höppner unsigned int rec; /* Record that is in error */ 2118fd57520SJan Höppner unsigned int num_records; /* Records in the track in error */ 2128fd57520SJan Höppner unsigned int blksize; /* Blocksize of first record in error */ 2138fd57520SJan Höppner unsigned int key_length; /* Key length of first record in error */ 2148fd57520SJan Höppner } format_check_t; 2158fd57520SJan Höppner 2168fd57520SJan Höppner /* Values returned in format_check_t when a format error is detected: */ 2178fd57520SJan Höppner /* Too few records were found on a single track */ 2188fd57520SJan Höppner #define DASD_FMT_ERR_TOO_FEW_RECORDS 1 2198fd57520SJan Höppner /* Too many records were found on a single track */ 2208fd57520SJan Höppner #define DASD_FMT_ERR_TOO_MANY_RECORDS 2 2218fd57520SJan Höppner /* Blocksize/data-length of a record was wrong */ 2228fd57520SJan Höppner #define DASD_FMT_ERR_BLKSIZE 3 2238fd57520SJan Höppner /* A record ID is defined by cylinder, head, and record number (CHR). */ 2248fd57520SJan Höppner /* On mismatch, this error is set */ 2258fd57520SJan Höppner #define DASD_FMT_ERR_RECORD_ID 4 2268fd57520SJan Höppner /* If key-length was != 0 */ 2278fd57520SJan Höppner #define DASD_FMT_ERR_KEY_LENGTH 5 2289807f759SDavid Howells 2299807f759SDavid Howells /* 2309807f759SDavid Howells * struct attrib_data_t 2319807f759SDavid Howells * represents the operation (cache) bits for the device. 2329807f759SDavid Howells * Used in DE to influence caching of the DASD. 2339807f759SDavid Howells */ 2349807f759SDavid Howells typedef struct attrib_data_t { 2359807f759SDavid Howells unsigned char operation:3; /* cache operation mode */ 2369807f759SDavid Howells unsigned char reserved:5; /* cache operation mode */ 2379807f759SDavid Howells __u16 nr_cyl; /* no of cyliners for read ahaed */ 2389807f759SDavid Howells __u8 reserved2[29]; /* for future use */ 2399807f759SDavid Howells } __attribute__ ((packed)) attrib_data_t; 2409807f759SDavid Howells 2419807f759SDavid Howells /* definition of operation (cache) bits within attributes of DE */ 2429807f759SDavid Howells #define DASD_NORMAL_CACHE 0x0 2439807f759SDavid Howells #define DASD_BYPASS_CACHE 0x1 2449807f759SDavid Howells #define DASD_INHIBIT_LOAD 0x2 2459807f759SDavid Howells #define DASD_SEQ_ACCESS 0x3 2469807f759SDavid Howells #define DASD_SEQ_PRESTAGE 0x4 2479807f759SDavid Howells #define DASD_REC_ACCESS 0x5 2489807f759SDavid Howells 2499807f759SDavid Howells /* 2509807f759SDavid Howells * Perform EMC Symmetrix I/O 2519807f759SDavid Howells */ 2529807f759SDavid Howells typedef struct dasd_symmio_parms { 2539807f759SDavid Howells unsigned char reserved[8]; /* compat with older releases */ 2549807f759SDavid Howells unsigned long long psf_data; /* char * cast to u64 */ 2559807f759SDavid Howells unsigned long long rssd_result; /* char * cast to u64 */ 2569807f759SDavid Howells int psf_data_len; 2579807f759SDavid Howells int rssd_result_len; 2589807f759SDavid Howells } __attribute__ ((packed)) dasd_symmio_parms_t; 2599807f759SDavid Howells 2609807f759SDavid Howells /* 2619807f759SDavid Howells * Data returned by Sense Path Group ID (SNID) 2629807f759SDavid Howells */ 2639807f759SDavid Howells struct dasd_snid_data { 2649807f759SDavid Howells struct { 2659807f759SDavid Howells __u8 group:2; 2669807f759SDavid Howells __u8 reserve:2; 2679807f759SDavid Howells __u8 mode:1; 2689807f759SDavid Howells __u8 res:3; 2699807f759SDavid Howells } __attribute__ ((packed)) path_state; 2709807f759SDavid Howells __u8 pgid[11]; 2719807f759SDavid Howells } __attribute__ ((packed)); 2729807f759SDavid Howells 2739807f759SDavid Howells struct dasd_snid_ioctl_data { 2749807f759SDavid Howells struct dasd_snid_data data; 2759807f759SDavid Howells __u8 path_mask; 2769807f759SDavid Howells } __attribute__ ((packed)); 2779807f759SDavid Howells 2789807f759SDavid Howells 2799807f759SDavid Howells /******************************************************************************** 2809807f759SDavid Howells * SECTION: Definition of IOCTLs 2819807f759SDavid Howells * 2829807f759SDavid Howells * Here ist how the ioctl-nr should be used: 2839807f759SDavid Howells * 0 - 31 DASD driver itself 2849807f759SDavid Howells * 32 - 239 still open 2859807f759SDavid Howells * 240 - 255 reserved for EMC 2869807f759SDavid Howells *******************************************************************************/ 2879807f759SDavid Howells 2889807f759SDavid Howells /* Disable the volume (for Linux) */ 2899807f759SDavid Howells #define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0) 2909807f759SDavid Howells /* Enable the volume (for Linux) */ 2919807f759SDavid Howells #define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1) 2929807f759SDavid Howells /* Issue a reserve/release command, rsp. */ 2939807f759SDavid Howells #define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */ 2949807f759SDavid Howells #define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */ 2959807f759SDavid Howells #define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */ 2969807f759SDavid Howells /* reset profiling information of a device */ 2979807f759SDavid Howells #define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5) 2989807f759SDavid Howells /* Quiesce IO on device */ 2999807f759SDavid Howells #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6) 3009807f759SDavid Howells /* Resume IO on device */ 3019807f759SDavid Howells #define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7) 3025ea34a01SHannes Reinecke /* Abort all I/O on a device */ 3035ea34a01SHannes Reinecke #define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240) 3045ea34a01SHannes Reinecke /* Allow I/O on a device */ 3055ea34a01SHannes Reinecke #define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241) 3069807f759SDavid Howells 3079807f759SDavid Howells 3089807f759SDavid Howells /* retrieve API version number */ 3099807f759SDavid Howells #define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int) 3109807f759SDavid Howells /* Get information on a dasd device */ 3119807f759SDavid Howells #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) 3129807f759SDavid Howells /* retrieve profiling information of a device */ 3139807f759SDavid Howells #define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t) 3149807f759SDavid Howells /* Get information on a dasd device (enhanced) */ 3159807f759SDavid Howells #define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t) 3169807f759SDavid Howells /* Performance Statistics Read */ 3179807f759SDavid Howells #define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t) 3189807f759SDavid Howells /* Get Attributes (cache operations) */ 3199807f759SDavid Howells #define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t) 3209807f759SDavid Howells 3219807f759SDavid Howells 3229807f759SDavid Howells /* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */ 3239807f759SDavid Howells #define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t) 3249807f759SDavid Howells /* Set Attributes (cache operations) */ 3259807f759SDavid Howells #define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t) 3269807f759SDavid Howells 3279807f759SDavid Howells /* Get Sense Path Group ID (SNID) data */ 3289807f759SDavid Howells #define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data) 3298fd57520SJan Höppner /* Check device format according to format_check_t */ 3308fd57520SJan Höppner #define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t) 3319807f759SDavid Howells 3329807f759SDavid Howells #define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t) 3339807f759SDavid Howells 3349807f759SDavid Howells #endif /* DASD_H */ 3359807f759SDavid Howells 336