aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2011-10-28 18:26:46 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-01-06 15:11:01 -0500
commit58de74b805312c7f5757cb654e9829bd9c1f3c69 (patch)
treed7d502fc06c7d5d937751fe3205f7d47da467b3f /arch/microblaze
parentce78fc6b284c4ece498f6b322b020268c7f0c0e9 (diff)
microblaze/PCI: convert to pci_create_root_bus() for correct root bus resources
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 microblaze fixed the resources before scanning the bus, but it makes microblaze more consistent with other architectures. It also allows us to use the pci_scan_root_bus() path safely. CC: Michal Simek <monstr@monstr.eu> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/microblaze')
-rw-r--r--arch/microblaze/pci/pci-common.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 8989773ff300..e0fdab323ec5 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -1513,14 +1513,18 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
1513 return pci_enable_resources(dev, mask); 1513 return pci_enable_resources(dev, mask);
1514} 1514}
1515 1515
1516static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose) 1516static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose, struct list_head *resources)
1517{ 1517{
1518 struct pci_bus *bus = hose->bus;
1519 struct resource *res; 1518 struct resource *res;
1520 int i; 1519 int i;
1521 1520
1522 /* Hookup PHB IO resource */ 1521 /* Hookup PHB IO resource */
1523 bus->resource[0] = res = &hose->io_resource; 1522 res = &hose->io_resource;
1523
1524 /* Fixup IO space offset */
1525 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
1526 res->start = (res->start + io_offset) & 0xffffffffu;
1527 res->end = (res->end + io_offset) & 0xffffffffu;
1524 1528
1525 if (!res->flags) { 1529 if (!res->flags) {
1526 printk(KERN_WARNING "PCI: I/O resource not set for host" 1530 printk(KERN_WARNING "PCI: I/O resource not set for host"
@@ -1531,6 +1535,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1531 res->end = res->start + IO_SPACE_LIMIT; 1535 res->end = res->start + IO_SPACE_LIMIT;
1532 res->flags = IORESOURCE_IO; 1536 res->flags = IORESOURCE_IO;
1533 } 1537 }
1538 pci_add_resource(resources, res);
1534 1539
1535 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n", 1540 pr_debug("PCI: PHB IO resource = %016llx-%016llx [%lx]\n",
1536 (unsigned long long)res->start, 1541 (unsigned long long)res->start,
@@ -1553,7 +1558,7 @@ static void __devinit pcibios_setup_phb_resources(struct pci_controller *hose)
1553 res->flags = IORESOURCE_MEM; 1558 res->flags = IORESOURCE_MEM;
1554 1559
1555 } 1560 }
1556 bus->resource[i+1] = res; 1561 pci_add_resource(resources, res);
1557 1562
1558 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n", 1563 pr_debug("PCI: PHB MEM resource %d = %016llx-%016llx [%lx]\n",
1559 i, (unsigned long long)res->start, 1564 i, (unsigned long long)res->start,
@@ -1576,32 +1581,27 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
1576 1581
1577static void __devinit pcibios_scan_phb(struct pci_controller *hose) 1582static void __devinit pcibios_scan_phb(struct pci_controller *hose)
1578{ 1583{
1584 LIST_HEAD(resources);
1579 struct pci_bus *bus; 1585 struct pci_bus *bus;
1580 struct device_node *node = hose->dn; 1586 struct device_node *node = hose->dn;
1581 unsigned long io_offset;
1582 struct resource *res = &hose->io_resource;
1583 1587
1584 pr_debug("PCI: Scanning PHB %s\n", 1588 pr_debug("PCI: Scanning PHB %s\n",
1585 node ? node->full_name : "<NO NAME>"); 1589 node ? node->full_name : "<NO NAME>");
1586 1590
1591 pcibios_setup_phb_resources(hose, &resources);
1592
1587 /* Create an empty bus for the toplevel */ 1593 /* Create an empty bus for the toplevel */
1588 bus = pci_create_bus(hose->parent, hose->first_busno, hose->ops, hose); 1594 bus = pci_create_root_bus(hose->parent, hose->first_busno, hose->ops,
1595 hose, &resources);
1589 if (bus == NULL) { 1596 if (bus == NULL) {
1590 printk(KERN_ERR "Failed to create bus for PCI domain %04x\n", 1597 printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",
1591 hose->global_number); 1598 hose->global_number);
1599 pci_free_resource_list(&resources);
1592 return; 1600 return;
1593 } 1601 }
1594 bus->secondary = hose->first_busno; 1602 bus->secondary = hose->first_busno;
1595 hose->bus = bus; 1603 hose->bus = bus;
1596 1604
1597 /* Fixup IO space offset */
1598 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
1599 res->start = (res->start + io_offset) & 0xffffffffu;
1600 res->end = (res->end + io_offset) & 0xffffffffu;
1601
1602 /* Wire up PHB bus resources */
1603 pcibios_setup_phb_resources(hose);
1604
1605 /* Scan children */ 1605 /* Scan children */
1606 hose->last_busno = bus->subordinate = pci_scan_child_bus(bus); 1606 hose->last_busno = bus->subordinate = pci_scan_child_bus(bus);
1607} 1607}