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 /include/linux/pci.h | |
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 'include/linux/pci.h')
-rw-r--r-- | include/linux/pci.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h index a494e5d775c3..150da2d644e7 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -1285,10 +1285,12 @@ void pci_cfg_access_unlock(struct pci_dev *dev); | |||
1285 | */ | 1285 | */ |
1286 | #ifdef CONFIG_PCI_DOMAINS | 1286 | #ifdef CONFIG_PCI_DOMAINS |
1287 | extern int pci_domains_supported; | 1287 | extern int pci_domains_supported; |
1288 | int pci_get_new_domain_nr(void); | ||
1288 | #else | 1289 | #else |
1289 | enum { pci_domains_supported = 0 }; | 1290 | enum { pci_domains_supported = 0 }; |
1290 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } | 1291 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } |
1291 | static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } | 1292 | static inline int pci_proc_domain(struct pci_bus *bus) { return 0; } |
1293 | static inline int pci_get_new_domain_nr(void) { return -ENOSYS; } | ||
1292 | #endif /* CONFIG_PCI_DOMAINS */ | 1294 | #endif /* CONFIG_PCI_DOMAINS */ |
1293 | 1295 | ||
1294 | /* | 1296 | /* |
@@ -1417,6 +1419,7 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus, | |||
1417 | 1419 | ||
1418 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } | 1420 | static inline int pci_domain_nr(struct pci_bus *bus) { return 0; } |
1419 | static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } | 1421 | static inline struct pci_dev *pci_dev_get(struct pci_dev *dev) { return NULL; } |
1422 | static inline int pci_get_new_domain_nr(void) { return -ENOSYS; } | ||
1420 | 1423 | ||
1421 | #define dev_is_pci(d) (false) | 1424 | #define dev_is_pci(d) (false) |
1422 | #define dev_is_pf(d) (false) | 1425 | #define dev_is_pf(d) (false) |