]> err.no Git - linux-2.6/commitdiff
ide: add ide_set_dma() helper (v2)
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 17 Feb 2007 01:40:26 +0000 (02:40 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sat, 17 Feb 2007 01:40:26 +0000 (02:40 +0100)
* add ide_set_dma() helper and make ide_hwif_t.ide_dma_check return
  -1 when DMA needs to be disabled (== need to call ->ide_dma_off_quietly)
   0 when DMA needs to be enabled  (== need to call ->ide_dma_on)
   1 when DMA setting shouldn't be changed
* fix IDE code to use ide_set_dma() instead if using ->ide_dma_check directly

v2:
* updated for scc_pata

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
36 files changed:
drivers/ide/arm/icside.c
drivers/ide/cris/ide-cris.c
drivers/ide/ide-dma.c
drivers/ide/ide-io.c
drivers/ide/ide-probe.c
drivers/ide/ide.c
drivers/ide/mips/au1xxx-ide.c
drivers/ide/pci/aec62xx.c
drivers/ide/pci/alim15x3.c
drivers/ide/pci/amd74xx.c
drivers/ide/pci/atiixp.c
drivers/ide/pci/cmd64x.c
drivers/ide/pci/cs5520.c
drivers/ide/pci/cs5530.c
drivers/ide/pci/cs5535.c
drivers/ide/pci/hpt34x.c
drivers/ide/pci/hpt366.c
drivers/ide/pci/it8213.c
drivers/ide/pci/it821x.c
drivers/ide/pci/jmicron.c
drivers/ide/pci/ns87415.c
drivers/ide/pci/pdc202xx_new.c
drivers/ide/pci/pdc202xx_old.c
drivers/ide/pci/piix.c
drivers/ide/pci/sc1200.c
drivers/ide/pci/serverworks.c
drivers/ide/pci/sgiioc4.c
drivers/ide/pci/siimage.c
drivers/ide/pci/sis5513.c
drivers/ide/pci/sl82c105.c
drivers/ide/pci/slc90e66.c
drivers/ide/pci/tc86c001.c
drivers/ide/pci/triflex.c
drivers/ide/pci/via82cxxx.c
drivers/ide/ppc/scc_pata.c
include/linux/ide.h

index 61ce40d52f5f0c6969611b9b6c196b1c55358527..aeed0205ce6490759a46da781ec22569d4e77c8c 100644 (file)
@@ -365,10 +365,7 @@ static int icside_dma_check(ide_drive_t *drive)
 out:
        on = icside_set_speed(drive, xfer_mode);
 
-       if (on)
-               return icside_dma_on(drive);
-       else
-               return icside_dma_off_quietly(drive);
+       return on ? 0 : -1;
 }
 
 static int icside_dma_end(ide_drive_t *drive)
