/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */1/*2* Author(s)......: Holger Smolinski <[email protected]>3* Bugreports.to..: <[email protected]>4* Copyright IBM Corp. 1999, 20005* EMC Symmetrix ioctl Copyright EMC Corporation, 20086* Author.........: Nigel Hislop <[email protected]>7*8* This file is the interface of the DASD device driver, which is exported to user space9* any future changes wrt the API will result in a change of the APIVERSION reported10* to userspace by the DASDAPIVER-ioctl11*12*/1314#ifndef DASD_H15#define DASD_H16#include <linux/types.h>17#include <linux/ioctl.h>1819#define DASD_IOCTL_LETTER 'D'2021#define DASD_API_VERSION 62223/*24* struct dasd_information2_t25* represents any data about the device, which is visible to userspace.26* including format and featueres.27*/28typedef struct dasd_information2_t {29unsigned int devno; /* S/390 devno */30unsigned int real_devno; /* for aliases */31unsigned int schid; /* S/390 subchannel identifier */32unsigned int cu_type : 16; /* from SenseID */33unsigned int cu_model : 8; /* from SenseID */34unsigned int dev_type : 16; /* from SenseID */35unsigned int dev_model : 8; /* from SenseID */36unsigned int open_count;37unsigned int req_queue_len;38unsigned int chanq_len; /* length of chanq */39char type[4]; /* from discipline.name, 'none' for unknown */40unsigned int status; /* current device level */41unsigned int label_block; /* where to find the VOLSER */42unsigned int FBA_layout; /* fixed block size (like AIXVOL) */43unsigned int characteristics_size;44unsigned int confdata_size;45char characteristics[64]; /* from read_device_characteristics */46char configuration_data[256]; /* from read_configuration_data */47unsigned int format; /* format info like formatted/cdl/ldl/... */48unsigned int features; /* dasd features like 'ro',... */49unsigned int reserved0; /* reserved for further use ,... */50unsigned int reserved1; /* reserved for further use ,... */51unsigned int reserved2; /* reserved for further use ,... */52unsigned int reserved3; /* reserved for further use ,... */53unsigned int reserved4; /* reserved for further use ,... */54unsigned int reserved5; /* reserved for further use ,... */55unsigned int reserved6; /* reserved for further use ,... */56unsigned int reserved7; /* reserved for further use ,... */57} dasd_information2_t;5859/*60* values to be used for dasd_information_t.format61* 0x00: NOT formatted62* 0x01: Linux disc layout63* 0x02: Common disc layout64*/65#define DASD_FORMAT_NONE 066#define DASD_FORMAT_LDL 167#define DASD_FORMAT_CDL 268/*69* values to be used for dasd_information_t.features70* 0x100: default features71* 0x001: readonly (ro)72* 0x002: use diag discipline (diag)73* 0x004: set the device initially online (internal use only)74* 0x008: enable ERP related logging75* 0x010: allow I/O to fail on lost paths76* 0x020: allow I/O to fail when a lock was stolen77* 0x040: give access to raw eckd data78* 0x080: enable discard support79* 0x100: enable autodisable for IFCC errors (default)80* 0x200: enable requeue of all requests on autoquiesce81*/82#define DASD_FEATURE_READONLY 0x00183#define DASD_FEATURE_USEDIAG 0x00284#define DASD_FEATURE_INITIAL_ONLINE 0x00485#define DASD_FEATURE_ERPLOG 0x00886#define DASD_FEATURE_FAILFAST 0x01087#define DASD_FEATURE_FAILONSLCK 0x02088#define DASD_FEATURE_USERAW 0x04089#define DASD_FEATURE_DISCARD 0x08090#define DASD_FEATURE_PATH_AUTODISABLE 0x10091#define DASD_FEATURE_REQUEUEQUIESCE 0x20092#define DASD_FEATURE_DEFAULT DASD_FEATURE_PATH_AUTODISABLE9394#define DASD_PARTN_BITS 29596/*97* struct dasd_information_t98* represents any data about the data, which is visible to userspace99*/100typedef struct dasd_information_t {101unsigned int devno; /* S/390 devno */102unsigned int real_devno; /* for aliases */103unsigned int schid; /* S/390 subchannel identifier */104unsigned int cu_type : 16; /* from SenseID */105unsigned int cu_model : 8; /* from SenseID */106unsigned int dev_type : 16; /* from SenseID */107unsigned int dev_model : 8; /* from SenseID */108unsigned int open_count;109unsigned int req_queue_len;110unsigned int chanq_len; /* length of chanq */111char type[4]; /* from discipline.name, 'none' for unknown */112unsigned int status; /* current device level */113unsigned int label_block; /* where to find the VOLSER */114unsigned int FBA_layout; /* fixed block size (like AIXVOL) */115unsigned int characteristics_size;116unsigned int confdata_size;117char characteristics[64]; /* from read_device_characteristics */118char configuration_data[256]; /* from read_configuration_data */119} dasd_information_t;120121/*122* Read Subsystem Data - Performance Statistics123*/124typedef struct dasd_rssd_perf_stats_t {125unsigned char invalid:1;126unsigned char format:3;127unsigned char data_format:4;128unsigned char unit_address;129unsigned short device_status;130unsigned int nr_read_normal;131unsigned int nr_read_normal_hits;132unsigned int nr_write_normal;133unsigned int nr_write_fast_normal_hits;134unsigned int nr_read_seq;135unsigned int nr_read_seq_hits;136unsigned int nr_write_seq;137unsigned int nr_write_fast_seq_hits;138unsigned int nr_read_cache;139unsigned int nr_read_cache_hits;140unsigned int nr_write_cache;141unsigned int nr_write_fast_cache_hits;142unsigned int nr_inhibit_cache;143unsigned int nr_bybass_cache;144unsigned int nr_seq_dasd_to_cache;145unsigned int nr_dasd_to_cache;146unsigned int nr_cache_to_dasd;147unsigned int nr_delayed_fast_write;148unsigned int nr_normal_fast_write;149unsigned int nr_seq_fast_write;150unsigned int nr_cache_miss;151unsigned char status2;152unsigned int nr_quick_write_promotes;153unsigned char reserved;154unsigned short ssid;155unsigned char reseved2[96];156} __attribute__((packed)) dasd_rssd_perf_stats_t;157158/*159* struct profile_info_t160* holds the profinling information161*/162typedef struct dasd_profile_info_t {163unsigned int dasd_io_reqs; /* number of requests processed at all */164unsigned int dasd_io_sects; /* number of sectors processed at all */165unsigned int dasd_io_secs[32]; /* histogram of request's sizes */166unsigned int dasd_io_times[32]; /* histogram of requests's times */167unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */168unsigned int dasd_io_time1[32]; /* histogram of time from build to start */169unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */170unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */171unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */172unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */173} dasd_profile_info_t;174175/*176* struct format_data_t177* represents all data necessary to format a dasd178*/179typedef struct format_data_t {180unsigned int start_unit; /* from track */181unsigned int stop_unit; /* to track */182unsigned int blksize; /* sectorsize */183unsigned int intensity;184} format_data_t;185186/*187* struct dasd_copypair_swap_data_t188* represents all data necessary to issue a swap of the copy pair relation189*/190struct dasd_copypair_swap_data_t {191char primary[20]; /* BUSID of primary */192char secondary[20]; /* BUSID of secondary */193194/* Reserved for future updates. */195__u8 reserved[64];196};197198/*199* values to be used for format_data_t.intensity200* 0/8: normal format201* 1/9: also write record zero202* 3/11: also write home address203* 4/12: invalidate track204*/205#define DASD_FMT_INT_FMT_R0 1 /* write record zero */206#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */207#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */208#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */209#define DASD_FMT_INT_FMT_NOR0 16 /* remove permission to write record zero */210#define DASD_FMT_INT_ESE_FULL 32 /* release space for entire volume */211212/*213* struct format_check_t214* represents all data necessary to evaluate the format of215* different tracks of a dasd216*/217typedef struct format_check_t {218/* Input */219struct format_data_t expect;220221/* Output */222unsigned int result; /* Error indication (DASD_FMT_ERR_*) */223unsigned int unit; /* Track that is in error */224unsigned int rec; /* Record that is in error */225unsigned int num_records; /* Records in the track in error */226unsigned int blksize; /* Blocksize of first record in error */227unsigned int key_length; /* Key length of first record in error */228} format_check_t;229230/* Values returned in format_check_t when a format error is detected: */231/* Too few records were found on a single track */232#define DASD_FMT_ERR_TOO_FEW_RECORDS 1233/* Too many records were found on a single track */234#define DASD_FMT_ERR_TOO_MANY_RECORDS 2235/* Blocksize/data-length of a record was wrong */236#define DASD_FMT_ERR_BLKSIZE 3237/* A record ID is defined by cylinder, head, and record number (CHR). */238/* On mismatch, this error is set */239#define DASD_FMT_ERR_RECORD_ID 4240/* If key-length was != 0 */241#define DASD_FMT_ERR_KEY_LENGTH 5242243/*244* struct attrib_data_t245* represents the operation (cache) bits for the device.246* Used in DE to influence caching of the DASD.247*/248typedef struct attrib_data_t {249unsigned char operation:3; /* cache operation mode */250unsigned char reserved:5; /* cache operation mode */251__u16 nr_cyl; /* no of cyliners for read ahaed */252__u8 reserved2[29]; /* for future use */253} __attribute__ ((packed)) attrib_data_t;254255/* definition of operation (cache) bits within attributes of DE */256#define DASD_NORMAL_CACHE 0x0257#define DASD_BYPASS_CACHE 0x1258#define DASD_INHIBIT_LOAD 0x2259#define DASD_SEQ_ACCESS 0x3260#define DASD_SEQ_PRESTAGE 0x4261#define DASD_REC_ACCESS 0x5262263/*264* Perform EMC Symmetrix I/O265*/266typedef struct dasd_symmio_parms {267unsigned char reserved[8]; /* compat with older releases */268unsigned long long psf_data; /* char * cast to u64 */269unsigned long long rssd_result; /* char * cast to u64 */270int psf_data_len;271int rssd_result_len;272} __attribute__ ((packed)) dasd_symmio_parms_t;273274/*275* Data returned by Sense Path Group ID (SNID)276*/277struct dasd_snid_data {278struct {279__u8 group:2;280__u8 reserve:2;281__u8 mode:1;282__u8 res:3;283} __attribute__ ((packed)) path_state;284__u8 pgid[11];285} __attribute__ ((packed));286287struct dasd_snid_ioctl_data {288struct dasd_snid_data data;289__u8 path_mask;290} __attribute__ ((packed));291292293/********************************************************************************294* SECTION: Definition of IOCTLs295*296* Here is how the ioctl-nr should be used:297* 0 - 31 DASD driver itself298* 32 - 239 still open299* 240 - 255 reserved for EMC300*******************************************************************************/301302/* Disable the volume (for Linux) */303#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)304/* Enable the volume (for Linux) */305#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)306/* Issue a reserve/release command, rsp. */307#define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */308#define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */309#define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */310/* reset profiling information of a device */311#define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)312/* Quiesce IO on device */313#define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)314/* Resume IO on device */315#define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)316/* Abort all I/O on a device */317#define BIODASDABORTIO _IO(DASD_IOCTL_LETTER, 240)318/* Allow I/O on a device */319#define BIODASDALLOWIO _IO(DASD_IOCTL_LETTER, 241)320321322/* retrieve API version number */323#define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)324/* Get information on a dasd device */325#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)326/* retrieve profiling information of a device */327#define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)328/* Get information on a dasd device (enhanced) */329#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)330/* Performance Statistics Read */331#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)332/* Get Attributes (cache operations) */333#define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)334335336/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */337#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)338/* Set Attributes (cache operations) */339#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)340/* Release Allocated Space */341#define BIODASDRAS _IOW(DASD_IOCTL_LETTER, 3, format_data_t)342/* Swap copy pair relation */343#define BIODASDCOPYPAIRSWAP _IOW(DASD_IOCTL_LETTER, 4, struct dasd_copypair_swap_data_t)344345/* Get Sense Path Group ID (SNID) data */346#define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)347/* Check device format according to format_check_t */348#define BIODASDCHECKFMT _IOWR(DASD_IOCTL_LETTER, 2, format_check_t)349350#define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)351352#endif /* DASD_H */353354355356