blob: 47fcdada5d259da4501fe836b74ba3982a48ecd8 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Nigel Hislopab1d8482008-10-10 21:33:25 +02006 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
7 * Author.........: Nigel Hislop <hislop_nigel@emc.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 *
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
12 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 */
14
15#ifndef DASD_H
16#define DASD_H
Heiko Carstens0680ba02009-01-09 12:14:52 +010017#include <linux/types.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070018#include <linux/ioctl.h>
19
20#define DASD_IOCTL_LETTER 'D'
21
22#define DASD_API_VERSION 6
23
24/*
25 * struct dasd_information2_t
26 * represents any data about the device, which is visible to userspace.
27 * including foramt and featueres.
28 */
29typedef 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;
59
60/*
61 * values to be used for dasd_information_t.format
62 * 0x00: NOT formatted
63 * 0x01: Linux disc layout
64 * 0x02: Common disc layout
65 */
66#define DASD_FORMAT_NONE 0
67#define DASD_FORMAT_LDL 1
68#define DASD_FORMAT_CDL 2
69/*
70 * values to be used for dasd_information_t.features
71 * 0x00: default features
72 * 0x01: readonly (ro)
73 * 0x02: use diag discipline (diag)
Horst Hummel40545572006-06-29 15:08:18 +020074 * 0x04: set the device initially online (internal use only)
Horst Hummel9575bf22006-12-08 15:54:15 +010075 * 0x08: enable ERP related logging
Linus Torvalds1da177e2005-04-16 15:20:36 -070076 */
Horst Hummel40545572006-06-29 15:08:18 +020077#define DASD_FEATURE_DEFAULT 0x00
78#define DASD_FEATURE_READONLY 0x01
79#define DASD_FEATURE_USEDIAG 0x02
80#define DASD_FEATURE_INITIAL_ONLINE 0x04
Horst Hummel9575bf22006-12-08 15:54:15 +010081#define DASD_FEATURE_ERPLOG 0x08
Holger Smolinski13de2272009-01-09 12:14:51 +010082#define DASD_FEATURE_FAILFAST 0x10
Stefan Weinhuber5a27e602011-01-05 12:48:04 +010083#define DASD_FEATURE_FAILONSLCK 0x20
Linus Torvalds1da177e2005-04-16 15:20:36 -070084
85#define DASD_PARTN_BITS 2
86
87/*
88 * struct dasd_information_t
89 * represents any data about the data, which is visible to userspace
90 */
91typedef struct dasd_information_t {
92 unsigned int devno; /* S/390 devno */
93 unsigned int real_devno; /* for aliases */
94 unsigned int schid; /* S/390 subchannel identifier */
95 unsigned int cu_type : 16; /* from SenseID */
96 unsigned int cu_model : 8; /* from SenseID */
97 unsigned int dev_type : 16; /* from SenseID */
98 unsigned int dev_model : 8; /* from SenseID */
99 unsigned int open_count;
100 unsigned int req_queue_len;
101 unsigned int chanq_len; /* length of chanq */
102 char type[4]; /* from discipline.name, 'none' for unknown */
103 unsigned int status; /* current device level */
104 unsigned int label_block; /* where to find the VOLSER */
105 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
106 unsigned int characteristics_size;
107 unsigned int confdata_size;
108 char characteristics[64]; /* from read_device_characteristics */
109 char configuration_data[256]; /* from read_configuration_data */
110} dasd_information_t;
111
112/*
Joe Perches58002662008-01-26 14:11:19 +0100113 * Read Subsystem Data - Performance Statistics
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 */
115typedef struct dasd_rssd_perf_stats_t {
116 unsigned char invalid:1;
117 unsigned char format:3;
118 unsigned char data_format:4;
119 unsigned char unit_address;
120 unsigned short device_status;
121 unsigned int nr_read_normal;
122 unsigned int nr_read_normal_hits;
123 unsigned int nr_write_normal;
124 unsigned int nr_write_fast_normal_hits;
125 unsigned int nr_read_seq;
126 unsigned int nr_read_seq_hits;
127 unsigned int nr_write_seq;
128 unsigned int nr_write_fast_seq_hits;
129 unsigned int nr_read_cache;
130 unsigned int nr_read_cache_hits;
131 unsigned int nr_write_cache;
132 unsigned int nr_write_fast_cache_hits;
133 unsigned int nr_inhibit_cache;
134 unsigned int nr_bybass_cache;
135 unsigned int nr_seq_dasd_to_cache;
136 unsigned int nr_dasd_to_cache;
137 unsigned int nr_cache_to_dasd;
138 unsigned int nr_delayed_fast_write;
139 unsigned int nr_normal_fast_write;
140 unsigned int nr_seq_fast_write;
141 unsigned int nr_cache_miss;
142 unsigned char status2;
143 unsigned int nr_quick_write_promotes;
144 unsigned char reserved;
145 unsigned short ssid;
146 unsigned char reseved2[96];
147} __attribute__((packed)) dasd_rssd_perf_stats_t;
148
149/*
150 * struct profile_info_t
151 * holds the profinling information
152 */
153typedef struct dasd_profile_info_t {
154 unsigned int dasd_io_reqs; /* number of requests processed at all */
155 unsigned int dasd_io_sects; /* number of sectors processed at all */
156 unsigned int dasd_io_secs[32]; /* histogram of request's sizes */
157 unsigned int dasd_io_times[32]; /* histogram of requests's times */
158 unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */
159 unsigned int dasd_io_time1[32]; /* histogram of time from build to start */
160 unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */
161 unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
162 unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */
163 unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
164} dasd_profile_info_t;
165
Stefan Weinhuberb44b0ab32009-03-26 15:23:47 +0100166/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 * struct format_data_t
168 * represents all data necessary to format a dasd
169 */
170typedef struct format_data_t {
Stefan Weinhuberb44b0ab32009-03-26 15:23:47 +0100171 unsigned int start_unit; /* from track */
172 unsigned int stop_unit; /* to track */
173 unsigned int blksize; /* sectorsize */
174 unsigned int intensity;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175} format_data_t;
176
177/*
178 * values to be used for format_data_t.intensity
179 * 0/8: normal format
180 * 1/9: also write record zero
181 * 3/11: also write home address
182 * 4/12: invalidate track
183 */
184#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
185#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
186#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
187#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
188
189
190/*
191 * struct attrib_data_t
192 * represents the operation (cache) bits for the device.
193 * Used in DE to influence caching of the DASD.
194 */
195typedef struct attrib_data_t {
196 unsigned char operation:3; /* cache operation mode */
197 unsigned char reserved:5; /* cache operation mode */
198 __u16 nr_cyl; /* no of cyliners for read ahaed */
199 __u8 reserved2[29]; /* for future use */
200} __attribute__ ((packed)) attrib_data_t;
201
202/* definition of operation (cache) bits within attributes of DE */
203#define DASD_NORMAL_CACHE 0x0
204#define DASD_BYPASS_CACHE 0x1
205#define DASD_INHIBIT_LOAD 0x2
206#define DASD_SEQ_ACCESS 0x3
207#define DASD_SEQ_PRESTAGE 0x4
208#define DASD_REC_ACCESS 0x5
209
Nigel Hislopab1d8482008-10-10 21:33:25 +0200210/*
211 * Perform EMC Symmetrix I/O
212 */
213typedef struct dasd_symmio_parms {
214 unsigned char reserved[8]; /* compat with older releases */
215 unsigned long long psf_data; /* char * cast to u64 */
216 unsigned long long rssd_result; /* char * cast to u64 */
217 int psf_data_len;
218 int rssd_result_len;
219} __attribute__ ((packed)) dasd_symmio_parms_t;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220
Stefan Weinhuber196339f2010-10-29 16:50:43 +0200221/*
222 * Data returned by Sense Path Group ID (SNID)
223 */
224struct dasd_snid_data {
225 struct {
226 __u8 group:2;
227 __u8 reserve:2;
228 __u8 mode:1;
229 __u8 res:3;
230 } __attribute__ ((packed)) path_state;
231 __u8 pgid[11];
232} __attribute__ ((packed));
233
234struct dasd_snid_ioctl_data {
235 struct dasd_snid_data data;
236 __u8 path_mask;
237} __attribute__ ((packed));
238
239
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240/********************************************************************************
241 * SECTION: Definition of IOCTLs
242 *
243 * Here ist how the ioctl-nr should be used:
244 * 0 - 31 DASD driver itself
Heiko Carstens49d9c812006-02-20 18:28:14 -0800245 * 32 - 239 still open
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246 * 240 - 255 reserved for EMC
247 *******************************************************************************/
248
249/* Disable the volume (for Linux) */
250#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
251/* Enable the volume (for Linux) */
252#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
253/* Issue a reserve/release command, rsp. */
254#define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */
255#define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */
256#define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */
257/* reset profiling information of a device */
258#define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)
259/* Quiesce IO on device */
260#define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
261/* Resume IO on device */
262#define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
263
264
265/* retrieve API version number */
266#define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
267/* Get information on a dasd device */
268#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
269/* retrieve profiling information of a device */
270#define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
271/* Get information on a dasd device (enhanced) */
272#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
273/* Performance Statistics Read */
274#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
275/* Get Attributes (cache operations) */
276#define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
277
278
279/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
280#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
281/* Set Attributes (cache operations) */
282#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283
Stefan Weinhuber196339f2010-10-29 16:50:43 +0200284/* Get Sense Path Group ID (SNID) data */
285#define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)
286
Nigel Hislopab1d8482008-10-10 21:33:25 +0200287#define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700288
289#endif /* DASD_H */
290