diff options
author | Liviu Dudau <Liviu.Dudau@arm.com> | 2014-09-29 10:29:27 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2014-09-30 19:08:57 -0400 |
commit | 41e5c0f81d3e676d671d96a0a1fafb27abfbd9d7 (patch) | |
tree | 674d5c5bc98998014d5b454f059bb052660057d5 /drivers/pci | |
parent | 670ba0c8883b576d0aec28bd7a838358a4be1406 (diff) |
of/pci: Add pci_get_new_domain_nr() and of_get_pci_domain_nr()
Add pci_get_new_domain_nr() to allocate a new domain number and
of_get_pci_domain_nr() to retrieve the PCI domain number of a given device
from DT. Host bridge drivers or architecture-specific code can choose to
implement their PCI domain number policy using these two functions.
Using of_get_pci_domain_nr() guarantees a stable PCI domain number on every
boot provided that all host bridge controllers are assigned a number in the
device tree using "linux,pci-domain" property. Mixing use of
pci_get_new_domain_nr() and of_get_pci_domain_nr() is not recommended as it
can lead to potentially conflicting domain numbers being assigned to root
buses behind different host bridges.
Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Arnd Bergmann <arnd@arndb.de>
CC: Grant Likely <grant.likely@linaro.org>
CC: Rob Herring <robh+dt@kernel.org>
CC: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pci.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 2c9ac70254e2..d36f35ff6c5d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -4406,6 +4406,15 @@ static void pci_no_domains(void) | |||
4406 | #endif | 4406 | #endif |
4407 | } | 4407 | } |
4408 | 4408 | ||
4409 | #ifdef CONFIG_PCI_DOMAINS | ||
4410 | static atomic_t __domain_nr = ATOMIC_INIT(-1); | ||
4411 | |||
4412 | int pci_get_new_domain_nr(void) | ||
4413 | { | ||
4414 | return atomic_inc_return(&__domain_nr); | ||
4415 | } | ||
4416 | #endif | ||
4417 | |||
4409 | /** | 4418 | /** |
4410 | * pci_ext_cfg_avail - can we access extended PCI config space? | 4419 | * pci_ext_cfg_avail - can we access extended PCI config space? |
4411 | * | 4420 | * |