aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ns87415.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-04-08 08:13:03 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-08 08:13:03 -0400
commit3153c26b54230d025c6d536e8d3015def4524906 (patch)
tree0dc92136480ddfdd2f52a48045446e9ed95ed077 /drivers/ide/ns87415.c
parentc9ff9e7b64138d87023b733e618f29a1d58543f7 (diff)
ide: refactor tf_read() method
Simplify tf_read() method, making it deal only with 'struct ide_taskfile' and the validity flags that the upper layer passes, and factoring out the code that deals with the high order bytes into ide_tf_readback() to be called from the only two functions interested, ide_complete_cmd() and ide_dump_sector(). This should stop the needless code duplication in this method and so make it about twice smaller than it was; along with simplifying the setup for the method call, this should save both time and space... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ns87415.c')
-rw-r--r--drivers/ide/ns87415.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c
index f1305f4d2be7..95327a2c2422 100644
--- a/drivers/ide/ns87415.c
+++ b/drivers/ide/ns87415.c
@@ -61,14 +61,10 @@ static u8 superio_dma_sff_read_status(ide_hwif_t *hwif)
61 return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); 61 return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
62} 62}
63 63
64static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) 64static void superio_tf_read(ide_drive_t *drive, struct ide_taskfile *tf,
65 u8 valid)
65{ 66{
66 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 67 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
67 struct ide_taskfile *tf = &cmd->tf;
68 u8 valid = cmd->valid.in.tf;
69
70 /* be sure we're looking at the low order bits */
71 ide_write_devctl(hwif, ATA_DEVCTL_OBS);
72 68
73 if (valid & IDE_VALID_ERROR) 69 if (valid & IDE_VALID_ERROR)
74 tf->error = inb(io_ports->feature_addr); 70 tf->error = inb(io_ports->feature_addr);
@@ -82,24 +78,6 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
82 tf->lbah = inb(io_ports->lbah_addr); 78 tf->lbah = inb(io_ports->lbah_addr);
83 if (valid & IDE_VALID_DEVICE) 79 if (valid & IDE_VALID_DEVICE)
84 tf->device = superio_ide_inb(io_ports->device_addr); 80 tf->device = superio_ide_inb(io_ports->device_addr);
85
86 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
87 ide_write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS);
88
89 tf = &cmd->hob;
90 valid = cmd->valid.in.hob;
91
92 if (valid & IDE_VALID_ERROR)
93 tf->error = inb(io_ports->feature_addr);
94 if (valid & IDE_VALID_NSECT)
95 tf->nsect = inb(io_ports->nsect_addr);
96 if (valid & IDE_VALID_LBAL)
97 tf->lbal = inb(io_ports->lbal_addr);
98 if (valid & IDE_VALID_LBAM)
99 tf->lbam = inb(io_ports->lbam_addr);
100 if (valid & IDE_VALID_LBAH)
101 tf->lbah = inb(io_ports->lbah_addr);
102 }
103} 81}
104 82
105static void ns87415_dev_select(ide_drive_t *drive); 83static void ns87415_dev_select(ide_drive_t *drive);