[PATCH v2 2/3] event: Introduce EVT_POST_PREBOOT event
Simon Glass
sjg at chromium.org
Thu Mar 19 23:09:02 CET 2026
On Wed, 18 Mar 2026 at 07:25, Michal Simek <michal.simek at amd.com> wrote:
>
> Add a new EVT_POST_PREBOOT event type which is fired in main_loop()
> after the preboot command has been executed.
>
> Signed-off-by: Michal Simek <michal.simek at amd.com>
> ---
>
> Changes in v2:
> - check return value
>
> common/main.c | 4 ++++
> include/event.h | 9 +++++++++
> 2 files changed, 13 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
>
> diff --git a/common/main.c b/common/main.c
> index b0b6e74f5d3d..4b4504557f6e 100644
> --- a/common/main.c
> +++ b/common/main.c
> @@ -19,6 +19,7 @@
> #include <net.h>
> #include <version_string.h>
> #include <efi_loader.h>
> +#include <event.h>
>
> static void run_preboot_environment_command(void)
> {
> @@ -53,6 +54,9 @@ void main_loop(void)
> if (IS_ENABLED(CONFIG_USE_PREBOOT))
> run_preboot_environment_command();
>
> + if (event_notify_null(EVT_POST_PREBOOT))
> + return;
> +
> if (IS_ENABLED(CONFIG_UPDATE_TFTP))
> update_tftp(0UL, NULL, NULL);
>
> diff --git a/include/event.h b/include/event.h
> index 1d267f1d1054..3ce5f992b04e 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -153,6 +153,15 @@ enum event_t {
> */
> EVT_MAIN_LOOP,
>
> + /**
> + * @EVT_POST_PREBOOT:
> + * This event is triggered in main_loop() after the preboot command
> + * has run, so that devices initialised by preboot (e.g. USB, UFS)
> + * are available to event handlers. Its parameter is NULL.
> + * A non-zero return value causes the boot to fail.
> + */
> + EVT_POST_PREBOOT,
> +
> /**
> * @EVT_OF_LIVE_BUILT:
> * This event is triggered immediately after the live device tree has been
> --
> 2.43.0
>
More information about the U-Boot
mailing list