diff options
| author | Michael Brown | 2022-09-15 17:47:04 +0200 |
|---|---|---|
| committer | Michael Brown | 2022-09-15 17:49:47 +0200 |
| commit | ff228f745c15594291fd3cbf3c02af27753a3885 (patch) | |
| tree | 20fcd06b1407db029e1969095c9f4a449451ba64 /src/arch/x86/include/ipxe | |
| parent | [pci] Check for wraparound in callers of pci_find_next() (diff) | |
| download | ipxe-ff228f745c15594291fd3cbf3c02af27753a3885.tar.gz ipxe-ff228f745c15594291fd3cbf3c02af27753a3885.tar.xz ipxe-ff228f745c15594291fd3cbf3c02af27753a3885.zip | |
[pci] Generalise pci_num_bus() to pci_discover()
Allow pci_find_next() to discover devices beyond the first PCI
segment, by generalising pci_num_bus() (which implicitly assumes that
there is only a single PCI segment) with pci_discover() (which has the
ability to return an arbitrary contiguous chunk of PCI bus:dev.fn
address space).
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/x86/include/ipxe')
| -rw-r--r-- | src/arch/x86/include/ipxe/pcidirect.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/arch/x86/include/ipxe/pcidirect.h b/src/arch/x86/include/ipxe/pcidirect.h index decdc8100..394edb2b8 100644 --- a/src/arch/x86/include/ipxe/pcidirect.h +++ b/src/arch/x86/include/ipxe/pcidirect.h @@ -26,14 +26,18 @@ struct pci_device; extern void pcidirect_prepare ( struct pci_device *pci, int where ); /** - * Determine number of PCI buses within system + * Find next PCI bus:dev.fn address range in system * - * @ret num_bus Number of buses + * @v busdevfn Starting PCI bus:dev.fn address + * @v range PCI bus:dev.fn address range to fill in */ -static inline __always_inline int -PCIAPI_INLINE ( direct, pci_num_bus ) ( void ) { +static inline __always_inline void +PCIAPI_INLINE ( direct, pci_discover ) ( uint32_t busdevfn __unused, + struct pci_range *range ) { + /* Scan first bus and rely on bridge detection to find higher buses */ - return 1; + range->start = PCI_BUSDEVFN ( 0, 0, 0, 0 ); + range->count = PCI_BUSDEVFN ( 0, 1, 0, 0 ); } /** |
