[efi] Make EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL optional
Some UEFI systems (observed with a Hyper-V virtual machine) do not provide EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. Make this an optional protocol (and fail any attempts to access PCI configuration space via the root bridge if the protocol is missing). Reported-by: Colin Blacker <Colin.Blacker@computerplanet.co.uk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
parent
f94d651632
commit
3bb910caa8
|
@ -59,7 +59,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
|
|
||||||
/** PCI root bridge I/O protocol */
|
/** PCI root bridge I/O protocol */
|
||||||
static EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *efipci;
|
static EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *efipci;
|
||||||
EFI_REQUIRE_PROTOCOL ( EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL, &efipci );
|
EFI_REQUEST_PROTOCOL ( EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL, &efipci );
|
||||||
|
|
||||||
static unsigned long efipci_address ( struct pci_device *pci,
|
static unsigned long efipci_address ( struct pci_device *pci,
|
||||||
unsigned long location ) {
|
unsigned long location ) {
|
||||||
|
@ -74,6 +74,9 @@ int efipci_read ( struct pci_device *pci, unsigned long location,
|
||||||
EFI_STATUS efirc;
|
EFI_STATUS efirc;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if ( ! efipci )
|
||||||
|
return -ENOTSUP;
|
||||||
|
|
||||||
if ( ( efirc = efipci->Pci.Read ( efipci, EFIPCI_WIDTH ( location ),
|
if ( ( efirc = efipci->Pci.Read ( efipci, EFIPCI_WIDTH ( location ),
|
||||||
efipci_address ( pci, location ), 1,
|
efipci_address ( pci, location ), 1,
|
||||||
value ) ) != 0 ) {
|
value ) ) != 0 ) {
|
||||||
|
@ -92,6 +95,9 @@ int efipci_write ( struct pci_device *pci, unsigned long location,
|
||||||
EFI_STATUS efirc;
|
EFI_STATUS efirc;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
if ( ! efipci )
|
||||||
|
return -ENOTSUP;
|
||||||
|
|
||||||
if ( ( efirc = efipci->Pci.Write ( efipci, EFIPCI_WIDTH ( location ),
|
if ( ( efirc = efipci->Pci.Write ( efipci, EFIPCI_WIDTH ( location ),
|
||||||
efipci_address ( pci, location ), 1,
|
efipci_address ( pci, location ), 1,
|
||||||
&value ) ) != 0 ) {
|
&value ) ) != 0 ) {
|
||||||
|
|
Reference in New Issue