summaryrefslogtreecommitdiffstats
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-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.
*/