[POWERPC] mpc52xx_pic: fix main interrupt masking
[powerpc.git] / drivers / ide / pci / sgiioc4.c
index 2af8a71..fd09b29 100644 (file)
@@ -275,34 +275,29 @@ sgiioc4_ide_dma_end(ide_drive_t * drive)
 }
 
 static int
-sgiioc4_ide_dma_check(ide_drive_t * drive)
+sgiioc4_ide_dma_on(ide_drive_t * drive)
 {
-       if (ide_config_drive_speed(drive, XFER_MW_DMA_2) != 0) {
-               printk(KERN_INFO
-                      "Couldnot set %s in Multimode-2 DMA mode | "
-                          "Drive %s using PIO instead\n",
-                      drive->name, drive->name);
-               drive->using_dma = 0;
-       } else
-               drive->using_dma = 1;
+       drive->using_dma = 1;
 
        return 0;
 }
 
-static int
-sgiioc4_ide_dma_on(ide_drive_t * drive)
+static void sgiioc4_dma_off_quietly(ide_drive_t *drive)
 {
-       drive->using_dma = 1;
+       drive->using_dma = 0;
 
-       return HWIF(drive)->ide_dma_host_on(drive);
+       drive->hwif->dma_host_off(drive);
 }
 
-static int
-sgiioc4_ide_dma_off_quietly(ide_drive_t * drive)
+static int sgiioc4_ide_dma_check(ide_drive_t *drive)
 {
-       drive->using_dma = 0;
-
-       return HWIF(drive)->ide_dma_host_off(drive);
+       /* FIXME: check for available DMA modes */
+       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 -1;
+       } else
+               return 0;
 }
 
 /* returns 1 if dma irq issued, 0 otherwise */
@@ -312,21 +307,13 @@ sgiioc4_ide_dma_test_irq(ide_drive_t * drive)
        return sgiioc4_checkirq(HWIF(drive));
 }
 
-static int
-sgiioc4_ide_dma_host_on(ide_drive_t * drive)
+static void sgiioc4_dma_host_on(ide_drive_t * drive)
 {
-       if (drive->using_dma)
-               return 0;
-
-       return 1;
 }
 
-static int
-sgiioc4_ide_dma_host_off(ide_drive_t * drive)
+static void sgiioc4_dma_host_off(ide_drive_t * drive)
 {
        sgiioc4_clearirq(drive);
-
-       return 0;
 }
 
 static int
@@ -593,7 +580,7 @@ static int sgiioc4_ide_dma_setup(ide_drive_t *drive)
 static void __devinit
 ide_init_sgiioc4(ide_hwif_t * hwif)
 {
-       hwif->mmio = 2;
+       hwif->mmio = 1;
        hwif->autodma = 1;
        hwif->atapi_dma = 1;
        hwif->ultra_mask = 0x0; /* Disable Ultra DMA */
@@ -616,10 +603,10 @@ ide_init_sgiioc4(ide_hwif_t * hwif)
        hwif->ide_dma_end = &sgiioc4_ide_dma_end;
        hwif->ide_dma_check = &sgiioc4_ide_dma_check;
        hwif->ide_dma_on = &sgiioc4_ide_dma_on;
-       hwif->ide_dma_off_quietly = &sgiioc4_ide_dma_off_quietly;
+       hwif->dma_off_quietly = &sgiioc4_dma_off_quietly;
        hwif->ide_dma_test_irq = &sgiioc4_ide_dma_test_irq;
-       hwif->ide_dma_host_on = &sgiioc4_ide_dma_host_on;
-       hwif->ide_dma_host_off = &sgiioc4_ide_dma_host_off;
+       hwif->dma_host_on = &sgiioc4_dma_host_on;
+       hwif->dma_host_off = &sgiioc4_dma_host_off;
        hwif->ide_dma_lostirq = &sgiioc4_ide_dma_lostirq;
        hwif->ide_dma_timeout = &__ide_dma_timeout;