aboutsummaryrefslogtreecommitdiff
path: root/src/pci.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2009-02-28 12:26:39 -0500
committerKevin O'Connor <kevin@koconnor.net>2009-02-28 12:26:39 -0500
commit6707c309d0a988ac83215f561e98f38c21f5fcd6 (patch)
tree2cdcc82477e2c424e4ac6c04f2679f1dc3ac5a15 /src/pci.c
parenta69a55974acea42052c61851379ff9932ad0f9e4 (diff)
downloadseabios-hppa-6707c309d0a988ac83215f561e98f38c21f5fcd6.zip
seabios-hppa-6707c309d0a988ac83215f561e98f38c21f5fcd6.tar.gz
seabios-hppa-6707c309d0a988ac83215f561e98f38c21f5fcd6.tar.bz2
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.
Diffstat (limited to 'src/pci.c')
-rw-r--r--src/pci.c12
1 files changed, 9 insertions, 3 deletions
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)