From dceb243a1a50364d5510ae4495ac2def8d3536ee Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 18 Sep 2025 15:35:22 -0400 Subject: kern: pci: Make max buses to scan configurable Signed-off-by: Ian Moffett --- src/sys/conf/GENERIC | 3 +++ src/sys/io/pci/pci.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src/sys') diff --git a/src/sys/conf/GENERIC b/src/sys/conf/GENERIC index 816ece3..a667a78 100644 --- a/src/sys/conf/GENERIC +++ b/src/sys/conf/GENERIC @@ -1 +1,4 @@ option DUMP_MEMMAP yes // Dump memory map on boot + +// PCI switches and knobs +setval PCI_MAX_BUS 8 // Max buses to scan on boot diff --git a/src/sys/io/pci/pci.c b/src/sys/io/pci/pci.c index ba96670..fcb5a8b 100644 --- a/src/sys/io/pci/pci.c +++ b/src/sys/io/pci/pci.c @@ -35,7 +35,14 @@ #include #include -#define PCI_BUS_ROOT 0 +#if defined(__PCI_MAX_BUS) +#define PCI_MAX_BUS __PCI_MAX_BUS +#if PCI_MAX_BUS > 256 +#error "PCI_MAX_BUS must be <= 256" +#endif /* PCI_MAX_BUS */ +#else +#define PCI_MAX_BUS 1 +#endif /* __PCI_MAX_BUS */ static struct cam_hook cam; @@ -160,5 +167,8 @@ pci_init_bus(void) panic("pci_init_bus: failed to init CAM\n"); } - pci_enum_bus(PCI_BUS_ROOT); + printf("pci: enumerating %d buses\n", PCI_MAX_BUS); + for (int i = 0; i < PCI_MAX_BUS; ++i) { + pci_enum_bus(i); + } } -- cgit v1.2.3