]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
PCI: Add pci_last_busno() helper
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Thu, 19 Feb 2009 15:20:41 +0000 (18:20 +0300)
committerKim Phillips <kim.phillips@freescale.com>
Mon, 23 Feb 2009 21:51:10 +0000 (15:51 -0600)
This is just a handy routine that reports last PCI busno: we walk
down all the hoses and return last hose's last_busno.

Will be used by PCI/PCIe initialization code.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
drivers/pci/pci.c
include/pci.h

index fffca49fce51ba7cb66c1669906c43a4b76d4945..d6d2d6e4ad63f42bcfcab9ab3d94c76ecccbc3dc 100644 (file)
@@ -165,6 +165,19 @@ struct pci_controller *pci_bus_to_hose (int bus)
        return NULL;
 }
 
+int pci_last_busno(void)
+{
+       struct pci_controller *hose = hose_head;
+
+       if (!hose)
+               return -1;
+
+       while (hose->next)
+               hose = hose->next;
+
+       return hose->last_busno;
+}
+
 #ifndef CONFIG_IXP425
 pci_dev_t pci_find_devices(struct pci_device_id *ids, int index)
 {
index d0594e316c93bd6d032fca15331c4abf82d1c579..aaa455434451de8b78a73f56e444656c5d7c90ff 100644 (file)
@@ -535,6 +535,8 @@ extern int pci_hose_config_device(struct pci_controller *hose,
                                  pci_addr_t mem,
                                  unsigned long command);
 
+int pci_last_busno(void);
+
 #ifdef CONFIG_MPC824X
 extern void pci_mpc824x_init (struct pci_controller *hose);
 #endif