blob: 77b10d6adabde1d2507fd629ed6499c9dacd22af [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
6 *
7 * This file is the interface of the DASD device driver, which is exported to user space
8 * any future changes wrt the API will result in a change of the APIVERSION reported
9 * to userspace by the DASDAPIVER-ioctl
10 *
11 * $Revision: 1.6 $
12 *
13 */
14
15#ifndef DASD_H
16#define DASD_H
17#include <linux/ioctl.h>
18
19#define DASD_IOCTL_LETTER 'D'
20
21#define DASD_API_VERSION 6
22
23/*
24 * struct dasd_information2_t
25 * represents any data about the device, which is visible to userspace.
26 * including foramt and featueres.
27 */
28typedef struct dasd_information2_t {
29 unsigned int devno; /* S/390 devno */
30 unsigned int real_devno; /* for aliases */
31 unsigned int schid; /* S/390 subchannel identifier */
32 unsigned int cu_type : 16; /* from SenseID */
33 unsigned int cu_model : 8; /* from SenseID */
34 unsigned int dev_type : 16; /* from SenseID */
35 unsigned int dev_model : 8; /* from SenseID */
36 unsigned int open_count;
37 unsigned int req_queue_len;
38 unsigned int chanq_len; /* length of chanq */
39 char type[4]; /* from discipline.name, 'none' for unknown */
40 unsigned int status; /* current device level */
41 unsigned int label_block; /* where to find the VOLSER */
42 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
43 unsigned int characteristics_size;
44 unsigned int confdata_size;
45 char characteristics[64]; /* from read_device_characteristics */
46 char configuration_data[256]; /* from read_configuration_data */
47 unsigned int format; /* format info like formatted/cdl/ldl/... */
48 unsigned int features; /* dasd features like 'ro',... */
49 unsigned int reserved0; /* reserved for further use ,... */
50 unsigned int reserved1; /* reserved for further use ,... */
51 unsigned int reserved2; /* reserved for further use ,... */
52 unsigned int reserved3; /* reserved for further use ,... */
53 unsigned int reserved4; /* reserved for further use ,... */
54 unsigned int reserved5; /* reserved for further use ,... */
55 unsigned int reserved6; /* reserved for further use ,... */
56 unsigned int reserved7; /* reserved for further use ,... */
57} dasd_information2_t;
58
59/*
60 * values to be used for dasd_information_t.format
61 * 0x00: NOT formatted
62 * 0x01: Linux disc layout
63 * 0x02: Common disc layout
64 */
65#define DASD_FORMAT_NONE 0
66#define DASD_FORMAT_LDL 1
67#define DASD_FORMAT_CDL 2
68/*
69 * values to be used for dasd_information_t.features
70 * 0x00: default features
71 * 0x01: readonly (ro)
72 * 0x02: use diag discipline (diag)
73 */
74#define DASD_FEATURE_DEFAULT 0
75#define DASD_FEATURE_READONLY 1
76#define DASD_FEATURE_USEDIAG 2
77
78#define DASD_PARTN_BITS 2
79
80/*
81 * struct dasd_information_t
82 * represents any data about the data, which is visible to userspace
83 */
84typedef struct dasd_information_t {
85 unsigned int devno; /* S/390 devno */
86 unsigned int real_devno; /* for aliases */
87 unsigned int schid; /* S/390 subchannel identifier */
88 unsigned int cu_type : 16; /* from SenseID */
89 unsigned int cu_model : 8; /* from SenseID */
90 unsigned int dev_type : 16; /* from SenseID */
91 unsigned int dev_model : 8; /* from SenseID */
92 unsigned int open_count;
93 unsigned int req_queue_len;
94 unsigned int chanq_len; /* length of chanq */
95 char type[4]; /* from discipline.name, 'none' for unknown */
96 unsigned int status; /* current device level */
97 unsigned int label_block; /* where to find the VOLSER */
98 unsigned int FBA_layout; /* fixed block size (like AIXVOL) */
99 unsigned int characteristics_size;
100 unsigned int confdata_size;
101 char characteristics[64]; /* from read_device_characteristics */
102 char configuration_data[256]; /* from read_configuration_data */
103} dasd_information_t;
104
105/*
106 * Read Subsystem Data - Perfomance Statistics
107 */
108typedef struct dasd_rssd_perf_stats_t {
109 unsigned char invalid:1;
110 unsigned char format:3;
111 unsigned char data_format:4;
112 unsigned char unit_address;
113 unsigned short device_status;
114 unsigned int nr_read_normal;
115 unsigned int nr_read_normal_hits;
116 unsigned int nr_write_normal;
117 unsigned int nr_write_fast_normal_hits;
118 unsigned int nr_read_seq;
119 unsigned int nr_read_seq_hits;
120 unsigned int nr_write_seq;
121 unsigned int nr_write_fast_seq_hits;
122 unsigned int nr_read_cache;
123 unsigned int nr_read_cache_hits;
124 unsigned int nr_write_cache;
125 unsigned int nr_write_fast_cache_hits;
126 unsigned int nr_inhibit_cache;
127 unsigned int nr_bybass_cache;
128 unsigned int nr_seq_dasd_to_cache;
129 unsigned int nr_dasd_to_cache;
130 unsigned int nr_cache_to_dasd;
131 unsigned int nr_delayed_fast_write;
132 unsigned int nr_normal_fast_write;
133 unsigned int nr_seq_fast_write;
134 unsigned int nr_cache_miss;
135 unsigned char status2;
136 unsigned int nr_quick_write_promotes;
137 unsigned char reserved;
138 unsigned short ssid;
139 unsigned char reseved2[96];
140} __attribute__((packed)) dasd_rssd_perf_stats_t;
141
142/*
143 * struct profile_info_t
144 * holds the profinling information
145 */
146typedef struct dasd_profile_info_t {
147 unsigned int dasd_io_reqs; /* number of requests processed at all */
148 unsigned int dasd_io_sects; /* number of sectors processed at all */
149 unsigned int dasd_io_secs[32]; /* histogram of request's sizes */
150 unsigned int dasd_io_times[32]; /* histogram of requests's times */
151 unsigned int dasd_io_timps[32]; /* histogram of requests's times per sector */
152 unsigned int dasd_io_time1[32]; /* histogram of time from build to start */
153 unsigned int dasd_io_time2[32]; /* histogram of time from start to irq */
154 unsigned int dasd_io_time2ps[32]; /* histogram of time from start to irq */
155 unsigned int dasd_io_time3[32]; /* histogram of time from irq to end */
156 unsigned int dasd_io_nr_req[32]; /* histogram of # of requests in chanq */
157} dasd_profile_info_t;
158
159/*
160 * struct format_data_t
161 * represents all data necessary to format a dasd
162 */
163typedef struct format_data_t {
164 int start_unit; /* from track */
165 int stop_unit; /* to track */
166 int blksize; /* sectorsize */
167 int intensity;
168} format_data_t;
169
170/*
171 * values to be used for format_data_t.intensity
172 * 0/8: normal format
173 * 1/9: also write record zero
174 * 3/11: also write home address
175 * 4/12: invalidate track
176 */
177#define DASD_FMT_INT_FMT_R0 1 /* write record zero */
178#define DASD_FMT_INT_FMT_HA 2 /* write home address, also set FMT_R0 ! */
179#define DASD_FMT_INT_INVAL 4 /* invalidate tracks */
180#define DASD_FMT_INT_COMPAT 8 /* use OS/390 compatible disk layout */
181
182
183/*
184 * struct attrib_data_t
185 * represents the operation (cache) bits for the device.
186 * Used in DE to influence caching of the DASD.
187 */
188typedef struct attrib_data_t {
189 unsigned char operation:3; /* cache operation mode */
190 unsigned char reserved:5; /* cache operation mode */
191 __u16 nr_cyl; /* no of cyliners for read ahaed */
192 __u8 reserved2[29]; /* for future use */
193} __attribute__ ((packed)) attrib_data_t;
194
195/* definition of operation (cache) bits within attributes of DE */
196#define DASD_NORMAL_CACHE 0x0
197#define DASD_BYPASS_CACHE 0x1
198#define DASD_INHIBIT_LOAD 0x2
199#define DASD_SEQ_ACCESS 0x3
200#define DASD_SEQ_PRESTAGE 0x4
201#define DASD_REC_ACCESS 0x5
202
203
204/********************************************************************************
205 * SECTION: Definition of IOCTLs
206 *
207 * Here ist how the ioctl-nr should be used:
208 * 0 - 31 DASD driver itself
209 * 32 - 239 still open
210 * 240 - 255 reserved for EMC
211 *******************************************************************************/
212
213/* Disable the volume (for Linux) */
214#define BIODASDDISABLE _IO(DASD_IOCTL_LETTER,0)
215/* Enable the volume (for Linux) */
216#define BIODASDENABLE _IO(DASD_IOCTL_LETTER,1)
217/* Issue a reserve/release command, rsp. */
218#define BIODASDRSRV _IO(DASD_IOCTL_LETTER,2) /* reserve */
219#define BIODASDRLSE _IO(DASD_IOCTL_LETTER,3) /* release */
220#define BIODASDSLCK _IO(DASD_IOCTL_LETTER,4) /* steal lock */
221/* reset profiling information of a device */
222#define BIODASDPRRST _IO(DASD_IOCTL_LETTER,5)
223/* Quiesce IO on device */
224#define BIODASDQUIESCE _IO(DASD_IOCTL_LETTER,6)
225/* Resume IO on device */
226#define BIODASDRESUME _IO(DASD_IOCTL_LETTER,7)
227
228
229/* retrieve API version number */
230#define DASDAPIVER _IOR(DASD_IOCTL_LETTER,0,int)
231/* Get information on a dasd device */
232#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t)
233/* retrieve profiling information of a device */
234#define BIODASDPRRD _IOR(DASD_IOCTL_LETTER,2,dasd_profile_info_t)
235/* Get information on a dasd device (enhanced) */
236#define BIODASDINFO2 _IOR(DASD_IOCTL_LETTER,3,dasd_information2_t)
237/* Performance Statistics Read */
238#define BIODASDPSRD _IOR(DASD_IOCTL_LETTER,4,dasd_rssd_perf_stats_t)
239/* Get Attributes (cache operations) */
240#define BIODASDGATTR _IOR(DASD_IOCTL_LETTER,5,attrib_data_t)
241
242
243/* #define BIODASDFORMAT _IOW(IOCTL_LETTER,0,format_data_t) , deprecated */
244#define BIODASDFMT _IOW(DASD_IOCTL_LETTER,1,format_data_t)
245/* Set Attributes (cache operations) */
246#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
247
248
249#endif /* DASD_H */
250
251/*
252 * Overrides for Emacs so that we follow Linus's tabbing style.
253 * Emacs will notice this stuff at the end of the file and automatically
254 * adjust the settings for this buffer only. This must remain at the end
255 * of the file.
256 * ---------------------------------------------------------------------------
257 * Local variables:
258 * c-indent-level: 4
259 * c-brace-imaginary-offset: 0
260 * c-brace-offset: -4
261 * c-argdecl-indent: 4
262 * c-label-offset: -4
263 * c-continued-statement-offset: 4
264 * c-continued-brace-offset: 0
265 * indent-tabs-mode: nil
266 * tab-width: 8
267 * End:
268 */