summaryrefslogtreecommitdiffstats
path: root/src/interface/efi/efi_bofm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interface/efi/efi_bofm.c')
-rw-r--r--src/interface/efi/efi_bofm.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/interface/efi/efi_bofm.c b/src/interface/efi/efi_bofm.c
index 15f3837cc..3d956800e 100644
--- a/src/interface/efi/efi_bofm.c
+++ b/src/interface/efi/efi_bofm.c
@@ -23,6 +23,7 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+#include <string.h>
#include <errno.h>
#include <ipxe/bofm.h>
#include <ipxe/efi/efi.h>
@@ -232,10 +233,20 @@ static int efi_bofm_start ( struct efi_device *efidev ) {
EFI_STATUS efirc;
int rc;
- /* Open PCI device, if possible */
- if ( ( rc = efipci_open ( device, EFI_OPEN_PROTOCOL_GET_PROTOCOL,
- &efipci ) ) != 0 )
+ /* Get PCI device information */
+ if ( ( rc = efipci_info ( device, &efipci ) ) != 0 ) {
+ DBGC ( device, "EFIBOFM %s cannot get PCI information: %s\n",
+ efi_handle_name ( device ), strerror ( rc ) );
+ goto err_info;
+ }
+
+ /* Open PCI I/O protocol */
+ if ( ( rc = efi_open_unsafe ( device, &efi_pci_io_protocol_guid,
+ &efipci.io ) ) != 0 ) {
+ DBGC ( device, "EFIBOFM %s cannot open PCI device: %s\n",
+ efi_handle_name ( device ), strerror ( rc ) );
goto err_open;
+ }
/* Locate BOFM protocol */
if ( ( efirc = bs->LocateProtocol ( &bofm1_protocol_guid, NULL,
@@ -274,8 +285,7 @@ static int efi_bofm_start ( struct efi_device *efidev ) {
efi_handle_name ( device ) );
DBGC2_HD ( device, bofmtab2, bofmtab2->Parameters.Length );
}
- bofmrc = bofm ( virt_to_user ( bofmtab2 ? bofmtab2 : bofmtab ),
- &efipci.pci );
+ bofmrc = bofm ( ( bofmtab2 ? bofmtab2 : bofmtab ), &efipci.pci );
DBGC ( device, "EFIBOFM %s status %08x\n",
efi_handle_name ( device ), bofmrc );
DBGC2 ( device, "EFIBOFM %s version 1 after processing:\n",
@@ -313,8 +323,9 @@ static int efi_bofm_start ( struct efi_device *efidev ) {
err_set_status:
err_locate_bofm:
- efipci_close ( device );
+ efi_close_unsafe ( device, &efi_pci_io_protocol_guid );
err_open:
+ err_info:
return rc;
}