]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
atiixp/jmicron/triflex: fix PIO fallback
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 17 Feb 2007 01:40:20 +0000 (02:40 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 17 Feb 2007 01:40:20 +0000 (02:40 +0100)
* atiixp: if DMA can't be used atiixp_config_drive_for_dma() should return 0,
  atiixp_dma_check() will tune the correct PIO mode anyway

* jmicron: if DMA can't be used config_chipset_for_dma() should return 0,
  micron_config_drive_for_dma() will tune the correct PIO mode anyway

  config_jmicron_chipset_for_pio(drive, !speed) doesn't program
  device transfer mode for speed != 0 (only wastes some CPU cycles
  on ide_get_best_pio_mode() call) so remove it

* triflex: if DMA can't be used triflex_config_drive_for_dma() should return 0,
  triflex_config_drive_xfer_rate() will tune correct PIO mode anyway

Above changes also fix (theoretical) issue when ->speedproc fails to set
device transfer mode (i.e. when ide_config_drive_speed() fails to program it)
but one of DMA transfer modes is already enabled on the device by the BIOS.
In such scenario ide_dma_enable() will incorrectly return true statement
and ->ide_dma_check will try to enable DMA on the device.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/pci/atiixp.c
drivers/ide/pci/jmicron.c
drivers/ide/pci/triflex.c

index 982ac31fa9954bc09c30ede6e40a9e7f35dd1541..922b315da4a03ffc39b7543a6dc4e075388ea3bd 100644 (file)
@@ -235,11 +235,8 @@ static int atiixp_config_drive_for_dma(ide_drive_t *drive)
 {
        u8 speed = ide_dma_speed(drive, atiixp_ratemask(drive));
 
-       /* If no DMA speed was available then disable DMA and use PIO. */
-       if (!speed) {
-               u8 tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
-               speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0;
-       }
+       if (!speed)
+               return 0;
 
        (void) atiixp_speedproc(drive, speed);
        return ide_dma_enable(drive);
index f07bbbed17783322627df81caeadabb49fe8d448..75c2b409908c4e64b8ccfeffb573cbeceaf457c1 100644 (file)
@@ -147,7 +147,9 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 {
        u8 speed        = ide_dma_speed(drive, jmicron_ratemask(drive));
 
-       config_jmicron_chipset_for_pio(drive, !speed);
+       if (!speed)
+               return 0;
+
        jmicron_tune_chipset(drive, speed);
        return ide_dma_enable(drive);
 }
index b13cce1fd1a6aa7e973b5e7d621d2af33a6984c1..b0d29cd7123aa3a8329e5a9c58b532b82eef22c6 100644 (file)
@@ -104,11 +104,9 @@ static int triflex_config_drive_for_dma(ide_drive_t *drive)
 {
        int speed = ide_dma_speed(drive, 0); /* No ultra speeds */
 
-       if (!speed) { 
-               u8 pspeed = ide_get_best_pio_mode(drive, 255, 4, NULL);
-               speed = XFER_PIO_0 + pspeed;
-       }
-       
+       if (!speed)
+               return 0;
+
        (void) triflex_tune_chipset(drive, speed);
         return ide_dma_enable(drive);
 }