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