powerpc/pci: Add a platform hook after probe and before resource survey
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 6 Nov 2011 18:55:57 +0000 (18:55 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 25 Nov 2011 03:32:53 +0000 (14:32 +1100)
Some platforms need to perform resource allocation using a custom algorithm
due to HW constraints, or may want to tweak things globally below a host
bridge. For example OPAL support for IODA will need to perform a
resource allocation pass that applies IODA specific segmentation
constraints to MMIO which cannot be done simply using the kernel generic
resource management code.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/machdep.h
arch/powerpc/kernel/pci-common.c

index b540d6f..bf37931 100644 (file)
@@ -213,6 +213,9 @@ struct machdep_calls {
         * allow assignment/enabling of the device. */
        int  (*pcibios_enable_device_hook)(struct pci_dev *);
 
+       /* Called after scan and before resource survey */
+       void (*pcibios_fixup_phb)(struct pci_controller *hose);
+
        /* Called to shutdown machine specific hardware not already controlled
         * by other drivers.
         */
index 458ed3b..f5b753d 100644 (file)
@@ -1732,6 +1732,12 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
        if (mode == PCI_PROBE_NORMAL)
                hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
 
+       /* Platform gets a chance to do some global fixups before
+        * we proceed to resource allocation
+        */
+       if (ppc_md.pcibios_fixup_phb)
+               ppc_md.pcibios_fixup_phb(hose);
+
        /* Configure PCI Express settings */
        if (bus && !pci_has_flag(PCI_PROBE_ONLY)) {
                struct pci_bus *child;