aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci-common.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-08-28 04:58:16 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-09-02 01:45:53 -0400
commit0ed2c722c650513ba4bce868c7a052e576c060e2 (patch)
tree6b679585a9c2afa871f81dc9da90af9b79c49c02 /arch/powerpc/kernel/pci-common.c
parentc5b20d3926dfc9616265b8ff5967cb7a476f9344 (diff)
powerpc/pci: Merge ppc32 and ppc64 versions of phb_scan()
The two versions are doing almost exactly the same thing. No need to maintain them as separate files. This patch also has the side effect of making the PCI device tree scanning code available to 32 bit powerpc machines, but no board ports actually make use of this feature at this point. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/pci-common.c')
-rw-r--r--arch/powerpc/kernel/pci-common.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 8f84a9a8428e..e9f4840096b3 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1688,3 +1688,52 @@ int early_find_capability(struct pci_controller *hose, int bus, int devfn,
1688{ 1688{
1689 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap); 1689 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap);
1690} 1690}
1691
1692/**
1693 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus
1694 * @hose: Pointer to the PCI host controller instance structure
1695 * @sysdata: value to use for sysdata pointer. ppc32 and ppc64 differ here
1696 *
1697 * Note: the 'data' pointer is a temporary measure. As 32 and 64 bit
1698 * pci code gets merged, this parameter should become unnecessary because
1699 * both will use the same value.
1700 */
1701void __devinit pcibios_scan_phb(struct pci_controller *hose, void *sysdata)
1702{
1703 struct pci_bus *bus;
1704 struct device_node *node = hose->dn;
1705 int mode;
1706
1707 pr_debug("PCI: Scanning PHB %s\n",
1708 node ? node->full_name : "<NO NAME>");
1709
1710 /* Create an empty bus for the toplevel */
1711 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops,
1712 sysdata);
1713 if (bus == NULL) {
1714 pr_err("Failed to create bus for PCI domain %04x\n",
1715 hose->global_number);
1716 return;
1717 }
1718 bus->secondary = hose->first_busno;
1719 hose->bus = bus;
1720
1721 /* Get some IO space for the new PHB */
1722 pcibios_setup_phb_io_space(hose);
1723
1724 /* Wire up PHB bus resources */
1725 pcibios_setup_phb_resources(hose);
1726
1727 /* Get probe mode and perform scan */
1728 mode = PCI_PROBE_NORMAL;
1729 if (node && ppc_md.pci_probe_mode)
1730 mode = ppc_md.pci_probe_mode(bus);
1731 pr_debug(" probe mode: %d\n", mode);
1732 if (mode == PCI_PROBE_DEVTREE) {
1733 bus->subordinate = hose->last_busno;
1734 of_scan_bus(node, bus);
1735 }
1736
1737 if (mode == PCI_PROBE_NORMAL)
1738 hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
1739}