From f76210961c76a3f54f673d668e21e30d2eed9612 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Thu, 9 Jun 2016 09:36:28 +0100 Subject: [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 --- src/core/settings.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/core') diff --git a/src/core/settings.c b/src/core/settings.c index 757555781..9cae0cae3 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 */ -- cgit v1.2.3-55-g7522