powerpc/pci: Make pcibios_allocate_bus_resources more robust
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 27 Oct 2008 19:48:44 +0000 (19:48 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 5 Nov 2008 22:26:05 +0000 (09:26 +1100)
To properly fix PCI hotplug, it's useful to be able to make the fixup
passes on all devices whether they were just hot plugged or already
there.

However, pcibios_allocate_bus_resources() wouldn't cope well with
being called twice for a given bus.  This makes it ignore resources
that have already been allocated, along with adding a bit of debug
output.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/pci-common.c

index 0eaabd41474f7c8039a9982648a920a6a9b13925..f965397a61051c41a6f7fa34e1f2faf1b2b7c24f 100644 (file)
@@ -1243,9 +1243,12 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus)
        int i;
        struct resource *res, *pr;
 
+       pr_debug("PCI: Allocating bus resources for %04x:%02x...\n",
+                pci_domain_nr(bus), bus->number);
+
        for (i = 0; i < PCI_BUS_NUM_RESOURCES; ++i) {
                if ((res = bus->resource[i]) == NULL || !res->flags
-                   || res->start > res->end)
+                   || res->start > res->end || res->parent)
                        continue;
                if (bus->parent == NULL)
                        pr = (res->flags & IORESOURCE_IO) ?