From e0d1a1ea68c47b29d93bfc375d984fe0aee21093 Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Fri, 10 Nov 2023 13:25:39 +0900 Subject: 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 Reviewed-by: Ilias Apalodimas Signed-off-by: Ilias Apalodimas --- cmd/bootefi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cmd/bootefi.c') diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 20e5c94a33a..4d74969ad62 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -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); -- cgit v1.2.3