]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
lmb: Always compile arch_lmb_reserve() into U-Boot on arm
authorMarek Vasut <marek.vasut@gmail.com>
Fri, 10 Sep 2021 20:47:07 +0000 (22:47 +0200)
committerTom Rini <trini@konsulko.com>
Thu, 23 Sep 2021 18:15:32 +0000 (14:15 -0400)
The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
if CMD_BOOT{I,M,Z} is not enabled. However, the arm32/arm64 variant of
arch_lmb_reserve() is only compiled in if CMD_BOOT{I,M,Z} is enabled.

This currently does not trigger build error, because there is an empty
weak implementation of arch_lmb_reserve(), however that is not the
function that should be used on arm32/arm64.

Fix this by moving the arch_lmb_reserve() implementation into common
code and always compile it in.

Reviewed-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
arch/arm/lib/bootm.c
arch/arm/lib/stack.c

index f60ee3a7e6a66aa339c5b91028f795eba27e6dbf..dd6a69315acca4b62bfa5ad976e825bc84d3e913 100644 (file)
@@ -16,7 +16,6 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <dm.h>
-#include <lmb.h>
 #include <log.h>
 #include <asm/global_data.h>
 #include <dm/root.h>
@@ -43,50 +42,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 static struct tag *params;
 
-static ulong get_sp(void)
-{
-       ulong ret;
-
-       asm("mov %0, sp" : "=r"(ret) : );
-       return ret;
-}
-
-void arch_lmb_reserve(struct lmb *lmb)
-{
-       ulong sp, bank_end;
-       int bank;
-
-       /*
-        * Booting a (Linux) kernel image
-        *
-        * Allocate space for command line and board info - the
-        * address should be as high as possible within the reach of
-        * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
-        * memory, which means far enough below the current stack
-        * pointer.
-        */
-       sp = get_sp();
-       debug("## Current stack ends at 0x%08lx ", sp);
-
-       /* adjust sp by 4K to be safe */
-       sp -= 4096;
-       for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
-               if (!gd->bd->bi_dram[bank].size ||
-                   sp < gd->bd->bi_dram[bank].start)
-                       continue;
-               /* Watch out for RAM at end of address space! */
-               bank_end = gd->bd->bi_dram[bank].start +
-                       gd->bd->bi_dram[bank].size - 1;
-               if (sp > bank_end)
-                       continue;
-               if (bank_end > gd->ram_top)
-                       bank_end = gd->ram_top - 1;
-
-               lmb_reserve(lmb, sp, bank_end - sp + 1);
-               break;
-       }
-}
-
 __weak void board_quiesce_devices(void)
 {
 }
index b03e1cfc80c9eabaf3712fce3ddaad693cd81fcf..3f961f44543db8a58eccfc8b9e8787a5221c4829 100644 (file)
@@ -12,6 +12,7 @@
  */
 #include <common.h>
 #include <init.h>
+#include <lmb.h>
 #include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -33,3 +34,47 @@ int arch_reserve_stacks(void)
 
        return 0;
 }
+
+static ulong get_sp(void)
+{
+       ulong ret;
+
+       asm("mov %0, sp" : "=r"(ret) : );
+       return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+       ulong sp, bank_end;
+       int bank;
+
+       /*
+        * Booting a (Linux) kernel image
+        *
+        * Allocate space for command line and board info - the
+        * address should be as high as possible within the reach of
+        * the kernel (see CONFIG_SYS_BOOTMAPSZ settings), but in unused
+        * memory, which means far enough below the current stack
+        * pointer.
+        */
+       sp = get_sp();
+       debug("## Current stack ends at 0x%08lx ", sp);
+
+       /* adjust sp by 4K to be safe */
+       sp -= 4096;
+       for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
+               if (!gd->bd->bi_dram[bank].size ||
+                   sp < gd->bd->bi_dram[bank].start)
+                       continue;
+               /* Watch out for RAM at end of address space! */
+               bank_end = gd->bd->bi_dram[bank].start +
+                       gd->bd->bi_dram[bank].size - 1;
+               if (sp > bank_end)
+                       continue;
+               if (bank_end > gd->ram_top)
+                       bank_end = gd->ram_top - 1;
+
+               lmb_reserve(lmb, sp, bank_end - sp + 1);
+               break;
+       }
+}