aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/scc_pata.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/scc_pata.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/scc_pata.c')
-rw-r--r--drivers/ide/scc_pata.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 5ecb70cf29dc..5be41f25204f 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -663,14 +663,9 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
663 scc_ide_outb(tf->device, io_ports->device_addr); 663 scc_ide_outb(tf->device, io_ports->device_addr);
664} 664}
665 665
666static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) 666static void scc_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
667{ 667{
668 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 668 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
669 struct ide_taskfile *tf = &cmd->tf;
670 u8 valid = cmd->valid.in.tf;
671
672 /* be sure we're looking at the low order bits */
673 scc_write_devctl(hwif, ATA_DEVCTL_OBS);
674 669
675 if (valid & IDE_VALID_ERROR) 670 if (valid & IDE_VALID_ERROR)
676 tf->error = scc_ide_inb(io_ports->feature_addr); 671 tf->error = scc_ide_inb(io_ports->feature_addr);
@@ -684,24 +679,6 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
684 tf->lbah = scc_ide_inb(io_ports->lbah_addr); 679 tf->lbah = scc_ide_inb(io_ports->lbah_addr);
685 if (valid & IDE_VALID_DEVICE) 680 if (valid & IDE_VALID_DEVICE)
686 tf->device = scc_ide_inb(io_ports->device_addr); 681 tf->device = scc_ide_inb(io_ports->device_addr);
687
688 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
689 scc_write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS);
690
691 tf = &cmd->hob;
692 valid = cmd->valid.in.hob;
693
694 if (valid & IDE_VALID_ERROR)
695 tf->error = scc_ide_inb(io_ports->feature_addr);
696 if (valid & IDE_VALID_NSECT)
697 tf->nsect = scc_ide_inb(io_ports->nsect_addr);
698 if (valid & IDE_VALID_LBAL)
699 tf->lbal = scc_ide_inb(io_ports->lbal_addr);
700 if (valid & IDE_VALID_LBAM)
701 tf->lbam = scc_ide_inb(io_ports->lbam_addr);
702 if (valid & IDE_VALID_LBAH)
703 tf->lbah = scc_ide_inb(io_ports->lbah_addr);
704 }
705} 682}
706 683
707static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd, 684static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd,