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>
This commit is contained in:
parent
22117d6eaa
commit
35b5d0be3d
|
@ -493,6 +493,7 @@ static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags,
|
||||||
cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO;
|
cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO;
|
||||||
cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM |
|
cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM |
|
||||||
IDE_TFLAG_OUT_FEATURE | tf_flags;
|
IDE_TFLAG_OUT_FEATURE | tf_flags;
|
||||||
|
cmd->tf.command = ATA_CMD_PACKET;
|
||||||
cmd->tf.feature = dma; /* Use PIO/DMA */
|
cmd->tf.feature = dma; /* Use PIO/DMA */
|
||||||
cmd->tf.lbam = bcount & 0xff;
|
cmd->tf.lbam = bcount & 0xff;
|
||||||
cmd->tf.lbah = (bcount >> 8) & 0xff;
|
cmd->tf.lbah = (bcount >> 8) & 0xff;
|
||||||
|
@ -638,6 +639,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
|
||||||
unsigned int timeout;
|
unsigned int timeout;
|
||||||
u32 tf_flags;
|
u32 tf_flags;
|
||||||
u16 bcount;
|
u16 bcount;
|
||||||
|
u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT);
|
||||||
|
|
||||||
if (dev_is_idecd(drive)) {
|
if (dev_is_idecd(drive)) {
|
||||||
tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL;
|
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)
|
||||||
|
|
||||||
(void)do_rw_taskfile(drive, cmd);
|
(void)do_rw_taskfile(drive, cmd);
|
||||||
|
|
||||||
/* Issue the packet command */
|
if (drq_int) {
|
||||||
if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {
|
|
||||||
if (drive->dma)
|
if (drive->dma)
|
||||||
drive->waiting_for_dma = 0;
|
drive->waiting_for_dma = 0;
|
||||||
hwif->expiry = expiry;
|
hwif->expiry = expiry;
|
||||||
ide_execute_command(drive, ATA_CMD_PACKET, ide_transfer_pc,
|
|
||||||
timeout);
|
|
||||||
return ide_started;
|
|
||||||
} else {
|
|
||||||
ide_execute_pkt_cmd(drive);
|
|
||||||
return ide_transfer_pc(drive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ide_execute_command(drive, cmd, ide_transfer_pc, timeout);
|
||||||
|
|
||||||
|
return drq_int ? ide_started : ide_transfer_pc(drive);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ide_issue_pc);
|
EXPORT_SYMBOL_GPL(ide_issue_pc);
|
||||||
|
|
|
@ -451,7 +451,7 @@ EXPORT_SYMBOL(ide_set_handler);
|
||||||
/**
|
/**
|
||||||
* ide_execute_command - execute an IDE command
|
* ide_execute_command - execute an IDE command
|
||||||
* @drive: IDE drive to issue the command against
|
* @drive: IDE drive to issue the command against
|
||||||
* @command: command byte to write
|
* @cmd: command
|
||||||
* @handler: handler for next phase
|
* @handler: handler for next phase
|
||||||
* @timeout: timeout for command
|
* @timeout: timeout for command
|
||||||
*
|
*
|
||||||
|
@ -461,15 +461,18 @@ EXPORT_SYMBOL(ide_set_handler);
|
||||||
* should go via this function or do equivalent locking.
|
* should go via this function or do equivalent locking.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
|
void ide_execute_command(ide_drive_t *drive, struct ide_cmd *cmd,
|
||||||
unsigned timeout)
|
ide_handler_t *handler, unsigned timeout)
|
||||||
{
|
{
|
||||||
ide_hwif_t *hwif = drive->hwif;
|
ide_hwif_t *hwif = drive->hwif;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave(&hwif->lock, flags);
|
spin_lock_irqsave(&hwif->lock, flags);
|
||||||
__ide_set_handler(drive, handler, timeout);
|
if ((cmd->protocol != ATAPI_PROT_DMA &&
|
||||||
hwif->tp_ops->exec_command(hwif, cmd);
|
cmd->protocol != ATAPI_PROT_PIO) ||
|
||||||
|
(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT))
|
||||||
|
__ide_set_handler(drive, handler, timeout);
|
||||||
|
hwif->tp_ops->exec_command(hwif, cmd->tf.command);
|
||||||
/*
|
/*
|
||||||
* Drive takes 400nS to respond, we must avoid the IRQ being
|
* Drive takes 400nS to respond, we must avoid the IRQ being
|
||||||
* serviced before that.
|
* serviced before that.
|
||||||
|
@ -480,18 +483,6 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
|
||||||
spin_unlock_irqrestore(&hwif->lock, flags);
|
spin_unlock_irqrestore(&hwif->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ide_execute_pkt_cmd(ide_drive_t *drive)
|
|
||||||
{
|
|
||||||
ide_hwif_t *hwif = drive->hwif;
|
|
||||||
unsigned long flags;
|
|
||||||
|
|
||||||
spin_lock_irqsave(&hwif->lock, flags);
|
|
||||||
hwif->tp_ops->exec_command(hwif, ATA_CMD_PACKET);
|
|
||||||
ndelay(400);
|
|
||||||
spin_unlock_irqrestore(&hwif->lock, flags);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ide_wait_not_busy() waits for the currently selected device on the hwif
|
* ide_wait_not_busy() waits for the currently selected device on the hwif
|
||||||
* to report a non-busy status, see comments in ide_probe_port().
|
* to report a non-busy status, see comments in ide_probe_port().
|
||||||
|
|
|
@ -97,8 +97,7 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
|
||||||
case ATA_PROT_NODATA:
|
case ATA_PROT_NODATA:
|
||||||
if (handler == NULL)
|
if (handler == NULL)
|
||||||
handler = task_no_data_intr;
|
handler = task_no_data_intr;
|
||||||
ide_execute_command(drive, tf->command, handler,
|
ide_execute_command(drive, cmd, handler, WAIT_WORSTCASE);
|
||||||
WAIT_WORSTCASE);
|
|
||||||
return ide_started;
|
return ide_started;
|
||||||
case ATA_PROT_DMA:
|
case ATA_PROT_DMA:
|
||||||
if ((drive->dev_flags & IDE_DFLAG_USING_DMA) == 0 ||
|
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)
|
||||||
dma_ops->dma_setup(drive, cmd))
|
dma_ops->dma_setup(drive, cmd))
|
||||||
return ide_stopped;
|
return ide_stopped;
|
||||||
hwif->expiry = dma_ops->dma_timer_expiry;
|
hwif->expiry = dma_ops->dma_timer_expiry;
|
||||||
ide_execute_command(drive, tf->command, ide_dma_intr,
|
ide_execute_command(drive, cmd, ide_dma_intr, 2 * WAIT_CMD);
|
||||||
2 * WAIT_CMD);
|
|
||||||
dma_ops->dma_start(drive);
|
dma_ops->dma_start(drive);
|
||||||
default:
|
default:
|
||||||
return ide_started;
|
return ide_started;
|
||||||
|
|
|
@ -1138,9 +1138,8 @@ void ide_kill_rq(ide_drive_t *, struct request *);
|
||||||
void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
|
void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
|
||||||
void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
|
void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
|
||||||
|
|
||||||
void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int);
|
void ide_execute_command(ide_drive_t *, struct ide_cmd *, ide_handler_t *,
|
||||||
|
unsigned int);
|
||||||
void ide_execute_pkt_cmd(ide_drive_t *);
|
|
||||||
|
|
||||||
void ide_pad_transfer(ide_drive_t *, int, int);
|
void ide_pad_transfer(ide_drive_t *, int, int);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue