powerpc/pci: Add pci_find_controller_for_domain()
authorOliver O'Halloran <oohall@gmail.com>
Fri, 15 Feb 2019 00:48:15 +0000 (11:48 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Feb 2019 13:10:14 +0000 (00:10 +1100)
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>
arch/powerpc/include/asm/pci-bridge.h
arch/powerpc/kernel/pci-common.c

index 98e8b46aff97629c2938f0b749841f069eba632e..6c0039f3a3a67101968109baf0b18136104dbff6 100644 (file)
@@ -273,6 +273,8 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
 extern struct pci_controller *pci_find_hose_for_OF_device(
                        struct device_node* node);
 
+extern struct pci_controller *pci_find_controller_for_domain(int domain_nr);
+
 /* Fill up host controller resources from the OF node */
 extern void pci_process_bridge_OF_ranges(struct pci_controller *hose,
                        struct device_node *dev, int primary);
index cbdf13d8622774a9f0a41369a4a77179ceb05d5b..60f20c2e559a4a4efcf3fdde16fbc97501ea3f6c 100644 (file)
@@ -351,6 +351,17 @@ struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
        return NULL;
 }
 
+struct pci_controller *pci_find_controller_for_domain(int domain_nr)
+{
+       struct pci_controller *hose;
+
+       list_for_each_entry(hose, &hose_list, list_node)
+               if (hose->global_number == domain_nr)
+                       return hose;
+
+       return NULL;
+}
+
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.
  * If the interrupt is used, then gets the interrupt line from the