efi_loader: add return to efibootmgr event group

When the image loaded by efibootmgr returns, efibootmgr
needs to clean the resources. Adding the event of returning
to efibootmgr is useful to simplify the implementation.

Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
Masahisa Kojima 2023-11-10 13:25:39 +09:00 committed by Ilias Apalodimas
parent e23c8e81eb
commit e0d1a1ea68
4 changed files with 20 additions and 0 deletions

View file

@ -356,6 +356,7 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
efi_status_t ret;
efi_uintn_t exit_data_size = 0;
u16 *exit_data = NULL;
struct efi_event *evt;
/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
switch_to_non_secure_mode();
@ -394,6 +395,17 @@ out:
log_err("Failed to remove loadfile2 for initrd\n");
}
/* Notify EFI_EVENT_GROUP_RETURN_TO_EFIBOOTMGR event group. */
list_for_each_entry(evt, &efi_events, link) {
if (evt->group &&
!guidcmp(evt->group,
&efi_guid_event_group_return_to_efibootmgr)) {
efi_signal_event(evt);
EFI_CALL(systab.boottime->close_event(evt));
break;
}
}
/* Control is returned to U-Boot, disable EFI watchdog */
efi_set_watchdog(0);