mirror of
https://git.ipxe.org/ipxe.git
synced 2024-11-23 10:04:11 +08:00
[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>
This commit is contained in:
parent
9d9465b140
commit
7c82ff0b6b
@ -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 );
|
||||
|
@ -32,6 +32,16 @@ extern int pcibios_read ( struct pci_device *pci, uint32_t command,
|
||||
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
|
||||
*
|
||||
|
@ -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 */
|
||||
|
@ -25,6 +25,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
|
||||
*
|
||||
|
@ -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 );
|
||||
|
@ -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 );
|
||||
|
@ -276,6 +276,7 @@ int ecam_write ( struct pci_device *pci, unsigned int location,
|
||||
return 0;
|
||||
}
|
||||
|
||||
PROVIDE_PCIAPI_INLINE ( ecam, pci_can_probe );
|
||||
PROVIDE_PCIAPI ( ecam, pci_discover, ecam_discover );
|
||||
PROVIDE_PCIAPI_INLINE ( ecam, pci_read_config_byte );
|
||||
PROVIDE_PCIAPI_INLINE ( ecam, pci_read_config_word );
|
||||
|
@ -361,6 +361,10 @@ 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 )
|
||||
|
@ -54,6 +54,16 @@ struct ecam_mapping {
|
||||
int rc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
static inline __always_inline int
|
||||
PCIAPI_INLINE ( ecam, pci_can_probe ) ( void ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
extern struct pci_api ecam_api;
|
||||
|
||||
#endif /* _IPXE_ECAM_H */
|
||||
|
@ -32,6 +32,16 @@ extern int efipci_read ( struct pci_device *pci, unsigned long location,
|
||||
extern int efipci_write ( struct pci_device *pci, unsigned long location,
|
||||
unsigned long value );
|
||||
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
static inline __always_inline int
|
||||
PCIAPI_INLINE ( efi, pci_can_probe ) ( void ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find next PCI bus:dev.fn address range in system
|
||||
*
|
||||
|
@ -22,6 +22,16 @@ extern int linux_pci_read ( struct pci_device *pci, unsigned long where,
|
||||
extern int linux_pci_write ( struct pci_device *pci, unsigned long where,
|
||||
unsigned long value, size_t len );
|
||||
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
static inline __always_inline int
|
||||
PCIAPI_INLINE ( linux, pci_can_probe ) ( void ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find next PCI bus:dev.fn address range in system
|
||||
*
|
||||
|
@ -66,6 +66,13 @@ struct pci_range {
|
||||
/* Include all architecture-dependent I/O API headers */
|
||||
#include <bits/pci_io.h>
|
||||
|
||||
/**
|
||||
* Check if PCI bus probing is allowed
|
||||
*
|
||||
* @ret ok Bus probing is allowed
|
||||
*/
|
||||
int pci_can_probe ( void );
|
||||
|
||||
/**
|
||||
* Find next PCI bus:dev.fn address range in system
|
||||
*
|
||||
|
@ -362,6 +362,7 @@ void * efipci_ioremap ( struct pci_device *pci, unsigned long bus_addr,
|
||||
return ioremap ( bus_addr, len );
|
||||
}
|
||||
|
||||
PROVIDE_PCIAPI_INLINE ( efi, pci_can_probe );
|
||||
PROVIDE_PCIAPI_INLINE ( efi, pci_discover );
|
||||
PROVIDE_PCIAPI_INLINE ( efi, pci_read_config_byte );
|
||||
PROVIDE_PCIAPI_INLINE ( efi, pci_read_config_word );
|
||||
|
@ -188,6 +188,7 @@ int linux_pci_write ( struct pci_device *pci, unsigned long where,
|
||||
return rc;
|
||||
}
|
||||
|
||||
PROVIDE_PCIAPI_INLINE ( linux, pci_can_probe );
|
||||
PROVIDE_PCIAPI_INLINE ( linux, pci_discover );
|
||||
PROVIDE_PCIAPI_INLINE ( linux, pci_read_config_byte );
|
||||
PROVIDE_PCIAPI_INLINE ( linux, pci_read_config_word );
|
||||
|
Loading…
Reference in New Issue
Block a user