diff options
| author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:47 -0400 |
|---|---|---|
| committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:47 -0400 |
| commit | 35b5d0be3d8de9a5ac51471c12029fb115200cdc (patch) | |
| tree | a9957b1952ad21c3313a39b3dc2ccdde3010035e | |
| parent | 22117d6eaac50d366d9013c88318a869ea4d8739 (diff) | |
ide: remove ide_execute_pkt_cmd() (v2)
* Pass command structure to ide_execute_command() and skip
__ide_set_handler() for ATAPI protocols on non-DRQ devices.
* Convert ide_issue_pc() to always use ide_execute_command()
and remove no longer needed ide_execute_pkt_cmd().
v2:
* Fix for non-DRQ devices (based on report from Borislav).
There should be no functional changes caused by this patch.
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
| -rw-r--r-- | drivers/ide/ide-atapi.c | 15 | ||||
| -rw-r--r-- | drivers/ide/ide-iops.c | 25 | ||||
| -rw-r--r-- | drivers/ide/ide-taskfile.c | 6 | ||||
| -rw-r--r-- | include/linux/ide.h | 5 |
4 files changed, 19 insertions, 32 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index f7fe1decb59d..2fb5d28a9be5 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
| @@ -493,6 +493,7 @@ static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, | |||
| 493 | cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; | 493 | cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; |
| 494 | cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | | 494 | cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | |
| 495 | IDE_TFLAG_OUT_FEATURE | tf_flags; | 495 | IDE_TFLAG_OUT_FEATURE | tf_flags; |
| 496 | cmd->tf.command = ATA_CMD_PACKET; | ||
| 496 | cmd->tf.feature = dma; /* Use PIO/DMA */ | 497 | cmd->tf.feature = dma; /* Use PIO/DMA */ |
| 497 | cmd->tf.lbam = bcount & 0xff; | 498 | cmd->tf.lbam = bcount & 0xff; |
| 498 | cmd->tf.lbah = (bcount >> 8) & 0xff; | 499 | cmd->tf.lbah = (bcount >> 8) & 0xff; |
| @@ -638,6 +639,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
| 638 | unsigned int timeout; | 639 | unsigned int timeout; |
| 639 | u32 tf_flags; | 640 | u32 tf_flags; |
| 640 | u16 bcount; | 641 | u16 bcount; |
| 642 | u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); | ||
| 641 | 643 | ||
| 642 | if (dev_is_idecd(drive)) { | 644 | if (dev_is_idecd(drive)) { |
| 643 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; | 645 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; |
| @@ -687,17 +689,14 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) | |||
| 687 | 689 | ||
| 688 | (void)do_rw_taskfile(drive, cmd); | 690 | (void)do_rw_taskfile(drive, cmd); |
| 689 | 691 | ||
| 690 | /* Issue the packet command */ | 692 | if (drq_int) { |
| 691 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { | ||
| 692 | if (drive->dma) | 693 | if (drive->dma) |
| 693 | drive->waiting_for_dma = 0; | 694 | drive->waiting_for_dma = 0; |
| 694 | hwif->expiry = expiry; | 695 | hwif->expiry = expiry; |
| 695 | ide_execute_command(drive, ATA_CMD_PACKET, ide_transfer_pc, | ||
| 696 | timeout); | ||
| 697 | return ide_started; | ||
| 698 | } else { | ||
| 699 | ide_execute_pkt_cmd(drive); | ||
| 700 | return ide_transfer_pc(drive); | ||
| 701 | } | 696 | } |
| 697 | |||
| 698 | ide_execute_command(drive, cmd, ide_transfer_pc, timeout); | ||
| 699 | |||
| 700 | return drq_int ? ide_started : ide_transfer_pc(drive); | ||
| 702 | } | 701 | } |
| 703 | EXPORT_SYMBOL_GPL(ide_issue_pc); | 702 | EXPORT_SYMBOL_GPL(ide_issue_pc); |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 52c1258ba9f4..5403e4a44be4 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
| @@ -451,7 +451,7 @@ EXPORT_SYMBOL(ide_set_handler); | |||
| 451 | /** | 451 | /** |
| 452 | * ide_execute_command - execute an IDE command | 452 | * ide_execute_command - execute an IDE command |
| 453 | * @drive: IDE drive to issue the command against | 453 | * @drive: IDE drive to issue the command against |
| 454 | * @command: command byte to write | 454 | * @cmd: command |
| 455 | * @handler: handler for next phase | 455 | * @handler: handler for next phase |
| 456 | * @timeout: timeout for command | 456 | * @timeout: timeout for command |
| 457 | * | 457 | * |
| @@ -461,15 +461,18 @@ EXPORT_SYMBOL(ide_set_handler); | |||
| 461 | * should go via this function or do equivalent locking. | 461 | * should go via this function or do equivalent locking. |
| 462 | */ | 462 | */ |
| 463 | 463 | ||
| 464 | void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | 464 | void ide_execute_command(ide_drive_t *drive, struct ide_cmd *cmd, |
| 465 | unsigned timeout) | 465 | ide_handler_t *handler, unsigned timeout) |
| 466 | { | 466 | { |
| 467 | ide_hwif_t *hwif = drive->hwif; | 467 | ide_hwif_t *hwif = drive->hwif; |
| 468 | unsigned long flags; | 468 | unsigned long flags; |
| 469 | 469 | ||
| 470 | spin_lock_irqsave(&hwif->lock, flags); | 470 | spin_lock_irqsave(&hwif->lock, flags); |
| 471 | __ide_set_handler(drive, handler, timeout); | 471 | if ((cmd->protocol != ATAPI_PROT_DMA && |
| 472 | hwif->tp_ops->exec_command(hwif, cmd); | 472 | cmd->protocol != ATAPI_PROT_PIO) || |
| 473 | (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT)) | ||
| 474 | __ide_set_handler(drive, handler, timeout); | ||
| 475 | hwif->tp_ops->exec_command(hwif, cmd->tf.command); | ||
| 473 | /* | 476 | /* |
| 474 | * Drive takes 400nS to respond, we must avoid the IRQ being | 477 | * Drive takes 400nS to respond, we must avoid the IRQ being |
| 475 | * serviced before that. | 478 | * serviced before that. |
| @@ -480,18 +483,6 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler, | |||
| 480 | spin_unlock_irqrestore(&hwif->lock, flags); | 483 | spin_unlock_irqrestore(&hwif->lock, flags); |
| 481 | } | 484 | } |
| 482 | 485 | ||
| 483 | void ide_execute_pkt_cmd(ide_drive_t *drive) | ||
| 484 | { | ||
| 485 | ide_hwif_t *hwif = drive->hwif; | ||
| 486 | unsigned long flags; | ||
| 487 | |||
| 488 | spin_lock_irqsave(&hwif->lock, flags); | ||
| 489 | hwif->tp_ops->exec_command(hwif, ATA_CMD_PACKET); | ||
| 490 | ndelay(400); | ||
| 491 | spin_unlock_irqrestore(&hwif->lock, flags); | ||
| 492 | } | ||
| 493 | EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd); | ||
| 494 | |||
| 495 | /* | 486 | /* |
| 496 | * ide_wait_not_busy() waits for the currently selected device on the hwif | 487 | * ide_wait_not_busy() waits for the currently selected device on the hwif |
| 497 | * to report a non-busy status, see comments in ide_probe_port(). | 488 | * to report a non-busy status, see comments in ide_probe_port(). |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index f5cf04cf5712..329fd6f13f79 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
| @@ -97,8 +97,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) | |||
| 97 | case ATA_PROT_NODATA: | 97 | case ATA_PROT_NODATA: |
| 98 | if (handler == NULL) | 98 | if (handler == NULL) |
| 99 | handler = task_no_data_intr; | 99 | handler = task_no_data_intr; |
| 100 | ide_execute_command(drive, tf->command, handler, | 100 | ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE); |
| 101 | WAIT_WORSTCASE); | ||
| 102 | return ide_started; | 101 | return ide_started; |
| 103 | case ATA_PROT_DMA: | 102 | case ATA_PROT_DMA: |
| 104 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || | 103 | if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 || |
| @@ -106,8 +105,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd) | |||
| 106 | dma_ops->dma_setup(drive, cmd)) | 105 | dma_ops->dma_setup(drive, cmd)) |
| 107 | return ide_stopped; | 106 | return ide_stopped; |
| 108 | hwif->expiry = dma_ops->dma_timer_expiry; | 107 | hwif->expiry = dma_ops->dma_timer_expiry; |
| 109 | ide_execute_command(drive, tf->command, ide_dma_intr, | 108 | ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD); |
| 110 | 2 * WAIT_CMD); | ||
| 111 | dma_ops->dma_start(drive); | 109 | dma_ops->dma_start(drive); |
| 112 | default: | 110 | default: |
| 113 | return ide_started; | 111 | return ide_started; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 9476939101be..2d0c7afd5e58 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
| @@ -1138,9 +1138,8 @@ void ide_kill_rq(ide_drive_t *, struct request *); | |||
| 1138 | void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); | 1138 | void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); |
| 1139 | void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); | 1139 | void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int); |
| 1140 | 1140 | ||
| 1141 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int); | 1141 | void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *, |
| 1142 | 1142 | unsigned int); | |
| 1143 | void ide_execute_pkt_cmd(ide_drive_t *); | ||
| 1144 | 1143 | ||
| 1145 | void ide_pad_transfer(ide_drive_t *, int, int); | 1144 | void ide_pad_transfer(ide_drive_t *, int, int); |
| 1146 | 1145 | ||
