aboutsummaryrefslogtreecommitdiff
path: root/src/pci.h
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/pci.h
parent3f168b6c7c4e1ab189eeeead60e40b16fac880b9 (diff)
downloadseabios-hppa-e633832efdba79b082a9d103eebc7f3d1e2459b9.zip
seabios-hppa-e633832efdba79b082a9d103eebc7f3d1e2459b9.tar.gz
seabios-hppa-e633832efdba79b082a9d103eebc7f3d1e2459b9.tar.bz2
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/pci.h')
-rw-r--r--src/pci.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pci.h b/src/pci.h
index a18cfb7..fc39fa0 100644
--- a/src/pci.h
+++ b/src/pci.h
@@ -23,12 +23,15 @@ u32 pci_config_readl(u16 bdf, u32 addr);
u16 pci_config_readw(u16 bdf, u32 addr);
u8 pci_config_readb(u16 bdf, u32 addr);
-void pci_bus_setup();
int pci_find_device(u16 vendid, u16 devid, int start_bdf);
int pci_find_classprog(u32 classprog, int start_bdf);
int pci_find_class(u16 classid, int start_bdf);
-extern int MaxBDF;
+int pci_next(int bdf, int *pmax);
+#define foreachpci(BDF, MAX, START) \
+ for (MAX=0x0100, BDF=pci_next((START), &MAX) \
+ ; BDF >= 0 \
+ ; BDF=pci_next(BDF+1, &MAX))
// pirtable.c
void create_pirtable();