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 * (C) IBM Corporation, IBM Deutschland Entwicklung GmbH, 1999,2000
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 #include <linux/slab.h>
15 #include <linux/hdreg.h> /* HDIO_GETGEO */
16 #include <linux/bio.h>
17 #include <linux/module.h>
18 #include <linux/init.h>
20 #include <asm/debug.h>
21 #include <asm/idals.h>
22 #include <asm/ebcdic.h>
24 #include <asm/todclk.h>
25 #include <asm/uaccess.h>
27 #include <asm/ccwdev.h>
30 #include "dasd_eckd.h"
34 #endif /* PRINTK_HEADER */
35 #define PRINTK_HEADER "dasd(eckd):"
37 #define ECKD_C0(i) (i->home_bytes)
38 #define ECKD_F(i) (i->formula)
39 #define ECKD_F1(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f1):\
40 (i->factors.f_0x02.f1))
41 #define ECKD_F2(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f2):\
42 (i->factors.f_0x02.f2))
43 #define ECKD_F3(i) (ECKD_F(i)==0x01?(i->factors.f_0x01.f3):\
44 (i->factors.f_0x02.f3))
45 #define ECKD_F4(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f4):0)
46 #define ECKD_F5(i) (ECKD_F(i)==0x02?(i->factors.f_0x02.f5):0)
47 #define ECKD_F6(i) (i->factor6)
48 #define ECKD_F7(i) (i->factor7)
49 #define ECKD_F8(i) (i->factor8)
51 MODULE_LICENSE("GPL");
53 static struct dasd_discipline dasd_eckd_discipline;
55 /* The ccw bus type uses this table to find devices that it sends to
57 static struct ccw_device_id dasd_eckd_ids[] = {
58 { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), .driver_info = 0x1},
59 { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), .driver_info = 0x2},
60 { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3390, 0), .driver_info = 0x3},
61 { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), .driver_info = 0x4},
62 { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), .driver_info = 0x5},
63 { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), .driver_info = 0x6},
64 { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3390, 0), .driver_info = 0x7},
65 { CCW_DEVICE_DEVTYPE (0x2107, 0, 0x3380, 0), .driver_info = 0x8},
66 { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3390, 0), .driver_info = 0x9},
67 { CCW_DEVICE_DEVTYPE (0x1750, 0, 0x3380, 0), .driver_info = 0xa},
68 { /* end of list */ },
71 MODULE_DEVICE_TABLE(ccw, dasd_eckd_ids);
73 static struct ccw_driver dasd_eckd_driver; /* see below */
75 /* initial attempt at a probe function. this can be simplified once
76 * the other detection code is gone */
78 dasd_eckd_probe (struct ccw_device *cdev)
82 /* set ECKD specific ccw-device options */
83 ret = ccw_device_set_options(cdev, CCWDEV_ALLOW_FORCE);
86 "dasd_eckd_probe: could not set ccw-device options "
87 "for %s\n", cdev->dev.bus_id);
90 ret = dasd_generic_probe(cdev, &dasd_eckd_discipline);
95 dasd_eckd_set_online(struct ccw_device *cdev)
97 return dasd_generic_set_online(cdev, &dasd_eckd_discipline);
100 static struct ccw_driver dasd_eckd_driver = {
102 .owner = THIS_MODULE,
103 .ids = dasd_eckd_ids,
104 .probe = dasd_eckd_probe,
105 .remove = dasd_generic_remove,
106 .set_offline = dasd_generic_set_offline,
107 .set_online = dasd_eckd_set_online,
108 .notify = dasd_generic_notify,
111 static const int sizes_trk0[] = { 28, 148, 84 };
112 #define LABEL_SIZE 140
114 static inline unsigned int
115 round_up_multiple(unsigned int no, unsigned int mult)
118 return (rem ? no - rem + mult : no);
121 static inline unsigned int
122 ceil_quot(unsigned int d1, unsigned int d2)
124 return (d1 + (d2 - 1)) / d2;
128 recs_per_track(struct dasd_eckd_characteristics * rdc,
129 unsigned int kl, unsigned int dl)
133 switch (rdc->dev_type) {
136 return 1499 / (15 + 7 + ceil_quot(kl + 12, 32) +
137 ceil_quot(dl + 12, 32));
139 return 1499 / (15 + ceil_quot(dl + 12, 32));
141 dn = ceil_quot(dl + 6, 232) + 1;
143 kn = ceil_quot(kl + 6, 232) + 1;
144 return 1729 / (10 + 9 + ceil_quot(kl + 6 * kn, 34) +
145 9 + ceil_quot(dl + 6 * dn, 34));
147 return 1729 / (10 + 9 + ceil_quot(dl + 6 * dn, 34));
149 dn = ceil_quot(dl + 6, 232) + 1;
151 kn = ceil_quot(kl + 6, 232) + 1;
152 return 1420 / (18 + 7 + ceil_quot(kl + 6 * kn, 34) +
153 ceil_quot(dl + 6 * dn, 34));
155 return 1420 / (18 + 7 + ceil_quot(dl + 6 * dn, 34));
161 check_XRC (struct ccw1 *de_ccw,
162 struct DE_eckd_data *data,
163 struct dasd_device *device)
165 struct dasd_eckd_private *private;
168 private = (struct dasd_eckd_private *) device->private;
169 if (!private->rdc_data.facilities.XRC_supported)
172 /* switch on System Time Stamp - needed for XRC Support */
173 data->ga_extended |= 0x08; /* switch on 'Time Stamp Valid' */
174 data->ga_extended |= 0x02; /* switch on 'Extended Parameter' */
176 rc = get_sync_clock(&data->ep_sys_time);
177 /* Ignore return code if sync clock is switched off. */
178 if (rc == -ENOSYS || rc == -EACCES)
181 de_ccw->count = sizeof(struct DE_eckd_data);
182 de_ccw->flags |= CCW_FLAG_SLI;
187 define_extent(struct ccw1 * ccw, struct DE_eckd_data * data, int trk,
188 int totrk, int cmd, struct dasd_device * device)
190 struct dasd_eckd_private *private;
191 struct ch_t geo, beg, end;
194 private = (struct dasd_eckd_private *) device->private;
196 ccw->cmd_code = DASD_ECKD_CCW_DEFINE_EXTENT;
199 ccw->cda = (__u32) __pa(data);
201 memset(data, 0, sizeof(struct DE_eckd_data));
203 case DASD_ECKD_CCW_READ_HOME_ADDRESS:
204 case DASD_ECKD_CCW_READ_RECORD_ZERO:
205 case DASD_ECKD_CCW_READ:
206 case DASD_ECKD_CCW_READ_MT:
207 case DASD_ECKD_CCW_READ_CKD:
208 case DASD_ECKD_CCW_READ_CKD_MT:
209 case DASD_ECKD_CCW_READ_KD:
210 case DASD_ECKD_CCW_READ_KD_MT:
211 case DASD_ECKD_CCW_READ_COUNT:
212 data->mask.perm = 0x1;
213 data->attributes.operation = private->attrib.operation;
215 case DASD_ECKD_CCW_WRITE:
216 case DASD_ECKD_CCW_WRITE_MT:
217 case DASD_ECKD_CCW_WRITE_KD:
218 case DASD_ECKD_CCW_WRITE_KD_MT:
219 data->mask.perm = 0x02;
220 data->attributes.operation = private->attrib.operation;
221 rc = check_XRC (ccw, data, device);
223 case DASD_ECKD_CCW_WRITE_CKD:
224 case DASD_ECKD_CCW_WRITE_CKD_MT:
225 data->attributes.operation = DASD_BYPASS_CACHE;
226 rc = check_XRC (ccw, data, device);
228 case DASD_ECKD_CCW_ERASE:
229 case DASD_ECKD_CCW_WRITE_HOME_ADDRESS:
230 case DASD_ECKD_CCW_WRITE_RECORD_ZERO:
231 data->mask.perm = 0x3;
232 data->mask.auth = 0x1;
233 data->attributes.operation = DASD_BYPASS_CACHE;
234 rc = check_XRC (ccw, data, device);
237 DEV_MESSAGE(KERN_ERR, device, "unknown opcode 0x%x", cmd);
241 data->attributes.mode = 0x3; /* ECKD */
243 if ((private->rdc_data.cu_type == 0x2105 ||
244 private->rdc_data.cu_type == 0x2107 ||
245 private->rdc_data.cu_type == 0x1750)
246 && !(private->uses_cdl && trk < 2))
247 data->ga_extended |= 0x40; /* Regular Data Format Mode */
249 geo.cyl = private->rdc_data.no_cyl;
250 geo.head = private->rdc_data.trk_per_cyl;
251 beg.cyl = trk / geo.head;
252 beg.head = trk % geo.head;
253 end.cyl = totrk / geo.head;
254 end.head = totrk % geo.head;
256 /* check for sequential prestage - enhance cylinder range */
257 if (data->attributes.operation == DASD_SEQ_PRESTAGE ||
258 data->attributes.operation == DASD_SEQ_ACCESS) {
260 if (end.cyl + private->attrib.nr_cyl < geo.cyl)
261 end.cyl += private->attrib.nr_cyl;
263 end.cyl = (geo.cyl - 1);
266 data->beg_ext.cyl = beg.cyl;
267 data->beg_ext.head = beg.head;
268 data->end_ext.cyl = end.cyl;
269 data->end_ext.head = end.head;
273 static int check_XRC_on_prefix(struct PFX_eckd_data *pfxdata,
274 struct dasd_device *device)
276 struct dasd_eckd_private *private;
279 private = (struct dasd_eckd_private *) device->private;
280 if (!private->rdc_data.facilities.XRC_supported)
283 /* switch on System Time Stamp - needed for XRC Support */
284 pfxdata->define_extend.ga_extended |= 0x08; /* 'Time Stamp Valid' */
285 pfxdata->define_extend.ga_extended |= 0x02; /* 'Extended Parameter' */
286 pfxdata->validity.time_stamp = 1; /* 'Time Stamp Valid' */
288 rc = get_sync_clock(&pfxdata->define_extend.ep_sys_time);
289 /* Ignore return code if sync clock is switched off. */
290 if (rc == -ENOSYS || rc == -EACCES)
295 static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, int trk,
296 int totrk, int cmd, struct dasd_device *basedev,
297 struct dasd_device *startdev)
299 struct dasd_eckd_private *basepriv, *startpriv;
300 struct DE_eckd_data *data;
301 struct ch_t geo, beg, end;
304 basepriv = (struct dasd_eckd_private *) basedev->private;
305 startpriv = (struct dasd_eckd_private *) startdev->private;
306 data = &pfxdata->define_extend;
308 ccw->cmd_code = DASD_ECKD_CCW_PFX;
310 ccw->count = sizeof(*pfxdata);
311 ccw->cda = (__u32) __pa(pfxdata);
313 memset(pfxdata, 0, sizeof(*pfxdata));
316 pfxdata->base_address = basepriv->conf_data.ned1.unit_addr;
317 pfxdata->base_lss = basepriv->conf_data.ned1.ID;
318 pfxdata->validity.define_extend = 1;
320 /* private uid is kept up to date, conf_data may be outdated */
321 if (startpriv->uid.type != UA_BASE_DEVICE) {
322 pfxdata->validity.verify_base = 1;
323 if (startpriv->uid.type == UA_HYPER_PAV_ALIAS)
324 pfxdata->validity.hyper_pav = 1;
327 /* define extend data (mostly)*/
329 case DASD_ECKD_CCW_READ_HOME_ADDRESS:
330 case DASD_ECKD_CCW_READ_RECORD_ZERO:
331 case DASD_ECKD_CCW_READ:
332 case DASD_ECKD_CCW_READ_MT:
333 case DASD_ECKD_CCW_READ_CKD:
334 case DASD_ECKD_CCW_READ_CKD_MT:
335 case DASD_ECKD_CCW_READ_KD:
336 case DASD_ECKD_CCW_READ_KD_MT:
337 case DASD_ECKD_CCW_READ_COUNT:
338 data->mask.perm = 0x1;
339 data->attributes.operation = basepriv->attrib.operation;
341 case DASD_ECKD_CCW_WRITE:
342 case DASD_ECKD_CCW_WRITE_MT:
343 case DASD_ECKD_CCW_WRITE_KD:
344 case DASD_ECKD_CCW_WRITE_KD_MT:
345 data->mask.perm = 0x02;
346 data->attributes.operation = basepriv->attrib.operation;
347 rc = check_XRC_on_prefix(pfxdata, basedev);
349 case DASD_ECKD_CCW_WRITE_CKD:
350 case DASD_ECKD_CCW_WRITE_CKD_MT:
351 data->attributes.operation = DASD_BYPASS_CACHE;
352 rc = check_XRC_on_prefix(pfxdata, basedev);
354 case DASD_ECKD_CCW_ERASE:
355 case DASD_ECKD_CCW_WRITE_HOME_ADDRESS:
356 case DASD_ECKD_CCW_WRITE_RECORD_ZERO:
357 data->mask.perm = 0x3;
358 data->mask.auth = 0x1;
359 data->attributes.operation = DASD_BYPASS_CACHE;
360 rc = check_XRC_on_prefix(pfxdata, basedev);
363 DEV_MESSAGE(KERN_ERR, basedev, "unknown opcode 0x%x", cmd);
367 data->attributes.mode = 0x3; /* ECKD */
369 if ((basepriv->rdc_data.cu_type == 0x2105 ||
370 basepriv->rdc_data.cu_type == 0x2107 ||
371 basepriv->rdc_data.cu_type == 0x1750)
372 && !(basepriv->uses_cdl && trk < 2))
373 data->ga_extended |= 0x40; /* Regular Data Format Mode */
375 geo.cyl = basepriv->rdc_data.no_cyl;
376 geo.head = basepriv->rdc_data.trk_per_cyl;
377 beg.cyl = trk / geo.head;
378 beg.head = trk % geo.head;
379 end.cyl = totrk / geo.head;
380 end.head = totrk % geo.head;
382 /* check for sequential prestage - enhance cylinder range */
383 if (data->attributes.operation == DASD_SEQ_PRESTAGE ||
384 data->attributes.operation == DASD_SEQ_ACCESS) {
386 if (end.cyl + basepriv->attrib.nr_cyl < geo.cyl)
387 end.cyl += basepriv->attrib.nr_cyl;
389 end.cyl = (geo.cyl - 1);
392 data->beg_ext.cyl = beg.cyl;
393 data->beg_ext.head = beg.head;
394 data->end_ext.cyl = end.cyl;
395 data->end_ext.head = end.head;
400 locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, int trk,
401 int rec_on_trk, int no_rec, int cmd,
402 struct dasd_device * device, int reclen)
404 struct dasd_eckd_private *private;
408 private = (struct dasd_eckd_private *) device->private;
410 DBF_DEV_EVENT(DBF_INFO, device,
411 "Locate: trk %d, rec %d, no_rec %d, cmd %d, reclen %d",
412 trk, rec_on_trk, no_rec, cmd, reclen);
414 ccw->cmd_code = DASD_ECKD_CCW_LOCATE_RECORD;
417 ccw->cda = (__u32) __pa(data);
419 memset(data, 0, sizeof(struct LO_eckd_data));
422 switch (private->rdc_data.dev_type) {
424 dn = ceil_quot(reclen + 6, 232);
425 d = 9 + ceil_quot(reclen + 6 * (dn + 1), 34);
426 sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8;
429 d = 7 + ceil_quot(reclen + 12, 32);
430 sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7;
434 data->sector = sector;
435 data->count = no_rec;
437 case DASD_ECKD_CCW_WRITE_HOME_ADDRESS:
438 data->operation.orientation = 0x3;
439 data->operation.operation = 0x03;
441 case DASD_ECKD_CCW_READ_HOME_ADDRESS:
442 data->operation.orientation = 0x3;
443 data->operation.operation = 0x16;
445 case DASD_ECKD_CCW_WRITE_RECORD_ZERO:
446 data->operation.orientation = 0x1;
447 data->operation.operation = 0x03;
450 case DASD_ECKD_CCW_READ_RECORD_ZERO:
451 data->operation.orientation = 0x3;
452 data->operation.operation = 0x16;
455 case DASD_ECKD_CCW_WRITE:
456 case DASD_ECKD_CCW_WRITE_MT:
457 case DASD_ECKD_CCW_WRITE_KD:
458 case DASD_ECKD_CCW_WRITE_KD_MT:
459 data->auxiliary.last_bytes_used = 0x1;
460 data->length = reclen;
461 data->operation.operation = 0x01;
463 case DASD_ECKD_CCW_WRITE_CKD:
464 case DASD_ECKD_CCW_WRITE_CKD_MT:
465 data->auxiliary.last_bytes_used = 0x1;
466 data->length = reclen;
467 data->operation.operation = 0x03;
469 case DASD_ECKD_CCW_READ:
470 case DASD_ECKD_CCW_READ_MT:
471 case DASD_ECKD_CCW_READ_KD:
472 case DASD_ECKD_CCW_READ_KD_MT:
473 data->auxiliary.last_bytes_used = 0x1;
474 data->length = reclen;
475 data->operation.operation = 0x06;
477 case DASD_ECKD_CCW_READ_CKD:
478 case DASD_ECKD_CCW_READ_CKD_MT:
479 data->auxiliary.last_bytes_used = 0x1;
480 data->length = reclen;
481 data->operation.operation = 0x16;
483 case DASD_ECKD_CCW_READ_COUNT:
484 data->operation.operation = 0x06;
486 case DASD_ECKD_CCW_ERASE:
487 data->length = reclen;
488 data->auxiliary.last_bytes_used = 0x1;
489 data->operation.operation = 0x0b;
492 DEV_MESSAGE(KERN_ERR, device, "unknown opcode 0x%x", cmd);
494 data->seek_addr.cyl = data->search_arg.cyl =
495 trk / private->rdc_data.trk_per_cyl;
496 data->seek_addr.head = data->search_arg.head =
497 trk % private->rdc_data.trk_per_cyl;
498 data->search_arg.record = rec_on_trk;
502 * Returns 1 if the block is one of the special blocks that needs
503 * to get read/written with the KD variant of the command.
504 * That is DASD_ECKD_READ_KD_MT instead of DASD_ECKD_READ_MT and
505 * DASD_ECKD_WRITE_KD_MT instead of DASD_ECKD_WRITE_MT.
506 * Luckily the KD variants differ only by one bit (0x08) from the
507 * normal variant. So don't wonder about code like:
508 * if (dasd_eckd_cdl_special(blk_per_trk, recid))
509 * ccw->cmd_code |= 0x8;
512 dasd_eckd_cdl_special(int blk_per_trk, int recid)
516 if (recid < blk_per_trk)
518 if (recid < 2 * blk_per_trk)
524 * Returns the record size for the special blocks of the cdl format.
525 * Only returns something useful if dasd_eckd_cdl_special is true
529 dasd_eckd_cdl_reclen(int recid)
532 return sizes_trk0[recid];
537 * Generate device unique id that specifies the physical device.
540 dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid)
542 struct dasd_eckd_private *private;
543 struct dasd_eckd_confdata *confdata;
545 private = (struct dasd_eckd_private *) device->private;
548 confdata = &private->conf_data;
552 memset(uid, 0, sizeof(struct dasd_uid));
553 memcpy(uid->vendor, confdata->ned1.HDA_manufacturer,
554 sizeof(uid->vendor) - 1);
555 EBCASC(uid->vendor, sizeof(uid->vendor) - 1);
556 memcpy(uid->serial, confdata->ned1.HDA_location,
557 sizeof(uid->serial) - 1);
558 EBCASC(uid->serial, sizeof(uid->serial) - 1);
559 uid->ssid = confdata->neq.subsystemID;
560 uid->real_unit_addr = confdata->ned1.unit_addr;
561 if (confdata->ned2.sneq.flags == 0x40 &&
562 confdata->ned2.sneq.format == 0x0001) {
563 uid->type = confdata->ned2.sneq.sua_flags;
564 if (uid->type == UA_BASE_PAV_ALIAS)
565 uid->base_unit_addr = confdata->ned2.sneq.base_unit_addr;
567 uid->type = UA_BASE_DEVICE;
572 static struct dasd_ccw_req *dasd_eckd_build_rcd_lpm(struct dasd_device *device,
574 struct ciw *ciw, __u8 lpm)
576 struct dasd_ccw_req *cqr;
579 cqr = dasd_smalloc_request("ECKD", 1 /* RCD */, ciw->count, device);
582 DEV_MESSAGE(KERN_WARNING, device, "%s",
583 "Could not allocate RCD request");
588 ccw->cmd_code = ciw->cmd;
589 ccw->cda = (__u32)(addr_t)rcd_buffer;
590 ccw->count = ciw->count;
592 cqr->startdev = device;
593 cqr->memdev = device;
595 cqr->expires = 10*HZ;
597 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
599 cqr->buildclk = get_clock();
600 cqr->status = DASD_CQR_FILLED;
604 static int dasd_eckd_read_conf_lpm(struct dasd_device *device,
606 int *rcd_buffer_size, __u8 lpm)
609 char *rcd_buf = NULL;
611 struct dasd_ccw_req *cqr;
614 * scan for RCD command in extended SenseID data
616 ciw = ccw_device_get_ciw(device->cdev, CIW_TYPE_RCD);
617 if (!ciw || ciw->cmd == 0) {
621 rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA);
626 cqr = dasd_eckd_build_rcd_lpm(device, rcd_buf, ciw, lpm);
631 ret = dasd_sleep_on(cqr);
633 * on success we update the user input parms
635 dasd_sfree_request(cqr, cqr->memdev);
639 *rcd_buffer_size = ciw->count;
640 *rcd_buffer = rcd_buf;
645 *rcd_buffer_size = 0;
650 dasd_eckd_read_conf(struct dasd_device *device)
653 int conf_len, conf_data_saved;
656 struct dasd_eckd_private *private;
657 struct dasd_eckd_path *path_data;
659 private = (struct dasd_eckd_private *) device->private;
660 path_data = (struct dasd_eckd_path *) &private->path_data;
661 path_data->opm = ccw_device_get_path_mask(device->cdev);
665 /* get configuration data per operational path */
666 for (lpm = 0x80; lpm; lpm>>= 1) {
667 if (lpm & path_data->opm){
668 rc = dasd_eckd_read_conf_lpm(device, &conf_data,
670 if (rc && rc != -EOPNOTSUPP) { /* -EOPNOTSUPP is ok */
671 MESSAGE(KERN_WARNING,
672 "Read configuration data returned "
676 if (conf_data == NULL) {
677 MESSAGE(KERN_WARNING, "%s", "No configuration "
679 continue; /* no error */
681 if (conf_len != sizeof(struct dasd_eckd_confdata)) {
682 MESSAGE(KERN_WARNING,
683 "sizes of configuration data mismatch"
684 "%d (read) vs %ld (expected)",
686 sizeof(struct dasd_eckd_confdata));
688 continue; /* no error */
690 /* save first valid configuration data */
691 if (!conf_data_saved){
692 memcpy(&private->conf_data, conf_data,
693 sizeof(struct dasd_eckd_confdata));
696 switch (((char *)conf_data)[242] & 0x07){
698 path_data->npm |= lpm;
701 path_data->ppm |= lpm;
710 static int dasd_eckd_read_features(struct dasd_device *device)
712 struct dasd_psf_prssd_data *prssdp;
713 struct dasd_rssd_features *features;
714 struct dasd_ccw_req *cqr;
717 struct dasd_eckd_private *private;
719 private = (struct dasd_eckd_private *) device->private;
720 cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
721 1 /* PSF */ + 1 /* RSSD */ ,
722 (sizeof(struct dasd_psf_prssd_data) +
723 sizeof(struct dasd_rssd_features)),
726 DEV_MESSAGE(KERN_WARNING, device, "%s",
727 "Could not allocate initialization request");
730 cqr->startdev = device;
731 cqr->memdev = device;
733 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
735 cqr->expires = 10 * HZ;
737 /* Prepare for Read Subsystem Data */
738 prssdp = (struct dasd_psf_prssd_data *) cqr->data;
739 memset(prssdp, 0, sizeof(struct dasd_psf_prssd_data));
740 prssdp->order = PSF_ORDER_PRSSD;
741 prssdp->suborder = 0x41; /* Read Feature Codes */
742 /* all other bytes of prssdp must be zero */
745 ccw->cmd_code = DASD_ECKD_CCW_PSF;
746 ccw->count = sizeof(struct dasd_psf_prssd_data);
747 ccw->flags |= CCW_FLAG_CC;
748 ccw->cda = (__u32)(addr_t) prssdp;
750 /* Read Subsystem Data - feature codes */
751 features = (struct dasd_rssd_features *) (prssdp + 1);
752 memset(features, 0, sizeof(struct dasd_rssd_features));
755 ccw->cmd_code = DASD_ECKD_CCW_RSSD;
756 ccw->count = sizeof(struct dasd_rssd_features);
757 ccw->cda = (__u32)(addr_t) features;
759 cqr->buildclk = get_clock();
760 cqr->status = DASD_CQR_FILLED;
761 rc = dasd_sleep_on(cqr);
763 prssdp = (struct dasd_psf_prssd_data *) cqr->data;
764 features = (struct dasd_rssd_features *) (prssdp + 1);
765 memcpy(&private->features, features,
766 sizeof(struct dasd_rssd_features));
768 dasd_sfree_request(cqr, cqr->memdev);
774 * Build CP for Perform Subsystem Function - SSC.
776 static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device)
778 struct dasd_ccw_req *cqr;
779 struct dasd_psf_ssc_data *psf_ssc_data;
782 cqr = dasd_smalloc_request("ECKD", 1 /* PSF */ ,
783 sizeof(struct dasd_psf_ssc_data),
787 DEV_MESSAGE(KERN_WARNING, device, "%s",
788 "Could not allocate PSF-SSC request");
791 psf_ssc_data = (struct dasd_psf_ssc_data *)cqr->data;
792 psf_ssc_data->order = PSF_ORDER_SSC;
793 psf_ssc_data->suborder = 0x88;
794 psf_ssc_data->reserved[0] = 0x88;
797 ccw->cmd_code = DASD_ECKD_CCW_PSF;
798 ccw->cda = (__u32)(addr_t)psf_ssc_data;
801 cqr->startdev = device;
802 cqr->memdev = device;
804 cqr->expires = 10*HZ;
805 cqr->buildclk = get_clock();
806 cqr->status = DASD_CQR_FILLED;
811 * Perform Subsystem Function.
812 * It is necessary to trigger CIO for channel revalidation since this
813 * call might change behaviour of DASD devices.
816 dasd_eckd_psf_ssc(struct dasd_device *device)
818 struct dasd_ccw_req *cqr;
821 cqr = dasd_eckd_build_psf_ssc(device);
825 rc = dasd_sleep_on(cqr);
827 /* trigger CIO to reprobe devices */
828 css_schedule_reprobe();
829 dasd_sfree_request(cqr, cqr->memdev);
834 * Valide storage server of current device.
836 static int dasd_eckd_validate_server(struct dasd_device *device)
839 struct dasd_eckd_private *private;
841 /* Currently PAV is the only reason to 'validate' server on LPAR */
842 if (dasd_nopav || MACHINE_IS_VM)
845 rc = dasd_eckd_psf_ssc(device);
846 /* may be requested feature is not available on server,
847 * therefore just report error and go ahead */
848 private = (struct dasd_eckd_private *) device->private;
849 DEV_MESSAGE(KERN_INFO, device,
850 "PSF-SSC on storage subsystem %s.%s.%04x returned rc=%d",
851 private->uid.vendor, private->uid.serial,
852 private->uid.ssid, rc);
853 /* RE-Read Configuration Data */
854 return dasd_eckd_read_conf(device);
858 * Check device characteristics.
859 * If the device is accessible using ECKD discipline, the device is enabled.
862 dasd_eckd_check_characteristics(struct dasd_device *device)
864 struct dasd_eckd_private *private;
865 struct dasd_block *block;
869 private = (struct dasd_eckd_private *) device->private;
870 if (private == NULL) {
871 private = kzalloc(sizeof(struct dasd_eckd_private),
872 GFP_KERNEL | GFP_DMA);
873 if (private == NULL) {
874 DEV_MESSAGE(KERN_WARNING, device, "%s",
875 "memory allocation failed for private "
879 device->private = (void *) private;
881 /* Invalidate status of initial analysis. */
882 private->init_cqr_status = -1;
883 /* Set default cache operations. */
884 private->attrib.operation = DASD_NORMAL_CACHE;
885 private->attrib.nr_cyl = 0;
887 /* Read Configuration Data */
888 rc = dasd_eckd_read_conf(device);
892 /* Generate device unique id and register in devmap */
893 rc = dasd_eckd_generate_uid(device, &private->uid);
896 dasd_set_uid(device->cdev, &private->uid);
898 if (private->uid.type == UA_BASE_DEVICE) {
899 block = dasd_alloc_block();
901 DEV_MESSAGE(KERN_WARNING, device, "%s",
902 "could not allocate dasd block structure");
906 device->block = block;
907 block->base = device;
910 /* register lcu with alias handling, enable PAV if this is a new lcu */
911 is_known = dasd_alias_make_device_known_to_lcu(device);
918 rc = dasd_eckd_validate_server(device); /* will switch pav on */
923 /* Read Feature Codes */
924 rc = dasd_eckd_read_features(device);
928 /* Read Device Characteristics */
929 rdc_data = (void *) &(private->rdc_data);
930 memset(rdc_data, 0, sizeof(rdc_data));
931 rc = dasd_generic_read_dev_chars(device, "ECKD", &rdc_data, 64);
933 DEV_MESSAGE(KERN_WARNING, device,
934 "Read device characteristics returned "
938 DEV_MESSAGE(KERN_INFO, device,
939 "%04X/%02X(CU:%04X/%02X) Cyl:%d Head:%d Sec:%d",
940 private->rdc_data.dev_type,
941 private->rdc_data.dev_model,
942 private->rdc_data.cu_type,
943 private->rdc_data.cu_model.model,
944 private->rdc_data.no_cyl,
945 private->rdc_data.trk_per_cyl,
946 private->rdc_data.sec_per_trk);
950 dasd_alias_disconnect_device_from_lcu(device);
952 dasd_free_block(device->block);
953 device->block = NULL;
955 kfree(device->private);
956 device->private = NULL;
960 static void dasd_eckd_uncheck_device(struct dasd_device *device)
962 dasd_alias_disconnect_device_from_lcu(device);
965 static struct dasd_ccw_req *
966 dasd_eckd_analysis_ccw(struct dasd_device *device)
968 struct dasd_eckd_private *private;
969 struct eckd_count *count_data;
970 struct LO_eckd_data *LO_data;
971 struct dasd_ccw_req *cqr;
973 int cplength, datasize;
976 private = (struct dasd_eckd_private *) device->private;
979 datasize = sizeof(struct DE_eckd_data) + 2*sizeof(struct LO_eckd_data);
980 cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
981 cplength, datasize, device);
985 /* Define extent for the first 3 tracks. */
986 define_extent(ccw++, cqr->data, 0, 2,
987 DASD_ECKD_CCW_READ_COUNT, device);
988 LO_data = cqr->data + sizeof(struct DE_eckd_data);
989 /* Locate record for the first 4 records on track 0. */
990 ccw[-1].flags |= CCW_FLAG_CC;
991 locate_record(ccw++, LO_data++, 0, 0, 4,
992 DASD_ECKD_CCW_READ_COUNT, device, 0);
994 count_data = private->count_area;
995 for (i = 0; i < 4; i++) {
996 ccw[-1].flags |= CCW_FLAG_CC;
997 ccw->cmd_code = DASD_ECKD_CCW_READ_COUNT;
1000 ccw->cda = (__u32)(addr_t) count_data;
1005 /* Locate record for the first record on track 2. */
1006 ccw[-1].flags |= CCW_FLAG_CC;
1007 locate_record(ccw++, LO_data++, 2, 0, 1,
1008 DASD_ECKD_CCW_READ_COUNT, device, 0);
1009 /* Read count ccw. */
1010 ccw[-1].flags |= CCW_FLAG_CC;
1011 ccw->cmd_code = DASD_ECKD_CCW_READ_COUNT;
1014 ccw->cda = (__u32)(addr_t) count_data;
1017 cqr->startdev = device;
1018 cqr->memdev = device;
1020 cqr->buildclk = get_clock();
1021 cqr->status = DASD_CQR_FILLED;
1026 * This is the callback function for the init_analysis cqr. It saves
1027 * the status of the initial analysis ccw before it frees it and kicks
1028 * the device to continue the startup sequence. This will call
1029 * dasd_eckd_do_analysis again (if the devices has not been marked
1030 * for deletion in the meantime).
1033 dasd_eckd_analysis_callback(struct dasd_ccw_req *init_cqr, void *data)
1035 struct dasd_eckd_private *private;
1036 struct dasd_device *device;
1038 device = init_cqr->startdev;
1039 private = (struct dasd_eckd_private *) device->private;
1040 private->init_cqr_status = init_cqr->status;
1041 dasd_sfree_request(init_cqr, device);
1042 dasd_kick_device(device);
1046 dasd_eckd_start_analysis(struct dasd_block *block)
1048 struct dasd_eckd_private *private;
1049 struct dasd_ccw_req *init_cqr;
1051 private = (struct dasd_eckd_private *) block->base->private;
1052 init_cqr = dasd_eckd_analysis_ccw(block->base);
1053 if (IS_ERR(init_cqr))
1054 return PTR_ERR(init_cqr);
1055 init_cqr->callback = dasd_eckd_analysis_callback;
1056 init_cqr->callback_data = NULL;
1057 init_cqr->expires = 5*HZ;
1058 dasd_add_request_head(init_cqr);
1063 dasd_eckd_end_analysis(struct dasd_block *block)
1065 struct dasd_device *device;
1066 struct dasd_eckd_private *private;
1067 struct eckd_count *count_area;
1068 unsigned int sb, blk_per_trk;
1071 device = block->base;
1072 private = (struct dasd_eckd_private *) device->private;
1073 status = private->init_cqr_status;
1074 private->init_cqr_status = -1;
1075 if (status != DASD_CQR_DONE) {
1076 DEV_MESSAGE(KERN_WARNING, device, "%s",
1077 "volume analysis returned unformatted disk");
1078 return -EMEDIUMTYPE;
1081 private->uses_cdl = 1;
1082 /* Calculate number of blocks/records per track. */
1083 blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
1084 /* Check Track 0 for Compatible Disk Layout */
1086 for (i = 0; i < 3; i++) {
1087 if (private->count_area[i].kl != 4 ||
1088 private->count_area[i].dl != dasd_eckd_cdl_reclen(i) - 4) {
1089 private->uses_cdl = 0;
1094 count_area = &private->count_area[4];
1096 if (private->uses_cdl == 0) {
1097 for (i = 0; i < 5; i++) {
1098 if ((private->count_area[i].kl != 0) ||
1099 (private->count_area[i].dl !=
1100 private->count_area[0].dl))
1104 count_area = &private->count_area[0];
1106 if (private->count_area[3].record == 1)
1107 DEV_MESSAGE(KERN_WARNING, device, "%s",
1108 "Trk 0: no records after VTOC!");
1110 if (count_area != NULL && count_area->kl == 0) {
1111 /* we found notthing violating our disk layout */
1112 if (dasd_check_blocksize(count_area->dl) == 0)
1113 block->bp_block = count_area->dl;
1115 if (block->bp_block == 0) {
1116 DEV_MESSAGE(KERN_WARNING, device, "%s",
1117 "Volume has incompatible disk layout");
1118 return -EMEDIUMTYPE;
1120 block->s2b_shift = 0; /* bits to shift 512 to get a block */
1121 for (sb = 512; sb < block->bp_block; sb = sb << 1)
1124 blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block);
1125 block->blocks = (private->rdc_data.no_cyl *
1126 private->rdc_data.trk_per_cyl *
1129 DEV_MESSAGE(KERN_INFO, device,
1130 "(%dkB blks): %dkB at %dkB/trk %s",
1131 (block->bp_block >> 10),
1132 ((private->rdc_data.no_cyl *
1133 private->rdc_data.trk_per_cyl *
1134 blk_per_trk * (block->bp_block >> 9)) >> 1),
1135 ((blk_per_trk * block->bp_block) >> 10),
1137 "compatible disk layout" : "linux disk layout");
1142 static int dasd_eckd_do_analysis(struct dasd_block *block)
1144 struct dasd_eckd_private *private;
1146 private = (struct dasd_eckd_private *) block->base->private;
1147 if (private->init_cqr_status < 0)
1148 return dasd_eckd_start_analysis(block);
1150 return dasd_eckd_end_analysis(block);
1153 static int dasd_eckd_ready_to_online(struct dasd_device *device)
1155 return dasd_alias_add_device(device);
1158 static int dasd_eckd_online_to_ready(struct dasd_device *device)
1160 return dasd_alias_remove_device(device);
1164 dasd_eckd_fill_geometry(struct dasd_block *block, struct hd_geometry *geo)
1166 struct dasd_eckd_private *private;
1168 private = (struct dasd_eckd_private *) block->base->private;
1169 if (dasd_check_blocksize(block->bp_block) == 0) {
1170 geo->sectors = recs_per_track(&private->rdc_data,
1171 0, block->bp_block);
1173 geo->cylinders = private->rdc_data.no_cyl;
1174 geo->heads = private->rdc_data.trk_per_cyl;
1178 static struct dasd_ccw_req *
1179 dasd_eckd_format_device(struct dasd_device * device,
1180 struct format_data_t * fdata)
1182 struct dasd_eckd_private *private;
1183 struct dasd_ccw_req *fcp;
1184 struct eckd_count *ect;
1188 int cplength, datasize;
1191 private = (struct dasd_eckd_private *) device->private;
1192 rpt = recs_per_track(&private->rdc_data, 0, fdata->blksize);
1193 cyl = fdata->start_unit / private->rdc_data.trk_per_cyl;
1194 head = fdata->start_unit % private->rdc_data.trk_per_cyl;
1196 /* Sanity checks. */
1197 if (fdata->start_unit >=
1198 (private->rdc_data.no_cyl * private->rdc_data.trk_per_cyl)) {
1199 DEV_MESSAGE(KERN_INFO, device, "Track no %d too big!",
1201 return ERR_PTR(-EINVAL);
1203 if (fdata->start_unit > fdata->stop_unit) {
1204 DEV_MESSAGE(KERN_INFO, device, "Track %d reached! ending.",
1206 return ERR_PTR(-EINVAL);
1208 if (dasd_check_blocksize(fdata->blksize) != 0) {
1209 DEV_MESSAGE(KERN_WARNING, device,
1210 "Invalid blocksize %d...terminating!",
1212 return ERR_PTR(-EINVAL);
1216 * fdata->intensity is a bit string that tells us what to do:
1217 * Bit 0: write record zero
1218 * Bit 1: write home address, currently not supported
1219 * Bit 2: invalidate tracks
1220 * Bit 3: use OS/390 compatible disk layout (cdl)
1221 * Only some bit combinations do make sense.
1223 switch (fdata->intensity) {
1224 case 0x00: /* Normal format */
1225 case 0x08: /* Normal format, use cdl. */
1227 datasize = sizeof(struct DE_eckd_data) +
1228 sizeof(struct LO_eckd_data) +
1229 rpt * sizeof(struct eckd_count);
1231 case 0x01: /* Write record zero and format track. */
1232 case 0x09: /* Write record zero and format track, use cdl. */
1234 datasize = sizeof(struct DE_eckd_data) +
1235 sizeof(struct LO_eckd_data) +
1236 sizeof(struct eckd_count) +
1237 rpt * sizeof(struct eckd_count);
1239 case 0x04: /* Invalidate track. */
1240 case 0x0c: /* Invalidate track, use cdl. */
1242 datasize = sizeof(struct DE_eckd_data) +
1243 sizeof(struct LO_eckd_data) +
1244 sizeof(struct eckd_count);
1247 DEV_MESSAGE(KERN_WARNING, device, "Invalid flags 0x%x.",
1249 return ERR_PTR(-EINVAL);
1251 /* Allocate the format ccw request. */
1252 fcp = dasd_smalloc_request(dasd_eckd_discipline.name,
1253 cplength, datasize, device);
1260 switch (fdata->intensity & ~0x08) {
1261 case 0x00: /* Normal format. */
1262 define_extent(ccw++, (struct DE_eckd_data *) data,
1263 fdata->start_unit, fdata->start_unit,
1264 DASD_ECKD_CCW_WRITE_CKD, device);
1265 data += sizeof(struct DE_eckd_data);
1266 ccw[-1].flags |= CCW_FLAG_CC;
1267 locate_record(ccw++, (struct LO_eckd_data *) data,
1268 fdata->start_unit, 0, rpt,
1269 DASD_ECKD_CCW_WRITE_CKD, device,
1271 data += sizeof(struct LO_eckd_data);
1273 case 0x01: /* Write record zero + format track. */
1274 define_extent(ccw++, (struct DE_eckd_data *) data,
1275 fdata->start_unit, fdata->start_unit,
1276 DASD_ECKD_CCW_WRITE_RECORD_ZERO,
1278 data += sizeof(struct DE_eckd_data);
1279 ccw[-1].flags |= CCW_FLAG_CC;
1280 locate_record(ccw++, (struct LO_eckd_data *) data,
1281 fdata->start_unit, 0, rpt + 1,
1282 DASD_ECKD_CCW_WRITE_RECORD_ZERO, device,
1283 device->block->bp_block);
1284 data += sizeof(struct LO_eckd_data);
1286 case 0x04: /* Invalidate track. */
1287 define_extent(ccw++, (struct DE_eckd_data *) data,
1288 fdata->start_unit, fdata->start_unit,
1289 DASD_ECKD_CCW_WRITE_CKD, device);
1290 data += sizeof(struct DE_eckd_data);
1291 ccw[-1].flags |= CCW_FLAG_CC;
1292 locate_record(ccw++, (struct LO_eckd_data *) data,
1293 fdata->start_unit, 0, 1,
1294 DASD_ECKD_CCW_WRITE_CKD, device, 8);
1295 data += sizeof(struct LO_eckd_data);
1298 if (fdata->intensity & 0x01) { /* write record zero */
1299 ect = (struct eckd_count *) data;
1300 data += sizeof(struct eckd_count);
1306 ccw[-1].flags |= CCW_FLAG_CC;
1307 ccw->cmd_code = DASD_ECKD_CCW_WRITE_RECORD_ZERO;
1308 ccw->flags = CCW_FLAG_SLI;
1310 ccw->cda = (__u32)(addr_t) ect;
1313 if ((fdata->intensity & ~0x08) & 0x04) { /* erase track */
1314 ect = (struct eckd_count *) data;
1315 data += sizeof(struct eckd_count);
1321 ccw[-1].flags |= CCW_FLAG_CC;
1322 ccw->cmd_code = DASD_ECKD_CCW_WRITE_CKD;
1323 ccw->flags = CCW_FLAG_SLI;
1325 ccw->cda = (__u32)(addr_t) ect;
1326 } else { /* write remaining records */
1327 for (i = 0; i < rpt; i++) {
1328 ect = (struct eckd_count *) data;
1329 data += sizeof(struct eckd_count);
1332 ect->record = i + 1;
1334 ect->dl = fdata->blksize;
1335 /* Check for special tracks 0-1 when formatting CDL */
1336 if ((fdata->intensity & 0x08) &&
1337 fdata->start_unit == 0) {
1340 ect->dl = sizes_trk0[i] - 4;
1343 if ((fdata->intensity & 0x08) &&
1344 fdata->start_unit == 1) {
1346 ect->dl = LABEL_SIZE - 44;
1348 ccw[-1].flags |= CCW_FLAG_CC;
1349 ccw->cmd_code = DASD_ECKD_CCW_WRITE_CKD;
1350 ccw->flags = CCW_FLAG_SLI;
1352 ccw->cda = (__u32)(addr_t) ect;
1356 fcp->startdev = device;
1357 fcp->memdev = device;
1358 clear_bit(DASD_CQR_FLAGS_USE_ERP, &fcp->flags);
1359 fcp->retries = 5; /* set retry counter to enable default ERP */
1360 fcp->buildclk = get_clock();
1361 fcp->status = DASD_CQR_FILLED;
1365 static void dasd_eckd_handle_terminated_request(struct dasd_ccw_req *cqr)
1367 cqr->status = DASD_CQR_FILLED;
1368 if (cqr->block && (cqr->startdev != cqr->block->base)) {
1369 dasd_eckd_reset_ccw_to_base_io(cqr);
1370 cqr->startdev = cqr->block->base;
1374 static dasd_erp_fn_t
1375 dasd_eckd_erp_action(struct dasd_ccw_req * cqr)
1377 struct dasd_device *device = (struct dasd_device *) cqr->startdev;
1378 struct ccw_device *cdev = device->cdev;
1380 switch (cdev->id.cu_type) {
1385 return dasd_3990_erp_action;
1389 return dasd_default_erp_action;
1393 static dasd_erp_fn_t
1394 dasd_eckd_erp_postaction(struct dasd_ccw_req * cqr)
1396 return dasd_default_erp_postaction;
1400 static void dasd_eckd_handle_unsolicited_interrupt(struct dasd_device *device,
1405 /* first of all check for state change pending interrupt */
1406 mask = DEV_STAT_ATTENTION | DEV_STAT_DEV_END | DEV_STAT_UNIT_EXCEP;
1407 if ((irb->scsw.cmd.dstat & mask) == mask) {
1408 dasd_generic_handle_state_change(device);
1412 /* summary unit check */
1413 if ((irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) &&
1414 (irb->ecw[7] == 0x0D)) {
1415 dasd_alias_handle_summary_unit_check(device, irb);
1420 /* service information message SIM */
1421 if ((irb->ecw[6] & DASD_SIM_SENSE) == DASD_SIM_SENSE) {
1422 dasd_3990_erp_handle_sim(device, irb->ecw);
1426 /* just report other unsolicited interrupts */
1427 DEV_MESSAGE(KERN_DEBUG, device, "%s",
1428 "unsolicited interrupt received");
1429 device->discipline->dump_sense(device, NULL, irb);
1430 dasd_schedule_device_bh(device);
1435 static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev,
1436 struct dasd_block *block,
1437 struct request *req)
1439 struct dasd_eckd_private *private;
1440 unsigned long *idaws;
1441 struct LO_eckd_data *LO_data;
1442 struct dasd_ccw_req *cqr;
1444 struct req_iterator iter;
1447 unsigned int blksize, blk_per_trk, off;
1448 int count, cidaw, cplength, datasize;
1449 sector_t recid, first_rec, last_rec;
1450 sector_t first_trk, last_trk;
1451 unsigned int first_offs, last_offs;
1452 unsigned char cmd, rcmd;
1454 struct dasd_device *basedev;
1456 basedev = block->base;
1457 private = (struct dasd_eckd_private *) basedev->private;
1458 if (rq_data_dir(req) == READ)
1459 cmd = DASD_ECKD_CCW_READ_MT;
1460 else if (rq_data_dir(req) == WRITE)
1461 cmd = DASD_ECKD_CCW_WRITE_MT;
1463 return ERR_PTR(-EINVAL);
1464 /* Calculate number of blocks/records per track. */
1465 blksize = block->bp_block;
1466 blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize);
1467 /* Calculate record id of first and last block. */
1468 first_rec = first_trk = req->sector >> block->s2b_shift;
1469 first_offs = sector_div(first_trk, blk_per_trk);
1470 last_rec = last_trk =
1471 (req->sector + req->nr_sectors - 1) >> block->s2b_shift;
1472 last_offs = sector_div(last_trk, blk_per_trk);
1473 /* Check struct bio and count the number of blocks for the request. */
1476 rq_for_each_segment(bv, req, iter) {
1477 if (bv->bv_len & (blksize - 1))
1478 /* Eckd can only do full blocks. */
1479 return ERR_PTR(-EINVAL);
1480 count += bv->bv_len >> (block->s2b_shift + 9);
1481 #if defined(CONFIG_64BIT)
1482 if (idal_is_needed (page_address(bv->bv_page), bv->bv_len))
1483 cidaw += bv->bv_len >> (block->s2b_shift + 9);
1487 if (count != last_rec - first_rec + 1)
1488 return ERR_PTR(-EINVAL);
1490 /* use the prefix command if available */
1491 use_prefix = private->features.feature[8] & 0x01;
1493 /* 1x prefix + number of blocks */
1494 cplength = 2 + count;
1495 /* 1x prefix + cidaws*sizeof(long) */
1496 datasize = sizeof(struct PFX_eckd_data) +
1497 sizeof(struct LO_eckd_data) +
1498 cidaw * sizeof(unsigned long);
1500 /* 1x define extent + 1x locate record + number of blocks */
1501 cplength = 2 + count;
1502 /* 1x define extent + 1x locate record + cidaws*sizeof(long) */
1503 datasize = sizeof(struct DE_eckd_data) +
1504 sizeof(struct LO_eckd_data) +
1505 cidaw * sizeof(unsigned long);
1507 /* Find out the number of additional locate record ccws for cdl. */
1508 if (private->uses_cdl && first_rec < 2*blk_per_trk) {
1509 if (last_rec >= 2*blk_per_trk)
1510 count = 2*blk_per_trk - first_rec;
1512 datasize += count*sizeof(struct LO_eckd_data);
1514 /* Allocate the ccw request. */
1515 cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1516 cplength, datasize, startdev);
1520 /* First ccw is define extent or prefix. */
1522 if (prefix(ccw++, cqr->data, first_trk,
1523 last_trk, cmd, basedev, startdev) == -EAGAIN) {
1524 /* Clock not in sync and XRC is enabled.
1527 dasd_sfree_request(cqr, startdev);
1528 return ERR_PTR(-EAGAIN);
1530 idaws = (unsigned long *) (cqr->data +
1531 sizeof(struct PFX_eckd_data));
1533 if (define_extent(ccw++, cqr->data, first_trk,
1534 last_trk, cmd, startdev) == -EAGAIN) {
1535 /* Clock not in sync and XRC is enabled.
1538 dasd_sfree_request(cqr, startdev);
1539 return ERR_PTR(-EAGAIN);
1541 idaws = (unsigned long *) (cqr->data +
1542 sizeof(struct DE_eckd_data));
1544 /* Build locate_record+read/write/ccws. */
1545 LO_data = (struct LO_eckd_data *) (idaws + cidaw);
1547 if (private->uses_cdl == 0 || recid > 2*blk_per_trk) {
1548 /* Only standard blocks so there is just one locate record. */
1549 ccw[-1].flags |= CCW_FLAG_CC;
1550 locate_record(ccw++, LO_data++, first_trk, first_offs + 1,
1551 last_rec - recid + 1, cmd, basedev, blksize);
1553 rq_for_each_segment(bv, req, iter) {
1554 dst = page_address(bv->bv_page) + bv->bv_offset;
1555 if (dasd_page_cache) {
1556 char *copy = kmem_cache_alloc(dasd_page_cache,
1557 GFP_DMA | __GFP_NOWARN);
1558 if (copy && rq_data_dir(req) == WRITE)
1559 memcpy(copy + bv->bv_offset, dst, bv->bv_len);
1561 dst = copy + bv->bv_offset;
1563 for (off = 0; off < bv->bv_len; off += blksize) {
1564 sector_t trkid = recid;
1565 unsigned int recoffs = sector_div(trkid, blk_per_trk);
1568 /* Locate record for cdl special block ? */
1569 if (private->uses_cdl && recid < 2*blk_per_trk) {
1570 if (dasd_eckd_cdl_special(blk_per_trk, recid)){
1572 count = dasd_eckd_cdl_reclen(recid);
1573 if (count < blksize &&
1574 rq_data_dir(req) == READ)
1575 memset(dst + count, 0xe5,
1578 ccw[-1].flags |= CCW_FLAG_CC;
1579 locate_record(ccw++, LO_data++,
1581 1, rcmd, basedev, count);
1583 /* Locate record for standard blocks ? */
1584 if (private->uses_cdl && recid == 2*blk_per_trk) {
1585 ccw[-1].flags |= CCW_FLAG_CC;
1586 locate_record(ccw++, LO_data++,
1588 last_rec - recid + 1,
1589 cmd, basedev, count);
1591 /* Read/write ccw. */
1592 ccw[-1].flags |= CCW_FLAG_CC;
1593 ccw->cmd_code = rcmd;
1595 if (idal_is_needed(dst, blksize)) {
1596 ccw->cda = (__u32)(addr_t) idaws;
1597 ccw->flags = CCW_FLAG_IDA;
1598 idaws = idal_create_words(idaws, dst, blksize);
1600 ccw->cda = (__u32)(addr_t) dst;
1608 if (req->cmd_flags & REQ_FAILFAST)
1609 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
1610 cqr->startdev = startdev;
1611 cqr->memdev = startdev;
1613 cqr->expires = 5 * 60 * HZ; /* 5 minutes */
1614 cqr->lpm = private->path_data.ppm;
1616 cqr->buildclk = get_clock();
1617 cqr->status = DASD_CQR_FILLED;
1622 dasd_eckd_free_cp(struct dasd_ccw_req *cqr, struct request *req)
1624 struct dasd_eckd_private *private;
1626 struct req_iterator iter;
1629 unsigned int blksize, blk_per_trk, off;
1633 if (!dasd_page_cache)
1635 private = (struct dasd_eckd_private *) cqr->block->base->private;
1636 blksize = cqr->block->bp_block;
1637 blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize);
1638 recid = req->sector >> cqr->block->s2b_shift;
1640 /* Skip over define extent & locate record. */
1642 if (private->uses_cdl == 0 || recid > 2*blk_per_trk)
1644 rq_for_each_segment(bv, req, iter) {
1645 dst = page_address(bv->bv_page) + bv->bv_offset;
1646 for (off = 0; off < bv->bv_len; off += blksize) {
1647 /* Skip locate record. */
1648 if (private->uses_cdl && recid <= 2*blk_per_trk)
1651 if (ccw->flags & CCW_FLAG_IDA)
1652 cda = *((char **)((addr_t) ccw->cda));
1654 cda = (char *)((addr_t) ccw->cda);
1656 if (rq_data_dir(req) == READ)
1657 memcpy(dst, cda, bv->bv_len);
1658 kmem_cache_free(dasd_page_cache,
1659 (void *)((addr_t)cda & PAGE_MASK));
1668 status = cqr->status == DASD_CQR_DONE;
1669 dasd_sfree_request(cqr, cqr->memdev);
1674 * Modify ccw chain in cqr so it can be started on a base device.
1676 * Note that this is not enough to restart the cqr!
1677 * Either reset cqr->startdev as well (summary unit check handling)
1678 * or restart via separate cqr (as in ERP handling).
1680 void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *cqr)
1683 struct PFX_eckd_data *pfxdata;
1686 pfxdata = cqr->data;
1688 if (ccw->cmd_code == DASD_ECKD_CCW_PFX) {
1689 pfxdata->validity.verify_base = 0;
1690 pfxdata->validity.hyper_pav = 0;
1694 #define DASD_ECKD_CHANQ_MAX_SIZE 4
1696 static struct dasd_ccw_req *dasd_eckd_build_alias_cp(struct dasd_device *base,
1697 struct dasd_block *block,
1698 struct request *req)
1700 struct dasd_eckd_private *private;
1701 struct dasd_device *startdev;
1702 unsigned long flags;
1703 struct dasd_ccw_req *cqr;
1705 startdev = dasd_alias_get_start_dev(base);
1708 private = (struct dasd_eckd_private *) startdev->private;
1709 if (private->count >= DASD_ECKD_CHANQ_MAX_SIZE)
1710 return ERR_PTR(-EBUSY);
1712 spin_lock_irqsave(get_ccwdev_lock(startdev->cdev), flags);
1714 cqr = dasd_eckd_build_cp(startdev, block, req);
1717 spin_unlock_irqrestore(get_ccwdev_lock(startdev->cdev), flags);
1721 static int dasd_eckd_free_alias_cp(struct dasd_ccw_req *cqr,
1722 struct request *req)
1724 struct dasd_eckd_private *private;
1725 unsigned long flags;
1727 spin_lock_irqsave(get_ccwdev_lock(cqr->memdev->cdev), flags);
1728 private = (struct dasd_eckd_private *) cqr->memdev->private;
1730 spin_unlock_irqrestore(get_ccwdev_lock(cqr->memdev->cdev), flags);
1731 return dasd_eckd_free_cp(cqr, req);
1735 dasd_eckd_fill_info(struct dasd_device * device,
1736 struct dasd_information2_t * info)
1738 struct dasd_eckd_private *private;
1740 private = (struct dasd_eckd_private *) device->private;
1741 info->label_block = 2;
1742 info->FBA_layout = private->uses_cdl ? 0 : 1;
1743 info->format = private->uses_cdl ? DASD_FORMAT_CDL : DASD_FORMAT_LDL;
1744 info->characteristics_size = sizeof(struct dasd_eckd_characteristics);
1745 memcpy(info->characteristics, &private->rdc_data,
1746 sizeof(struct dasd_eckd_characteristics));
1747 info->confdata_size = sizeof(struct dasd_eckd_confdata);
1748 memcpy(info->configuration_data, &private->conf_data,
1749 sizeof(struct dasd_eckd_confdata));
1754 * SECTION: ioctl functions for eckd devices.
1758 * Release device ioctl.
1759 * Buils a channel programm to releases a prior reserved
1760 * (see dasd_eckd_reserve) device.
1763 dasd_eckd_release(struct dasd_device *device)
1765 struct dasd_ccw_req *cqr;
1768 if (!capable(CAP_SYS_ADMIN))
1771 cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1774 DEV_MESSAGE(KERN_WARNING, device, "%s",
1775 "Could not allocate initialization request");
1776 return PTR_ERR(cqr);
1778 cqr->cpaddr->cmd_code = DASD_ECKD_CCW_RELEASE;
1779 cqr->cpaddr->flags |= CCW_FLAG_SLI;
1780 cqr->cpaddr->count = 32;
1781 cqr->cpaddr->cda = (__u32)(addr_t) cqr->data;
1782 cqr->startdev = device;
1783 cqr->memdev = device;
1784 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
1785 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
1786 cqr->retries = 2; /* set retry counter to enable basic ERP */
1787 cqr->expires = 2 * HZ;
1788 cqr->buildclk = get_clock();
1789 cqr->status = DASD_CQR_FILLED;
1791 rc = dasd_sleep_on_immediatly(cqr);
1793 dasd_sfree_request(cqr, cqr->memdev);
1798 * Reserve device ioctl.
1799 * Options are set to 'synchronous wait for interrupt' and
1800 * 'timeout the request'. This leads to a terminate IO if
1801 * the interrupt is outstanding for a certain time.
1804 dasd_eckd_reserve(struct dasd_device *device)
1806 struct dasd_ccw_req *cqr;
1809 if (!capable(CAP_SYS_ADMIN))
1812 cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1815 DEV_MESSAGE(KERN_WARNING, device, "%s",
1816 "Could not allocate initialization request");
1817 return PTR_ERR(cqr);
1819 cqr->cpaddr->cmd_code = DASD_ECKD_CCW_RESERVE;
1820 cqr->cpaddr->flags |= CCW_FLAG_SLI;
1821 cqr->cpaddr->count = 32;
1822 cqr->cpaddr->cda = (__u32)(addr_t) cqr->data;
1823 cqr->startdev = device;
1824 cqr->memdev = device;
1825 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
1826 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
1827 cqr->retries = 2; /* set retry counter to enable basic ERP */
1828 cqr->expires = 2 * HZ;
1829 cqr->buildclk = get_clock();
1830 cqr->status = DASD_CQR_FILLED;
1832 rc = dasd_sleep_on_immediatly(cqr);
1834 dasd_sfree_request(cqr, cqr->memdev);
1839 * Steal lock ioctl - unconditional reserve device.
1840 * Buils a channel programm to break a device's reservation.
1841 * (unconditional reserve)
1844 dasd_eckd_steal_lock(struct dasd_device *device)
1846 struct dasd_ccw_req *cqr;
1849 if (!capable(CAP_SYS_ADMIN))
1852 cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1855 DEV_MESSAGE(KERN_WARNING, device, "%s",
1856 "Could not allocate initialization request");
1857 return PTR_ERR(cqr);
1859 cqr->cpaddr->cmd_code = DASD_ECKD_CCW_SLCK;
1860 cqr->cpaddr->flags |= CCW_FLAG_SLI;
1861 cqr->cpaddr->count = 32;
1862 cqr->cpaddr->cda = (__u32)(addr_t) cqr->data;
1863 cqr->startdev = device;
1864 cqr->memdev = device;
1865 clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags);
1866 set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags);
1867 cqr->retries = 2; /* set retry counter to enable basic ERP */
1868 cqr->expires = 2 * HZ;
1869 cqr->buildclk = get_clock();
1870 cqr->status = DASD_CQR_FILLED;
1872 rc = dasd_sleep_on_immediatly(cqr);
1874 dasd_sfree_request(cqr, cqr->memdev);
1879 * Read performance statistics
1882 dasd_eckd_performance(struct dasd_device *device, void __user *argp)
1884 struct dasd_psf_prssd_data *prssdp;
1885 struct dasd_rssd_perf_stats_t *stats;
1886 struct dasd_ccw_req *cqr;
1890 cqr = dasd_smalloc_request(dasd_eckd_discipline.name,
1891 1 /* PSF */ + 1 /* RSSD */ ,
1892 (sizeof(struct dasd_psf_prssd_data) +
1893 sizeof(struct dasd_rssd_perf_stats_t)),
1896 DEV_MESSAGE(KERN_WARNING, device, "%s",
1897 "Could not allocate initialization request");
1898 return PTR_ERR(cqr);
1900 cqr->startdev = device;
1901 cqr->memdev = device;
1903 cqr->expires = 10 * HZ;
1905 /* Prepare for Read Subsystem Data */
1906 prssdp = (struct dasd_psf_prssd_data *) cqr->data;
1907 memset(prssdp, 0, sizeof(struct dasd_psf_prssd_data));
1908 prssdp->order = PSF_ORDER_PRSSD;
1909 prssdp->suborder = 0x01; /* Performance Statistics */
1910 prssdp->varies[1] = 0x01; /* Perf Statistics for the Subsystem */
1913 ccw->cmd_code = DASD_ECKD_CCW_PSF;
1914 ccw->count = sizeof(struct dasd_psf_prssd_data);
1915 ccw->flags |= CCW_FLAG_CC;
1916 ccw->cda = (__u32)(addr_t) prssdp;
1918 /* Read Subsystem Data - Performance Statistics */
1919 stats = (struct dasd_rssd_perf_stats_t *) (prssdp + 1);
1920 memset(stats, 0, sizeof(struct dasd_rssd_perf_stats_t));
1923 ccw->cmd_code = DASD_ECKD_CCW_RSSD;
1924 ccw->count = sizeof(struct dasd_rssd_perf_stats_t);
1925 ccw->cda = (__u32)(addr_t) stats;
1927 cqr->buildclk = get_clock();
1928 cqr->status = DASD_CQR_FILLED;
1929 rc = dasd_sleep_on(cqr);
1931 prssdp = (struct dasd_psf_prssd_data *) cqr->data;
1932 stats = (struct dasd_rssd_perf_stats_t *) (prssdp + 1);
1933 if (copy_to_user(argp, stats,
1934 sizeof(struct dasd_rssd_perf_stats_t)))
1937 dasd_sfree_request(cqr, cqr->memdev);
1942 * Get attributes (cache operations)
1943 * Returnes the cache attributes used in Define Extend (DE).
1946 dasd_eckd_get_attrib(struct dasd_device *device, void __user *argp)
1948 struct dasd_eckd_private *private =
1949 (struct dasd_eckd_private *)device->private;
1950 struct attrib_data_t attrib = private->attrib;
1953 if (!capable(CAP_SYS_ADMIN))
1959 if (copy_to_user(argp, (long *) &attrib,
1960 sizeof(struct attrib_data_t)))
1967 * Set attributes (cache operations)
1968 * Stores the attributes for cache operation to be used in Define Extend (DE).
1971 dasd_eckd_set_attrib(struct dasd_device *device, void __user *argp)
1973 struct dasd_eckd_private *private =
1974 (struct dasd_eckd_private *)device->private;
1975 struct attrib_data_t attrib;
1977 if (!capable(CAP_SYS_ADMIN))
1982 if (copy_from_user(&attrib, argp, sizeof(struct attrib_data_t)))
1984 private->attrib = attrib;
1986 DEV_MESSAGE(KERN_INFO, device,
1987 "cache operation mode set to %x (%i cylinder prestage)",
1988 private->attrib.operation, private->attrib.nr_cyl);
1993 dasd_eckd_ioctl(struct dasd_block *block, unsigned int cmd, void __user *argp)
1995 struct dasd_device *device = block->base;
1999 return dasd_eckd_get_attrib(device, argp);
2001 return dasd_eckd_set_attrib(device, argp);
2003 return dasd_eckd_performance(device, argp);
2005 return dasd_eckd_release(device);
2007 return dasd_eckd_reserve(device);
2009 return dasd_eckd_steal_lock(device);
2011 return -ENOIOCTLCMD;
2016 * Dump the range of CCWs into 'page' buffer
2017 * and return number of printed chars.
2020 dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page)
2026 while (from <= to) {
2027 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
2028 " CCW %p: %08X %08X DAT:",
2029 from, ((int *) from)[0], ((int *) from)[1]);
2031 /* get pointer to data (consider IDALs) */
2032 if (from->flags & CCW_FLAG_IDA)
2033 datap = (char *) *((addr_t *) (addr_t) from->cda);
2035 datap = (char *) ((addr_t) from->cda);
2037 /* dump data (max 32 bytes) */
2038 for (count = 0; count < from->count && count < 32; count++) {
2039 if (count % 8 == 0) len += sprintf(page + len, " ");
2040 if (count % 4 == 0) len += sprintf(page + len, " ");
2041 len += sprintf(page + len, "%02x", datap[count]);
2043 len += sprintf(page + len, "\n");
2050 * Print sense data and related channel program.
2051 * Parts are printed because printk buffer is only 1024 bytes.
2053 static void dasd_eckd_dump_sense(struct dasd_device *device,
2054 struct dasd_ccw_req *req, struct irb *irb)
2057 struct ccw1 *first, *last, *fail, *from, *to;
2060 page = (char *) get_zeroed_page(GFP_ATOMIC);
2062 DEV_MESSAGE(KERN_ERR, device, " %s",
2063 "No memory to dump sense data");
2066 /* dump the sense data */
2067 len = sprintf(page, KERN_ERR PRINTK_HEADER
2068 " I/O status report for device %s:\n",
2069 device->cdev->dev.bus_id);
2070 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
2071 " in req: %p CS: 0x%02X DS: 0x%02X\n", req,
2072 irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
2073 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
2074 " device %s: Failing CCW: %p\n",
2075 device->cdev->dev.bus_id,
2076 (void *) (addr_t) irb->scsw.cmd.cpa);
2077 if (irb->esw.esw0.erw.cons) {
2078 for (sl = 0; sl < 4; sl++) {
2079 len += sprintf(page + len, KERN_ERR PRINTK_HEADER
2080 " Sense(hex) %2d-%2d:",
2081 (8 * sl), ((8 * sl) + 7));
2083 for (sct = 0; sct < 8; sct++) {
2084 len += sprintf(page + len, " %02x",
2085 irb->ecw[8 * sl + sct]);
2087 len += sprintf(page + len, "\n");
2090 if (irb->ecw[27] & DASD_SENSE_BIT_0) {
2091 /* 24 Byte Sense Data */
2092 sprintf(page + len, KERN_ERR PRINTK_HEADER
2093 " 24 Byte: %x MSG %x, "
2094 "%s MSGb to SYSOP\n",
2095 irb->ecw[7] >> 4, irb->ecw[7] & 0x0f,
2096 irb->ecw[1] & 0x10 ? "" : "no");
2098 /* 32 Byte Sense Data */
2099 sprintf(page + len, KERN_ERR PRINTK_HEADER
2100 " 32 Byte: Format: %x "
2101 "Exception class %x\n",
2102 irb->ecw[6] & 0x0f, irb->ecw[22] >> 4);
2105 sprintf(page + len, KERN_ERR PRINTK_HEADER
2106 " SORRY - NO VALID SENSE AVAILABLE\n");
2111 /* req == NULL for unsolicited interrupts */
2112 /* dump the Channel Program (max 140 Bytes per line) */
2113 /* Count CCW and print first CCWs (maximum 1024 % 140 = 7) */
2114 first = req->cpaddr;
2115 for (last = first; last->flags & (CCW_FLAG_CC | CCW_FLAG_DC); last++);
2116 to = min(first + 6, last);
2117 len = sprintf(page, KERN_ERR PRINTK_HEADER
2118 " Related CP in req: %p\n", req);
2119 dasd_eckd_dump_ccw_range(first, to, page + len);
2122 /* print failing CCW area (maximum 4) */
2123 /* scsw->cda is either valid or zero */
2126 fail = (struct ccw1 *)(addr_t)
2127 irb->scsw.cmd.cpa; /* failing CCW */
2128 if (from < fail - 2) {
2129 from = fail - 2; /* there is a gap - print header */
2130 len += sprintf(page, KERN_ERR PRINTK_HEADER "......\n");
2132 to = min(fail + 1, last);
2133 len += dasd_eckd_dump_ccw_range(from, to, page + len);
2135 /* print last CCWs (maximum 2) */
2136 from = max(from, ++to);
2137 if (from < last - 1) {
2138 from = last - 1; /* there is a gap - print header */
2139 len += sprintf(page + len, KERN_ERR PRINTK_HEADER "......\n");
2141 len += dasd_eckd_dump_ccw_range(from, last, page + len);
2145 free_page((unsigned long) page);
2149 * max_blocks is dependent on the amount of storage that is available
2150 * in the static io buffer for each device. Currently each device has
2151 * 8192 bytes (=2 pages). For 64 bit one dasd_mchunkt_t structure has
2152 * 24 bytes, the struct dasd_ccw_req has 136 bytes and each block can use
2153 * up to 16 bytes (8 for the ccw and 8 for the idal pointer). In
2154 * addition we have one define extent ccw + 16 bytes of data and one
2155 * locate record ccw + 16 bytes of data. That makes:
2156 * (8192 - 24 - 136 - 8 - 16 - 8 - 16) / 16 = 499 blocks at maximum.
2157 * We want to fit two into the available memory so that we can immediately
2158 * start the next request if one finishes off. That makes 249.5 blocks
2159 * for one request. Give a little safety and the result is 240.
2161 static struct dasd_discipline dasd_eckd_discipline = {
2162 .owner = THIS_MODULE,
2166 .check_device = dasd_eckd_check_characteristics,
2167 .uncheck_device = dasd_eckd_uncheck_device,
2168 .do_analysis = dasd_eckd_do_analysis,
2169 .ready_to_online = dasd_eckd_ready_to_online,
2170 .online_to_ready = dasd_eckd_online_to_ready,
2171 .fill_geometry = dasd_eckd_fill_geometry,
2172 .start_IO = dasd_start_IO,
2173 .term_IO = dasd_term_IO,
2174 .handle_terminated_request = dasd_eckd_handle_terminated_request,
2175 .format_device = dasd_eckd_format_device,
2176 .erp_action = dasd_eckd_erp_action,
2177 .erp_postaction = dasd_eckd_erp_postaction,
2178 .handle_unsolicited_interrupt = dasd_eckd_handle_unsolicited_interrupt,
2179 .build_cp = dasd_eckd_build_alias_cp,
2180 .free_cp = dasd_eckd_free_alias_cp,
2181 .dump_sense = dasd_eckd_dump_sense,
2182 .fill_info = dasd_eckd_fill_info,
2183 .ioctl = dasd_eckd_ioctl,
2187 dasd_eckd_init(void)
2189 ASCEBC(dasd_eckd_discipline.ebcname, 4);
2190 return ccw_driver_register(&dasd_eckd_driver);
2194 dasd_eckd_cleanup(void)
2196 ccw_driver_unregister(&dasd_eckd_driver);
2199 module_init(dasd_eckd_init);
2200 module_exit(dasd_eckd_cleanup);