diff options
Diffstat (limited to 'drivers/s390/block')
-rw-r--r-- | drivers/s390/block/dasd.c | 249 | ||||
-rw-r--r-- | drivers/s390/block/dasd_3990_erp.c | 871 | ||||
-rw-r--r-- | drivers/s390/block/dasd_alias.c | 35 | ||||
-rw-r--r-- | drivers/s390/block/dasd_devmap.c | 43 | ||||
-rw-r--r-- | drivers/s390/block/dasd_diag.c | 66 | ||||
-rw-r--r-- | drivers/s390/block/dasd_eckd.c | 1297 | ||||
-rw-r--r-- | drivers/s390/block/dasd_eckd.h | 49 | ||||
-rw-r--r-- | drivers/s390/block/dasd_eer.c | 27 | ||||
-rw-r--r-- | drivers/s390/block/dasd_erp.c | 21 | ||||
-rw-r--r-- | drivers/s390/block/dasd_fba.c | 77 | ||||
-rw-r--r-- | drivers/s390/block/dasd_genhd.c | 7 | ||||
-rw-r--r-- | drivers/s390/block/dasd_int.h | 13 | ||||
-rw-r--r-- | drivers/s390/block/dasd_ioctl.c | 46 | ||||
-rw-r--r-- | drivers/s390/block/dasd_proc.c | 22 |
14 files changed, 1964 insertions, 859 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 08c23a921012..2fd64e5a9ab2 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -9,6 +9,9 @@ * */ +#define KMSG_COMPONENT "dasd" +#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt + #include <linux/kmod.h> #include <linux/init.h> #include <linux/interrupt.h> @@ -22,6 +25,7 @@ #include <asm/ebcdic.h> #include <asm/idals.h> #include <asm/todclk.h> +#include <asm/itcw.h> /* This is ugly... */ #define PRINTK_HEADER "dasd:" @@ -221,7 +225,7 @@ static int dasd_state_known_to_basic(struct dasd_device *device) return rc; } /* register 'device' debug area, used for all DBF_DEV_XXX calls */ - device->debug_area = debug_register(dev_name(&device->cdev->dev), 1, 1, + device->debug_area = debug_register(dev_name(&device->cdev->dev), 4, 1, 8 * sizeof(long)); debug_register_view(device->debug_area, &debug_sprintf_view); debug_set_level(device->debug_area, DBF_WARNING); @@ -762,7 +766,7 @@ static inline int dasd_check_cqr(struct dasd_ccw_req *cqr) return -EINVAL; device = cqr->startdev; if (strncmp((char *) &cqr->magic, device->discipline->ebcname, 4)) { - DEV_MESSAGE(KERN_WARNING, device, + DBF_DEV_EVENT(DBF_WARNING, device, " dasd_ccw_req 0x%08x magic doesn't match" " discipline 0x%08x", cqr->magic, @@ -782,6 +786,7 @@ int dasd_term_IO(struct dasd_ccw_req *cqr) { struct dasd_device *device; int retries, rc; + char errorstring[ERRORLENGTH]; /* Check the cqr */ rc = dasd_check_cqr(cqr); @@ -815,10 +820,10 @@ int dasd_term_IO(struct dasd_ccw_req *cqr) "device busy, retry later"); break; default: - DEV_MESSAGE(KERN_ERR, device, - "line %d unknown RC=%d, please " - "report to linux390@de.ibm.com", - __LINE__, rc); + /* internal error 10 - unknown rc*/ + snprintf(errorstring, ERRORLENGTH, "10 %d", rc); + dev_err(&device->cdev->dev, "An error occurred in the " + "DASD device driver, reason=%s\n", errorstring); BUG(); break; } @@ -836,6 +841,7 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) { struct dasd_device *device; int rc; + char errorstring[ERRORLENGTH]; /* Check the cqr */ rc = dasd_check_cqr(cqr); @@ -843,17 +849,23 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) return rc; device = (struct dasd_device *) cqr->startdev; if (cqr->retries < 0) { - DEV_MESSAGE(KERN_DEBUG, device, - "start_IO: request %p (%02x/%i) - no retry left.", - cqr, cqr->status, cqr->retries); + /* internal error 14 - start_IO run out of retries */ + sprintf(errorstring, "14 %p", cqr); + dev_err(&device->cdev->dev, "An error occurred in the DASD " + "device driver, reason=%s\n", errorstring); cqr->status = DASD_CQR_ERROR; return -EIO; } cqr->startclk = get_clock(); cqr->starttime = jiffies; cqr->retries--; - rc = ccw_device_start(device->cdev, cqr->cpaddr, (long) cqr, - cqr->lpm, 0); + if (cqr->cpmode == 1) { + rc = ccw_device_tm_start(device->cdev, cqr->cpaddr, + (long) cqr, cqr->lpm); + } else { + rc = ccw_device_start(device->cdev, cqr->cpaddr, + (long) cqr, cqr->lpm, 0); + } switch (rc) { case 0: cqr->status = DASD_CQR_IN_IO; @@ -862,11 +874,11 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) cqr); break; case -EBUSY: - DBF_DEV_EVENT(DBF_ERR, device, "%s", + DBF_DEV_EVENT(DBF_DEBUG, device, "%s", "start_IO: device busy, retry later"); break; case -ETIMEDOUT: - DBF_DEV_EVENT(DBF_ERR, device, "%s", + DBF_DEV_EVENT(DBF_DEBUG, device, "%s", "start_IO: request timeout, retry later"); break; case -EACCES: @@ -876,19 +888,24 @@ int dasd_start_IO(struct dasd_ccw_req *cqr) * Do a retry with all available pathes. */ cqr->lpm = LPM_ANYPATH; - DBF_DEV_EVENT(DBF_ERR, device, "%s", + DBF_DEV_EVENT(DBF_DEBUG, device, "%s", "start_IO: selected pathes gone," " retry on all pathes"); break; case -ENODEV: + DBF_DEV_EVENT(DBF_DEBUG, device, "%s", + "start_IO: -ENODEV device gone, retry"); + break; case -EIO: - DBF_DEV_EVENT(DBF_ERR, device, "%s", - "start_IO: device gone, retry"); + DBF_DEV_EVENT(DBF_DEBUG, device, "%s", + "start_IO: -EIO device gone, retry"); break; default: - DEV_MESSAGE(KERN_ERR, device, - "line %d unknown RC=%d, please report" - " to linux390@de.ibm.com", __LINE__, rc); + /* internal error 11 - unknown rc */ + snprintf(errorstring, ERRORLENGTH, "11 %d", rc); + dev_err(&device->cdev->dev, + "An error occurred in the DASD device driver, " + "reason=%s\n", errorstring); BUG(); break; } @@ -945,7 +962,7 @@ static void dasd_handle_killed_request(struct ccw_device *cdev, return; cqr = (struct dasd_ccw_req *) intparm; if (cqr->status != DASD_CQR_IN_IO) { - MESSAGE(KERN_DEBUG, + DBF_EVENT(DBF_DEBUG, "invalid status in handle_killed_request: " "bus_id %s, status %02x", dev_name(&cdev->dev), cqr->status); @@ -956,8 +973,8 @@ static void dasd_handle_killed_request(struct ccw_device *cdev, if (device == NULL || device != dasd_device_from_cdev_locked(cdev) || strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) { - MESSAGE(KERN_DEBUG, "invalid device in request: bus_id %s", - dev_name(&cdev->dev)); + DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: " + "bus_id %s", dev_name(&cdev->dev)); return; } @@ -996,11 +1013,11 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, case -EIO: break; case -ETIMEDOUT: - printk(KERN_WARNING"%s(%s): request timed out\n", + DBF_EVENT(DBF_WARNING, "%s(%s): request timed out\n", __func__, dev_name(&cdev->dev)); break; default: - printk(KERN_WARNING"%s(%s): unknown error %ld\n", + DBF_EVENT(DBF_WARNING, "%s(%s): unknown error %ld\n", __func__, dev_name(&cdev->dev), PTR_ERR(irb)); } dasd_handle_killed_request(cdev, intparm); @@ -1009,15 +1026,11 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, now = get_clock(); - DBF_EVENT(DBF_ERR, "Interrupt: bus_id %s CS/DS %04x ip %08x", - dev_name(&cdev->dev), ((irb->scsw.cmd.cstat << 8) | - irb->scsw.cmd.dstat), (unsigned int) intparm); - /* check for unsolicited interrupts */ cqr = (struct dasd_ccw_req *) intparm; - if (!cqr || ((irb->scsw.cmd.cc == 1) && - (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) && - (irb->scsw.cmd.stctl & SCSW_STCTL_STATUS_PEND))) { + if (!cqr || ((scsw_cc(&irb->scsw) == 1) && + (scsw_fctl(&irb->scsw) & SCSW_FCTL_START_FUNC) && + (scsw_stctl(&irb->scsw) & SCSW_STCTL_STATUS_PEND))) { if (cqr && cqr->status == DASD_CQR_IN_IO) cqr->status = DASD_CQR_QUEUED; device = dasd_device_from_cdev_locked(cdev); @@ -1033,14 +1046,14 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, device = (struct dasd_device *) cqr->startdev; if (!device || strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) { - MESSAGE(KERN_DEBUG, "invalid device in request: bus_id %s", - dev_name(&cdev->dev)); + DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: " + "bus_id %s", dev_name(&cdev->dev)); return; } /* Check for clear pending */ if (cqr->status == DASD_CQR_CLEAR_PENDING && - irb->scsw.cmd.fctl & SCSW_FCTL_CLEAR_FUNC) { + scsw_fctl(&irb->scsw) & SCSW_FCTL_CLEAR_FUNC) { cqr->status = DASD_CQR_CLEARED; dasd_device_clear_timer(device); wake_up(&dasd_flush_wq); @@ -1048,19 +1061,17 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, return; } - /* check status - the request might have been killed by dyn detach */ + /* check status - the request might have been killed by dyn detach */ if (cqr->status != DASD_CQR_IN_IO) { - MESSAGE(KERN_DEBUG, - "invalid status: bus_id %s, status %02x", - dev_name(&cdev->dev), cqr->status); + DBF_DEV_EVENT(DBF_DEBUG, device, "invalid status: bus_id %s, " + "status %02x", dev_name(&cdev->dev), cqr->status); return; } - DBF_DEV_EVENT(DBF_DEBUG, device, "Int: CS/DS 0x%04x for cqr %p", - ((irb->scsw.cmd.cstat << 8) | irb->scsw.cmd.dstat), cqr); + next = NULL; expires = 0; - if (irb->scsw.cmd.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END) && - irb->scsw.cmd.cstat == 0 && !irb->esw.esw0.erw.cons) { + if (scsw_dstat(&irb->scsw) == (DEV_STAT_CHN_END | DEV_STAT_DEV_END) && + scsw_cstat(&irb->scsw) == 0) { /* request was completed successfully */ cqr->status = DASD_CQR_SUCCESS; cqr->stopclk = now; @@ -1071,18 +1082,23 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, } } else { /* error */ memcpy(&cqr->irb, irb, sizeof(struct irb)); + /* log sense for every failed I/O to s390 debugfeature */ + dasd_log_sense_dbf(cqr, irb); if (device->features & DASD_FEATURE_ERPLOG) { dasd_log_sense(cqr, irb); } + /* * If we don't want complex ERP for this request, then just * reset this and retry it in the fastpath */ if (!test_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags) && cqr->retries > 0) { - DEV_MESSAGE(KERN_DEBUG, device, - "default ERP in fastpath (%i retries left)", - cqr->retries); + if (cqr->lpm == LPM_ANYPATH) + DBF_DEV_EVENT(DBF_DEBUG, device, + "default ERP in fastpath " + "(%i retries left)", + cqr->retries); cqr->lpm = LPM_ANYPATH; cqr->status = DASD_CQR_QUEUED; next = cqr; @@ -1093,10 +1109,6 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm, (!device->stopped)) { if (device->discipline->start_IO(next) == 0) expires = next->expires; - else - DEV_MESSAGE(KERN_DEBUG, device, "%s", - "Interrupt fastpath " - "failed!"); } if (expires != 0) dasd_device_set_timer(device, expires); @@ -1169,6 +1181,7 @@ static void __dasd_device_process_final_queue(struct dasd_device *device, struct dasd_block *block; void (*callback)(struct dasd_ccw_req *, void *data); void *callback_data; + char errorstring[ERRORLENGTH]; list_for_each_safe(l, n, final_queue) { cqr = list_entry(l, struct dasd_ccw_req, devlist); @@ -1189,10 +1202,11 @@ static void __dasd_device_process_final_queue(struct dasd_device *device, cqr->status = DASD_CQR_TERMINATED; break; default: - DEV_MESSAGE(KERN_ERR, device, - "wrong cqr status in __dasd_process_final_queue " - "for cqr %p, status %x", - cqr, cqr->status); + /* internal error 12 - wrong cqr status*/ + snprintf(errorstring, ERRORLENGTH, "12 %p %x02", cqr, cqr->status); + dev_err(&device->cdev->dev, + "An error occurred in the DASD device driver, " + "reason=%s\n", errorstring); BUG(); } if (cqr->callback != NULL) @@ -1217,18 +1231,17 @@ static void __dasd_device_check_expire(struct dasd_device *device) (time_after_eq(jiffies, cqr->expires + cqr->starttime))) { if (device->discipline->term_IO(cqr) != 0) { /* Hmpf, try again in 5 sec */ - DEV_MESSAGE(KERN_ERR, device, - "internal error - timeout (%is) expired " - "for cqr %p, termination failed, " - "retrying in 5s", - (cqr->expires/HZ), cqr); + dev_err(&device->cdev->dev, + "cqr %p timed out (%is) but cannot be " + "ended, retrying in 5 s\n", + cqr, (cqr->expires/HZ)); cqr->expires += 5*HZ; dasd_device_set_timer(device, 5*HZ); } else { - DEV_MESSAGE(KERN_ERR, device, - "internal error - timeout (%is) expired " - "for cqr %p (%i retries left)", - (cqr->expires/HZ), cqr, cqr->retries); + dev_err(&device->cdev->dev, + "cqr %p timed out (%is), %i retries " + "remaining\n", cqr, (cqr->expires/HZ), + cqr->retries); } } } @@ -1290,10 +1303,9 @@ int dasd_flush_device_queue(struct dasd_device *device) rc = device->discipline->term_IO(cqr); if (rc) { /* unable to terminate requeust */ - DEV_MESSAGE(KERN_ERR, device, - "dasd flush ccw_queue is unable " - " to terminate request %p", - cqr); + dev_err(&device->cdev->dev, + "Flushing the DASD request queue " + "failed for request %p\n", cqr); /* stop flush processing */ goto finished; } @@ -1537,10 +1549,9 @@ int dasd_cancel_req(struct dasd_ccw_req *cqr) /* request in IO - terminate IO and release again */ rc = device->discipline->term_IO(cqr); if (rc) { - DEV_MESSAGE(KERN_ERR, device, - "dasd_cancel_req is unable " - " to terminate request %p, rc = %d", - cqr, rc); + dev_err(&device->cdev->dev, + "Cancelling request %p failed with rc=%d\n", + cqr, rc); } else { cqr->stopclk = get_clock(); rc = 1; @@ -1617,7 +1628,7 @@ static inline void __dasd_block_process_erp(struct dasd_block *block, if (cqr->status == DASD_CQR_DONE) DBF_DEV_EVENT(DBF_NOTICE, device, "%s", "ERP successful"); else - DEV_MESSAGE(KERN_ERR, device, "%s", "ERP unsuccessful"); + dev_err(&device->cdev->dev, "ERP failed for the DASD\n"); erp_fn = device->discipline->erp_postaction(cqr); erp_fn(cqr); } @@ -1991,8 +2002,11 @@ static void dasd_setup_queue(struct dasd_block *block) blk_queue_max_sectors(block->request_queue, max); blk_queue_max_phys_segments(block->request_queue, -1L); blk_queue_max_hw_segments(block->request_queue, -1L); - blk_queue_max_segment_size(block->request_queue, -1L); - blk_queue_segment_boundary(block->request_queue, -1L); + /* with page sized segments we can translate each segement into + * one idaw/tidaw + */ + blk_queue_max_segment_size(block->request_queue, PAGE_SIZE); + blk_queue_segment_boundary(block->request_queue, PAGE_SIZE - 1); blk_queue_ordered(block->request_queue, QUEUE_ORDERED_DRAIN, NULL); } @@ -2043,8 +2057,9 @@ static int dasd_open(struct block_device *bdev, fmode_t mode) } if (dasd_probeonly) { - DEV_MESSAGE(KERN_INFO, base, "%s", - "No access to device due to probeonly mode"); + dev_info(&base->cdev->dev, + "Accessing the DASD failed because it is in " + "probeonly mode\n"); rc = -EPERM; goto out; } @@ -2101,7 +2116,8 @@ dasd_device_operations = { .owner = THIS_MODULE, .open = dasd_open, .release = dasd_release, - .locked_ioctl = dasd_ioctl, + .ioctl = dasd_ioctl, + .compat_ioctl = dasd_ioctl, .getgeo = dasd_getgeo, }; @@ -2143,14 +2159,14 @@ int dasd_generic_probe(struct ccw_device *cdev, ret = ccw_device_set_options(cdev, CCWDEV_DO_PATHGROUP); if (ret) { - printk(KERN_WARNING + DBF_EVENT(DBF_WARNING, "dasd_generic_probe: could not set ccw-device options " "for %s\n", dev_name(&cdev->dev)); return ret; } ret = dasd_add_sysfs_files(cdev); if (ret) { - printk(KERN_WARNING + DBF_EVENT(DBF_WARNING, "dasd_generic_probe: could not add sysfs entries " "for %s\n", dev_name(&cdev->dev)); return ret; @@ -2166,9 +2182,7 @@ int dasd_generic_probe(struct ccw_device *cdev, (dasd_autodetect && dasd_busid_known(dev_name(&cdev->dev)) != 0)) ret = ccw_device_set_online(cdev); if (ret) - printk(KERN_WARNING - "dasd_generic_probe: could not initially " - "online ccw-device %s; return code: %d\n", + pr_warning("%s: Setting the DASD online failed with rc=%d\n", dev_name(&cdev->dev), ret); return 0; } @@ -2232,10 +2246,9 @@ int dasd_generic_set_online(struct ccw_device *cdev, discipline = base_discipline; if (device->features & DASD_FEATURE_USEDIAG) { if (!dasd_diag_discipline_pointer) { - printk (KERN_WARNING - "dasd_generic couldn't online device %s " - "- discipline DIAG not available\n", - dev_name(&cdev->dev)); + pr_warning("%s Setting the DASD online failed because " + "of missing DIAG discipline\n", + dev_name(&cdev->dev)); dasd_delete_device(device); return -ENODEV; } @@ -2256,10 +2269,9 @@ int dasd_generic_set_online(struct ccw_device *cdev, /* check_device will allocate block device if necessary */ rc = discipline->check_device(device); if (rc) { - printk (KERN_WARNING - "dasd_generic couldn't online device %s " - "with discipline %s rc=%i\n", - dev_name(&cdev->dev), discipline->name, rc); + pr_warning("%s Setting the DASD online with discipline %s " + "failed with rc=%i\n", + dev_name(&cdev->dev), discipline->name, rc); module_put(discipline->owner); module_put(base_discipline->owner); dasd_delete_device(device); @@ -2268,9 +2280,8 @@ int dasd_generic_set_online(struct ccw_device *cdev, dasd_set_target_state(device, DASD_STATE_ONLINE); if (device->state <= DASD_STATE_KNOWN) { - printk (KERN_WARNING - "dasd_generic discipline not found for %s\n", - dev_name(&cdev->dev)); + pr_warning("%s Setting the DASD online failed because of a " + "missing discipline\n", dev_name(&cdev->dev)); rc = -ENODEV; dasd_set_target_state(device, DASD_STATE_NEW); if (device->block) @@ -2314,13 +2325,13 @@ int dasd_generic_set_offline(struct ccw_device *cdev) open_count = atomic_read(&device->block->open_count); if (open_count > max_count) { if (open_count > 0) - printk(KERN_WARNING "Can't offline dasd " - "device with open count = %i.\n", - open_count); + pr_warning("%s: The DASD cannot be set offline " + "with open count %i\n", + dev_name(&cdev->dev), open_count); else - printk(KERN_WARNING "%s", - "Can't offline dasd device due " - "to internal use\n"); + pr_warning("%s: The DASD cannot be set offline " + "while it is in use\n", + dev_name(&cdev->dev)); clear_bit(DASD_FLAG_OFFLINE, &device->flags); dasd_put_device(device); return -EBUSY; @@ -2393,8 +2404,10 @@ static struct dasd_ccw_req *dasd_generic_build_rdc(struct dasd_device *device, cqr = dasd_smalloc_request(magic, 1 /* RDC */, rdc_buffer_size, device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "Could not allocate RDC request"); + /* internal error 13 - Allocating the RDC request failed*/ + dev_err(&device->cdev->dev, + "An error occurred in the DASD device driver, " + "reason=%s\n", "13"); return cqr; } @@ -2431,6 +2444,40 @@ int dasd_generic_read_dev_chars(struct dasd_device *device, char *magic, } EXPORT_SYMBOL_GPL(dasd_generic_read_dev_chars); +/* + * In command mode and transport mode we need to look for sense + * data in different places. The sense data itself is allways + * an array of 32 bytes, so we can unify the sense data access + * for both modes. + */ +char *dasd_get_sense(struct irb *irb) +{ + struct tsb *tsb = NULL; + char *sense = NULL; + + if (scsw_is_tm(&irb->scsw) && (irb->scsw.tm.fcxs == 0x01)) { + if (irb->scsw.tm.tcw) + tsb = tcw_get_tsb((struct tcw *)(unsigned long) + irb->scsw.tm.tcw); + if (tsb && tsb->length == 64 && tsb->flags) + switch (tsb->flags & 0x07) { + case 1: /* tsa_iostat */ + sense = tsb->tsa.iostat.sense; + break; + case 2: /* tsa_ddpc */ + sense = tsb->tsa.ddpc.sense; + break; + default: + /* currently we don't use interrogate data */ + break; + } + } else if (irb->esw.esw0.erw.cons) { + sense = irb->ecw; + } + return sense; +} +EXPORT_SYMBOL_GPL(dasd_get_sense); + static int __init dasd_init(void) { int rc; @@ -2472,7 +2519,7 @@ static int __init dasd_init(void) return 0; failed: - MESSAGE(KERN_INFO, "%s", "initialization not performed due to errors"); + pr_info("The DASD device driver could not be initialized\n"); dasd_exit(); return rc; } diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c index d82aad5224f0..27991b692056 100644 --- a/drivers/s390/block/dasd_3990_erp.c +++ b/drivers/s390/block/dasd_3990_erp.c @@ -7,6 +7,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/timer.h> #include <linux/slab.h> #include <asm/idals.h> @@ -75,7 +77,7 @@ dasd_3990_erp_block_queue(struct dasd_ccw_req * erp, int expires) struct dasd_device *device = erp->startdev; unsigned long flags; - DEV_MESSAGE(KERN_INFO, device, + DBF_DEV_EVENT(DBF_INFO, device, "blocking request queue for %is", expires/HZ); spin_lock_irqsave(get_ccwdev_lock(device->cdev), flags); @@ -114,9 +116,9 @@ dasd_3990_erp_int_req(struct dasd_ccw_req * erp) } else { /* issue a message and wait for 'device ready' interrupt */ - DEV_MESSAGE(KERN_ERR, device, "%s", + dev_err(&device->cdev->dev, "is offline or not installed - " - "INTERVENTION REQUIRED!!"); + "INTERVENTION REQUIRED!!\n"); dasd_3990_erp_block_queue(erp, 60*HZ); } @@ -158,7 +160,7 @@ dasd_3990_erp_alternate_path(struct dasd_ccw_req * erp) if ((erp->lpm & opm) != 0x00) { - DEV_MESSAGE(KERN_DEBUG, device, + DBF_DEV_EVENT(DBF_WARNING, device, "try alternate lpm=%x (lpum=%x / opm=%x)", erp->lpm, erp->irb.esw.esw0.sublog.lpum, opm); @@ -166,10 +168,9 @@ dasd_3990_erp_alternate_path(struct dasd_ccw_req * erp) erp->status = DASD_CQR_FILLED; erp->retries = 10; } else { - DEV_MESSAGE(KERN_ERR, device, - "No alternate channel path left (lpum=%x / " - "opm=%x) -> permanent error", - erp->irb.esw.esw0.sublog.lpum, opm); + dev_err(&device->cdev->dev, + "The DASD cannot be reached on any path (lpum=%x" + "/opm=%x)\n", erp->irb.esw.esw0.sublog.lpum, opm); /* post request with permanent error */ erp->status = DASD_CQR_FAILED; @@ -204,8 +205,8 @@ dasd_3990_erp_DCTL(struct dasd_ccw_req * erp, char modifier) sizeof(struct DCTL_data), device); if (IS_ERR(dctl_cqr)) { - DEV_MESSAGE(KERN_ERR, device, "%s", - "Unable to allocate DCTL-CQR"); + dev_err(&device->cdev->dev, + "Unable to allocate DCTL-CQR\n"); erp->status = DASD_CQR_FAILED; return erp; } @@ -294,7 +295,7 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) /* interrupt (this enables easier enqueing of the cqr) */ if (erp->function != dasd_3990_erp_action_4) { - DEV_MESSAGE(KERN_INFO, device, "%s", + DBF_DEV_EVENT(DBF_INFO, device, "%s", "dasd_3990_erp_action_4: first time retry"); erp->retries = 256; @@ -303,7 +304,7 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) } else { if (sense && (sense[25] == 0x1D)) { /* state change pending */ - DEV_MESSAGE(KERN_INFO, device, + DBF_DEV_EVENT(DBF_INFO, device, "waiting for state change pending " "interrupt, %d retries left", erp->retries); @@ -311,15 +312,14 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) dasd_3990_erp_block_queue(erp, 30*HZ); } else if (sense && (sense[25] == 0x1E)) { /* busy */ - DEV_MESSAGE(KERN_INFO, device, + DBF_DEV_EVENT(DBF_INFO, device, "busy - redriving request later, " "%d retries left", erp->retries); dasd_3990_erp_block_queue(erp, HZ); } else { - /* no state change pending - retry */ - DEV_MESSAGE (KERN_INFO, device, + DBF_DEV_EVENT(DBF_INFO, device, "redriving request immediately, " "%d retries left", erp->retries); @@ -384,6 +384,7 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) struct dasd_device *device = erp->startdev; char msg_format = (sense[7] & 0xF0); char msg_no = (sense[7] & 0x0F); + char errorstring[ERRORLENGTH]; switch (msg_format) { case 0x00: /* Format 0 - Program or System Checks */ @@ -394,95 +395,97 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) case 0x00: /* No Message */ break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Invalid Command"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Invalid Command\n"); break; case 0x02: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 0 - Invalid Command " - "Sequence"); + "Sequence\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 0 - CCW Count less than " - "required"); + "required\n"); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Invalid Parameter"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Invalid Parameter\n"); break; case 0x05: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Diagnostic of Sepecial" - " Command Violates File Mask"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Diagnostic of Special" + " Command Violates File Mask\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 0 - Channel Returned with " - "Incorrect retry CCW"); + "Incorrect retry CCW\n"); break; case 0x08: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Reset Notification"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Reset Notification\n"); break; case 0x09: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Storage Path Restart"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Storage Path Restart\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, + dev_warn(&device->cdev->dev, "FORMAT 0 - Channel requested " - "... %02x", sense[8]); + "... %02x\n", sense[8]); break; case 0x0B: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 0 - Invalid Defective/" - "Alternate Track Pointer"); + "Alternate Track Pointer\n"); break; case 0x0C: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 0 - DPS Installation " - "Check"); + "Check\n"); break; case 0x0E: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 0 - Command Invalid on " - "Secondary Address"); + "Secondary Address\n"); break; case 0x0F: - DEV_MESSAGE(KERN_WARNING, device, + dev_warn(&device->cdev->dev, "FORMAT 0 - Status Not As " - "Required: reason %02x", sense[8]); + "Required: reason %02x\n", + sense[8]); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Reseved"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Reserved\n"); } } else { switch (msg_no) { case 0x00: /* No Message */ break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Device Error Source"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Device Error " + "Source\n"); break; case 0x02: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Reserved\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, + dev_warn(&device->cdev->dev, "FORMAT 0 - Device Fenced - " - "device = %02x", sense[4]); + "device = %02x\n", sense[4]); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 0 - Data Pinned for " - "Device"); + "Device\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 0 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 0 - Reserved\n"); } } break; @@ -492,348 +495,352 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) case 0x00: /* No Message */ break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 1 - Device Status 1 not as " - "expected"); + "expected\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Index missing"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Index missing\n"); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Interruption cannot be reset"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Interruption cannot be " + "reset\n"); break; case 0x05: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 1 - Device did not respond to " - "selection"); + "selection\n"); break; case 0x06: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 1 - Device check-2 error or Set " - "Sector is not complete"); + "Sector is not complete\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 1 - Head address does not " - "compare"); + "compare\n"); break; case 0x08: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Device status 1 not valid"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Device status 1 not valid\n"); break; case 0x09: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Device not ready"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Device not ready\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 1 - Track physical address did " - "not compare"); + "not compare\n"); break; case 0x0B: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Missing device address bit"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Missing device address bit\n"); break; case 0x0C: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Drive motor switch is off"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Drive motor switch is off\n"); break; case 0x0D: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Seek incomplete"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Seek incomplete\n"); break; case 0x0E: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 1 - Cylinder address did not " - "compare"); + "compare\n"); break; case 0x0F: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 1 - Offset active cannot be " - "reset"); + "reset\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 1 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 1 - Reserved\n"); } break; case 0x20: /* Format 2 - 3990 Equipment Checks */ switch (msg_no) { case 0x08: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 2 - 3990 check-2 error"); + dev_warn(&device->cdev->dev, + "FORMAT 2 - 3990 check-2 error\n"); break; case 0x0E: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 2 - Support facility errors"); + dev_warn(&device->cdev->dev, + "FORMAT 2 - Support facility errors\n"); break; case 0x0F: - DEV_MESSAGE(KERN_WARNING, device, - "FORMAT 2 - Microcode detected error %02x", - sense[8]); + dev_warn(&device->cdev->dev, + "FORMAT 2 - Microcode detected error " + "%02x\n", + sense[8]); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 2 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 2 - Reserved\n"); } break; case 0x30: /* Format 3 - 3990 Control Checks */ switch (msg_no) { case 0x0F: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 3 - Allegiance terminated"); + dev_warn(&device->cdev->dev, + "FORMAT 3 - Allegiance terminated\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 3 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 3 - Reserved\n"); } break; case 0x40: /* Format 4 - Data Checks */ switch (msg_no) { case 0x00: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 4 - Home address area error"); + dev_warn(&device->cdev->dev, + "FORMAT 4 - Home address area error\n"); break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 4 - Count area error"); + dev_warn(&device->cdev->dev, + "FORMAT 4 - Count area error\n"); break; case 0x02: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 4 - Key area error"); + dev_warn(&device->cdev->dev, + "FORMAT 4 - Key area error\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 4 - Data area error"); + dev_warn(&device->cdev->dev, + "FORMAT 4 - Data area error\n"); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - No sync byte in home address " - "area"); + "area\n"); break; case 0x05: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - No sync byte in count address " - "area"); + "area\n"); break; case 0x06: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 4 - No sync byte in key area"); + dev_warn(&device->cdev->dev, + "FORMAT 4 - No sync byte in key area\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 4 - No sync byte in data area"); + dev_warn(&device->cdev->dev, + "FORMAT 4 - No sync byte in data area\n"); break; case 0x08: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - Home address area error; " - "offset active"); + "offset active\n"); break; case 0x09: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - Count area error; offset " - "active"); + "active\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - Key area error; offset " - "active"); + "active\n"); break; case 0x0B: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - Data area error; " - "offset active"); + "offset active\n"); break; case 0x0C: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - No sync byte in home " - "address area; offset active"); + "address area; offset active\n"); break; case 0x0D: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - No syn byte in count " - "address area; offset active"); + "address area; offset active\n"); break; case 0x0E: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - No sync byte in key area; " - "offset active"); + "offset active\n"); break; case 0x0F: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 4 - No syn byte in data area; " - "offset active"); + "offset active\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 4 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 4 - Reserved\n"); } break; case 0x50: /* Format 5 - Data Check with displacement information */ switch (msg_no) { case 0x00: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 5 - Data Check in the " - "home address area"); + "home address area\n"); break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 5 - Data Check in the count area"); + dev_warn(&device->cdev->dev, + "FORMAT 5 - Data Check in the count " + "area\n"); break; case 0x02: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 5 - Data Check in the key area"); + dev_warn(&device->cdev->dev, + "FORMAT 5 - Data Check in the key area\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 5 - Data Check in the data area"); + dev_warn(&device->cdev->dev, + "FORMAT 5 - Data Check in the data " + "area\n"); break; case 0x08: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 5 - Data Check in the " - "home address area; offset active"); + "home address area; offset active\n"); break; case 0x09: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 5 - Data Check in the count area; " - "offset active"); + "offset active\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 5 - Data Check in the key area; " - "offset active"); + "offset active\n"); break; case 0x0B: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 5 - Data Check in the data area; " - "offset active"); + "offset active\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 5 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 5 - Reserved\n"); } break; case 0x60: /* Format 6 - Usage Statistics/Overrun Errors */ switch (msg_no) { case 0x00: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel A"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel A\n"); break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel B"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel B\n"); break; case 0x02: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel C"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel C\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel D"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel D\n"); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel E"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel E\n"); break; case 0x05: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel F"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel F\n"); break; case 0x06: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel G"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel G\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Overrun on channel H"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Overrun on channel H\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 6 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 6 - Reserved\n"); } break; case 0x70: /* Format 7 - Device Connection Control Checks */ switch (msg_no) { case 0x00: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - RCC initiated by a connection " - "check alert"); + "check alert\n"); break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - RCC 1 sequence not " - "successful"); + "successful\n"); break; case 0x02: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - RCC 1 and RCC 2 sequences not " - "successful"); + "successful\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - Invalid tag-in during " - "selection sequence"); + "selection sequence\n"); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 7 - extra RCC required"); + dev_warn(&device->cdev->dev, + "FORMAT 7 - extra RCC required\n"); break; case 0x05: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - Invalid DCC selection " - "response or timeout"); + "response or timeout\n"); break; case 0x06: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - Missing end operation; device " - "transfer complete"); + "transfer complete\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - Missing end operation; device " - "transfer incomplete"); + "transfer incomplete\n"); break; case 0x08: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - Invalid tag-in for an " - "immediate command sequence"); + "immediate command sequence\n"); break; case 0x09: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - Invalid tag-in for an " - "extended command sequence"); + "extended command sequence\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - 3990 microcode time out when " - "stopping selection"); + "stopping selection\n"); break; case 0x0B: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - No response to selection " - "after a poll interruption"); + "after a poll interruption\n"); break; case 0x0C: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - Permanent path error (DASD " - "controller not available)"); + "controller not available)\n"); break; case 0x0D: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 7 - DASD controller not available" - " on disconnected command chain"); + " on disconnected command chain\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 7 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 7 - Reserved\n"); } break; @@ -841,52 +848,52 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) switch (msg_no) { case 0x00: /* No Message */ case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - Error correction code " - "hardware fault"); + "hardware fault\n"); break; case 0x03: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - Unexpected end operation " - "response code"); + "response code\n"); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - End operation with transfer " - "count not zero"); + "count not zero\n"); break; case 0x05: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - End operation with transfer " - "count zero"); + "count zero\n"); break; case 0x06: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - DPS checks after a system " - "reset or selective reset"); + "reset or selective reset\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 8 - DPS cannot be filled"); + dev_warn(&device->cdev->dev, + "FORMAT 8 - DPS cannot be filled\n"); break; case 0x08: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - Short busy time-out during " - "device selection"); + "device selection\n"); break; case 0x09: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - DASD controller failed to " - "set or reset the long busy latch"); + "set or reset the long busy latch\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 8 - No interruption from device " - "during a command chain"); + "during a command chain\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 8 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 8 - Reserved\n"); } break; @@ -895,97 +902,100 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) case 0x00: break; /* No Message */ case 0x06: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 9 - Device check-2 error"); + dev_warn(&device->cdev->dev, + "FORMAT 9 - Device check-2 error\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 9 - Head address did not compare"); + dev_warn(&device->cdev->dev, + "FORMAT 9 - Head address did not " + "compare\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 9 - Track physical address did " - "not compare while oriented"); + "not compare while oriented\n"); break; case 0x0E: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT 9 - Cylinder address did not " - "compare"); + "compare\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT 9 - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT 9 - Reserved\n"); } break; case 0xF0: /* Format F - Cache Storage Checks */ switch (msg_no) { case 0x00: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - Operation Terminated"); + dev_warn(&device->cdev->dev, + "FORMAT F - Operation Terminated\n"); break; case 0x01: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - Subsystem Processing Error"); + dev_warn(&device->cdev->dev, + "FORMAT F - Subsystem Processing Error\n"); break; case 0x02: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT F - Cache or nonvolatile storage " - "equipment failure"); + "equipment failure\n"); break; case 0x04: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - Caching terminated"); + dev_warn(&device->cdev->dev, + "FORMAT F - Caching terminated\n"); break; case 0x06: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT F - Cache fast write access not " - "authorized"); + "authorized\n"); break; case 0x07: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - Track format incorrect"); + dev_warn(&device->cdev->dev, + "FORMAT F - Track format incorrect\n"); break; case 0x09: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - Caching reinitiated"); + dev_warn(&device->cdev->dev, + "FORMAT F - Caching reinitiated\n"); break; case 0x0A: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT F - Nonvolatile storage " - "terminated"); + "terminated\n"); break; case 0x0B: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - Volume is suspended duplex"); + dev_warn(&device->cdev->dev, + "FORMAT F - Volume is suspended duplex\n"); /* call extended error reporting (EER) */ dasd_eer_write(device, erp->refers, DASD_EER_PPRCSUSPEND); break; case 0x0C: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - Subsystem status connot be " - "determined"); + dev_warn(&device->cdev->dev, + "FORMAT F - Subsystem status cannot be " + "determined\n"); break; case 0x0D: - DEV_MESSAGE(KERN_WARNING, device, "%s", + dev_warn(&device->cdev->dev, "FORMAT F - Caching status reset to " - "default"); + "default\n"); break; case 0x0E: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT F - DASD Fast Write inhibited"); + dev_warn(&device->cdev->dev, + "FORMAT F - DASD Fast Write inhibited\n"); break; default: - DEV_MESSAGE(KERN_WARNING, device, "%s", - "FORMAT D - Reserved"); + dev_warn(&device->cdev->dev, + "FORMAT D - Reserved\n"); } break; - default: /* unknown message format - should not happen */ - DEV_MESSAGE (KERN_WARNING, device, - "unknown message format %02x", - msg_format); + default: /* unknown message format - should not happen + internal error 03 - unknown message format */ + snprintf(errorstring, ERRORLENGTH, "03 %x02", msg_format); + dev_err(&device->cdev->dev, + "An error occurred in the DASD device driver, " + "reason=%s\n", errorstring); break; } /* end switch message format */ @@ -1015,7 +1025,7 @@ dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense) /* env data present (ACTION 10 - retry should work) */ if (sense[2] & SNS2_ENV_DATA_PRESENT) { - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Command Reject - environmental data present"); dasd_3990_handle_env_data(erp, sense); @@ -1023,9 +1033,10 @@ dasd_3990_erp_com_rej(struct dasd_ccw_req * erp, char *sense) erp->retries = 5; } else { - /* fatal error - set status to FAILED */ - DEV_MESSAGE(KERN_ERR, device, "%s", - "Command Reject - Fatal error"); + /* fatal error - set status to FAILED + internal error 09 - Command Reject */ + dev_err(&device->cdev->dev, "An error occurred in the DASD " + "device driver, reason=%s\n", "09"); erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); } @@ -1061,7 +1072,7 @@ dasd_3990_erp_bus_out(struct dasd_ccw_req * erp) } else { /* issue a message and wait for 'device ready' interrupt */ - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "bus out parity error or BOPC requested by " "channel"); @@ -1093,21 +1104,19 @@ dasd_3990_erp_equip_check(struct dasd_ccw_req * erp, char *sense) erp->function = dasd_3990_erp_equip_check; if (sense[1] & SNS1_WRITE_INHIBITED) { + dev_info(&device->cdev->dev, + "Write inhibited path encountered\n"); - DEV_MESSAGE(KERN_DEBUG, device, "%s", - "Write inhibited path encountered"); - - /* vary path offline */ - DEV_MESSAGE(KERN_ERR, device, "%s", - "Path should be varied off-line. " - "This is not implemented yet \n - please report " - "to linux390@de.ibm.com"); + /* vary path offline + internal error 04 - Path should be varied off-line.*/ + dev_err(&device->cdev->dev, "An error occurred in the DASD " + "device driver, reason=%s\n", "04"); erp = dasd_3990_erp_action_1(erp); } else if (sense[2] & SNS2_ENV_DATA_PRESENT) { - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Equipment Check - " "environmental data present"); dasd_3990_handle_env_data(erp, sense); @@ -1116,7 +1125,7 @@ dasd_3990_erp_equip_check(struct dasd_ccw_req * erp, char *sense) } else if (sense[1] & SNS1_PERM_ERR) { - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Equipment Check - retry exhausted or " "undesirable"); @@ -1125,7 +1134,7 @@ dasd_3990_erp_equip_check(struct dasd_ccw_req * erp, char *sense) } else { /* all other equipment checks - Action 5 */ /* rest is done when retries == 0 */ - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Equipment check or processing error"); erp = dasd_3990_erp_action_5(erp); @@ -1156,9 +1165,9 @@ dasd_3990_erp_data_check(struct dasd_ccw_req * erp, char *sense) if (sense[2] & SNS2_CORRECTABLE) { /* correctable data check */ /* issue message that the data has been corrected */ - DEV_MESSAGE(KERN_EMERG, device, "%s", + dev_emerg(&device->cdev->dev, "Data recovered during retry with PCI " - "fetch mode active"); + "fetch mode active\n"); /* not possible to handle this situation in Linux */ panic("No way to inform application about the possibly " @@ -1166,7 +1175,7 @@ dasd_3990_erp_data_check(struct dasd_ccw_req * erp, char *sense) } else if (sense[2] & SNS2_ENV_DATA_PRESENT) { - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Uncorrectable data check recovered secondary " "addr of duplex pair"); @@ -1174,7 +1183,7 @@ dasd_3990_erp_data_check(struct dasd_ccw_req * erp, char *sense) } else if (sense[1] & SNS1_PERM_ERR) { - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Uncorrectable data check with internal " "retry exhausted"); @@ -1182,7 +1191,7 @@ dasd_3990_erp_data_check(struct dasd_ccw_req * erp, char *sense) } else { /* all other data checks */ - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Uncorrectable data check with retry count " "exhausted..."); @@ -1212,7 +1221,7 @@ dasd_3990_erp_overrun(struct dasd_ccw_req * erp, char *sense) erp->function = dasd_3990_erp_overrun; - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Overrun - service overrun or overrun" " error requested by channel"); @@ -1243,7 +1252,7 @@ dasd_3990_erp_inv_format(struct dasd_ccw_req * erp, char *sense) if (sense[2] & SNS2_ENV_DATA_PRESENT) { - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Track format error when destaging or " "staging data"); @@ -1252,8 +1261,10 @@ dasd_3990_erp_inv_format(struct dasd_ccw_req * erp, char *sense) erp = dasd_3990_erp_action_4(erp, sense); } else { - DEV_MESSAGE(KERN_ERR, device, "%s", - "Invalid Track Format - Fatal error"); + /* internal error 06 - The track format is not valid*/ + dev_err(&device->cdev->dev, + "An error occurred in the DASD device driver, " + "reason=%s\n", "06"); erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); } @@ -1279,8 +1290,8 @@ dasd_3990_erp_EOC(struct dasd_ccw_req * default_erp, char *sense) struct dasd_device *device = default_erp->startdev; - DEV_MESSAGE(KERN_ERR, device, "%s", - "End-of-Cylinder - must never happen"); + dev_err(&device->cdev->dev, + "The cylinder data for accessing the DASD is inconsistent\n"); /* implement action 7 - BUG */ return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); @@ -1306,7 +1317,7 @@ dasd_3990_erp_env_data(struct dasd_ccw_req * erp, char *sense) erp->function = dasd_3990_erp_env_data; - DEV_MESSAGE(KERN_DEBUG, device, "%s", "Environmental data present"); + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Environmental data present"); dasd_3990_handle_env_data(erp, sense); @@ -1339,8 +1350,8 @@ dasd_3990_erp_no_rec(struct dasd_ccw_req * default_erp, char *sense) struct dasd_device *device = default_erp->startdev; - DEV_MESSAGE(KERN_ERR, device, "%s", - "No Record Found - Fatal error "); + dev_err(&device->cdev->dev, + "The specified record was not found\n"); return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); @@ -1365,7 +1376,8 @@ dasd_3990_erp_file_prot(struct dasd_ccw_req * erp) struct dasd_device *device = erp->startdev; - DEV_MESSAGE(KERN_ERR, device, "%s", "File Protected"); + dev_err(&device->cdev->dev, "Accessing the DASD failed because of " + "a hardware error\n"); return dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); @@ -1394,7 +1406,7 @@ static struct dasd_ccw_req *dasd_3990_erp_inspect_alias( if (cqr->block && (cqr->block->base != cqr->startdev)) { if (cqr->startdev->features & DASD_FEATURE_ERPLOG) { - DEV_MESSAGE(KERN_ERR, cqr->startdev, + DBF_DEV_EVENT(DBF_ERR, cqr->startdev, "ERP on alias device for request %p," " recover on base device %s", cqr, dev_name(&cqr->block->base->cdev->dev)); @@ -1511,7 +1523,7 @@ dasd_3990_erp_action_10_32(struct dasd_ccw_req * erp, char *sense) erp->retries = 256; erp->function = dasd_3990_erp_action_10_32; - DEV_MESSAGE(KERN_DEBUG, device, "%s", "Perform logging requested"); + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Perform logging requested"); return erp; @@ -1549,7 +1561,7 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) char *LO_data; /* LO_eckd_data_t */ struct ccw1 *ccw, *oldccw; - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Write not finished because of unexpected condition"); default_erp->function = dasd_3990_erp_action_1B_32; @@ -1561,10 +1573,16 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) cqr = cqr->refers; } + if (scsw_is_tm(&cqr->irb.scsw)) { + DBF_DEV_EVENT(DBF_WARNING, device, "%s", + "32 bit sense, action 1B is not defined" + " in transport mode - just retry"); + return default_erp; + } + /* for imprecise ending just do default erp */ if (sense[1] & 0x01) { - - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Imprecise ending is set - just retry"); return default_erp; @@ -1575,8 +1593,7 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) cpa = default_erp->refers->irb.scsw.cmd.cpa; if (cpa == 0) { - - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Unable to determine address of the CCW " "to be restarted"); @@ -1590,7 +1607,9 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) sizeof(struct LO_eckd_data), device); if (IS_ERR(erp)) { - DEV_MESSAGE(KERN_ERR, device, "%s", "Unable to allocate ERP"); + /* internal error 01 - Unable to allocate ERP */ + dev_err(&device->cdev->dev, "An error occurred in the DASD " + "device driver, reason=%s\n", "01"); return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); } @@ -1599,7 +1618,7 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) oldccw = cqr->cpaddr; if (oldccw->cmd_code == DASD_ECKD_CCW_PFX) { PFX_data = cqr->data; - memcpy(DE_data, &PFX_data->define_extend, + memcpy(DE_data, &PFX_data->define_extent, sizeof(struct DE_eckd_data)); } else memcpy(DE_data, cqr->data, sizeof(struct DE_eckd_data)); @@ -1608,10 +1627,7 @@ dasd_3990_erp_action_1B_32(struct dasd_ccw_req * default_erp, char *sense) LO_data = erp->data + sizeof(struct DE_eckd_data); if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) { - - DEV_MESSAGE(KERN_ERR, device, "%s", - "BUG - this should not happen"); - + /* should not */ return dasd_3990_erp_cleanup(default_erp, DASD_CQR_FAILED); } @@ -1701,7 +1717,7 @@ dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense) char *LO_data; /* struct LO_eckd_data */ struct ccw1 *ccw; - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Write not finished because of unexpected condition" " - follow on"); @@ -1712,10 +1728,16 @@ dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense) cqr = cqr->refers; } + if (scsw_is_tm(&cqr->irb.scsw)) { + DBF_DEV_EVENT(DBF_WARNING, device, "%s", + "32 bit sense, action 1B, update," + " in transport mode - just retry"); + return previous_erp; + } + /* for imprecise ending just do default erp */ if (sense[1] & 0x01) { - - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Imprecise ending is set - just retry"); previous_erp->status = DASD_CQR_FILLED; @@ -1728,10 +1750,10 @@ dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense) cpa = previous_erp->irb.scsw.cmd.cpa; if (cpa == 0) { - - DEV_MESSAGE(KERN_DEBUG, device, "%s", - "Unable to determine address of the CCW " - "to be restarted"); + /* internal error 02 - + Unable to determine address of the CCW to be restarted */ + dev_err(&device->cdev->dev, "An error occurred in the DASD " + "device driver, reason=%s\n", "02"); previous_erp->status = DASD_CQR_FAILED; @@ -1744,10 +1766,7 @@ dasd_3990_update_1B(struct dasd_ccw_req * previous_erp, char *sense) LO_data = erp->data + sizeof(struct DE_eckd_data); if ((sense[3] == 0x01) && (LO_data[1] & 0x01)) { - - DEV_MESSAGE(KERN_ERR, device, "%s", - "BUG - this should not happen"); - + /* should not happen */ previous_erp->status = DASD_CQR_FAILED; return previous_erp; @@ -1935,14 +1954,13 @@ dasd_3990_erp_compound_config(struct dasd_ccw_req * erp, char *sense) if ((sense[25] & DASD_SENSE_BIT_1) && (sense[26] & DASD_SENSE_BIT_2)) { - /* set to suspended duplex state then restart */ + /* set to suspended duplex state then restart + internal error 05 - Set device to suspended duplex state + should be done */ struct dasd_device *device = erp->startdev; - - DEV_MESSAGE(KERN_ERR, device, "%s", - "Set device to suspended duplex state should be " - "done!\n" - "This is not implemented yet (for compound ERP)" - " - please report to linux390@de.ibm.com"); + dev_err(&device->cdev->dev, + "An error occurred in the DASD device driver, " + "reason=%s\n", "05"); } @@ -2012,15 +2030,14 @@ dasd_3990_erp_handle_sim(struct dasd_device *device, char *sense) { /* print message according to log or message to operator mode */ if ((sense[24] & DASD_SIM_MSG_TO_OP) || (sense[1] & 0x10)) { - /* print SIM SRC from RefCode */ - DEV_MESSAGE(KERN_ERR, device, "SIM - SRC: " - "%02x%02x%02x%02x", sense[22], + dev_err(&device->cdev->dev, "SIM - SRC: " + "%02x%02x%02x%02x\n", sense[22], sense[23], sense[11], sense[12]); } else if (sense[24] & DASD_SIM_LOG) { /* print SIM SRC Refcode */ - DEV_MESSAGE(KERN_WARNING, device, "SIM - SRC: " - "%02x%02x%02x%02x", sense[22], + dev_warn(&device->cdev->dev, "log SIM - SRC: " + "%02x%02x%02x%02x\n", sense[22], sense[23], sense[11], sense[12]); } } @@ -2063,14 +2080,14 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) switch (sense[25]) { case 0x00: /* success - use default ERP for retries */ - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_DEBUG, device, "%s", "ERP called for successful request" " - just retry"); break; case 0x01: /* fatal error */ - DEV_MESSAGE(KERN_ERR, device, "%s", - "Retry not recommended - Fatal error"); + dev_err(&device->cdev->dev, + "ERP failed for the DASD\n"); erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); break; @@ -2080,13 +2097,10 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) erp = dasd_3990_erp_int_req(erp); break; - case 0x0F: /* length mismatch during update write command */ - DEV_MESSAGE(KERN_ERR, device, "%s", - "update write command error - should not " - "happen;\n" - "Please send this message together with " - "the above sense data to linux390@de." - "ibm.com"); + case 0x0F: /* length mismatch during update write command + internal error 08 - update write command error*/ + dev_err(&device->cdev->dev, "An error occurred in the " + "DASD device driver, reason=%s\n", "08"); erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); break; @@ -2095,13 +2109,12 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) erp = dasd_3990_erp_action_10_32(erp, sense); break; - case 0x15: /* next track outside defined extend */ - DEV_MESSAGE(KERN_ERR, device, "%s", - "next track outside defined extend - " - "should not happen;\n" - "Please send this message together with " - "the above sense data to linux390@de." - "ibm.com"); + case 0x15: /* next track outside defined extend + internal error 07 - The next track is not + within the defined storage extent */ + dev_err(&device->cdev->dev, + "An error occurred in the DASD device driver, " + "reason=%s\n", "07"); erp = dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED); break; @@ -2112,9 +2125,9 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) break; case 0x1C: /* invalid data */ - DEV_MESSAGE(KERN_EMERG, device, "%s", + dev_emerg(&device->cdev->dev, "Data recovered during retry with PCI " - "fetch mode active"); + "fetch mode active\n"); /* not possible to handle this situation in Linux */ panic @@ -2123,7 +2136,7 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) break; case 0x1D: /* state-change pending */ - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "A State change pending condition exists " "for the subsystem or device"); @@ -2131,7 +2144,7 @@ dasd_3990_erp_inspect_32(struct dasd_ccw_req * erp, char *sense) break; case 0x1E: /* busy */ - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Busy condition exists " "for the subsystem or device"); erp = dasd_3990_erp_action_4(erp, sense); @@ -2171,9 +2184,9 @@ dasd_3990_erp_control_check(struct dasd_ccw_req *erp) { struct dasd_device *device = erp->startdev; - if (erp->refers->irb.scsw.cmd.cstat & (SCHN_STAT_INTF_CTRL_CHK + if (scsw_cstat(&erp->refers->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK | SCHN_STAT_CHN_CTRL_CHK)) { - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "channel or interface control check"); erp = dasd_3990_erp_action_4(erp, NULL); } @@ -2193,21 +2206,23 @@ dasd_3990_erp_control_check(struct dasd_ccw_req *erp) * erp_new contens was possibly modified */ static struct dasd_ccw_req * -dasd_3990_erp_inspect(struct dasd_ccw_req * erp) +dasd_3990_erp_inspect(struct dasd_ccw_req *erp) { struct dasd_ccw_req *erp_new = NULL; - /* sense data are located in the refers record of the */ - /* already set up new ERP ! */ - char *sense = erp->refers->irb.ecw; + char *sense; /* if this problem occured on an alias retry on base */ erp_new = dasd_3990_erp_inspect_alias(erp); if (erp_new) return erp_new; - /* check if no concurrent sens is available */ - if (!erp->refers->irb.esw.esw0.erw.cons) + /* sense data are located in the refers record of the + * already set up new ERP ! + * check if concurrent sens is available + */ + sense = dasd_get_sense(&erp->refers->irb); + if (!sense) erp_new = dasd_3990_erp_control_check(erp); /* distinguish between 24 and 32 byte sense data */ else if (sense[27] & DASD_SENSE_BIT_0) { @@ -2231,7 +2246,11 @@ dasd_3990_erp_inspect(struct dasd_ccw_req * erp) * DESCRIPTION * This funtion adds an additional request block (ERP) to the head of * the given cqr (or erp). - * This erp is initialized as an default erp (retry TIC) + * For a command mode cqr the erp is initialized as an default erp + * (retry TIC). + * For transport mode we make a copy of the original TCW (points to + * the original TCCB, TIDALs, etc.) but give it a fresh + * TSB so the original sense data will not be changed. * * PARAMETER * cqr head of the current ERP-chain (or single cqr if @@ -2239,25 +2258,35 @@ dasd_3990_erp_inspect(struct dasd_ccw_req * erp) * RETURN VALUES * erp pointer to new ERP-chain head */ -static struct dasd_ccw_req * -dasd_3990_erp_add_erp(struct dasd_ccw_req * cqr) +static struct dasd_ccw_req *dasd_3990_erp_add_erp(struct dasd_ccw_req *cqr) { struct dasd_device *device = cqr->startdev; struct ccw1 *ccw; - - /* allocate additional request block */ struct dasd_ccw_req *erp; + int cplength, datasize; + struct tcw *tcw; + struct tsb *tsb; + + if (cqr->cpmode == 1) { + cplength = 0; + datasize = sizeof(struct tcw) + sizeof(struct tsb); + } else { + cplength = 2; + datasize = 0; + } - erp = dasd_alloc_erp_request((char *) &cqr->magic, 2, 0, device); + /* allocate additional request block */ + erp = dasd_alloc_erp_request((char *) &cqr->magic, + cplength, datasize, device); if (IS_ERR(erp)) { if (cqr->retries <= 0) { - DEV_MESSAGE(KERN_ERR, device, "%s", + DBF_DEV_EVENT(DBF_ERR, device, "%s", "Unable to allocate ERP request"); cqr->status = DASD_CQR_FAILED; cqr->stopclk = get_clock (); } else { - DEV_MESSAGE (KERN_ERR, device, + DBF_DEV_EVENT(DBF_ERR, device, "Unable to allocate ERP request " "(%i retries left)", cqr->retries); @@ -2266,13 +2295,24 @@ dasd_3990_erp_add_erp(struct dasd_ccw_req * cqr) return cqr; } - /* initialize request with default TIC to current ERP/CQR */ - ccw = erp->cpaddr; - ccw->cmd_code = CCW_CMD_NOOP; - ccw->flags = CCW_FLAG_CC; - ccw++; - ccw->cmd_code = CCW_CMD_TIC; - ccw->cda = (long)(cqr->cpaddr); + if (cqr->cpmode == 1) { + /* make a shallow copy of the original tcw but set new tsb */ + erp->cpmode = 1; + erp->cpaddr = erp->data; + tcw = erp->data; + tsb = (struct tsb *) &tcw[1]; + *tcw = *((struct tcw *)cqr->cpaddr); + tcw->tsb = (long)tsb; + } else { + /* initialize request with default TIC to current ERP/CQR */ + ccw = erp->cpaddr; + ccw->cmd_code = CCW_CMD_NOOP; + ccw->flags = CCW_FLAG_CC; + ccw++; + ccw->cmd_code = CCW_CMD_TIC; + ccw->cda = (long)(cqr->cpaddr); + } + erp->function = dasd_3990_erp_add_erp; erp->refers = cqr; erp->startdev = device; @@ -2282,7 +2322,6 @@ dasd_3990_erp_add_erp(struct dasd_ccw_req * cqr) erp->expires = 0; erp->retries = 256; erp->buildclk = get_clock(); - erp->status = DASD_CQR_FILLED; return erp; @@ -2340,28 +2379,33 @@ dasd_3990_erp_additional_erp(struct dasd_ccw_req * cqr) * match 'boolean' for match found * returns 1 if match found, otherwise 0. */ -static int -dasd_3990_erp_error_match(struct dasd_ccw_req *cqr1, struct dasd_ccw_req *cqr2) +static int dasd_3990_erp_error_match(struct dasd_ccw_req *cqr1, + struct dasd_ccw_req *cqr2) { + char *sense1, *sense2; if (cqr1->startdev != cqr2->startdev) return 0; - if (cqr1->irb.esw.esw0.erw.cons != cqr2->irb.esw.esw0.erw.cons) - return 0; + sense1 = dasd_get_sense(&cqr1->irb); + sense2 = dasd_get_sense(&cqr2->irb); - if ((cqr1->irb.esw.esw0.erw.cons == 0) && - (cqr2->irb.esw.esw0.erw.cons == 0)) { - if ((cqr1->irb.scsw.cmd.cstat & (SCHN_STAT_INTF_CTRL_CHK | - SCHN_STAT_CHN_CTRL_CHK)) == - (cqr2->irb.scsw.cmd.cstat & (SCHN_STAT_INTF_CTRL_CHK | - SCHN_STAT_CHN_CTRL_CHK))) + /* one request has sense data, the other not -> no match, return 0 */ + if (!sense1 != !sense2) + return 0; + /* no sense data in both cases -> check cstat for IFCC */ + if (!sense1 && !sense2) { + if ((scsw_cstat(&cqr1->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK | + SCHN_STAT_CHN_CTRL_CHK)) == + (scsw_cstat(&cqr2->irb.scsw) & (SCHN_STAT_INTF_CTRL_CHK | + SCHN_STAT_CHN_CTRL_CHK))) return 1; /* match with ifcc*/ } /* check sense data; byte 0-2,25,27 */ - if (!((memcmp (cqr1->irb.ecw, cqr2->irb.ecw, 3) == 0) && - (cqr1->irb.ecw[27] == cqr2->irb.ecw[27]) && - (cqr1->irb.ecw[25] == cqr2->irb.ecw[25]))) { + if (!(sense1 && sense2 && + (memcmp(sense1, sense2, 3) == 0) && + (sense1[27] == sense2[27]) && + (sense1[25] == sense2[25]))) { return 0; /* sense doesn't match */ } @@ -2434,7 +2478,7 @@ dasd_3990_erp_further_erp(struct dasd_ccw_req *erp) { struct dasd_device *device = erp->startdev; - char *sense = erp->irb.ecw; + char *sense = dasd_get_sense(&erp->irb); /* check for 24 byte sense ERP */ if ((erp->function == dasd_3990_erp_bus_out) || @@ -2449,7 +2493,7 @@ dasd_3990_erp_further_erp(struct dasd_ccw_req *erp) /* prepare erp for retry on different channel path */ erp = dasd_3990_erp_action_1(erp); - if (!(sense[2] & DASD_SENSE_BIT_0)) { + if (sense && !(sense[2] & DASD_SENSE_BIT_0)) { /* issue a Diagnostic Control command with an * Inhibit Write subcommand */ @@ -2471,7 +2515,7 @@ dasd_3990_erp_further_erp(struct dasd_ccw_req *erp) break; } default: - DEV_MESSAGE(KERN_DEBUG, device, + DBF_DEV_EVENT(DBF_WARNING, device, "invalid subcommand modifier 0x%x " "for Diagnostic Control Command", sense[25]); @@ -2479,19 +2523,21 @@ dasd_3990_erp_further_erp(struct dasd_ccw_req *erp) } /* check for 32 byte sense ERP */ - } else if ((erp->function == dasd_3990_erp_compound_retry) || - (erp->function == dasd_3990_erp_compound_path) || - (erp->function == dasd_3990_erp_compound_code) || - (erp->function == dasd_3990_erp_compound_config)) { + } else if (sense && + ((erp->function == dasd_3990_erp_compound_retry) || + (erp->function == dasd_3990_erp_compound_path) || + (erp->function == dasd_3990_erp_compound_code) || + (erp->function == dasd_3990_erp_compound_config))) { erp = dasd_3990_erp_compound(erp, sense); } else { - /* No retry left and no additional special handling */ - /*necessary */ - DEV_MESSAGE(KERN_ERR, device, - "no retries left for erp %p - " - "set status to FAILED", erp); + /* + * No retry left and no additional special handling + * necessary + */ + dev_err(&device->cdev->dev, + "ERP %p has run out of retries and failed\n", erp); erp->status = DASD_CQR_FAILED; } @@ -2548,24 +2594,25 @@ dasd_3990_erp_handle_match_erp(struct dasd_ccw_req *erp_head, if (erp->retries > 0) { - char *sense = erp->refers->irb.ecw; + char *sense = dasd_get_sense(&erp->refers->irb); /* check for special retries */ - if (erp->function == dasd_3990_erp_action_4) { + if (sense && erp->function == dasd_3990_erp_action_4) { erp = dasd_3990_erp_action_4(erp, sense); - } else if (erp->function == dasd_3990_erp_action_1B_32) { + } else if (sense && + erp->function == dasd_3990_erp_action_1B_32) { erp = dasd_3990_update_1B(erp, sense); - } else if (erp->function == dasd_3990_erp_int_req) { + } else if (sense && erp->function == dasd_3990_erp_int_req) { erp = dasd_3990_erp_int_req(erp); } else { /* simple retry */ - DEV_MESSAGE(KERN_DEBUG, device, + DBF_DEV_EVENT(DBF_DEBUG, device, "%i retries left for erp %p", erp->retries, erp); @@ -2609,24 +2656,24 @@ dasd_3990_erp_action(struct dasd_ccw_req * cqr) if (device->features & DASD_FEATURE_ERPLOG) { /* print current erp_chain */ - DEV_MESSAGE(KERN_ERR, device, "%s", - "ERP chain at BEGINNING of ERP-ACTION"); + dev_err(&device->cdev->dev, + "ERP chain at BEGINNING of ERP-ACTION\n"); for (temp_erp = cqr; temp_erp != NULL; temp_erp = temp_erp->refers) { - DEV_MESSAGE(KERN_ERR, device, - " erp %p (%02x) refers to %p", + dev_err(&device->cdev->dev, + "ERP %p (%02x) refers to %p\n", temp_erp, temp_erp->status, temp_erp->refers); } } /* double-check if current erp/cqr was successful */ - if ((cqr->irb.scsw.cmd.cstat == 0x00) && - (cqr->irb.scsw.cmd.dstat == + if ((scsw_cstat(&cqr->irb.scsw) == 0x00) && + (scsw_dstat(&cqr->irb.scsw) == (DEV_STAT_CHN_END | DEV_STAT_DEV_END))) { - DEV_MESSAGE(KERN_DEBUG, device, + DBF_DEV_EVENT(DBF_DEBUG, device, "ERP called for successful request %p" " - NO ERP necessary", cqr); @@ -2648,13 +2695,13 @@ dasd_3990_erp_action(struct dasd_ccw_req * cqr) if (device->features & DASD_FEATURE_ERPLOG) { /* print current erp_chain */ - DEV_MESSAGE(KERN_ERR, device, "%s", - "ERP chain at END of ERP-ACTION"); + dev_err(&device->cdev->dev, + "ERP chain at END of ERP-ACTION\n"); for (temp_erp = erp; temp_erp != NULL; temp_erp = temp_erp->refers) { - DEV_MESSAGE(KERN_ERR, device, - " erp %p (%02x) refers to %p", + dev_err(&device->cdev->dev, + "ERP %p (%02x) refers to %p\n", temp_erp, temp_erp->status, temp_erp->refers); } @@ -2667,6 +2714,8 @@ dasd_3990_erp_action(struct dasd_ccw_req * cqr) list_add_tail(&erp->blocklist, &cqr->blocklist); } + + return erp; } /* end dasd_3990_erp_action */ diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c index 20676cdef4a5..5b7bbc87593b 100644 --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -5,6 +5,8 @@ * Author(s): Stefan Weinhuber <wein@de.ibm.com> */ +#define KMSG_COMPONENT "dasd" + #include <linux/list.h> #include <asm/ebcdic.h> #include "dasd_int.h" @@ -503,7 +505,7 @@ static void lcu_update_work(struct work_struct *work) */ spin_lock_irqsave(&lcu->lock, flags); if (rc || (lcu->flags & NEED_UAC_UPDATE)) { - DEV_MESSAGE(KERN_WARNING, device, "could not update" + DBF_DEV_EVENT(DBF_WARNING, device, "could not update" " alias data in lcu (rc = %d), retry later", rc); schedule_delayed_work(&lcu->ruac_data.dwork, 30*HZ); } else { @@ -646,14 +648,16 @@ static int reset_summary_unit_check(struct alias_lcu *lcu, { struct dasd_ccw_req *cqr; int rc = 0; + struct ccw1 *ccw; cqr = lcu->rsu_cqr; strncpy((char *) &cqr->magic, "ECKD", 4); ASCEBC((char *) &cqr->magic, 4); - cqr->cpaddr->cmd_code = DASD_ECKD_CCW_RSCK; - cqr->cpaddr->flags = 0 ; - cqr->cpaddr->count = 16; - cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; + ccw = cqr->cpaddr; + ccw->cmd_code = DASD_ECKD_CCW_RSCK; + ccw->flags = 0 ; + ccw->count = 16; + ccw->cda = (__u32)(addr_t) cqr->data; ((char *)cqr->data)[0] = reason; clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); @@ -855,16 +859,25 @@ void dasd_alias_handle_summary_unit_check(struct dasd_device *device, struct alias_lcu *lcu; char reason; struct dasd_eckd_private *private; + char *sense; private = (struct dasd_eckd_private *) device->private; - reason = irb->ecw[8]; - DEV_MESSAGE(KERN_WARNING, device, "%s %x", - "eckd handle summary unit check: reason", reason); + sense = dasd_get_sense(irb); + if (sense) { + reason = sense[8]; + DBF_DEV_EVENT(DBF_NOTICE, device, "%s %x", + "eckd handle summary unit check: reason", reason); + } else { + DBF_DEV_EVENT(DBF_WARNING, device, "%s", + "eckd handle summary unit check:" + " no reason code available"); + return; + } lcu = private->lcu; if (!lcu) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "device not ready to handle summary" " unit check (no lcu structure)"); return; @@ -877,7 +890,7 @@ void dasd_alias_handle_summary_unit_check(struct dasd_device *device, * the next interrupt on a different device */ if (list_empty(&device->alias_list)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "device is in offline processing," " don't do summary unit check handling"); spin_unlock(&lcu->lock); @@ -885,7 +898,7 @@ void dasd_alias_handle_summary_unit_check(struct dasd_device *device, } if (lcu->suc_data.device) { /* already scheduled or running */ - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "previous instance of summary unit check worker" " still pending"); spin_unlock(&lcu->lock); diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index 34339902efb9..e77666c8e6c0 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -13,6 +13,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/ctype.h> #include <linux/init.h> #include <linux/module.h> @@ -67,6 +69,8 @@ int dasd_probeonly = 0; /* is true, when probeonly mode is active */ int dasd_autodetect = 0; /* is true, when autodetection is active */ int dasd_nopav = 0; /* is true, when PAV is disabled */ EXPORT_SYMBOL_GPL(dasd_nopav); +int dasd_nofcx; /* disable High Performance Ficon */ +EXPORT_SYMBOL_GPL(dasd_nofcx); /* * char *dasd[] is intended to hold the ranges supplied by the dasd= statement @@ -125,6 +129,7 @@ __setup ("dasd=", dasd_call_setup); * Read a device busid/devno from a string. */ static int + dasd_busid(char **str, int *id0, int *id1, int *devno) { int val, old_style; @@ -132,8 +137,7 @@ dasd_busid(char **str, int *id0, int *id1, int *devno) /* Interpret ipldev busid */ if (strncmp(DASD_IPLDEV, *str, strlen(DASD_IPLDEV)) == 0) { if (ipl_info.type != IPL_TYPE_CCW) { - MESSAGE(KERN_ERR, "%s", "ipl device is not a ccw " - "device"); + pr_err("The IPL device is not a CCW device\n"); return -EINVAL; } *id0 = 0; @@ -209,9 +213,8 @@ dasd_feature_list(char *str, char **endp) else if (len == 8 && !strncmp(str, "failfast", 8)) features |= DASD_FEATURE_FAILFAST; else { - MESSAGE(KERN_WARNING, - "unsupported feature: %*s, " - "ignoring setting", len, str); + pr_warning("%*s is not a supported device option\n", + len, str); rc = -EINVAL; } str += len; @@ -220,8 +223,8 @@ dasd_feature_list(char *str, char **endp) str++; } if (*str != ')') { - MESSAGE(KERN_WARNING, "%s", - "missing ')' in dasd parameter string\n"); + pr_warning("A closing parenthesis ')' is missing in the " + "dasd= parameter\n"); rc = -EINVAL; } else str++; @@ -253,25 +256,29 @@ dasd_parse_keyword( char *parsestring ) { } if (strncmp("autodetect", parsestring, length) == 0) { dasd_autodetect = 1; - MESSAGE (KERN_INFO, "%s", - "turning to autodetection mode"); + pr_info("The autodetection mode has been activated\n"); return residual_str; } if (strncmp("probeonly", parsestring, length) == 0) { dasd_probeonly = 1; - MESSAGE(KERN_INFO, "%s", - "turning to probeonly mode"); + pr_info("The probeonly mode has been activated\n"); return residual_str; } if (strncmp("nopav", parsestring, length) == 0) { if (MACHINE_IS_VM) - MESSAGE(KERN_INFO, "%s", "'nopav' not supported on VM"); + pr_info("'nopav' is not supported on z/VM\n"); else { dasd_nopav = 1; - MESSAGE(KERN_INFO, "%s", "disable PAV mode"); + pr_info("PAV support has be deactivated\n"); } return residual_str; } + if (strncmp("nofcx", parsestring, length) == 0) { + dasd_nofcx = 1; + pr_info("High Performance FICON support has been " + "deactivated\n"); + return residual_str; + } if (strncmp("fixedbuffers", parsestring, length) == 0) { if (dasd_page_cache) return residual_str; @@ -280,10 +287,10 @@ dasd_parse_keyword( char *parsestring ) { PAGE_SIZE, SLAB_CACHE_DMA, NULL); if (!dasd_page_cache) - MESSAGE(KERN_WARNING, "%s", "Failed to create slab, " + DBF_EVENT(DBF_WARNING, "%s", "Failed to create slab, " "fixed buffer mode disabled."); else - MESSAGE (KERN_INFO, "%s", + DBF_EVENT(DBF_INFO, "%s", "turning on fixed buffer mode"); return residual_str; } @@ -321,7 +328,7 @@ dasd_parse_range( char *parsestring ) { (from_id0 != to_id0 || from_id1 != to_id1 || from > to)) rc = -EINVAL; if (rc) { - MESSAGE(KERN_ERR, "Invalid device range %s", parsestring); + pr_err("%s is not a valid device range\n", parsestring); return ERR_PTR(rc); } features = dasd_feature_list(str, &str); @@ -340,8 +347,8 @@ dasd_parse_range( char *parsestring ) { return str + 1; if (*str == '\0') return str; - MESSAGE(KERN_WARNING, - "junk at end of dasd parameter string: %s\n", str); + pr_warning("The dasd= parameter value %s has an invalid ending\n", + str); return ERR_PTR(-EINVAL); } diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index ef2a56952054..b9a7f7733446 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c @@ -8,6 +8,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -144,8 +146,8 @@ dasd_diag_erp(struct dasd_device *device) mdsk_term_io(device); rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); if (rc) - DEV_MESSAGE(KERN_WARNING, device, "DIAG ERP unsuccessful, " - "rc=%d", rc); + dev_warn(&device->cdev->dev, "DIAG ERP failed with " + "rc=%d\n", rc); } /* Start a given request at the device. Return zero on success, non-zero @@ -160,7 +162,7 @@ dasd_start_diag(struct dasd_ccw_req * cqr) device = cqr->startdev; if (cqr->retries < 0) { - DEV_MESSAGE(KERN_WARNING, device, "DIAG start_IO: request %p " + DBF_DEV_EVENT(DBF_ERR, device, "DIAG start_IO: request %p " "- no retry left)", cqr); cqr->status = DASD_CQR_ERROR; return -EIO; @@ -195,7 +197,7 @@ dasd_start_diag(struct dasd_ccw_req * cqr) break; default: /* Error condition */ cqr->status = DASD_CQR_QUEUED; - DEV_MESSAGE(KERN_WARNING, device, "dia250 returned rc=%d", rc); + DBF_DEV_EVENT(DBF_WARNING, device, "dia250 returned rc=%d", rc); dasd_diag_erp(device); rc = -EIO; break; @@ -243,13 +245,14 @@ dasd_ext_handler(__u16 code) return; } if (!ip) { /* no intparm: unsolicited interrupt */ - MESSAGE(KERN_DEBUG, "%s", "caught unsolicited interrupt"); + DBF_EVENT(DBF_NOTICE, "%s", "caught unsolicited " + "interrupt"); return; } cqr = (struct dasd_ccw_req *) ip; device = (struct dasd_device *) cqr->startdev; if (strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) { - DEV_MESSAGE(KERN_WARNING, device, + DBF_DEV_EVENT(DBF_WARNING, device, " magic number of dasd_ccw_req 0x%08X doesn't" " match discipline 0x%08X", cqr->magic, *(int *) (&device->discipline->name)); @@ -281,15 +284,11 @@ dasd_ext_handler(__u16 code) rc = dasd_start_diag(next); if (rc == 0) expires = next->expires; - else if (rc != -EACCES) - DEV_MESSAGE(KERN_WARNING, device, "%s", - "Interrupt fastpath " - "failed!"); } } } else { cqr->status = DASD_CQR_QUEUED; - DEV_MESSAGE(KERN_WARNING, device, "interrupt status for " + DBF_DEV_EVENT(DBF_DEBUG, device, "interrupt status for " "request %p was %d (%d retries left)", cqr, status, cqr->retries); dasd_diag_erp(device); @@ -322,8 +321,9 @@ dasd_diag_check_device(struct dasd_device *device) if (private == NULL) { private = kzalloc(sizeof(struct dasd_diag_private),GFP_KERNEL); if (private == NULL) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "memory allocation failed for private data"); + DBF_DEV_EVENT(DBF_WARNING, device, "%s", + "Allocating memory for private DASD data " + "failed\n"); return -ENOMEM; } ccw_device_get_id(device->cdev, &private->dev_id); @@ -331,7 +331,7 @@ dasd_diag_check_device(struct dasd_device *device) } block = dasd_alloc_block(); if (IS_ERR(block)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "could not allocate dasd block structure"); device->private = NULL; kfree(private); @@ -347,7 +347,7 @@ dasd_diag_check_device(struct dasd_device *device) rc = diag210((struct diag210 *) rdc_data); if (rc) { - DEV_MESSAGE(KERN_WARNING, device, "failed to retrieve device " + DBF_DEV_EVENT(DBF_WARNING, device, "failed to retrieve device " "information (rc=%d)", rc); rc = -EOPNOTSUPP; goto out; @@ -362,8 +362,8 @@ dasd_diag_check_device(struct dasd_device *device) private->pt_block = 2; break; default: - DEV_MESSAGE(KERN_WARNING, device, "unsupported device class " - "(class=%d)", private->rdc_data.vdev_class); + dev_warn(&device->cdev->dev, "Device type %d is not supported " + "in DIAG mode\n", private->rdc_data.vdev_class); rc = -EOPNOTSUPP; goto out; } @@ -380,7 +380,7 @@ dasd_diag_check_device(struct dasd_device *device) /* figure out blocksize of device */ label = (struct vtoc_cms_label *) get_zeroed_page(GFP_KERNEL); if (label == NULL) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "No memory to allocate initialization request"); rc = -ENOMEM; goto out; @@ -404,8 +404,8 @@ dasd_diag_check_device(struct dasd_device *device) private->iob.flaga = DASD_DIAG_FLAGA_DEFAULT; rc = dia250(&private->iob, RW_BIO); if (rc == 3) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "DIAG call failed"); + dev_warn(&device->cdev->dev, + "A 64-bit DIAG call failed\n"); rc = -EOPNOTSUPP; goto out_label; } @@ -414,8 +414,8 @@ dasd_diag_check_device(struct dasd_device *device) break; } if (bsize > PAGE_SIZE) { - DEV_MESSAGE(KERN_WARNING, device, "device access failed " - "(rc=%d)", rc); + dev_warn(&device->cdev->dev, "Accessing the DASD failed because" + " of an incorrect format (rc=%d)\n", rc); rc = -EIO; goto out_label; } @@ -433,15 +433,15 @@ dasd_diag_check_device(struct dasd_device *device) block->s2b_shift++; rc = mdsk_init_io(device, block->bp_block, 0, NULL); if (rc) { - DEV_MESSAGE(KERN_WARNING, device, "DIAG initialization " - "failed (rc=%d)", rc); + dev_warn(&device->cdev->dev, "DIAG initialization " + "failed with rc=%d\n", rc); rc = -EIO; } else { - DEV_MESSAGE(KERN_INFO, device, - "(%ld B/blk): %ldkB", - (unsigned long) block->bp_block, - (unsigned long) (block->blocks << - block->s2b_shift) >> 1); + dev_info(&device->cdev->dev, + "New DASD with %ld byte/block, total size %ld KB\n", + (unsigned long) block->bp_block, + (unsigned long) (block->blocks << + block->s2b_shift) >> 1); } out_label: free_page((long) label); @@ -595,7 +595,7 @@ static void dasd_diag_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, struct irb *stat) { - DEV_MESSAGE(KERN_ERR, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "dump sense not available for DIAG data"); } @@ -621,10 +621,8 @@ static int __init dasd_diag_init(void) { if (!MACHINE_IS_VM) { - MESSAGE_LOG(KERN_INFO, - "Machine is not VM: %s " - "discipline not initializing", - dasd_diag_discipline.name); + pr_info("Discipline %s cannot be used without z/VM\n", + dasd_diag_discipline.name); return -ENODEV; } ASCEBC(dasd_diag_discipline.ebcname, 4); diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index bdb87998f364..21254793c604 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -11,6 +11,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/stddef.h> #include <linux/kernel.h> #include <linux/slab.h> @@ -27,9 +29,12 @@ #include <asm/uaccess.h> #include <asm/cio.h> #include <asm/ccwdev.h> +#include <asm/itcw.h> #include "dasd_int.h" #include "dasd_eckd.h" +#include "../cio/chsc.h" + #ifdef PRINTK_HEADER #undef PRINTK_HEADER @@ -84,7 +89,7 @@ dasd_eckd_probe (struct ccw_device *cdev) /* set ECKD specific ccw-device options */ ret = ccw_device_set_options(cdev, CCWDEV_ALLOW_FORCE); if (ret) { - printk(KERN_WARNING + DBF_EVENT(DBF_WARNING, "dasd_eckd_probe: could not set ccw-device options " "for %s\n", dev_name(&cdev->dev)); return ret; @@ -159,6 +164,14 @@ recs_per_track(struct dasd_eckd_characteristics * rdc, return 0; } +static void set_ch_t(struct ch_t *geo, __u32 cyl, __u8 head) +{ + geo->cyl = (__u16) cyl; + geo->head = cyl >> 16; + geo->head <<= 4; + geo->head |= head; +} + static int check_XRC (struct ccw1 *de_ccw, struct DE_eckd_data *data, @@ -186,11 +199,12 @@ check_XRC (struct ccw1 *de_ccw, } static int -define_extent(struct ccw1 * ccw, struct DE_eckd_data * data, int trk, - int totrk, int cmd, struct dasd_device * device) +define_extent(struct ccw1 *ccw, struct DE_eckd_data *data, unsigned int trk, + unsigned int totrk, int cmd, struct dasd_device *device) { struct dasd_eckd_private *private; - struct ch_t geo, beg, end; + u32 begcyl, endcyl; + u16 heads, beghead, endhead; int rc = 0; private = (struct dasd_eckd_private *) device->private; @@ -236,7 +250,8 @@ define_extent(struct ccw1 * ccw, struct DE_eckd_data * data, int trk, rc = check_XRC (ccw, data, device); break; default: - DEV_MESSAGE(KERN_ERR, device, "unknown opcode 0x%x", cmd); + dev_err(&device->cdev->dev, + "0x%x is not a known command\n", cmd); break; } @@ -248,27 +263,24 @@ define_extent(struct ccw1 * ccw, struct DE_eckd_data * data, int trk, && !(private->uses_cdl && trk < 2)) data->ga_extended |= 0x40; /* Regular Data Format Mode */ - geo.cyl = private->rdc_data.no_cyl; - geo.head = private->rdc_data.trk_per_cyl; - beg.cyl = trk / geo.head; - beg.head = trk % geo.head; - end.cyl = totrk / geo.head; - end.head = totrk % geo.head; + heads = private->rdc_data.trk_per_cyl; + begcyl = trk / heads; + beghead = trk % heads; + endcyl = totrk / heads; + endhead = totrk % heads; /* check for sequential prestage - enhance cylinder range */ if (data->attributes.operation == DASD_SEQ_PRESTAGE || data->attributes.operation == DASD_SEQ_ACCESS) { - if (end.cyl + private->attrib.nr_cyl < geo.cyl) - end.cyl += private->attrib.nr_cyl; + if (endcyl + private->attrib.nr_cyl < private->real_cyl) + endcyl += private->attrib.nr_cyl; else - end.cyl = (geo.cyl - 1); + endcyl = (private->real_cyl - 1); } - data->beg_ext.cyl = beg.cyl; - data->beg_ext.head = beg.head; - data->end_ext.cyl = end.cyl; - data->end_ext.head = end.head; + set_ch_t(&data->beg_ext, begcyl, beghead); + set_ch_t(&data->end_ext, endcyl, endhead); return rc; } @@ -283,29 +295,145 @@ static int check_XRC_on_prefix(struct PFX_eckd_data *pfxdata, return 0; /* switch on System Time Stamp - needed for XRC Support */ - pfxdata->define_extend.ga_extended |= 0x08; /* 'Time Stamp Valid' */ - pfxdata->define_extend.ga_extended |= 0x02; /* 'Extended Parameter' */ + pfxdata->define_extent.ga_extended |= 0x08; /* 'Time Stamp Valid' */ + pfxdata->define_extent.ga_extended |= 0x02; /* 'Extended Parameter' */ pfxdata->validity.time_stamp = 1; /* 'Time Stamp Valid' */ - rc = get_sync_clock(&pfxdata->define_extend.ep_sys_time); + rc = get_sync_clock(&pfxdata->define_extent.ep_sys_time); /* Ignore return code if sync clock is switched off. */ if (rc == -ENOSYS || rc == -EACCES) rc = 0; return rc; } -static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, int trk, - int totrk, int cmd, struct dasd_device *basedev, - struct dasd_device *startdev) +static void fill_LRE_data(struct LRE_eckd_data *data, unsigned int trk, + unsigned int rec_on_trk, int count, int cmd, + struct dasd_device *device, unsigned int reclen, + unsigned int tlf) +{ + struct dasd_eckd_private *private; + int sector; + int dn, d; + + private = (struct dasd_eckd_private *) device->private; + + memset(data, 0, sizeof(*data)); + sector = 0; + if (rec_on_trk) { + switch (private->rdc_data.dev_type) { + case 0x3390: + dn = ceil_quot(reclen + 6, 232); + d = 9 + ceil_quot(reclen + 6 * (dn + 1), 34); + sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8; + break; + case 0x3380: + d = 7 + ceil_quot(reclen + 12, 32); + sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7; + break; + } + } + data->sector = sector; + /* note: meaning of count depends on the operation + * for record based I/O it's the number of records, but for + * track based I/O it's the number of tracks + */ + data->count = count; + switch (cmd) { + case DASD_ECKD_CCW_WRITE_HOME_ADDRESS: + data->operation.orientation = 0x3; + data->operation.operation = 0x03; + break; + case DASD_ECKD_CCW_READ_HOME_ADDRESS: + data->operation.orientation = 0x3; + data->operation.operation = 0x16; + break; + case DASD_ECKD_CCW_WRITE_RECORD_ZERO: + data->operation.orientation = 0x1; + data->operation.operation = 0x03; + data->count++; + break; + case DASD_ECKD_CCW_READ_RECORD_ZERO: + data->operation.orientation = 0x3; + data->operation.operation = 0x16; + data->count++; + break; + case DASD_ECKD_CCW_WRITE: + case DASD_ECKD_CCW_WRITE_MT: + case DASD_ECKD_CCW_WRITE_KD: + case DASD_ECKD_CCW_WRITE_KD_MT: + data->auxiliary.length_valid = 0x1; + data->length = reclen; + data->operation.operation = 0x01; + break; + case DASD_ECKD_CCW_WRITE_CKD: + case DASD_ECKD_CCW_WRITE_CKD_MT: + data->auxiliary.length_valid = 0x1; + data->length = reclen; + data->operation.operation = 0x03; + break; + case DASD_ECKD_CCW_WRITE_TRACK_DATA: + data->auxiliary.length_valid = 0x1; + data->length = reclen; /* not tlf, as one might think */ + data->operation.operation = 0x3F; + data->extended_operation = 0x23; + break; + case DASD_ECKD_CCW_READ: + case DASD_ECKD_CCW_READ_MT: + case DASD_ECKD_CCW_READ_KD: + case DASD_ECKD_CCW_READ_KD_MT: + data->auxiliary.length_valid = 0x1; + data->length = reclen; + data->operation.operation = 0x06; + break; + case DASD_ECKD_CCW_READ_CKD: + case DASD_ECKD_CCW_READ_CKD_MT: + data->auxiliary.length_valid = 0x1; + data->length = reclen; + data->operation.operation = 0x16; + break; + case DASD_ECKD_CCW_READ_COUNT: + data->operation.operation = 0x06; + break; + case DASD_ECKD_CCW_READ_TRACK_DATA: + data->auxiliary.length_valid = 0x1; + data->length = tlf; + data->operation.operation = 0x0C; + break; + case DASD_ECKD_CCW_ERASE: + data->length = reclen; + data->auxiliary.length_valid = 0x1; + data->operation.operation = 0x0b; + break; + default: + DBF_DEV_EVENT(DBF_ERR, device, + "fill LRE unknown opcode 0x%x", cmd); + BUG(); + } + set_ch_t(&data->seek_addr, + trk / private->rdc_data.trk_per_cyl, + trk % private->rdc_data.trk_per_cyl); + data->search_arg.cyl = data->seek_addr.cyl; + data->search_arg.head = data->seek_addr.head; + data->search_arg.record = rec_on_trk; +} + +static int prefix_LRE(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, + unsigned int trk, unsigned int totrk, int cmd, + struct dasd_device *basedev, struct dasd_device *startdev, + unsigned char format, unsigned int rec_on_trk, int count, + unsigned int blksize, unsigned int tlf) { struct dasd_eckd_private *basepriv, *startpriv; - struct DE_eckd_data *data; - struct ch_t geo, beg, end; + struct DE_eckd_data *dedata; + struct LRE_eckd_data *lredata; + u32 begcyl, endcyl; + u16 heads, beghead, endhead; int rc = 0; basepriv = (struct dasd_eckd_private *) basedev->private; startpriv = (struct dasd_eckd_private *) startdev->private; - data = &pfxdata->define_extend; + dedata = &pfxdata->define_extent; + lredata = &pfxdata->locate_record; ccw->cmd_code = DASD_ECKD_CCW_PFX; ccw->flags = 0; @@ -314,10 +442,16 @@ static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, int trk, memset(pfxdata, 0, sizeof(*pfxdata)); /* prefix data */ - pfxdata->format = 0; + if (format > 1) { + DBF_DEV_EVENT(DBF_ERR, basedev, + "PFX LRE unknown format 0x%x", format); + BUG(); + return -EINVAL; + } + pfxdata->format = format; pfxdata->base_address = basepriv->ned->unit_addr; pfxdata->base_lss = basepriv->ned->ID; - pfxdata->validity.define_extend = 1; + pfxdata->validity.define_extent = 1; /* private uid is kept up to date, conf_data may be outdated */ if (startpriv->uid.type != UA_BASE_DEVICE) { @@ -337,70 +471,94 @@ static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, int trk, case DASD_ECKD_CCW_READ_KD: case DASD_ECKD_CCW_READ_KD_MT: case DASD_ECKD_CCW_READ_COUNT: - data->mask.perm = 0x1; - data->attributes.operation = basepriv->attrib.operation; + dedata->mask.perm = 0x1; + dedata->attributes.operation = basepriv->attrib.operation; + break; + case DASD_ECKD_CCW_READ_TRACK_DATA: + dedata->mask.perm = 0x1; + dedata->attributes.operation = basepriv->attrib.operation; + dedata->blk_size = 0; break; case DASD_ECKD_CCW_WRITE: case DASD_ECKD_CCW_WRITE_MT: case DASD_ECKD_CCW_WRITE_KD: case DASD_ECKD_CCW_WRITE_KD_MT: - data->mask.perm = 0x02; - data->attributes.operation = basepriv->attrib.operation; + dedata->mask.perm = 0x02; + dedata->attributes.operation = basepriv->attrib.operation; rc = check_XRC_on_prefix(pfxdata, basedev); break; case DASD_ECKD_CCW_WRITE_CKD: case DASD_ECKD_CCW_WRITE_CKD_MT: - data->attributes.operation = DASD_BYPASS_CACHE; + dedata->attributes.operation = DASD_BYPASS_CACHE; rc = check_XRC_on_prefix(pfxdata, basedev); break; case DASD_ECKD_CCW_ERASE: case DASD_ECKD_CCW_WRITE_HOME_ADDRESS: case DASD_ECKD_CCW_WRITE_RECORD_ZERO: - data->mask.perm = 0x3; - data->mask.auth = 0x1; - data->attributes.operation = DASD_BYPASS_CACHE; + dedata->mask.perm = 0x3; + dedata->mask.auth = 0x1; + dedata->attributes.operation = DASD_BYPASS_CACHE; rc = check_XRC_on_prefix(pfxdata, basedev); break; - default: - DEV_MESSAGE(KERN_ERR, basedev, "unknown opcode 0x%x", cmd); + case DASD_ECKD_CCW_WRITE_TRACK_DATA: + dedata->mask.perm = 0x02; + dedata->attributes.operation = basepriv->attrib.operation; + dedata->blk_size = blksize; + rc = check_XRC_on_prefix(pfxdata, basedev); break; + default: + DBF_DEV_EVENT(DBF_ERR, basedev, + "PFX LRE unknown opcode 0x%x", cmd); + BUG(); + return -EINVAL; } - data->attributes.mode = 0x3; /* ECKD */ + dedata->attributes.mode = 0x3; /* ECKD */ if ((basepriv->rdc_data.cu_type == 0x2105 || basepriv->rdc_data.cu_type == 0x2107 || basepriv->rdc_data.cu_type == 0x1750) && !(basepriv->uses_cdl && trk < 2)) - data->ga_extended |= 0x40; /* Regular Data Format Mode */ + dedata->ga_extended |= 0x40; /* Regular Data Format Mode */ - geo.cyl = basepriv->rdc_data.no_cyl; - geo.head = basepriv->rdc_data.trk_per_cyl; - beg.cyl = trk / geo.head; - beg.head = trk % geo.head; - end.cyl = totrk / geo.head; - end.head = totrk % geo.head; + heads = basepriv->rdc_data.trk_per_cyl; + begcyl = trk / heads; + beghead = trk % heads; + endcyl = totrk / heads; + endhead = totrk % heads; /* check for sequential prestage - enhance cylinder range */ - if (data->attributes.operation == DASD_SEQ_PRESTAGE || - data->attributes.operation == DASD_SEQ_ACCESS) { + if (dedata->attributes.operation == DASD_SEQ_PRESTAGE || + dedata->attributes.operation == DASD_SEQ_ACCESS) { - if (end.cyl + basepriv->attrib.nr_cyl < geo.cyl) - end.cyl += basepriv->attrib.nr_cyl; + if (endcyl + basepriv->attrib.nr_cyl < basepriv->real_cyl) + endcyl += basepriv->attrib.nr_cyl; else - end.cyl = (geo.cyl - 1); + endcyl = (basepriv->real_cyl - 1); + } + + set_ch_t(&dedata->beg_ext, begcyl, beghead); + set_ch_t(&dedata->end_ext, endcyl, endhead); + + if (format == 1) { + fill_LRE_data(lredata, trk, rec_on_trk, count, cmd, + basedev, blksize, tlf); } - data->beg_ext.cyl = beg.cyl; - data->beg_ext.head = beg.head; - data->end_ext.cyl = end.cyl; - data->end_ext.head = end.head; return rc; } +static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, + unsigned int trk, unsigned int totrk, int cmd, + struct dasd_device *basedev, struct dasd_device *startdev) +{ + return prefix_LRE(ccw, pfxdata, trk, totrk, cmd, basedev, startdev, + 0, 0, 0, 0, 0); +} + static void -locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, int trk, - int rec_on_trk, int no_rec, int cmd, +locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, unsigned int trk, + unsigned int rec_on_trk, int no_rec, int cmd, struct dasd_device * device, int reclen) { struct dasd_eckd_private *private; @@ -491,12 +649,14 @@ locate_record(struct ccw1 *ccw, struct LO_eckd_data *data, int trk, data->operation.operation = 0x0b; break; default: - DEV_MESSAGE(KERN_ERR, device, "unknown opcode 0x%x", cmd); - } - data->seek_addr.cyl = data->search_arg.cyl = - trk / private->rdc_data.trk_per_cyl; - data->seek_addr.head = data->search_arg.head = - trk % private->rdc_data.trk_per_cyl; + DBF_DEV_EVENT(DBF_ERR, device, "unknown locate record " + "opcode 0x%x", cmd); + } + set_ch_t(&data->seek_addr, + trk / private->rdc_data.trk_per_cyl, + trk % private->rdc_data.trk_per_cyl); + data->search_arg.cyl = data->seek_addr.cyl; + data->search_arg.head = data->seek_addr.head; data->search_arg.record = rec_on_trk; } @@ -585,8 +745,8 @@ static struct dasd_ccw_req *dasd_eckd_build_rcd_lpm(struct dasd_device *device, cqr = dasd_smalloc_request("ECKD", 1 /* RCD */, ciw->count, device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "Could not allocate RCD request"); + DBF_DEV_EVENT(DBF_WARNING, device, "%s", + "Could not allocate RCD request"); return cqr; } @@ -736,14 +896,16 @@ static int dasd_eckd_read_conf(struct dasd_device *device) rc = dasd_eckd_read_conf_lpm(device, &conf_data, &conf_len, lpm); if (rc && rc != -EOPNOTSUPP) { /* -EOPNOTSUPP is ok */ - MESSAGE(KERN_WARNING, - "Read configuration data returned " - "error %d", rc); + DBF_EVENT(DBF_WARNING, + "Read configuration data returned " + "error %d for device: %s", rc, + dev_name(&device->cdev->dev)); return rc; } if (conf_data == NULL) { - MESSAGE(KERN_WARNING, "%s", "No configuration " - "data retrieved"); + DBF_EVENT(DBF_WARNING, "No configuration " + "data retrieved for device: %s", + dev_name(&device->cdev->dev)); continue; /* no error */ } /* save first valid configuration data */ @@ -790,8 +952,9 @@ static int dasd_eckd_read_features(struct dasd_device *device) sizeof(struct dasd_rssd_features)), device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "Could not allocate initialization request"); + DBF_EVENT(DBF_WARNING, "Could not allocate initialization " + "request for device: %s", + dev_name(&device->cdev->dev)); return PTR_ERR(cqr); } cqr->startdev = device; @@ -840,7 +1003,8 @@ static int dasd_eckd_read_features(struct dasd_device *device) /* * Build CP for Perform Subsystem Function - SSC. */ -static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device) +static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device, + int enable_pav) { struct dasd_ccw_req *cqr; struct dasd_psf_ssc_data *psf_ssc_data; @@ -851,15 +1015,17 @@ static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device) device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Could not allocate PSF-SSC request"); return cqr; } psf_ssc_data = (struct dasd_psf_ssc_data *)cqr->data; psf_ssc_data->order = PSF_ORDER_SSC; - psf_ssc_data->suborder = 0x88; - psf_ssc_data->reserved[0] = 0x88; - + psf_ssc_data->suborder = 0x40; + if (enable_pav) { + psf_ssc_data->suborder |= 0x88; + psf_ssc_data->reserved[0] = 0x88; + } ccw = cqr->cpaddr; ccw->cmd_code = DASD_ECKD_CCW_PSF; ccw->cda = (__u32)(addr_t)psf_ssc_data; @@ -880,12 +1046,12 @@ static struct dasd_ccw_req *dasd_eckd_build_psf_ssc(struct dasd_device *device) * call might change behaviour of DASD devices. */ static int -dasd_eckd_psf_ssc(struct dasd_device *device) +dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav) { struct dasd_ccw_req *cqr; int rc; - cqr = dasd_eckd_build_psf_ssc(device); + cqr = dasd_eckd_build_psf_ssc(device, enable_pav); if (IS_ERR(cqr)) return PTR_ERR(cqr); @@ -904,19 +1070,20 @@ static int dasd_eckd_validate_server(struct dasd_device *device) { int rc; struct dasd_eckd_private *private; + int enable_pav; - /* Currently PAV is the only reason to 'validate' server on LPAR */ if (dasd_nopav || MACHINE_IS_VM) - return 0; - - rc = dasd_eckd_psf_ssc(device); + enable_pav = 0; + else + enable_pav = 1; + rc = dasd_eckd_psf_ssc(device, enable_pav); /* may be requested feature is not available on server, * therefore just report error and go ahead */ private = (struct dasd_eckd_private *) device->private; - DEV_MESSAGE(KERN_INFO, device, - "PSF-SSC on storage subsystem %s.%s.%04x returned rc=%d", - private->uid.vendor, private->uid.serial, - private->uid.ssid, rc); + DBF_EVENT(DBF_WARNING, "PSF-SSC on storage subsystem %s.%s.%04x " + "returned rc=%d for device: %s", + private->uid.vendor, private->uid.serial, + private->uid.ssid, rc, dev_name(&device->cdev->dev)); /* RE-Read Configuration Data */ return dasd_eckd_read_conf(device); } @@ -938,9 +1105,9 @@ dasd_eckd_check_characteristics(struct dasd_device *device) private = kzalloc(sizeof(struct dasd_eckd_private), GFP_KERNEL | GFP_DMA); if (private == NULL) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "memory allocation failed for private " - "data"); + dev_warn(&device->cdev->dev, + "Allocating memory for private DASD data " + "failed\n"); return -ENOMEM; } device->private = (void *) private; @@ -965,8 +1132,9 @@ dasd_eckd_check_characteristics(struct dasd_device *device) if (private->uid.type == UA_BASE_DEVICE) { block = dasd_alloc_block(); if (IS_ERR(block)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "could not allocate dasd block structure"); + DBF_EVENT(DBF_WARNING, "could not allocate dasd " + "block structure for device: %s", + dev_name(&device->cdev->dev)); rc = PTR_ERR(block); goto out_err1; } @@ -997,20 +1165,27 @@ dasd_eckd_check_characteristics(struct dasd_device *device) memset(rdc_data, 0, sizeof(rdc_data)); rc = dasd_generic_read_dev_chars(device, "ECKD", &rdc_data, 64); if (rc) { - DEV_MESSAGE(KERN_WARNING, device, - "Read device characteristics returned " - "rc=%d", rc); + DBF_EVENT(DBF_WARNING, + "Read device characteristics failed, rc=%d for " + "device: %s", rc, dev_name(&device->cdev->dev)); goto out_err3; } - DEV_MESSAGE(KERN_INFO, device, - "%04X/%02X(CU:%04X/%02X) Cyl:%d Head:%d Sec:%d", - private->rdc_data.dev_type, - private->rdc_data.dev_model, - private->rdc_data.cu_type, - private->rdc_data.cu_model.model, - private->rdc_data.no_cyl, - private->rdc_data.trk_per_cyl, - private->rdc_data.sec_per_trk); + /* find the vaild cylinder size */ + if (private->rdc_data.no_cyl == LV_COMPAT_CYL && + private->rdc_data.long_no_cyl) + private->real_cyl = private->rdc_data.long_no_cyl; + else + private->real_cyl = private->rdc_data.no_cyl; + + dev_info(&device->cdev->dev, "New DASD %04X/%02X (CU %04X/%02X) " + "with %d cylinders, %d heads, %d sectors\n", + private->rdc_data.dev_type, + private->rdc_data.dev_model, + private->rdc_data.cu_type, + private->rdc_data.cu_model.model, + private->real_cyl, + private->rdc_data.trk_per_cyl, + private->rdc_data.sec_per_trk); return 0; out_err3: @@ -1151,14 +1326,12 @@ dasd_eckd_end_analysis(struct dasd_block *block) status = private->init_cqr_status; private->init_cqr_status = -1; if (status != DASD_CQR_DONE) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "volume analysis returned unformatted disk"); + dev_warn(&device->cdev->dev, + "The DASD is not formatted\n"); return -EMEDIUMTYPE; } private->uses_cdl = 1; - /* Calculate number of blocks/records per track. */ - blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); /* Check Track 0 for Compatible Disk Layout */ count_area = NULL; for (i = 0; i < 3; i++) { @@ -1182,8 +1355,8 @@ dasd_eckd_end_analysis(struct dasd_block *block) count_area = &private->count_area[0]; } else { if (private->count_area[3].record == 1) - DEV_MESSAGE(KERN_WARNING, device, "%s", - "Trk 0: no records after VTOC!"); + dev_warn(&device->cdev->dev, + "Track 0 has no records following the VTOC\n"); } if (count_area != NULL && count_area->kl == 0) { /* we found notthing violating our disk layout */ @@ -1191,8 +1364,8 @@ dasd_eckd_end_analysis(struct dasd_block *block) block->bp_block = count_area->dl; } if (block->bp_block == 0) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "Volume has incompatible disk layout"); + dev_warn(&device->cdev->dev, + "The disk layout of the DASD is not supported\n"); return -EMEDIUMTYPE; } block->s2b_shift = 0; /* bits to shift 512 to get a block */ @@ -1200,19 +1373,19 @@ dasd_eckd_end_analysis(struct dasd_block *block) block->s2b_shift++; blk_per_trk = recs_per_track(&private->rdc_data, 0, block->bp_block); - block->blocks = (private->rdc_data.no_cyl * + block->blocks = (private->real_cyl * private->rdc_data.trk_per_cyl * blk_per_trk); - DEV_MESSAGE(KERN_INFO, device, - "(%dkB blks): %dkB at %dkB/trk %s", - (block->bp_block >> 10), - ((private->rdc_data.no_cyl * - private->rdc_data.trk_per_cyl * - blk_per_trk * (block->bp_block >> 9)) >> 1), - ((blk_per_trk * block->bp_block) >> 10), - private->uses_cdl ? - "compatible disk layout" : "linux disk layout"); + dev_info(&device->cdev->dev, + "DASD with %d KB/block, %d KB total size, %d KB/track, " + "%s\n", (block->bp_block >> 10), + ((private->real_cyl * + private->rdc_data.trk_per_cyl * + blk_per_trk * (block->bp_block >> 9)) >> 1), + ((blk_per_trk * block->bp_block) >> 10), + private->uses_cdl ? + "compatible disk layout" : "linux disk layout"); return 0; } @@ -1262,31 +1435,35 @@ dasd_eckd_format_device(struct dasd_device * device, struct eckd_count *ect; struct ccw1 *ccw; void *data; - int rpt, cyl, head; + int rpt; + struct ch_t address; int cplength, datasize; int i; + int intensity = 0; + int r0_perm; private = (struct dasd_eckd_private *) device->private; rpt = recs_per_track(&private->rdc_data, 0, fdata->blksize); - cyl = fdata->start_unit / private->rdc_data.trk_per_cyl; - head = fdata->start_unit % private->rdc_data.trk_per_cyl; + set_ch_t(&address, + fdata->start_unit / private->rdc_data.trk_per_cyl, + fdata->start_unit % private->rdc_data.trk_per_cyl); /* Sanity checks. */ if (fdata->start_unit >= - (private->rdc_data.no_cyl * private->rdc_data.trk_per_cyl)) { - DEV_MESSAGE(KERN_INFO, device, "Track no %d too big!", - fdata->start_unit); + (private->real_cyl * private->rdc_data.trk_per_cyl)) { + dev_warn(&device->cdev->dev, "Start track number %d used in " + "formatting is too big\n", fdata->start_unit); return ERR_PTR(-EINVAL); } if (fdata->start_unit > fdata->stop_unit) { - DEV_MESSAGE(KERN_INFO, device, "Track %d reached! ending.", - fdata->start_unit); + dev_warn(&device->cdev->dev, "Start track %d used in " + "formatting exceeds end track\n", fdata->start_unit); return ERR_PTR(-EINVAL); } if (dasd_check_blocksize(fdata->blksize) != 0) { - DEV_MESSAGE(KERN_WARNING, device, - "Invalid blocksize %d...terminating!", - fdata->blksize); + dev_warn(&device->cdev->dev, + "The DASD cannot be formatted with block size %d\n", + fdata->blksize); return ERR_PTR(-EINVAL); } @@ -1296,9 +1473,17 @@ dasd_eckd_format_device(struct dasd_device * device, * Bit 1: write home address, currently not supported * Bit 2: invalidate tracks * Bit 3: use OS/390 compatible disk layout (cdl) + * Bit 4: do not allow storage subsystem to modify record zero * Only some bit combinations do make sense. */ - switch (fdata->intensity) { + if (fdata->intensity & 0x10) { + r0_perm = 0; + intensity = fdata->intensity & ~0x10; + } else { + r0_perm = 1; + intensity = fdata->intensity; + } + switch (intensity) { case 0x00: /* Normal format */ case 0x08: /* Normal format, use cdl. */ cplength = 2 + rpt; @@ -1322,8 +1507,8 @@ dasd_eckd_format_device(struct dasd_device * device, sizeof(struct eckd_count); break; default: - DEV_MESSAGE(KERN_WARNING, device, "Invalid flags 0x%x.", - fdata->intensity); + dev_warn(&device->cdev->dev, "An I/O control call used " + "incorrect flags 0x%x\n", fdata->intensity); return ERR_PTR(-EINVAL); } /* Allocate the format ccw request. */ @@ -1335,11 +1520,14 @@ dasd_eckd_format_device(struct dasd_device * device, data = fcp->data; ccw = fcp->cpaddr; - switch (fdata->intensity & ~0x08) { + switch (intensity & ~0x08) { case 0x00: /* Normal format. */ define_extent(ccw++, (struct DE_eckd_data *) data, fdata->start_unit, fdata->start_unit, DASD_ECKD_CCW_WRITE_CKD, device); + /* grant subsystem permission to format R0 */ + if (r0_perm) + ((struct DE_eckd_data *)data)->ga_extended |= 0x04; data += sizeof(struct DE_eckd_data); ccw[-1].flags |= CCW_FLAG_CC; locate_record(ccw++, (struct LO_eckd_data *) data, @@ -1373,11 +1561,11 @@ dasd_eckd_format_device(struct dasd_device * device, data += sizeof(struct LO_eckd_data); break; } - if (fdata->intensity & 0x01) { /* write record zero */ + if (intensity & 0x01) { /* write record zero */ ect = (struct eckd_count *) data; data += sizeof(struct eckd_count); - ect->cyl = cyl; - ect->head = head; + ect->cyl = address.cyl; + ect->head = address.head; ect->record = 0; ect->kl = 0; ect->dl = 8; @@ -1388,11 +1576,11 @@ dasd_eckd_format_device(struct dasd_device * device, ccw->cda = (__u32)(addr_t) ect; ccw++; } - if ((fdata->intensity & ~0x08) & 0x04) { /* erase track */ + if ((intensity & ~0x08) & 0x04) { /* erase track */ ect = (struct eckd_count *) data; data += sizeof(struct eckd_count); - ect->cyl = cyl; - ect->head = head; + ect->cyl = address.cyl; + ect->head = address.head; ect->record = 1; ect->kl = 0; ect->dl = 0; @@ -1405,20 +1593,20 @@ dasd_eckd_format_device(struct dasd_device * device, for (i = 0; i < rpt; i++) { ect = (struct eckd_count *) data; data += sizeof(struct eckd_count); - ect->cyl = cyl; - ect->head = head; + ect->cyl = address.cyl; + ect->head = address.head; ect->record = i + 1; ect->kl = 0; ect->dl = fdata->blksize; /* Check for special tracks 0-1 when formatting CDL */ - if ((fdata->intensity & 0x08) && + if ((intensity & 0x08) && fdata->start_unit == 0) { if (i < 3) { ect->kl = 4; ect->dl = sizes_trk0[i] - 4; } } - if ((fdata->intensity & 0x08) && + if ((intensity & 0x08) && fdata->start_unit == 1) { ect->kl = 44; ect->dl = LABEL_SIZE - 44; @@ -1479,57 +1667,69 @@ static void dasd_eckd_handle_unsolicited_interrupt(struct dasd_device *device, struct irb *irb) { char mask; + char *sense = NULL; /* first of all check for state change pending interrupt */ mask = DEV_STAT_ATTENTION | DEV_STAT_DEV_END | DEV_STAT_UNIT_EXCEP; - if ((irb->scsw.cmd.dstat & mask) == mask) { + if ((scsw_dstat(&irb->scsw) & mask) == mask) { dasd_generic_handle_state_change(device); return; } /* summary unit check */ - if ((irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) && + if ((scsw_dstat(&irb->scsw) & DEV_STAT_UNIT_CHECK) && (irb->ecw[7] == 0x0D)) { dasd_alias_handle_summary_unit_check(device, irb); return; } - + sense = dasd_get_sense(irb); /* service information message SIM */ - if (irb->esw.esw0.erw.cons && !(irb->ecw[27] & DASD_SENSE_BIT_0) && - ((irb->ecw[6] & DASD_SIM_SENSE) == DASD_SIM_SENSE)) { - dasd_3990_erp_handle_sim(device, irb->ecw); + if (sense && !(sense[27] & DASD_SENSE_BIT_0) && + ((sense[6] & DASD_SIM_SENSE) == DASD_SIM_SENSE)) { + dasd_3990_erp_handle_sim(device, sense); dasd_schedule_device_bh(device); return; } - if ((irb->scsw.cmd.cc == 1) && - (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) && - (irb->scsw.cmd.actl & SCSW_ACTL_START_PEND) && - (irb->scsw.cmd.stctl & SCSW_STCTL_STATUS_PEND)) { + if ((scsw_cc(&irb->scsw) == 1) && + (scsw_fctl(&irb->scsw) & SCSW_FCTL_START_FUNC) && + (scsw_actl(&irb->scsw) & SCSW_ACTL_START_PEND) && + (scsw_stctl(&irb->scsw) & SCSW_STCTL_STATUS_PEND)) { /* fake irb do nothing, they are handled elsewhere */ dasd_schedule_device_bh(device); return; } - if (!(irb->esw.esw0.erw.cons)) { + if (!sense) { /* just report other unsolicited interrupts */ - DEV_MESSAGE(KERN_ERR, device, "%s", + DBF_DEV_EVENT(DBF_ERR, device, "%s", "unsolicited interrupt received"); } else { - DEV_MESSAGE(KERN_ERR, device, "%s", + DBF_DEV_EVENT(DBF_ERR, device, "%s", "unsolicited interrupt received " "(sense available)"); - device->discipline->dump_sense(device, NULL, irb); + device->discipline->dump_sense_dbf(device, NULL, irb, + "unsolicited"); } dasd_schedule_device_bh(device); return; }; -static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, + +static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_single( + struct dasd_device *startdev, struct dasd_block *block, - struct request *req) + struct request *req, + sector_t first_rec, + sector_t last_rec, + sector_t first_trk, + sector_t last_trk, + unsigned int first_offs, + unsigned int last_offs, + unsigned int blk_per_trk, + unsigned int blksize) { struct dasd_eckd_private *private; unsigned long *idaws; @@ -1539,11 +1739,9 @@ static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, struct req_iterator iter; struct bio_vec *bv; char *dst; - unsigned int blksize, blk_per_trk, off; + unsigned int off; int count, cidaw, cplength, datasize; - sector_t recid, first_rec, last_rec; - sector_t first_trk, last_trk; - unsigned int first_offs, last_offs; + sector_t recid; unsigned char cmd, rcmd; int use_prefix; struct dasd_device *basedev; @@ -1556,15 +1754,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, cmd = DASD_ECKD_CCW_WRITE_MT; else return ERR_PTR(-EINVAL); - /* Calculate number of blocks/records per track. */ - blksize = block->bp_block; - blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize); - /* Calculate record id of first and last block. */ - first_rec = first_trk = req->sector >> block->s2b_shift; - first_offs = sector_div(first_trk, blk_per_trk); - last_rec = last_trk = - (req->sector + req->nr_sectors - 1) >> block->s2b_shift; - last_offs = sector_div(last_trk, blk_per_trk); + /* Check struct bio and count the number of blocks for the request. */ count = 0; cidaw = 0; @@ -1714,6 +1904,497 @@ static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, return cqr; } +static struct dasd_ccw_req *dasd_eckd_build_cp_cmd_track( + struct dasd_device *startdev, + struct dasd_block *block, + struct request *req, + sector_t first_rec, + sector_t last_rec, + sector_t first_trk, + sector_t last_trk, + unsigned int first_offs, + unsigned int last_offs, + unsigned int blk_per_trk, + unsigned int blksize) +{ + struct dasd_eckd_private *private; + unsigned long *idaws; + struct dasd_ccw_req *cqr; + struct ccw1 *ccw; + struct req_iterator iter; + struct bio_vec *bv; + char *dst, *idaw_dst; + unsigned int cidaw, cplength, datasize; + unsigned int tlf; + sector_t recid; + unsigned char cmd; + struct dasd_device *basedev; + unsigned int trkcount, count, count_to_trk_end; + unsigned int idaw_len, seg_len, part_len, len_to_track_end; + unsigned char new_track, end_idaw; + sector_t trkid; + unsigned int recoffs; + + basedev = block->base; + private = (struct dasd_eckd_private *) basedev->private; + if (rq_data_dir(req) == READ) + cmd = DASD_ECKD_CCW_READ_TRACK_DATA; + else if (rq_data_dir(req) == WRITE) + cmd = DASD_ECKD_CCW_WRITE_TRACK_DATA; + else + return ERR_PTR(-EINVAL); + + /* Track based I/O needs IDAWs for each page, and not just for + * 64 bit addresses. We need additional idals for pages + * that get filled from two tracks, so we use the number + * of records as upper limit. + */ + cidaw = last_rec - first_rec + 1; + trkcount = last_trk - first_trk + 1; + + /* 1x prefix + one read/write ccw per track */ + cplength = 1 + trkcount; + + /* on 31-bit we need space for two 32 bit addresses per page + * on 64-bit one 64 bit address + */ + datasize = sizeof(struct PFX_eckd_data) + + cidaw * sizeof(unsigned long long); + + /* Allocate the ccw request. */ + cqr = dasd_smalloc_request(dasd_eckd_discipline.name, + cplength, datasize, startdev); + if (IS_ERR(cqr)) + return cqr; + ccw = cqr->cpaddr; + /* transfer length factor: how many bytes to read from the last track */ + if (first_trk == last_trk) + tlf = last_offs - first_offs + 1; + else + tlf = last_offs + 1; + tlf *= blksize; + + if (prefix_LRE(ccw++, cqr->data, first_trk, + last_trk, cmd, basedev, startdev, + 1 /* format */, first_offs + 1, + trkcount, blksize, + tlf) == -EAGAIN) { + /* Clock not in sync and XRC is enabled. + * Try again later. + */ + dasd_sfree_request(cqr, startdev); + return ERR_PTR(-EAGAIN); + } + + /* + * The translation of request into ccw programs must meet the + * following conditions: + * - all idaws but the first and the last must address full pages + * (or 2K blocks on 31-bit) + * - the scope of a ccw and it's idal ends with the track boundaries + */ + idaws = (unsigned long *) (cqr->data + sizeof(struct PFX_eckd_data)); + recid = first_rec; + new_track = 1; + end_idaw = 0; + len_to_track_end = 0; + idaw_dst = 0; + idaw_len = 0; + rq_for_each_segment(bv, req, iter) { + dst = page_address(bv->bv_page) + bv->bv_offset; + seg_len = bv->bv_len; + while (seg_len) { + if (new_track) { + trkid = recid; + recoffs = sector_div(trkid, blk_per_trk); + count_to_trk_end = blk_per_trk - recoffs; + count = min((last_rec - recid + 1), + (sector_t)count_to_trk_end); + len_to_track_end = count * blksize; + ccw[-1].flags |= CCW_FLAG_CC; + ccw->cmd_code = cmd; + ccw->count = len_to_track_end; + ccw->cda = (__u32)(addr_t)idaws; + ccw->flags = CCW_FLAG_IDA; + ccw++; + recid += count; + new_track = 0; + } + /* If we start a new idaw, everything is fine and the + * start of the new idaw is the start of this segment. + * If we continue an idaw, we must make sure that the + * current segment begins where the so far accumulated + * idaw ends + */ + if (!idaw_dst) + idaw_dst = dst; + if ((idaw_dst + idaw_len) != dst) { + dasd_sfree_request(cqr, startdev); + return ERR_PTR(-ERANGE); + } + part_len = min(seg_len, len_to_track_end); + seg_len -= part_len; + dst += part_len; + idaw_len += part_len; + len_to_track_end -= part_len; + /* collected memory area ends on an IDA_BLOCK border, + * -> create an idaw + * idal_create_words will handle cases where idaw_len + * is larger then IDA_BLOCK_SIZE + */ + if (!(__pa(idaw_dst + idaw_len) & (IDA_BLOCK_SIZE-1))) + end_idaw = 1; + /* We also need to end the idaw at track end */ + if (!len_to_track_end) { + new_track = 1; + end_idaw = 1; + } + if (end_idaw) { + idaws = idal_create_words(idaws, idaw_dst, + idaw_len); + idaw_dst = 0; + idaw_len = 0; + end_idaw = 0; + } + } + } + + if (blk_noretry_request(req) || + block->base->features & DASD_FEATURE_FAILFAST) + set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); + cqr->startdev = startdev; + cqr->memdev = startdev; + cqr->block = block; + cqr->expires = 5 * 60 * HZ; /* 5 minutes */ + cqr->lpm = private->path_data.ppm; + cqr->retries = 256; + cqr->buildclk = get_clock(); + cqr->status = DASD_CQR_FILLED; + return cqr; +} + +static int prepare_itcw(struct itcw *itcw, + unsigned int trk, unsigned int totrk, int cmd, + struct dasd_device *basedev, + struct dasd_device *startdev, + unsigned int rec_on_trk, int count, + unsigned int blksize, + unsigned int total_data_size, + unsigned int tlf, + unsigned int blk_per_trk) +{ + struct PFX_eckd_data pfxdata; + struct dasd_eckd_private *basepriv, *startpriv; + struct DE_eckd_data *dedata; + struct LRE_eckd_data *lredata; + struct dcw *dcw; + + u32 begcyl, endcyl; + u16 heads, beghead, endhead; + u8 pfx_cmd; + + int rc = 0; + int sector = 0; + int dn, d; + + + /* setup prefix data */ + basepriv = (struct dasd_eckd_private *) basedev->private; + startpriv = (struct dasd_eckd_private *) startdev->private; + dedata = &pfxdata.define_extent; + lredata = &pfxdata.locate_record; + + memset(&pfxdata, 0, sizeof(pfxdata)); + pfxdata.format = 1; /* PFX with LRE */ + pfxdata.base_address = basepriv->ned->unit_addr; + pfxdata.base_lss = basepriv->ned->ID; + pfxdata.validity.define_extent = 1; + + /* private uid is kept up to date, conf_data may be outdated */ + if (startpriv->uid.type != UA_BASE_DEVICE) { + pfxdata.validity.verify_base = 1; + if (startpriv->uid.type == UA_HYPER_PAV_ALIAS) + pfxdata.validity.hyper_pav = 1; + } + + switch (cmd) { + case DASD_ECKD_CCW_READ_TRACK_DATA: + dedata->mask.perm = 0x1; + dedata->attributes.operation = basepriv->attrib.operation; + dedata->blk_size = blksize; + dedata->ga_extended |= 0x42; + lredata->operation.orientation = 0x0; + lredata->operation.operation = 0x0C; + lredata->auxiliary.check_bytes = 0x01; + pfx_cmd = DASD_ECKD_CCW_PFX_READ; + break; + case DASD_ECKD_CCW_WRITE_TRACK_DATA: + dedata->mask.perm = 0x02; + dedata->attributes.operation = basepriv->attrib.operation; + dedata->blk_size = blksize; + rc = check_XRC_on_prefix(&pfxdata, basedev); + dedata->ga_extended |= 0x42; + lredata->operation.orientation = 0x0; + lredata->operation.operation = 0x3F; + lredata->extended_operation = 0x23; + lredata->auxiliary.check_bytes = 0x2; + pfx_cmd = DASD_ECKD_CCW_PFX; + break; + default: + DBF_DEV_EVENT(DBF_ERR, basedev, + "prepare itcw, unknown opcode 0x%x", cmd); + BUG(); + break; + } + if (rc) + return rc; + + dedata->attributes.mode = 0x3; /* ECKD */ + + heads = basepriv->rdc_data.trk_per_cyl; + begcyl = trk / heads; + beghead = trk % heads; + endcyl = totrk / heads; + endhead = totrk % heads; + + /* check for sequential prestage - enhance cylinder range */ + if (dedata->attributes.operation == DASD_SEQ_PRESTAGE || + dedata->attributes.operation == DASD_SEQ_ACCESS) { + + if (endcyl + basepriv->attrib.nr_cyl < basepriv->real_cyl) + endcyl += basepriv->attrib.nr_cyl; + else + endcyl = (basepriv->real_cyl - 1); + } + + set_ch_t(&dedata->beg_ext, begcyl, beghead); + set_ch_t(&dedata->end_ext, endcyl, endhead); + + dedata->ep_format = 0x20; /* records per track is valid */ + dedata->ep_rec_per_track = blk_per_trk; + + if (rec_on_trk) { + switch (basepriv->rdc_data.dev_type) { + case 0x3390: + dn = ceil_quot(blksize + 6, 232); + d = 9 + ceil_quot(blksize + 6 * (dn + 1), 34); + sector = (49 + (rec_on_trk - 1) * (10 + d)) / 8; + break; + case 0x3380: + d = 7 + ceil_quot(blksize + 12, 32); + sector = (39 + (rec_on_trk - 1) * (8 + d)) / 7; + break; + } + } + + lredata->auxiliary.length_valid = 1; + lredata->auxiliary.length_scope = 1; + lredata->auxiliary.imbedded_ccw_valid = 1; + lredata->length = tlf; + lredata->imbedded_ccw = cmd; + lredata->count = count; + lredata->sector = sector; + set_ch_t(&lredata->seek_addr, begcyl, beghead); + lredata->search_arg.cyl = lredata->seek_addr.cyl; + lredata->search_arg.head = lredata->seek_addr.head; + lredata->search_arg.record = rec_on_trk; + + dcw = itcw_add_dcw(itcw, pfx_cmd, 0, + &pfxdata, sizeof(pfxdata), total_data_size); + + return rc; +} + +static struct dasd_ccw_req *dasd_eckd_build_cp_tpm_track( + struct dasd_device *startdev, + struct dasd_block *block, + struct request *req, + sector_t first_rec, + sector_t last_rec, + sector_t first_trk, + sector_t last_trk, + unsigned int first_offs, + unsigned int last_offs, + unsigned int blk_per_trk, + unsigned int blksize) +{ + struct dasd_eckd_private *private; + struct dasd_ccw_req *cqr; + struct req_iterator iter; + struct bio_vec *bv; + char *dst; + unsigned int trkcount, ctidaw; + unsigned char cmd; + struct dasd_device *basedev; + unsigned int tlf; + struct itcw *itcw; + struct tidaw *last_tidaw = NULL; + int itcw_op; + size_t itcw_size; + + basedev = block->base; + private = (struct dasd_eckd_private *) basedev->private; + if (rq_data_dir(req) == READ) { + cmd = DASD_ECKD_CCW_READ_TRACK_DATA; + itcw_op = ITCW_OP_READ; + } else if (rq_data_dir(req) == WRITE) { + cmd = DASD_ECKD_CCW_WRITE_TRACK_DATA; + itcw_op = ITCW_OP_WRITE; + } else + return ERR_PTR(-EINVAL); + + /* trackbased I/O needs address all memory via TIDAWs, + * not just for 64 bit addresses. This allows us to map + * each segment directly to one tidaw. + */ + trkcount = last_trk - first_trk + 1; + ctidaw = 0; + rq_for_each_segment(bv, req, iter) { + ++ctidaw; + } + + /* Allocate the ccw request. */ + itcw_size = itcw_calc_size(0, ctidaw, 0); + cqr = dasd_smalloc_request(dasd_eckd_discipline.name, + 0, itcw_size, startdev); + if (IS_ERR(cqr)) + return cqr; + + cqr->cpmode = 1; + cqr->startdev = startdev; + cqr->memdev = startdev; + cqr->block = block; + cqr->expires = 100*HZ; + cqr->buildclk = get_clock(); + cqr->status = DASD_CQR_FILLED; + cqr->retries = 10; + + /* transfer length factor: how many bytes to read from the last track */ + if (first_trk == last_trk) + tlf = last_offs - first_offs + 1; + else + tlf = last_offs + 1; + tlf *= blksize; + + itcw = itcw_init(cqr->data, itcw_size, itcw_op, 0, ctidaw, 0); + cqr->cpaddr = itcw_get_tcw(itcw); + + if (prepare_itcw(itcw, first_trk, last_trk, + cmd, basedev, startdev, + first_offs + 1, + trkcount, blksize, + (last_rec - first_rec + 1) * blksize, + tlf, blk_per_trk) == -EAGAIN) { + /* Clock not in sync and XRC is enabled. + * Try again later. + */ + dasd_sfree_request(cqr, startdev); + return ERR_PTR(-EAGAIN); + } + + /* + * A tidaw can address 4k of memory, but must not cross page boundaries + * We can let the block layer handle this by setting + * blk_queue_segment_boundary to page boundaries and + * blk_max_segment_size to page size when setting up the request queue. + */ + rq_for_each_segment(bv, req, iter) { + dst = page_address(bv->bv_page) + bv->bv_offset; + last_tidaw = itcw_add_tidaw(itcw, 0x00, dst, bv->bv_len); + if (IS_ERR(last_tidaw)) + return (struct dasd_ccw_req *)last_tidaw; + } + + last_tidaw->flags |= 0x80; + itcw_finalize(itcw); + + if (blk_noretry_request(req) || + block->base->features & DASD_FEATURE_FAILFAST) + set_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags); + cqr->startdev = startdev; + cqr->memdev = startdev; + cqr->block = block; + cqr->expires = 5 * 60 * HZ; /* 5 minutes */ + cqr->lpm = private->path_data.ppm; + cqr->retries = 256; + cqr->buildclk = get_clock(); + cqr->status = DASD_CQR_FILLED; + return cqr; +} + +static struct dasd_ccw_req *dasd_eckd_build_cp(struct dasd_device *startdev, + struct dasd_block *block, + struct request *req) +{ + int tpm, cmdrtd, cmdwtd; + int use_prefix; + + struct dasd_eckd_private *private; + int fcx_in_css, fcx_in_gneq, fcx_in_features; + struct dasd_device *basedev; + sector_t first_rec, last_rec; + sector_t first_trk, last_trk; + unsigned int first_offs, last_offs; + unsigned int blk_per_trk, blksize; + int cdlspecial; + struct dasd_ccw_req *cqr; + + basedev = block->base; + private = (struct dasd_eckd_private *) basedev->private; + + /* Calculate number of blocks/records per track. */ + blksize = block->bp_block; + blk_per_trk = recs_per_track(&private->rdc_data, 0, blksize); + /* Calculate record id of first and last block. */ + first_rec = first_trk = req->sector >> block->s2b_shift; + first_offs = sector_div(first_trk, blk_per_trk); + last_rec = last_trk = + (req->sector + req->nr_sectors - 1) >> block->s2b_shift; + last_offs = sector_div(last_trk, blk_per_trk); + cdlspecial = (private->uses_cdl && first_rec < 2*blk_per_trk); + + /* is transport mode supported ? */ + fcx_in_css = css_general_characteristics.fcx; + fcx_in_gneq = private->gneq->reserved2[7] & 0x04; + fcx_in_features = private->features.feature[40] & 0x80; + tpm = fcx_in_css && fcx_in_gneq && fcx_in_features; + + /* is read track data and write track data in command mode supported? */ + cmdrtd = private->features.feature[9] & 0x20; + cmdwtd = private->features.feature[12] & 0x40; + use_prefix = private->features.feature[8] & 0x01; + + cqr = NULL; + if (cdlspecial || dasd_page_cache) { + /* do nothing, just fall through to the cmd mode single case */ + } else if (!dasd_nofcx && tpm && (first_trk == last_trk)) { + cqr = dasd_eckd_build_cp_tpm_track(startdev, block, req, + first_rec, last_rec, + first_trk, last_trk, + first_offs, last_offs, + blk_per_trk, blksize); + if (IS_ERR(cqr) && PTR_ERR(cqr) != -EAGAIN) + cqr = NULL; + } else if (use_prefix && + (((rq_data_dir(req) == READ) && cmdrtd) || + ((rq_data_dir(req) == WRITE) && cmdwtd))) { + cqr = dasd_eckd_build_cp_cmd_track(startdev, block, req, + first_rec, last_rec, + first_trk, last_trk, + first_offs, last_offs, + blk_per_trk, blksize); + if (IS_ERR(cqr) && PTR_ERR(cqr) != -EAGAIN) + cqr = NULL; + } + if (!cqr) + cqr = dasd_eckd_build_cp_cmd_single(startdev, block, req, + first_rec, last_rec, + first_trk, last_trk, + first_offs, last_offs, + blk_per_trk, blksize); + return cqr; +} + static int dasd_eckd_free_cp(struct dasd_ccw_req *cqr, struct request *req) { @@ -1767,7 +2448,7 @@ out: } /* - * Modify ccw chain in cqr so it can be started on a base device. + * Modify ccw/tcw in cqr so it can be started on a base device. * * Note that this is not enough to restart the cqr! * Either reset cqr->startdev as well (summary unit check handling) @@ -1777,13 +2458,24 @@ void dasd_eckd_reset_ccw_to_base_io(struct dasd_ccw_req *cqr) { struct ccw1 *ccw; struct PFX_eckd_data *pfxdata; - - ccw = cqr->cpaddr; - pfxdata = cqr->data; - - if (ccw->cmd_code == DASD_ECKD_CCW_PFX) { + struct tcw *tcw; + struct tccb *tccb; + struct dcw *dcw; + + if (cqr->cpmode == 1) { + tcw = cqr->cpaddr; + tccb = tcw_get_tccb(tcw); + dcw = (struct dcw *)&tccb->tca[0]; + pfxdata = (struct PFX_eckd_data *)&dcw->cd[0]; pfxdata->validity.verify_base = 0; pfxdata->validity.hyper_pav = 0; + } else { + ccw = cqr->cpaddr; + pfxdata = cqr->data; + if (ccw->cmd_code == DASD_ECKD_CCW_PFX) { + pfxdata->validity.verify_base = 0; + pfxdata->validity.hyper_pav = 0; + } } } @@ -1861,6 +2553,7 @@ dasd_eckd_release(struct dasd_device *device) { struct dasd_ccw_req *cqr; int rc; + struct ccw1 *ccw; if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -1868,14 +2561,15 @@ dasd_eckd_release(struct dasd_device *device) cqr = dasd_smalloc_request(dasd_eckd_discipline.name, 1, 32, device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Could not allocate initialization request"); return PTR_ERR(cqr); } - cqr->cpaddr->cmd_code = DASD_ECKD_CCW_RELEASE; - cqr->cpaddr->flags |= CCW_FLAG_SLI; - cqr->cpaddr->count = 32; - cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; + ccw = cqr->cpaddr; + ccw->cmd_code = DASD_ECKD_CCW_RELEASE; + ccw->flags |= CCW_FLAG_SLI; + ccw->count = 32; + ccw->cda = (__u32)(addr_t) cqr->data; cqr->startdev = device; cqr->memdev = device; clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); @@ -1902,6 +2596,7 @@ dasd_eckd_reserve(struct dasd_device *device) { struct dasd_ccw_req *cqr; int rc; + struct ccw1 *ccw; if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -1909,14 +2604,15 @@ dasd_eckd_reserve(struct dasd_device *device) cqr = dasd_smalloc_request(dasd_eckd_discipline.name, 1, 32, device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Could not allocate initialization request"); return PTR_ERR(cqr); } - cqr->cpaddr->cmd_code = DASD_ECKD_CCW_RESERVE; - cqr->cpaddr->flags |= CCW_FLAG_SLI; - cqr->cpaddr->count = 32; - cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; + ccw = cqr->cpaddr; + ccw->cmd_code = DASD_ECKD_CCW_RESERVE; + ccw->flags |= CCW_FLAG_SLI; + ccw->count = 32; + ccw->cda = (__u32)(addr_t) cqr->data; cqr->startdev = device; cqr->memdev = device; clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); @@ -1942,6 +2638,7 @@ dasd_eckd_steal_lock(struct dasd_device *device) { struct dasd_ccw_req *cqr; int rc; + struct ccw1 *ccw; if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -1949,14 +2646,15 @@ dasd_eckd_steal_lock(struct dasd_device *device) cqr = dasd_smalloc_request(dasd_eckd_discipline.name, 1, 32, device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Could not allocate initialization request"); return PTR_ERR(cqr); } - cqr->cpaddr->cmd_code = DASD_ECKD_CCW_SLCK; - cqr->cpaddr->flags |= CCW_FLAG_SLI; - cqr->cpaddr->count = 32; - cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; + ccw = cqr->cpaddr; + ccw->cmd_code = DASD_ECKD_CCW_SLCK; + ccw->flags |= CCW_FLAG_SLI; + ccw->count = 32; + ccw->cda = (__u32)(addr_t) cqr->data; cqr->startdev = device; cqr->memdev = device; clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); @@ -1990,7 +2688,7 @@ dasd_eckd_performance(struct dasd_device *device, void __user *argp) sizeof(struct dasd_rssd_perf_stats_t)), device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Could not allocate initialization request"); return PTR_ERR(cqr); } @@ -2080,9 +2778,9 @@ dasd_eckd_set_attrib(struct dasd_device *device, void __user *argp) return -EFAULT; private->attrib = attrib; - DEV_MESSAGE(KERN_INFO, device, - "cache operation mode set to %x (%i cylinder prestage)", - private->attrib.operation, private->attrib.nr_cyl); + dev_info(&device->cdev->dev, + "The DASD cache mode was set to %x (%i cylinder prestage)\n", + private->attrib.operation, private->attrib.nr_cyl); return 0; } @@ -2133,7 +2831,7 @@ static int dasd_symm_io(struct dasd_device *device, void __user *argp) /* setup CCWs for PSF + RSSD */ cqr = dasd_smalloc_request("ECKD", 2 , 0, device); if (IS_ERR(cqr)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "Could not allocate initialization request"); rc = PTR_ERR(cqr); goto out_free; @@ -2242,11 +2940,54 @@ dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) return len; } +static void +dasd_eckd_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, + struct irb *irb, char *reason) +{ + u64 *sense; + int sl; + struct tsb *tsb; + + sense = NULL; + tsb = NULL; + if (req && scsw_is_tm(&req->irb.scsw)) { + if (irb->scsw.tm.tcw) + tsb = tcw_get_tsb( + (struct tcw *)(unsigned long)irb->scsw.tm.tcw); + if (tsb && (irb->scsw.tm.fcxs == 0x01)) { + switch (tsb->flags & 0x07) { + case 1: /* tsa_iostat */ + sense = (u64 *)tsb->tsa.iostat.sense; + break; + case 2: /* ts_ddpc */ + sense = (u64 *)tsb->tsa.ddpc.sense; + break; + case 3: /* tsa_intrg */ + break; + } + } + } else { + if (irb->esw.esw0.erw.cons) + sense = (u64 *)irb->ecw; + } + if (sense) { + for (sl = 0; sl < 4; sl++) { + DBF_DEV_EVENT(DBF_EMERG, device, + "%s: %016llx %016llx %016llx %016llx", + reason, sense[0], sense[1], sense[2], + sense[3]); + } + } else { + DBF_DEV_EVENT(DBF_EMERG, device, "%s", + "SORRY - NO VALID SENSE AVAILABLE\n"); + } +} + /* * Print sense data and related channel program. * Parts are printed because printk buffer is only 1024 bytes. */ -static void dasd_eckd_dump_sense(struct dasd_device *device, +static void dasd_eckd_dump_sense_ccw(struct dasd_device *device, struct dasd_ccw_req *req, struct irb *irb) { char *page; @@ -2255,8 +2996,8 @@ static void dasd_eckd_dump_sense(struct dasd_device *device, page = (char *) get_zeroed_page(GFP_ATOMIC); if (page == NULL) { - DEV_MESSAGE(KERN_ERR, device, " %s", - "No memory to dump sense data"); + DBF_DEV_EVENT(DBF_WARNING, device, "%s", + "No memory to dump sense data\n"); return; } /* dump the sense data */ @@ -2265,7 +3006,7 @@ static void dasd_eckd_dump_sense(struct dasd_device *device, dev_name(&device->cdev->dev)); len += sprintf(page + len, KERN_ERR PRINTK_HEADER " in req: %p CS: 0x%02X DS: 0x%02X\n", req, - irb->scsw.cmd.cstat, irb->scsw.cmd.dstat); + scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw)); len += sprintf(page + len, KERN_ERR PRINTK_HEADER " device %s: Failing CCW: %p\n", dev_name(&device->cdev->dev), @@ -2341,6 +3082,147 @@ static void dasd_eckd_dump_sense(struct dasd_device *device, free_page((unsigned long) page); } + +/* + * Print sense data from a tcw. + */ +static void dasd_eckd_dump_sense_tcw(struct dasd_device *device, + struct dasd_ccw_req *req, struct irb *irb) +{ + char *page; + int len, sl, sct, residual; + + struct tsb *tsb; + u8 *sense; + + + page = (char *) get_zeroed_page(GFP_ATOMIC); + if (page == NULL) { + DBF_DEV_EVENT(DBF_WARNING, device, " %s", + "No memory to dump sense data"); + return; + } + /* dump the sense data */ + len = sprintf(page, KERN_ERR PRINTK_HEADER + " I/O status report for device %s:\n", + dev_name(&device->cdev->dev)); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " in req: %p CS: 0x%02X DS: 0x%02X " + "fcxs: 0x%02X schxs: 0x%02X\n", req, + scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw), + irb->scsw.tm.fcxs, irb->scsw.tm.schxs); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " device %s: Failing TCW: %p\n", + dev_name(&device->cdev->dev), + (void *) (addr_t) irb->scsw.tm.tcw); + + tsb = NULL; + sense = NULL; + if (irb->scsw.tm.tcw) + tsb = tcw_get_tsb( + (struct tcw *)(unsigned long)irb->scsw.tm.tcw); + + if (tsb && (irb->scsw.tm.fcxs == 0x01)) { + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->length %d\n", tsb->length); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->flags %x\n", tsb->flags); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->dcw_offset %d\n", tsb->dcw_offset); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->count %d\n", tsb->count); + residual = tsb->count - 28; + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " residual %d\n", residual); + + switch (tsb->flags & 0x07) { + case 1: /* tsa_iostat */ + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.iostat.dev_time %d\n", + tsb->tsa.iostat.dev_time); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.iostat.def_time %d\n", + tsb->tsa.iostat.def_time); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.iostat.queue_time %d\n", + tsb->tsa.iostat.queue_time); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.iostat.dev_busy_time %d\n", + tsb->tsa.iostat.dev_busy_time); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.iostat.dev_act_time %d\n", + tsb->tsa.iostat.dev_act_time); + sense = tsb->tsa.iostat.sense; + break; + case 2: /* ts_ddpc */ + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.ddpc.rc %d\n", tsb->tsa.ddpc.rc); + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.ddpc.rcq: "); + for (sl = 0; sl < 16; sl++) { + for (sct = 0; sct < 8; sct++) { + len += sprintf(page + len, " %02x", + tsb->tsa.ddpc.rcq[sl]); + } + len += sprintf(page + len, "\n"); + } + sense = tsb->tsa.ddpc.sense; + break; + case 3: /* tsa_intrg */ + len += sprintf(page + len, KERN_ERR PRINTK_HEADER + " tsb->tsa.intrg.: not supportet yet \n"); + break; + } + + if (sense) { + for (sl = 0; sl < 4; sl++) { + len += sprintf(page + len, + KERN_ERR PRINTK_HEADER + " Sense(hex) %2d-%2d:", + (8 * sl), ((8 * sl) + 7)); + for (sct = 0; sct < 8; sct++) { + len += sprintf(page + len, " %02x", + sense[8 * sl + sct]); + } + len += sprintf(page + len, "\n"); + } + + if (sense[27] & DASD_SENSE_BIT_0) { + /* 24 Byte Sense Data */ + sprintf(page + len, KERN_ERR PRINTK_HEADER + " 24 Byte: %x MSG %x, " + "%s MSGb to SYSOP\n", + sense[7] >> 4, sense[7] & 0x0f, + sense[1] & 0x10 ? "" : "no"); + } else { + /* 32 Byte Sense Data */ + sprintf(page + len, KERN_ERR PRINTK_HEADER + " 32 Byte: Format: %x " + "Exception class %x\n", + sense[6] & 0x0f, sense[22] >> 4); + } + } else { + sprintf(page + len, KERN_ERR PRINTK_HEADER + " SORRY - NO VALID SENSE AVAILABLE\n"); + } + } else { + sprintf(page + len, KERN_ERR PRINTK_HEADER + " SORRY - NO TSB DATA AVAILABLE\n"); + } + printk("%s", page); + free_page((unsigned long) page); +} + +static void dasd_eckd_dump_sense(struct dasd_device *device, + struct dasd_ccw_req *req, struct irb *irb) +{ + if (req && scsw_is_tm(&req->irb.scsw)) + dasd_eckd_dump_sense_tcw(device, req, irb); + else + dasd_eckd_dump_sense_ccw(device, req, irb); +} + + /* * max_blocks is dependent on the amount of storage that is available * in the static io buffer for each device. Currently each device has @@ -2375,6 +3257,7 @@ static struct dasd_discipline dasd_eckd_discipline = { .build_cp = dasd_eckd_build_alias_cp, .free_cp = dasd_eckd_free_alias_cp, .dump_sense = dasd_eckd_dump_sense, + .dump_sense_dbf = dasd_eckd_dump_sense_dbf, .fill_info = dasd_eckd_fill_info, .ioctl = dasd_eckd_ioctl, }; diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h index 2476f87d21d0..ad45bcac3ce4 100644 --- a/drivers/s390/block/dasd_eckd.h +++ b/drivers/s390/block/dasd_eckd.h @@ -38,8 +38,11 @@ #define DASD_ECKD_CCW_RELEASE 0x94 #define DASD_ECKD_CCW_READ_CKD_MT 0x9e #define DASD_ECKD_CCW_WRITE_CKD_MT 0x9d +#define DASD_ECKD_CCW_WRITE_TRACK_DATA 0xA5 +#define DASD_ECKD_CCW_READ_TRACK_DATA 0xA6 #define DASD_ECKD_CCW_RESERVE 0xB4 #define DASD_ECKD_CCW_PFX 0xE7 +#define DASD_ECKD_CCW_PFX_READ 0xEA #define DASD_ECKD_CCW_RSCK 0xF9 /* @@ -48,6 +51,11 @@ #define PSF_ORDER_PRSSD 0x18 #define PSF_ORDER_SSC 0x1D +/* + * Size that is reportet for large volumes in the old 16-bit no_cyl field + */ +#define LV_COMPAT_CYL 0xFFFE + /***************************************************************************** * SECTION: Type Definitions ****************************************************************************/ @@ -118,7 +126,9 @@ struct DE_eckd_data { unsigned long long ep_sys_time; /* Ext Parameter - System Time Stamp */ __u8 ep_format; /* Extended Parameter format byte */ __u8 ep_prio; /* Extended Parameter priority I/O byte */ - __u8 ep_reserved[6]; /* Extended Parameter Reserved */ + __u8 ep_reserved1; /* Extended Parameter Reserved */ + __u8 ep_rec_per_track; /* Number of records on a track */ + __u8 ep_reserved[4]; /* Extended Parameter Reserved */ } __attribute__ ((packed)); struct LO_eckd_data { @@ -139,11 +149,37 @@ struct LO_eckd_data { __u16 length; } __attribute__ ((packed)); +struct LRE_eckd_data { + struct { + unsigned char orientation:2; + unsigned char operation:6; + } __attribute__ ((packed)) operation; + struct { + unsigned char length_valid:1; + unsigned char length_scope:1; + unsigned char imbedded_ccw_valid:1; + unsigned char check_bytes:2; + unsigned char imbedded_count_valid:1; + unsigned char reserved:1; + unsigned char read_count_suffix:1; + } __attribute__ ((packed)) auxiliary; + __u8 imbedded_ccw; + __u8 count; + struct ch_t seek_addr; + struct chr_t search_arg; + __u8 sector; + __u16 length; + __u8 imbedded_count; + __u8 extended_operation; + __u16 extended_parameter_length; + __u8 extended_parameter[0]; +} __attribute__ ((packed)); + /* Prefix data for format 0x00 and 0x01 */ struct PFX_eckd_data { unsigned char format; struct { - unsigned char define_extend:1; + unsigned char define_extent:1; unsigned char time_stamp:1; unsigned char verify_base:1; unsigned char hyper_pav:1; @@ -153,9 +189,8 @@ struct PFX_eckd_data { __u8 aux; __u8 base_lss; __u8 reserved[7]; - struct DE_eckd_data define_extend; - struct LO_eckd_data locate_record; - __u8 LO_extended_data[4]; + struct DE_eckd_data define_extent; + struct LRE_eckd_data locate_record; } __attribute__ ((packed)); struct dasd_eckd_characteristics { @@ -228,7 +263,8 @@ struct dasd_eckd_characteristics { __u8 factor7; __u8 factor8; __u8 reserved2[3]; - __u8 reserved3[10]; + __u8 reserved3[6]; + __u32 long_no_cyl; } __attribute__ ((packed)); /* elements of the configuration data */ @@ -406,6 +442,7 @@ struct dasd_eckd_private { int uses_cdl; struct attrib_data_t attrib; /* e.g. cache operations */ struct dasd_rssd_features features; + u32 real_cyl; /* alias managemnet */ struct dasd_uid uid; diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index f8e05ce98621..c24c8c30380d 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c @@ -6,6 +6,8 @@ * Author(s): Stefan Weinhuber <wein@de.ibm.com> */ +#define KMSG_COMPONENT "dasd" + #include <linux/init.h> #include <linux/fs.h> #include <linux/kernel.h> @@ -297,11 +299,12 @@ static void dasd_eer_write_standard_trigger(struct dasd_device *device, struct dasd_eer_header header; unsigned long flags; struct eerbuffer *eerb; + char *sense; /* go through cqr chain and count the valid sense data sets */ data_size = 0; for (temp_cqr = cqr; temp_cqr; temp_cqr = temp_cqr->refers) - if (temp_cqr->irb.esw.esw0.erw.cons) + if (dasd_get_sense(&temp_cqr->irb)) data_size += 32; header.total_size = sizeof(header) + data_size + 4; /* "EOR" */ @@ -316,9 +319,11 @@ static void dasd_eer_write_standard_trigger(struct dasd_device *device, list_for_each_entry(eerb, &bufferlist, list) { dasd_eer_start_record(eerb, header.total_size); dasd_eer_write_buffer(eerb, (char *) &header, sizeof(header)); - for (temp_cqr = cqr; temp_cqr; temp_cqr = temp_cqr->refers) - if (temp_cqr->irb.esw.esw0.erw.cons) - dasd_eer_write_buffer(eerb, cqr->irb.ecw, 32); + for (temp_cqr = cqr; temp_cqr; temp_cqr = temp_cqr->refers) { + sense = dasd_get_sense(&temp_cqr->irb); + if (sense) + dasd_eer_write_buffer(eerb, sense, 32); + } dasd_eer_write_buffer(eerb, "EOR", 4); } spin_unlock_irqrestore(&bufferlock, flags); @@ -451,6 +456,7 @@ int dasd_eer_enable(struct dasd_device *device) { struct dasd_ccw_req *cqr; unsigned long flags; + struct ccw1 *ccw; if (device->eer_cqr) return 0; @@ -468,10 +474,11 @@ int dasd_eer_enable(struct dasd_device *device) cqr->expires = 10 * HZ; clear_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); - cqr->cpaddr->cmd_code = DASD_ECKD_CCW_SNSS; - cqr->cpaddr->count = SNSS_DATA_SIZE; - cqr->cpaddr->flags = 0; - cqr->cpaddr->cda = (__u32)(addr_t) cqr->data; + ccw = cqr->cpaddr; + ccw->cmd_code = DASD_ECKD_CCW_SNSS; + ccw->count = SNSS_DATA_SIZE; + ccw->flags = 0; + ccw->cda = (__u32)(addr_t) cqr->data; cqr->buildclk = get_clock(); cqr->status = DASD_CQR_FILLED; @@ -534,7 +541,7 @@ static int dasd_eer_open(struct inode *inp, struct file *filp) if (eerb->buffer_page_count < 1 || eerb->buffer_page_count > INT_MAX / PAGE_SIZE) { kfree(eerb); - MESSAGE(KERN_WARNING, "can't open device since module " + DBF_EVENT(DBF_WARNING, "can't open device since module " "parameter eer_pages is smaller than 1 or" " bigger than %d", (int)(INT_MAX / PAGE_SIZE)); unlock_kernel(); @@ -687,7 +694,7 @@ int __init dasd_eer_init(void) if (rc) { kfree(dasd_eer_dev); dasd_eer_dev = NULL; - MESSAGE(KERN_ERR, "%s", "dasd_eer_init could not " + DBF_EVENT(DBF_ERR, "%s", "dasd_eer_init could not " "register misc device"); return rc; } diff --git a/drivers/s390/block/dasd_erp.c b/drivers/s390/block/dasd_erp.c index 8f10000851a3..d970ce2814be 100644 --- a/drivers/s390/block/dasd_erp.c +++ b/drivers/s390/block/dasd_erp.c @@ -9,6 +9,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/ctype.h> #include <linux/init.h> @@ -91,14 +93,14 @@ dasd_default_erp_action(struct dasd_ccw_req *cqr) /* just retry - there is nothing to save ... I got no sense data.... */ if (cqr->retries > 0) { - DEV_MESSAGE (KERN_DEBUG, device, + DBF_DEV_EVENT(DBF_DEBUG, device, "default ERP called (%i retries left)", cqr->retries); cqr->lpm = LPM_ANYPATH; cqr->status = DASD_CQR_FILLED; } else { - DEV_MESSAGE (KERN_WARNING, device, "%s", - "default ERP called (NO retry left)"); + dev_err(&device->cdev->dev, + "default ERP has run out of retries and failed\n"); cqr->status = DASD_CQR_FAILED; cqr->stopclk = get_clock(); } @@ -162,8 +164,21 @@ dasd_log_sense(struct dasd_ccw_req *cqr, struct irb *irb) device->discipline->dump_sense(device, cqr, irb); } +void +dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb) +{ + struct dasd_device *device; + + device = cqr->startdev; + /* dump sense data to s390 debugfeature*/ + if (device->discipline && device->discipline->dump_sense_dbf) + device->discipline->dump_sense_dbf(device, cqr, irb, "log"); +} +EXPORT_SYMBOL(dasd_log_sense_dbf); + EXPORT_SYMBOL(dasd_default_erp_action); EXPORT_SYMBOL(dasd_default_erp_postaction); EXPORT_SYMBOL(dasd_alloc_erp_request); EXPORT_SYMBOL(dasd_free_erp_request); EXPORT_SYMBOL(dasd_log_sense); + diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index f1d176021694..a3eb6fd14673 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c @@ -6,6 +6,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/stddef.h> #include <linux/kernel.h> #include <asm/debug.h> @@ -128,17 +130,18 @@ dasd_fba_check_characteristics(struct dasd_device *device) private = kzalloc(sizeof(struct dasd_fba_private), GFP_KERNEL | GFP_DMA); if (private == NULL) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "memory allocation failed for private " - "data"); + dev_warn(&device->cdev->dev, + "Allocating memory for private DASD " + "data failed\n"); return -ENOMEM; } device->private = (void *) private; } block = dasd_alloc_block(); if (IS_ERR(block)) { - DEV_MESSAGE(KERN_WARNING, device, "%s", - "could not allocate dasd block structure"); + DBF_EVENT(DBF_WARNING, "could not allocate dasd block " + "structure for device: %s", + dev_name(&device->cdev->dev)); device->private = NULL; kfree(private); return PTR_ERR(block); @@ -150,9 +153,9 @@ dasd_fba_check_characteristics(struct dasd_device *device) rdc_data = (void *) &(private->rdc_data); rc = dasd_generic_read_dev_chars(device, "FBA ", &rdc_data, 32); if (rc) { - DEV_MESSAGE(KERN_WARNING, device, - "Read device characteristics returned error %d", - rc); + DBF_EVENT(DBF_WARNING, "Read device characteristics returned " + "error %d for device: %s", + rc, dev_name(&device->cdev->dev)); device->block = NULL; dasd_free_block(block); device->private = NULL; @@ -160,15 +163,16 @@ dasd_fba_check_characteristics(struct dasd_device *device) return rc; } - DEV_MESSAGE(KERN_INFO, device, - "%04X/%02X(CU:%04X/%02X) %dMB at(%d B/blk)", - cdev->id.dev_type, - cdev->id.dev_model, - cdev->id.cu_type, - cdev->id.cu_model, - ((private->rdc_data.blk_bdsa * - (private->rdc_data.blk_size >> 9)) >> 11), - private->rdc_data.blk_size); + dev_info(&device->cdev->dev, + "New FBA DASD %04X/%02X (CU %04X/%02X) with %d MB " + "and %d B/blk\n", + cdev->id.dev_type, + cdev->id.dev_model, + cdev->id.cu_type, + cdev->id.cu_model, + ((private->rdc_data.blk_bdsa * + (private->rdc_data.blk_size >> 9)) >> 11), + private->rdc_data.blk_size); return 0; } @@ -180,7 +184,7 @@ static int dasd_fba_do_analysis(struct dasd_block *block) private = (struct dasd_fba_private *) block->base->private; rc = dasd_check_blocksize(private->rdc_data.blk_size); if (rc) { - DEV_MESSAGE(KERN_INFO, block->base, "unknown blocksize %d", + DBF_DEV_EVENT(DBF_WARNING, block->base, "unknown blocksize %d", private->rdc_data.blk_size); return rc; } @@ -215,7 +219,7 @@ dasd_fba_erp_postaction(struct dasd_ccw_req * cqr) if (cqr->function == dasd_default_erp_action) return dasd_default_erp_postaction; - DEV_MESSAGE(KERN_WARNING, cqr->startdev, "unknown ERP action %p", + DBF_DEV_EVENT(DBF_WARNING, cqr->startdev, "unknown ERP action %p", cqr->function); return NULL; } @@ -233,9 +237,9 @@ static void dasd_fba_handle_unsolicited_interrupt(struct dasd_device *device, } /* check for unsolicited interrupts */ - DEV_MESSAGE(KERN_DEBUG, device, "%s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "unsolicited interrupt received"); - device->discipline->dump_sense(device, NULL, irb); + device->discipline->dump_sense_dbf(device, NULL, irb, "unsolicited"); dasd_schedule_device_bh(device); return; }; @@ -437,6 +441,25 @@ dasd_fba_fill_info(struct dasd_device * device, } static void +dasd_fba_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, + struct irb *irb, char *reason) +{ + int sl; + if (irb->esw.esw0.erw.cons) { + for (sl = 0; sl < 4; sl++) { + DBF_DEV_EVENT(DBF_EMERG, device, + "%s: %08x %08x %08x %08x", + reason, irb->ecw[8 * 0], irb->ecw[8 * 1], + irb->ecw[8 * 2], irb->ecw[8 * 3]); + } + } else { + DBF_DEV_EVENT(DBF_EMERG, device, "%s", + "SORRY - NO VALID SENSE AVAILABLE\n"); + } +} + + +static void dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, struct irb *irb) { @@ -446,7 +469,7 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, page = (char *) get_zeroed_page(GFP_ATOMIC); if (page == NULL) { - DEV_MESSAGE(KERN_ERR, device, " %s", + DBF_DEV_EVENT(DBF_WARNING, device, "%s", "No memory to dump sense data"); return; } @@ -476,8 +499,7 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, len += sprintf(page + len, KERN_ERR PRINTK_HEADER " SORRY - NO VALID SENSE AVAILABLE\n"); } - MESSAGE_LOG(KERN_ERR, "%s", - page + sizeof(KERN_ERR PRINTK_HEADER)); + printk(KERN_ERR "%s", page); /* dump the Channel Program */ /* print first CCWs (maximum 8) */ @@ -498,8 +520,7 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, len += sprintf(page + len, "\n"); act++; } - MESSAGE_LOG(KERN_ERR, "%s", - page + sizeof(KERN_ERR PRINTK_HEADER)); + printk(KERN_ERR "%s", page); /* print failing CCW area */ @@ -540,8 +561,7 @@ dasd_fba_dump_sense(struct dasd_device *device, struct dasd_ccw_req * req, act++; } if (len > 0) - MESSAGE_LOG(KERN_ERR, "%s", - page + sizeof(KERN_ERR PRINTK_HEADER)); + printk(KERN_ERR "%s", page); free_page((unsigned long) page); } @@ -576,6 +596,7 @@ static struct dasd_discipline dasd_fba_discipline = { .build_cp = dasd_fba_build_cp, .free_cp = dasd_fba_free_cp, .dump_sense = dasd_fba_dump_sense, + .dump_sense_dbf = dasd_fba_dump_sense_dbf, .fill_info = dasd_fba_fill_info, }; diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c index e99d566b69cc..d3198303b93c 100644 --- a/drivers/s390/block/dasd_genhd.c +++ b/drivers/s390/block/dasd_genhd.c @@ -11,6 +11,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/interrupt.h> #include <linux/fs.h> #include <linux/blkpg.h> @@ -163,9 +165,8 @@ int dasd_gendisk_init(void) /* Register to static dasd major 94 */ rc = register_blkdev(DASD_MAJOR, "dasd"); if (rc != 0) { - MESSAGE(KERN_WARNING, - "Couldn't register successfully to " - "major no %d", DASD_MAJOR); + pr_warning("Registering the device driver with major number " + "%d failed\n", DASD_MAJOR); return rc; } return 0; diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index 4a39084d9c95..c1e487f774c6 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -112,6 +112,9 @@ do { \ d_data); \ } while(0) +/* limit size for an errorstring */ +#define ERRORLENGTH 30 + /* definition of dbf debug levels */ #define DBF_EMERG 0 /* system is unusable */ #define DBF_ALERT 1 /* action must be taken immediately */ @@ -157,7 +160,8 @@ struct dasd_ccw_req { struct dasd_block *block; /* the originating block device */ struct dasd_device *memdev; /* the device used to allocate this */ struct dasd_device *startdev; /* device the request is started on */ - struct ccw1 *cpaddr; /* address of channel program */ + void *cpaddr; /* address of ccw or tcw */ + unsigned char cpmode; /* 0 = cmd mode, 1 = itcw */ char status; /* status of this request */ short retries; /* A retry counter */ unsigned long flags; /* flags of this request */ @@ -280,6 +284,8 @@ struct dasd_discipline { dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, struct irb *); + void (*dump_sense_dbf) (struct dasd_device *, struct dasd_ccw_req *, + struct irb *, char *); void (*handle_unsolicited_interrupt) (struct dasd_device *, struct irb *); @@ -378,7 +384,7 @@ struct dasd_block { struct block_device *bdev; atomic_t open_count; - unsigned long blocks; /* size of volume in blocks */ + unsigned long long blocks; /* size of volume in blocks */ unsigned int bp_block; /* bytes per block */ unsigned int s2b_shift; /* log2 (bp_block/512) */ @@ -573,12 +579,14 @@ int dasd_generic_notify(struct ccw_device *, int); void dasd_generic_handle_state_change(struct dasd_device *); int dasd_generic_read_dev_chars(struct dasd_device *, char *, void **, int); +char *dasd_get_sense(struct irb *); /* externals in dasd_devmap.c */ extern int dasd_max_devindex; extern int dasd_probeonly; extern int dasd_autodetect; extern int dasd_nopav; +extern int dasd_nofcx; int dasd_devmap_init(void); void dasd_devmap_exit(void); @@ -623,6 +631,7 @@ struct dasd_ccw_req *dasd_alloc_erp_request(char *, int, int, struct dasd_device *); void dasd_free_erp_request(struct dasd_ccw_req *, struct dasd_device *); void dasd_log_sense(struct dasd_ccw_req *, struct irb *); +void dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb); /* externals in dasd_3990_erp.c */ struct dasd_ccw_req *dasd_3990_erp_action(struct dasd_ccw_req *); diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index b82d816d9ef7..4ce3f72ee1c1 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -9,6 +9,9 @@ * * i/o controls for the dasd driver. */ + +#define KMSG_COMPONENT "dasd" + #include <linux/interrupt.h> #include <linux/major.h> #include <linux/fs.h> @@ -94,7 +97,8 @@ static int dasd_ioctl_quiesce(struct dasd_block *block) if (!capable (CAP_SYS_ADMIN)) return -EACCES; - DEV_MESSAGE(KERN_DEBUG, base, "%s", "Quiesce IO on device"); + dev_info(&base->cdev->dev, "The DASD has been put in the quiesce " + "state\n"); spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags); base->stopped |= DASD_STOPPED_QUIESCE; spin_unlock_irqrestore(get_ccwdev_lock(base->cdev), flags); @@ -103,7 +107,7 @@ static int dasd_ioctl_quiesce(struct dasd_block *block) /* - * Quiesce device. + * Resume device. */ static int dasd_ioctl_resume(struct dasd_block *block) { @@ -114,7 +118,8 @@ static int dasd_ioctl_resume(struct dasd_block *block) if (!capable (CAP_SYS_ADMIN)) return -EACCES; - DEV_MESSAGE(KERN_DEBUG, base, "%s", "resume IO on device"); + dev_info(&base->cdev->dev, "I/O operations have been resumed " + "on the DASD\n"); spin_lock_irqsave(get_ccwdev_lock(base->cdev), flags); base->stopped &= ~DASD_STOPPED_QUIESCE; spin_unlock_irqrestore(get_ccwdev_lock(base->cdev), flags); @@ -140,13 +145,13 @@ static int dasd_format(struct dasd_block *block, struct format_data_t *fdata) return -EPERM; if (base->state != DASD_STATE_BASIC) { - DEV_MESSAGE(KERN_WARNING, base, "%s", - "dasd_format: device is not disabled! "); + dev_warn(&base->cdev->dev, + "The DASD cannot be formatted while it is enabled\n"); return -EBUSY; } DBF_DEV_EVENT(DBF_NOTICE, base, - "formatting units %d to %d (%d B blocks) flags %d", + "formatting units %u to %u (%u B blocks) flags %u", fdata->start_unit, fdata->stop_unit, fdata->blksize, fdata->intensity); @@ -169,10 +174,9 @@ static int dasd_format(struct dasd_block *block, struct format_data_t *fdata) dasd_sfree_request(cqr, cqr->memdev); if (rc) { if (rc != -ERESTARTSYS) - DEV_MESSAGE(KERN_ERR, base, - " Formatting of unit %d failed " - "with rc = %d", - fdata->start_unit, rc); + dev_err(&base->cdev->dev, + "Formatting unit %d failed with " + "rc=%d\n", fdata->start_unit, rc); return rc; } fdata->start_unit++; @@ -199,8 +203,9 @@ dasd_ioctl_format(struct block_device *bdev, void __user *argp) if (copy_from_user(&fdata, argp, sizeof(struct format_data_t))) return -EFAULT; if (bdev != bdev->bd_contains) { - DEV_MESSAGE(KERN_WARNING, block->base, "%s", - "Cannot low-level format a partition"); + dev_warn(&block->base->cdev->dev, + "The specified DASD is a partition and cannot be " + "formatted\n"); return -EINVAL; } return dasd_format(block, &fdata); @@ -365,9 +370,9 @@ static int dasd_ioctl_readall_cmb(struct dasd_block *block, unsigned int cmd, return ret; } -int -dasd_ioctl(struct block_device *bdev, fmode_t mode, - unsigned int cmd, unsigned long arg) +static int +dasd_do_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) { struct dasd_block *block = bdev->bd_disk->private_data; void __user *argp = (void __user *)arg; @@ -420,3 +425,14 @@ dasd_ioctl(struct block_device *bdev, fmode_t mode, return -EINVAL; } } + +int dasd_ioctl(struct block_device *bdev, fmode_t mode, + unsigned int cmd, unsigned long arg) +{ + int rc; + + lock_kernel(); + rc = dasd_do_ioctl(bdev, mode, cmd, arg); + unlock_kernel(); + return rc; +} diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c index bf6fd348f20e..2080ba6a69b0 100644 --- a/drivers/s390/block/dasd_proc.c +++ b/drivers/s390/block/dasd_proc.c @@ -11,6 +11,8 @@ * */ +#define KMSG_COMPONENT "dasd" + #include <linux/ctype.h> #include <linux/seq_file.h> #include <linux/vmalloc.h> @@ -112,7 +114,7 @@ dasd_devices_show(struct seq_file *m, void *v) seq_printf(m, "n/f "); else seq_printf(m, - "at blocksize: %d, %ld blocks, %ld MB", + "at blocksize: %d, %lld blocks, %lld MB", block->bp_block, block->blocks, ((block->bp_block >> 9) * block->blocks) >> 11); @@ -267,7 +269,7 @@ dasd_statistics_write(struct file *file, const char __user *user_buf, buffer = dasd_get_user_string(user_buf, user_len); if (IS_ERR(buffer)) return PTR_ERR(buffer); - MESSAGE_LOG(KERN_INFO, "/proc/dasd/statictics: '%s'", buffer); + DBF_EVENT(DBF_DEBUG, "/proc/dasd/statictics: '%s'\n", buffer); /* check for valid verbs */ for (str = buffer; isspace(*str); str++); @@ -277,33 +279,33 @@ dasd_statistics_write(struct file *file, const char __user *user_buf, if (strcmp(str, "on") == 0) { /* switch on statistics profiling */ dasd_profile_level = DASD_PROFILE_ON; - MESSAGE(KERN_INFO, "%s", "Statistics switched on"); + pr_info("The statistics feature has been switched " + "on\n"); } else if (strcmp(str, "off") == 0) { /* switch off and reset statistics profiling */ memset(&dasd_global_profile, 0, sizeof (struct dasd_profile_info_t)); dasd_profile_level = DASD_PROFILE_OFF; - MESSAGE(KERN_INFO, "%s", "Statistics switched off"); + pr_info("The statistics feature has been switched " + "off\n"); } else goto out_error; } else if (strncmp(str, "reset", 5) == 0) { /* reset the statistics */ memset(&dasd_global_profile, 0, sizeof (struct dasd_profile_info_t)); - MESSAGE(KERN_INFO, "%s", "Statistics reset"); + pr_info("The statistics have been reset\n"); } else goto out_error; kfree(buffer); return user_len; out_error: - MESSAGE(KERN_WARNING, "%s", - "/proc/dasd/statistics: only 'set on', 'set off' " - "and 'reset' are supported verbs"); + pr_warning("%s is not a supported value for /proc/dasd/statistics\n", + str); kfree(buffer); return -EINVAL; #else - MESSAGE(KERN_WARNING, "%s", - "/proc/dasd/statistics: is not activated in this kernel"); + pr_warning("/proc/dasd/statistics: is not activated in this kernel\n"); return user_len; #endif /* CONFIG_DASD_PROFILE */ } |