[pci] Allow probing permission to vary by range

Make pci_can_probe() part of the runtime selectable PCI I/O API, and
defer this check to the per-range API.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-11-24 23:09:53 +00:00
parent ff1a17dc7e
commit 9c1ac48bcf
10 changed files with 33 additions and 22 deletions
+4 -4
View File
@@ -447,10 +447,6 @@ static int pcibus_probe ( struct root_device *rootdev ) {
uint32_t busdevfn = 0;
int rc;
/* Skip automatic probing if prohibited */
if ( ! pci_can_probe() )
return 0;
do {
/* Allocate struct pci_device */
if ( ! pci )
@@ -464,6 +460,10 @@ static int pcibus_probe ( struct root_device *rootdev ) {
if ( ( rc = pci_find_next ( pci, &busdevfn ) ) != 0 )
break;
/* Skip automatic probing if prohibited */
if ( ! pci_can_probe ( pci ) )
continue;
/* Look for a driver */
if ( ( rc = pci_find_driver ( pci ) ) != 0 ) {
DBGC ( pci, PCI_FMT " (%04x:%04x class %06x) has no "
+13 -1
View File
@@ -142,6 +142,18 @@ static struct pci_api * pcicloud_api ( struct pci_device *pci ) {
return api;
}
/**
* Check if PCI bus probing is allowed
*
* @v pci PCI device
* @ret ok Bus probing is allowed
*/
static int pcicloud_can_probe ( struct pci_device *pci ) {
struct pci_api *api = pcicloud_api ( pci );
return api->pci_can_probe ( pci );
}
/**
* Read byte from PCI configuration space
*
@@ -246,7 +258,7 @@ static void * pcicloud_ioremap ( struct pci_device *pci,
return api->pci_ioremap ( pci, bus_addr, len );
}
PROVIDE_PCIAPI_INLINE ( cloud, pci_can_probe );
PROVIDE_PCIAPI ( cloud, pci_can_probe, pcicloud_can_probe );
PROVIDE_PCIAPI ( cloud, pci_discover, pcicloud_discover );
PROVIDE_PCIAPI ( cloud, pci_read_config_byte, pcicloud_read_config_byte );
PROVIDE_PCIAPI ( cloud, pci_read_config_word, pcicloud_read_config_word );