aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSughosh Ganu2022-10-21 18:16:01 +0530
committerTom Rini2022-10-31 14:47:32 -0400
commit467bad5e368abfb8bca218b988567799e53f9e03 (patch)
treef6ab1f91224b87fbb07e1a30d9977fc68e77d7f5
parent95b5a7de30f6c2f6c38ac4919442c7d8d6fb86ce (diff)
event: Add an event for main_loop
Add an event type EVT_MAIN_LOOP that can be used for registering events that need to be run after the platform has been initialised and before the main_loop function is called. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
-rw-r--r--common/board_r.c3
-rw-r--r--common/event.c3
-rw-r--r--include/event.h3
3 files changed, 9 insertions, 0 deletions
diff --git a/common/board_r.c b/common/board_r.c
index 98653de0553..828ad448668 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -579,6 +579,9 @@ static int run_main_loop(void)
#ifdef CONFIG_SANDBOX
sandbox_main_loop_init();
#endif
+
+ event_notify_null(EVT_MAIN_LOOP);
+
/* main_loop() can return to retry autoboot, if so just run it again */
for (;;)
main_loop();
diff --git a/common/event.c b/common/event.c
index 3e345509783..231b9e6ffdd 100644
--- a/common/event.c
+++ b/common/event.c
@@ -38,6 +38,9 @@ const char *const type_name[] = {
/* fdt hooks */
"ft_fixup",
+
+ /* main loop events */
+ "main_loop",
};
_Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
diff --git a/include/event.h b/include/event.h
index 3e6dcbc3dd6..e4580b68350 100644
--- a/include/event.h
+++ b/include/event.h
@@ -34,6 +34,9 @@ enum event_t {
/* Device tree fixups before booting */
EVT_FT_FIXUP,
+ /* To be called once, before calling main_loop() */
+ EVT_MAIN_LOOP,
+
EVT_COUNT
};