aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/ataflop.c2
-rw-r--r--drivers/block/swim.c4
-rw-r--r--drivers/block/viodasd.c86
-rw-r--r--drivers/block/virtio_blk.c61
4 files changed, 84 insertions, 69 deletions
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index a5af1d6dda8b..e35cf59cbfde 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -1470,8 +1470,6 @@ repeat:
1470 1470
1471void do_fd_request(struct request_queue * q) 1471void do_fd_request(struct request_queue * q)
1472{ 1472{
1473 unsigned long flags;
1474
1475 DPRINT(("do_fd_request for pid %d\n",current->pid)); 1473 DPRINT(("do_fd_request for pid %d\n",current->pid));
1476 while( fdc_busy ) sleep_on( &fdc_wait ); 1474 while( fdc_busy ) sleep_on( &fdc_wait );
1477 fdc_busy = 1; 1475 fdc_busy = 1;
diff --git a/drivers/block/swim.c b/drivers/block/swim.c
index 8f569e3df890..821c2833f9cf 100644
--- a/drivers/block/swim.c
+++ b/drivers/block/swim.c
@@ -864,7 +864,7 @@ static int __devinit swim_probe(struct platform_device *dev)
864 struct swim_priv *swd; 864 struct swim_priv *swd;
865 int ret; 865 int ret;
866 866
867 res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs"); 867 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
868 if (!res) { 868 if (!res) {
869 ret = -ENODEV; 869 ret = -ENODEV;
870 goto out; 870 goto out;
@@ -942,7 +942,7 @@ static int __devexit swim_remove(struct platform_device *dev)
942 942
943 iounmap(swd->base); 943 iounmap(swd->base);
944 944
945 res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs"); 945 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
946 if (res) 946 if (res)
947 release_mem_region(res->start, resource_size(res)); 947 release_mem_region(res->start, resource_size(res));
948 948
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
69enum { 69enum {
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
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 51042f0ba7e1..7eff828b2117 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -243,10 +243,12 @@ static int index_to_minor(int index)
243static int __devinit virtblk_probe(struct virtio_device *vdev) 243static int __devinit virtblk_probe(struct virtio_device *vdev)
244{ 244{
245 struct virtio_blk *vblk; 245 struct virtio_blk *vblk;
246 struct request_queue *q;
246 int err; 247 int err;
247 u64 cap; 248 u64 cap;
248 u32 v; 249 u32 v, blk_size, sg_elems, opt_io_size;
249 u32 blk_size, sg_elems; 250 u16 min_io_size;
251 u8 physical_block_exp, alignment_offset;
250 252
251 if (index_to_minor(index) >= 1 << MINORBITS) 253 if (index_to_minor(index) >= 1 << MINORBITS)
252 return -ENOSPC; 254 return -ENOSPC;
@@ -293,13 +295,13 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
293 goto out_mempool; 295 goto out_mempool;
294 } 296 }
295 297
296 vblk->disk->queue = blk_init_queue(do_virtblk_request, &vblk->lock); 298 q = vblk->disk->queue = blk_init_queue(do_virtblk_request, &vblk->lock);
297 if (!vblk->disk->queue) { 299 if (!q) {
298 err = -ENOMEM; 300 err = -ENOMEM;
299 goto out_put_disk; 301 goto out_put_disk;
300 } 302 }
301 303
302 vblk->disk->queue->queuedata = vblk; 304 q->queuedata = vblk;
303 305
304 if (index < 26) { 306 if (index < 26) {
305 sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26); 307 sprintf(vblk->disk->disk_name, "vd%c", 'a' + index % 26);
@@ -323,10 +325,10 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
323 325
324 /* If barriers are supported, tell block layer that queue is ordered */ 326 /* If barriers are supported, tell block layer that queue is ordered */
325 if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH)) 327 if (virtio_has_feature(vdev, VIRTIO_BLK_F_FLUSH))
326 blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_DRAIN_FLUSH, 328 blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH,
327 virtblk_prepare_flush); 329 virtblk_prepare_flush);
328 else if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER)) 330 else if (virtio_has_feature(vdev, VIRTIO_BLK_F_BARRIER))
329 blk_queue_ordered(vblk->disk->queue, QUEUE_ORDERED_TAG, NULL); 331 blk_queue_ordered(q, QUEUE_ORDERED_TAG, NULL);
330 332
331 /* If disk is read-only in the host, the guest should obey */ 333 /* If disk is read-only in the host, the guest should obey */
332 if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO)) 334 if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))
@@ -345,14 +347,14 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
345 set_capacity(vblk->disk, cap); 347 set_capacity(vblk->disk, cap);
346 348
347 /* We can handle whatever the host told us to handle. */ 349 /* We can handle whatever the host told us to handle. */
348 blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2); 350 blk_queue_max_phys_segments(q, vblk->sg_elems-2);
349 blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2); 351 blk_queue_max_hw_segments(q, vblk->sg_elems-2);
350 352
351 /* No need to bounce any requests */ 353 /* No need to bounce any requests */
352 blk_queue_bounce_limit(vblk->disk->queue, BLK_BOUNCE_ANY); 354 blk_queue_bounce_limit(q, BLK_BOUNCE_ANY);
353 355
354 /* No real sector limit. */ 356 /* No real sector limit. */
355 blk_queue_max_sectors(vblk->disk->queue, -1U); 357 blk_queue_max_sectors(q, -1U);
356 358
357 /* Host can optionally specify maximum segment size and number of 359 /* Host can optionally specify maximum segment size and number of
358 * segments. */ 360 * segments. */
@@ -360,16 +362,45 @@ static int __devinit virtblk_probe(struct virtio_device *vdev)
360 offsetof(struct virtio_blk_config, size_max), 362 offsetof(struct virtio_blk_config, size_max),
361 &v); 363 &v);
362 if (!err) 364 if (!err)
363 blk_queue_max_segment_size(vblk->disk->queue, v); 365 blk_queue_max_segment_size(q, v);
364 else 366 else
365 blk_queue_max_segment_size(vblk->disk->queue, -1U); 367 blk_queue_max_segment_size(q, -1U);
366 368
367 /* Host can optionally specify the block size of the device */ 369 /* Host can optionally specify the block size of the device */
368 err = virtio_config_val(vdev, VIRTIO_BLK_F_BLK_SIZE, 370 err = virtio_config_val(vdev, VIRTIO_BLK_F_BLK_SIZE,
369 offsetof(struct virtio_blk_config, blk_size), 371 offsetof(struct virtio_blk_config, blk_size),
370 &blk_size); 372 &blk_size);
371 if (!err) 373 if (!err)
372 blk_queue_logical_block_size(vblk->disk->queue, blk_size); 374 blk_queue_logical_block_size(q, blk_size);
375 else
376 blk_size = queue_logical_block_size(q);
377
378 /* Use topology information if available */
379 err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
380 offsetof(struct virtio_blk_config, physical_block_exp),
381 &physical_block_exp);
382 if (!err && physical_block_exp)
383 blk_queue_physical_block_size(q,
384 blk_size * (1 << physical_block_exp));
385
386 err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
387 offsetof(struct virtio_blk_config, alignment_offset),
388 &alignment_offset);
389 if (!err && alignment_offset)
390 blk_queue_alignment_offset(q, blk_size * alignment_offset);
391
392 err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
393 offsetof(struct virtio_blk_config, min_io_size),
394 &min_io_size);
395 if (!err && min_io_size)
396 blk_queue_io_min(q, blk_size * min_io_size);
397
398 err = virtio_config_val(vdev, VIRTIO_BLK_F_TOPOLOGY,
399 offsetof(struct virtio_blk_config, opt_io_size),
400 &opt_io_size);
401 if (!err && opt_io_size)
402 blk_queue_io_opt(q, blk_size * opt_io_size);
403
373 404
374 add_disk(vblk->disk); 405 add_disk(vblk->disk);
375 return 0; 406 return 0;
@@ -412,7 +443,7 @@ static struct virtio_device_id id_table[] = {
412static unsigned int features[] = { 443static unsigned int features[] = {
413 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX, 444 VIRTIO_BLK_F_BARRIER, VIRTIO_BLK_F_SEG_MAX, VIRTIO_BLK_F_SIZE_MAX,
414 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE, 445 VIRTIO_BLK_F_GEOMETRY, VIRTIO_BLK_F_RO, VIRTIO_BLK_F_BLK_SIZE,
415 VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH 446 VIRTIO_BLK_F_SCSI, VIRTIO_BLK_F_FLUSH, VIRTIO_BLK_F_TOPOLOGY
416}; 447};
417 448
418/* 449/*