diff options
author | Michael Brown <mcb30@ipxe.org> | 2022-09-15 16:47:04 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2022-09-15 16:49:47 +0100 |
commit | ff228f745c15594291fd3cbf3c02af27753a3885 (patch) | |
tree | 20fcd06b1407db029e1969095c9f4a449451ba64 /src/include/ipxe/linux | |
parent | 56b30364c5db6367279ffe88929f286f15680b40 (diff) | |
download | ipxe-ff228f745c15594291fd3cbf3c02af27753a3885.tar.gz |
[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/include/ipxe/linux')
-rw-r--r-- | src/include/ipxe/linux/linux_pci.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/include/ipxe/linux/linux_pci.h b/src/include/ipxe/linux/linux_pci.h index de42f766b..ec6ff8b1c 100644 --- a/src/include/ipxe/linux/linux_pci.h +++ b/src/include/ipxe/linux/linux_pci.h @@ -23,14 +23,18 @@ extern int linux_pci_write ( struct pci_device *pci, unsigned long where, unsigned long value, size_t len ); /** - * 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 ( linux, pci_num_bus ) ( void ) { - /* Assume all buses may exist */ - return 0x100; +static inline __always_inline void +PCIAPI_INLINE ( linux, pci_discover ) ( uint32_t busdevfn __unused, + struct pci_range *range ) { + + /* Assume all buses in segment 0 may exist */ + range->start = PCI_BUSDEVFN ( 0, 0, 0, 0 ); + range->count = PCI_BUSDEVFN ( 1, 0, 0, 0 ); } /** |