aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/scc_pata.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:40 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:40 -0400
commitdb2432c40f4afbf5869d4885adbd023c581dbd0b (patch)
tree1ec6543ecc49f2b997ad9a7e2976e656e29b5d5d /drivers/ide/pci/scc_pata.c
parent92fcaaa85ec2004abc148b70b667812a42ae8272 (diff)
scc_pata: add ->tf_{load,read} methods
Add ->tf_{load,read} methods so scc_ide_{outb,outw,inb,inw}() can be used directly. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/scc_pata.c')
-rw-r--r--drivers/ide/pci/scc_pata.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index d11df45a2ae8..cb635a66030e 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -618,6 +618,90 @@ static int __devinit init_setup_scc(struct pci_dev *dev,
618 return rc; 618 return rc;
619} 619}
620 620
621static void scc_tf_load(ide_drive_t *drive, ide_task_t *task)
622{
623 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
624 struct ide_taskfile *tf = &task->tf;
625 u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
626
627 if (task->tf_flags & IDE_TFLAG_FLAGGED)
628 HIHI = 0xFF;
629
630 ide_set_irq(drive, 1);
631
632 if (task->tf_flags & IDE_TFLAG_OUT_DATA)
633 scc_ide_outw((tf->hob_data << 8) | tf->data,
634 io_ports->data_addr);
635
636 if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
637 scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
638 if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
639 scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr);
640 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
641 scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr);
642 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
643 scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr);
644 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
645 scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr);
646
647 if (task->tf_flags & IDE_TFLAG_OUT_FEATURE)
648 scc_ide_outb(tf->feature, io_ports->feature_addr);
649 if (task->tf_flags & IDE_TFLAG_OUT_NSECT)
650 scc_ide_outb(tf->nsect, io_ports->nsect_addr);
651 if (task->tf_flags & IDE_TFLAG_OUT_LBAL)
652 scc_ide_outb(tf->lbal, io_ports->lbal_addr);
653 if (task->tf_flags & IDE_TFLAG_OUT_LBAM)
654 scc_ide_outb(tf->lbam, io_ports->lbam_addr);
655 if (task->tf_flags & IDE_TFLAG_OUT_LBAH)
656 scc_ide_outb(tf->lbah, io_ports->lbah_addr);
657
658 if (task->tf_flags & IDE_TFLAG_OUT_DEVICE)
659 scc_ide_outb((tf->device & HIHI) | drive->select.all,
660 io_ports->device_addr);
661}
662
663static void scc_tf_read(ide_drive_t *drive, ide_task_t *task)
664{
665 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
666 struct ide_taskfile *tf = &task->tf;
667
668 if (task->tf_flags & IDE_TFLAG_IN_DATA) {
669 u16 data = scc_ide_inw(io_ports->data_addr);
670
671 tf->data = data & 0xff;
672 tf->hob_data = (data >> 8) & 0xff;
673 }
674
675 /* be sure we're looking at the low order bits */
676 scc_ide_outb(drive->ctl & ~0x80, io_ports->ctl_addr);
677
678 if (task->tf_flags & IDE_TFLAG_IN_NSECT)
679 tf->nsect = scc_ide_inb(io_ports->nsect_addr);
680 if (task->tf_flags & IDE_TFLAG_IN_LBAL)
681 tf->lbal = scc_ide_inb(io_ports->lbal_addr);
682 if (task->tf_flags & IDE_TFLAG_IN_LBAM)
683 tf->lbam = scc_ide_inb(io_ports->lbam_addr);
684 if (task->tf_flags & IDE_TFLAG_IN_LBAH)
685 tf->lbah = scc_ide_inb(io_ports->lbah_addr);
686 if (task->tf_flags & IDE_TFLAG_IN_DEVICE)
687 tf->device = scc_ide_inb(io_ports->device_addr);
688
689 if (task->tf_flags & IDE_TFLAG_LBA48) {
690 scc_ide_outb(drive->ctl | 0x80, io_ports->ctl_addr);
691
692 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
693 tf->hob_feature = scc_ide_inb(io_ports->feature_addr);
694 if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
695 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr);
696 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
697 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr);
698 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
699 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr);
700 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
701 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr);
702 }
703}
704
621static void scc_input_data(ide_drive_t *drive, struct request *rq, 705static void scc_input_data(ide_drive_t *drive, struct request *rq,
622 void *buf, unsigned int len) 706 void *buf, unsigned int len)
623{ 707{
@@ -664,6 +748,9 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
664 748
665 ide_set_hwifdata(hwif, ports); 749 ide_set_hwifdata(hwif, ports);
666 750
751 hwif->tf_load = scc_tf_load;
752 hwif->tf_read = scc_tf_read;
753
667 hwif->input_data = scc_input_data; 754 hwif->input_data = scc_input_data;
668 hwif->output_data = scc_output_data; 755 hwif->output_data = scc_output_data;
669 756