From 27c7a62986b3dd6d44351271d2c0cf59664ce759 Mon Sep 17 00:00:00 2001 From: Chanho Park Date: Fri, 18 Aug 2023 14:11:02 +0900 Subject: [PATCH] dm: event: add EVT_DM_POST_INIT_R event type MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch introduces EVT_DM_POST_INIT_R event type for handling hooks after relocation. Fixes: 55171aedda88 ("dm: Emit the arch_cpu_init_dm() even only before relocation") Suggested-by: Simon Glass Cc: Bin Meng Signed-off-by: Chanho Park Tested-by: Milan P. Stanić Reviewed-by: Simon Glass Tested-by: Roland Ruckerbauer Tested-by: Roland Ruckerbauer Fixed missing event name in event.c: Signed-off-by: Simon Glass --- common/event.c | 1 + drivers/core/root.c | 6 ++++-- include/event.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/common/event.c b/common/event.c index 3224e28122..6653300e6c 100644 --- a/common/event.c +++ b/common/event.c @@ -28,6 +28,7 @@ const char *const type_name[] = { /* Events related to driver model */ "dm_post_init_f", + "dm_post_init_r", "dm_pre_probe", "dm_post_probe", "dm_pre_remove", diff --git a/drivers/core/root.c b/drivers/core/root.c index 6775fb0b65..79d871ab29 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -436,8 +436,10 @@ int dm_init_and_scan(bool pre_reloc_only) return ret; } } - if (CONFIG_IS_ENABLED(DM_EVENT) && !(gd->flags & GD_FLG_RELOC)) { - ret = event_notify_null(EVT_DM_POST_INIT_F); + if (CONFIG_IS_ENABLED(DM_EVENT)) { + ret = event_notify_null(gd->flags & GD_FLG_RELOC ? + EVT_DM_POST_INIT_R : + EVT_DM_POST_INIT_F); if (ret) return log_msg_ret("ev", ret); } diff --git a/include/event.h b/include/event.h index daf44bf8a8..bb38ba98e7 100644 --- a/include/event.h +++ b/include/event.h @@ -24,6 +24,7 @@ enum event_t { /* Events related to driver model */ EVT_DM_POST_INIT_F, + EVT_DM_POST_INIT_R, EVT_DM_PRE_PROBE, EVT_DM_POST_PROBE, EVT_DM_PRE_REMOVE, -- 2.39.5