aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/pci/common.c')
-rw-r--r--arch/x86/pci/common.c63
1 files changed, 1 insertions, 62 deletions
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 7b6e3bb9b28c..75fcc29ecf52 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -77,59 +77,6 @@ int pcibios_scanned;
77 */ 77 */
78DEFINE_SPINLOCK(pci_config_lock); 78DEFINE_SPINLOCK(pci_config_lock);
79 79
80/*
81 * Several buggy motherboards address only 16 devices and mirror
82 * them to next 16 IDs. We try to detect this `feature' on all
83 * primary buses (those containing host bridges as they are
84 * expected to be unique) and remove the ghost devices.
85 */
86
87static void __devinit pcibios_fixup_ghosts(struct pci_bus *b)
88{
89 struct list_head *ln, *mn;
90 struct pci_dev *d, *e;
91 int mirror = PCI_DEVFN(16,0);
92 int seen_host_bridge = 0;
93 int i;
94
95 DBG("PCI: Scanning for ghost devices on bus %d\n", b->number);
96 list_for_each(ln, &b->devices) {
97 d = pci_dev_b(ln);
98 if ((d->class >> 8) == PCI_CLASS_BRIDGE_HOST)
99 seen_host_bridge++;
100 for (mn=ln->next; mn != &b->devices; mn=mn->next) {
101 e = pci_dev_b(mn);
102 if (e->devfn != d->devfn + mirror ||
103 e->vendor != d->vendor ||
104 e->device != d->device ||
105 e->class != d->class)
106 continue;
107 for(i=0; i<PCI_NUM_RESOURCES; i++)
108 if (e->resource[i].start != d->resource[i].start ||
109 e->resource[i].end != d->resource[i].end ||
110 e->resource[i].flags != d->resource[i].flags)
111 continue;
112 break;
113 }
114 if (mn == &b->devices)
115 return;
116 }
117 if (!seen_host_bridge)
118 return;
119 printk(KERN_WARNING "PCI: Ignoring ghost devices on bus %02x\n", b->number);
120
121 ln = &b->devices;
122 while (ln->next != &b->devices) {
123 d = pci_dev_b(ln->next);
124 if (d->devfn >= mirror) {
125 list_del(&d->global_list);
126 list_del(&d->bus_list);
127 kfree(d);
128 } else
129 ln = ln->next;
130 }
131}
132
133static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 80static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
134{ 81{
135 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE]; 82 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
@@ -152,7 +99,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *b)
152{ 99{
153 struct pci_dev *dev; 100 struct pci_dev *dev;
154 101
155 pcibios_fixup_ghosts(b);
156 pci_read_bridge_bases(b); 102 pci_read_bridge_bases(b);
157 list_for_each_entry(dev, &b->devices, bus_list) 103 list_for_each_entry(dev, &b->devices, bus_list)
158 pcibios_fixup_device_resources(dev); 104 pcibios_fixup_device_resources(dev);
@@ -427,10 +373,6 @@ static int __init pcibios_init(void)
427 373
428 if (pci_bf_sort >= pci_force_bf) 374 if (pci_bf_sort >= pci_force_bf)
429 pci_sort_breadthfirst(); 375 pci_sort_breadthfirst();
430#ifdef CONFIG_PCI_BIOS
431 if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
432 pcibios_sort();
433#endif
434 return 0; 376 return 0;
435} 377}
436 378
@@ -455,9 +397,6 @@ char * __devinit pcibios_setup(char *str)
455 } else if (!strcmp(str, "nobios")) { 397 } else if (!strcmp(str, "nobios")) {
456 pci_probe &= ~PCI_PROBE_BIOS; 398 pci_probe &= ~PCI_PROBE_BIOS;
457 return NULL; 399 return NULL;
458 } else if (!strcmp(str, "nosort")) {
459 pci_probe |= PCI_NO_SORT;
460 return NULL;
461 } else if (!strcmp(str, "biosirq")) { 400 } else if (!strcmp(str, "biosirq")) {
462 pci_probe |= PCI_BIOS_IRQ_SCAN; 401 pci_probe |= PCI_BIOS_IRQ_SCAN;
463 return NULL; 402 return NULL;
@@ -527,7 +466,7 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
527{ 466{
528 int err; 467 int err;
529 468
530 if ((err = pcibios_enable_resources(dev, mask)) < 0) 469 if ((err = pci_enable_resources(dev, mask)) < 0)
531 return err; 470 return err;
532 471
533 if (!dev->msi_enabled) 472 if (!dev->msi_enabled)