From 0be8491b717fec6697dbf6ef8ac07604e062ecb1 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Sat, 10 Apr 2021 13:14:30 +0100 Subject: [pci] Avoid scanning nonexistent buses when using PCIAPI_DIRECT There is no method for obtaining the number of PCI buses when using PCIAPI_DIRECT, and we therefore currently scan all possible bus numbers. This can cause a several-second startup delay in some virtualised environments, since PCI configuration space access will necessarily require the involvement of the hypervisor. Ameliorate this situation by defaulting to scanning only a single bus, and expanding the number of PCI buses to accommodate any subordinate buses that are detected during enumeration. Signed-off-by: Michael Brown --- src/arch/x86/include/ipxe/pcidirect.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/arch/x86') diff --git a/src/arch/x86/include/ipxe/pcidirect.h b/src/arch/x86/include/ipxe/pcidirect.h index 9570fd7d6..decdc8100 100644 --- a/src/arch/x86/include/ipxe/pcidirect.h +++ b/src/arch/x86/include/ipxe/pcidirect.h @@ -32,8 +32,8 @@ extern void pcidirect_prepare ( struct pci_device *pci, int where ); */ static inline __always_inline int PCIAPI_INLINE ( direct, pci_num_bus ) ( void ) { - /* No way to work this out via Type 1 accesses */ - return 0x100; + /* Scan first bus and rely on bridge detection to find higher buses */ + return 1; } /** -- cgit v1.2.3-55-g7522