index 24281176b4dcec4d37d776944a6bf93a215c7ce7..027341d66b28efcbb6e62caa800f73b697a0de1b 100644 (file)
@@ -1048,12 +1048,10 @@ static ide_startstop_t cris_dma_intr (ide_drive_t *drive)
 
 static int cris_dma_check(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif = drive->hwif;
-
        if (ide_use_dma(drive) && cris_config_drive_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static int cris_dma_end(ide_drive_t *drive)
index 1a288e5307d396c3de6e8646d8e9269a080b2f14..4fbcea4c10256db9061dfee75c488cde8bdaedc7 100644 (file)
@@ -348,15 +348,14 @@ EXPORT_SYMBOL_GPL(ide_destroy_dmatable);
 static int config_drive_for_dma (ide_drive_t *drive)
 {
        struct hd_driveid *id = drive->id;
-       ide_hwif_t *hwif = HWIF(drive);
 
-       if ((id->capability & 1) && hwif->autodma) {
+       if ((id->capability & 1) && drive->hwif->autodma) {
                /*
                 * Enable DMA on any drive that has
                 * UltraDMA (mode 0/1/2/3/4/5/6) enabled
                 */
                if ((id->field_valid & 4) && ((id->dma_ultra >> 8) & 0x7f))
-                       return hwif->ide_dma_on(drive);
+                       return 0;
                /*
                 * Enable DMA on any drive that has mode2 DMA
                 * (multi or single) enabled
@@ -364,14 +363,14 @@ static int config_drive_for_dma (ide_drive_t *drive)
                if (id->field_valid & 2)        /* regular DMA */
                        if ((id->dma_mword & 0x404) == 0x404 ||
                            (id->dma_1word & 0x404) == 0x404)
-                               return hwif->ide_dma_on(drive);
+                               return 0;
 
                /* Consult the list of known "good" drives */
                if (__ide_dma_good_drive(drive))
-                       return hwif->ide_dma_on(drive);
+                       return 0;
        }
-//     if (hwif->tuneproc != NULL) hwif->tuneproc(drive, 255);
-       return hwif->ide_dma_off_quietly(drive);
+
+       return -1;
 }
 
 /**
@@ -765,6 +764,30 @@ bug_dma_off:
 
 EXPORT_SYMBOL(ide_dma_verbose);
 
+int ide_set_dma(ide_drive_t *drive)
+{
+       ide_hwif_t *hwif = drive->hwif;
+       int rc;
+
+       rc = hwif->ide_dma_check(drive);
+
+       switch(rc) {
+       case -1: /* DMA needs to be disabled */
+               return hwif->ide_dma_off_quietly(drive);
+       case  0: /* DMA needs to be enabled */
+               return hwif->ide_dma_on(drive);
+       case  1: /* DMA setting cannot be changed */
+               break;
+       default:
+               BUG();
+               break;
+       }
+
+       return rc;
+}
+
+EXPORT_SYMBOL_GPL(ide_set_dma);
+
 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
 int __ide_dma_lostirq (ide_drive_t *drive)
 {
index 99d1c43f433eed5e1ae9aadd765e27aff57136ea..9f45a84588d9cc197c05903ba5d7b31c8fc8a53a 100644 (file)
@@ -226,7 +226,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
                        break;
                if (drive->hwif->ide_dma_check == NULL)
                        break;
-               drive->hwif->ide_dma_check(drive);
+               ide_set_dma(drive);
                break;
        }
        pm->pm_step = ide_pm_state_completed;
index 176bbc850d6ba8731bd5e8b89de627c5209208c2..72218f3e440f945b9ceaf0789199a4c4268a187f 100644 (file)
@@ -857,7 +857,7 @@ static void probe_hwif(ide_hwif_t *hwif)
 #ifdef CONFIG_IDEDMA_ONLYDISK
                                if (drive->media == ide_disk)
 #endif
-                                       hwif->ide_dma_check(drive);
+                                       ide_set_dma(drive);
                        }
                }
        }
