[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

@@ -175,7 +175,7 @@ void adjust_pci_device ( struct pci_device *pci ) {
* @ret rc Return status code
*/
int pci_read_config ( struct pci_device *pci ) {
uint16_t busdevfn;
uint32_t busdevfn;
uint8_t hdrtype;
uint32_t tmp;
@@ -203,8 +203,8 @@ int pci_read_config ( struct pci_device *pci ) {
pci_read_bases ( pci );
/* Initialise generic device component */
snprintf ( pci->dev.name, sizeof ( pci->dev.name ),
"PCI%02x:%02x.%x", PCI_BUS ( pci->busdevfn ),
snprintf ( pci->dev.name, sizeof ( pci->dev.name ), "%04x:%02x:%02x.%x",
PCI_SEG ( pci->busdevfn ), PCI_BUS ( pci->busdevfn ),
PCI_SLOT ( pci->busdevfn ), PCI_FUNC ( pci->busdevfn ) );
pci->dev.desc.bus_type = BUS_TYPE_PCI;
pci->dev.desc.location = pci->busdevfn;
@@ -232,7 +232,7 @@ int pci_find_next ( struct pci_device *pci, unsigned int busdevfn ) {
/* Determine number of PCI buses */
if ( ! end )
end = PCI_BUSDEVFN ( pci_num_bus(), 0, 0 );
end = PCI_BUSDEVFN ( 0, pci_num_bus(), 0, 0 );
/* Find next PCI device, if any */
for ( ; busdevfn < end ; busdevfn++ ) {

View File

@@ -70,7 +70,7 @@ static int pci_settings_fetch ( struct settings *settings __unused,
unsigned int i;
/* Extract busdevfn, offset, and length from tag */
tag_busdevfn = ( ( setting->tag >> 16 ) & 0xffff );
tag_busdevfn = ( setting->tag >> 16 );
tag_offset = ( ( setting->tag >> 8 ) & 0xff );
tag_len = ( ( setting->tag >> 0 ) & 0xff );