]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/siimage.c
lxfb: rename kernel arg fbsize to vram
[linux-2.6] / drivers / ide / pci / siimage.c
index faf5c3d6ab7223e5f01d013bd7dfa3004ed55b67..c2040a017f475e3abea81f27644ebc0b0dc49044 100644 (file)
@@ -301,7 +301,7 @@ static void sil_set_dma_mode(ide_drive_t *drive, const u8 speed)
 }
 
 /* returns 1 if dma irq issued, 0 otherwise */
-static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
+static int siimage_io_dma_test_irq(ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
@@ -320,14 +320,14 @@ static int siimage_io_ide_dma_test_irq (ide_drive_t *drive)
 }
 
 /**
- *     siimage_mmio_ide_dma_test_irq   -       check we caused an IRQ
+ *     siimage_mmio_dma_test_irq       -       check we caused an IRQ
  *     @drive: drive we are testing
  *
  *     Check if we caused an IDE DMA interrupt. We may also have caused
  *     SATA status interrupts, if so we clean them up and continue.
  */
-static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
+
+static int siimage_mmio_dma_test_irq(ide_drive_t *drive)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        unsigned long addr      = siimage_selreg(hwif, 0x1);
@@ -369,6 +369,14 @@ static int siimage_mmio_ide_dma_test_irq (ide_drive_t *drive)
        return 0;
 }
 
+static int siimage_dma_test_irq(ide_drive_t *drive)
+{
+       if (drive->hwif->mmio)
+               return siimage_mmio_dma_test_irq(drive);
+       else
+               return siimage_io_dma_test_irq(drive);
+}
+
 /**
  *     sil_sata_reset_poll     -       wait for SATA reset
  *     @drive: drive we are resetting
@@ -614,9 +622,10 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
        struct pci_dev *dev     = to_pci_dev(hwif->dev);
        void *addr              = pci_get_drvdata(dev);
        u8 ch                   = hwif->channel;
-       hw_regs_t               hw;
        unsigned long           base;
 
+       struct ide_io_ports *io_ports = &hwif->io_ports;
+
        /*
         *      Fill in the basic HWIF bits
         */
@@ -630,7 +639,7 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
         *      based I/O
         */
 
-       memset(&hw, 0, sizeof(hw_regs_t));
+       memset(io_ports, 0, sizeof(*io_ports));
 
        base = (unsigned long)addr;
        if (ch)
@@ -643,17 +652,15 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
         *      so we can't currently use it sanely since we want to
         *      use LBA48 mode.
         */     
-       hw.io_ports[IDE_DATA_OFFSET]    = base;
-       hw.io_ports[IDE_ERROR_OFFSET]   = base + 1;
-       hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2;
-       hw.io_ports[IDE_SECTOR_OFFSET]  = base + 3;
-       hw.io_ports[IDE_LCYL_OFFSET]    = base + 4;
-       hw.io_ports[IDE_HCYL_OFFSET]    = base + 5;
-       hw.io_ports[IDE_SELECT_OFFSET]  = base + 6;
-       hw.io_ports[IDE_STATUS_OFFSET]  = base + 7;
-       hw.io_ports[IDE_CONTROL_OFFSET] = base + 10;
-
-       hw.io_ports[IDE_IRQ_OFFSET]     = 0;
+       io_ports->data_addr     = base;
+       io_ports->error_addr    = base + 1;
+       io_ports->nsect_addr    = base + 2;
+       io_ports->lbal_addr     = base + 3;
+       io_ports->lbam_addr     = base + 4;
+       io_ports->lbah_addr     = base + 5;
+       io_ports->device_addr   = base + 6;
+       io_ports->status_addr   = base + 7;
+       io_ports->ctl_addr      = base + 10;
 
        if (pdev_is_sata(dev)) {
                base = (unsigned long)addr;
@@ -664,8 +671,6 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
                hwif->sata_scr[SATA_CONTROL_OFFSET]     = base + 0x100;
        }
 
-       memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
-
        hwif->irq = dev->irq;
 
        hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00);
@@ -756,41 +761,6 @@ static u8 __devinit sil_cable_detect(ide_hwif_t *hwif)
        return (ata66 & 0x01) ? ATA_CBL_PATA80 : ATA_CBL_PATA40;
 }
 
-/**
- *     init_hwif_siimage       -       set up hwif structs
- *     @hwif: interface to set up
- *
- *     We do the basic set up of the interface structure. The SIIMAGE
- *     requires several custom handlers so we override the default
- *     ide DMA handlers appropriately
- */
-
-static void __devinit init_hwif_siimage(ide_hwif_t *hwif)
-{
-       u8 sata = is_sata(hwif);
-
-       if (sata) {
-               static int first = 1;
-
-               if (first) {
-                       printk(KERN_INFO "siimage: For full SATA support you should use the libata sata_sil module.\n");
-                       first = 0;
-               }
-       }
-
-       if (hwif->dma_base == 0)
-               return;
-
-       if (sata)
-               hwif->host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
-
-       if (hwif->mmio) {
-               hwif->ide_dma_test_irq = &siimage_mmio_ide_dma_test_irq;
-       } else {
-               hwif->ide_dma_test_irq = & siimage_io_ide_dma_test_irq;
-       }
-}
-
 static const struct ide_port_ops sil_pata_port_ops = {
        .set_pio_mode           = sil_set_pio_mode,
        .set_dma_mode           = sil_set_dma_mode,
@@ -809,13 +779,17 @@ static const struct ide_port_ops sil_sata_port_ops = {
        .cable_detect           = sil_cable_detect,
 };
 
+static struct ide_dma_ops sil_dma_ops = {
+       .dma_test_irq           = siimage_dma_test_irq,
+};
+
 #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,    \
                .port_ops       = p_ops,                \
+               .dma_ops        = &sil_dma_ops,         \
                .pio_mask       = ATA_PIO4,             \
                .mwdma_mask     = ATA_MWDMA2,           \
                .udma_mask      = ATA_UDMA6,            \
@@ -838,7 +812,24 @@ static const struct ide_port_info siimage_chipsets[] __devinitdata = {
  
 static int __devinit siimage_init_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-       return ide_setup_pci_device(dev, &siimage_chipsets[id->driver_data]);
+       struct ide_port_info d;
+       u8 idx = id->driver_data;
+
+       d = siimage_chipsets[idx];
+
+       if (idx) {
+               static int first = 1;
+
+               if (first) {
+                       printk(KERN_INFO "siimage: For full SATA support you "
+                               "should use the libata sata_sil module.\n");
+                       first = 0;
+               }
+
+               d.host_flags |= IDE_HFLAG_NO_ATAPI_DMA;
+       }
+
+       return ide_setup_pci_device(dev, &d);
 }
 
 static const struct pci_device_id siimage_pci_tbl[] = {