aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_boottime.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2017-11-26 14:05:15 +0100
committerAlexander Graf <agraf@suse.de>2017-12-01 13:37:06 +0100
commit80286e8f811341e6054a85b69e2573a778ba42cf (patch)
tree59655b12cb24e8f214b6a08c998b0b4743e83fbf /lib/efi_loader/efi_boottime.c
parent9449358a71b7dfd96ed9f3fbd276d4a19daef1b5 (diff)
downloadu-boot-80286e8f811341e6054a85b69e2573a778ba42cf.zip
u-boot-80286e8f811341e6054a85b69e2573a778ba42cf.tar.gz
u-boot-80286e8f811341e6054a85b69e2573a778ba42cf.tar.bz2
efi_loader: simplify efi_open_protocol
Use function efi_search_protocol. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader/efi_boottime.c')
-rw-r--r--lib/efi_loader/efi_boottime.c36
1 files changed, 6 insertions, 30 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 565addf..4cc5b1e 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2051,8 +2051,7 @@ static efi_status_t EFIAPI efi_open_protocol(
void **protocol_interface, void *agent_handle,
void *controller_handle, uint32_t attributes)
{
- struct list_head *lhandle;
- int i;
+ struct efi_handler *handler;
efi_status_t r = EFI_INVALID_PARAMETER;
EFI_ENTRY("%p, %pUl, %p, %p, %p, 0x%x", handle, protocol,
@@ -2065,8 +2064,6 @@ static efi_status_t EFIAPI efi_open_protocol(
goto out;
}
- EFI_PRINT_GUID("protocol", protocol);
-
switch (attributes) {
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
case EFI_OPEN_PROTOCOL_GET_PROTOCOL:
@@ -2087,33 +2084,12 @@ static efi_status_t EFIAPI efi_open_protocol(
goto out;
}
- list_for_each(lhandle, &efi_obj_list) {
- struct efi_object *efiobj;
- efiobj = list_entry(lhandle, struct efi_object, link);
-
- if (efiobj->handle != handle)
- continue;
-
- for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {
- struct efi_handler *handler = &efiobj->protocols[i];
- const efi_guid_t *hprotocol = handler->guid;
- if (!hprotocol)
- continue;
- if (!guidcmp(hprotocol, protocol)) {
- if (attributes !=
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL) {
- *protocol_interface =
- handler->protocol_interface;
- }
- r = EFI_SUCCESS;
- goto out;
- }
- }
- goto unsupported;
- }
+ r = efi_search_protocol(handle, protocol, &handler);
+ if (r != EFI_SUCCESS)
+ goto out;
-unsupported:
- r = EFI_UNSUPPORTED;
+ if (attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL)
+ *protocol_interface = handler->protocol_interface;
out:
return EFI_EXIT(r);
}