===================================================================
@@ -301,9 +301,10 @@ static __devinit acpi_status add_window(
}
static void __devinit
-pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
+pcibios_setup_root_windows(struct pci_bus *bus)
{
int i, j;
+ struct pci_controller *ctrl = bus->sysdata;
j = 0;
for (i = 0; i < ctrl->windows; i++) {
@@ -371,9 +372,6 @@ pci_acpi_scan_root(struct acpi_device *d
* such quirk. So we just ignore the case now.
*/
pbus = pci_scan_bus_parented(NULL, bus, &pci_root_ops, controller);
- if (pbus)
- pcibios_setup_root_windows(pbus, controller);
-
return pbus;
out3:
@@ -456,15 +454,29 @@ pcibios_fixup_resources(struct pci_dev *
{
struct pci_bus_region region;
int i;
+ struct resource *devr, *busr;
for (i = start; i < limit; i++) {
- if (!dev->resource[i].flags)
+ char *dtype = i < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
+
+ devr = &dev->resource[i];
+ if (!devr->flags)
continue;
+
region.start = dev->resource[i].start;
region.end = dev->resource[i].end;
- pcibios_bus_to_resource(dev, &dev->resource[i], ®ion);
- if ((is_valid_resource(dev, i)))
- pci_claim_resource(dev, i);
+ pcibios_bus_to_resource(dev, devr, ®ion);
+ if (!is_valid_resource(dev, i))
+ continue;
+
+ busr = pci_find_parent_resource(dev, devr);
+ if (!busr || request_resource(busr, devr)) {
+ dev_err(&dev->dev, "BAR %d: %s of %s %pR\n", i,
+ busr ? "address space collision on" :
+ "no parent found for",
+ dtype, devr);
+ devr->flags = 0;
+ }
}
}
@@ -487,7 +499,9 @@ pcibios_fixup_bus (struct pci_bus *b)
{
struct pci_dev *dev;
- if (b->self) {
+ if (pci_is_root_bus(b))
+ pcibios_setup_root_windows(b);
+ else {
pci_read_bridge_bases(b);
pcibios_fixup_bridge_resources(b->self);
}