[PATCH 2/2] zynqmp: Run board_get_usable_ram_top() only on main U-Boot

Michal Simek michal.simek at xilinx.com
Fri Jan 14 13:14:22 CET 2022


From: Ashok Reddy Soma <ashok.reddy.soma at xilinx.com>

With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.

Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma at xilinx.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

 board/xilinx/zynqmp/zynqmp.c | 3 +++
 boot/image-board.c           | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 2b5239ccb475..c69fb939a83e 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -483,6 +483,7 @@ int dram_init(void)
 	return 0;
 }
 
+#if defined(CONFIG_LMB)
 ulong board_get_usable_ram_top(ulong total_size)
 {
 	phys_size_t size;
@@ -504,6 +505,8 @@ ulong board_get_usable_ram_top(ulong total_size)
 
 	return reg + size;
 }
+#endif
+
 #else
 int dram_init_banksize(void)
 {
diff --git a/boot/image-board.c b/boot/image-board.c
index bf8817165cab..9cdfbc44154c 100644
--- a/boot/image-board.c
+++ b/boot/image-board.c
@@ -546,6 +546,7 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
 	return 0;
 }
 
+#if defined(CONFIG_LMB)
 /**
  * boot_ramdisk_high - relocate init ramdisk
  * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -639,6 +640,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
 error:
 	return -1;
 }
+#endif
 
 int boot_get_setup(bootm_headers_t *images, u8 arch,
 		   ulong *setup_start, ulong *setup_len)
@@ -832,6 +834,7 @@ int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
 	return 0;
 }
 
+#if defined(CONFIG_LMB)
 /**
  * boot_get_cmdline - allocate and initialize kernel cmdline
  * @lmb: pointer to lmb handle, will be used for memory mgmt
@@ -939,6 +942,7 @@ int image_setup_linux(bootm_headers_t *images)
 
 	return 0;
 }
+#endif
 
 void genimg_print_size(uint32_t size)
 {
-- 
2.34.1



More information about the U-Boot mailing list