mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-30 23:21:27 +01:00
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>
This commit is contained in:
parent
9449358a71
commit
80286e8f81
@ -2051,8 +2051,7 @@ static efi_status_t EFIAPI efi_open_protocol(
|
|||||||
void **protocol_interface, void *agent_handle,
|
void **protocol_interface, void *agent_handle,
|
||||||
void *controller_handle, uint32_t attributes)
|
void *controller_handle, uint32_t attributes)
|
||||||
{
|
{
|
||||||
struct list_head *lhandle;
|
struct efi_handler *handler;
|
||||||
int i;
|
|
||||||
efi_status_t r = EFI_INVALID_PARAMETER;
|
efi_status_t r = EFI_INVALID_PARAMETER;
|
||||||
|
|
||||||
EFI_ENTRY("%p, %pUl, %p, %p, %p, 0x%x", handle, protocol,
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
EFI_PRINT_GUID("protocol", protocol);
|
|
||||||
|
|
||||||
switch (attributes) {
|
switch (attributes) {
|
||||||
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
|
case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
|
||||||
case EFI_OPEN_PROTOCOL_GET_PROTOCOL:
|
case EFI_OPEN_PROTOCOL_GET_PROTOCOL:
|
||||||
@ -2087,33 +2084,12 @@ static efi_status_t EFIAPI efi_open_protocol(
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
list_for_each(lhandle, &efi_obj_list) {
|
r = efi_search_protocol(handle, protocol, &handler);
|
||||||
struct efi_object *efiobj;
|
if (r != EFI_SUCCESS)
|
||||||
efiobj = list_entry(lhandle, struct efi_object, link);
|
goto out;
|
||||||
|
|
||||||
if (efiobj->handle != handle)
|
if (attributes != EFI_OPEN_PROTOCOL_TEST_PROTOCOL)
|
||||||
continue;
|
*protocol_interface = handler->protocol_interface;
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsupported:
|
|
||||||
r = EFI_UNSUPPORTED;
|
|
||||||
out:
|
out:
|
||||||
return EFI_EXIT(r);
|
return EFI_EXIT(r);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user