diff options
author | Michael Brown <mcb30@ipxe.org> | 2016-06-09 09:36:28 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2016-06-09 09:36:28 +0100 |
commit | f76210961c76a3f54f673d668e21e30d2eed9612 (patch) | |
tree | df0eb4b64085a587d2df39bcee478a6b320b9c01 /src/core/settings.c | |
parent | 2c197517f2a82970ab6866e197f06a3099418324 (diff) | |
download | ipxe-f76210961c76a3f54f673d668e21e30d2eed9612.zip ipxe-f76210961c76a3f54f673d668e21e30d2eed9612.tar.gz ipxe-f76210961c76a3f54f673d668e21e30d2eed9612.tar.bz2 |
[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/core/settings.c')
-rw-r--r-- | src/core/settings.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/settings.c b/src/core/settings.c index 7575557..9cae0ca 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -2232,6 +2232,10 @@ static int format_busdevfn_setting ( const struct setting_type *type __unused, const void *raw, size_t raw_len, char *buf, size_t len ) { unsigned long busdevfn; + unsigned int seg; + unsigned int bus; + unsigned int slot; + unsigned int func; int check_len; /* Extract numeric value */ @@ -2240,9 +2244,14 @@ static int format_busdevfn_setting ( const struct setting_type *type __unused, return check_len; assert ( check_len == ( int ) raw_len ); + /* Extract PCI address components */ + seg = PCI_SEG ( busdevfn ); + bus = PCI_BUS ( busdevfn ); + slot = PCI_SLOT ( busdevfn ); + func = PCI_FUNC ( busdevfn ); + /* Format value */ - return snprintf ( buf, len, "%02lx:%02lx.%lx", PCI_BUS ( busdevfn ), - PCI_SLOT ( busdevfn ), PCI_FUNC ( busdevfn ) ); + return snprintf ( buf, len, "%04x:%02x:%02x.%x", seg, bus, slot, func ); } /** PCI bus:dev.fn setting type */ |