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