2 * File...........: linux/drivers/s390/block/dasd.c
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Bugreports.to..: <Linux390@de.ibm.com>
5 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
6 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
7 * Author.........: Nigel Hislop <hislop_nigel@emc.com>
9 * This file is the interface of the DASD device driver, which is exported to user space
10 * any future changes wrt the API will result in a change of the APIVERSION reported
11 * to userspace by the DASDAPIVER-ioctl
17 #include <linux/types.h>
18 #include <linux/ioctl.h>
20 #define DASD_IOCTL_LETTER 'D'
22 #define DASD_API_VERSION 6
25 * struct dasd_information2_t
26 * represents any data about the device, which is visible to userspace.
27 * including foramt and featueres.
29 typedef struct dasd_information2_t {
30 unsigned int devno; /* S/390 devno */
31 unsigned int real_devno; /* for aliases */
32 unsigned int schid; /* S/390 subchannel identifier */
33 unsigned int cu_type : 16; /* from SenseID */
34 unsigned int cu_model : 8; /* from SenseID */
35 unsigned int dev_type : 16; /* from SenseID */
36 unsigned int dev_model : 8; /* from SenseID */
37 unsigned int open_count;
38 unsigned int req_queue_len;
39 unsigned int chanq_len; /* length of chanq */
40 char type[4]; /* from discipline.name, 'none' for unknown */
41 unsigned int status; /* current device level */
42 unsigned int label_block; /* where to find the VOLSER */
43 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
44 unsigned int characteristics_size;
45 unsigned int confdata_size;
46 char characteristics[64]; /* from read_device_characteristics */
47 char configuration_data[256]; /* from read_configuration_data */
48 unsigned int format; /* format info like formatted/cdl/ldl/... */
49 unsigned int features; /* dasd features like 'ro',... */
50 unsigned int reserved0; /* reserved for further use ,... */
51 unsigned int reserved1; /* reserved for further use ,... */
52 unsigned int reserved2; /* reserved for further use ,... */
53 unsigned int reserved3; /* reserved for further use ,... */
54 unsigned int reserved4; /* reserved for further use ,... */
55 unsigned int reserved5; /* reserved for further use ,... */
56 unsigned int reserved6; /* reserved for further use ,... */
57 unsigned int reserved7; /* reserved for further use ,... */
58 } dasd_information2_t;
61 * values to be used for dasd_information_t.format
63 * 0x01: Linux disc layout
64 * 0x02: Common disc layout
66 #define DASD_FORMAT_NONE 0
67 #define DASD_FORMAT_LDL 1
68 #define DASD_FORMAT_CDL 2
70 * values to be used for dasd_information_t.features
71 * 0x00: default features
73 * 0x02: use diag discipline (diag)
74 * 0x04: set the device initially online (internal use only)
75 * 0x08: enable ERP related logging
77 #define DASD_FEATURE_DEFAULT 0x00
78 #define DASD_FEATURE_READONLY 0x01
79 #define DASD_FEATURE_USEDIAG 0x02
80 #define DASD_FEATURE_INITIAL_ONLINE 0x04
81 #define DASD_FEATURE_ERPLOG 0x08
82 #define DASD_FEATURE_FAILFAST 0x10
84 #define DASD_PARTN_BITS 2
87 * struct dasd_information_t
88 * represents any data about the data, which is visible to userspace
90 typedef struct dasd_information_t {
91 unsigned int devno; /* S/390 devno */
92 unsigned int real_devno; /* for aliases */
93 unsigned int schid; /* S/390 subchannel identifier */
94 unsigned int cu_type : 16; /* from SenseID */
95 unsigned int cu_model : 8; /* from SenseID */
96 unsigned int dev_type : 16; /* from SenseID */
97 unsigned int dev_model : 8; /* from SenseID */
98 unsigned int open_count;
99 unsigned int req_queue_len;
100 unsigned int chanq_len; /* length of chanq */
101 char type[4]; /* from discipline.name, 'none' for unknown */
102 unsigned int status; /* current device level */
103 unsigned int label_block; /* where to find the VOLSER */
104 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
105 unsigned int characteristics_size;
106 unsigned int confdata_size;
107 char characteristics[64]; /* from read_device_characteristics */
108 char configuration_data[256]; /* from read_configuration_data */
109 } dasd_information_t;
112 * Read Subsystem Data - Performance Statistics
114 typedef struct dasd_rssd_perf_stats_t {
115 unsigned char invalid:1;
116 unsigned char format:3;
117 unsigned char data_format:4;
118 unsigned char unit_address;
119 unsigned short device_status;
120 unsigned int nr_read_normal;
121 unsigned int nr_read_normal_hits;
122 unsigned int nr_write_normal;
123 unsigned int nr_write_fast_normal_hits;
124 unsigned int nr_read_seq;
125 unsigned int nr_read_seq_hits;
126 unsigned int nr_write_seq;
127 unsigned int nr_write_fast_seq_hits;
128 unsigned int nr_read_cache;
129 unsigned int nr_read_cache_hits;
130 unsigned int nr_write_cache;
131 unsigned int nr_write_fast_cache_hits;
132 unsigned int nr_inhibit_cache;
133 unsigned int nr_bybass_cache;
134 unsigned int nr_seq_dasd_to_cache;
135 unsigned int nr_dasd_to_cache;
136 unsigned int nr_cache_to_dasd;
137 unsigned int nr_delayed_fast_write;
138 unsigned int nr_normal_fast_write;
139 unsigned int nr_seq_fast_write;
140 unsigned int nr_cache_miss;
141 unsigned char status2;
142 unsigned int nr_quick_write_promotes;
143 unsigned char reserved;
145 unsigned char reseved2[96];
146 } __attribute__((packed)) dasd_rssd_perf_stats_t;
149 * struct profile_info_t
150 * holds the profinling information
152 typedef struct dasd_profile_info_t {
153 unsigned int dasd_io_reqs; /* number of requests processed at all */
154 unsigned int dasd_io_sects; /* number of sectors processed at all */
155 unsigned int dasd_io_secs[32]; /* histogram of request's sizes */
156 unsigned int dasd_io_times[32]; /* histogram of requests's times */
157 unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */
158 unsigned int dasd_io_time1[32]; /* histogram of time from build to start */
159 unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */
160 unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
161 unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */
162 unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
163 } dasd_profile_info_t;
166 * struct format_data_t
167 * represents all data necessary to format a dasd
169 typedef struct format_data_t {
170 unsigned int start_unit; /* from track */
171 unsigned int stop_unit; /* to track */
172 unsigned int blksize; /* sectorsize */
173 unsigned int intensity;
177 * values to be used for format_data_t.intensity
179 * 1/9: also write record zero
180 * 3/11: also write home address
181 * 4/12: invalidate track
183 #define DASD_FMT_INT_FMT_R0 1 /* write record zero */
184 #define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
185 #define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
186 #define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
190 * struct attrib_data_t
191 * represents the operation (cache) bits for the device.
192 * Used in DE to influence caching of the DASD.
194 typedef struct attrib_data_t {
195 unsigned char operation:3; /* cache operation mode */
196 unsigned char reserved:5; /* cache operation mode */
197 __u16 nr_cyl; /* no of cyliners for read ahaed */
198 __u8 reserved2[29]; /* for future use */
199 } __attribute__ ((packed)) attrib_data_t;
201 /* definition of operation (cache) bits within attributes of DE */
202 #define DASD_NORMAL_CACHE 0x0
203 #define DASD_BYPASS_CACHE 0x1
204 #define DASD_INHIBIT_LOAD 0x2
205 #define DASD_SEQ_ACCESS 0x3
206 #define DASD_SEQ_PRESTAGE 0x4
207 #define DASD_REC_ACCESS 0x5
210 * Perform EMC Symmetrix I/O
212 typedef struct dasd_symmio_parms {
213 unsigned char reserved[8]; /* compat with older releases */
214 unsigned long long psf_data; /* char * cast to u64 */
215 unsigned long long rssd_result; /* char * cast to u64 */
218 } __attribute__ ((packed)) dasd_symmio_parms_t;
221 * Data returned by Sense Path Group ID (SNID)
223 struct dasd_snid_data {
229 } __attribute__ ((packed)) path_state;
231 } __attribute__ ((packed));
233 struct dasd_snid_ioctl_data {
234 struct dasd_snid_data data;
236 } __attribute__ ((packed));
239 /********************************************************************************
240 * SECTION: Definition of IOCTLs
242 * Here ist how the ioctl-nr should be used:
243 * 0 - 31 DASD driver itself
244 * 32 - 239 still open
245 * 240 - 255 reserved for EMC
246 *******************************************************************************/
248 /* Disable the volume (for Linux) */
249 #define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
250 /* Enable the volume (for Linux) */
251 #define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
252 /* Issue a reserve/release command, rsp. */
253 #define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */
254 #define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */
255 #define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */
256 /* reset profiling information of a device */
257 #define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)
258 /* Quiesce IO on device */
259 #define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
260 /* Resume IO on device */
261 #define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
264 /* retrieve API version number */
265 #define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
266 /* Get information on a dasd device */
267 #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
268 /* retrieve profiling information of a device */
269 #define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
270 /* Get information on a dasd device (enhanced) */
271 #define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
272 /* Performance Statistics Read */
273 #define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
274 /* Get Attributes (cache operations) */
275 #define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
278 /* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
279 #define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
280 /* Set Attributes (cache operations) */
281 #define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
283 /* Get Sense Path Group ID (SNID) data */
284 #define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)
286 #define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)