diff options
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r-- | drivers/ide/ide-dma.c | 66 |
1 files changed, 15 insertions, 51 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 0d795a1678c7..4703837bf1fc 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -611,12 +611,6 @@ static int __ide_dma_test_irq(ide_drive_t *drive) | |||
611 | ide_hwif_t *hwif = HWIF(drive); | 611 | ide_hwif_t *hwif = HWIF(drive); |
612 | u8 dma_stat = hwif->INB(hwif->dma_status); | 612 | u8 dma_stat = hwif->INB(hwif->dma_status); |
613 | 613 | ||
614 | #if 0 /* do not set unless you know what you are doing */ | ||
615 | if (dma_stat & 4) { | ||
616 | u8 stat = hwif->INB(IDE_STATUS_REG); | ||
617 | hwif->OUTB(hwif->dma_status, dma_stat & 0xE4); | ||
618 | } | ||
619 | #endif | ||
620 | /* return 1 if INTR asserted */ | 614 | /* return 1 if INTR asserted */ |
621 | if ((dma_stat & 4) == 4) | 615 | if ((dma_stat & 4) == 4) |
622 | return 1; | 616 | return 1; |
@@ -753,10 +747,12 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode) | |||
753 | mode = XFER_MW_DMA_1; | 747 | mode = XFER_MW_DMA_1; |
754 | } | 748 | } |
755 | 749 | ||
756 | printk(KERN_DEBUG "%s: %s mode selected\n", drive->name, | 750 | mode = min(mode, req_mode); |
751 | |||
752 | printk(KERN_INFO "%s: %s mode selected\n", drive->name, | ||
757 | mode ? ide_xfer_verbose(mode) : "no DMA"); | 753 | mode ? ide_xfer_verbose(mode) : "no DMA"); |
758 | 754 | ||
759 | return min(mode, req_mode); | 755 | return mode; |
760 | } | 756 | } |
761 | 757 | ||
762 | EXPORT_SYMBOL_GPL(ide_find_dma_mode); | 758 | EXPORT_SYMBOL_GPL(ide_find_dma_mode); |
@@ -772,6 +768,9 @@ static int ide_tune_dma(ide_drive_t *drive) | |||
772 | if (__ide_dma_bad_drive(drive)) | 768 | if (__ide_dma_bad_drive(drive)) |
773 | return 0; | 769 | return 0; |
774 | 770 | ||
771 | if (ide_id_dma_bug(drive)) | ||
772 | return 0; | ||
773 | |||
775 | if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) | 774 | if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) |
776 | return config_drive_for_dma(drive); | 775 | return config_drive_for_dma(drive); |
777 | 776 | ||
@@ -806,58 +805,23 @@ static int ide_dma_check(ide_drive_t *drive) | |||
806 | return vdma ? 0 : -1; | 805 | return vdma ? 0 : -1; |
807 | } | 806 | } |
808 | 807 | ||
809 | void ide_dma_verbose(ide_drive_t *drive) | 808 | int ide_id_dma_bug(ide_drive_t *drive) |
810 | { | 809 | { |
811 | struct hd_driveid *id = drive->id; | 810 | struct hd_driveid *id = drive->id; |
812 | ide_hwif_t *hwif = HWIF(drive); | ||
813 | 811 | ||
814 | if (id->field_valid & 4) { | 812 | if (id->field_valid & 4) { |
815 | if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) | 813 | if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) |
816 | goto bug_dma_off; | 814 | goto err_out; |
817 | if (id->dma_ultra & ((id->dma_ultra >> 8) & hwif->ultra_mask)) { | ||
818 | if (((id->dma_ultra >> 11) & 0x1F) && | ||
819 | eighty_ninty_three(drive)) { | ||
820 | if ((id->dma_ultra >> 15) & 1) { | ||
821 | printk(", UDMA(mode 7)"); | ||
822 | } else if ((id->dma_ultra >> 14) & 1) { | ||
823 | printk(", UDMA(133)"); | ||
824 | } else if ((id->dma_ultra >> 13) & 1) { | ||
825 | printk(", UDMA(100)"); | ||
826 | } else if ((id->dma_ultra >> 12) & 1) { | ||
827 | printk(", UDMA(66)"); | ||
828 | } else if ((id->dma_ultra >> 11) & 1) { | ||
829 | printk(", UDMA(44)"); | ||
830 | } else | ||
831 | goto mode_two; | ||
832 | } else { | ||
833 | mode_two: | ||
834 | if ((id->dma_ultra >> 10) & 1) { | ||
835 | printk(", UDMA(33)"); | ||
836 | } else if ((id->dma_ultra >> 9) & 1) { | ||
837 | printk(", UDMA(25)"); | ||
838 | } else if ((id->dma_ultra >> 8) & 1) { | ||
839 | printk(", UDMA(16)"); | ||
840 | } | ||
841 | } | ||
842 | } else { | ||
843 | printk(", (U)DMA"); /* Can be BIOS-enabled! */ | ||
844 | } | ||
845 | } else if (id->field_valid & 2) { | 815 | } else if (id->field_valid & 2) { |
846 | if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) | 816 | if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) |
847 | goto bug_dma_off; | 817 | goto err_out; |
848 | printk(", DMA"); | ||
849 | } else if (id->field_valid & 1) { | ||
850 | goto bug_dma_off; | ||
851 | } | 818 | } |
852 | return; | 819 | return 0; |
853 | bug_dma_off: | 820 | err_out: |
854 | printk(", BUG DMA OFF"); | 821 | printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name); |
855 | hwif->dma_off_quietly(drive); | 822 | return 1; |
856 | return; | ||
857 | } | 823 | } |
858 | 824 | ||
859 | EXPORT_SYMBOL(ide_dma_verbose); | ||
860 | |||
861 | int ide_set_dma(ide_drive_t *drive) | 825 | int ide_set_dma(ide_drive_t *drive) |
862 | { | 826 | { |
863 | ide_hwif_t *hwif = drive->hwif; | 827 | ide_hwif_t *hwif = drive->hwif; |