summaryrefslogtreecommitdiffstats
path: root/src/drivers/bus
diff options
context:
space:
mode:
authorMichael Brown2005-04-16 13:16:31 +0200
committerMichael Brown2005-04-16 13:16:31 +0200
commit6e5a3858bff856e41955523e8ffc0251ce601d80 (patch)
tree0ef75b19425618f7e848d4ca5d76673383615645 /src/drivers/bus
parentImproved debugging output (diff)
downloadipxe-6e5a3858bff856e41955523e8ffc0251ce601d80.tar.gz
ipxe-6e5a3858bff856e41955523e8ffc0251ce601d80.tar.xz
ipxe-6e5a3858bff856e41955523e8ffc0251ce601d80.zip
Read number of PCI buses returned by BIOS so that we can scan more
quickly.
Diffstat (limited to 'src/drivers/bus')
-rw-r--r--src/drivers/bus/pci.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/drivers/bus/pci.c b/src/drivers/bus/pci.c
index 4b34454c1..44b3a1b49 100644
--- a/src/drivers/bus/pci.c
+++ b/src/drivers/bus/pci.c
@@ -10,6 +10,13 @@ DEV_BUS( struct pci_device, pci_dev );
static char pci_magic[0]; /* guaranteed unique symbol */
/*
+ * pci_io.c may know how many buses we have, in which case it can
+ * overwrite this value.
+ *
+ */
+unsigned int pci_max_bus = 0xff;
+
+/*
* Fill in parameters (vendor & device ids, class, membase etc.) for a
* PCI device based on bus & devfn.
*
@@ -18,6 +25,10 @@ static char pci_magic[0]; /* guaranteed unique symbol */
static int fill_pci_device ( struct pci_device *pci ) {
uint32_t l;
int reg;
+
+ /* Check bus is within range */
+ if ( PCI_BUS ( pci->busdevfn ) > pci_max_bus )
+ return 0;
/* Check to see if there's anything physically present.
*/