]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/siimage.c
ide: add IDE_HFLAG_SERIALIZE_DMA host flag
[linux-2.6] / drivers / ide / pci / siimage.c
index 8d624afe8529995988f328770ac3cc266e9e14d4..faf5c3d6ab7223e5f01d013bd7dfa3004ed55b67 100644 (file)
@@ -347,7 +347,7 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
                        printk(KERN_WARNING "%s: sata_error = 0x%08x, "
                                "watchdog = %d, %s\n",
                                drive->name, sata_error, watchdog,
-                               __FUNCTION__);
+                               __func__);
 
                } else {
                        watchdog = (ext_stat & 0x8000) ? 1 : 0;
@@ -369,48 +369,6 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
        return 0;
 }
 
-/**
- *     sil_sata_busproc        -       bus isolation IOCTL
- *     @drive: drive to isolate/restore
- *     @state: bus state to set
- *
- *     Used by the SII3112 to handle bus isolation. As this is a 
- *     SATA controller the work required is quite limited, we 
- *     just have to clean up the statistics
- */
-
-static int sil_sata_busproc(ide_drive_t * drive, int state)
-{
-       ide_hwif_t *hwif        = HWIF(drive);
-       struct pci_dev *dev     = to_pci_dev(hwif->dev);
-       u32 stat_config         = 0;
-       unsigned long addr      = siimage_selreg(hwif, 0);
-
-       if (hwif->mmio)
-               stat_config = readl((void __iomem *)addr);
-       else
-               pci_read_config_dword(dev, addr, &stat_config);
-
-       switch (state) {
-               case BUSSTATE_ON:
-                       hwif->drives[0].failures = 0;
-                       hwif->drives[1].failures = 0;
-                       break;
-               case BUSSTATE_OFF:
-                       hwif->drives[0].failures = hwif->drives[0].max_failures + 1;
-                       hwif->drives[1].failures = hwif->drives[1].max_failures + 1;
-                       break;
-               case BUSSTATE_TRISTATE:
-                       hwif->drives[0].failures = hwif->drives[0].max_failures + 1;
-                       hwif->drives[1].failures = hwif->drives[1].max_failures + 1;
-                       break;
-               default:
-                       return -EINVAL;
-       }
-       hwif->bus_state = state;
-       return 0;
-}
-
 /**
  *     sil_sata_reset_poll     -       wait for SATA reset
  *     @drive: drive we are resetting
@@ -777,14 +735,14 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif)
 }
 
 /**
- *     ata66_siimage   -       check for 80 pin cable
+ *     sil_cable_detect        -       cable detection
  *     @hwif: interface to check
  *
  *     Check for the presence of an ATA66 capable cable on the
  *     interface.
  */
 
-static u8 __devinit ata66_siimage(ide_hwif_t *hwif)
+static u8 __devinit sil_cable_detect(ide_hwif_t *hwif)
 {
        struct pci_dev *dev = to_pci_dev(hwif->dev);
        unsigned long addr = siimage_selreg(hwif, 0);
@@ -811,26 +769,14 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
 {
        u8 sata = is_sata(hwif);
 
-       hwif->set_pio_mode = &sil_set_pio_mode;
-       hwif->set_dma_mode = &sil_set_dma_mode;
-       hwif->quirkproc = &sil_quirkproc;
-
        if (sata) {
                static int first = 1;
 
-               hwif->busproc = &sil_sata_busproc;
-               hwif->reset_poll = &sil_sata_reset_poll;
-               hwif->pre_reset = &sil_sata_pre_reset;
-               hwif->udma_filter = &sil_sata_udma_filter;
-
                if (first) {
                        printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
                        first = 0;
                }
-       } else
-               hwif->udma_filter = &sil_pata_udma_filter;
-
-       hwif->cable_detect = ata66_siimage;
+       }
 
        if (hwif->dma_base == 0)
                return;
@@ -845,22 +791,40 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
        }
 }
 
-#define DECLARE_SII_DEV(name_str)                      \
+static const struct ide_port_ops sil_pata_port_ops = {
+       .set_pio_mode           = sil_set_pio_mode,
+       .set_dma_mode           = sil_set_dma_mode,
+       .quirkproc              = sil_quirkproc,
+       .udma_filter            = sil_pata_udma_filter,
+       .cable_detect           = sil_cable_detect,
+};
+
+static const struct ide_port_ops sil_sata_port_ops = {
+       .set_pio_mode           = sil_set_pio_mode,
+       .set_dma_mode           = sil_set_dma_mode,
+       .reset_poll             = sil_sata_reset_poll,
+       .pre_reset              = sil_sata_pre_reset,
+       .quirkproc              = sil_quirkproc,
+       .udma_filter            = sil_sata_udma_filter,
+       .cable_detect           = sil_cable_detect,
+};
+
+#define DECLARE_SII_DEV(name_str, p_ops)               \
        {                                               \
                .name           = name_str,             \
                .init_chipset   = init_chipset_siimage, \
                .init_iops      = init_iops_siimage,    \
                .init_hwif      = init_hwif_siimage,    \
-               .host_flags     = IDE_HFLAG_BOOTABLE,   \
+               .port_ops       = p_ops,                \
                .pio_mask       = ATA_PIO4,             \
                .mwdma_mask     = ATA_MWDMA2,           \
                .udma_mask      = ATA_UDMA6,            \
        }
 
 static const struct ide_port_info siimage_chipsets[] __devinitdata = {
-       /* 0 */ DECLARE_SII_DEV("SiI680"),
-       /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA"),
-       /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA")
+       /* 0 */ DECLARE_SII_DEV("SiI680",               &sil_pata_port_ops),
+       /* 1 */ DECLARE_SII_DEV("SiI3112 Serial ATA",   &sil_sata_port_ops),
+       /* 2 */ DECLARE_SII_DEV("Adaptec AAR-1210SA",   &sil_sata_port_ops)
 };
 
 /**