[RFC PATCH 10/31] event: add events to notify memory map changes

Sughosh Ganu sughosh.ganu at linaro.org
Fri Jun 7 20:52:19 CEST 2024


Add events which would be used for notifying changes in the respective
modules' memory map. This is to be used for having a synchronous view
of the memory that is currently in use, and that is available for
allocations.

Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
---
 common/event.c  |  4 ++++
 include/event.h | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/common/event.c b/common/event.c
index 16c2ba6cc9..067ee9ee4e 100644
--- a/common/event.c
+++ b/common/event.c
@@ -48,6 +48,10 @@ const char *const type_name[] = {
 
 	/* main loop events */
 	"main_loop",
+
+	"lmb_map_update",
+
+	"efi_map_update",
 };
 
 _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
diff --git a/include/event.h b/include/event.h
index fb353ad623..9d8be7a103 100644
--- a/include/event.h
+++ b/include/event.h
@@ -153,6 +153,22 @@ enum event_t {
 	 */
 	EVT_MAIN_LOOP,
 
+	/**
+	 * @EVT_LMB_MAP_UPDATE:
+	 * This event is triggered on an update to the LMB reserved memory
+	 * region. This can be used to notify about any LMB memory allocation
+	 * or freeing of memory having occurred.
+	 */
+	EVT_LMB_MAP_UPDATE,
+
+	/**
+	 * @EVT_EFI_MEM_MAP_UPDATE:
+	 * This event is triggered on an update to the EFI  memory map.
+	 * This can be used to notify about any EFI memory allocation
+	 * or freeing of memory having occurred.
+	 */
+	EVT_EFI_MEM_MAP_UPDATE,
+
 	/**
 	 * @EVT_COUNT:
 	 * This constants holds the maximum event number + 1 and is used when
@@ -203,6 +219,18 @@ union event_data {
 		oftree tree;
 		struct bootm_headers *images;
 	} ft_fixup;
+
+	struct event_lmb_map_update {
+		u64 base;
+		u64 size;
+		u8 op;
+	} lmb_map;
+
+	struct event_efi_mem_map_update {
+		u64 base;
+		u64 size;
+		u8  op;
+	} efi_mem_map;
 };
 
 /**
-- 
2.34.1



More information about the U-Boot mailing list