diff options
Diffstat (limited to 'drivers/block/viodasd.c')
-rw-r--r-- | drivers/block/viodasd.c | 86 |
1 files changed, 36 insertions, 50 deletions
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index a8c8b56b275e..1b3def1e8591 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -28,6 +28,9 @@ | |||
28 | * All disk operations are performed by sending messages back and forth to | 28 | * All disk operations are performed by sending messages back and forth to |
29 | * the OS/400 partition. | 29 | * the OS/400 partition. |
30 | */ | 30 | */ |
31 | |||
32 | #define pr_fmt(fmt) "viod: " fmt | ||
33 | |||
31 | #include <linux/major.h> | 34 | #include <linux/major.h> |
32 | #include <linux/fs.h> | 35 | #include <linux/fs.h> |
33 | #include <linux/module.h> | 36 | #include <linux/module.h> |
@@ -63,9 +66,6 @@ MODULE_LICENSE("GPL"); | |||
63 | 66 | ||
64 | #define VIOD_VERS "1.64" | 67 | #define VIOD_VERS "1.64" |
65 | 68 | ||
66 | #define VIOD_KERN_WARNING KERN_WARNING "viod: " | ||
67 | #define VIOD_KERN_INFO KERN_INFO "viod: " | ||
68 | |||
69 | enum { | 69 | enum { |
70 | PARTITION_SHIFT = 3, | 70 | PARTITION_SHIFT = 3, |
71 | MAX_DISKNO = HVMAXARCHITECTEDVIRTUALDISKS, | 71 | MAX_DISKNO = HVMAXARCHITECTEDVIRTUALDISKS, |
@@ -156,7 +156,7 @@ static int viodasd_open(struct block_device *bdev, fmode_t mode) | |||
156 | ((u64)DEVICE_NO(d) << 48) | ((u64)flags << 32), | 156 | ((u64)DEVICE_NO(d) << 48) | ((u64)flags << 32), |
157 | 0, 0, 0); | 157 | 0, 0, 0); |
158 | if (hvrc != 0) { | 158 | if (hvrc != 0) { |
159 | printk(VIOD_KERN_WARNING "HV open failed %d\n", (int)hvrc); | 159 | pr_warning("HV open failed %d\n", (int)hvrc); |
160 | return -EIO; | 160 | return -EIO; |
161 | } | 161 | } |
162 | 162 | ||
@@ -167,9 +167,8 @@ static int viodasd_open(struct block_device *bdev, fmode_t mode) | |||
167 | const struct vio_error_entry *err = | 167 | const struct vio_error_entry *err = |
168 | vio_lookup_rc(viodasd_err_table, we.sub_result); | 168 | vio_lookup_rc(viodasd_err_table, we.sub_result); |
169 | 169 | ||
170 | printk(VIOD_KERN_WARNING | 170 | pr_warning("bad rc opening disk: %d:0x%04x (%s)\n", |
171 | "bad rc opening disk: %d:0x%04x (%s)\n", | 171 | (int)we.rc, we.sub_result, err->msg); |
172 | (int)we.rc, we.sub_result, err->msg); | ||
173 | return -EIO; | 172 | return -EIO; |
174 | } | 173 | } |
175 | 174 | ||
@@ -195,8 +194,7 @@ static int viodasd_release(struct gendisk *disk, fmode_t mode) | |||
195 | ((u64)DEVICE_NO(d) << 48) /* | ((u64)flags << 32) */, | 194 | ((u64)DEVICE_NO(d) << 48) /* | ((u64)flags << 32) */, |
196 | 0, 0, 0); | 195 | 0, 0, 0); |
197 | if (hvrc != 0) | 196 | if (hvrc != 0) |
198 | printk(VIOD_KERN_WARNING "HV close call failed %d\n", | 197 | pr_warning("HV close call failed %d\n", (int)hvrc); |
199 | (int)hvrc); | ||
200 | return 0; | 198 | return 0; |
201 | } | 199 | } |
202 | 200 | ||
@@ -288,8 +286,7 @@ static int send_request(struct request *req) | |||
288 | bevent = (struct vioblocklpevent *) | 286 | bevent = (struct vioblocklpevent *) |
289 | vio_get_event_buffer(viomajorsubtype_blockio); | 287 | vio_get_event_buffer(viomajorsubtype_blockio); |
290 | if (bevent == NULL) { | 288 | if (bevent == NULL) { |
291 | printk(VIOD_KERN_WARNING | 289 | pr_warning("error allocating disk event buffer\n"); |
292 | "error allocating disk event buffer\n"); | ||
293 | goto error_ret; | 290 | goto error_ret; |
294 | } | 291 | } |
295 | 292 | ||
@@ -333,9 +330,8 @@ static int send_request(struct request *req) | |||
333 | } | 330 | } |
334 | 331 | ||
335 | if (hvrc != HvLpEvent_Rc_Good) { | 332 | if (hvrc != HvLpEvent_Rc_Good) { |
336 | printk(VIOD_KERN_WARNING | 333 | pr_warning("error sending disk event to OS/400 (rc %d)\n", |
337 | "error sending disk event to OS/400 (rc %d)\n", | 334 | (int)hvrc); |
338 | (int)hvrc); | ||
339 | goto error_ret; | 335 | goto error_ret; |
340 | } | 336 | } |
341 | spin_unlock_irqrestore(&viodasd_spinlock, flags); | 337 | spin_unlock_irqrestore(&viodasd_spinlock, flags); |
@@ -402,7 +398,7 @@ retry: | |||
402 | ((u64)dev_no << 48) | ((u64)flags<< 32), | 398 | ((u64)dev_no << 48) | ((u64)flags<< 32), |
403 | 0, 0, 0); | 399 | 0, 0, 0); |
404 | if (hvrc != 0) { | 400 | if (hvrc != 0) { |
405 | printk(VIOD_KERN_WARNING "bad rc on HV open %d\n", (int)hvrc); | 401 | pr_warning("bad rc on HV open %d\n", (int)hvrc); |
406 | return 0; | 402 | return 0; |
407 | } | 403 | } |
408 | 404 | ||
@@ -416,9 +412,8 @@ retry: | |||
416 | goto retry; | 412 | goto retry; |
417 | } | 413 | } |
418 | if (we.max_disk > (MAX_DISKNO - 1)) { | 414 | if (we.max_disk > (MAX_DISKNO - 1)) { |
419 | printk_once(VIOD_KERN_INFO | 415 | printk_once(KERN_INFO pr_fmt("Only examining the first %d of %d disks connected\n"), |
420 | "Only examining the first %d of %d disks connected\n", | 416 | MAX_DISKNO, we.max_disk + 1); |
421 | MAX_DISKNO, we.max_disk + 1); | ||
422 | } | 417 | } |
423 | 418 | ||
424 | /* Send the close event to OS/400. We DON'T expect a response */ | 419 | /* Send the close event to OS/400. We DON'T expect a response */ |
@@ -432,17 +427,15 @@ retry: | |||
432 | ((u64)dev_no << 48) | ((u64)flags << 32), | 427 | ((u64)dev_no << 48) | ((u64)flags << 32), |
433 | 0, 0, 0); | 428 | 0, 0, 0); |
434 | if (hvrc != 0) { | 429 | if (hvrc != 0) { |
435 | printk(VIOD_KERN_WARNING | 430 | pr_warning("bad rc sending event to OS/400 %d\n", (int)hvrc); |
436 | "bad rc sending event to OS/400 %d\n", (int)hvrc); | ||
437 | return 0; | 431 | return 0; |
438 | } | 432 | } |
439 | 433 | ||
440 | if (d->dev == NULL) { | 434 | if (d->dev == NULL) { |
441 | /* this is when we reprobe for new disks */ | 435 | /* this is when we reprobe for new disks */ |
442 | if (vio_create_viodasd(dev_no) == NULL) { | 436 | if (vio_create_viodasd(dev_no) == NULL) { |
443 | printk(VIOD_KERN_WARNING | 437 | pr_warning("cannot allocate virtual device for disk %d\n", |
444 | "cannot allocate virtual device for disk %d\n", | 438 | dev_no); |
445 | dev_no); | ||
446 | return 0; | 439 | return 0; |
447 | } | 440 | } |
448 | /* | 441 | /* |
@@ -457,15 +450,13 @@ retry: | |||
457 | spin_lock_init(&d->q_lock); | 450 | spin_lock_init(&d->q_lock); |
458 | q = blk_init_queue(do_viodasd_request, &d->q_lock); | 451 | q = blk_init_queue(do_viodasd_request, &d->q_lock); |
459 | if (q == NULL) { | 452 | if (q == NULL) { |
460 | printk(VIOD_KERN_WARNING "cannot allocate queue for disk %d\n", | 453 | pr_warning("cannot allocate queue for disk %d\n", dev_no); |
461 | dev_no); | ||
462 | return 0; | 454 | return 0; |
463 | } | 455 | } |
464 | g = alloc_disk(1 << PARTITION_SHIFT); | 456 | g = alloc_disk(1 << PARTITION_SHIFT); |
465 | if (g == NULL) { | 457 | if (g == NULL) { |
466 | printk(VIOD_KERN_WARNING | 458 | pr_warning("cannot allocate disk structure for disk %d\n", |
467 | "cannot allocate disk structure for disk %d\n", | 459 | dev_no); |
468 | dev_no); | ||
469 | blk_cleanup_queue(q); | 460 | blk_cleanup_queue(q); |
470 | return 0; | 461 | return 0; |
471 | } | 462 | } |
@@ -489,13 +480,12 @@ retry: | |||
489 | g->driverfs_dev = d->dev; | 480 | g->driverfs_dev = d->dev; |
490 | set_capacity(g, d->size >> 9); | 481 | set_capacity(g, d->size >> 9); |
491 | 482 | ||
492 | printk(VIOD_KERN_INFO "disk %d: %lu sectors (%lu MB) " | 483 | pr_info("disk %d: %lu sectors (%lu MB) CHS=%d/%d/%d sector size %d%s\n", |
493 | "CHS=%d/%d/%d sector size %d%s\n", | 484 | dev_no, (unsigned long)(d->size >> 9), |
494 | dev_no, (unsigned long)(d->size >> 9), | 485 | (unsigned long)(d->size >> 20), |
495 | (unsigned long)(d->size >> 20), | 486 | (int)d->cylinders, (int)d->tracks, |
496 | (int)d->cylinders, (int)d->tracks, | 487 | (int)d->sectors, (int)d->bytes_per_sector, |
497 | (int)d->sectors, (int)d->bytes_per_sector, | 488 | d->read_only ? " (RO)" : ""); |
498 | d->read_only ? " (RO)" : ""); | ||
499 | 489 | ||
500 | /* register us in the global list */ | 490 | /* register us in the global list */ |
501 | add_disk(g); | 491 | add_disk(g); |
@@ -580,8 +570,8 @@ static int viodasd_handle_read_write(struct vioblocklpevent *bevent) | |||
580 | if (error) { | 570 | if (error) { |
581 | const struct vio_error_entry *err; | 571 | const struct vio_error_entry *err; |
582 | err = vio_lookup_rc(viodasd_err_table, bevent->sub_result); | 572 | err = vio_lookup_rc(viodasd_err_table, bevent->sub_result); |
583 | printk(VIOD_KERN_WARNING "read/write error %d:0x%04x (%s)\n", | 573 | pr_warning("read/write error %d:0x%04x (%s)\n", |
584 | event->xRc, bevent->sub_result, err->msg); | 574 | event->xRc, bevent->sub_result, err->msg); |
585 | num_sect = blk_rq_sectors(req); | 575 | num_sect = blk_rq_sectors(req); |
586 | } | 576 | } |
587 | qlock = req->q->queue_lock; | 577 | qlock = req->q->queue_lock; |
@@ -606,8 +596,7 @@ static void handle_block_event(struct HvLpEvent *event) | |||
606 | return; | 596 | return; |
607 | /* First, we should NEVER get an int here...only acks */ | 597 | /* First, we should NEVER get an int here...only acks */ |
608 | if (hvlpevent_is_int(event)) { | 598 | if (hvlpevent_is_int(event)) { |
609 | printk(VIOD_KERN_WARNING | 599 | pr_warning("Yikes! got an int in viodasd event handler!\n"); |
610 | "Yikes! got an int in viodasd event handler!\n"); | ||
611 | if (hvlpevent_need_ack(event)) { | 600 | if (hvlpevent_need_ack(event)) { |
612 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 601 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
613 | HvCallEvent_ackLpEvent(event); | 602 | HvCallEvent_ackLpEvent(event); |
@@ -650,7 +639,7 @@ static void handle_block_event(struct HvLpEvent *event) | |||
650 | break; | 639 | break; |
651 | 640 | ||
652 | default: | 641 | default: |
653 | printk(VIOD_KERN_WARNING "invalid subtype!"); | 642 | pr_warning("invalid subtype!"); |
654 | if (hvlpevent_need_ack(event)) { | 643 | if (hvlpevent_need_ack(event)) { |
655 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | 644 | event->xRc = HvLpEvent_Rc_InvalidSubtype; |
656 | HvCallEvent_ackLpEvent(event); | 645 | HvCallEvent_ackLpEvent(event); |
@@ -739,29 +728,26 @@ static int __init viodasd_init(void) | |||
739 | vio_set_hostlp(); | 728 | vio_set_hostlp(); |
740 | 729 | ||
741 | if (viopath_hostLp == HvLpIndexInvalid) { | 730 | if (viopath_hostLp == HvLpIndexInvalid) { |
742 | printk(VIOD_KERN_WARNING "invalid hosting partition\n"); | 731 | pr_warning("invalid hosting partition\n"); |
743 | rc = -EIO; | 732 | rc = -EIO; |
744 | goto early_fail; | 733 | goto early_fail; |
745 | } | 734 | } |
746 | 735 | ||
747 | printk(VIOD_KERN_INFO "vers " VIOD_VERS ", hosting partition %d\n", | 736 | pr_info("vers " VIOD_VERS ", hosting partition %d\n", viopath_hostLp); |
748 | viopath_hostLp); | ||
749 | 737 | ||
750 | /* register the block device */ | 738 | /* register the block device */ |
751 | rc = register_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME); | 739 | rc = register_blkdev(VIODASD_MAJOR, VIOD_GENHD_NAME); |
752 | if (rc) { | 740 | if (rc) { |
753 | printk(VIOD_KERN_WARNING | 741 | pr_warning("Unable to get major number %d for %s\n", |
754 | "Unable to get major number %d for %s\n", | 742 | VIODASD_MAJOR, VIOD_GENHD_NAME); |
755 | VIODASD_MAJOR, VIOD_GENHD_NAME); | ||
756 | goto early_fail; | 743 | goto early_fail; |
757 | } | 744 | } |
758 | /* Actually open the path to the hosting partition */ | 745 | /* Actually open the path to the hosting partition */ |
759 | rc = viopath_open(viopath_hostLp, viomajorsubtype_blockio, | 746 | rc = viopath_open(viopath_hostLp, viomajorsubtype_blockio, |
760 | VIOMAXREQ + 2); | 747 | VIOMAXREQ + 2); |
761 | if (rc) { | 748 | if (rc) { |
762 | printk(VIOD_KERN_WARNING | 749 | pr_warning("error opening path to host partition %d\n", |
763 | "error opening path to host partition %d\n", | 750 | viopath_hostLp); |
764 | viopath_hostLp); | ||
765 | goto unregister_blk; | 751 | goto unregister_blk; |
766 | } | 752 | } |
767 | 753 | ||
@@ -770,7 +756,7 @@ static int __init viodasd_init(void) | |||
770 | 756 | ||
771 | rc = vio_register_driver(&viodasd_driver); | 757 | rc = vio_register_driver(&viodasd_driver); |
772 | if (rc) { | 758 | if (rc) { |
773 | printk(VIOD_KERN_WARNING "vio_register_driver failed\n"); | 759 | pr_warning("vio_register_driver failed\n"); |
774 | goto unset_handler; | 760 | goto unset_handler; |
775 | } | 761 | } |
776 | 762 | ||