diff options
| author | Michael Brown | 2016-06-09 10:36:28 +0200 |
|---|---|---|
| committer | Michael Brown | 2016-06-09 10:36:28 +0200 |
| commit | f76210961c76a3f54f673d668e21e30d2eed9612 (patch) | |
| tree | df0eb4b64085a587d2df39bcee478a6b320b9c01 /src/include | |
| parent | [libc] Always use a non-zero seed for the (non-crypto) RNG (diff) | |
| download | ipxe-f76210961c76a3f54f673d668e21e30d2eed9612.tar.gz ipxe-f76210961c76a3f54f673d668e21e30d2eed9612.tar.xz ipxe-f76210961c76a3f54f673d668e21e30d2eed9612.zip | |
[pci] Support systems with multiple PCI root bridges
Extend the 16-bit PCI bus:dev.fn address to a 32-bit seg:bus:dev.fn
address, assuming a segment value of zero in contexts where multiple
segments are unsupported by the underlying data structures (e.g. in
the iBFT or BOFM tables).
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ipxe/pci.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/include/ipxe/pci.h b/src/include/ipxe/pci.h index bf0e81dfa..ddd8c8d1e 100644 --- a/src/include/ipxe/pci.h +++ b/src/include/ipxe/pci.h @@ -195,8 +195,8 @@ struct pci_device { uint32_t class; /** Interrupt number */ uint8_t irq; - /** Bus, device, and function (bus:dev.fn) number */ - uint16_t busdevfn; + /** Segment, bus, device, and function (bus:dev.fn) number */ + uint32_t busdevfn; /** Driver for this device */ struct pci_driver *driver; /** Driver-private data @@ -241,11 +241,13 @@ struct pci_driver { /** Declare a fallback PCI driver */ #define __pci_driver_fallback __table_entry ( PCI_DRIVERS, 02 ) +#define PCI_SEG( busdevfn ) ( ( (busdevfn) >> 16 ) & 0xffff ) #define PCI_BUS( busdevfn ) ( ( (busdevfn) >> 8 ) & 0xff ) #define PCI_SLOT( busdevfn ) ( ( (busdevfn) >> 3 ) & 0x1f ) #define PCI_FUNC( busdevfn ) ( ( (busdevfn) >> 0 ) & 0x07 ) -#define PCI_BUSDEVFN( bus, slot, func ) \ - ( ( (bus) << 8 ) | ( (slot) << 3 ) | ( (func) << 0 ) ) +#define PCI_BUSDEVFN( segment, bus, slot, func ) \ + ( ( (segment) << 16 ) | ( (bus) << 8 ) | \ + ( (slot) << 3 ) | ( (func) << 0 ) ) #define PCI_FIRST_FUNC( busdevfn ) ( (busdevfn) & ~0x07 ) #define PCI_LAST_FUNC( busdevfn ) ( (busdevfn) | 0x07 ) @@ -271,12 +273,12 @@ struct pci_driver { PCI_ID( _vendor, _device, _name, _description, _data ) /** PCI device debug message format */ -#define PCI_FMT "PCI %02x:%02x.%x" +#define PCI_FMT "%04x:%02x:%02x.%x" /** PCI device debug message arguments */ #define PCI_ARGS( pci ) \ - PCI_BUS ( (pci)->busdevfn ), PCI_SLOT ( (pci)->busdevfn ), \ - PCI_FUNC ( (pci)->busdevfn ) + PCI_SEG ( (pci)->busdevfn ), PCI_BUS ( (pci)->busdevfn ), \ + PCI_SLOT ( (pci)->busdevfn ), PCI_FUNC ( (pci)->busdevfn ) extern void adjust_pci_device ( struct pci_device *pci ); extern unsigned long pci_bar_start ( struct pci_device *pci, |
