Skip to content

Commit

Permalink
efi_loader: don't use HandleProtocol
Browse files Browse the repository at this point in the history
HandleProtocol() is deprecrated. According to the UEFI specification it
should be implemented as a call to  OpenProtocolInterface() with a hard
coded agent handle. This implies that we would have to call
CloseProtocolInterfaces() after usage with the same handle.

Getting rid of an EFI_CALL() is also appreciated.

Signed-off-by: Heinrich Schuchardt <[email protected]>
Acked-by: Ilias Apalodimas <[email protected]>
  • Loading branch information
xypron committed Jan 27, 2023
1 parent 23aa050 commit 15436fa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/efi_loader/efi_boottime.c
Original file line number Diff line number Diff line change
Expand Up @@ -1949,6 +1949,7 @@ efi_status_t efi_load_image_from_path(bool boot_policy,
efi_uintn_t buffer_size;
uint64_t addr, pages;
const efi_guid_t *guid;
struct efi_handler *handler;

/* In case of failure nothing is returned */
*buffer = NULL;
Expand All @@ -1970,11 +1971,11 @@ efi_status_t efi_load_image_from_path(bool boot_policy,
}
if (ret != EFI_SUCCESS)
return EFI_NOT_FOUND;
ret = EFI_CALL(efi_handle_protocol(device, guid,
(void **)&load_file_protocol));
ret = efi_search_protocol(device, guid, &handler);
if (ret != EFI_SUCCESS)
return EFI_NOT_FOUND;
buffer_size = 0;
load_file_protocol = handler->protocol_interface;
ret = EFI_CALL(load_file_protocol->load_file(
load_file_protocol, rem, boot_policy,
&buffer_size, NULL));
Expand Down

0 comments on commit 15436fa

Please sign in to comment.