]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
zynqmp: Run board_get_usable_ram_top() only on main U-Boot
authorAshok Reddy Soma <ashok.reddy.soma@xilinx.com>
Thu, 7 Jul 2022 08:45:37 +0000 (10:45 +0200)
committerMichal Simek <michal.simek@amd.com>
Tue, 26 Jul 2022 06:23:54 +0000 (08:23 +0200)
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@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com
arch/arc/lib/bootm.c
arch/arm/lib/bootm.c
arch/m68k/lib/bootm.c
arch/microblaze/lib/bootm.c
arch/powerpc/lib/bootm.c
arch/riscv/lib/bootm.c
arch/x86/lib/bootm.c
board/xilinx/zynqmp/zynqmp.c
boot/image-board.c

index ed6c5dfa58451568ce98f27cb4c8c25710d1bd85..628addd87ed57343923d1df9af44977f7d41f2d9 100644 (file)
@@ -29,9 +29,11 @@ static int boot_prep_linux(bootm_headers_t *images)
 {
        int ret;
 
-       ret = image_setup_linux(images);
-       if (ret)
-               return ret;
+       if (CONFIG_IS_ENABLED(LMB)) {
+               ret = image_setup_linux(images);
+               if (ret)
+                       return ret;
+       }
 
        return board_prep_linux(images);
 }
index fc22befeac1fb4546743419f8be2b0d3b7b57515..9f086f3b904d1731a592e6eb11c63321f9a6a2b6 100644 (file)
@@ -199,7 +199,7 @@ static void boot_prep_linux(bootm_headers_t *images)
 {
        char *commandline = env_get("bootargs");
 
-       if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) {
+       if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) {
                debug("using: FDT\n");
                if (image_setup_linux(images)) {
                        panic("FDT creation failed!");
index 27729db67e27ab9acb4c126fbf9679678fe48d45..9cade929541f11f61f5b681afc3d6ece0a445b51 100644 (file)
@@ -60,9 +60,11 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
        }
        set_clocks_in_mhz(kbd);
 
-       ret = image_setup_linux(images);
-       if (ret)
-               goto error;
+       if (CONFIG_IS_ENABLED(LMB)) {
+               ret = image_setup_linux(images);
+               if (ret)
+                       goto error;
+       }
 
        kernel = (void (*)(struct bd_info *, ulong, ulong, ulong, ulong))images->ep;
 
index af946b864282b582c92f91ccbcf2ba326c8de440..31b6659cdf75934bfd150b3ba1ea3d8de54cdc79 100644 (file)
@@ -73,7 +73,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag)
 
 static void boot_prep_linux(bootm_headers_t *images)
 {
-       if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) {
+       if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) {
                debug("using: FDT\n");
                if (image_setup_linux(images)) {
                        printf("FDT creation failed! hanging...");
index d365705856dd7b5157433f6d778502b94f5488fd..e52aa75703f3534f2d4beb06a2be1e48ef947cbe 100644 (file)
@@ -214,9 +214,11 @@ static int boot_body_linux(bootm_headers_t *images)
        if (ret)
                return ret;
 
-       ret = image_setup_linux(images);
-       if (ret)
-               return ret;
+       if (CONFIG_IS_ENABLED(LMB)) {
+               ret = image_setup_linux(images);
+               if (ret)
+                       return ret;
+       }
 
        return 0;
 }
index c1ac339283a642ff942b161356fc71b7012e286e..670d9c9ebcfb665b5cf2e791f342695d711d631f 100644 (file)
@@ -64,7 +64,7 @@ static void announce_and_cleanup(int fake)
 
 static void boot_prep_linux(bootm_headers_t *images)
 {
-       if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) {
+       if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) {
                debug("using: FDT\n");
                if (image_setup_linux(images)) {
                        printf("FDT creation failed! hanging...");
index 57cba5c65d3b7554b76111edcf3a060e8c161e04..1bcdb3e30d26292c5085b526b638cf2ea1795809 100644 (file)
@@ -78,15 +78,14 @@ static int boot_prep_linux(bootm_headers_t *images)
        size_t len;
        int ret;
 
-#ifdef CONFIG_OF_LIBFDT
-       if (images->ft_len) {
+       if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) {
                debug("using: FDT\n");
                if (image_setup_linux(images)) {
                        puts("FDT creation failed! hanging...");
                        hang();
                }
        }
-#endif
+
        if (images->legacy_hdr_valid) {
                hdr = images->legacy_hdr_os;
                if (image_check_type(hdr, IH_TYPE_MULTI)) {
index 106c3953e1fca68149267b0d760ccf2b3a04e652..f7c6e3ed4e3f6a3ac3353f2a86f96b14837bf7de 100644 (file)
@@ -253,6 +253,7 @@ int dram_init(void)
        return 0;
 }
 
+#if defined(CONFIG_LMB)
 ulong board_get_usable_ram_top(ulong total_size)
 {
        phys_size_t size;
@@ -277,6 +278,8 @@ ulong board_get_usable_ram_top(ulong total_size)
 
        return reg + size;
 }
+#endif
+
 #else
 int dram_init_banksize(void)
 {
index cfc1c658e3a612d3de26a1df1cb51a962c988d16..03c866b5fa8e18bf9d915e7cbc0b204a893c2e56 100644 (file)
@@ -537,6 +537,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
@@ -630,6 +631,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)
@@ -823,6 +825,7 @@ int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
        return 0;
 }
 
+#if defined(CONFIG_LMB)
 #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
 /**
  * boot_get_cmdline - allocate and initialize kernel cmdline
@@ -932,6 +935,7 @@ int image_setup_linux(bootm_headers_t *images)
 
        return 0;
 }
+#endif
 
 void genimg_print_size(uint32_t size)
 {