From 6707c309d0a988ac83215f561e98f38c21f5fcd6 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sat, 28 Feb 2009 12:26:39 -0500 Subject: [PATCH] Support multiple independent root buses (if known at compile time). Allow extra root buses to be specified in src/config.h. This is based on a patch by Myles Watson. --- src/config.h | 4 ++++ src/pci.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/config.h b/src/config.h index 13b8472..56e5302 100644 --- a/src/config.h +++ b/src/config.h @@ -51,6 +51,10 @@ #define CONFIG_KBD_CALL_INT15_4F 1 // Support for int15c2 mouse calls #define CONFIG_PS2_MOUSE 1 +// If the target machine has multiple independent root buses, the +// extra buses may be specified here. +#define CONFIG_PCI_ROOT1 0x00 +#define CONFIG_PCI_ROOT2 0x00 // Support finding and running option roms during post. #define CONFIG_OPTIONROMS 1 // Set if option roms are already copied to 0xc0000-0xf0000 diff --git a/src/pci.c b/src/pci.c index a59af07..349c8cd 100644 --- a/src/pci.c +++ b/src/pci.c @@ -10,7 +10,6 @@ #include "util.h" // dprintf #include "config.h" // CONFIG_* #include "pci_regs.h" // PCI_VENDOR_ID -#include "farptr.h" // SET_VAR void pci_config_writel(u16 bdf, u32 addr, u32 val) { @@ -59,8 +58,15 @@ pci_next(int bdf, int *pmax) int max = *pmax; for (;;) { - if (bdf >= max) - return -1; + if (bdf >= max) { + if (CONFIG_PCI_ROOT1 && bdf <= (CONFIG_PCI_ROOT1 << 8)) + bdf = CONFIG_PCI_ROOT1 << 8; + else if (CONFIG_PCI_ROOT2 && bdf <= (CONFIG_PCI_ROOT2 << 8)) + bdf = CONFIG_PCI_ROOT2 << 8; + else + return -1; + *pmax = max = bdf + 0x0100; + } u16 v = pci_config_readw(bdf, PCI_VENDOR_ID); if (v != 0x0000 && v != 0xffff) -- 2.39.5