index fbc6d39ace68e0c8310e86b9d67368d19dbbc598..5585c01a9b7f49a4c0bfe8b935cce7efb520d78d 100644 (file)
@@ -1135,7 +1135,8 @@ static int set_using_dma (ide_drive_t *drive, int arg)
        if (HWIF(drive)->ide_dma_check == NULL)
                return -EPERM;
        if (arg) {
-               if (HWIF(drive)->ide_dma_check(drive)) return -EIO;
+               if (ide_set_dma(drive))
+                       return -EIO;
                if (HWIF(drive)->ide_dma_on(drive)) return -EIO;
        } else {
                if (__ide_dma_off(drive))
index b431b990426d04bd4a5900520e6b48585659341e..8a723c81c4b8c077388471cceb80623d6782818d 100644 (file)
@@ -414,9 +414,9 @@ static int auide_dma_check(ide_drive_t *drive)
        speed = ide_find_best_mode(drive, XFER_PIO | XFER_MWDMA);
        
        if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
-               return HWIF(drive)->ide_dma_on(drive);
+               return 0;
 
-       return HWIF(drive)->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static int auide_dma_test_irq(ide_drive_t *drive)
index 25892814b314c278e984ca630809eb1d94705313..990eafe5ea1171e599efe0908fb3d0ea22ea0131 100644 (file)
@@ -209,15 +209,13 @@ static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio)
 
 static int aec62xx_config_drive_xfer_rate (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                aec62xx_tune_drive(drive, 5);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static int aec62xx_irq_timeout (ide_drive_t *drive)
index 2baed4e04beb677ce54e61d0bc66fd92f6d2e60a..4debd18d52f83da057dc1e73922d196a442ce2d5 100644 (file)
@@ -507,17 +507,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
  *
  *     Configure a drive for DMA operation. If DMA is not possible we
  *     drop the drive into PIO mode instead.
- *
- *     FIXME: exactly what are we trying to return here
  */
+
 static int ali15x3_config_drive_for_dma(ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct hd_driveid *id   = drive->id;
 
        if ((m5229_revision<=0x20) && (drive->media!=ide_disk))
-               return hwif->ide_dma_off_quietly(drive);
+               goto no_dma_set;
 
        drive->init_speed = 0;
 
@@ -552,9 +550,10 @@ try_dma_modes:
 ata_pio:
                hwif->tuneproc(drive, 255);
 no_dma_set:
-               return hwif->ide_dma_off_quietly(drive);
+               return -1;
        }
-       return hwif->ide_dma_on(drive);
+
+       return 0;
 }
 
 /**
index a4336995a4108675d4a2f73a9af6dcde1838be04..7989bdd842a2312ae0ca21640c1bbfcf029338fb 100644 (file)
@@ -304,8 +304,9 @@ static int amd74xx_ide_dma_check(ide_drive_t *drive)
        amd_set_drive(drive, speed);
 
        if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
-               return HWIF(drive)->ide_dma_on(drive);
-       return HWIF(drive)->ide_dma_off_quietly(drive);
+               return 0;
+
+       return -1;
 }
 
 /*
index 6d372c4e1d815ecaa00dedef3a51aa6e54020a80..e7b4415adc83b3044722b28636d6217f1bcdc987 100644 (file)
@@ -252,21 +252,20 @@ static int atiixp_config_drive_for_dma(ide_drive_t *drive)
 
 static int atiixp_dma_check(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
        u8 tspeed, speed;
 
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && atiixp_config_drive_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive)) {
                tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL);
                speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0;
-               hwif->speedproc(drive, speed);
+               atiixp_speedproc(drive, speed);
        }
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /**
index 28f58088669338dcb1c8df9205484f09e3fccb65..49df27513da7add4275f42bd71a33bdbdd3bc84f 100644 (file)
@@ -474,15 +474,13 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int cmd64x_config_drive_for_dma (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                config_chipset_for_pio(drive, 1);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static int cmd64x_alt_dma_status (struct pci_dev *dev)
index ba6786aabf3baaf937c351fe55884537d6e31d5a..400859a839f7dcd9b1fb4c25b1796a98e87a12cb 100644 (file)
@@ -132,12 +132,11 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio)
 
 static int cs5520_config_drive_xfer_rate(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif = HWIF(drive);
-
        /* Tune the drive for PIO modes up to PIO 4 */  
        cs5520_tune_drive(drive, 4);
+
        /* Then tell the core to use DMA operations */
-       return hwif->ide_dma_on(drive);
+       return 0;
 }
 
 /*
index 68b5d278ca0196e8d34754fa659527634312a66a..ff909cfb96b64037c43af97e8cbacf16a4897b18 100644 (file)
@@ -196,10 +196,7 @@ static int cs5530_config_dma (ide_drive_t *drive)
                outl(timings, basereg + 12);    /* write drive1 config register */
        }
 
