diff options
| author | Michal Simek <[email protected]> | 2026-04-02 17:36:59 +0200 |
|---|---|---|
| committer | Heinrich Schuchardt <[email protected]> | 2026-04-17 08:02:42 +0200 |
| commit | fc36b91243393d73d4507ca5d50f7231011a7fe0 (patch) | |
| tree | fb3292ab7e711cdd4cc78d8a2118b12761c89e13 | |
| parent | 583efb5040587f06bab5f5d3eb321186c3a39fe4 (diff) | |
event: Introduce EVT_POST_PREBOOT event
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 <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Acked-by: Ilias Apalodimas <[email protected]>
| -rw-r--r-- | common/event.c | 3 | ||||
| -rw-r--r-- | common/main.c | 4 | ||||
| -rw-r--r-- | include/event.h | 9 |
3 files changed, 16 insertions, 0 deletions
diff --git a/common/event.c b/common/event.c index 8d7513eb10b..398e713d2f8 100644 --- a/common/event.c +++ b/common/event.c @@ -49,6 +49,9 @@ const char *const type_name[] = { /* main loop events */ "main_loop", + /* post preboot events */ + "post_preboot", + /* livetree has been built */ "of_live_init", }; diff --git a/common/main.c b/common/main.c index b0b6e74f5d3..4b4504557f6 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 1d267f1d105..3ce5f992b04 100644 --- a/include/event.h +++ b/include/event.h @@ -154,6 +154,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 * built. This allows for machine specific fixups to be done to the live tree |
