aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index fb6795236e76..38479a29d3e1 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -59,7 +59,7 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
59{ 59{
60 int ret = 1; 60 int ret = 1;
61 61
62 BUG_ON(!(rq->flags & REQ_STARTED)); 62 BUG_ON(!blk_rq_started(rq));
63 63
64 /* 64 /*
65 * if failfast is set on a request, override number of sectors and 65 * if failfast is set on a request, override number of sectors and
@@ -141,7 +141,7 @@ enum {
141 141
142static void ide_complete_power_step(ide_drive_t *drive, struct request *rq, u8 stat, u8 error) 142static void ide_complete_power_step(ide_drive_t *drive, struct request *rq, u8 stat, u8 error)
143{ 143{
144 struct request_pm_state *pm = rq->end_io_data; 144 struct request_pm_state *pm = rq->data;
145 145
146 if (drive->media != ide_disk) 146 if (drive->media != ide_disk)
147 return; 147 return;
@@ -164,7 +164,7 @@ static void ide_complete_power_step(ide_drive_t *drive, struct request *rq, u8 s
164 164
165static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq) 165static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
166{ 166{
167 struct request_pm_state *pm = rq->end_io_data; 167 struct request_pm_state *pm = rq->data;
168 ide_task_t *args = rq->special; 168 ide_task_t *args = rq->special;
169 169
170 memset(args, 0, sizeof(*args)); 170 memset(args, 0, sizeof(*args));
@@ -244,7 +244,7 @@ int ide_end_dequeued_request(ide_drive_t *drive, struct request *rq,
244 244
245 spin_lock_irqsave(&ide_lock, flags); 245 spin_lock_irqsave(&ide_lock, flags);
246 246
247 BUG_ON(!(rq->flags & REQ_STARTED)); 247 BUG_ON(!blk_rq_started(rq));
248 248
249 /* 249 /*
250 * if failfast is set on a request, override number of sectors and 250 * if failfast is set on a request, override number of sectors and
@@ -366,7 +366,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
366 rq = HWGROUP(drive)->rq; 366 rq = HWGROUP(drive)->rq;
367 spin_unlock_irqrestore(&ide_lock, flags); 367 spin_unlock_irqrestore(&ide_lock, flags);
368 368
369 if (rq->flags & REQ_DRIVE_CMD) { 369 if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
370 u8 *args = (u8 *) rq->buffer; 370 u8 *args = (u8 *) rq->buffer;
371 if (rq->errors == 0) 371 if (rq->errors == 0)
372 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 372 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
@@ -376,7 +376,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
376 args[1] = err; 376 args[1] = err;
377 args[2] = hwif->INB(IDE_NSECTOR_REG); 377 args[2] = hwif->INB(IDE_NSECTOR_REG);
378 } 378 }
379 } else if (rq->flags & REQ_DRIVE_TASK) { 379 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
380 u8 *args = (u8 *) rq->buffer; 380 u8 *args = (u8 *) rq->buffer;
381 if (rq->errors == 0) 381 if (rq->errors == 0)
382 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 382 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
@@ -390,7 +390,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
390 args[5] = hwif->INB(IDE_HCYL_REG); 390 args[5] = hwif->INB(IDE_HCYL_REG);
391 args[6] = hwif->INB(IDE_SELECT_REG); 391 args[6] = hwif->INB(IDE_SELECT_REG);
392 } 392 }
393 } else if (rq->flags & REQ_DRIVE_TASKFILE) { 393 } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
394 ide_task_t *args = (ide_task_t *) rq->special; 394 ide_task_t *args = (ide_task_t *) rq->special;
395 if (rq->errors == 0) 395 if (rq->errors == 0)
396 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 396 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
@@ -421,7 +421,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
421 } 421 }
422 } 422 }
423 } else if (blk_pm_request(rq)) { 423 } else if (blk_pm_request(rq)) {
424 struct request_pm_state *pm = rq->end_io_data; 424 struct request_pm_state *pm = rq->data;
425#ifdef DEBUG_PM 425#ifdef DEBUG_PM
426 printk("%s: complete_power_step(step: %d, stat: %x, err: %x)\n", 426 printk("%s: complete_power_step(step: %d, stat: %x, err: %x)\n",
427 drive->name, rq->pm->pm_step, stat, err); 427 drive->name, rq->pm->pm_step, stat, err);
@@ -587,7 +587,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat)
587 return ide_stopped; 587 return ide_stopped;
588 588
589 /* retry only "normal" I/O: */ 589 /* retry only "normal" I/O: */
590 if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { 590 if (!blk_fs_request(rq)) {
591 rq->errors = 1; 591 rq->errors = 1;
592 ide_end_drive_cmd(drive, stat, err); 592 ide_end_drive_cmd(drive, stat, err);
593 return ide_stopped; 593 return ide_stopped;
@@ -638,7 +638,7 @@ ide_startstop_t ide_abort(ide_drive_t *drive, const char *msg)
638 return ide_stopped; 638 return ide_stopped;
639 639
640 /* retry only "normal" I/O: */ 640 /* retry only "normal" I/O: */
641 if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK | REQ_DRIVE_TASKFILE)) { 641 if (!blk_fs_request(rq)) {
642 rq->errors = 1; 642 rq->errors = 1;
643 ide_end_drive_cmd(drive, BUSY_STAT, 0); 643 ide_end_drive_cmd(drive, BUSY_STAT, 0);
644 return ide_stopped; 644 return ide_stopped;
@@ -808,7 +808,7 @@ void ide_map_sg(ide_drive_t *drive, struct request *rq)
808 if (hwif->sg_mapped) /* needed by ide-scsi */ 808 if (hwif->sg_mapped) /* needed by ide-scsi */
809 return; 809 return;
810 810
811 if ((rq->flags & REQ_DRIVE_TASKFILE) == 0) { 811 if (rq->cmd_type != REQ_TYPE_ATA_TASKFILE) {
812 hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg); 812 hwif->sg_nents = blk_rq_map_sg(drive->queue, rq, sg);
813 } else { 813 } else {
814 sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE); 814 sg_init_one(sg, rq->buffer, rq->nr_sectors * SECTOR_SIZE);
@@ -844,7 +844,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
844 struct request *rq) 844 struct request *rq)
845{ 845{
846 ide_hwif_t *hwif = HWIF(drive); 846 ide_hwif_t *hwif = HWIF(drive);
847 if (rq->flags & REQ_DRIVE_TASKFILE) { 847 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
848 ide_task_t *args = rq->special; 848 ide_task_t *args = rq->special;
849 849
850 if (!args) 850 if (!args)
@@ -866,7 +866,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
866 if (args->tf_out_flags.all != 0) 866 if (args->tf_out_flags.all != 0)
867 return flagged_taskfile(drive, args); 867 return flagged_taskfile(drive, args);
868 return do_rw_taskfile(drive, args); 868 return do_rw_taskfile(drive, args);
869 } else if (rq->flags & REQ_DRIVE_TASK) { 869 } else if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
870 u8 *args = rq->buffer; 870 u8 *args = rq->buffer;
871 u8 sel; 871 u8 sel;
872 872
@@ -892,7 +892,7 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
892 hwif->OUTB(sel, IDE_SELECT_REG); 892 hwif->OUTB(sel, IDE_SELECT_REG);
893 ide_cmd(drive, args[0], args[2], &drive_cmd_intr); 893 ide_cmd(drive, args[0], args[2], &drive_cmd_intr);
894 return ide_started; 894 return ide_started;
895 } else if (rq->flags & REQ_DRIVE_CMD) { 895 } else if (rq->cmd_type == REQ_TYPE_ATA_CMD) {
896 u8 *args = rq->buffer; 896 u8 *args = rq->buffer;
897 897
898 if (!args) 898 if (!args)
@@ -933,7 +933,7 @@ done:
933 933
934static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) 934static void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
935{ 935{
936 struct request_pm_state *pm = rq->end_io_data; 936 struct request_pm_state *pm = rq->data;
937 937
938 if (blk_pm_suspend_request(rq) && 938 if (blk_pm_suspend_request(rq) &&
939 pm->pm_step == ide_pm_state_start_suspend) 939 pm->pm_step == ide_pm_state_start_suspend)
@@ -980,7 +980,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
980 ide_startstop_t startstop; 980 ide_startstop_t startstop;
981 sector_t block; 981 sector_t block;
982 982
983 BUG_ON(!(rq->flags & REQ_STARTED)); 983 BUG_ON(!blk_rq_started(rq));
984 984
985#ifdef DEBUG 985#ifdef DEBUG
986 printk("%s: start_request: current=0x%08lx\n", 986 printk("%s: start_request: current=0x%08lx\n",
@@ -1013,12 +1013,12 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
1013 if (!drive->special.all) { 1013 if (!drive->special.all) {
1014 ide_driver_t *drv; 1014 ide_driver_t *drv;
1015 1015
1016 if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK)) 1016 if (rq->cmd_type == REQ_TYPE_ATA_CMD ||
1017 return execute_drive_cmd(drive, rq); 1017 rq->cmd_type == REQ_TYPE_ATA_TASK ||
1018 else if (rq->flags & REQ_DRIVE_TASKFILE) 1018 rq->cmd_type == REQ_TYPE_ATA_TASKFILE)
1019 return execute_drive_cmd(drive, rq); 1019 return execute_drive_cmd(drive, rq);
1020 else if (blk_pm_request(rq)) { 1020 else if (blk_pm_request(rq)) {
1021 struct request_pm_state *pm = rq->end_io_data; 1021 struct request_pm_state *pm = rq->data;
1022#ifdef DEBUG_PM 1022#ifdef DEBUG_PM
1023 printk("%s: start_power_step(step: %d)\n", 1023 printk("%s: start_power_step(step: %d)\n",
1024 drive->name, rq->pm->pm_step); 1024 drive->name, rq->pm->pm_step);
@@ -1264,7 +1264,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
1264 * We count how many times we loop here to make sure we service 1264 * We count how many times we loop here to make sure we service
1265 * all drives in the hwgroup without looping for ever 1265 * all drives in the hwgroup without looping for ever
1266 */ 1266 */
1267 if (drive->blocked && !blk_pm_request(rq) && !(rq->flags & REQ_PREEMPT)) { 1267 if (drive->blocked && !blk_pm_request(rq) && !(rq->cmd_flags & REQ_PREEMPT)) {
1268 drive = drive->next ? drive->next : hwgroup->drive; 1268 drive = drive->next ? drive->next : hwgroup->drive;
1269 if (loops++ < 4 && !blk_queue_plugged(drive->queue)) 1269 if (loops++ < 4 && !blk_queue_plugged(drive->queue))
1270 goto again; 1270 goto again;
@@ -1670,7 +1670,7 @@ irqreturn_t ide_intr (int irq, void *dev_id, struct pt_regs *regs)
1670void ide_init_drive_cmd (struct request *rq) 1670void ide_init_drive_cmd (struct request *rq)
1671{ 1671{
1672 memset(rq, 0, sizeof(*rq)); 1672 memset(rq, 0, sizeof(*rq));
1673 rq->flags = REQ_DRIVE_CMD; 1673 rq->cmd_type = REQ_TYPE_ATA_CMD;
1674 rq->ref_count = 1; 1674 rq->ref_count = 1;
1675} 1675}
1676 1676
@@ -1710,7 +1710,6 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
1710 int must_wait = (action == ide_wait || action == ide_head_wait); 1710 int must_wait = (action == ide_wait || action == ide_head_wait);
1711 1711
1712 rq->errors = 0; 1712 rq->errors = 0;
1713 rq->rq_status = RQ_ACTIVE;
1714 1713
1715 /* 1714 /*
1716 * we need to hold an extra reference to request for safe inspection 1715 * we need to hold an extra reference to request for safe inspection
@@ -1718,7 +1717,7 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
1718 */ 1717 */
1719 if (must_wait) { 1718 if (must_wait) {
1720 rq->ref_count++; 1719 rq->ref_count++;
1721 rq->waiting = &wait; 1720 rq->end_io_data = &wait;
1722 rq->end_io = blk_end_sync_rq; 1721 rq->end_io = blk_end_sync_rq;
1723 } 1722 }
1724 1723
@@ -1727,7 +1726,7 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
1727 hwgroup->rq = NULL; 1726 hwgroup->rq = NULL;
1728 if (action == ide_preempt || action == ide_head_wait) { 1727 if (action == ide_preempt || action == ide_head_wait) {
1729 where = ELEVATOR_INSERT_FRONT; 1728 where = ELEVATOR_INSERT_FRONT;
1730 rq->flags |= REQ_PREEMPT; 1729 rq->cmd_flags |= REQ_PREEMPT;
1731 } 1730 }
1732 __elv_add_request(drive->queue, rq, where, 0); 1731 __elv_add_request(drive->queue, rq, where, 0);
1733 ide_do_request(hwgroup, IDE_NO_IRQ); 1732 ide_do_request(hwgroup, IDE_NO_IRQ);
@@ -1736,7 +1735,6 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio
1736 err = 0; 1735 err = 0;
1737 if (must_wait) { 1736 if (must_wait) {
1738 wait_for_completion(&wait); 1737 wait_for_completion(&wait);
1739 rq->waiting = NULL;
1740 if (rq->errors) 1738 if (rq->errors)
1741 err = -EIO; 1739 err = -EIO;
1742 1740