diff mbox series

[v14,08/15] event: Add an event for main_loop

Message ID 20221018114337.439816-9-sughosh.ganu@linaro.org
State Superseded
Headers show
Series FWU: Add FWU Multi Bank Update feature support | expand

Commit Message

Sughosh Ganu Oct. 18, 2022, 11:43 a.m. UTC
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>
---
Changes since V13: None

 common/board_r.c | 3 +++
 common/event.c   | 3 +++
 include/event.h  | 3 +++
 3 files changed, 9 insertions(+)

Comments

Etienne Carriere Oct. 20, 2022, 2:18 p.m. UTC | #1
On Tue, 18 Oct 2022 at 13:44, Sughosh Ganu <sughosh.ganu@linaro.org> wrote:
>
> 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>
> ---
> Changes since V13: None
>

Acked-by: Etienne Carriere <etienne.carriere@linaro.org>


>  common/board_r.c | 3 +++
>  common/event.c   | 3 +++
>  include/event.h  | 3 +++
>  3 files changed, 9 insertions(+)
>
> diff --git a/common/board_r.c b/common/board_r.c
> index 92ca2066ee..62e5e783f1 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 3e34550978..231b9e6ffd 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 3e6dcbc3dd..e4580b6835 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
>  };
>
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 92ca2066ee..62e5e783f1 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 3e34550978..231b9e6ffd 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 3e6dcbc3dd..e4580b6835 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
 };