-       /*
-        * Finally, turn DMA on in software, and exit.
-        */
-       return hwif->ide_dma_on(drive); /* success */
+       return 0;       /* success */
 }
 
 /**
index cd7c4190ad6e375c571a2007a269f0e6f891c61b..45f43efbf92c856b4aaabf967cbab9ee87d33c9f 100644 (file)
@@ -195,20 +195,19 @@ static int cs5535_config_drive_for_dma(ide_drive_t *drive)
 
 static int cs5535_dma_check(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = drive->hwif;
        u8 speed;
 
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && cs5535_config_drive_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive)) {
                speed = ide_get_best_pio_mode(drive, 255, 4, NULL);
                cs5535_set_drive(drive, speed);
        }
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
index c65971d8d6adc3e50df095f7eb078d9c59e0ef3e..924eaa3a5708890e592dce1d7d130b769c37f25b 100644 (file)
@@ -109,21 +109,19 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int hpt34x_config_drive_xfer_rate (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
 #ifndef CONFIG_HPT34X_AUTODMA
-               return hwif->ide_dma_off_quietly(drive);
+               return -1;
 #else
-               return hwif->ide_dma_on(drive);
+               return 0;
 #endif
 
        if (ide_use_fast_pio(drive))
                hpt34x_tune_drive(drive, 255);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /*
index 752b6d6dde040adb7322e0dad59fb62b2bd2f213..60ecdc258c7cbc1272edff2082c0e97c17ba98d4 100644 (file)
@@ -736,17 +736,15 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
 
 static int hpt366_config_drive_xfer_rate(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                hpt3xx_tune_drive(drive, 255);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /*
index 63248b6909faf0ce5cc2471da359441740fd5b12..424f00bb160d6210047805002b101ca7ba3bac21 100644 (file)
@@ -244,17 +244,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int it8213_config_drive_for_dma (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif = drive->hwif;
+       u8 pio;
 
-       if (ide_use_dma(drive)) {
-               if (config_chipset_for_dma(drive))
-                       return hwif->ide_dma_on(drive);
-       }
+       if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+               return 0;
 
-       hwif->speedproc(drive, XFER_PIO_0
-                       + ide_get_best_pio_mode(drive, 255, 4, NULL));
+       pio = ide_get_best_pio_mode(drive, 255, 4, NULL);
+       it8213_tune_chipset(drive, XFER_PIO_0 + pio);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /**
index e9bad185968a8e289cd28f2844ac2578b6727373..35ee17df3f8df13ea92f1adb96c351bfb05c47ad 100644 (file)
@@ -520,14 +520,12 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int it821x_config_drive_for_dma (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = drive->hwif;
+       if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+               return 0;
 
-       if (ide_use_dma(drive)) {
-               if (config_chipset_for_dma(drive))
-                       return hwif->ide_dma_on(drive);
-       }
        config_it821x_chipset_for_pio(drive, 1);
-       return hwif->ide_dma_off_quietly(drive);
+
+       return -1;
 }
 
 /**
@@ -612,7 +610,7 @@ static void __devinit it821x_fixups(ide_hwif_t *hwif)
 #ifdef CONFIG_IDEDMA_ONLYDISK
                        if (drive->media == ide_disk)
 #endif
-                               hwif->ide_dma_check(drive);
+                               ide_set_dma(drive);
                } else {
                        /* Non RAID volume. Fixups to stop the core code
                           doing unsupported things */
index 75c2b409908c4e64b8ccfeffb573cbeceaf457c1..53f25500c22b57afdb2cc54f1daa2cd510070000 100644 (file)
@@ -164,14 +164,12 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int jmicron_config_drive_for_dma (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = drive->hwif;
+       if (ide_use_dma(drive) && config_chipset_for_dma(drive))
+               return 0;
 
-       if (ide_use_dma(drive)) {
-               if (config_chipset_for_dma(drive))
-                       return hwif->ide_dma_on(drive);
-       }
        config_jmicron_chipset_for_pio(drive, 1);
-       return hwif->ide_dma_off_quietly(drive);
+
+       return -1;
 }
 
 /**
index 7f2090fac6cb08e059706dc3e2a2827da22d5525..b310c4f510773c6f8aa2c9961fd72a7d7261b8ce 100644 (file)
@@ -190,7 +190,8 @@ static int ns87415_ide_dma_setup(ide_drive_t *drive)
 static int ns87415_ide_dma_check (ide_drive_t *drive)
 {
        if (drive->media != ide_disk)
-               return HWIF(drive)->ide_dma_off_quietly(drive);
+               return -1;
+
        return __ide_dma_check(drive);
 }
 
index b780e15e9f321e2c92731efd0b0f8307dfa43c64..6ceb25bc5a7bb1109e22ff804a997dde62d66cc9 100644 (file)
@@ -281,17 +281,15 @@ static int config_chipset_for_dma(ide_drive_t *drive)
 
 static int pdcnew_config_drive_xfer_rate(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
-               hwif->tuneproc(drive, 255);
+               pdcnew_tune_drive(drive, 255);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static int pdcnew_quirkproc(ide_drive_t *drive)
index b2b8e6ea7e90a718ca1c6bcb51ace2030f9f72a6..a7a639fe1eaff2b4540f52160afc8163f1eef35f 100644 (file)
@@ -322,17 +322,15 @@ chipset_is_set:
 
 static int pdc202xx_config_drive_xfer_rate (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                pdc202xx_tune_drive(drive, 255);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static int pdc202xx_quirkproc (ide_drive_t *drive)
index caf606a1ee8695f6016e84c79165845fe37a3d77..569822f4cf55d8ba28c79f9c385db511657b8d80 100644 (file)
@@ -386,19 +386,17 @@ static int piix_config_drive_for_dma (ide_drive_t *drive)
  
 static int piix_config_drive_xfer_rate (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && piix_config_drive_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                /* Find best PIO mode. */
