[PATCH v5 7/9] event: Add a generic way to reserve memory
Simon Glass
sjg at chromium.org
Sun Dec 1 16:28:09 CET 2024
Add an event which allows memory to be reserved, for use after
relocation. This can be used by subsystems which need their own
memory.
This could be used to clean up reserve_arch() but that is left for a
separate series.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
common/board_f.c | 1 +
common/event.c | 1 +
include/event.h | 11 +++++++++++
3 files changed, 13 insertions(+)
diff --git a/common/board_f.c b/common/board_f.c
index 3532ffec46f..0f2ae570174 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -976,6 +976,7 @@ static const init_fnc_t init_sequence_f[] = {
reserve_bootstage,
reserve_bloblist,
reserve_arch,
+ INITCALL_EVENT(EVT_RESERVE),
reserve_stacks,
dram_init_banksize,
show_dram_config,
diff --git a/common/event.c b/common/event.c
index dda569d4478..b7da027094b 100644
--- a/common/event.c
+++ b/common/event.c
@@ -37,6 +37,7 @@ const char *const type_name[] = {
/* init hooks */
"misc_init_f",
"fsp_init_r",
+ "reserve",
"settings_r",
"last_stage_init",
diff --git a/include/event.h b/include/event.h
index 75141a192a4..56c05e8e7a4 100644
--- a/include/event.h
+++ b/include/event.h
@@ -104,6 +104,17 @@ enum event_t {
*/
EVT_FSP_INIT_F,
+ /**
+ * @EVT_RESERVE:
+ * This event is trigged after all other reservations are done, just
+ * before the stack is placed. It can be used to reserve memory for any
+ * other purpose. The memory thus reserved is available immediately and
+ * will remain valid after relocation.
+ *
+ * To reserve memory, subtract the required amount of bytes from
+ * gd->start_addr_sp
+ */
+ EVT_RESERVE,
/**
* @EVT_SETTINGS_R:
* This event is triggered post-relocation and before console init.
--
2.43.0
More information about the U-Boot
mailing list