diff options
author | Oliver O'Halloran <oohall@gmail.com> | 2019-02-14 19:48:15 -0500 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2019-02-21 08:10:14 -0500 |
commit | 67060cb1ffa474c4fa1ae4db865ac1c7ed1fa899 (patch) | |
tree | 79d761c5be8591c0c680f8383a89a886bcbfadbc | |
parent | c8f02f2108136a6218326fbcd4034b985849667c (diff) |
powerpc/pci: Add pci_find_controller_for_domain()
Add a helper to find the pci_controller structure based on the domain
number / phb id.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Sam Bobroff <sbobroff@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 98e8b46aff97..6c0039f3a3a6 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -273,6 +273,8 @@ extern int pcibios_map_io_space(struct pci_bus *bus); | |||
273 | extern struct pci_controller *pci_find_hose_for_OF_device( | 273 | extern struct pci_controller *pci_find_hose_for_OF_device( |
274 | struct device_node* node); | 274 | struct device_node* node); |
275 | 275 | ||
276 | extern struct pci_controller *pci_find_controller_for_domain(int domain_nr); | ||
277 | |||
276 | /* Fill up host controller resources from the OF node */ | 278 | /* Fill up host controller resources from the OF node */ |
277 | extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, | 279 | extern void pci_process_bridge_OF_ranges(struct pci_controller *hose, |
278 | struct device_node *dev, int primary); | 280 | struct device_node *dev, int primary); |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index cbdf13d86227..60f20c2e559a 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -351,6 +351,17 @@ struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node) | |||
351 | return NULL; | 351 | return NULL; |
352 | } | 352 | } |
353 | 353 | ||
354 | struct pci_controller *pci_find_controller_for_domain(int domain_nr) | ||
355 | { | ||
356 | struct pci_controller *hose; | ||
357 | |||
358 | list_for_each_entry(hose, &hose_list, list_node) | ||
359 | if (hose->global_number == domain_nr) | ||
360 | return hose; | ||
361 | |||
362 | return NULL; | ||
363 | } | ||
364 | |||
354 | /* | 365 | /* |
355 | * Reads the interrupt pin to determine if interrupt is use by card. | 366 | * Reads the interrupt pin to determine if interrupt is use by card. |
356 | * If the interrupt is used, then gets the interrupt line from the | 367 | * If the interrupt is used, then gets the interrupt line from the |