]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
event: Introduce EVT_POST_PREBOOT event
authorMichal Simek <michal.simek@amd.com>
Thu, 2 Apr 2026 15:36:59 +0000 (17:36 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 17 Apr 2026 06:02:42 +0000 (08:02 +0200)
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@amd.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
common/event.c
common/main.c
include/event.h

index 8d7513eb10b61919e1e784481dfdcc076be14986..398e713d2f82fc3067635a0a3190b414a826ea8d 100644 (file)
@@ -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",
 };
index b0b6e74f5d3d385df0be498240d9001dfa2c5136..4b4504557f6e07a13b069ac4420c2e6d6d62d9d4 100644 (file)
@@ -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);
 
index 1d267f1d10547642d381fa287ab4981a2bf03543..3ce5f992b04e649ff84743afd851ad915bcf9c0d 100644 (file)
@@ -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