2 * File...........: linux/drivers/s390/block/dasd_eckd.c
3 * Author(s)......: Holger Smolinski <Holger.Smolinski@de.ibm.com>
4 * Horst Hummel <Horst.Hummel@de.ibm.com>
5 * Carsten Otte <Cotte@de.ibm.com>
6 * Martin Schwidefsky <schwidefsky@de.ibm.com>
7 * Bugreports.to..: <Linux390@de.ibm.com>
8 * Copyright IBM Corp. 1999, 2009
9 * EMC Symmetrix ioctl Copyright EMC Corporation, 2008
10 * Author.........: Nigel Hislop <hislop_nigel@emc.com>
13 #define KMSG_COMPONENT "dasd-eckd"
15 #include <linux/stddef.h>
16 #include <linux/kernel.h>
17 #include <linux/slab.h>
18 #include <linux/hdreg.h> /* HDIO_GETGEO */
19 #include <linux/bio.h>
20 #include <linux/module.h>
21 #include <linux/init.h>
23 #include <asm/debug.h>
24 #include <asm/idals.h>
25 #include <asm/ebcdic.h>
27 #include <asm/todclk.h>
28 #include <asm/uaccess.h>
30 #include <asm/ccwdev.h>
34 #include "dasd_eckd.h"
35 #include "../cio/chsc.h"
40 #endif /* PRINTK_HEADER */
41 #define PRINTK_HEADER "dasd(eckd):"
43 #define ECKD_C0(i) (i->home_bytes)
44 #define ECKD_F(i) (i->formula)
45 #define ECKD_F1(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f1):\
46 (i->factors.f_0x02.f1))
47 #define ECKD_F2(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f2):\
48 (i->factors.f_0x02.f2))
49 #define ECKD_F3(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f3):\
50 (i->factors.f_0x02.f3))
51 #define ECKD_F4(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f4):0)
52 #define ECKD_F5(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f5):0)
53 #define ECKD_F6(i) (i->factor6)
54 #define ECKD_F7(i) (i->factor7)
55 #define ECKD_F8(i) (i->factor8)
57 MODULE_LICENSE("GPL");
59 static struct dasd_discipline dasd_eckd_discipline
;
61 /* The ccw bus type uses this table to find devices that it sends to
63 static struct ccw_device_id dasd_eckd_ids
[] = {
64 { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), .driver_info
= 0x1},
65 { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), .driver_info
= 0x2},
66 { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3390, 0), .driver_info
= 0x3},
67 { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), .driver_info
= 0x4},
68 { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), .driver_info
= 0x5},
69 { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), .driver_info
= 0x6},
70 { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3390, 0), .driver_info
= 0x7},
71 { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3380, 0), .driver_info
= 0x8},
72 { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3390, 0), .driver_info
= 0x9},
73 { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3380, 0), .driver_info
= 0xa},
74 { /* end of list */ },
77 MODULE_DEVICE_TABLE(ccw
, dasd_eckd_ids
);
79 static struct ccw_driver dasd_eckd_driver
; /* see below */
81 /* initial attempt at a probe function. this can be simplified once
82 * the other detection code is gone */
84 dasd_eckd_probe (struct ccw_device
*cdev
)
88 /* set ECKD specific ccw-device options */
89 ret
= ccw_device_set_options(cdev
, CCWDEV_ALLOW_FORCE
);
91 DBF_EVENT(DBF_WARNING
,
92 "dasd_eckd_probe: could not set ccw-device options "
93 "for %s\n", dev_name(&cdev
->dev
));
96 ret
= dasd_generic_probe(cdev
, &dasd_eckd_discipline
);
101 dasd_eckd_set_online(struct ccw_device
*cdev
)
103 return dasd_generic_set_online(cdev
, &dasd_eckd_discipline
);
106 static const int sizes_trk0
[] = { 28, 148, 84 };
107 #define LABEL_SIZE 140
109 static inline unsigned int
110 round_up_multiple(unsigned int no
, unsigned int mult
)
113 return (rem
? no
- rem
+ mult
: no
);
116 static inline unsigned int
117 ceil_quot(unsigned int d1
, unsigned int d2
)
119 return (d1
+ (d2
- 1)) / d2
;
123 recs_per_track(struct dasd_eckd_characteristics
* rdc
,
124 unsigned int kl
, unsigned int dl
)
128 switch (rdc
->dev_type
) {
131 return 1499 / (15 + 7 + ceil_quot(kl
+ 12, 32) +
132 ceil_quot(dl
+ 12, 32));
134 return 1499 / (15 + ceil_quot(dl
+ 12, 32));
136 dn
= ceil_quot(dl
+ 6, 232) + 1;
138 kn
= ceil_quot(kl
+ 6, 232) + 1;
139 return 1729 / (10 + 9 + ceil_quot(kl
+ 6 * kn
, 34) +
140 9 + ceil_quot(dl
+ 6 * dn
, 34));
142 return 1729 / (10 + 9 + ceil_quot(dl
+ 6 * dn
, 34));
144 dn
= ceil_quot(dl
+ 6, 232) + 1;
146 kn
= ceil_quot(kl
+ 6, 232) + 1;
147 return 1420 / (18 + 7 + ceil_quot(kl
+ 6 * kn
, 34) +
148 ceil_quot(dl
+ 6 * dn
, 34));
150 return 1420 / (18 + 7 + ceil_quot(dl
+ 6 * dn
, 34));
155 static void set_ch_t(struct ch_t
*geo
, __u32 cyl
, __u8 head
)
157 geo
->cyl
= (__u16
) cyl
;
158 geo
->head
= cyl
>> 16;
164 check_XRC (struct ccw1
*de_ccw
,
165 struct DE_eckd_data
*data
,
166 struct dasd_device
*device
)
168 struct dasd_eckd_private
*private;
171 private = (struct dasd_eckd_private
*) device
->private;
172 if (!private->rdc_data
.facilities
.XRC_supported
)
175 /* switch on System Time Stamp - needed for XRC Support */
176 data
->ga_extended
|= 0x08; /* switch on 'Time Stamp Valid' */
177 data
->ga_extended
|= 0x02; /* switch on 'Extended Parameter' */
179 rc
= get_sync_clock(&data
->ep_sys_time
);
180 /* Ignore return code if sync clock is switched off. */
181 if (rc
== -ENOSYS
|| rc
== -EACCES
)
184 de_ccw
->count
= sizeof(struct DE_eckd_data
);
185 de_ccw
->flags
|= CCW_FLAG_SLI
;
190 define_extent(struct ccw1
*ccw
, struct DE_eckd_data
*data
, unsigned int trk
,
191 unsigned int totrk
, int cmd
, struct dasd_device
*device
)
193 struct dasd_eckd_private
*private;
195 u16 heads
, beghead
, endhead
;
198 private = (struct dasd_eckd_private
*) device
->private;
200 ccw
->cmd_code
= DASD_ECKD_CCW_DEFINE_EXTENT
;
203 ccw
->cda
= (__u32
) __pa(data
);
205 memset(data
, 0, sizeof(struct DE_eckd_data
));
207 case DASD_ECKD_CCW_READ_HOME_ADDRESS
:
208 case DASD_ECKD_CCW_READ_RECORD_ZERO
:
209 case DASD_ECKD_CCW_READ
:
210 case DASD_ECKD_CCW_READ_MT
:
211 case DASD_ECKD_CCW_READ_CKD
:
212 case DASD_ECKD_CCW_READ_CKD_MT
:
213 case DASD_ECKD_CCW_READ_KD
:
214 case DASD_ECKD_CCW_READ_KD_MT
:
215 case DASD_ECKD_CCW_READ_COUNT
:
216 data
->mask
.perm
= 0x1;
217 data
->attributes
.operation
= private->attrib
.operation
;
219 case DASD_ECKD_CCW_WRITE
:
220 case DASD_ECKD_CCW_WRITE_MT
:
221 case DASD_ECKD_CCW_WRITE_KD
:
222 case DASD_ECKD_CCW_WRITE_KD_MT
:
223 data
->mask
.perm
= 0x02;
224 data
->attributes
.operation
= private->attrib
.operation
;
225 rc
= check_XRC (ccw
, data
, device
);
227 case DASD_ECKD_CCW_WRITE_CKD
:
228 case DASD_ECKD_CCW_WRITE_CKD_MT
:
229 data
->attributes
.operation
= DASD_BYPASS_CACHE
;
230 rc
= check_XRC (ccw
, data
, device
);
232 case DASD_ECKD_CCW_ERASE
:
233 case DASD_ECKD_CCW_WRITE_HOME_ADDRESS
:
234 case DASD_ECKD_CCW_WRITE_RECORD_ZERO
:
235 data
->mask
.perm
= 0x3;
236 data
->mask
.auth
= 0x1;
237 data
->attributes
.operation
= DASD_BYPASS_CACHE
;
238 rc
= check_XRC (ccw
, data
, device
);
241 dev_err(&device
->cdev
->dev
,
242 "0x%x is not a known command\n", cmd
);
246 data
->attributes
.mode
= 0x3; /* ECKD */
248 if ((private->rdc_data
.cu_type
== 0x2105 ||
249 private->rdc_data
.cu_type
== 0x2107 ||
250 private->rdc_data
.cu_type
== 0x1750)
251 && !(private->uses_cdl
&& trk
< 2))
252 data
->ga_extended
|= 0x40; /* Regular Data Format Mode */
254 heads
= private->rdc_data
.trk_per_cyl
;
255 begcyl
= trk
/ heads
;
256 beghead
= trk
% heads
;
257 endcyl
= totrk
/ heads
;
258 endhead
= totrk
% heads
;
260 /* check for sequential prestage - enhance cylinder range */
261 if (data
->attributes
.operation
== DASD_SEQ_PRESTAGE
||
262 data
->attributes
.operation
== DASD_SEQ_ACCESS
) {
264 if (endcyl
+ private->attrib
.nr_cyl
< private->real_cyl
)
265 endcyl
+= private->attrib
.nr_cyl
;
267 endcyl
= (private->real_cyl
- 1);
270 set_ch_t(&data
->beg_ext
, begcyl
, beghead
);
271 set_ch_t(&data
->end_ext
, endcyl
, endhead
);
275 static int check_XRC_on_prefix(struct PFX_eckd_data
*pfxdata
,
276 struct dasd_device
*device
)
278 struct dasd_eckd_private
*private;
281 private = (struct dasd_eckd_private
*) device
->private;
282 if (!private->rdc_data
.facilities
.XRC_supported
)
285 /* switch on System Time Stamp - needed for XRC Support */
286 pfxdata
->define_extent
.ga_extended
|= 0x08; /* 'Time Stamp Valid' */
287 pfxdata
->define_extent
.ga_extended
|= 0x02; /* 'Extended Parameter' */
288 pfxdata
->validity
.time_stamp
= 1; /* 'Time Stamp Valid' */
290 rc
= get_sync_clock(&pfxdata
->define_extent
.ep_sys_time
);
291 /* Ignore return code if sync clock is switched off. */
292 if (rc
== -ENOSYS
|| rc
== -EACCES
)
297 static void fill_LRE_data(struct LRE_eckd_data
*data
, unsigned int trk
,
298 unsigned int rec_on_trk
, int count
, int cmd
,
299 struct dasd_device
*device
, unsigned int reclen
,
302 struct dasd_eckd_private
*private;
306 private = (struct dasd_eckd_private
*) device
->private;
308 memset(data
, 0, sizeof(*data
));
311 switch (private->rdc_data
.dev_type
) {
313 dn
= ceil_quot(reclen
+ 6, 232);
314 d
= 9 + ceil_quot(reclen
+ 6 * (dn
+ 1), 34);
315 sector
= (49 + (rec_on_trk
- 1) * (10 + d
)) / 8;
318 d
= 7 + ceil_quot(reclen
+ 12, 32);
319 sector
= (39 + (rec_on_trk
- 1) * (8 + d
)) / 7;
323 data
->sector
= sector
;
324 /* note: meaning of count depends on the operation
325 * for record based I/O it's the number of records, but for
326 * track based I/O it's the number of tracks
330 case DASD_ECKD_CCW_WRITE_HOME_ADDRESS
:
331 data
->operation
.orientation
= 0x3;
332 data
->operation
.operation
= 0x03;
334 case DASD_ECKD_CCW_READ_HOME_ADDRESS
:
335 data
->operation
.orientation
= 0x3;
336 data
->operation
.operation
= 0x16;
338 case DASD_ECKD_CCW_WRITE_RECORD_ZERO
:
339 data
->operation
.orientation
= 0x1;
340 data
->operation
.operation
= 0x03;
343 case DASD_ECKD_CCW_READ_RECORD_ZERO
:
344 data
->operation
.orientation
= 0x3;
345 data
->operation
.operation
= 0x16;
348 case DASD_ECKD_CCW_WRITE
:
349 case DASD_ECKD_CCW_WRITE_MT
:
350 case DASD_ECKD_CCW_WRITE_KD
:
351 case DASD_ECKD_CCW_WRITE_KD_MT
:
352 data
->auxiliary
.length_valid
= 0x1;
353 data
->length
= reclen
;
354 data
->operation
.operation
= 0x01;
356 case DASD_ECKD_CCW_WRITE_CKD
:
357 case DASD_ECKD_CCW_WRITE_CKD_MT
:
358 data
->auxiliary
.length_valid
= 0x1;
359 data
->length
= reclen
;
360 data
->operation
.operation
= 0x03;
362 case DASD_ECKD_CCW_WRITE_TRACK_DATA
:
363 data
->auxiliary
.length_valid
= 0x1;
364 data
->length
= reclen
; /* not tlf, as one might think */
365 data
->operation
.operation
= 0x3F;
366 data
->extended_operation
= 0x23;
368 case DASD_ECKD_CCW_READ
:
369 case DASD_ECKD_CCW_READ_MT
:
370 case DASD_ECKD_CCW_READ_KD
:
371 case DASD_ECKD_CCW_READ_KD_MT
:
372 data
->auxiliary
.length_valid
= 0x1;
373 data
->length
= reclen
;
374 data
->operation
.operation
= 0x06;
376 case DASD_ECKD_CCW_READ_CKD
:
377 case DASD_ECKD_CCW_READ_CKD_MT
:
378 data
->auxiliary
.length_valid
= 0x1;
379 data
->length
= reclen
;
380 data
->operation
.operation
= 0x16;
382 case DASD_ECKD_CCW_READ_COUNT
:
383 data
->operation
.operation
= 0x06;
385 case DASD_ECKD_CCW_READ_TRACK_DATA
:
386 data
->auxiliary
.length_valid
= 0x1;
388 data
->operation
.operation
= 0x0C;
390 case DASD_ECKD_CCW_ERASE
:
391 data
->length
= reclen
;
392 data
->auxiliary
.length_valid
= 0x1;
393 data
->operation
.operation
= 0x0b;
396 DBF_DEV_EVENT(DBF_ERR
, device
,
397 "fill LRE unknown opcode 0x%x", cmd
);
400 set_ch_t(&data
->seek_addr
,
401 trk
/ private->rdc_data
.trk_per_cyl
,
402 trk
% private->rdc_data
.trk_per_cyl
);
403 data
->search_arg
.cyl
= data
->seek_addr
.cyl
;
404 data
->search_arg
.head
= data
->seek_addr
.head
;
405 data
->search_arg
.record
= rec_on_trk
;
408 static int prefix_LRE(struct ccw1
*ccw
, struct PFX_eckd_data
*pfxdata
,
409 unsigned int trk
, unsigned int totrk
, int cmd
,
410 struct dasd_device
*basedev
, struct dasd_device
*startdev
,
411 unsigned char format
, unsigned int rec_on_trk
, int count
,
412 unsigned int blksize
, unsigned int tlf
)
414 struct dasd_eckd_private
*basepriv
, *startpriv
;
415 struct DE_eckd_data
*dedata
;
416 struct LRE_eckd_data
*lredata
;
418 u16 heads
, beghead
, endhead
;
421 basepriv
= (struct dasd_eckd_private
*) basedev
->private;
422 startpriv
= (struct dasd_eckd_private
*) startdev
->private;
423 dedata
= &pfxdata
->define_extent
;
424 lredata
= &pfxdata
->locate_record
;
426 ccw
->cmd_code
= DASD_ECKD_CCW_PFX
;
428 ccw
->count
= sizeof(*pfxdata
);
429 ccw
->cda
= (__u32
) __pa(pfxdata
);
431 memset(pfxdata
, 0, sizeof(*pfxdata
));
434 DBF_DEV_EVENT(DBF_ERR
, basedev
,
435 "PFX LRE unknown format 0x%x", format
);
439 pfxdata
->format
= format
;
440 pfxdata
->base_address
= basepriv
->ned
->unit_addr
;
441 pfxdata
->base_lss
= basepriv
->ned
->ID
;
442 pfxdata
->validity
.define_extent
= 1;
444 /* private uid is kept up to date, conf_data may be outdated */
445 if (startpriv
->uid
.type
!= UA_BASE_DEVICE
) {
446 pfxdata
->validity
.verify_base
= 1;
447 if (startpriv
->uid
.type
== UA_HYPER_PAV_ALIAS
)
448 pfxdata
->validity
.hyper_pav
= 1;
451 /* define extend data (mostly)*/
453 case DASD_ECKD_CCW_READ_HOME_ADDRESS
:
454 case DASD_ECKD_CCW_READ_RECORD_ZERO
:
455 case DASD_ECKD_CCW_READ
:
456 case DASD_ECKD_CCW_READ_MT
:
457 case DASD_ECKD_CCW_READ_CKD
:
458 case DASD_ECKD_CCW_READ_CKD_MT
:
459 case DASD_ECKD_CCW_READ_KD
:
460 case DASD_ECKD_CCW_READ_KD_MT
:
461 case DASD_ECKD_CCW_READ_COUNT
:
462 dedata
->mask
.perm
= 0x1;
463 dedata
->attributes
.operation
= basepriv
->attrib
.operation
;
465 case DASD_ECKD_CCW_READ_TRACK_DATA
:
466 dedata
->mask
.perm
= 0x1;
467 dedata
->attributes
.operation
= basepriv
->attrib
.operation
;
468 dedata
->blk_size
= 0;
470 case DASD_ECKD_CCW_WRITE
:
471 case DASD_ECKD_CCW_WRITE_MT
:
472 case DASD_ECKD_CCW_WRITE_KD
:
473 case DASD_ECKD_CCW_WRITE_KD_MT
:
474 dedata
->mask
.perm
= 0x02;
475 dedata
->attributes
.operation
= basepriv
->attrib
.operation
;
476 rc
= check_XRC_on_prefix(pfxdata
, basedev
);
478 case DASD_ECKD_CCW_WRITE_CKD
:
479 case DASD_ECKD_CCW_WRITE_CKD_MT
:
480 dedata
->attributes
.operation
= DASD_BYPASS_CACHE
;
481 rc
= check_XRC_on_prefix(pfxdata
, basedev
);
483 case DASD_ECKD_CCW_ERASE
:
484 case DASD_ECKD_CCW_WRITE_HOME_ADDRESS
:
485 case DASD_ECKD_CCW_WRITE_RECORD_ZERO
:
486 dedata
->mask
.perm
= 0x3;
487 dedata
->mask
.auth
= 0x1;
488 dedata
->attributes
.operation
= DASD_BYPASS_CACHE
;
489 rc
= check_XRC_on_prefix(pfxdata
, basedev
);
491 case DASD_ECKD_CCW_WRITE_TRACK_DATA
:
492 dedata
->mask
.perm
= 0x02;
493 dedata
->attributes
.operation
= basepriv
->attrib
.operation
;
494 dedata
->blk_size
= blksize
;
495 rc
= check_XRC_on_prefix(pfxdata
, basedev
);
498 DBF_DEV_EVENT(DBF_ERR
, basedev
,
499 "PFX LRE unknown opcode 0x%x", cmd
);
504 dedata
->attributes
.mode
= 0x3; /* ECKD */
506 if ((basepriv
->rdc_data
.cu_type
== 0x2105 ||
507 basepriv
->rdc_data
.cu_type
== 0x2107 ||
508 basepriv
->rdc_data
.cu_type
== 0x1750)
509 && !(basepriv
->uses_cdl
&& trk
< 2))
510 dedata
->ga_extended
|= 0x40; /* Regular Data Format Mode */
512 heads
= basepriv
->rdc_data
.trk_per_cyl
;
513 begcyl
= trk
/ heads
;
514 beghead
= trk
% heads
;
515 endcyl
= totrk
/ heads
;
516 endhead
= totrk
% heads
;
518 /* check for sequential prestage - enhance cylinder range */
519 if (dedata
->attributes
.operation
== DASD_SEQ_PRESTAGE
||
520 dedata
->attributes
.operation
== DASD_SEQ_ACCESS
) {
522 if (endcyl
+ basepriv
->attrib
.nr_cyl
< basepriv
->real_cyl
)
523 endcyl
+= basepriv
->attrib
.nr_cyl
;
525 endcyl
= (basepriv
->real_cyl
- 1);
528 set_ch_t(&dedata
->beg_ext
, begcyl
, beghead
);
529 set_ch_t(&dedata
->end_ext
, endcyl
, endhead
);
532 fill_LRE_data(lredata
, trk
, rec_on_trk
, count
, cmd
,
533 basedev
, blksize
, tlf
);
539 static int prefix(struct ccw1
*ccw
, struct PFX_eckd_data
*pfxdata
,
540 unsigned int trk
, unsigned int totrk
, int cmd
,
541 struct dasd_device
*basedev
, struct dasd_device
*startdev
)
543 return prefix_LRE(ccw
, pfxdata
, trk
, totrk
, cmd
, basedev
, startdev
,
548 locate_record(struct ccw1
*ccw
, struct LO_eckd_data
*data
, unsigned int trk
,
549 unsigned int rec_on_trk
, int no_rec
, int cmd
,
550 struct dasd_device
* device
, int reclen
)
552 struct dasd_eckd_private
*private;
556 private = (struct dasd_eckd_private
*) device
->private;
558 DBF_DEV_EVENT(DBF_INFO
, device
,
559 "Locate: trk %d, rec %d, no_rec %d, cmd %d, reclen %d",
560 trk
, rec_on_trk
, no_rec
, cmd
, reclen
);
562 ccw
->cmd_code
= DASD_ECKD_CCW_LOCATE_RECORD
;
565 ccw
->cda
= (__u32
) __pa(data
);
567 memset(data
, 0, sizeof(struct LO_eckd_data
));
570 switch (private->rdc_data
.dev_type
) {
572 dn
= ceil_quot(reclen
+ 6, 232);
573 d
= 9 + ceil_quot(reclen
+ 6 * (dn
+ 1), 34);
574 sector
= (49 + (rec_on_trk
- 1) * (10 + d
)) / 8;
577 d
= 7 + ceil_quot(reclen
+ 12, 32);
578 sector
= (39 + (rec_on_trk
- 1) * (8 + d
)) / 7;
582 data
->sector
= sector
;
583 data
->count
= no_rec
;
585 case DASD_ECKD_CCW_WRITE_HOME_ADDRESS
:
586 data
->operation
.orientation
= 0x3;
587 data
->operation
.operation
= 0x03;
589 case DASD_ECKD_CCW_READ_HOME_ADDRESS
:
590 data
->operation
.orientation
= 0x3;
591 data
->operation
.operation
= 0x16;
593 case DASD_ECKD_CCW_WRITE_RECORD_ZERO
:
594 data
->operation
.orientation
= 0x1;
595 data
->operation
.operation
= 0x03;
598 case DASD_ECKD_CCW_READ_RECORD_ZERO
:
599 data
->operation
.orientation
= 0x3;
600 data
->operation
.operation
= 0x16;
603 case DASD_ECKD_CCW_WRITE
:
604 case DASD_ECKD_CCW_WRITE_MT
:
605 case DASD_ECKD_CCW_WRITE_KD
:
606 case DASD_ECKD_CCW_WRITE_KD_MT
:
607 data
->auxiliary
.last_bytes_used
= 0x1;
608 data
->length
= reclen
;
609 data
->operation
.operation
= 0x01;
611 case DASD_ECKD_CCW_WRITE_CKD
:
612 case DASD_ECKD_CCW_WRITE_CKD_MT
:
613 data
->auxiliary
.last_bytes_used
= 0x1;
614 data
->length
= reclen
;
615 data
->operation
.operation
= 0x03;
617 case DASD_ECKD_CCW_READ
:
618 case DASD_ECKD_CCW_READ_MT
:
619 case DASD_ECKD_CCW_READ_KD
:
620 case DASD_ECKD_CCW_READ_KD_MT
:
621 data
->auxiliary
.last_bytes_used
= 0x1;
622 data
->length
= reclen
;
623 data
->operation
.operation
= 0x06;
625 case DASD_ECKD_CCW_READ_CKD
:
626 case DASD_ECKD_CCW_READ_CKD_MT
:
627 data
->auxiliary
.last_bytes_used
= 0x1;
628 data
->length
= reclen
;
629 data
->operation
.operation
= 0x16;
631 case DASD_ECKD_CCW_READ_COUNT
:
632 data
->operation
.operation
= 0x06;
634 case DASD_ECKD_CCW_ERASE
:
635 data
->length
= reclen
;
636 data
->auxiliary
.last_bytes_used
= 0x1;
637 data
->operation
.operation
= 0x0b;
640 DBF_DEV_EVENT(DBF_ERR
, device
, "unknown locate record "
643 set_ch_t(&data
->seek_addr
,
644 trk
/ private->rdc_data
.trk_per_cyl
,
645 trk
% private->rdc_data
.trk_per_cyl
);
646 data
->search_arg
.cyl
= data
->seek_addr
.cyl
;
647 data
->search_arg
.head
= data
->seek_addr
.head
;
648 data
->search_arg
.record
= rec_on_trk
;
652 * Returns 1 if the block is one of the special blocks that needs
653 * to get read/written with the KD variant of the command.
654 * That is DASD_ECKD_READ_KD_MT instead of DASD_ECKD_READ_MT and
655 * DASD_ECKD_WRITE_KD_MT instead of DASD_ECKD_WRITE_MT.
656 * Luckily the KD variants differ only by one bit (0x08) from the
657 * normal variant. So don't wonder about code like:
658 * if (dasd_eckd_cdl_special(blk_per_trk, recid))
659 * ccw->cmd_code |= 0x8;
662 dasd_eckd_cdl_special(int blk_per_trk
, int recid
)
666 if (recid
< blk_per_trk
)
668 if (recid
< 2 * blk_per_trk
)
674 * Returns the record size for the special blocks of the cdl format.
675 * Only returns something useful if dasd_eckd_cdl_special is true
679 dasd_eckd_cdl_reclen(int recid
)
682 return sizes_trk0
[recid
];
687 * Generate device unique id that specifies the physical device.
689 static int dasd_eckd_generate_uid(struct dasd_device
*device
,
690 struct dasd_uid
*uid
)
692 struct dasd_eckd_private
*private;
695 private = (struct dasd_eckd_private
*) device
->private;
698 if (!private->ned
|| !private->gneq
)
701 memset(uid
, 0, sizeof(struct dasd_uid
));
702 memcpy(uid
->vendor
, private->ned
->HDA_manufacturer
,
703 sizeof(uid
->vendor
) - 1);
704 EBCASC(uid
->vendor
, sizeof(uid
->vendor
) - 1);
705 memcpy(uid
->serial
, private->ned
->HDA_location
,
706 sizeof(uid
->serial
) - 1);
707 EBCASC(uid
->serial
, sizeof(uid
->serial
) - 1);
708 uid
->ssid
= private->gneq
->subsystemID
;
709 uid
->real_unit_addr
= private->ned
->unit_addr
;;
711 uid
->type
= private->sneq
->sua_flags
;
712 if (uid
->type
== UA_BASE_PAV_ALIAS
)
713 uid
->base_unit_addr
= private->sneq
->base_unit_addr
;
715 uid
->type
= UA_BASE_DEVICE
;
717 if (private->vdsneq
) {
718 for (count
= 0; count
< 16; count
++) {
719 sprintf(uid
->vduit
+2*count
, "%02x",
720 private->vdsneq
->uit
[count
]);
726 static struct dasd_ccw_req
*dasd_eckd_build_rcd_lpm(struct dasd_device
*device
,
728 struct ciw
*ciw
, __u8 lpm
)
730 struct dasd_ccw_req
*cqr
;
733 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 1 /* RCD */, ciw
->count
,
737 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
738 "Could not allocate RCD request");
743 ccw
->cmd_code
= ciw
->cmd
;
744 ccw
->cda
= (__u32
)(addr_t
)rcd_buffer
;
745 ccw
->count
= ciw
->count
;
747 cqr
->startdev
= device
;
748 cqr
->memdev
= device
;
750 cqr
->expires
= 10*HZ
;
752 clear_bit(DASD_CQR_FLAGS_USE_ERP
, &cqr
->flags
);
754 cqr
->buildclk
= get_clock();
755 cqr
->status
= DASD_CQR_FILLED
;
759 static int dasd_eckd_read_conf_lpm(struct dasd_device
*device
,
761 int *rcd_buffer_size
, __u8 lpm
)
764 char *rcd_buf
= NULL
;
766 struct dasd_ccw_req
*cqr
;
769 * scan for RCD command in extended SenseID data
771 ciw
= ccw_device_get_ciw(device
->cdev
, CIW_TYPE_RCD
);
772 if (!ciw
|| ciw
->cmd
== 0) {
776 rcd_buf
= kzalloc(ciw
->count
, GFP_KERNEL
| GFP_DMA
);
783 * buffer has to start with EBCDIC "V1.0" to show
784 * support for virtual device SNEQ
790 cqr
= dasd_eckd_build_rcd_lpm(device
, rcd_buf
, ciw
, lpm
);
795 ret
= dasd_sleep_on(cqr
);
797 * on success we update the user input parms
799 dasd_sfree_request(cqr
, cqr
->memdev
);
803 *rcd_buffer_size
= ciw
->count
;
804 *rcd_buffer
= rcd_buf
;
809 *rcd_buffer_size
= 0;
813 static int dasd_eckd_identify_conf_parts(struct dasd_eckd_private
*private)
816 struct dasd_sneq
*sneq
;
820 private->sneq
= NULL
;
821 private->vdsneq
= NULL
;
822 private->gneq
= NULL
;
823 count
= private->conf_len
/ sizeof(struct dasd_sneq
);
824 sneq
= (struct dasd_sneq
*)private->conf_data
;
825 for (i
= 0; i
< count
; ++i
) {
826 if (sneq
->flags
.identifier
== 1 && sneq
->format
== 1)
827 private->sneq
= sneq
;
828 else if (sneq
->flags
.identifier
== 1 && sneq
->format
== 4)
829 private->vdsneq
= (struct vd_sneq
*)sneq
;
830 else if (sneq
->flags
.identifier
== 2)
831 private->gneq
= (struct dasd_gneq
*)sneq
;
832 else if (sneq
->flags
.identifier
== 3 && sneq
->res1
== 1)
833 private->ned
= (struct dasd_ned
*)sneq
;
836 if (!private->ned
|| !private->gneq
) {
838 private->sneq
= NULL
;
839 private->vdsneq
= NULL
;
840 private->gneq
= NULL
;
847 static unsigned char dasd_eckd_path_access(void *conf_data
, int conf_len
)
849 struct dasd_gneq
*gneq
;
852 count
= conf_len
/ sizeof(*gneq
);
853 gneq
= (struct dasd_gneq
*)conf_data
;
855 for (i
= 0; i
< count
; ++i
) {
856 if (gneq
->flags
.identifier
== 2) {
863 return ((char *)gneq
)[18] & 0x07;
868 static int dasd_eckd_read_conf(struct dasd_device
*device
)
871 int conf_len
, conf_data_saved
;
874 struct dasd_eckd_private
*private;
875 struct dasd_eckd_path
*path_data
;
877 private = (struct dasd_eckd_private
*) device
->private;
878 path_data
= (struct dasd_eckd_path
*) &private->path_data
;
879 path_data
->opm
= ccw_device_get_path_mask(device
->cdev
);
882 /* get configuration data per operational path */
883 for (lpm
= 0x80; lpm
; lpm
>>= 1) {
884 if (lpm
& path_data
->opm
){
885 rc
= dasd_eckd_read_conf_lpm(device
, &conf_data
,
887 if (rc
&& rc
!= -EOPNOTSUPP
) { /* -EOPNOTSUPP is ok */
888 DBF_EVENT(DBF_WARNING
,
889 "Read configuration data returned "
890 "error %d for device: %s", rc
,
891 dev_name(&device
->cdev
->dev
));
894 if (conf_data
== NULL
) {
895 DBF_EVENT(DBF_WARNING
, "No configuration "
896 "data retrieved for device: %s",
897 dev_name(&device
->cdev
->dev
));
898 continue; /* no error */
900 /* save first valid configuration data */
901 if (!conf_data_saved
) {
902 kfree(private->conf_data
);
903 private->conf_data
= conf_data
;
904 private->conf_len
= conf_len
;
905 if (dasd_eckd_identify_conf_parts(private)) {
906 private->conf_data
= NULL
;
907 private->conf_len
= 0;
913 switch (dasd_eckd_path_access(conf_data
, conf_len
)) {
915 path_data
->npm
|= lpm
;
918 path_data
->ppm
|= lpm
;
921 if (conf_data
!= private->conf_data
)
928 static int dasd_eckd_read_features(struct dasd_device
*device
)
930 struct dasd_psf_prssd_data
*prssdp
;
931 struct dasd_rssd_features
*features
;
932 struct dasd_ccw_req
*cqr
;
935 struct dasd_eckd_private
*private;
937 private = (struct dasd_eckd_private
*) device
->private;
938 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 1 /* PSF */ + 1 /* RSSD */,
939 (sizeof(struct dasd_psf_prssd_data
) +
940 sizeof(struct dasd_rssd_features
)),
943 DBF_EVENT(DBF_WARNING
, "Could not allocate initialization "
944 "request for device: %s",
945 dev_name(&device
->cdev
->dev
));
948 cqr
->startdev
= device
;
949 cqr
->memdev
= device
;
951 clear_bit(DASD_CQR_FLAGS_USE_ERP
, &cqr
->flags
);
953 cqr
->expires
= 10 * HZ
;
955 /* Prepare for Read Subsystem Data */
956 prssdp
= (struct dasd_psf_prssd_data
*) cqr
->data
;
957 memset(prssdp
, 0, sizeof(struct dasd_psf_prssd_data
));
958 prssdp
->order
= PSF_ORDER_PRSSD
;
959 prssdp
->suborder
= 0x41; /* Read Feature Codes */
960 /* all other bytes of prssdp must be zero */
963 ccw
->cmd_code
= DASD_ECKD_CCW_PSF
;
964 ccw
->count
= sizeof(struct dasd_psf_prssd_data
);
965 ccw
->flags
|= CCW_FLAG_CC
;
966 ccw
->cda
= (__u32
)(addr_t
) prssdp
;
968 /* Read Subsystem Data - feature codes */
969 features
= (struct dasd_rssd_features
*) (prssdp
+ 1);
970 memset(features
, 0, sizeof(struct dasd_rssd_features
));
973 ccw
->cmd_code
= DASD_ECKD_CCW_RSSD
;
974 ccw
->count
= sizeof(struct dasd_rssd_features
);
975 ccw
->cda
= (__u32
)(addr_t
) features
;
977 cqr
->buildclk
= get_clock();
978 cqr
->status
= DASD_CQR_FILLED
;
979 rc
= dasd_sleep_on(cqr
);
981 prssdp
= (struct dasd_psf_prssd_data
*) cqr
->data
;
982 features
= (struct dasd_rssd_features
*) (prssdp
+ 1);
983 memcpy(&private->features
, features
,
984 sizeof(struct dasd_rssd_features
));
986 dasd_sfree_request(cqr
, cqr
->memdev
);
992 * Build CP for Perform Subsystem Function - SSC.
994 static struct dasd_ccw_req
*dasd_eckd_build_psf_ssc(struct dasd_device
*device
,
997 struct dasd_ccw_req
*cqr
;
998 struct dasd_psf_ssc_data
*psf_ssc_data
;
1001 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 1 /* PSF */ ,
1002 sizeof(struct dasd_psf_ssc_data
),
1006 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
1007 "Could not allocate PSF-SSC request");
1010 psf_ssc_data
= (struct dasd_psf_ssc_data
*)cqr
->data
;
1011 psf_ssc_data
->order
= PSF_ORDER_SSC
;
1012 psf_ssc_data
->suborder
= 0x40;
1014 psf_ssc_data
->suborder
|= 0x88;
1015 psf_ssc_data
->reserved
[0] = 0x88;
1018 ccw
->cmd_code
= DASD_ECKD_CCW_PSF
;
1019 ccw
->cda
= (__u32
)(addr_t
)psf_ssc_data
;
1022 cqr
->startdev
= device
;
1023 cqr
->memdev
= device
;
1025 cqr
->expires
= 10*HZ
;
1026 cqr
->buildclk
= get_clock();
1027 cqr
->status
= DASD_CQR_FILLED
;
1032 * Perform Subsystem Function.
1033 * It is necessary to trigger CIO for channel revalidation since this
1034 * call might change behaviour of DASD devices.
1037 dasd_eckd_psf_ssc(struct dasd_device
*device
, int enable_pav
)
1039 struct dasd_ccw_req
*cqr
;
1042 cqr
= dasd_eckd_build_psf_ssc(device
, enable_pav
);
1044 return PTR_ERR(cqr
);
1046 rc
= dasd_sleep_on(cqr
);
1048 /* trigger CIO to reprobe devices */
1049 css_schedule_reprobe();
1050 dasd_sfree_request(cqr
, cqr
->memdev
);
1055 * Valide storage server of current device.
1057 static int dasd_eckd_validate_server(struct dasd_device
*device
)
1060 struct dasd_eckd_private
*private;
1063 if (dasd_nopav
|| MACHINE_IS_VM
)
1067 rc
= dasd_eckd_psf_ssc(device
, enable_pav
);
1068 /* may be requested feature is not available on server,
1069 * therefore just report error and go ahead */
1070 private = (struct dasd_eckd_private
*) device
->private;
1071 DBF_EVENT(DBF_WARNING
, "PSF-SSC on storage subsystem %s.%s.%04x "
1072 "returned rc=%d for device: %s",
1073 private->uid
.vendor
, private->uid
.serial
,
1074 private->uid
.ssid
, rc
, dev_name(&device
->cdev
->dev
));
1075 /* RE-Read Configuration Data */
1076 return dasd_eckd_read_conf(device
);
1080 * Check device characteristics.
1081 * If the device is accessible using ECKD discipline, the device is enabled.
1084 dasd_eckd_check_characteristics(struct dasd_device
*device
)
1086 struct dasd_eckd_private
*private;
1087 struct dasd_block
*block
;
1090 private = (struct dasd_eckd_private
*) device
->private;
1092 private = kzalloc(sizeof(*private), GFP_KERNEL
| GFP_DMA
);
1094 dev_warn(&device
->cdev
->dev
,
1095 "Allocating memory for private DASD data "
1099 device
->private = (void *) private;
1101 memset(private, 0, sizeof(*private));
1103 /* Invalidate status of initial analysis. */
1104 private->init_cqr_status
= -1;
1105 /* Set default cache operations. */
1106 private->attrib
.operation
= DASD_NORMAL_CACHE
;
1107 private->attrib
.nr_cyl
= 0;
1109 /* Read Configuration Data */
1110 rc
= dasd_eckd_read_conf(device
);
1114 /* Generate device unique id and register in devmap */
1115 rc
= dasd_eckd_generate_uid(device
, &private->uid
);
1118 dasd_set_uid(device
->cdev
, &private->uid
);
1120 if (private->uid
.type
== UA_BASE_DEVICE
) {
1121 block
= dasd_alloc_block();
1122 if (IS_ERR(block
)) {
1123 DBF_EVENT(DBF_WARNING
, "could not allocate dasd "
1124 "block structure for device: %s",
1125 dev_name(&device
->cdev
->dev
));
1126 rc
= PTR_ERR(block
);
1129 device
->block
= block
;
1130 block
->base
= device
;
1133 /* register lcu with alias handling, enable PAV if this is a new lcu */
1134 is_known
= dasd_alias_make_device_known_to_lcu(device
);
1141 rc
= dasd_eckd_validate_server(device
); /* will switch pav on */
1146 /* Read Feature Codes */
1147 rc
= dasd_eckd_read_features(device
);
1151 /* Read Device Characteristics */
1152 rc
= dasd_generic_read_dev_chars(device
, DASD_ECKD_MAGIC
,
1153 &private->rdc_data
, 64);
1155 DBF_EVENT(DBF_WARNING
,
1156 "Read device characteristics failed, rc=%d for "
1157 "device: %s", rc
, dev_name(&device
->cdev
->dev
));
1160 /* find the vaild cylinder size */
1161 if (private->rdc_data
.no_cyl
== LV_COMPAT_CYL
&&
1162 private->rdc_data
.long_no_cyl
)
1163 private->real_cyl
= private->rdc_data
.long_no_cyl
;
1165 private->real_cyl
= private->rdc_data
.no_cyl
;
1167 dev_info(&device
->cdev
->dev
, "New DASD %04X/%02X (CU %04X/%02X) "
1168 "with %d cylinders, %d heads, %d sectors\n",
1169 private->rdc_data
.dev_type
,
1170 private->rdc_data
.dev_model
,
1171 private->rdc_data
.cu_type
,
1172 private->rdc_data
.cu_model
.model
,
1174 private->rdc_data
.trk_per_cyl
,
1175 private->rdc_data
.sec_per_trk
);
1179 dasd_alias_disconnect_device_from_lcu(device
);
1181 dasd_free_block(device
->block
);
1182 device
->block
= NULL
;
1184 kfree(private->conf_data
);
1185 kfree(device
->private);
1186 device
->private = NULL
;
1190 static void dasd_eckd_uncheck_device(struct dasd_device
*device
)
1192 struct dasd_eckd_private
*private;
1194 private = (struct dasd_eckd_private
*) device
->private;
1195 dasd_alias_disconnect_device_from_lcu(device
);
1196 private->ned
= NULL
;
1197 private->sneq
= NULL
;
1198 private->vdsneq
= NULL
;
1199 private->gneq
= NULL
;
1200 private->conf_len
= 0;
1201 kfree(private->conf_data
);
1202 private->conf_data
= NULL
;
1205 static struct dasd_ccw_req
*
1206 dasd_eckd_analysis_ccw(struct dasd_device
*device
)
1208 struct dasd_eckd_private
*private;
1209 struct eckd_count
*count_data
;
1210 struct LO_eckd_data
*LO_data
;
1211 struct dasd_ccw_req
*cqr
;
1213 int cplength
, datasize
;
1216 private = (struct dasd_eckd_private
*) device
->private;
1219 datasize
= sizeof(struct DE_eckd_data
) + 2*sizeof(struct LO_eckd_data
);
1220 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, cplength
, datasize
, device
);
1224 /* Define extent for the first 3 tracks. */
1225 define_extent(ccw
++, cqr
->data
, 0, 2,
1226 DASD_ECKD_CCW_READ_COUNT
, device
);
1227 LO_data
= cqr
->data
+ sizeof(struct DE_eckd_data
);
1228 /* Locate record for the first 4 records on track 0. */
1229 ccw
[-1].flags
|= CCW_FLAG_CC
;
1230 locate_record(ccw
++, LO_data
++, 0, 0, 4,
1231 DASD_ECKD_CCW_READ_COUNT
, device
, 0);
1233 count_data
= private->count_area
;
1234 for (i
= 0; i
< 4; i
++) {
1235 ccw
[-1].flags
|= CCW_FLAG_CC
;
1236 ccw
->cmd_code
= DASD_ECKD_CCW_READ_COUNT
;
1239 ccw
->cda
= (__u32
)(addr_t
) count_data
;
1244 /* Locate record for the first record on track 2. */
1245 ccw
[-1].flags
|= CCW_FLAG_CC
;
1246 locate_record(ccw
++, LO_data
++, 2, 0, 1,
1247 DASD_ECKD_CCW_READ_COUNT
, device
, 0);
1248 /* Read count ccw. */
1249 ccw
[-1].flags
|= CCW_FLAG_CC
;
1250 ccw
->cmd_code
= DASD_ECKD_CCW_READ_COUNT
;
1253 ccw
->cda
= (__u32
)(addr_t
) count_data
;
1256 cqr
->startdev
= device
;
1257 cqr
->memdev
= device
;
1259 cqr
->buildclk
= get_clock();
1260 cqr
->status
= DASD_CQR_FILLED
;
1265 * This is the callback function for the init_analysis cqr. It saves
1266 * the status of the initial analysis ccw before it frees it and kicks
1267 * the device to continue the startup sequence. This will call
1268 * dasd_eckd_do_analysis again (if the devices has not been marked
1269 * for deletion in the meantime).
1272 dasd_eckd_analysis_callback(struct dasd_ccw_req
*init_cqr
, void *data
)
1274 struct dasd_eckd_private
*private;
1275 struct dasd_device
*device
;
1277 device
= init_cqr
->startdev
;
1278 private = (struct dasd_eckd_private
*) device
->private;
1279 private->init_cqr_status
= init_cqr
->status
;
1280 dasd_sfree_request(init_cqr
, device
);
1281 dasd_kick_device(device
);
1285 dasd_eckd_start_analysis(struct dasd_block
*block
)
1287 struct dasd_eckd_private
*private;
1288 struct dasd_ccw_req
*init_cqr
;
1290 private = (struct dasd_eckd_private
*) block
->base
->private;
1291 init_cqr
= dasd_eckd_analysis_ccw(block
->base
);
1292 if (IS_ERR(init_cqr
))
1293 return PTR_ERR(init_cqr
);
1294 init_cqr
->callback
= dasd_eckd_analysis_callback
;
1295 init_cqr
->callback_data
= NULL
;
1296 init_cqr
->expires
= 5*HZ
;
1297 dasd_add_request_head(init_cqr
);
1302 dasd_eckd_end_analysis(struct dasd_block
*block
)
1304 struct dasd_device
*device
;
1305 struct dasd_eckd_private
*private;
1306 struct eckd_count
*count_area
;
1307 unsigned int sb
, blk_per_trk
;
1310 device
= block
->base
;
1311 private = (struct dasd_eckd_private
*) device
->private;
1312 status
= private->init_cqr_status
;
1313 private->init_cqr_status
= -1;
1314 if (status
!= DASD_CQR_DONE
) {
1315 dev_warn(&device
->cdev
->dev
,
1316 "The DASD is not formatted\n");
1317 return -EMEDIUMTYPE
;
1320 private->uses_cdl
= 1;
1321 /* Check Track 0 for Compatible Disk Layout */
1323 for (i
= 0; i
< 3; i
++) {
1324 if (private->count_area
[i
].kl
!= 4 ||
1325 private->count_area
[i
].dl
!= dasd_eckd_cdl_reclen(i
) - 4) {
1326 private->uses_cdl
= 0;
1331 count_area
= &private->count_area
[4];
1333 if (private->uses_cdl
== 0) {
1334 for (i
= 0; i
< 5; i
++) {
1335 if ((private->count_area
[i
].kl
!= 0) ||
1336 (private->count_area
[i
].dl
!=
1337 private->count_area
[0].dl
))
1341 count_area
= &private->count_area
[0];
1343 if (private->count_area
[3].record
== 1)
1344 dev_warn(&device
->cdev
->dev
,
1345 "Track 0 has no records following the VTOC\n");
1347 if (count_area
!= NULL
&& count_area
->kl
== 0) {
1348 /* we found notthing violating our disk layout */
1349 if (dasd_check_blocksize(count_area
->dl
) == 0)
1350 block
->bp_block
= count_area
->dl
;
1352 if (block
->bp_block
== 0) {
1353 dev_warn(&device
->cdev
->dev
,
1354 "The disk layout of the DASD is not supported\n");
1355 return -EMEDIUMTYPE
;
1357 block
->s2b_shift
= 0; /* bits to shift 512 to get a block */
1358 for (sb
= 512; sb
< block
->bp_block
; sb
= sb
<< 1)
1361 blk_per_trk
= recs_per_track(&private->rdc_data
, 0, block
->bp_block
);
1362 block
->blocks
= (private->real_cyl
*
1363 private->rdc_data
.trk_per_cyl
*
1366 dev_info(&device
->cdev
->dev
,
1367 "DASD with %d KB/block, %d KB total size, %d KB/track, "
1368 "%s\n", (block
->bp_block
>> 10),
1369 ((private->real_cyl
*
1370 private->rdc_data
.trk_per_cyl
*
1371 blk_per_trk
* (block
->bp_block
>> 9)) >> 1),
1372 ((blk_per_trk
* block
->bp_block
) >> 10),
1374 "compatible disk layout" : "linux disk layout");
1379 static int dasd_eckd_do_analysis(struct dasd_block
*block
)
1381 struct dasd_eckd_private
*private;
1383 private = (struct dasd_eckd_private
*) block
->base
->private;
1384 if (private->init_cqr_status
< 0)
1385 return dasd_eckd_start_analysis(block
);
1387 return dasd_eckd_end_analysis(block
);
1390 static int dasd_eckd_ready_to_online(struct dasd_device
*device
)
1392 return dasd_alias_add_device(device
);
1395 static int dasd_eckd_online_to_ready(struct dasd_device
*device
)
1397 return dasd_alias_remove_device(device
);
1401 dasd_eckd_fill_geometry(struct dasd_block
*block
, struct hd_geometry
*geo
)
1403 struct dasd_eckd_private
*private;
1405 private = (struct dasd_eckd_private
*) block
->base
->private;
1406 if (dasd_check_blocksize(block
->bp_block
) == 0) {
1407 geo
->sectors
= recs_per_track(&private->rdc_data
,
1408 0, block
->bp_block
);
1410 geo
->cylinders
= private->rdc_data
.no_cyl
;
1411 geo
->heads
= private->rdc_data
.trk_per_cyl
;
1415 static struct dasd_ccw_req
*
1416 dasd_eckd_format_device(struct dasd_device
* device
,
1417 struct format_data_t
* fdata
)
1419 struct dasd_eckd_private
*private;
1420 struct dasd_ccw_req
*fcp
;
1421 struct eckd_count
*ect
;
1425 struct ch_t address
;
1426 int cplength
, datasize
;
1431 private = (struct dasd_eckd_private
*) device
->private;
1432 rpt
= recs_per_track(&private->rdc_data
, 0, fdata
->blksize
);
1434 fdata
->start_unit
/ private->rdc_data
.trk_per_cyl
,
1435 fdata
->start_unit
% private->rdc_data
.trk_per_cyl
);
1437 /* Sanity checks. */
1438 if (fdata
->start_unit
>=
1439 (private->real_cyl
* private->rdc_data
.trk_per_cyl
)) {
1440 dev_warn(&device
->cdev
->dev
, "Start track number %d used in "
1441 "formatting is too big\n", fdata
->start_unit
);
1442 return ERR_PTR(-EINVAL
);
1444 if (fdata
->start_unit
> fdata
->stop_unit
) {
1445 dev_warn(&device
->cdev
->dev
, "Start track %d used in "
1446 "formatting exceeds end track\n", fdata
->start_unit
);
1447 return ERR_PTR(-EINVAL
);
1449 if (dasd_check_blocksize(fdata
->blksize
) != 0) {
1450 dev_warn(&device
->cdev
->dev
,
1451 "The DASD cannot be formatted with block size %d\n",
1453 return ERR_PTR(-EINVAL
);
1457 * fdata->intensity is a bit string that tells us what to do:
1458 * Bit 0: write record zero
1459 * Bit 1: write home address, currently not supported
1460 * Bit 2: invalidate tracks
1461 * Bit 3: use OS/390 compatible disk layout (cdl)
1462 * Bit 4: do not allow storage subsystem to modify record zero
1463 * Only some bit combinations do make sense.
1465 if (fdata
->intensity
& 0x10) {
1467 intensity
= fdata
->intensity
& ~0x10;
1470 intensity
= fdata
->intensity
;
1472 switch (intensity
) {
1473 case 0x00: /* Normal format */
1474 case 0x08: /* Normal format, use cdl. */
1476 datasize
= sizeof(struct DE_eckd_data
) +
1477 sizeof(struct LO_eckd_data
) +
1478 rpt
* sizeof(struct eckd_count
);
1480 case 0x01: /* Write record zero and format track. */
1481 case 0x09: /* Write record zero and format track, use cdl. */
1483 datasize
= sizeof(struct DE_eckd_data
) +
1484 sizeof(struct LO_eckd_data
) +
1485 sizeof(struct eckd_count
) +
1486 rpt
* sizeof(struct eckd_count
);
1488 case 0x04: /* Invalidate track. */
1489 case 0x0c: /* Invalidate track, use cdl. */
1491 datasize
= sizeof(struct DE_eckd_data
) +
1492 sizeof(struct LO_eckd_data
) +
1493 sizeof(struct eckd_count
);
1496 dev_warn(&device
->cdev
->dev
, "An I/O control call used "
1497 "incorrect flags 0x%x\n", fdata
->intensity
);
1498 return ERR_PTR(-EINVAL
);
1500 /* Allocate the format ccw request. */
1501 fcp
= dasd_smalloc_request(DASD_ECKD_MAGIC
, cplength
, datasize
, device
);
1508 switch (intensity
& ~0x08) {
1509 case 0x00: /* Normal format. */
1510 define_extent(ccw
++, (struct DE_eckd_data
*) data
,
1511 fdata
->start_unit
, fdata
->start_unit
,
1512 DASD_ECKD_CCW_WRITE_CKD
, device
);
1513 /* grant subsystem permission to format R0 */
1515 ((struct DE_eckd_data
*)data
)->ga_extended
|= 0x04;
1516 data
+= sizeof(struct DE_eckd_data
);
1517 ccw
[-1].flags
|= CCW_FLAG_CC
;
1518 locate_record(ccw
++, (struct LO_eckd_data
*) data
,
1519 fdata
->start_unit
, 0, rpt
,
1520 DASD_ECKD_CCW_WRITE_CKD
, device
,
1522 data
+= sizeof(struct LO_eckd_data
);
1524 case 0x01: /* Write record zero + format track. */
1525 define_extent(ccw
++, (struct DE_eckd_data
*) data
,
1526 fdata
->start_unit
, fdata
->start_unit
,
1527 DASD_ECKD_CCW_WRITE_RECORD_ZERO
,
1529 data
+= sizeof(struct DE_eckd_data
);
1530 ccw
[-1].flags
|= CCW_FLAG_CC
;
1531 locate_record(ccw
++, (struct LO_eckd_data
*) data
,
1532 fdata
->start_unit
, 0, rpt
+ 1,
1533 DASD_ECKD_CCW_WRITE_RECORD_ZERO
, device
,
1534 device
->block
->bp_block
);
1535 data
+= sizeof(struct LO_eckd_data
);
1537 case 0x04: /* Invalidate track. */
1538 define_extent(ccw
++, (struct DE_eckd_data
*) data
,
1539 fdata
->start_unit
, fdata
->start_unit
,
1540 DASD_ECKD_CCW_WRITE_CKD
, device
);
1541 data
+= sizeof(struct DE_eckd_data
);
1542 ccw
[-1].flags
|= CCW_FLAG_CC
;
1543 locate_record(ccw
++, (struct LO_eckd_data
*) data
,
1544 fdata
->start_unit
, 0, 1,
1545 DASD_ECKD_CCW_WRITE_CKD
, device
, 8);
1546 data
+= sizeof(struct LO_eckd_data
);
1549 if (intensity
& 0x01) { /* write record zero */
1550 ect
= (struct eckd_count
*) data
;
1551 data
+= sizeof(struct eckd_count
);
1552 ect
->cyl
= address
.cyl
;
1553 ect
->head
= address
.head
;
1557 ccw
[-1].flags
|= CCW_FLAG_CC
;
1558 ccw
->cmd_code
= DASD_ECKD_CCW_WRITE_RECORD_ZERO
;
1559 ccw
->flags
= CCW_FLAG_SLI
;
1561 ccw
->cda
= (__u32
)(addr_t
) ect
;
1564 if ((intensity
& ~0x08) & 0x04) { /* erase track */
1565 ect
= (struct eckd_count
*) data
;
1566 data
+= sizeof(struct eckd_count
);
1567 ect
->cyl
= address
.cyl
;
1568 ect
->head
= address
.head
;
1572 ccw
[-1].flags
|= CCW_FLAG_CC
;
1573 ccw
->cmd_code
= DASD_ECKD_CCW_WRITE_CKD
;
1574 ccw
->flags
= CCW_FLAG_SLI
;
1576 ccw
->cda
= (__u32
)(addr_t
) ect
;
1577 } else { /* write remaining records */
1578 for (i
= 0; i
< rpt
; i
++) {
1579 ect
= (struct eckd_count
*) data
;
1580 data
+= sizeof(struct eckd_count
);
1581 ect
->cyl
= address
.cyl
;
1582 ect
->head
= address
.head
;
1583 ect
->record
= i
+ 1;
1585 ect
->dl
= fdata
->blksize
;
1586 /* Check for special tracks 0-1 when formatting CDL */
1587 if ((intensity
& 0x08) &&
1588 fdata
->start_unit
== 0) {
1591 ect
->dl
= sizes_trk0
[i
] - 4;
1594 if ((intensity
& 0x08) &&
1595 fdata
->start_unit
== 1) {
1597 ect
->dl
= LABEL_SIZE
- 44;
1599 ccw
[-1].flags
|= CCW_FLAG_CC
;
1600 ccw
->cmd_code
= DASD_ECKD_CCW_WRITE_CKD
;
1601 ccw
->flags
= CCW_FLAG_SLI
;
1603 ccw
->cda
= (__u32
)(addr_t
) ect
;
1607 fcp
->startdev
= device
;
1608 fcp
->memdev
= device
;
1609 clear_bit(DASD_CQR_FLAGS_USE_ERP
, &fcp
->flags
);
1610 fcp
->retries
= 5; /* set retry counter to enable default ERP */
1611 fcp
->buildclk
= get_clock();
1612 fcp
->status
= DASD_CQR_FILLED
;
1616 static void dasd_eckd_handle_terminated_request(struct dasd_ccw_req
*cqr
)
1618 cqr
->status
= DASD_CQR_FILLED
;
1619 if (cqr
->block
&& (cqr
->startdev
!= cqr
->block
->base
)) {
1620 dasd_eckd_reset_ccw_to_base_io(cqr
);
1621 cqr
->startdev
= cqr
->block
->base
;
1625 static dasd_erp_fn_t
1626 dasd_eckd_erp_action(struct dasd_ccw_req
* cqr
)
1628 struct dasd_device
*device
= (struct dasd_device
*) cqr
->startdev
;
1629 struct ccw_device
*cdev
= device
->cdev
;
1631 switch (cdev
->id
.cu_type
) {
1636 return dasd_3990_erp_action
;
1640 return dasd_default_erp_action
;
1644 static dasd_erp_fn_t
1645 dasd_eckd_erp_postaction(struct dasd_ccw_req
* cqr
)
1647 return dasd_default_erp_postaction
;
1651 static void dasd_eckd_handle_unsolicited_interrupt(struct dasd_device
*device
,
1657 /* first of all check for state change pending interrupt */
1658 mask
= DEV_STAT_ATTENTION
| DEV_STAT_DEV_END
| DEV_STAT_UNIT_EXCEP
;
1659 if ((scsw_dstat(&irb
->scsw
) & mask
) == mask
) {
1660 dasd_generic_handle_state_change(device
);
1664 /* summary unit check */
1665 if ((scsw_dstat(&irb
->scsw
) & DEV_STAT_UNIT_CHECK
) &&
1666 (irb
->ecw
[7] == 0x0D)) {
1667 dasd_alias_handle_summary_unit_check(device
, irb
);
1671 sense
= dasd_get_sense(irb
);
1672 /* service information message SIM */
1673 if (sense
&& !(sense
[27] & DASD_SENSE_BIT_0
) &&
1674 ((sense
[6] & DASD_SIM_SENSE
) == DASD_SIM_SENSE
)) {
1675 dasd_3990_erp_handle_sim(device
, sense
);
1676 dasd_schedule_device_bh(device
);
1680 if ((scsw_cc(&irb
->scsw
) == 1) &&
1681 (scsw_fctl(&irb
->scsw
) & SCSW_FCTL_START_FUNC
) &&
1682 (scsw_actl(&irb
->scsw
) & SCSW_ACTL_START_PEND
) &&
1683 (scsw_stctl(&irb
->scsw
) & SCSW_STCTL_STATUS_PEND
)) {
1684 /* fake irb do nothing, they are handled elsewhere */
1685 dasd_schedule_device_bh(device
);
1690 /* just report other unsolicited interrupts */
1691 DBF_DEV_EVENT(DBF_ERR
, device
, "%s",
1692 "unsolicited interrupt received");
1694 DBF_DEV_EVENT(DBF_ERR
, device
, "%s",
1695 "unsolicited interrupt received "
1696 "(sense available)");
1697 device
->discipline
->dump_sense_dbf(device
, irb
, "unsolicited");
1700 dasd_schedule_device_bh(device
);
1705 static struct dasd_ccw_req
*dasd_eckd_build_cp_cmd_single(
1706 struct dasd_device
*startdev
,
1707 struct dasd_block
*block
,
1708 struct request
*req
,
1713 unsigned int first_offs
,
1714 unsigned int last_offs
,
1715 unsigned int blk_per_trk
,
1716 unsigned int blksize
)
1718 struct dasd_eckd_private
*private;
1719 unsigned long *idaws
;
1720 struct LO_eckd_data
*LO_data
;
1721 struct dasd_ccw_req
*cqr
;
1723 struct req_iterator iter
;
1727 int count
, cidaw
, cplength
, datasize
;
1729 unsigned char cmd
, rcmd
;
1731 struct dasd_device
*basedev
;
1733 basedev
= block
->base
;
1734 private = (struct dasd_eckd_private
*) basedev
->private;
1735 if (rq_data_dir(req
) == READ
)
1736 cmd
= DASD_ECKD_CCW_READ_MT
;
1737 else if (rq_data_dir(req
) == WRITE
)
1738 cmd
= DASD_ECKD_CCW_WRITE_MT
;
1740 return ERR_PTR(-EINVAL
);
1742 /* Check struct bio and count the number of blocks for the request. */
1745 rq_for_each_segment(bv
, req
, iter
) {
1746 if (bv
->bv_len
& (blksize
- 1))
1747 /* Eckd can only do full blocks. */
1748 return ERR_PTR(-EINVAL
);
1749 count
+= bv
->bv_len
>> (block
->s2b_shift
+ 9);
1750 #if defined(CONFIG_64BIT)
1751 if (idal_is_needed (page_address(bv
->bv_page
), bv
->bv_len
))
1752 cidaw
+= bv
->bv_len
>> (block
->s2b_shift
+ 9);
1756 if (count
!= last_rec
- first_rec
+ 1)
1757 return ERR_PTR(-EINVAL
);
1759 /* use the prefix command if available */
1760 use_prefix
= private->features
.feature
[8] & 0x01;
1762 /* 1x prefix + number of blocks */
1763 cplength
= 2 + count
;
1764 /* 1x prefix + cidaws*sizeof(long) */
1765 datasize
= sizeof(struct PFX_eckd_data
) +
1766 sizeof(struct LO_eckd_data
) +
1767 cidaw
* sizeof(unsigned long);
1769 /* 1x define extent + 1x locate record + number of blocks */
1770 cplength
= 2 + count
;
1771 /* 1x define extent + 1x locate record + cidaws*sizeof(long) */
1772 datasize
= sizeof(struct DE_eckd_data
) +
1773 sizeof(struct LO_eckd_data
) +
1774 cidaw
* sizeof(unsigned long);
1776 /* Find out the number of additional locate record ccws for cdl. */
1777 if (private->uses_cdl
&& first_rec
< 2*blk_per_trk
) {
1778 if (last_rec
>= 2*blk_per_trk
)
1779 count
= 2*blk_per_trk
- first_rec
;
1781 datasize
+= count
*sizeof(struct LO_eckd_data
);
1783 /* Allocate the ccw request. */
1784 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, cplength
, datasize
,
1789 /* First ccw is define extent or prefix. */
1791 if (prefix(ccw
++, cqr
->data
, first_trk
,
1792 last_trk
, cmd
, basedev
, startdev
) == -EAGAIN
) {
1793 /* Clock not in sync and XRC is enabled.
1796 dasd_sfree_request(cqr
, startdev
);
1797 return ERR_PTR(-EAGAIN
);
1799 idaws
= (unsigned long *) (cqr
->data
+
1800 sizeof(struct PFX_eckd_data
));
1802 if (define_extent(ccw
++, cqr
->data
, first_trk
,
1803 last_trk
, cmd
, startdev
) == -EAGAIN
) {
1804 /* Clock not in sync and XRC is enabled.
1807 dasd_sfree_request(cqr
, startdev
);
1808 return ERR_PTR(-EAGAIN
);
1810 idaws
= (unsigned long *) (cqr
->data
+
1811 sizeof(struct DE_eckd_data
));
1813 /* Build locate_record+read/write/ccws. */
1814 LO_data
= (struct LO_eckd_data
*) (idaws
+ cidaw
);
1816 if (private->uses_cdl
== 0 || recid
> 2*blk_per_trk
) {
1817 /* Only standard blocks so there is just one locate record. */
1818 ccw
[-1].flags
|= CCW_FLAG_CC
;
1819 locate_record(ccw
++, LO_data
++, first_trk
, first_offs
+ 1,
1820 last_rec
- recid
+ 1, cmd
, basedev
, blksize
);
1822 rq_for_each_segment(bv
, req
, iter
) {
1823 dst
= page_address(bv
->bv_page
) + bv
->bv_offset
;
1824 if (dasd_page_cache
) {
1825 char *copy
= kmem_cache_alloc(dasd_page_cache
,
1826 GFP_DMA
| __GFP_NOWARN
);
1827 if (copy
&& rq_data_dir(req
) == WRITE
)
1828 memcpy(copy
+ bv
->bv_offset
, dst
, bv
->bv_len
);
1830 dst
= copy
+ bv
->bv_offset
;
1832 for (off
= 0; off
< bv
->bv_len
; off
+= blksize
) {
1833 sector_t trkid
= recid
;
1834 unsigned int recoffs
= sector_div(trkid
, blk_per_trk
);
1837 /* Locate record for cdl special block ? */
1838 if (private->uses_cdl
&& recid
< 2*blk_per_trk
) {
1839 if (dasd_eckd_cdl_special(blk_per_trk
, recid
)){
1841 count
= dasd_eckd_cdl_reclen(recid
);
1842 if (count
< blksize
&&
1843 rq_data_dir(req
) == READ
)
1844 memset(dst
+ count
, 0xe5,
1847 ccw
[-1].flags
|= CCW_FLAG_CC
;
1848 locate_record(ccw
++, LO_data
++,
1850 1, rcmd
, basedev
, count
);
1852 /* Locate record for standard blocks ? */
1853 if (private->uses_cdl
&& recid
== 2*blk_per_trk
) {
1854 ccw
[-1].flags
|= CCW_FLAG_CC
;
1855 locate_record(ccw
++, LO_data
++,
1857 last_rec
- recid
+ 1,
1858 cmd
, basedev
, count
);
1860 /* Read/write ccw. */
1861 ccw
[-1].flags
|= CCW_FLAG_CC
;
1862 ccw
->cmd_code
= rcmd
;
1864 if (idal_is_needed(dst
, blksize
)) {
1865 ccw
->cda
= (__u32
)(addr_t
) idaws
;
1866 ccw
->flags
= CCW_FLAG_IDA
;
1867 idaws
= idal_create_words(idaws
, dst
, blksize
);
1869 ccw
->cda
= (__u32
)(addr_t
) dst
;
1877 if (blk_noretry_request(req
) ||
1878 block
->base
->features
& DASD_FEATURE_FAILFAST
)
1879 set_bit(DASD_CQR_FLAGS_FAILFAST
, &cqr
->flags
);
1880 cqr
->startdev
= startdev
;
1881 cqr
->memdev
= startdev
;
1883 cqr
->expires
= 5 * 60 * HZ
; /* 5 minutes */
1884 cqr
->lpm
= private->path_data
.ppm
;
1886 cqr
->buildclk
= get_clock();
1887 cqr
->status
= DASD_CQR_FILLED
;
1891 static struct dasd_ccw_req
*dasd_eckd_build_cp_cmd_track(
1892 struct dasd_device
*startdev
,
1893 struct dasd_block
*block
,
1894 struct request
*req
,
1899 unsigned int first_offs
,
1900 unsigned int last_offs
,
1901 unsigned int blk_per_trk
,
1902 unsigned int blksize
)
1904 struct dasd_eckd_private
*private;
1905 unsigned long *idaws
;
1906 struct dasd_ccw_req
*cqr
;
1908 struct req_iterator iter
;
1910 char *dst
, *idaw_dst
;
1911 unsigned int cidaw
, cplength
, datasize
;
1915 struct dasd_device
*basedev
;
1916 unsigned int trkcount
, count
, count_to_trk_end
;
1917 unsigned int idaw_len
, seg_len
, part_len
, len_to_track_end
;
1918 unsigned char new_track
, end_idaw
;
1920 unsigned int recoffs
;
1922 basedev
= block
->base
;
1923 private = (struct dasd_eckd_private
*) basedev
->private;
1924 if (rq_data_dir(req
) == READ
)
1925 cmd
= DASD_ECKD_CCW_READ_TRACK_DATA
;
1926 else if (rq_data_dir(req
) == WRITE
)
1927 cmd
= DASD_ECKD_CCW_WRITE_TRACK_DATA
;
1929 return ERR_PTR(-EINVAL
);
1931 /* Track based I/O needs IDAWs for each page, and not just for
1932 * 64 bit addresses. We need additional idals for pages
1933 * that get filled from two tracks, so we use the number
1934 * of records as upper limit.
1936 cidaw
= last_rec
- first_rec
+ 1;
1937 trkcount
= last_trk
- first_trk
+ 1;
1939 /* 1x prefix + one read/write ccw per track */
1940 cplength
= 1 + trkcount
;
1942 /* on 31-bit we need space for two 32 bit addresses per page
1943 * on 64-bit one 64 bit address
1945 datasize
= sizeof(struct PFX_eckd_data
) +
1946 cidaw
* sizeof(unsigned long long);
1948 /* Allocate the ccw request. */
1949 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, cplength
, datasize
,
1954 /* transfer length factor: how many bytes to read from the last track */
1955 if (first_trk
== last_trk
)
1956 tlf
= last_offs
- first_offs
+ 1;
1958 tlf
= last_offs
+ 1;
1961 if (prefix_LRE(ccw
++, cqr
->data
, first_trk
,
1962 last_trk
, cmd
, basedev
, startdev
,
1963 1 /* format */, first_offs
+ 1,
1966 /* Clock not in sync and XRC is enabled.
1969 dasd_sfree_request(cqr
, startdev
);
1970 return ERR_PTR(-EAGAIN
);
1974 * The translation of request into ccw programs must meet the
1975 * following conditions:
1976 * - all idaws but the first and the last must address full pages
1977 * (or 2K blocks on 31-bit)
1978 * - the scope of a ccw and it's idal ends with the track boundaries
1980 idaws
= (unsigned long *) (cqr
->data
+ sizeof(struct PFX_eckd_data
));
1984 len_to_track_end
= 0;
1987 rq_for_each_segment(bv
, req
, iter
) {
1988 dst
= page_address(bv
->bv_page
) + bv
->bv_offset
;
1989 seg_len
= bv
->bv_len
;
1993 recoffs
= sector_div(trkid
, blk_per_trk
);
1994 count_to_trk_end
= blk_per_trk
- recoffs
;
1995 count
= min((last_rec
- recid
+ 1),
1996 (sector_t
)count_to_trk_end
);
1997 len_to_track_end
= count
* blksize
;
1998 ccw
[-1].flags
|= CCW_FLAG_CC
;
1999 ccw
->cmd_code
= cmd
;
2000 ccw
->count
= len_to_track_end
;
2001 ccw
->cda
= (__u32
)(addr_t
)idaws
;
2002 ccw
->flags
= CCW_FLAG_IDA
;
2006 /* first idaw for a ccw may start anywhere */
2010 /* If we start a new idaw, we must make sure that it
2011 * starts on an IDA_BLOCK_SIZE boundary.
2012 * If we continue an idaw, we must make sure that the
2013 * current segment begins where the so far accumulated
2017 if (__pa(dst
) & (IDA_BLOCK_SIZE
-1)) {
2018 dasd_sfree_request(cqr
, startdev
);
2019 return ERR_PTR(-ERANGE
);
2023 if ((idaw_dst
+ idaw_len
) != dst
) {
2024 dasd_sfree_request(cqr
, startdev
);
2025 return ERR_PTR(-ERANGE
);
2027 part_len
= min(seg_len
, len_to_track_end
);
2028 seg_len
-= part_len
;
2030 idaw_len
+= part_len
;
2031 len_to_track_end
-= part_len
;
2032 /* collected memory area ends on an IDA_BLOCK border,
2034 * idal_create_words will handle cases where idaw_len
2035 * is larger then IDA_BLOCK_SIZE
2037 if (!(__pa(idaw_dst
+ idaw_len
) & (IDA_BLOCK_SIZE
-1)))
2039 /* We also need to end the idaw at track end */
2040 if (!len_to_track_end
) {
2045 idaws
= idal_create_words(idaws
, idaw_dst
,
2054 if (blk_noretry_request(req
) ||
2055 block
->base
->features
& DASD_FEATURE_FAILFAST
)
2056 set_bit(DASD_CQR_FLAGS_FAILFAST
, &cqr
->flags
);
2057 cqr
->startdev
= startdev
;
2058 cqr
->memdev
= startdev
;
2060 cqr
->expires
= 5 * 60 * HZ
; /* 5 minutes */
2061 cqr
->lpm
= private->path_data
.ppm
;
2063 cqr
->buildclk
= get_clock();
2064 cqr
->status
= DASD_CQR_FILLED
;
2068 static int prepare_itcw(struct itcw
*itcw
,
2069 unsigned int trk
, unsigned int totrk
, int cmd
,
2070 struct dasd_device
*basedev
,
2071 struct dasd_device
*startdev
,
2072 unsigned int rec_on_trk
, int count
,
2073 unsigned int blksize
,
2074 unsigned int total_data_size
,
2076 unsigned int blk_per_trk
)
2078 struct PFX_eckd_data pfxdata
;
2079 struct dasd_eckd_private
*basepriv
, *startpriv
;
2080 struct DE_eckd_data
*dedata
;
2081 struct LRE_eckd_data
*lredata
;
2085 u16 heads
, beghead
, endhead
;
2093 /* setup prefix data */
2094 basepriv
= (struct dasd_eckd_private
*) basedev
->private;
2095 startpriv
= (struct dasd_eckd_private
*) startdev
->private;
2096 dedata
= &pfxdata
.define_extent
;
2097 lredata
= &pfxdata
.locate_record
;
2099 memset(&pfxdata
, 0, sizeof(pfxdata
));
2100 pfxdata
.format
= 1; /* PFX with LRE */
2101 pfxdata
.base_address
= basepriv
->ned
->unit_addr
;
2102 pfxdata
.base_lss
= basepriv
->ned
->ID
;
2103 pfxdata
.validity
.define_extent
= 1;
2105 /* private uid is kept up to date, conf_data may be outdated */
2106 if (startpriv
->uid
.type
!= UA_BASE_DEVICE
) {
2107 pfxdata
.validity
.verify_base
= 1;
2108 if (startpriv
->uid
.type
== UA_HYPER_PAV_ALIAS
)
2109 pfxdata
.validity
.hyper_pav
= 1;
2113 case DASD_ECKD_CCW_READ_TRACK_DATA
:
2114 dedata
->mask
.perm
= 0x1;
2115 dedata
->attributes
.operation
= basepriv
->attrib
.operation
;
2116 dedata
->blk_size
= blksize
;
2117 dedata
->ga_extended
|= 0x42;
2118 lredata
->operation
.orientation
= 0x0;
2119 lredata
->operation
.operation
= 0x0C;
2120 lredata
->auxiliary
.check_bytes
= 0x01;
2121 pfx_cmd
= DASD_ECKD_CCW_PFX_READ
;
2123 case DASD_ECKD_CCW_WRITE_TRACK_DATA
:
2124 dedata
->mask
.perm
= 0x02;
2125 dedata
->attributes
.operation
= basepriv
->attrib
.operation
;
2126 dedata
->blk_size
= blksize
;
2127 rc
= check_XRC_on_prefix(&pfxdata
, basedev
);
2128 dedata
->ga_extended
|= 0x42;
2129 lredata
->operation
.orientation
= 0x0;
2130 lredata
->operation
.operation
= 0x3F;
2131 lredata
->extended_operation
= 0x23;
2132 lredata
->auxiliary
.check_bytes
= 0x2;
2133 pfx_cmd
= DASD_ECKD_CCW_PFX
;
2136 DBF_DEV_EVENT(DBF_ERR
, basedev
,
2137 "prepare itcw, unknown opcode 0x%x", cmd
);
2144 dedata
->attributes
.mode
= 0x3; /* ECKD */
2146 heads
= basepriv
->rdc_data
.trk_per_cyl
;
2147 begcyl
= trk
/ heads
;
2148 beghead
= trk
% heads
;
2149 endcyl
= totrk
/ heads
;
2150 endhead
= totrk
% heads
;
2152 /* check for sequential prestage - enhance cylinder range */
2153 if (dedata
->attributes
.operation
== DASD_SEQ_PRESTAGE
||
2154 dedata
->attributes
.operation
== DASD_SEQ_ACCESS
) {
2156 if (endcyl
+ basepriv
->attrib
.nr_cyl
< basepriv
->real_cyl
)
2157 endcyl
+= basepriv
->attrib
.nr_cyl
;
2159 endcyl
= (basepriv
->real_cyl
- 1);
2162 set_ch_t(&dedata
->beg_ext
, begcyl
, beghead
);
2163 set_ch_t(&dedata
->end_ext
, endcyl
, endhead
);
2165 dedata
->ep_format
= 0x20; /* records per track is valid */
2166 dedata
->ep_rec_per_track
= blk_per_trk
;
2169 switch (basepriv
->rdc_data
.dev_type
) {
2171 dn
= ceil_quot(blksize
+ 6, 232);
2172 d
= 9 + ceil_quot(blksize
+ 6 * (dn
+ 1), 34);
2173 sector
= (49 + (rec_on_trk
- 1) * (10 + d
)) / 8;
2176 d
= 7 + ceil_quot(blksize
+ 12, 32);
2177 sector
= (39 + (rec_on_trk
- 1) * (8 + d
)) / 7;
2182 lredata
->auxiliary
.length_valid
= 1;
2183 lredata
->auxiliary
.length_scope
= 1;
2184 lredata
->auxiliary
.imbedded_ccw_valid
= 1;
2185 lredata
->length
= tlf
;
2186 lredata
->imbedded_ccw
= cmd
;
2187 lredata
->count
= count
;
2188 lredata
->sector
= sector
;
2189 set_ch_t(&lredata
->seek_addr
, begcyl
, beghead
);
2190 lredata
->search_arg
.cyl
= lredata
->seek_addr
.cyl
;
2191 lredata
->search_arg
.head
= lredata
->seek_addr
.head
;
2192 lredata
->search_arg
.record
= rec_on_trk
;
2194 dcw
= itcw_add_dcw(itcw
, pfx_cmd
, 0,
2195 &pfxdata
, sizeof(pfxdata
), total_data_size
);
2200 static struct dasd_ccw_req
*dasd_eckd_build_cp_tpm_track(
2201 struct dasd_device
*startdev
,
2202 struct dasd_block
*block
,
2203 struct request
*req
,
2208 unsigned int first_offs
,
2209 unsigned int last_offs
,
2210 unsigned int blk_per_trk
,
2211 unsigned int blksize
)
2213 struct dasd_eckd_private
*private;
2214 struct dasd_ccw_req
*cqr
;
2215 struct req_iterator iter
;
2218 unsigned int trkcount
, ctidaw
;
2220 struct dasd_device
*basedev
;
2223 struct tidaw
*last_tidaw
= NULL
;
2227 basedev
= block
->base
;
2228 private = (struct dasd_eckd_private
*) basedev
->private;
2229 if (rq_data_dir(req
) == READ
) {
2230 cmd
= DASD_ECKD_CCW_READ_TRACK_DATA
;
2231 itcw_op
= ITCW_OP_READ
;
2232 } else if (rq_data_dir(req
) == WRITE
) {
2233 cmd
= DASD_ECKD_CCW_WRITE_TRACK_DATA
;
2234 itcw_op
= ITCW_OP_WRITE
;
2236 return ERR_PTR(-EINVAL
);
2238 /* trackbased I/O needs address all memory via TIDAWs,
2239 * not just for 64 bit addresses. This allows us to map
2240 * each segment directly to one tidaw.
2242 trkcount
= last_trk
- first_trk
+ 1;
2244 rq_for_each_segment(bv
, req
, iter
) {
2248 /* Allocate the ccw request. */
2249 itcw_size
= itcw_calc_size(0, ctidaw
, 0);
2250 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 0, itcw_size
, startdev
);
2255 cqr
->startdev
= startdev
;
2256 cqr
->memdev
= startdev
;
2258 cqr
->expires
= 100*HZ
;
2259 cqr
->buildclk
= get_clock();
2260 cqr
->status
= DASD_CQR_FILLED
;
2263 /* transfer length factor: how many bytes to read from the last track */
2264 if (first_trk
== last_trk
)
2265 tlf
= last_offs
- first_offs
+ 1;
2267 tlf
= last_offs
+ 1;
2270 itcw
= itcw_init(cqr
->data
, itcw_size
, itcw_op
, 0, ctidaw
, 0);
2271 cqr
->cpaddr
= itcw_get_tcw(itcw
);
2273 if (prepare_itcw(itcw
, first_trk
, last_trk
,
2274 cmd
, basedev
, startdev
,
2277 (last_rec
- first_rec
+ 1) * blksize
,
2278 tlf
, blk_per_trk
) == -EAGAIN
) {
2279 /* Clock not in sync and XRC is enabled.
2282 dasd_sfree_request(cqr
, startdev
);
2283 return ERR_PTR(-EAGAIN
);
2287 * A tidaw can address 4k of memory, but must not cross page boundaries
2288 * We can let the block layer handle this by setting
2289 * blk_queue_segment_boundary to page boundaries and
2290 * blk_max_segment_size to page size when setting up the request queue.
2292 rq_for_each_segment(bv
, req
, iter
) {
2293 dst
= page_address(bv
->bv_page
) + bv
->bv_offset
;
2294 last_tidaw
= itcw_add_tidaw(itcw
, 0x00, dst
, bv
->bv_len
);
2295 if (IS_ERR(last_tidaw
))
2296 return (struct dasd_ccw_req
*)last_tidaw
;
2299 last_tidaw
->flags
|= 0x80;
2300 itcw_finalize(itcw
);
2302 if (blk_noretry_request(req
) ||
2303 block
->base
->features
& DASD_FEATURE_FAILFAST
)
2304 set_bit(DASD_CQR_FLAGS_FAILFAST
, &cqr
->flags
);
2305 cqr
->startdev
= startdev
;
2306 cqr
->memdev
= startdev
;
2308 cqr
->expires
= 5 * 60 * HZ
; /* 5 minutes */
2309 cqr
->lpm
= private->path_data
.ppm
;
2311 cqr
->buildclk
= get_clock();
2312 cqr
->status
= DASD_CQR_FILLED
;
2316 static struct dasd_ccw_req
*dasd_eckd_build_cp(struct dasd_device
*startdev
,
2317 struct dasd_block
*block
,
2318 struct request
*req
)
2320 int tpm
, cmdrtd
, cmdwtd
;
2322 #if defined(CONFIG_64BIT)
2323 int fcx_in_css
, fcx_in_gneq
, fcx_in_features
;
2325 struct dasd_eckd_private
*private;
2326 struct dasd_device
*basedev
;
2327 sector_t first_rec
, last_rec
;
2328 sector_t first_trk
, last_trk
;
2329 unsigned int first_offs
, last_offs
;
2330 unsigned int blk_per_trk
, blksize
;
2332 struct dasd_ccw_req
*cqr
;
2334 basedev
= block
->base
;
2335 private = (struct dasd_eckd_private
*) basedev
->private;
2337 /* Calculate number of blocks/records per track. */
2338 blksize
= block
->bp_block
;
2339 blk_per_trk
= recs_per_track(&private->rdc_data
, 0, blksize
);
2340 /* Calculate record id of first and last block. */
2341 first_rec
= first_trk
= blk_rq_pos(req
) >> block
->s2b_shift
;
2342 first_offs
= sector_div(first_trk
, blk_per_trk
);
2343 last_rec
= last_trk
=
2344 (blk_rq_pos(req
) + blk_rq_sectors(req
) - 1) >> block
->s2b_shift
;
2345 last_offs
= sector_div(last_trk
, blk_per_trk
);
2346 cdlspecial
= (private->uses_cdl
&& first_rec
< 2*blk_per_trk
);
2348 /* is transport mode supported? */
2349 #if defined(CONFIG_64BIT)
2350 fcx_in_css
= css_general_characteristics
.fcx
;
2351 fcx_in_gneq
= private->gneq
->reserved2
[7] & 0x04;
2352 fcx_in_features
= private->features
.feature
[40] & 0x80;
2353 tpm
= fcx_in_css
&& fcx_in_gneq
&& fcx_in_features
;
2358 /* is read track data and write track data in command mode supported? */
2359 cmdrtd
= private->features
.feature
[9] & 0x20;
2360 cmdwtd
= private->features
.feature
[12] & 0x40;
2361 use_prefix
= private->features
.feature
[8] & 0x01;
2364 if (cdlspecial
|| dasd_page_cache
) {
2365 /* do nothing, just fall through to the cmd mode single case */
2366 } else if (!dasd_nofcx
&& tpm
&& (first_trk
== last_trk
)) {
2367 cqr
= dasd_eckd_build_cp_tpm_track(startdev
, block
, req
,
2368 first_rec
, last_rec
,
2369 first_trk
, last_trk
,
2370 first_offs
, last_offs
,
2371 blk_per_trk
, blksize
);
2372 if (IS_ERR(cqr
) && PTR_ERR(cqr
) != -EAGAIN
)
2374 } else if (use_prefix
&&
2375 (((rq_data_dir(req
) == READ
) && cmdrtd
) ||
2376 ((rq_data_dir(req
) == WRITE
) && cmdwtd
))) {
2377 cqr
= dasd_eckd_build_cp_cmd_track(startdev
, block
, req
,
2378 first_rec
, last_rec
,
2379 first_trk
, last_trk
,
2380 first_offs
, last_offs
,
2381 blk_per_trk
, blksize
);
2382 if (IS_ERR(cqr
) && PTR_ERR(cqr
) != -EAGAIN
)
2386 cqr
= dasd_eckd_build_cp_cmd_single(startdev
, block
, req
,
2387 first_rec
, last_rec
,
2388 first_trk
, last_trk
,
2389 first_offs
, last_offs
,
2390 blk_per_trk
, blksize
);
2395 dasd_eckd_free_cp(struct dasd_ccw_req
*cqr
, struct request
*req
)
2397 struct dasd_eckd_private
*private;
2399 struct req_iterator iter
;
2402 unsigned int blksize
, blk_per_trk
, off
;
2406 if (!dasd_page_cache
)
2408 private = (struct dasd_eckd_private
*) cqr
->block
->base
->private;
2409 blksize
= cqr
->block
->bp_block
;
2410 blk_per_trk
= recs_per_track(&private->rdc_data
, 0, blksize
);
2411 recid
= blk_rq_pos(req
) >> cqr
->block
->s2b_shift
;
2413 /* Skip over define extent & locate record. */
2415 if (private->uses_cdl
== 0 || recid
> 2*blk_per_trk
)
2417 rq_for_each_segment(bv
, req
, iter
) {
2418 dst
= page_address(bv
->bv_page
) + bv
->bv_offset
;
2419 for (off
= 0; off
< bv
->bv_len
; off
+= blksize
) {
2420 /* Skip locate record. */
2421 if (private->uses_cdl
&& recid
<= 2*blk_per_trk
)
2424 if (ccw
->flags
& CCW_FLAG_IDA
)
2425 cda
= *((char **)((addr_t
) ccw
->cda
));
2427 cda
= (char *)((addr_t
) ccw
->cda
);
2429 if (rq_data_dir(req
) == READ
)
2430 memcpy(dst
, cda
, bv
->bv_len
);
2431 kmem_cache_free(dasd_page_cache
,
2432 (void *)((addr_t
)cda
& PAGE_MASK
));
2441 status
= cqr
->status
== DASD_CQR_DONE
;
2442 dasd_sfree_request(cqr
, cqr
->memdev
);
2447 * Modify ccw/tcw in cqr so it can be started on a base device.
2449 * Note that this is not enough to restart the cqr!
2450 * Either reset cqr->startdev as well (summary unit check handling)
2451 * or restart via separate cqr (as in ERP handling).
2453 void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req
*cqr
)
2456 struct PFX_eckd_data
*pfxdata
;
2461 if (cqr
->cpmode
== 1) {
2463 tccb
= tcw_get_tccb(tcw
);
2464 dcw
= (struct dcw
*)&tccb
->tca
[0];
2465 pfxdata
= (struct PFX_eckd_data
*)&dcw
->cd
[0];
2466 pfxdata
->validity
.verify_base
= 0;
2467 pfxdata
->validity
.hyper_pav
= 0;
2470 pfxdata
= cqr
->data
;
2471 if (ccw
->cmd_code
== DASD_ECKD_CCW_PFX
) {
2472 pfxdata
->validity
.verify_base
= 0;
2473 pfxdata
->validity
.hyper_pav
= 0;
2478 #define DASD_ECKD_CHANQ_MAX_SIZE 4
2480 static struct dasd_ccw_req
*dasd_eckd_build_alias_cp(struct dasd_device
*base
,
2481 struct dasd_block
*block
,
2482 struct request
*req
)
2484 struct dasd_eckd_private
*private;
2485 struct dasd_device
*startdev
;
2486 unsigned long flags
;
2487 struct dasd_ccw_req
*cqr
;
2489 startdev
= dasd_alias_get_start_dev(base
);
2492 private = (struct dasd_eckd_private
*) startdev
->private;
2493 if (private->count
>= DASD_ECKD_CHANQ_MAX_SIZE
)
2494 return ERR_PTR(-EBUSY
);
2496 spin_lock_irqsave(get_ccwdev_lock(startdev
->cdev
), flags
);
2498 cqr
= dasd_eckd_build_cp(startdev
, block
, req
);
2501 spin_unlock_irqrestore(get_ccwdev_lock(startdev
->cdev
), flags
);
2505 static int dasd_eckd_free_alias_cp(struct dasd_ccw_req
*cqr
,
2506 struct request
*req
)
2508 struct dasd_eckd_private
*private;
2509 unsigned long flags
;
2511 spin_lock_irqsave(get_ccwdev_lock(cqr
->memdev
->cdev
), flags
);
2512 private = (struct dasd_eckd_private
*) cqr
->memdev
->private;
2514 spin_unlock_irqrestore(get_ccwdev_lock(cqr
->memdev
->cdev
), flags
);
2515 return dasd_eckd_free_cp(cqr
, req
);
2519 dasd_eckd_fill_info(struct dasd_device
* device
,
2520 struct dasd_information2_t
* info
)
2522 struct dasd_eckd_private
*private;
2524 private = (struct dasd_eckd_private
*) device
->private;
2525 info
->label_block
= 2;
2526 info
->FBA_layout
= private->uses_cdl
? 0 : 1;
2527 info
->format
= private->uses_cdl
? DASD_FORMAT_CDL
: DASD_FORMAT_LDL
;
2528 info
->characteristics_size
= sizeof(struct dasd_eckd_characteristics
);
2529 memcpy(info
->characteristics
, &private->rdc_data
,
2530 sizeof(struct dasd_eckd_characteristics
));
2531 info
->confdata_size
= min((unsigned long)private->conf_len
,
2532 sizeof(info
->configuration_data
));
2533 memcpy(info
->configuration_data
, private->conf_data
,
2534 info
->confdata_size
);
2539 * SECTION: ioctl functions for eckd devices.
2543 * Release device ioctl.
2544 * Buils a channel programm to releases a prior reserved
2545 * (see dasd_eckd_reserve) device.
2548 dasd_eckd_release(struct dasd_device
*device
)
2550 struct dasd_ccw_req
*cqr
;
2554 if (!capable(CAP_SYS_ADMIN
))
2557 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 1, 32, device
);
2559 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2560 "Could not allocate initialization request");
2561 return PTR_ERR(cqr
);
2564 ccw
->cmd_code
= DASD_ECKD_CCW_RELEASE
;
2565 ccw
->flags
|= CCW_FLAG_SLI
;
2567 ccw
->cda
= (__u32
)(addr_t
) cqr
->data
;
2568 cqr
->startdev
= device
;
2569 cqr
->memdev
= device
;
2570 clear_bit(DASD_CQR_FLAGS_USE_ERP
, &cqr
->flags
);
2571 set_bit(DASD_CQR_FLAGS_FAILFAST
, &cqr
->flags
);
2572 cqr
->retries
= 2; /* set retry counter to enable basic ERP */
2573 cqr
->expires
= 2 * HZ
;
2574 cqr
->buildclk
= get_clock();
2575 cqr
->status
= DASD_CQR_FILLED
;
2577 rc
= dasd_sleep_on_immediatly(cqr
);
2579 dasd_sfree_request(cqr
, cqr
->memdev
);
2584 * Reserve device ioctl.
2585 * Options are set to 'synchronous wait for interrupt' and
2586 * 'timeout the request'. This leads to a terminate IO if
2587 * the interrupt is outstanding for a certain time.
2590 dasd_eckd_reserve(struct dasd_device
*device
)
2592 struct dasd_ccw_req
*cqr
;
2596 if (!capable(CAP_SYS_ADMIN
))
2599 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 1, 32, device
);
2601 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2602 "Could not allocate initialization request");
2603 return PTR_ERR(cqr
);
2606 ccw
->cmd_code
= DASD_ECKD_CCW_RESERVE
;
2607 ccw
->flags
|= CCW_FLAG_SLI
;
2609 ccw
->cda
= (__u32
)(addr_t
) cqr
->data
;
2610 cqr
->startdev
= device
;
2611 cqr
->memdev
= device
;
2612 clear_bit(DASD_CQR_FLAGS_USE_ERP
, &cqr
->flags
);
2613 set_bit(DASD_CQR_FLAGS_FAILFAST
, &cqr
->flags
);
2614 cqr
->retries
= 2; /* set retry counter to enable basic ERP */
2615 cqr
->expires
= 2 * HZ
;
2616 cqr
->buildclk
= get_clock();
2617 cqr
->status
= DASD_CQR_FILLED
;
2619 rc
= dasd_sleep_on_immediatly(cqr
);
2621 dasd_sfree_request(cqr
, cqr
->memdev
);
2626 * Steal lock ioctl - unconditional reserve device.
2627 * Buils a channel programm to break a device's reservation.
2628 * (unconditional reserve)
2631 dasd_eckd_steal_lock(struct dasd_device
*device
)
2633 struct dasd_ccw_req
*cqr
;
2637 if (!capable(CAP_SYS_ADMIN
))
2640 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 1, 32, device
);
2642 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2643 "Could not allocate initialization request");
2644 return PTR_ERR(cqr
);
2647 ccw
->cmd_code
= DASD_ECKD_CCW_SLCK
;
2648 ccw
->flags
|= CCW_FLAG_SLI
;
2650 ccw
->cda
= (__u32
)(addr_t
) cqr
->data
;
2651 cqr
->startdev
= device
;
2652 cqr
->memdev
= device
;
2653 clear_bit(DASD_CQR_FLAGS_USE_ERP
, &cqr
->flags
);
2654 set_bit(DASD_CQR_FLAGS_FAILFAST
, &cqr
->flags
);
2655 cqr
->retries
= 2; /* set retry counter to enable basic ERP */
2656 cqr
->expires
= 2 * HZ
;
2657 cqr
->buildclk
= get_clock();
2658 cqr
->status
= DASD_CQR_FILLED
;
2660 rc
= dasd_sleep_on_immediatly(cqr
);
2662 dasd_sfree_request(cqr
, cqr
->memdev
);
2667 * Read performance statistics
2670 dasd_eckd_performance(struct dasd_device
*device
, void __user
*argp
)
2672 struct dasd_psf_prssd_data
*prssdp
;
2673 struct dasd_rssd_perf_stats_t
*stats
;
2674 struct dasd_ccw_req
*cqr
;
2678 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 1 /* PSF */ + 1 /* RSSD */,
2679 (sizeof(struct dasd_psf_prssd_data
) +
2680 sizeof(struct dasd_rssd_perf_stats_t
)),
2683 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2684 "Could not allocate initialization request");
2685 return PTR_ERR(cqr
);
2687 cqr
->startdev
= device
;
2688 cqr
->memdev
= device
;
2690 cqr
->expires
= 10 * HZ
;
2692 /* Prepare for Read Subsystem Data */
2693 prssdp
= (struct dasd_psf_prssd_data
*) cqr
->data
;
2694 memset(prssdp
, 0, sizeof(struct dasd_psf_prssd_data
));
2695 prssdp
->order
= PSF_ORDER_PRSSD
;
2696 prssdp
->suborder
= 0x01; /* Performance Statistics */
2697 prssdp
->varies
[1] = 0x01; /* Perf Statistics for the Subsystem */
2700 ccw
->cmd_code
= DASD_ECKD_CCW_PSF
;
2701 ccw
->count
= sizeof(struct dasd_psf_prssd_data
);
2702 ccw
->flags
|= CCW_FLAG_CC
;
2703 ccw
->cda
= (__u32
)(addr_t
) prssdp
;
2705 /* Read Subsystem Data - Performance Statistics */
2706 stats
= (struct dasd_rssd_perf_stats_t
*) (prssdp
+ 1);
2707 memset(stats
, 0, sizeof(struct dasd_rssd_perf_stats_t
));
2710 ccw
->cmd_code
= DASD_ECKD_CCW_RSSD
;
2711 ccw
->count
= sizeof(struct dasd_rssd_perf_stats_t
);
2712 ccw
->cda
= (__u32
)(addr_t
) stats
;
2714 cqr
->buildclk
= get_clock();
2715 cqr
->status
= DASD_CQR_FILLED
;
2716 rc
= dasd_sleep_on(cqr
);
2718 prssdp
= (struct dasd_psf_prssd_data
*) cqr
->data
;
2719 stats
= (struct dasd_rssd_perf_stats_t
*) (prssdp
+ 1);
2720 if (copy_to_user(argp
, stats
,
2721 sizeof(struct dasd_rssd_perf_stats_t
)))
2724 dasd_sfree_request(cqr
, cqr
->memdev
);
2729 * Get attributes (cache operations)
2730 * Returnes the cache attributes used in Define Extend (DE).
2733 dasd_eckd_get_attrib(struct dasd_device
*device
, void __user
*argp
)
2735 struct dasd_eckd_private
*private =
2736 (struct dasd_eckd_private
*)device
->private;
2737 struct attrib_data_t attrib
= private->attrib
;
2740 if (!capable(CAP_SYS_ADMIN
))
2746 if (copy_to_user(argp
, (long *) &attrib
,
2747 sizeof(struct attrib_data_t
)))
2754 * Set attributes (cache operations)
2755 * Stores the attributes for cache operation to be used in Define Extend (DE).
2758 dasd_eckd_set_attrib(struct dasd_device
*device
, void __user
*argp
)
2760 struct dasd_eckd_private
*private =
2761 (struct dasd_eckd_private
*)device
->private;
2762 struct attrib_data_t attrib
;
2764 if (!capable(CAP_SYS_ADMIN
))
2769 if (copy_from_user(&attrib
, argp
, sizeof(struct attrib_data_t
)))
2771 private->attrib
= attrib
;
2773 dev_info(&device
->cdev
->dev
,
2774 "The DASD cache mode was set to %x (%i cylinder prestage)\n",
2775 private->attrib
.operation
, private->attrib
.nr_cyl
);
2780 * Issue syscall I/O to EMC Symmetrix array.
2781 * CCWs are PSF and RSSD
2783 static int dasd_symm_io(struct dasd_device
*device
, void __user
*argp
)
2785 struct dasd_symmio_parms usrparm
;
2786 char *psf_data
, *rssd_result
;
2787 struct dasd_ccw_req
*cqr
;
2791 /* Copy parms from caller */
2793 if (copy_from_user(&usrparm
, argp
, sizeof(usrparm
)))
2795 #ifndef CONFIG_64BIT
2796 /* Make sure pointers are sane even on 31 bit. */
2797 if ((usrparm
.psf_data
>> 32) != 0 || (usrparm
.rssd_result
>> 32) != 0) {
2802 /* alloc I/O data area */
2803 psf_data
= kzalloc(usrparm
.psf_data_len
, GFP_KERNEL
| GFP_DMA
);
2804 rssd_result
= kzalloc(usrparm
.rssd_result_len
, GFP_KERNEL
| GFP_DMA
);
2805 if (!psf_data
|| !rssd_result
) {
2810 /* get syscall header from user space */
2812 if (copy_from_user(psf_data
,
2813 (void __user
*)(unsigned long) usrparm
.psf_data
,
2814 usrparm
.psf_data_len
))
2817 /* sanity check on syscall header */
2818 if (psf_data
[0] != 0x17 && psf_data
[1] != 0xce) {
2823 /* setup CCWs for PSF + RSSD */
2824 cqr
= dasd_smalloc_request(DASD_ECKD_MAGIC
, 2 , 0, device
);
2826 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2827 "Could not allocate initialization request");
2832 cqr
->startdev
= device
;
2833 cqr
->memdev
= device
;
2835 cqr
->expires
= 10 * HZ
;
2836 cqr
->buildclk
= get_clock();
2837 cqr
->status
= DASD_CQR_FILLED
;
2839 /* Build the ccws */
2843 ccw
->cmd_code
= DASD_ECKD_CCW_PSF
;
2844 ccw
->count
= usrparm
.psf_data_len
;
2845 ccw
->flags
|= CCW_FLAG_CC
;
2846 ccw
->cda
= (__u32
)(addr_t
) psf_data
;
2851 ccw
->cmd_code
= DASD_ECKD_CCW_RSSD
;
2852 ccw
->count
= usrparm
.rssd_result_len
;
2853 ccw
->flags
= CCW_FLAG_SLI
;
2854 ccw
->cda
= (__u32
)(addr_t
) rssd_result
;
2856 rc
= dasd_sleep_on(cqr
);
2861 if (copy_to_user((void __user
*)(unsigned long) usrparm
.rssd_result
,
2862 rssd_result
, usrparm
.rssd_result_len
))
2867 dasd_sfree_request(cqr
, cqr
->memdev
);
2872 DBF_DEV_EVENT(DBF_WARNING
, device
, "Symmetrix ioctl: rc=%d", rc
);
2877 dasd_eckd_ioctl(struct dasd_block
*block
, unsigned int cmd
, void __user
*argp
)
2879 struct dasd_device
*device
= block
->base
;
2883 return dasd_eckd_get_attrib(device
, argp
);
2885 return dasd_eckd_set_attrib(device
, argp
);
2887 return dasd_eckd_performance(device
, argp
);
2889 return dasd_eckd_release(device
);
2891 return dasd_eckd_reserve(device
);
2893 return dasd_eckd_steal_lock(device
);
2895 return dasd_symm_io(device
, argp
);
2897 return -ENOIOCTLCMD
;
2902 * Dump the range of CCWs into 'page' buffer
2903 * and return number of printed chars.
2906 dasd_eckd_dump_ccw_range(struct ccw1
*from
, struct ccw1
*to
, char *page
)
2912 while (from
<= to
) {
2913 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
2914 " CCW %p: %08X %08X DAT:",
2915 from
, ((int *) from
)[0], ((int *) from
)[1]);
2917 /* get pointer to data (consider IDALs) */
2918 if (from
->flags
& CCW_FLAG_IDA
)
2919 datap
= (char *) *((addr_t
*) (addr_t
) from
->cda
);
2921 datap
= (char *) ((addr_t
) from
->cda
);
2923 /* dump data (max 32 bytes) */
2924 for (count
= 0; count
< from
->count
&& count
< 32; count
++) {
2925 if (count
% 8 == 0) len
+= sprintf(page
+ len
, " ");
2926 if (count
% 4 == 0) len
+= sprintf(page
+ len
, " ");
2927 len
+= sprintf(page
+ len
, "%02x", datap
[count
]);
2929 len
+= sprintf(page
+ len
, "\n");
2936 dasd_eckd_dump_sense_dbf(struct dasd_device
*device
, struct irb
*irb
,
2941 sense
= (u64
*) dasd_get_sense(irb
);
2943 DBF_DEV_EVENT(DBF_EMERG
, device
,
2944 "%s: %s %02x%02x%02x %016llx %016llx %016llx "
2946 scsw_is_tm(&irb
->scsw
) ? "t" : "c",
2947 scsw_cc(&irb
->scsw
), scsw_cstat(&irb
->scsw
),
2948 scsw_dstat(&irb
->scsw
), sense
[0], sense
[1],
2949 sense
[2], sense
[3]);
2951 DBF_DEV_EVENT(DBF_EMERG
, device
, "%s",
2952 "SORRY - NO VALID SENSE AVAILABLE\n");
2957 * Print sense data and related channel program.
2958 * Parts are printed because printk buffer is only 1024 bytes.
2960 static void dasd_eckd_dump_sense_ccw(struct dasd_device
*device
,
2961 struct dasd_ccw_req
*req
, struct irb
*irb
)
2964 struct ccw1
*first
, *last
, *fail
, *from
, *to
;
2967 page
= (char *) get_zeroed_page(GFP_ATOMIC
);
2969 DBF_DEV_EVENT(DBF_WARNING
, device
, "%s",
2970 "No memory to dump sense data\n");
2973 /* dump the sense data */
2974 len
= sprintf(page
, KERN_ERR PRINTK_HEADER
2975 " I/O status report for device %s:\n",
2976 dev_name(&device
->cdev
->dev
));
2977 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
2978 " in req: %p CS: 0x%02X DS: 0x%02X CC: 0x%02X RC: %d\n",
2979 req
, scsw_cstat(&irb
->scsw
), scsw_dstat(&irb
->scsw
),
2980 scsw_cc(&irb
->scsw
), req
->intrc
);
2981 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
2982 " device %s: Failing CCW: %p\n",
2983 dev_name(&device
->cdev
->dev
),
2984 (void *) (addr_t
) irb
->scsw
.cmd
.cpa
);
2985 if (irb
->esw
.esw0
.erw
.cons
) {
2986 for (sl
= 0; sl
< 4; sl
++) {
2987 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
2988 " Sense(hex) %2d-%2d:",
2989 (8 * sl
), ((8 * sl
) + 7));
2991 for (sct
= 0; sct
< 8; sct
++) {
2992 len
+= sprintf(page
+ len
, " %02x",
2993 irb
->ecw
[8 * sl
+ sct
]);
2995 len
+= sprintf(page
+ len
, "\n");
2998 if (irb
->ecw
[27] & DASD_SENSE_BIT_0
) {
2999 /* 24 Byte Sense Data */
3000 sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3001 " 24 Byte: %x MSG %x, "
3002 "%s MSGb to SYSOP\n",
3003 irb
->ecw
[7] >> 4, irb
->ecw
[7] & 0x0f,
3004 irb
->ecw
[1] & 0x10 ? "" : "no");
3006 /* 32 Byte Sense Data */
3007 sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3008 " 32 Byte: Format: %x "
3009 "Exception class %x\n",
3010 irb
->ecw
[6] & 0x0f, irb
->ecw
[22] >> 4);
3013 sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3014 " SORRY - NO VALID SENSE AVAILABLE\n");
3019 /* req == NULL for unsolicited interrupts */
3020 /* dump the Channel Program (max 140 Bytes per line) */
3021 /* Count CCW and print first CCWs (maximum 1024 % 140 = 7) */
3022 first
= req
->cpaddr
;
3023 for (last
= first
; last
->flags
& (CCW_FLAG_CC
| CCW_FLAG_DC
); last
++);
3024 to
= min(first
+ 6, last
);
3025 len
= sprintf(page
, KERN_ERR PRINTK_HEADER
3026 " Related CP in req: %p\n", req
);
3027 dasd_eckd_dump_ccw_range(first
, to
, page
+ len
);
3030 /* print failing CCW area (maximum 4) */
3031 /* scsw->cda is either valid or zero */
3034 fail
= (struct ccw1
*)(addr_t
)
3035 irb
->scsw
.cmd
.cpa
; /* failing CCW */
3036 if (from
< fail
- 2) {
3037 from
= fail
- 2; /* there is a gap - print header */
3038 len
+= sprintf(page
, KERN_ERR PRINTK_HEADER
"......\n");
3040 to
= min(fail
+ 1, last
);
3041 len
+= dasd_eckd_dump_ccw_range(from
, to
, page
+ len
);
3043 /* print last CCWs (maximum 2) */
3044 from
= max(from
, ++to
);
3045 if (from
< last
- 1) {
3046 from
= last
- 1; /* there is a gap - print header */
3047 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
"......\n");
3049 len
+= dasd_eckd_dump_ccw_range(from
, last
, page
+ len
);
3053 free_page((unsigned long) page
);
3058 * Print sense data from a tcw.
3060 static void dasd_eckd_dump_sense_tcw(struct dasd_device
*device
,
3061 struct dasd_ccw_req
*req
, struct irb
*irb
)
3064 int len
, sl
, sct
, residual
;
3070 page
= (char *) get_zeroed_page(GFP_ATOMIC
);
3072 DBF_DEV_EVENT(DBF_WARNING
, device
, " %s",
3073 "No memory to dump sense data");
3076 /* dump the sense data */
3077 len
= sprintf(page
, KERN_ERR PRINTK_HEADER
3078 " I/O status report for device %s:\n",
3079 dev_name(&device
->cdev
->dev
));
3080 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3081 " in req: %p CS: 0x%02X DS: 0x%02X CC: 0x%02X RC: %d "
3082 "fcxs: 0x%02X schxs: 0x%02X\n", req
,
3083 scsw_cstat(&irb
->scsw
), scsw_dstat(&irb
->scsw
),
3084 scsw_cc(&irb
->scsw
), req
->intrc
,
3085 irb
->scsw
.tm
.fcxs
, irb
->scsw
.tm
.schxs
);
3086 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3087 " device %s: Failing TCW: %p\n",
3088 dev_name(&device
->cdev
->dev
),
3089 (void *) (addr_t
) irb
->scsw
.tm
.tcw
);
3093 if (irb
->scsw
.tm
.tcw
)
3095 (struct tcw
*)(unsigned long)irb
->scsw
.tm
.tcw
);
3097 if (tsb
&& (irb
->scsw
.tm
.fcxs
== 0x01)) {
3098 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3099 " tsb->length %d\n", tsb
->length
);
3100 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3101 " tsb->flags %x\n", tsb
->flags
);
3102 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3103 " tsb->dcw_offset %d\n", tsb
->dcw_offset
);
3104 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3105 " tsb->count %d\n", tsb
->count
);
3106 residual
= tsb
->count
- 28;
3107 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3108 " residual %d\n", residual
);
3110 switch (tsb
->flags
& 0x07) {
3111 case 1: /* tsa_iostat */
3112 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3113 " tsb->tsa.iostat.dev_time %d\n",
3114 tsb
->tsa
.iostat
.dev_time
);
3115 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3116 " tsb->tsa.iostat.def_time %d\n",
3117 tsb
->tsa
.iostat
.def_time
);
3118 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3119 " tsb->tsa.iostat.queue_time %d\n",
3120 tsb
->tsa
.iostat
.queue_time
);
3121 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3122 " tsb->tsa.iostat.dev_busy_time %d\n",
3123 tsb
->tsa
.iostat
.dev_busy_time
);
3124 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3125 " tsb->tsa.iostat.dev_act_time %d\n",
3126 tsb
->tsa
.iostat
.dev_act_time
);
3127 sense
= tsb
->tsa
.iostat
.sense
;
3129 case 2: /* ts_ddpc */
3130 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3131 " tsb->tsa.ddpc.rc %d\n", tsb
->tsa
.ddpc
.rc
);
3132 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3133 " tsb->tsa.ddpc.rcq: ");
3134 for (sl
= 0; sl
< 16; sl
++) {
3135 for (sct
= 0; sct
< 8; sct
++) {
3136 len
+= sprintf(page
+ len
, " %02x",
3137 tsb
->tsa
.ddpc
.rcq
[sl
]);
3139 len
+= sprintf(page
+ len
, "\n");
3141 sense
= tsb
->tsa
.ddpc
.sense
;
3143 case 3: /* tsa_intrg */
3144 len
+= sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3145 " tsb->tsa.intrg.: not supportet yet \n");
3150 for (sl
= 0; sl
< 4; sl
++) {
3151 len
+= sprintf(page
+ len
,
3152 KERN_ERR PRINTK_HEADER
3153 " Sense(hex) %2d-%2d:",
3154 (8 * sl
), ((8 * sl
) + 7));
3155 for (sct
= 0; sct
< 8; sct
++) {
3156 len
+= sprintf(page
+ len
, " %02x",
3157 sense
[8 * sl
+ sct
]);
3159 len
+= sprintf(page
+ len
, "\n");
3162 if (sense
[27] & DASD_SENSE_BIT_0
) {
3163 /* 24 Byte Sense Data */
3164 sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3165 " 24 Byte: %x MSG %x, "
3166 "%s MSGb to SYSOP\n",
3167 sense
[7] >> 4, sense
[7] & 0x0f,
3168 sense
[1] & 0x10 ? "" : "no");
3170 /* 32 Byte Sense Data */
3171 sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3172 " 32 Byte: Format: %x "
3173 "Exception class %x\n",
3174 sense
[6] & 0x0f, sense
[22] >> 4);
3177 sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3178 " SORRY - NO VALID SENSE AVAILABLE\n");
3181 sprintf(page
+ len
, KERN_ERR PRINTK_HEADER
3182 " SORRY - NO TSB DATA AVAILABLE\n");
3185 free_page((unsigned long) page
);
3188 static void dasd_eckd_dump_sense(struct dasd_device
*device
,
3189 struct dasd_ccw_req
*req
, struct irb
*irb
)
3191 if (req
&& scsw_is_tm(&req
->irb
.scsw
))
3192 dasd_eckd_dump_sense_tcw(device
, req
, irb
);
3194 dasd_eckd_dump_sense_ccw(device
, req
, irb
);
3197 int dasd_eckd_pm_freeze(struct dasd_device
*device
)
3200 * the device should be disconnected from our LCU structure
3201 * on restore we will reconnect it and reread LCU specific
3202 * information like PAV support that might have changed
3204 dasd_alias_remove_device(device
);
3205 dasd_alias_disconnect_device_from_lcu(device
);
3210 int dasd_eckd_restore_device(struct dasd_device
*device
)
3212 struct dasd_eckd_private
*private;
3214 struct dasd_uid temp_uid
;
3216 private = (struct dasd_eckd_private
*) device
->private;
3218 /* Read Configuration Data */
3219 rc
= dasd_eckd_read_conf(device
);
3223 /* Generate device unique id and register in devmap */
3224 rc
= dasd_eckd_generate_uid(device
, &private->uid
);
3225 dasd_get_uid(device
->cdev
, &temp_uid
);
3226 if (memcmp(&private->uid
, &temp_uid
, sizeof(struct dasd_uid
)) != 0)
3227 dev_err(&device
->cdev
->dev
, "The UID of the DASD has changed\n");
3230 dasd_set_uid(device
->cdev
, &private->uid
);
3232 /* register lcu with alias handling, enable PAV if this is a new lcu */
3233 is_known
= dasd_alias_make_device_known_to_lcu(device
);
3238 rc
= dasd_eckd_validate_server(device
); /* will switch pav on */
3243 /* Read Feature Codes */
3244 rc
= dasd_eckd_read_features(device
);
3248 /* Read Device Characteristics */
3249 memset(&private->rdc_data
, 0, sizeof(private->rdc_data
));
3250 rc
= dasd_generic_read_dev_chars(device
, DASD_ECKD_MAGIC
,
3251 &private->rdc_data
, 64);
3253 DBF_EVENT(DBF_WARNING
,
3254 "Read device characteristics failed, rc=%d for "
3255 "device: %s", rc
, dev_name(&device
->cdev
->dev
));
3259 /* add device to alias management */
3260 dasd_alias_add_device(device
);
3268 static struct ccw_driver dasd_eckd_driver
= {
3269 .name
= "dasd-eckd",
3270 .owner
= THIS_MODULE
,
3271 .ids
= dasd_eckd_ids
,
3272 .probe
= dasd_eckd_probe
,
3273 .remove
= dasd_generic_remove
,
3274 .set_offline
= dasd_generic_set_offline
,
3275 .set_online
= dasd_eckd_set_online
,
3276 .notify
= dasd_generic_notify
,
3277 .freeze
= dasd_generic_pm_freeze
,
3278 .thaw
= dasd_generic_restore_device
,
3279 .restore
= dasd_generic_restore_device
,
3283 * max_blocks is dependent on the amount of storage that is available
3284 * in the static io buffer for each device. Currently each device has
3285 * 8192 bytes (=2 pages). For 64 bit one dasd_mchunkt_t structure has
3286 * 24 bytes, the struct dasd_ccw_req has 136 bytes and each block can use
3287 * up to 16 bytes (8 for the ccw and 8 for the idal pointer). In
3288 * addition we have one define extent ccw + 16 bytes of data and one
3289 * locate record ccw + 16 bytes of data. That makes:
3290 * (8192 - 24 - 136 - 8 - 16 - 8 - 16) / 16 = 499 blocks at maximum.
3291 * We want to fit two into the available memory so that we can immediately
3292 * start the next request if one finishes off. That makes 249.5 blocks
3293 * for one request. Give a little safety and the result is 240.
3295 static struct dasd_discipline dasd_eckd_discipline
= {
3296 .owner
= THIS_MODULE
,
3300 .check_device
= dasd_eckd_check_characteristics
,
3301 .uncheck_device
= dasd_eckd_uncheck_device
,
3302 .do_analysis
= dasd_eckd_do_analysis
,
3303 .ready_to_online
= dasd_eckd_ready_to_online
,
3304 .online_to_ready
= dasd_eckd_online_to_ready
,
3305 .fill_geometry
= dasd_eckd_fill_geometry
,
3306 .start_IO
= dasd_start_IO
,
3307 .term_IO
= dasd_term_IO
,
3308 .handle_terminated_request
= dasd_eckd_handle_terminated_request
,
3309 .format_device
= dasd_eckd_format_device
,
3310 .erp_action
= dasd_eckd_erp_action
,
3311 .erp_postaction
= dasd_eckd_erp_postaction
,
3312 .handle_unsolicited_interrupt
= dasd_eckd_handle_unsolicited_interrupt
,
3313 .build_cp
= dasd_eckd_build_alias_cp
,
3314 .free_cp
= dasd_eckd_free_alias_cp
,
3315 .dump_sense
= dasd_eckd_dump_sense
,
3316 .dump_sense_dbf
= dasd_eckd_dump_sense_dbf
,
3317 .fill_info
= dasd_eckd_fill_info
,
3318 .ioctl
= dasd_eckd_ioctl
,
3319 .freeze
= dasd_eckd_pm_freeze
,
3320 .restore
= dasd_eckd_restore_device
,
3324 dasd_eckd_init(void)
3328 ASCEBC(dasd_eckd_discipline
.ebcname
, 4);
3329 ret
= ccw_driver_register(&dasd_eckd_driver
);
3331 wait_for_device_probe();
3337 dasd_eckd_cleanup(void)
3339 ccw_driver_unregister(&dasd_eckd_driver
);
3342 module_init(dasd_eckd_init
);
3343 module_exit(dasd_eckd_cleanup
);