ide: add ->exec_command method
Add ->exec_command method for writing ATA Command register and use it instead of ->OUTBSYNC. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
@@ -103,6 +103,14 @@ void SELECT_MASK(ide_drive_t *drive, int mask)
|
||||
port_ops->maskproc(drive, mask);
|
||||
}
|
||||
|
||||
static void ide_exec_command(ide_hwif_t *hwif, u8 cmd)
|
||||
{
|
||||
if (hwif->host_flags & IDE_HFLAG_MMIO)
|
||||
writeb(cmd, (void __iomem *)hwif->io_ports.command_addr);
|
||||
else
|
||||
outb(cmd, hwif->io_ports.command_addr);
|
||||
}
|
||||
|
||||
static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
|
||||
{
|
||||
if (hwif->host_flags & IDE_HFLAG_MMIO)
|
||||
@@ -331,6 +339,7 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq,
|
||||
|
||||
void default_hwif_transport(ide_hwif_t *hwif)
|
||||
{
|
||||
hwif->exec_command = ide_exec_command;
|
||||
hwif->read_sff_dma_status = ide_read_sff_dma_status;
|
||||
|
||||
hwif->tf_load = ide_tf_load;
|
||||
@@ -696,7 +705,7 @@ int ide_driveid_update(ide_drive_t *drive)
|
||||
SELECT_MASK(drive, 1);
|
||||
ide_set_irq(drive, 0);
|
||||
msleep(50);
|
||||
hwif->OUTBSYNC(hwif, WIN_IDENTIFY, hwif->io_ports.command_addr);
|
||||
hwif->exec_command(hwif, WIN_IDENTIFY);
|
||||
timeout = jiffies + WAIT_WORSTCASE;
|
||||
do {
|
||||
if (time_after(jiffies, timeout)) {
|
||||
@@ -783,7 +792,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
|
||||
ide_set_irq(drive, 0);
|
||||
hwif->OUTB(speed, io_ports->nsect_addr);
|
||||
hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr);
|
||||
hwif->OUTBSYNC(hwif, WIN_SETFEATURES, io_ports->command_addr);
|
||||
hwif->exec_command(hwif, WIN_SETFEATURES);
|
||||
if (drive->quirk_list == 2)
|
||||
ide_set_irq(drive, 1);
|
||||
|
||||
@@ -891,7 +900,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
|
||||
|
||||
spin_lock_irqsave(&ide_lock, flags);
|
||||
__ide_set_handler(drive, handler, timeout, expiry);
|
||||
hwif->OUTBSYNC(hwif, cmd, hwif->io_ports.command_addr);
|
||||
hwif->exec_command(hwif, cmd);
|
||||
/*
|
||||
* Drive takes 400nS to respond, we must avoid the IRQ being
|
||||
* serviced before that.
|
||||
@@ -909,7 +918,7 @@ void ide_execute_pkt_cmd(ide_drive_t *drive)
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&ide_lock, flags);
|
||||
hwif->OUTBSYNC(hwif, WIN_PACKETCMD, hwif->io_ports.command_addr);
|
||||
hwif->exec_command(hwif, WIN_PACKETCMD);
|
||||
ndelay(400);
|
||||
spin_unlock_irqrestore(&ide_lock, flags);
|
||||
}
|
||||
@@ -1116,7 +1125,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
|
||||
pre_reset(drive);
|
||||
SELECT_DRIVE(drive);
|
||||
udelay (20);
|
||||
hwif->OUTBSYNC(hwif, WIN_SRST, io_ports->command_addr);
|
||||
hwif->exec_command(hwif, WIN_SRST);
|
||||
ndelay(400);
|
||||
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
|
||||
hwgroup->polling = 1;
|
||||
|
Reference in New Issue
Block a user