aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/scc_pata.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/scc_pata.c')
-rw-r--r--drivers/ide/scc_pata.c71
1 files changed, 16 insertions, 55 deletions
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 6d8dbd9c10bc..5be41f25204f 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -337,7 +337,6 @@ static void scc_dma_start(ide_drive_t *drive)
337 337
338 /* start DMA */ 338 /* start DMA */
339 scc_ide_outb(dma_cmd | 1, hwif->dma_base); 339 scc_ide_outb(dma_cmd | 1, hwif->dma_base);
340 wmb();
341} 340}
342 341
343static int __scc_dma_end(ide_drive_t *drive) 342static int __scc_dma_end(ide_drive_t *drive)
@@ -354,7 +353,6 @@ static int __scc_dma_end(ide_drive_t *drive)
354 /* clear the INTR & ERROR bits */ 353 /* clear the INTR & ERROR bits */
355 scc_ide_outb(dma_stat | 6, hwif->dma_base + 4); 354 scc_ide_outb(dma_stat | 6, hwif->dma_base + 4);
356 /* verify good DMA status */ 355 /* verify good DMA status */
357 wmb();
358 return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0; 356 return (dma_stat & 7) != 4 ? (0x10 | dma_stat) : 0;
359} 357}
360 358
@@ -647,77 +645,40 @@ static int __devinit init_setup_scc(struct pci_dev *dev,
647 return rc; 645 return rc;
648} 646}
649 647
650static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd) 648static void scc_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid)
651{ 649{
652 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 650 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
653 struct ide_taskfile *tf = &cmd->tf; 651
654 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 652 if (valid & IDE_VALID_FEATURE)
655
656 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
657 HIHI = 0xFF;
658
659 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
660 scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
661 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
662 scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr);
663 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
664 scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr);
665 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
666 scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr);
667 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
668 scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr);
669
670 if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE)
671 scc_ide_outb(tf->feature, io_ports->feature_addr); 653 scc_ide_outb(tf->feature, io_ports->feature_addr);
672 if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) 654 if (valid & IDE_VALID_NSECT)
673 scc_ide_outb(tf->nsect, io_ports->nsect_addr); 655 scc_ide_outb(tf->nsect, io_ports->nsect_addr);
674 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) 656 if (valid & IDE_VALID_LBAL)
675 scc_ide_outb(tf->lbal, io_ports->lbal_addr); 657 scc_ide_outb(tf->lbal, io_ports->lbal_addr);
676 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) 658 if (valid & IDE_VALID_LBAM)
677 scc_ide_outb(tf->lbam, io_ports->lbam_addr); 659 scc_ide_outb(tf->lbam, io_ports->lbam_addr);
678 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) 660 if (valid & IDE_VALID_LBAH)
679 scc_ide_outb(tf->lbah, io_ports->lbah_addr); 661 scc_ide_outb(tf->lbah, io_ports->lbah_addr);
680 662 if (valid & IDE_VALID_DEVICE)
681 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) 663 scc_ide_outb(tf->device, io_ports->device_addr);
682 scc_ide_outb((tf->device & HIHI) | drive->select,
683 io_ports->device_addr);
684} 664}
685 665
686static 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)
687{ 667{
688 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 668 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
689 struct ide_taskfile *tf = &cmd->tf;
690
691 /* be sure we're looking at the low order bits */
692 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
693 669
694 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) 670 if (valid & IDE_VALID_ERROR)
695 tf->error = scc_ide_inb(io_ports->feature_addr); 671 tf->error = scc_ide_inb(io_ports->feature_addr);
696 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) 672 if (valid & IDE_VALID_NSECT)
697 tf->nsect = scc_ide_inb(io_ports->nsect_addr); 673 tf->nsect = scc_ide_inb(io_ports->nsect_addr);
698 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) 674 if (valid & IDE_VALID_LBAL)
699 tf->lbal = scc_ide_inb(io_ports->lbal_addr); 675 tf->lbal = scc_ide_inb(io_ports->lbal_addr);
700 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) 676 if (valid & IDE_VALID_LBAM)
701 tf->lbam = scc_ide_inb(io_ports->lbam_addr); 677 tf->lbam = scc_ide_inb(io_ports->lbam_addr);
702 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) 678 if (valid & IDE_VALID_LBAH)
703 tf->lbah = scc_ide_inb(io_ports->lbah_addr); 679 tf->lbah = scc_ide_inb(io_ports->lbah_addr);
704 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) 680 if (valid & IDE_VALID_DEVICE)
705 tf->device = scc_ide_inb(io_ports->device_addr); 681 tf->device = scc_ide_inb(io_ports->device_addr);
706
707 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
708 scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
709
710 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR)
711 tf->hob_error = scc_ide_inb(io_ports->feature_addr);
712 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
713 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr);
714 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
715 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr);
716 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
717 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr);
718 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
719 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr);
720 }
721} 682}
722 683
723static 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,