/**
* Check if PCI bus probing is allowed
*
+ * @v pci PCI device
* @ret ok Bus probing is allowed
*/
static inline __always_inline int
-PCIAPI_INLINE ( pcbios, pci_can_probe ) ( void ) {
+PCIAPI_INLINE ( pcbios, pci_can_probe ) ( struct pci_device *pci __unused ) {
return 1;
}
/**
* Check if PCI bus probing is allowed
*
+ * @v pci PCI device
* @ret ok Bus probing is allowed
*/
static inline __always_inline int
-PCIAPI_INLINE ( direct, pci_can_probe ) ( void ) {
+PCIAPI_INLINE ( direct, pci_can_probe ) ( struct pci_device *pci __unused ) {
return 1;
}
uint32_t busdevfn = 0;
int rc;
- /* Skip automatic probing if prohibited */
- if ( ! pci_can_probe() )
- return 0;
-
do {
/* Allocate struct pci_device */
if ( ! pci )
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 "
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
*
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 );
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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;
}
/**
* 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
/** 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 );
#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 ), \
#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 */