aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Axtens <dja@axtens.net>2015-03-31 01:00:44 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-04-11 06:49:12 -0400
commitff9df8c87d6807e90c5c3b0e1fd1649d09fd3bcd (patch)
tree549479a5e515c2741656e9251f8fbb2568438512
parentb122c95494374ab848f8d9f41d98644c2c318ecc (diff)
powerpc: Create pci_controller_ops.probe_mode and shim
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>
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h18
-rw-r--r--arch/powerpc/include/asm/pci.h5
-rw-r--r--arch/powerpc/kernel/pci-common.c4
-rw-r--r--arch/powerpc/kernel/pci-hotplug.c3
-rw-r--r--arch/powerpc/kernel/pci_of_scan.c3
5 files changed, 22 insertions, 11 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index b9732fcb0f5f..278f48978bad 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -12,6 +12,11 @@
12#include <linux/ioport.h> 12#include <linux/ioport.h>
13#include <asm-generic/pci-bridge.h> 13#include <asm-generic/pci-bridge.h>
14 14
15/* Return values for pci_controller_ops.probe_mode function */
16#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
17#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
18#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
19
15struct device_node; 20struct device_node;
16 21
17/* 22/*
@@ -20,6 +25,8 @@ struct device_node;
20struct pci_controller_ops { 25struct pci_controller_ops {
21 void (*dma_dev_setup)(struct pci_dev *dev); 26 void (*dma_dev_setup)(struct pci_dev *dev);
22 void (*dma_bus_setup)(struct pci_bus *bus); 27 void (*dma_bus_setup)(struct pci_bus *bus);
28
29 int (*probe_mode)(struct pci_bus *);
23}; 30};
24 31
25/* 32/*
@@ -292,5 +299,16 @@ static inline void pci_dma_bus_setup(struct pci_bus *bus)
292 ppc_md.pci_dma_bus_setup(bus); 299 ppc_md.pci_dma_bus_setup(bus);
293} 300}
294 301
302static inline int pci_probe_mode(struct pci_bus *bus)
303{
304 struct pci_controller *phb = pci_bus_to_host(bus);
305
306 if (phb->controller_ops.probe_mode)
307 return phb->controller_ops.probe_mode(bus);
308 if (ppc_md.pci_probe_mode)
309 return ppc_md.pci_probe_mode(bus);
310 return PCI_PROBE_NORMAL;
311}
312
295#endif /* __KERNEL__ */ 313#endif /* __KERNEL__ */
296#endif /* _ASM_POWERPC_PCI_BRIDGE_H */ 314#endif /* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index 1b0739bc14b5..8745067ac702 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -22,11 +22,6 @@
22 22
23#include <asm-generic/pci-dma-compat.h> 23#include <asm-generic/pci-dma-compat.h>
24 24
25/* Return values for ppc_md.pci_probe_mode function */
26#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
27#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
28#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
29
30#define PCIBIOS_MIN_IO 0x1000 25#define PCIBIOS_MIN_IO 0x1000
31#define PCIBIOS_MIN_MEM 0x10000000 26#define PCIBIOS_MIN_MEM 0x10000000
32 27
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index af357cc38ff6..b0de23c89ca5 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1622,8 +1622,8 @@ void pcibios_scan_phb(struct pci_controller *hose)
1622 1622
1623 /* Get probe mode and perform scan */ 1623 /* Get probe mode and perform scan */
1624 mode = PCI_PROBE_NORMAL; 1624 mode = PCI_PROBE_NORMAL;
1625 if (node && ppc_md.pci_probe_mode) 1625 if (node)
1626 mode = ppc_md.pci_probe_mode(bus); 1626 mode = pci_probe_mode(bus);
1627 pr_debug(" probe mode: %d\n", mode); 1627 pr_debug(" probe mode: %d\n", mode);
1628 if (mode == PCI_PROBE_DEVTREE) 1628 if (mode == PCI_PROBE_DEVTREE)
1629 of_scan_bus(node, bus); 1629 of_scan_bus(node, bus);
diff --git a/arch/powerpc/kernel/pci-hotplug.c b/arch/powerpc/kernel/pci-hotplug.c
index 18d9575729a3..27116b1b2d14 100644
--- a/arch/powerpc/kernel/pci-hotplug.c
+++ b/arch/powerpc/kernel/pci-hotplug.c
@@ -78,8 +78,7 @@ void pcibios_add_pci_devices(struct pci_bus * bus)
78 eeh_add_device_tree_early(PCI_DN(dn)); 78 eeh_add_device_tree_early(PCI_DN(dn));
79 79
80 mode = PCI_PROBE_NORMAL; 80 mode = PCI_PROBE_NORMAL;
81 if (ppc_md.pci_probe_mode) 81 mode = pci_probe_mode(bus);
82 mode = ppc_md.pci_probe_mode(bus);
83 82
84 if (mode == PCI_PROBE_DEVTREE) { 83 if (mode == PCI_PROBE_DEVTREE) {
85 /* use ofdt-based probe */ 84 /* use ofdt-based probe */
diff --git a/arch/powerpc/kernel/pci_of_scan.c b/arch/powerpc/kernel/pci_of_scan.c
index 7122dfece393..4ee63c4f077e 100644
--- a/arch/powerpc/kernel/pci_of_scan.c
+++ b/arch/powerpc/kernel/pci_of_scan.c
@@ -287,8 +287,7 @@ void of_scan_pci_bridge(struct pci_dev *dev)
287 pr_debug(" bus name: %s\n", bus->name); 287 pr_debug(" bus name: %s\n", bus->name);
288 288
289 mode = PCI_PROBE_NORMAL; 289 mode = PCI_PROBE_NORMAL;
290 if (ppc_md.pci_probe_mode) 290 mode = pci_probe_mode(bus);
291 mode = ppc_md.pci_probe_mode(bus);
292 pr_debug(" probe mode: %d\n", mode); 291 pr_debug(" probe mode: %d\n", mode);
293 292
294 if (mode == PCI_PROBE_DEVTREE) 293 if (mode == PCI_PROBE_DEVTREE)