X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fide%2Fsetup-pci.c;h=1129f8c30840f00280320bb29a489a52aa7e3ac2;hb=b4e44369a380c1836d0983c2a5011099b7b26eb1;hp=118fb3205ca81cda6f4f260bedeea806883ffa4d;hpb=7f52a3afc4c02db75b3953fcbbb980abc86873a2;p=linux-2.6-omap-h63xx.git diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index 118fb3205ca..1129f8c3084 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -5,12 +5,6 @@ * * Copyright (c) 1995-1998 Mark Lord * May be copied or modified under the terms of the GNU General Public License - * - * Recent Changes - * Split the set up function into multiple functions - * Use pci_set_master - * Fix misreporting of I/O v MMIO problems - * Initial fixups for simplex devices */ /* @@ -407,7 +401,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d, unsigned long ctl = 0, base = 0; ide_hwif_t *hwif; - if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) { + if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { /* Possibly we should fail if these checks report true */ ide_pci_check_iomem(dev, d, 2*port); ide_pci_check_iomem(dev, d, 2*port+1); @@ -571,7 +565,7 @@ out: void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) { - int port; + 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; @@ -582,16 +576,13 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a * Set up the IDE ports */ - for (port = 0; port <= 1; ++port) { + 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)) continue; /* port not enabled */ - if (d->channels <= port) - break; - if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) continue; @@ -616,6 +607,9 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a else ide_hwif_setup_dma(dev, d, hwif); bypass_legacy_dma: + hwif->host_flags = d->host_flags; + hwif->pio_mask = d->pio_mask; + if (d->init_hwif) /* Call chipset-specific routine * for each enabled hwif @@ -702,6 +696,7 @@ out: 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; int ret; @@ -710,11 +705,19 @@ int ide_setup_pci_device(struct pci_dev *dev, ide_pci_device_t *d) goto out; if ((index_list.b.low & 0xf0) != 0xf0) - probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.low], d->fixup); + hwif = &ide_hwifs[index_list.b.low]; if ((index_list.b.high & 0xf0) != 0xf0) - probe_hwif_init_with_fixup(&ide_hwifs[index_list.b.high], d->fixup); + mate = &ide_hwifs[index_list.b.high]; - create_proc_ide_interfaces(); + 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; } @@ -748,13 +751,22 @@ int ide_setup_pci_devices(struct pci_dev *dev1, struct pci_dev *dev2, } } - create_proc_ide_interfaces(); + 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]); + } + } out: return ret; } EXPORT_SYMBOL_GPL(ide_setup_pci_devices); +#ifdef CONFIG_IDEPCI_PCIBUS_ORDER /* * Module interfaces */ @@ -804,19 +816,15 @@ static int __init ide_scan_pcidev(struct pci_dev *dev) struct list_head *l; struct pci_driver *d; - list_for_each(l, &ide_pci_drivers) - { + list_for_each(l, &ide_pci_drivers) { d = list_entry(l, struct pci_driver, node); - if(d->id_table) - { - const struct pci_device_id *id = pci_match_id(d->id_table, dev); - if(id != NULL) - { - if(d->probe(dev, id) >= 0) - { - dev->driver = d; - return 1; - } + if (d->id_table) { + const struct pci_device_id *id = pci_match_id(d->id_table, + dev); + if (id != NULL && d->probe(dev, id) >= 0) { + dev->driver = d; + pci_dev_get(dev); + return 1; } } } @@ -839,25 +847,25 @@ void __init ide_scan_pcibus (int scan_direction) struct list_head *l, *n; pre_init = 0; - if (!scan_direction) { - while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + if (!scan_direction) + while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) ide_scan_pcidev(dev); - } - } else { - while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { + else + while ((dev = pci_get_device_reverse(PCI_ANY_ID, PCI_ANY_ID, dev)) + != NULL) ide_scan_pcidev(dev); - } - } /* * Hand the drivers over to the PCI layer now we * are post init. */ - list_for_each_safe(l, n, &ide_pci_drivers) - { + list_for_each_safe(l, n, &ide_pci_drivers) { list_del(l); d = list_entry(l, struct pci_driver, node); - __pci_register_driver(d, d->driver.owner, d->driver.mod_name); + if (__pci_register_driver(d, d->driver.owner, d->driver.mod_name)) + printk(KERN_ERR "%s: failed to register driver for %s\n", + __FUNCTION__, d->driver.mod_name); } } +#endif