aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2011-10-28 18:27:43 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-01-06 15:11:09 -0500
commit45a709f890a7b84930942a5f5f82011312fe727c (patch)
treea84a981f8a0331d39409b32b7282c70c2c47a98c /arch
parent49a6cba4eb165dba65221eea4d555ec8a7c85800 (diff)
powerpc/PCI: convert to pci_create_root_bus()
Convert from pci_create_bus() to pci_create_root_bus(). This way the root bus resources are correct immediately. This patch doesn't fix a problem because powerpc fixed the resources before scanning the bus, but it makes powerpc more consistent with other architectures. v2: fix build error with resource pointer passing CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/pci-common.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 88953c8c7dde..0dbc5fb53c68 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1560,14 +1560,13 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1560 return pci_enable_resources(dev, mask); 1560 return pci_enable_resources(dev, mask);
1561} 1561}
1562 1562
1563static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose) 1563static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
1564{ 1564{
1565 struct pci_bus *bus = hose->bus;
1566 struct resource *res; 1565 struct resource *res;
1567 int i; 1566 int i;
1568 1567
1569 /* Hookup PHB IO resource */ 1568 /* Hookup PHB IO resource */
1570 bus->resource[0] = res = &hose->io_resource; 1569 res = &hose->io_resource;
1571 1570
1572 if (!res->flags) { 1571 if (!res->flags) {
1573 printk(KERN_WARNING "PCI: I/O resource not set for host" 1572 printk(KERN_WARNING "PCI: I/O resource not set for host"
@@ -1585,6 +1584,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1585 (unsigned long long)res->start, 1584 (unsigned long long)res->start,
1586 (unsigned long long)res->end, 1585 (unsigned long long)res->end,
1587 (unsigned long)res->flags); 1586 (unsigned long)res->flags);
1587 pci_add_resource(resources, res);
1588 1588
1589 /* Hookup PHB Memory resources */ 1589 /* Hookup PHB Memory resources */
1590 for (i = 0; i < 3; ++i) { 1590 for (i = 0; i < 3; ++i) {
@@ -1602,12 +1602,12 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1602 res->flags = IORESOURCE_MEM; 1602 res->flags = IORESOURCE_MEM;
1603#endif /* CONFIG_PPC32 */ 1603#endif /* CONFIG_PPC32 */
1604 } 1604 }
1605 bus->resource[i+1] = res;
1606 1605
1607 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i, 1606 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", i,
1608 (unsigned long long)res->start, 1607 (unsigned long long)res->start,
1609 (unsigned long long)res->end, 1608 (unsigned long long)res->end,
1610 (unsigned long)res->flags); 1609 (unsigned long)res->flags);
1610 pci_add_resource(resources, res);
1611 } 1611 }
1612 1612
1613 pr_debug("PCI: PHB MEM offset = %016llx\n", 1613 pr_debug("PCI: PHB MEM offset = %016llx\n",
@@ -1701,6 +1701,7 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
1701 */ 1701 */
1702void __devinit pcibios_scan_phb(struct pci_controller *hose) 1702void __devinit pcibios_scan_phb(struct pci_controller *hose)
1703{ 1703{
1704 LIST_HEAD(resources);
1704 struct pci_bus *bus; 1705 struct pci_bus *bus;
1705 struct device_node *node = hose->dn; 1706 struct device_node *node = hose->dn;
1706 int mode; 1707 int mode;
@@ -1708,22 +1709,24 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
1708 pr_debug("PCI: Scanning PHB %s\n", 1709 pr_debug("PCI: Scanning PHB %s\n",
1709 node ? node->full_name : "<NO NAME>"); 1710 node ? node->full_name : "<NO NAME>");
1710 1711
1712 /* Get some IO space for the new PHB */
1713 pcibios_setup_phb_io_space(hose);
1714
1715 /* Wire up PHB bus resources */
1716 pcibios_setup_phb_resources(hose, &resources);
1717
1711 /* Create an empty bus for the toplevel */ 1718 /* Create an empty bus for the toplevel */
1712 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose); 1719 bus = pci_create_root_bus(hose->parent, hose->first_busno,
1720 hose->ops, hose, &resources);
1713 if (bus == NULL) { 1721 if (bus == NULL) {
1714 pr_err("Failed to create bus for PCI domain %04x\n", 1722 pr_err("Failed to create bus for PCI domain %04x\n",
1715 hose->global_number); 1723 hose->global_number);
1724 pci_free_resource_list(&resources);
1716 return; 1725 return;
1717 } 1726 }
1718 bus->secondary = hose->first_busno; 1727 bus->secondary = hose->first_busno;
1719 hose->bus = bus; 1728 hose->bus = bus;
1720 1729
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 */ 1730 /* Get probe mode and perform scan */
1728 mode = PCI_PROBE_NORMAL; 1731 mode = PCI_PROBE_NORMAL;
1729 if (node && ppc_md.pci_probe_mode) 1732 if (node && ppc_md.pci_probe_mode)