Merge tag 'u-boot-stm32-20211012' of https://source.denx.de/u-boot/custodians/u-boot-stm
[platform/kernel/u-boot.git] / arch / arm / lib / stack.c
index 3f961f4..656084c 100644 (file)
@@ -45,36 +45,5 @@ static ulong get_sp(void)
 
 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;
-       }
+       arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 16384);
 }