aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-ppc64
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2005-09-12 03:17:36 -0400
committerPaul Mackerras <paulus@samba.org>2005-09-12 03:17:36 -0400
commit4267292b0f368c1633ff3316a53b5f7fbada95f8 (patch)
tree4830de68a91351ef29445ec2a7f7ad8d7145b0b9 /include/asm-ppc64
parent357d596bd552ad157a906289ab13ea6ba7e66e3d (diff)
ppc64: Set up PCI tree from Open Firmware device tree
This adds code which gives us the option on ppc64 of instantiating the PCI tree (the tree of pci_bus and pci_dev structs) from the Open Firmware device tree rather than by probing PCI configuration space. The OF device tree has a node for each PCI device and bridge in the system, with properties that tell us what addresses the firmware has configured for them and other details. There are a couple of reasons why this is needed. First, on systems with a hypervisor, there is a PCI-PCI bridge per slot under the PCI host bridges. These PCI-PCI bridges have special isolation features for virtualization. We can't write to their config space, and we are not supposed to be reading their config space either. The firmware tells us about the address ranges that they pass in the OF device tree. Secondly, on powermacs, the interrupt controller is in a PCI device that may be behind a PCI-PCI bridge. If we happened to take an interrupt just at the point when the device or a bridge on the path to it was disabled for probing, we would crash when we try to access the interrupt controller. I have implemented a platform-specific function which is called for each PCI bridge (host or PCI-PCI) to say whether the code should look in the device tree or use normal PCI probing for the devices under that bridge. On pSeries machines we use the device tree if we're running under a hypervisor, otherwise we use normal probing. On powermacs we use normal probing for the AGP bridge, since the device for the AGP bridge itself isn't shown in the device tree (at least on my G5), and the device tree for everything else. This has been tested on a dual G5 powermac, a partition on a POWER5 machine (running under the hypervisor), and a legacy iSeries partition. Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-ppc64')
-rw-r--r--include/asm-ppc64/machdep.h1
-rw-r--r--include/asm-ppc64/pci-bridge.h5
2 files changed, 6 insertions, 0 deletions
diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
index 9a1ef4427ed2..7b25738c111f 100644
--- a/include/asm-ppc64/machdep.h
+++ b/include/asm-ppc64/machdep.h
@@ -88,6 +88,7 @@ struct machdep_calls {
88 88
89 /* PCI stuff */ 89 /* PCI stuff */
90 void (*pcibios_fixup)(void); 90 void (*pcibios_fixup)(void);
91 int (*pci_probe_mode)(struct pci_bus *);
91 92
92 void (*restart)(char *cmd); 93 void (*restart)(char *cmd);
93 void (*power_off)(void); 94 void (*power_off)(void);
diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h
index 6b4a5b1f695e..d8991389ab39 100644
--- a/include/asm-ppc64/pci-bridge.h
+++ b/include/asm-ppc64/pci-bridge.h
@@ -119,5 +119,10 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
119 return PCI_DN(busdn)->phb; 119 return PCI_DN(busdn)->phb;
120} 120}
121 121
122/* Return values for ppc_md.pci_probe_mode function */
123#define PCI_PROBE_NONE -1 /* Don't look at this bus at all */
124#define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */
125#define PCI_PROBE_DEVTREE 1 /* Instantiate from device tree */
126
122#endif 127#endif
123#endif /* __KERNEL__ */ 128#endif /* __KERNEL__ */