aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-dma.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-12-12 17:31:58 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2007-12-12 17:31:58 -0500
commit3ab7efe8e2cbcca2d401b43cfcc2fa9a7dac2299 (patch)
tree7ddbb4d5fdae6f61d23ef0ba2a43aaca23bd2195 /drivers/ide/ide-dma.c
parente11b9035a47da66fcd4bafd3a5f6b14f51ca667e (diff)
ide: DMA reporting and validity checking fixes (take 3)
* ide_xfer_verbose() fixups: - beautify returned mode names - fix PIO5 reporting - make it return 'const char *' * Change printk() level from KERN_DEBUG to KERN_INFO in ide_find_dma_mode(). * Add ide_id_dma_bug() helper based on ide_dma_verbose() to check for invalid DMA info in identify block. * Use ide_id_dma_bug() in ide_tune_dma() and ide_driveid_update(). As a result DMA won't be tuned or will be disabled after tuning if device reports inconsistent info about enabled DMA mode (ide_dma_verbose() does the same checks while the IDE device is probed by ide-{cd,disk} device driver). * Remove no longer needed ide_dma_verbose(). This patch should fix the following problem with out-of-sync IDE messages reported by Nick Warne: hdd: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache<7>hdd: skipping word 93 validity check , UDMA(66) and later debugged by Mark Lord to be caused by: ide_dma_verbose() printk( ... "2048kB Cache"); eighty_ninty_three() printk(KERN_DEBUG "%s: skipping word 93 validity check\n"); ide_dma_verbose() printk(", UDMA(66)" Please note that as a result ide-{cd,disk} device drivers won't report the DMA speed used but this is intended since now DMA mode being used is always reported by IDE core code. v2: * fixes suggested by Randy: - use KERN_CONT for printk()-s in ide-{cd,disk}.c - don't remove argument name from ide_xfer_verbose() declaration v3: * Remove incorrect check for (id->field_valid & 1) from ide_id_dma_bug() (spotted by Sergei). * "XFER SLOW" -> "PIO SLOW" in ide_xfer_verbose() (suggested by Sergei). * Fix ide_find_dma_mode() to report the correct mode ('mode' after being limited by 'req_mode'). Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Cc: Nick Warne <nick@ukfsn.org> Cc: Mark Lord <lkml@rtr.ca> Cc: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r--drivers/ide/ide-dma.c60
1 files changed, 15 insertions, 45 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 0d795a1678c7..6879aaae544d 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -753,10 +753,12 @@ u8 ide_find_dma_mode(ide_drive_t *drive, u8 req_mode)
753 mode = XFER_MW_DMA_1; 753 mode = XFER_MW_DMA_1;
754 } 754 }
755 755
756 printk(KERN_DEBUG "%s: %s mode selected\n", drive->name, 756 mode = min(mode, req_mode);
757
758 printk(KERN_INFO "%s: %s mode selected\n", drive->name,
757 mode ? ide_xfer_verbose(mode) : "no DMA"); 759 mode ? ide_xfer_verbose(mode) : "no DMA");
758 760
759 return min(mode, req_mode); 761 return mode;
760} 762}
761 763
762EXPORT_SYMBOL_GPL(ide_find_dma_mode); 764EXPORT_SYMBOL_GPL(ide_find_dma_mode);
@@ -772,6 +774,9 @@ static int ide_tune_dma(ide_drive_t *drive)
772 if (__ide_dma_bad_drive(drive)) 774 if (__ide_dma_bad_drive(drive))
773 return 0; 775 return 0;
774 776
777 if (ide_id_dma_bug(drive))
778 return 0;
779
775 if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA) 780 if (drive->hwif->host_flags & IDE_HFLAG_TRUST_BIOS_FOR_DMA)
776 return config_drive_for_dma(drive); 781 return config_drive_for_dma(drive);
777 782
@@ -806,58 +811,23 @@ static int ide_dma_check(ide_drive_t *drive)
806 return vdma ? 0 : -1; 811 return vdma ? 0 : -1;
807} 812}
808 813
809void ide_dma_verbose(ide_drive_t *drive) 814int ide_id_dma_bug(ide_drive_t *drive)
810{ 815{
811 struct hd_driveid *id = drive->id; 816 struct hd_driveid *id = drive->id;
812 ide_hwif_t *hwif = HWIF(drive);
813 817
814 if (id->field_valid & 4) { 818 if (id->field_valid & 4) {
815 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8)) 819 if ((id->dma_ultra >> 8) && (id->dma_mword >> 8))
816 goto bug_dma_off; 820 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) { 821 } else if (id->field_valid & 2) {
846 if ((id->dma_mword >> 8) && (id->dma_1word >> 8)) 822 if ((id->dma_mword >> 8) && (id->dma_1word >> 8))
847 goto bug_dma_off; 823 goto err_out;
848 printk(", DMA");
849 } else if (id->field_valid & 1) {
850 goto bug_dma_off;
851 } 824 }
852 return; 825 return 0;
853bug_dma_off: 826err_out:
854 printk(", BUG DMA OFF"); 827 printk(KERN_ERR "%s: bad DMA info in identify block\n", drive->name);
855 hwif->dma_off_quietly(drive); 828 return 1;
856 return;
857} 829}
858 830
859EXPORT_SYMBOL(ide_dma_verbose);
860
861int ide_set_dma(ide_drive_t *drive) 831int ide_set_dma(ide_drive_t *drive)
862{ 832{
863 ide_hwif_t *hwif = drive->hwif; 833 ide_hwif_t *hwif = drive->hwif;