]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc: Create pci_controller_ops.probe_mode and shim
authorDaniel Axtens <dja@axtens.net>
Tue, 31 Mar 2015 05:00:44 +0000 (16:00 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 11 Apr 2015 10:49:12 +0000 (20:49 +1000)
Add pci_controller_ops.probe_mode, shadowing ppc_md.pci_probe_mode.
Add a shim, and changes the callsites to use the shim.

We also need to move the probe mode defines to pci-bridge.h from pci.h.
They are required by the shim in order to return a sensible default.
Previously, the were defined in pci.h, but pci.h includes pci-bridge.h
before the relevant #defines. This means the definitions are absent
if pci.h is included before pci-bridge.h. This occurs in some drivers.
So, move the definitons now, and move them back when we remove the shim.

Anything that wants the defines would have had to include pci.h, and
since pci.h includes pci-bridge.h, nothing will lose access to the
defines.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/pci-bridge.h
arch/powerpc/include/asm/pci.h
arch/powerpc/kernel/pci-common.c
arch/powerpc/kernel/pci-hotplug.c
arch/powerpc/kernel/pci_of_scan.c

index b9732fcb0f5f04b03757f1019d1cded526b5eec5..278f48978badbb0ac6d6f1e6f5fbf89f57525d23 100644 (file)
 #include <linux/ioport.h>
 #include <asm-generic/pci-bridge.h>
 
+/* Return values for pci_controller_ops.probe_mode function */
+#define PCI_PROBE_NONE         -1      /* Don't look at this bus at all */
+#define PCI_PROBE_NORMAL       0       /* Do normal PCI probing */
+#define PCI_PROBE_DEVTREE      1       /* Instantiate from device tree */
+
 struct device_node;
 
 /*
@@ -20,6 +25,8 @@ struct device_node;
 struct pci_controller_ops {
        void            (*dma_dev_setup)(struct pci_dev *dev);
        void            (*dma_bus_setup)(struct pci_bus *bus);
+
+       int             (*probe_mode)(struct pci_bus *);
 };
 
 /*
@@ -292,5 +299,16 @@ static inline void pci_dma_bus_setup(struct pci_bus *bus)
                ppc_md.pci_dma_bus_setup(bus);
 }
 
+static inline int pci_probe_mode(struct pci_bus *bus)
+{
+       struct pci_controller *phb = pci_bus_to_host(bus);
+
+       if (phb->controller_ops.probe_mode)
+               return phb->controller_ops.probe_mode(bus);
+       if (ppc_md.pci_probe_mode)
+               return ppc_md.pci_probe_mode(bus);
+       return PCI_PROBE_NORMAL;
+}
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PCI_BRIDGE_H */
index 1b0739bc14b595655d9790d893257a627e059d80..8745067ac70258f8b85f89a0b33ff784d809f137 100644 (file)
 
 #include <asm-generic/pci-dma-compat.h>
 
-/* Return values for ppc_md.pci_probe_mode function */
-#define PCI_PROBE_NONE         -1      /* Don't look at this bus at all */
-#define PCI_PROBE_NORMAL       0       /* Do normal PCI probing */
-#define PCI_PROBE_DEVTREE      1       /* Instantiate from device tree */
-
 #define PCIBIOS_MIN_IO         0x1000
 #define PCIBIOS_MIN_MEM                0x10000000
 
index af357cc38ff6f9d0eaf59e0e6da99da3fd94bb47..b0de23c89ca58b98d1b189b4bf4ea0adbe38e68d 100644 (file)
@@ -1622,8 +1622,8 @@ void pcibios_scan_phb(struct pci_controller *hose)
 
        /* Get probe mode and perform scan */
        mode = PCI_PROBE_NORMAL;
-       if (node && ppc_md.pci_probe_mode)
-               mode = ppc_md.pci_probe_mode(bus);
+       if (node)
+               mode = pci_probe_mode(bus);
        pr_debug("    probe mode: %d\n", mode);
        if (mode == PCI_PROBE_DEVTREE)
                of_scan_bus(node, bus);
index 18d9575729a39f4d4262c5e59b2d6c8424b20aeb..27116b1b2d142981e3786bac5f1c219ee1d7f7c8 100644 (file)
@@ -78,8 +78,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
        eeh_add_device_tree_early(PCI_DN(dn));
 
        mode = PCI_PROBE_NORMAL;
-       if (ppc_md.pci_probe_mode)
-               mode = ppc_md.pci_probe_mode(bus);
+       mode = pci_probe_mode(bus);
 
        if (mode == PCI_PROBE_DEVTREE) {
                /* use ofdt-based probe */
index 7122dfece393c1b2e0a03ffe844f8228554bd9f9..4ee63c4f077e8e6218cf6fee75818e448c0bbcd9 100644 (file)
@@ -287,8 +287,7 @@ void of_scan_pci_bridge(struct pci_dev *dev)
        pr_debug("    bus name: %s\n", bus->name);
 
        mode = PCI_PROBE_NORMAL;
-       if (ppc_md.pci_probe_mode)
-               mode = ppc_md.pci_probe_mode(bus);
+       mode = pci_probe_mode(bus);
        pr_debug("    probe mode: %d\n", mode);
 
        if (mode == PCI_PROBE_DEVTREE)