mirror of
https://github.com/ipxe/ipxe
synced 2026-01-22 12:08:58 +03:00
[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:
@@ -139,10 +139,11 @@ PCIAPI_INLINE ( ecam, pci_ioremap ) ( struct pci_device *pci __unused,
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @v pci PCI device
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
static inline __always_inline int
|
||||
PCIAPI_INLINE ( ecam, pci_can_probe ) ( void ) {
|
||||
PCIAPI_INLINE ( ecam, pci_can_probe ) ( struct pci_device *pci __unused ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,10 +35,11 @@ extern int efipci_write ( struct pci_device *pci, unsigned long location,
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @v pci PCI device
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
static inline __always_inline int
|
||||
PCIAPI_INLINE ( efi, pci_can_probe ) ( void ) {
|
||||
PCIAPI_INLINE ( efi, pci_can_probe ) ( struct pci_device *pci __unused ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,11 @@ extern int linux_pci_write ( struct pci_device *pci, unsigned long where,
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @v pci PCI device
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
static inline __always_inline int
|
||||
PCIAPI_INLINE ( linux, pci_can_probe ) ( void ) {
|
||||
PCIAPI_INLINE ( linux, pci_can_probe ) ( struct pci_device *pci __unused ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,11 @@ struct pci_device;
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @v pci PCI device
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
static inline __always_inline int
|
||||
PCIAPI_INLINE ( null, pci_can_probe ) ( void ) {
|
||||
PCIAPI_INLINE ( null, pci_can_probe ) ( struct pci_device *pci __unused ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,10 @@ struct pci_range {
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @v pci PCI device
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
int pci_can_probe ( void );
|
||||
int pci_can_probe ( struct pci_device *pci );
|
||||
|
||||
/**
|
||||
* Find next PCI bus:dev.fn address range in system
|
||||
@@ -163,6 +164,7 @@ void * pci_ioremap ( struct pci_device *pci, unsigned long bus_addr,
|
||||
/** A runtime selectable PCI I/O API */
|
||||
struct pci_api {
|
||||
const char *name;
|
||||
typeof ( pci_can_probe ) ( * pci_can_probe );
|
||||
typeof ( pci_discover ) ( * pci_discover );
|
||||
typeof ( pci_read_config_byte ) ( * pci_read_config_byte );
|
||||
typeof ( pci_read_config_word ) ( * pci_read_config_word );
|
||||
@@ -198,6 +200,7 @@ struct pci_api {
|
||||
#define PROVIDE_PCIAPI_RUNTIME( subsys, priority ) \
|
||||
struct pci_api pciapi_ ## subsys __pci_api ( priority ) = { \
|
||||
.name = #subsys, \
|
||||
.pci_can_probe = PCIAPI_INLINE ( subsys, pci_can_probe ), \
|
||||
.pci_discover = PCIAPI_INLINE ( subsys, pci_discover ), \
|
||||
.pci_read_config_byte = \
|
||||
PCIAPI_INLINE ( subsys, pci_read_config_byte ), \
|
||||
|
||||
@@ -15,14 +15,4 @@ 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 */
|
||||
|
||||
Reference in New Issue
Block a user