[PATCH] s390: dasd device identifiers
[linux-2.6.git] / drivers / s390 / block / dasd_eckd.h
1 /* 
2  * File...........: linux/drivers/s390/block/dasd_eckd.h
3  * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4  *                  Horst Hummel <Horst.Hummel@de.ibm.com> 
5  * Bugreports.to..: <Linux390@de.ibm.com>
6  * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
7  *
8  */
9
10 #ifndef DASD_ECKD_H
11 #define DASD_ECKD_H
12
13 /*****************************************************************************
14  * SECTION: CCW Definitions
15  ****************************************************************************/
16 #define DASD_ECKD_CCW_WRITE              0x05
17 #define DASD_ECKD_CCW_READ               0x06
18 #define DASD_ECKD_CCW_WRITE_HOME_ADDRESS 0x09
19 #define DASD_ECKD_CCW_READ_HOME_ADDRESS  0x0a
20 #define DASD_ECKD_CCW_WRITE_KD           0x0d
21 #define DASD_ECKD_CCW_READ_KD            0x0e
22 #define DASD_ECKD_CCW_ERASE              0x11
23 #define DASD_ECKD_CCW_READ_COUNT         0x12
24 #define DASD_ECKD_CCW_SLCK               0x14
25 #define DASD_ECKD_CCW_WRITE_RECORD_ZERO  0x15
26 #define DASD_ECKD_CCW_READ_RECORD_ZERO   0x16
27 #define DASD_ECKD_CCW_WRITE_CKD          0x1d
28 #define DASD_ECKD_CCW_READ_CKD           0x1e
29 #define DASD_ECKD_CCW_PSF                0x27
30 #define DASD_ECKD_CCW_RSSD               0x3e
31 #define DASD_ECKD_CCW_LOCATE_RECORD      0x47
32 #define DASD_ECKD_CCW_SNSS               0x54
33 #define DASD_ECKD_CCW_DEFINE_EXTENT      0x63
34 #define DASD_ECKD_CCW_WRITE_MT           0x85
35 #define DASD_ECKD_CCW_READ_MT            0x86
36 #define DASD_ECKD_CCW_WRITE_KD_MT        0x8d
37 #define DASD_ECKD_CCW_READ_KD_MT         0x8e
38 #define DASD_ECKD_CCW_RELEASE            0x94
39 #define DASD_ECKD_CCW_READ_CKD_MT        0x9e
40 #define DASD_ECKD_CCW_WRITE_CKD_MT       0x9d
41 #define DASD_ECKD_CCW_RESERVE            0xB4
42
43 /*
44  *Perform Subsystem Function / Sub-Orders
45  */
46 #define PSF_ORDER_PRSSD                  0x18
47
48 /*****************************************************************************
49  * SECTION: Type Definitions
50  ****************************************************************************/
51
52 struct eckd_count {
53         __u16 cyl;
54         __u16 head;
55         __u8 record;
56         __u8 kl;
57         __u16 dl;
58 } __attribute__ ((packed));
59
60 struct ch_t {
61         __u16 cyl;
62         __u16 head;
63 } __attribute__ ((packed));
64
65 struct chs_t {
66         __u16 cyl;
67         __u16 head;
68         __u32 sector;
69 } __attribute__ ((packed));
70
71 struct chr_t {
72         __u16 cyl;
73         __u16 head;
74         __u8 record;
75 } __attribute__ ((packed));
76
77 struct geom_t {
78         __u16 cyl;
79         __u16 head;
80         __u32 sector;
81 } __attribute__ ((packed));
82
83 struct eckd_home {
84         __u8 skip_control[14];
85         __u16 cell_number;
86         __u8 physical_addr[3];
87         __u8 flag;
88         struct ch_t track_addr;
89         __u8 reserved;
90         __u8 key_length;
91         __u8 reserved2[2];
92 } __attribute__ ((packed));
93
94 struct DE_eckd_data {
95         struct {
96                 unsigned char perm:2;   /* Permissions on this extent */
97                 unsigned char reserved:1;
98                 unsigned char seek:2;   /* Seek control */
99                 unsigned char auth:2;   /* Access authorization */
100                 unsigned char pci:1;    /* PCI Fetch mode */
101         } __attribute__ ((packed)) mask;
102         struct {
103                 unsigned char mode:2;   /* Architecture mode */
104                 unsigned char ckd:1;    /* CKD Conversion */
105                 unsigned char operation:3;      /* Operation mode */
106                 unsigned char cfw:1;    /* Cache fast write */
107                 unsigned char dfw:1;    /* DASD fast write */
108         } __attribute__ ((packed)) attributes;
109         __u16 blk_size;         /* Blocksize */
110         __u16 fast_write_id;
111         __u8 ga_additional;     /* Global Attributes Additional */
112         __u8 ga_extended;       /* Global Attributes Extended   */
113         struct ch_t beg_ext;
114         struct ch_t end_ext;
115         unsigned long long ep_sys_time; /* Ext Parameter - System Time Stamp */
116         __u8 ep_format;        /* Extended Parameter format byte       */
117         __u8 ep_prio;          /* Extended Parameter priority I/O byte */
118         __u8 ep_reserved[6];   /* Extended Parameter Reserved          */
119 } __attribute__ ((packed));
120
121 struct LO_eckd_data {
122         struct {
123                 unsigned char orientation:2;
124                 unsigned char operation:6;
125         } __attribute__ ((packed)) operation;
126         struct {
127                 unsigned char last_bytes_used:1;
128                 unsigned char reserved:6;
129                 unsigned char read_count_suffix:1;
130         } __attribute__ ((packed)) auxiliary;
131         __u8 unused;
132         __u8 count;
133         struct ch_t seek_addr;
134         struct chr_t search_arg;
135         __u8 sector;
136         __u16 length;
137 } __attribute__ ((packed));
138
139 struct dasd_eckd_characteristics {
140         __u16 cu_type;
141         struct {
142                 unsigned char support:2;
143                 unsigned char async:1;
144                 unsigned char reserved:1;
145                 unsigned char cache_info:1;
146                 unsigned char model:3;
147         } __attribute__ ((packed)) cu_model;
148         __u16 dev_type;
149         __u8 dev_model;
150         struct {
151                 unsigned char mult_burst:1;
152                 unsigned char RT_in_LR:1;
153                 unsigned char reserved1:1;
154                 unsigned char RD_IN_LR:1;
155                 unsigned char reserved2:4;
156                 unsigned char reserved3:8;
157                 unsigned char defect_wr:1;
158                 unsigned char XRC_supported:1; 
159                 unsigned char reserved4:1;
160                 unsigned char striping:1;
161                 unsigned char reserved5:4;
162                 unsigned char cfw:1;
163                 unsigned char reserved6:2;
164                 unsigned char cache:1;
165                 unsigned char dual_copy:1;
166                 unsigned char dfw:1;
167                 unsigned char reset_alleg:1;
168                 unsigned char sense_down:1;
169         } __attribute__ ((packed)) facilities;
170         __u8 dev_class;
171         __u8 unit_type;
172         __u16 no_cyl;
173         __u16 trk_per_cyl;
174         __u8 sec_per_trk;
175         __u8 byte_per_track[3];
176         __u16 home_bytes;
177         __u8 formula;
178         union {
179                 struct {
180                         __u8 f1;
181                         __u16 f2;
182                         __u16 f3;
183                 } __attribute__ ((packed)) f_0x01;
184                 struct {
185                         __u8 f1;
186                         __u8 f2;
187                         __u8 f3;
188                         __u8 f4;
189                         __u8 f5;
190                 } __attribute__ ((packed)) f_0x02;
191         } __attribute__ ((packed)) factors;
192         __u16 first_alt_trk;
193         __u16 no_alt_trk;
194         __u16 first_dia_trk;
195         __u16 no_dia_trk;
196         __u16 first_sup_trk;
197         __u16 no_sup_trk;
198         __u8 MDR_ID;
199         __u8 OBR_ID;
200         __u8 director;
201         __u8 rd_trk_set;
202         __u16 max_rec_zero;
203         __u8 reserved1;
204         __u8 RWANY_in_LR;
205         __u8 factor6;
206         __u8 factor7;
207         __u8 factor8;
208         __u8 reserved2[3];
209         __u8 reserved3[10];
210 } __attribute__ ((packed));
211
212 struct dasd_eckd_confdata {
213         struct {
214                 struct {
215                         unsigned char identifier:2;
216                         unsigned char token_id:1;
217                         unsigned char sno_valid:1;
218                         unsigned char subst_sno:1;
219                         unsigned char recNED:1;
220                         unsigned char emuNED:1;
221                         unsigned char reserved:1;
222                 } __attribute__ ((packed)) flags;
223                 __u8 descriptor;
224                 __u8 dev_class;
225                 __u8 reserved;
226                 unsigned char dev_type[6];
227                 unsigned char dev_model[3];
228                 unsigned char HDA_manufacturer[3];
229                 unsigned char HDA_location[2];
230                 unsigned char HDA_seqno[12];
231                 __u8 ID;
232                 __u8 unit_addr;
233         } __attribute__ ((packed)) ned1;
234         union {
235                 struct {
236                         struct {
237                                 unsigned char identifier:2;
238                                 unsigned char token_id:1;
239                                 unsigned char sno_valid:1;
240                                 unsigned char subst_sno:1;
241                                 unsigned char recNED:1;
242                                 unsigned char emuNED:1;
243                                 unsigned char reserved:1;
244                         } __attribute__ ((packed)) flags;
245                         __u8 descriptor;
246                         __u8 reserved[2];
247                         unsigned char dev_type[6];
248                         unsigned char dev_model[3];
249                         unsigned char DASD_manufacturer[3];
250                         unsigned char DASD_location[2];
251                         unsigned char DASD_seqno[12];
252                         __u16 ID;
253                 } __attribute__ ((packed)) ned;
254                 struct {
255                         unsigned char flags;            /* byte  0    */
256                         unsigned char res2[7];          /* byte  1- 7 */
257                         unsigned char sua_flags;        /* byte  8    */
258                         __u8 base_unit_addr;            /* byte  9    */
259                         unsigned char res3[22];         /* byte 10-31 */
260                 } __attribute__ ((packed)) sneq;
261         } __attribute__ ((packed)) ned2;
262         struct {
263                 struct {
264                         unsigned char identifier:2;
265                         unsigned char token_id:1;
266                         unsigned char sno_valid:1;
267                         unsigned char subst_sno:1;
268                         unsigned char recNED:1;
269                         unsigned char emuNED:1;
270                         unsigned char reserved:1;
271                 } __attribute__ ((packed)) flags;
272                 __u8 descriptor;
273                 __u8 reserved[2];
274                 unsigned char cont_type[6];
275                 unsigned char cont_model[3];
276                 unsigned char cont_manufacturer[3];
277                 unsigned char cont_location[2];
278                 unsigned char cont_seqno[12];
279                 __u16 ID;
280         } __attribute__ ((packed)) ned3;
281         struct {
282                 struct {
283                         unsigned char identifier:2;
284                         unsigned char token_id:1;
285                         unsigned char sno_valid:1;
286                         unsigned char subst_sno:1;
287                         unsigned char recNED:1;
288                         unsigned char emuNED:1;
289                         unsigned char reserved:1;
290                 } __attribute__ ((packed)) flags;
291                 __u8 descriptor;
292                 __u8 reserved[2];
293                 unsigned char cont_type[6];
294                 unsigned char empty[3];
295                 unsigned char cont_manufacturer[3];
296                 unsigned char cont_location[2];
297                 unsigned char cont_seqno[12];
298                 __u16 ID;
299         } __attribute__ ((packed)) ned4;
300         unsigned char ned5[32];
301         unsigned char ned6[32];
302         unsigned char ned7[32];
303         struct {
304                 struct {
305                         unsigned char identifier:2;
306                         unsigned char reserved:6;
307                 } __attribute__ ((packed)) flags;
308                 __u8 selector;
309                 __u16 interfaceID;
310                 __u32 reserved;
311                 __u16 subsystemID;
312                 struct {
313                         unsigned char sp0:1;
314                         unsigned char sp1:1;
315                         unsigned char reserved:5;
316                         unsigned char scluster:1;
317                 } __attribute__ ((packed)) spathID;
318                 __u8 unit_address;
319                 __u8 dev_ID;
320                 __u8 dev_address;
321                 __u8 adapterID;
322                 __u16 link_address;
323                 struct {
324                         unsigned char parallel:1;
325                         unsigned char escon:1;
326                         unsigned char reserved:1;
327                         unsigned char ficon:1;
328                         unsigned char reserved2:4;
329                 } __attribute__ ((packed)) protocol_type;
330                 struct {
331                         unsigned char PID_in_236:1;
332                         unsigned char reserved:7;
333                 } __attribute__ ((packed)) format_flags;
334                 __u8 log_dev_address;
335                 unsigned char reserved2[12];
336         } __attribute__ ((packed)) neq;
337 } __attribute__ ((packed));
338
339 struct dasd_eckd_path {
340         __u8 opm;
341         __u8 ppm;
342         __u8 npm;
343 };
344
345 /*
346  * Perform Subsystem Function - Prepare for Read Subsystem Data  
347  */
348 struct dasd_psf_prssd_data {
349         unsigned char order;
350         unsigned char flags;
351         unsigned char reserved[4];
352         unsigned char suborder;
353         unsigned char varies[9];
354 } __attribute__ ((packed));
355
356 #endif                          /* DASD_ECKD_H */