aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcibios.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-11-29 20:31:49 -0500
committerKevin O'Connor <kevin@koconnor.net>2008-11-29 20:31:49 -0500
commite633832efdba79b082a9d103eebc7f3d1e2459b9 (patch)
tree1d16bc29eaceb4baedd69fa67c9c8014e66cf793 /src/pcibios.c
parent3f168b6c7c4e1ab189eeeead60e40b16fac880b9 (diff)
downloadseabios-e633832efdba79b082a9d103eebc7f3d1e2459b9.tar.gz
Only touch PCI functions > 0 on multi-function devices; rescan max pci each time.
Some single-function devices will respond to all sub-functions - and this confuses things. So, when scanning the PCI bus make sure to only touch function 0 on single-function devices. Since the bus scanning code is necessarily complex now, we might as well implement max bus detection inline with all pci scans. So, there is no need to scan for the max bus at startup.
Diffstat (limited to 'src/pcibios.c')
-rw-r--r--src/pcibios.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pcibios.c b/src/pcibios.c
index 65e4a18c..93cdc462 100644
--- a/src/pcibios.c
+++ b/src/pcibios.c
@@ -20,9 +20,14 @@
static void
handle_1ab101(struct bregs *regs)
{
+ // Find max bus.
+ int bdf, max;
+ foreachpci(bdf, max, 0) {
+ }
+
regs->al = 0x01; // Flags - "Config Mechanism #1" supported.
regs->bx = 0x0210; // PCI version 2.10
- regs->cl = pci_bdf_to_bus(GET_VAR(CS, MaxBDF) - 1);
+ regs->cl = pci_bdf_to_bus(max - 1);
regs->edx = 0x20494350; // "PCI "
// XXX - bochs bios code sets edi to point to 32bit code - but no
// reference to this in spec.