]> err.no Git - linux-2.6/blobdiff - drivers/ide/setup-pci.c
ide: add CONFIG_IDE_ARCH_OBSOLETE_INIT
[linux-2.6] / drivers / ide / setup-pci.c
index fff567bcedbeed1496603a06c4caec9cc305f73a..875167e11cd12bc131f47c6ac7ef04262ada11cd 100644 (file)
@@ -388,7 +388,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
        if (hwif->io_ports[IDE_DATA_OFFSET] != base ||
            hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) {
                memset(&hwif->hw, 0, sizeof(hwif->hw));
-#ifndef IDE_ARCH_OBSOLETE_INIT
+#ifndef CONFIG_IDE_ARCH_OBSOLETE_INIT
                ide_std_init_ports(&hwif->hw, base, (ctl | 2));
                hwif->hw.io_ports[IDE_IRQ_OFFSET] = 0;
 #else
@@ -397,7 +397,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
                memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
                hwif->noprobe = !hwif->io_ports[IDE_DATA_OFFSET];
        }
-       hwif->chipset = ide_pci;
+       hwif->chipset = d->chipset ? d->chipset : ide_pci;
        hwif->pci_dev = dev;
        hwif->cds = (struct ide_pci_device_s *) d;
        hwif->channel = port;
@@ -512,7 +512,7 @@ out:
  *     @dev: PCI device
  *     @d: IDE pci device info
  *     @pciirq: IRQ line
- *     @index: ata index to update
+ *     @idx: ATA index table to update
  *
  *     Scan the interfaces attached to this device and do any
  *     necessary per port setup. Attach the devices and ask the
@@ -522,26 +522,25 @@ out:
  *     but is also used directly as a helper function by some controllers
  *     where the chipset setup is not the default PCI IDE one.
  */
-void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index)
+
+void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, u8 *idx)
 {
        int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
-       int at_least_one_hwif_enabled = 0;
        ide_hwif_t *hwif, *mate = NULL;
        u8 tmp;
 
-       index->all = 0xf0f0;
-
        /*
         * Set up the IDE ports
         */
-        
+
        for (port = 0; port < channels; ++port) {
                ide_pci_enablebit_t *e = &(d->enablebits[port]);
        
                if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
-                   (tmp & e->mask) != e->val))
+                   (tmp & e->mask) != e->val)) {
+                       printk(KERN_INFO "%s: IDE port disabled\n", d->name);
                        continue;       /* port not enabled */
+               }
 
                if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL)
                        continue;
@@ -549,11 +548,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
                /* setup proper ancestral information */
                hwif->gendev.parent = &dev->dev;
 
-               if (hwif->channel) {
-                       index->b.high = hwif->index;
-               } else {
-                       index->b.low = hwif->index;
-               }
+               *(idx + port) = hwif->index;
 
                
                if (d->init_iops)
@@ -562,15 +557,28 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
                if ((d->host_flags & IDE_HFLAG_NO_DMA) == 0)
                        ide_hwif_setup_dma(dev, d, hwif);
 
-               if ((d->host_flags & IDE_HFLAG_LEGACY_IRQS) && hwif->irq == 0)
+               if ((!hwif->irq && (d->host_flags & IDE_HFLAG_LEGACY_IRQS)) ||
+                   (d->host_flags & IDE_HFLAG_FORCE_LEGACY_IRQS))
                        hwif->irq = port ? 15 : 14;
 
+               hwif->fixup = d->fixup;
+
                hwif->host_flags = d->host_flags;
                hwif->pio_mask = d->pio_mask;
 
                if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
                        hwif->mate->serialized = hwif->serialized = 1;
 