-               (void) hwif->speedproc(drive, XFER_PIO_0 +
-                                      ide_get_best_pio_mode(drive, 255, 4, NULL));
+               piix_tune_chipset(drive, XFER_PIO_0 +
+                                 ide_get_best_pio_mode(drive, 255, 4, NULL));
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /**
index 8d762d323f8b654504a7fe85ffe499a2a14efc38..08e317f281e7a44a83d9a524ad4edc6ca070c0fe 100644 (file)
@@ -241,10 +241,7 @@ static int sc1200_config_dma2 (ide_drive_t *drive, int mode)
 
        outb(inb(hwif->dma_base+2)|(unit?0x40:0x20), hwif->dma_base+2); /* set DMA_capable bit */
 
-       /*
-        * Finally, turn DMA on in software, and exit.
-        */
-       return hwif->ide_dma_on(drive); /* success */
+       return 0;       /* success */
 }
 
 /*
index f44a5ab8fe00f5f4766ebc77405e2352850d62ad..dbcd37a0c65217138100ad6beac91fab1cb8b306 100644 (file)
@@ -315,17 +315,15 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int svwks_config_drive_xfer_rate (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                config_chipset_for_pio(drive);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static unsigned int __devinit init_chipset_svwks (struct pci_dev *dev, const char *name)
index 290697e09e5599c7aebd3671ec62dfa4e9a15c43..cb5c3211bd8e9a634739ab2e398d5e2dbfaf7c65 100644 (file)
@@ -296,9 +296,9 @@ static int sgiioc4_ide_dma_check(ide_drive_t *drive)
        if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0) {
                printk(KERN_WARNING "%s: couldn't set MWDMA2 mode, "
                                    "using PIO instead\n", drive->name);
-               return sgiioc4_ide_dma_off_quietly(drive);
+               return -1;
        } else
-               return sgiioc4_ide_dma_on(drive);
+               return 0;
 }
 
 /* returns 1 if dma irq issued, 0 otherwise */
