mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
efi_loader: simplify efi_install_protocol_interface
Use helper functio efi_add_protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
3f79a2b532
commit
1202530d22
1 changed files with 2 additions and 36 deletions
|
@ -839,8 +839,6 @@ static efi_status_t EFIAPI efi_install_protocol_interface(
|
||||||
void **handle, const efi_guid_t *protocol,
|
void **handle, const efi_guid_t *protocol,
|
||||||
int protocol_interface_type, void *protocol_interface)
|
int protocol_interface_type, void *protocol_interface)
|
||||||
{
|
{
|
||||||
struct list_head *lhandle;
|
|
||||||
int i;
|
|
||||||
efi_status_t r;
|
efi_status_t r;
|
||||||
|
|
||||||
EFI_ENTRY("%p, %pUl, %d, %p", handle, protocol, protocol_interface_type,
|
EFI_ENTRY("%p, %pUl, %d, %p", handle, protocol, protocol_interface_type,
|
||||||
|
@ -863,40 +861,8 @@ static efi_status_t EFIAPI efi_install_protocol_interface(
|
||||||
debug("%sEFI: handle %p\n", indent_string(nesting_level),
|
debug("%sEFI: handle %p\n", indent_string(nesting_level),
|
||||||
*handle);
|
*handle);
|
||||||
}
|
}
|
||||||
/* Find object. */
|
/* Add new protocol */
|
||||||
list_for_each(lhandle, &efi_obj_list) {
|
r = efi_add_protocol(*handle, protocol, protocol_interface);
|
||||||
struct efi_object *efiobj;
|
|
||||||
efiobj = list_entry(lhandle, struct efi_object, link);
|
|
||||||
|
|
||||||
if (efiobj->handle != *handle)
|
|
||||||
continue;
|
|
||||||
/* Check if protocol is already installed on the handle. */
|
|
||||||
for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {
|
|
||||||
struct efi_handler *handler = &efiobj->protocols[i];
|
|
||||||
|
|
||||||
if (!handler->guid)
|
|
||||||
continue;
|
|
||||||
if (!guidcmp(handler->guid, protocol)) {
|
|
||||||
r = EFI_INVALID_PARAMETER;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Install protocol in first empty slot. */
|
|
||||||
for (i = 0; i < ARRAY_SIZE(efiobj->protocols); i++) {
|
|
||||||
struct efi_handler *handler = &efiobj->protocols[i];
|
|
||||||
|
|
||||||
if (handler->guid)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
handler->guid = protocol;
|
|
||||||
handler->protocol_interface = protocol_interface;
|
|
||||||
r = EFI_SUCCESS;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
r = EFI_OUT_OF_RESOURCES;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
r = EFI_INVALID_PARAMETER;
|
|
||||||
out:
|
out:
|
||||||
return EFI_EXIT(r);
|
return EFI_EXIT(r);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue