
From: Simon Glass <sjg@chromium.org> In some cases a board may wish to do some final processing before starting the OS. An example is the EFI app, which may wish to call exit-boot-services. Add an event to permit this. Signed-off-by: Simon Glass <sjg@chromium.org> --- boot/bootm_final.c | 10 ++++++++++ common/event.c | 1 + include/event.h | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/boot/bootm_final.c b/boot/bootm_final.c index 79ec35e23b0..7594880399e 100644 --- a/boot/bootm_final.c +++ b/boot/bootm_final.c @@ -7,6 +7,7 @@ #include <bootm.h> #include <bootstage.h> +#include <event.h> #include <usb.h> #include <dm/root.h> @@ -16,6 +17,8 @@ __weak void board_quiesce_devices(void) void bootm_final(enum bootm_final_t flags) { + int ret; + printf("\nStarting kernel ...%s\n\n", flags & BOOTM_FINAL_FAKE ? "(fake run for tracing)" : ""); @@ -40,6 +43,13 @@ void bootm_final(enum bootm_final_t flags) */ dm_remove_devices_active(); + ret = event_notify_null(EVT_BOOTM_FINAL); + if (ret) { + printf("Event handler failed to finalise (err %dE\n", + ret); + return; + } + bootm_disable_interrupts(); if (!(flags & BOOTM_FINAL_NO_CLEANUP)) diff --git a/common/event.c b/common/event.c index 26c96210c50..a48ca6c549d 100644 --- a/common/event.c +++ b/common/event.c @@ -52,6 +52,7 @@ const char *const type_name[] = { /* booting */ "boot_os_addr", + "bootm_final", }; _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size"); diff --git a/include/event.h b/include/event.h index e12a140152a..67b5bdd8a8b 100644 --- a/include/event.h +++ b/include/event.h @@ -179,6 +179,14 @@ enum event_t { */ EVT_BOOT_OS_ADDR, + /** + * @EVT_BOOTM_FINAL: + * Triggered after any required device-removals are complete, bootstage + * report is shown, etc. and before any machine-specific poking, such as + * disabling interrupts, changing exception level + */ + EVT_BOOTM_FINAL, + /** * @EVT_COUNT: * This constants holds the maximum event number + 1 and is used when -- 2.43.0