[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>
This commit is contained in:
Michael Brown
2016-06-09 09:36:28 +01:00
parent 2c197517f2
commit f76210961c
9 changed files with 160 additions and 42 deletions

View File

@@ -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 */