Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkiewicz@elka.pw.edu.pl>2003-10-16 20:49:11 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-10-16 20:49:11 -0700
commit2ede979b02038072f3dd488652352f0ef4284be9 (patch)
tree5916d80e0d6d30e44c85bff661dad6b2a9914a7a
parent6d4289d1b43efc7c54289c142815008677377acb (diff)
[PATCH] fix ServerWorks PIO auto-tuning
If PIO mode should be auto-tuned xferspeed argument for svwks_tune_chipset() is equal to 255 (0xFF). It is then passed to ide_rate_filter() which matches desired mode with chipset capabilities. Since 255 is greater than any of the values used for transfer modes, ide_rate_filter() will always return the highest mode supported by both device/chipset (which sometimes should not be used ie. when host is a simplex one) and the wrong mode will be set. Thanks to Torben Mathiasen and Tomas Szepe for testing it.
-rw-r--r--drivers/ide/pci/serverworks.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/ide/pci/serverworks.c b/drivers/ide/pci/serverworks.c
index 66b8d9b4f5fb..b5afd8c142e6 100644
--- a/drivers/ide/pci/serverworks.c
+++ b/drivers/ide/pci/serverworks.c
@@ -272,7 +272,7 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
ide_hwif_t *hwif = HWIF(drive);
struct pci_dev *dev = hwif->pci_dev;
- u8 speed = ide_rate_filter(svwks_ratemask(drive), xferspeed);
+ u8 speed;
u8 pio = ide_get_best_pio_mode(drive, 255, 5, NULL);
u8 unit = (drive->select.b.unit & 0x01);
u8 csb5 = svwks_csb_check(dev);
@@ -280,6 +280,11 @@ static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed)
u8 dma_timing = 0, pio_timing = 0;
u16 csb5_pio = 0;
+ if (xferspeed == 255) /* PIO auto-tuning */
+ speed = XFER_PIO_0 + pio;
+ else
+ speed = ide_rate_filter(svwks_ratemask(drive), xferspeed);
+
/* If we are about to put a disk into UDMA mode we screwed up.
Our code assumes we never _ever_ do this on an OSB4 */