[PATCH 24/35] global_data: Reduce the size of mon_len

Simon Glass sjg at chromium.org
Wed Jul 24 17:09:11 CEST 2024


This is the length of the U-Boot binary, which is typically 200-800KB
and certainly not larger than 4GB. Use a 32-bit value to save space in
global_data and move it up to be with fields of the same alignment.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/board_f.c                  | 4 ++--
 include/asm-generic/global_data.h | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index c99b573bc17..1bd4b790e80 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -339,7 +339,7 @@ __weak int arch_setup_dest_addr(void)
 
 static int setup_dest_addr(void)
 {
-	debug("Monitor len: %08lX\n", gd->mon_len);
+	debug("Monitor len: %08x\n", gd->mon_len);
 	/*
 	 * Ram is setup, size stored in gd !!
 	 */
@@ -476,7 +476,7 @@ static int reserve_uboot(void)
 		gd->relocaddr &= ~(65536 - 1);
 	#endif
 
-		debug("Reserving %ldk for U-Boot at: %08lx\n",
+		debug("Reserving %dk for U-Boot at: %08lx\n",
 		      gd->mon_len >> 10, gd->relocaddr);
 	}
 
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 7910e73e2e3..c8699c9e963 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -70,6 +70,10 @@ struct global_data {
 	 * @mem_clk: memory clock rate in Hz
 	 */
 	unsigned int mem_clk;
+	/**
+	 * @mon_len: monitor length in bytes
+	 */
+	unsigned int mon_len;
 	/**
 	 * @env_addr: address of environment structure
 	 *
@@ -114,10 +118,6 @@ struct global_data {
 	 * @ram_size: RAM size in bytes
 	 */
 	phys_size_t ram_size;
-	/**
-	 * @mon_len: monitor length in bytes
-	 */
-	unsigned long mon_len;
 	/**
 	 * @irq_sp: IRQ stack pointer
 	 */
-- 
2.34.1



More information about the U-Boot mailing list