aboutsummaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2024-08-15 08:46:41 +0100
committerMichael Brown <mcb30@ipxe.org>2024-08-15 09:31:14 +0100
commit7c82ff0b6b12437bfc25d01d52308fc6fe2e1311 (patch)
treec62f116dedfe6b5a590ac77beee26ec882db335e /src/arch
parent9d9465b140cf59750f97995c501d054d2543c29a (diff)
downloadipxe-7c82ff0b6b12437bfc25d01d52308fc6fe2e1311.tar.gz
[pci] Separate permission to probe buses from bus:dev.fn range discovery
The UEFI device model requires us to not probe the PCI bus directly, but instead to wait to be offered the opportunity to drive devices via our driver service binding handle. We currently inhibit PCI bus probing by having pci_discover() return an empty range when using the EFI PCI I/O API. This has the unwanted side effect that scanning the bus manually using the "pciscan" command will also fail to discover any devices. Separate out the concept of being allowed to probe PCI buses from the mechanism for discovering PCI bus:dev.fn address ranges, so that this limitation may be removed. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/core/pcidirect.c1
-rw-r--r--src/arch/x86/include/ipxe/pcibios.h10
-rw-r--r--src/arch/x86/include/ipxe/pcicloud.h10
-rw-r--r--src/arch/x86/include/ipxe/pcidirect.h10
-rw-r--r--src/arch/x86/interface/pcbios/pcibios.c1
-rw-r--r--src/arch/x86/interface/pcbios/pcicloud.c1
6 files changed, 33 insertions, 0 deletions
diff --git a/src/arch/x86/core/pcidirect.c b/src/arch/x86/core/pcidirect.c
index f4659a1ac..90d4623b3 100644
--- a/src/arch/x86/core/pcidirect.c
+++ b/src/arch/x86/core/pcidirect.c
@@ -45,6 +45,7 @@ void pcidirect_prepare ( struct pci_device *pci, int where ) {
PCIDIRECT_CONFIG_ADDRESS );
}
+PROVIDE_PCIAPI_INLINE ( direct, pci_can_probe );
PROVIDE_PCIAPI_INLINE ( direct, pci_discover );
PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_byte );
PROVIDE_PCIAPI_INLINE ( direct, pci_read_config_word );
diff --git a/src/arch/x86/include/ipxe/pcibios.h b/src/arch/x86/include/ipxe/pcibios.h
index 3caea1cfe..ef9585654 100644
--- a/src/arch/x86/include/ipxe/pcibios.h
+++ b/src/arch/x86/include/ipxe/pcibios.h
@@ -33,6 +33,16 @@ extern int pcibios_write ( struct pci_device *pci, uint32_t command,
uint32_t value );
/**
+ * Check if PCI bus probing is allowed
+ *
+ * @ret ok Bus probing is allowed
+ */
+static inline __always_inline int
+PCIAPI_INLINE ( pcbios, pci_can_probe ) ( void ) {
+ return 1;
+}
+
+/**
* Read byte from PCI configuration space via PCI BIOS
*
* @v pci PCI device
diff --git a/src/arch/x86/include/ipxe/pcicloud.h b/src/arch/x86/include/ipxe/pcicloud.h
index 52268908c..1feef56cb 100644
--- a/src/arch/x86/include/ipxe/pcicloud.h
+++ b/src/arch/x86/include/ipxe/pcicloud.h
@@ -15,4 +15,14 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define PCIAPI_PREFIX_cloud __cloud_
#endif
+/**
+ * Check if PCI bus probing is allowed
+ *
+ * @ret ok Bus probing is allowed
+ */
+static inline __always_inline int
+PCIAPI_INLINE ( cloud, pci_can_probe ) ( void ) {
+ return 1;
+}
+
#endif /* _IPXE_PCICLOUD_H */
diff --git a/src/arch/x86/include/ipxe/pcidirect.h b/src/arch/x86/include/ipxe/pcidirect.h
index 98c6a2bbb..999b52763 100644
--- a/src/arch/x86/include/ipxe/pcidirect.h
+++ b/src/arch/x86/include/ipxe/pcidirect.h
@@ -26,6 +26,16 @@ struct pci_device;
extern void pcidirect_prepare ( struct pci_device *pci, int where );
/**
+ * Check if PCI bus probing is allowed
+ *
+ * @ret ok Bus probing is allowed
+ */
+static inline __always_inline int
+PCIAPI_INLINE ( direct, pci_can_probe ) ( void ) {
+ return 1;
+}
+
+/**
* Find next PCI bus:dev.fn address range in system
*
* @v busdevfn Starting PCI bus:dev.fn address
diff --git a/src/arch/x86/interface/pcbios/pcibios.c b/src/arch/x86/interface/pcbios/pcibios.c
index 7b7a769e3..ebe40ba7d 100644
--- a/src/arch/x86/interface/pcbios/pcibios.c
+++ b/src/arch/x86/interface/pcbios/pcibios.c
@@ -120,6 +120,7 @@ int pcibios_write ( struct pci_device *pci, uint32_t command, uint32_t value ){
return ( status >> 8 );
}
+PROVIDE_PCIAPI_INLINE ( pcbios, pci_can_probe );
PROVIDE_PCIAPI ( pcbios, pci_discover, pcibios_discover );
PROVIDE_PCIAPI_INLINE ( pcbios, pci_read_config_byte );
PROVIDE_PCIAPI_INLINE ( pcbios, pci_read_config_word );
diff --git a/src/arch/x86/interface/pcbios/pcicloud.c b/src/arch/x86/interface/pcbios/pcicloud.c
index 98ba38b31..f7d4a2da1 100644
--- a/src/arch/x86/interface/pcbios/pcicloud.c
+++ b/src/arch/x86/interface/pcbios/pcicloud.c
@@ -148,6 +148,7 @@ static void * pcicloud_ioremap ( struct pci_device *pci,
return pcicloud->pci_ioremap ( pci, bus_addr, len );
}
+PROVIDE_PCIAPI_INLINE ( cloud, pci_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 );