aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2014-09-29 10:29:26 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-09-30 19:08:57 -0400
commit670ba0c8883b576d0aec28bd7a838358a4be1406 (patch)
treefd0b13325b9c832f5d56a969d154d5d4a235b6c2 /drivers/pci/probe.c
parent0b0b0893d49b34201a6c4416b1a707b580b91e3d (diff)
PCI: Add generic domain handling
The handling of PCI domains (or PCI segments in ACPI speak) is usually a straightforward affair but its implementation is currently left to the architectural code, with pci_domain_nr(b) querying the value of the domain associated with bus b. This patch introduces CONFIG_PCI_DOMAINS_GENERIC as an option that can be selected if an architecture wants a simple implementation where the value of the domain associated with a bus is stored in struct pci_bus. The architectures that select CONFIG_PCI_DOMAINS_GENERIC will then have to implement pci_bus_assign_domain_nr() as a way of setting the domain number associated with a root bus. All child buses except the root bus will inherit the domain_nr value from their parent. Signed-off-by: Catalin Marinas <Catalin.Marinas@arm.com> [Renamed pci_set_domain_nr() to pci_bus_assign_domain_nr()] Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index e3cf8a2e6292..636d1c9156a9 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -485,7 +485,7 @@ void pci_read_bridge_bases(struct pci_bus *child)
485 } 485 }
486} 486}
487 487
488static struct pci_bus *pci_alloc_bus(void) 488static struct pci_bus *pci_alloc_bus(struct pci_bus *parent)
489{ 489{
490 struct pci_bus *b; 490 struct pci_bus *b;
491 491
@@ -500,6 +500,10 @@ static struct pci_bus *pci_alloc_bus(void)
500 INIT_LIST_HEAD(&b->resources); 500 INIT_LIST_HEAD(&b->resources);
501 b->max_bus_speed = PCI_SPEED_UNKNOWN; 501 b->max_bus_speed = PCI_SPEED_UNKNOWN;
502 b->cur_bus_speed = PCI_SPEED_UNKNOWN; 502 b->cur_bus_speed = PCI_SPEED_UNKNOWN;
503#ifdef CONFIG_PCI_DOMAINS_GENERIC
504 if (parent)
505 b->domain_nr = parent->domain_nr;
506#endif
503 return b; 507 return b;
504} 508}
505 509
@@ -671,7 +675,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
671 /* 675 /*
672 * Allocate a new bus, and inherit stuff from the parent.. 676 * Allocate a new bus, and inherit stuff from the parent..
673 */ 677 */
674 child = pci_alloc_bus(); 678 child = pci_alloc_bus(parent);
675 if (!child) 679 if (!child)
676 return NULL; 680 return NULL;
677 681
@@ -1761,13 +1765,14 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
1761 char bus_addr[64]; 1765 char bus_addr[64];
1762 char *fmt; 1766 char *fmt;
1763 1767
1764 b = pci_alloc_bus(); 1768 b = pci_alloc_bus(NULL);
1765 if (!b) 1769 if (!b)
1766 return NULL; 1770 return NULL;
1767 1771
1768 b->sysdata = sysdata; 1772 b->sysdata = sysdata;
1769 b->ops = ops; 1773 b->ops = ops;
1770 b->number = b->busn_res.start = bus; 1774 b->number = b->busn_res.start = bus;
1775 pci_bus_assign_domain_nr(b, parent);
1771 b2 = pci_find_bus(pci_domain_nr(b), bus); 1776 b2 = pci_find_bus(pci_domain_nr(b), bus);
1772 if (b2) { 1777 if (b2) {
1773 /* If we already got to this bus through a different bridge, ignore it */ 1778 /* If we already got to this bus through a different bridge, ignore it */