index 1e5b8b17e6d8ef4f8ba9ba8cc57b08745c1b3671..7b4c189a9d99c81384a8500ca7c339995b495f07 100644 (file)
@@ -414,15 +414,13 @@ static int config_chipset_for_dma (ide_drive_t *drive)
  
 static int siimage_config_drive_for_dma (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                config_chipset_for_pio(drive, 1);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /* returns 1 if dma irq issued, 0 otherwise */
index 53ffeced06ff9e63fd33f6af81a3e7828bf03ef9..2ba0669f36a17bd066546a56f7e49324162c91d8 100644 (file)
@@ -669,19 +669,17 @@ static int config_chipset_for_dma (ide_drive_t *drive)
 
 static int sis5513_config_xfer_rate(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        config_art_rwp_pio(drive, 5);
 
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                sis5513_tune_drive(drive, 5);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /* Chip detection and general config */
index c7025858f237501bc9ddbca0ed3f60db3b6de5d0..27b21e1202609d0176252a824cb484a7b61aa24f 100644 (file)
@@ -161,14 +161,14 @@ static int sl82c105_check_drive (ide_drive_t *drive)
                if (id->field_valid & 2) {
                        if ((id->dma_mword & hwif->mwdma_mask) ||
                            (id->dma_1word & hwif->swdma_mask))
-                               return hwif->ide_dma_on(drive);
+                               return 0;
                }
 
                if (__ide_dma_good_drive(drive) && id->eide_dma_time < 150)
-                       return hwif->ide_dma_on(drive);
+                       return 0;
        } while (0);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /*
index 917cc8e61e47d0d63a2d6cb9cf2f336b1fa7c645..ae7eb58d961c6f46a27c153aec56dee407befe84 100644 (file)
@@ -179,18 +179,16 @@ static int slc90e66_config_drive_for_dma (ide_drive_t *drive)
 
 static int slc90e66_config_drive_xfer_rate (ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        drive->init_speed = 0;
 
        if (ide_use_dma(drive) && slc90e66_config_drive_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
-               (void) hwif->speedproc(drive, XFER_PIO_0 +
-                                      ide_get_best_pio_mode(drive, 255, 4, NULL));
+               (void)slc90e66_tune_chipset(drive, XFER_PIO_0 +
+                               ide_get_best_pio_mode(drive, 255, 4, NULL));
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif)
index 3703fc87d150c5f86126982116c6d575988e4e14..0b6d81d6ce488926dd01bcc87996559423d94bfd 100644 (file)
@@ -185,15 +185,13 @@ static int config_chipset_for_dma(ide_drive_t *drive)
 
 static int tc86c001_config_drive_xfer_rate(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        if (ide_use_dma(drive) && config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
                tc86c001_tune_drive(drive, 255);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
index 1f5f6759fef8201cd285a3c8d589f50179c8b9bf..5e06179c3469ed4a1fc7956d60fd95e389a630a2 100644 (file)
@@ -113,13 +113,12 @@ static int triflex_config_drive_for_dma(ide_drive_t *drive)
 
 static int triflex_config_drive_xfer_rate(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif        = HWIF(drive);
-
        if (ide_use_dma(drive) && triflex_config_drive_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
+
+       triflex_tune_drive(drive, 255);
 
-       hwif->tuneproc(drive, 255);
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 static void __devinit init_hwif_triflex(ide_hwif_t *hwif)
index 6fb6e50b82312131b1b3ac45f29f927c0f6a7e07..a508550c4095cecb0a43ffb474ca4d94b531d30b 100644 (file)
@@ -240,8 +240,9 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive)
        via_set_drive(drive, speed);
 
        if (drive->autodma && (speed & XFER_MODE) != XFER_PIO)
-               return hwif->ide_dma_on(drive);
-       return hwif->ide_dma_off_quietly(drive);
+               return 0;
+
+       return -1;
 }
 
 static struct via_isa_bridge *via_config_find(struct pci_dev **isa)
index 7e3e93caafd0030e51f83dae00f51fa914a68d9f..de64b022478b9158edaf471dc31657ec2e56d022 100644 (file)
@@ -371,15 +371,13 @@ static int scc_config_chipset_for_dma(ide_drive_t *drive)
 
 static int scc_config_drive_for_dma(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif = HWIF(drive);
-
        if (ide_use_dma(drive) && scc_config_chipset_for_dma(drive))
-               return hwif->ide_dma_on(drive);
+               return 0;
 
        if (ide_use_fast_pio(drive))
-               hwif->tuneproc(drive, 4);
+               scc_tuneproc(drive, 4);
 
-       return hwif->ide_dma_off_quietly(drive);
+       return -1;
 }
 
 /**
index 579a8521de6320560c5468e1cfa8b47e17d64432..08f96e8a1902254927ae92e6b8de99a00d21f706 100644 (file)
@@ -1278,6 +1278,7 @@ int __ide_dma_good_drive(ide_drive_t *);
 int ide_use_dma(ide_drive_t *);
 int __ide_dma_off(ide_drive_t *);
 void ide_dma_verbose(ide_drive_t *);
+int ide_set_dma(ide_drive_t *);
 ide_startstop_t ide_dma_intr(ide_drive_t *);
 
 #ifdef CONFIG_BLK_DEV_IDEDMA_PCI
@@ -1303,6 +1304,7 @@ extern int __ide_dma_timeout(ide_drive_t *);
 static inline int ide_use_dma(ide_drive_t *drive) { return 0; }
 static inline int __ide_dma_off(ide_drive_t *drive) { return 0; }
 static inline void ide_dma_verbose(ide_drive_t *drive) { ; }
+static inline int ide_set_dma(ide_drive_t *drive) { return 1; }
 #endif /* CONFIG_BLK_DEV_IDEDMA */
 
 #ifndef CONFIG_BLK_DEV_IDEDMA_PCI