+               if (d->host_flags & IDE_HFLAG_IO_32BIT) {
+                       hwif->drives[0].io_32bit = 1;
+                       hwif->drives[1].io_32bit = 1;
+               }
+
+               if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
+                       hwif->drives[0].unmask = 1;
+                       hwif->drives[1].unmask = 1;
+               }
+
                if (hwif->dma_base) {
                        hwif->swdma_mask = d->swdma_mask;
                        hwif->mwdma_mask = d->mwdma_mask;
@@ -580,6 +588,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
                hwif->drives[0].autotune = 1;
                hwif->drives[1].autotune = 1;
 
+               if (d->host_flags & IDE_HFLAG_RQSIZE_256)
+                       hwif->rqsize = 256;
+
                if (d->init_hwif)
                        /* Call chipset-specific routine
                         * for each enabled hwif
@@ -587,10 +598,7 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
                        d->init_hwif(hwif);
 
                mate = hwif;
-               at_least_one_hwif_enabled = 1;
        }
-       if (!at_least_one_hwif_enabled)
-               printk(KERN_INFO "%s: neither IDE port enabled (BIOS)\n", d->name);
 }
 
 EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
@@ -606,9 +614,8 @@ EXPORT_SYMBOL_GPL(ide_pci_setup_ports);
  * for all other chipsets, we just assume both interfaces are enabled.
  */
 static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
-                                  ata_index_t *index, u8 noisy)
+                                  u8 *idx, u8 noisy)
 {
-       static ata_index_t ata_index = { .b = { .low = 0xff, .high = 0xff } };
        int tried_config = 0;
        int pciirq, ret;
 
@@ -658,37 +665,21 @@ static int do_ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d,
 
        /* FIXME: silent failure can happen */
 
-       *index = ata_index;
-       ide_pci_setup_ports(dev, d, pciirq, index);
+       ide_pci_setup_ports(dev, d, pciirq, idx);
 out:
        return ret;
 }
 
 int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d)
 {
-       ide_hwif_t *hwif = NULL, *mate = NULL;
-       ata_index_t index_list;
+       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
        int ret;
 
-       ret = do_ide_setup_pci_device(dev, d, &index_list, 1);
-       if (ret < 0)
-               goto out;
+       ret = do_ide_setup_pci_device(dev, d, &idx[0], 1);
 
-       if ((index_list.b.low & 0xf0) != 0xf0)
-               hwif = &ide_hwifs[index_list.b.low];
-       if ((index_list.b.high & 0xf0) != 0xf0)
-               mate = &ide_hwifs[index_list.b.high];
+       if (ret >= 0)
+               ide_device_add(idx);
 
-       if (hwif)
-               probe_hwif_init_with_fixup(hwif, d->fixup);
-       if (mate)
-               probe_hwif_init_with_fixup(mate, d->fixup);
-
-       if (hwif)
-               ide_proc_register_port(hwif);
-       if (mate)
-               ide_proc_register_port(mate);
-out:
        return ret;
 }
 
@@ -698,11 +689,11 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
                          ide_pci_device_t *d)
 {
        struct pci_dev *pdev[] = { dev1, dev2 };
-       ata_index_t index_list[2];
        int ret, i;
+       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
 
        for (i = 0; i < 2; i++) {
-               ret = do_ide_setup_pci_device(pdev[i], d, index_list + i, !i);
+               ret = do_ide_setup_pci_device(pdev[i], d, &idx[i*2], !i);
                /*
                 * FIXME: Mom, mom, they stole me the helper function to undo
                 * do_ide_setup_pci_device() on the first device!
@@ -711,25 +702,7 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2,
                        goto out;
        }
 
-       for (i = 0; i < 2; i++) {
-               u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
-               int j;
-
-               for (j = 0; j < 2; j++) {
-                       if ((idx[j] & 0xf0) != 0xf0)
-                               probe_hwif_init(ide_hwifs + idx[j]);
-               }
-       }
-
-       for (i = 0; i < 2; i++) {
-               u8 idx[2] = { index_list[i].b.low, index_list[i].b.high };
-               int j;
-
-               for (j = 0; j < 2; j++) {
-                       if ((idx[j] & 0xf0) != 0xf0)
-                               ide_proc_register_port(ide_hwifs + idx[j]);
-               }
-       }
+       ide_device_add(idx);
 out:
        return ret;
 }