summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/interface/efi/efi_pci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/interface/efi/efi_pci.c b/src/interface/efi/efi_pci.c
index 033eae87c..86c781d82 100644
--- a/src/interface/efi/efi_pci.c
+++ b/src/interface/efi/efi_pci.c
@@ -59,7 +59,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/** PCI root bridge I/O protocol */
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,
unsigned long location ) {
@@ -74,6 +74,9 @@ int efipci_read ( struct pci_device *pci, unsigned long location,
EFI_STATUS efirc;
int rc;
+ if ( ! efipci )
+ return -ENOTSUP;
+
if ( ( efirc = efipci->Pci.Read ( efipci, EFIPCI_WIDTH ( location ),
efipci_address ( pci, location ), 1,
value ) ) != 0 ) {
@@ -92,6 +95,9 @@ int efipci_write ( struct pci_device *pci, unsigned long location,
EFI_STATUS efirc;
int rc;
+ if ( ! efipci )
+ return -ENOTSUP;
+
if ( ( efirc = efipci->Pci.Write ( efipci, EFIPCI_WIDTH ( location ),
efipci_address ( pci, location ), 1,
&value ) ) != 0 ) {