summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/interface/pcbios/pcicloud.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/interface/pcbios/pcicloud.c')
-rw-r--r--src/arch/x86/interface/pcbios/pcicloud.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/arch/x86/interface/pcbios/pcicloud.c b/src/arch/x86/interface/pcbios/pcicloud.c
index 97d7cac1..98ba38b3 100644
--- a/src/arch/x86/interface/pcbios/pcicloud.c
+++ b/src/arch/x86/interface/pcbios/pcicloud.c
@@ -165,24 +165,27 @@ static void pcicloud_init ( void ) {
static struct pci_api *apis[] = {
&ecam_api, &pcibios_api, &pcidirect_api
};
- struct pci_range range;
+ struct pci_device pci;
+ uint32_t busdevfn;
unsigned int i;
+ int rc;
- /* Select first API that successfully discovers an address range */
+ /* Select first API that successfully discovers a PCI device */
for ( i = 0 ; i < ( sizeof ( apis ) / sizeof ( apis[0] ) ) ; i++ ) {
pcicloud = apis[i];
- pcicloud_discover ( 0, &range );
- if ( range.count != 0 ) {
- DBGC ( pcicloud, "PCICLOUD selected %s API\n",
- pcicloud->name );
- break;
+ busdevfn = 0;
+ if ( ( rc = pci_find_next ( &pci, &busdevfn ) ) == 0 ) {
+ DBGC ( pcicloud, "PCICLOUD selected %s API (found "
+ PCI_FMT ")\n", pcicloud->name,
+ PCI_ARGS ( &pci ) );
+ return;
}
}
- /* The PCI direct API can never fail discovery since the range
- * is hardcoded.
- */
- assert ( range.count != 0 );
+ /* Fall back to using final attempted API if no devices found */
+ pcicloud = apis[ i - 1 ];
+ DBGC ( pcicloud, "PCICLOUD selected %s API (nothing detected)\n",
+ pcicloud->name );
}
/** Cloud VM PCI configuration space access initialisation function */