summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorTom Rini <[email protected]>2021-09-23 22:38:21 -0400
committerTom Rini <[email protected]>2021-09-23 22:38:21 -0400
commit657668348b5d677afca029673479266ef601f8a6 (patch)
tree88d807a4872e12a0df8eefc8463da8af9b286bd5 /arch
parent7b57e56739ed2c550d17a072a7f4c8326c0c83dc (diff)
parent8e85f36a8fabb4bd5216f6bfcc9a8224adb63496 (diff)
Merge branch '2021-09-23-assorted-updates' into next
- Rework lmb reservation so we have common code for all arches to use - armv8 cache.S cleanups, crc32 speedup - ENV_IS_NOWHWERE, pci io/memory base configuration fixes
Diffstat (limited to 'arch')
-rw-r--r--arch/arc/lib/bootm.c30
-rw-r--r--arch/arc/lib/cache.c14
-rw-r--r--arch/arm/Kconfig10
-rw-r--r--arch/arm/Makefile4
-rw-r--r--arch/arm/cpu/armv8/cache.S19
-rw-r--r--arch/arm/lib/bootm.c45
-rw-r--r--arch/arm/lib/stack.c14
-rw-r--r--arch/arm/mach-imx/misc.c30
-rw-r--r--arch/arm/mach-mediatek/Kconfig42
-rw-r--r--arch/m68k/lib/bootm.c18
-rw-r--r--arch/microblaze/lib/bootm.c28
-rw-r--r--arch/mips/lib/bootm.c9
-rw-r--r--arch/mips/mach-mtmips/Kconfig3
-rw-r--r--arch/mips/mach-mtmips/mt7620/Kconfig8
-rw-r--r--arch/mips/mach-mtmips/mt7628/Kconfig9
-rw-r--r--arch/nds32/lib/bootm.c13
-rw-r--r--arch/nios2/lib/bootm.c16
-rw-r--r--arch/powerpc/lib/bootm.c18
-rw-r--r--arch/riscv/lib/bootm.c13
-rw-r--r--arch/sh/lib/bootm.c16
-rw-r--r--arch/x86/lib/bootm.c18
-rw-r--r--arch/xtensa/lib/bootm.c12
22 files changed, 195 insertions, 194 deletions
diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index 8a8d394a5f0..41408c2b460 100644
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
@@ -8,42 +8,12 @@
#include <env.h>
#include <image.h>
#include <irq_func.h>
-#include <lmb.h>
#include <log.h>
#include <asm/cache.h>
#include <asm/global_data.h>
DECLARE_GLOBAL_DATA_PTR;
-static ulong get_sp(void)
-{
- ulong ret;
-
- asm("mov %0, sp" : "=r"(ret) : );
- return ret;
-}
-
-void arch_lmb_reserve(struct lmb *lmb)
-{
- ulong sp;
-
- /*
- * 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;
- lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
-}
-
static int cleanup_before_linux(void)
{
disable_interrupts();
diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index f807cd83d6b..4c696cb53a4 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -11,6 +11,7 @@
#include <linux/compiler.h>
#include <linux/kernel.h>
#include <linux/log2.h>
+#include <lmb.h>
#include <asm/arcregs.h>
#include <asm/arc-bcr.h>
#include <asm/cache.h>
@@ -820,3 +821,16 @@ void sync_n_cleanup_cache_all(void)
__ic_entire_invalidate();
}
+
+static ulong get_sp(void)
+{
+ ulong ret;
+
+ asm("mov %0, sp" : "=r"(ret) : );
+ return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f0fd57f8d6d..95102d386b4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -9,6 +9,16 @@ config ARM64
select PHYS_64BIT
select SYS_CACHE_SHIFT_6
+config ARM64_CRC32
+ bool "Enable support for CRC32 instruction"
+ depends on ARM64
+ default y
+ help
+ ARMv8 implements dedicated crc32 instruction for crc32 calculation.
+ This is faster than software crc32 calculation. This instruction may
+ not be present on all ARMv8.0, but is always present on ARMv8.1 and
+ newer.
+
config POSITION_INDEPENDENT
bool "Generate position-independent pre-relocation code"
depends on ARM64 || CPU_V7A
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index c68e598a675..ce977bf6323 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -18,7 +18,11 @@ arch-$(CONFIG_CPU_V7A) =$(call cc-option, -march=armv7-a, \
$(call cc-option, -march=armv7))
arch-$(CONFIG_CPU_V7M) =-march=armv7-m
arch-$(CONFIG_CPU_V7R) =-march=armv7-r
+ifeq ($(CONFIG_ARM64_CRC32),y)
+arch-$(CONFIG_ARM64) =-march=armv8-a+crc
+else
arch-$(CONFIG_ARM64) =-march=armv8-a
+endif
# On Tegra systems we must build SPL for the armv4 core on the device
# but otherwise we can use the value in CONFIG_SYS_ARM_ARCH
diff --git a/arch/arm/cpu/armv8/cache.S b/arch/arm/cpu/armv8/cache.S
index e04907dd8c0..d1cee23437d 100644
--- a/arch/arm/cpu/armv8/cache.S
+++ b/arch/arm/cpu/armv8/cache.S
@@ -27,13 +27,11 @@ ENTRY(__asm_dcache_level)
msr csselr_el1, x12 /* select cache level */
isb /* sync change of cssidr_el1 */
mrs x6, ccsidr_el1 /* read the new cssidr_el1 */
- and x2, x6, #7 /* x2 <- log2(cache line size)-4 */
+ ubfx x2, x6, #0, #3 /* x2 <- log2(cache line size)-4 */
+ ubfx x3, x6, #3, #10 /* x3 <- number of cache ways - 1 */
+ ubfx x4, x6, #13, #15 /* x4 <- number of cache sets - 1 */
add x2, x2, #4 /* x2 <- log2(cache line size) */
- mov x3, #0x3ff
- and x3, x3, x6, lsr #3 /* x3 <- max number of #ways */
clz w5, w3 /* bit position of #ways */
- mov x4, #0x7fff
- and x4, x4, x6, lsr #13 /* x4 <- max number of #sets */
/* x12 <- cache level << 1 */
/* x2 <- line length offset */
/* x3 <- number of cache ways - 1 */
@@ -72,8 +70,7 @@ ENTRY(__asm_dcache_all)
mov x1, x0
dsb sy
mrs x10, clidr_el1 /* read clidr_el1 */
- lsr x11, x10, #24
- and x11, x11, #0x7 /* x11 <- loc */
+ ubfx x11, x10, #24, #3 /* x11 <- loc */
cbz x11, finished /* if loc is 0, exit */
mov x15, lr
mov x0, #0 /* start flush at cache level 0 */
@@ -83,8 +80,7 @@ ENTRY(__asm_dcache_all)
/* x15 <- return address */
loop_level:
- lsl x12, x0, #1
- add x12, x12, x0 /* x0 <- tripled cache level */
+ add x12, x0, x0, lsl #1 /* x12 <- tripled cache level */
lsr x12, x10, x12
and x12, x12, #7 /* x12 <- cache type */
cmp x12, #2
@@ -131,8 +127,7 @@ ENDPROC(__asm_invalidate_dcache_all)
.pushsection .text.__asm_flush_dcache_range, "ax"
ENTRY(__asm_flush_dcache_range)
mrs x3, ctr_el0
- lsr x3, x3, #16
- and x3, x3, #0xf
+ ubfx x3, x3, #16, #4
mov x2, #4
lsl x2, x2, x3 /* cache line size */
@@ -158,7 +153,7 @@ ENDPROC(__asm_flush_dcache_range)
.pushsection .text.__asm_invalidate_dcache_range, "ax"
ENTRY(__asm_invalidate_dcache_range)
mrs x3, ctr_el0
- ubfm x3, x3, #16, #19
+ ubfx x3, x3, #16, #4
mov x2, #4
lsl x2, x2, x3 /* cache line size */
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index f60ee3a7e6a..dd6a69315ac 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -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)
{
}
diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c
index b03e1cfc80c..656084c7e51 100644
--- a/arch/arm/lib/stack.c
+++ b/arch/arm/lib/stack.c
@@ -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,16 @@ 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)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 16384);
+}
diff --git a/arch/arm/mach-imx/misc.c b/arch/arm/mach-imx/misc.c
index d82efa7f8f0..09a758ff6e8 100644
--- a/arch/arm/mach-imx/misc.c
+++ b/arch/arm/mach-imx/misc.c
@@ -77,33 +77,3 @@ int mxs_reset_block(struct mxs_register_32 *reg)
return 0;
}
-
-static ulong get_sp(void)
-{
- ulong ret;
-
- asm("mov %0, sp" : "=r"(ret) : );
- return ret;
-}
-
-void board_lmb_reserve(struct lmb *lmb)
-{
- ulong sp, bank_end;
- int bank;
-
- sp = get_sp();
- debug("## Current stack ends at 0x%08lx ", sp);
-
- /* adjust sp by 16K to be safe */
- sp -= 4096 << 2;
- for (bank = 0; bank < CONFIG_NR_DRAM_BANKS; bank++) {
- if (sp < gd->bd->bi_dram[bank].start)
- continue;
- bank_end = gd->bd->bi_dram[bank].start +
- gd->bd->bi_dram[bank].size;
- if (sp >= bank_end)
- continue;
- lmb_reserve(lmb, sp, bank_end - sp);
- break;
- }
-}
diff --git a/arch/arm/mach-mediatek/Kconfig b/arch/arm/mach-mediatek/Kconfig
index 134b6b17c2d..f79a5c62cd3 100644
--- a/arch/arm/mach-mediatek/Kconfig
+++ b/arch/arm/mach-mediatek/Kconfig
@@ -79,12 +79,40 @@ config TARGET_MT8518
endchoice
-source "board/mediatek/mt7622/Kconfig"
-source "board/mediatek/mt7623/Kconfig"
-source "board/mediatek/mt7629/Kconfig"
-source "board/mediatek/mt8183/Kconfig"
-source "board/mediatek/mt8512/Kconfig"
-source "board/mediatek/mt8516/Kconfig"
-source "board/mediatek/mt8518/Kconfig"
+config SYS_BOARD
+ string "Board name"
+ default "mt7622" if TARGET_MT7622
+ default "mt7623" if TARGET_MT7623
+ default "mt7629" if TARGET_MT7629
+ default "mt8183" if TARGET_MT8183
+ default "mt8512" if TARGET_MT8512
+ default "mt8516" if TARGET_MT8516
+ default "mt8518" if TARGET_MT8518
+ default ""
+ help
+ This option contains information about board name.
+ Based on this option board/<CONFIG_SYS_VENDOR>/<CONFIG_SYS_BOARD> will
+ be used.
+
+config SYS_CONFIG_NAME
+ string "Board configuration name"
+ default "mt7622" if TARGET_MT7622
+ default "mt7623" if TARGET_MT7623
+ default "mt7629" if TARGET_MT7629
+ default "mt8183" if TARGET_MT8183
+ default "mt8512" if TARGET_MT8512
+ default "mt8516" if TARGET_MT8516
+ default "mt8518" if TARGET_MT8518
+ default ""
+ help
+ This option contains information about board configuration name.
+ Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header
+ will be used for board configuration.
+
+config MTK_BROM_HEADER_INFO
+ string
+ default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
+ default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
+ default "lk=1" if TARGET_MT7623
endif
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 51a6f938586..27729db67e2 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -32,23 +32,7 @@ static void set_clocks_in_mhz (struct bd_info *kbd);
void arch_lmb_reserve(struct lmb *lmb)
{
- ulong sp;
-
- /*
- * 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 1K to be safe */
- sp -= 1024;
- lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 1024);
}
int do_bootm_linux(int flag, int argc, char *const argv[],
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 6695ac63c77..3a6da6e29ff 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -34,33 +34,7 @@ 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 (sp < gd->bd->bi_dram[bank].start)
- continue;
- bank_end = gd->bd->bi_dram[bank].start +
- gd->bd->bi_dram[bank].size;
- if (sp >= bank_end)
- continue;
- lmb_reserve(lmb, sp, bank_end - sp);
- break;
- }
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
}
static void boot_jump_linux(bootm_headers_t *images, int flag)
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index fde90fced44..cab8da4860c 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -39,14 +39,7 @@ static ulong arch_get_sp(void)
void arch_lmb_reserve(struct lmb *lmb)
{
- ulong sp;
-
- sp = arch_get_sp();
- debug("## Current stack ends at 0x%08lx\n", sp);
-
- /* adjust sp by 4K to be safe */
- sp -= 4096;
- lmb_reserve(lmb, sp, gd->ram_top - sp);
+ arch_lmb_reserve_generic(lmb, arch_get_sp(), gd->ram_top, 4096);
}
static void linux_cmdline_init(void)
diff --git a/arch/mips/mach-mtmips/Kconfig b/arch/mips/mach-mtmips/Kconfig
index 9f300a98ba8..151b004603d 100644
--- a/arch/mips/mach-mtmips/Kconfig
+++ b/arch/mips/mach-mtmips/Kconfig
@@ -1,6 +1,9 @@
menu "MediaTek MIPS platforms"
depends on ARCH_MTMIPS
+config SYS_VENDOR
+ default "mediatek" if BOARD_MT7628_RFB || BOARD_MT7620_RFB || BOARD_MT7620_MT7530_RFB
+
config SYS_MALLOC_F_LEN
default 0x1000
diff --git a/arch/mips/mach-mtmips/mt7620/Kconfig b/arch/mips/mach-mtmips/mt7620/Kconfig
index 5db83eb9d9a..3ca711ad0f3 100644
--- a/arch/mips/mach-mtmips/mt7620/Kconfig
+++ b/arch/mips/mach-mtmips/mt7620/Kconfig
@@ -66,6 +66,12 @@ config CPU_FREQ_MULTI
default 6 if CPU_FREQ_600MHZ
default 7 if CPU_FREQ_620MHZ
-source "board/mediatek/mt7620/Kconfig"
+config SYS_CONFIG_NAME
+ string "Board configuration name"
+ default "mt7620" if BOARD_MT7620_RFB || BOARD_MT7620_MT7530_RFB
+
+config SYS_BOARD
+ string "Board name"
+ default "mt7620" if BOARD_MT7620_RFB || BOARD_MT7620_MT7530_RFB
endif
diff --git a/arch/mips/mach-mtmips/mt7628/Kconfig b/arch/mips/mach-mtmips/mt7628/Kconfig
index f451c1593f6..e7273591bca 100644
--- a/arch/mips/mach-mtmips/mt7628/Kconfig
+++ b/arch/mips/mach-mtmips/mt7628/Kconfig
@@ -44,8 +44,15 @@ config SPL_UART2_SPIS_PINMUX
Select this if the UART2 of your board is connected to GPIO 16/17
(shared with SPIS) rather than the usual GPIO 20/21.
+config SYS_BOARD
+ string "Board name"
+ default "mt7628" if BOARD_MT7628_RFB
+
+config SYS_CONFIG_NAME
+ string "Board configuration name"
+ default "mt7628" if BOARD_MT7628_RFB
+
source "board/gardena/smart-gateway-mt7688/Kconfig"
-source "board/mediatek/mt7628/Kconfig"
source "board/seeed/linkit-smart-7688/Kconfig"
source "board/vocore/vocore2/Kconfig"
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 4cb0f530ae1..a7c8978f231 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -245,3 +245,16 @@ static void setup_end_tag(struct bd_info *bd)
}
#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */
+
+static ulong get_sp(void)
+{
+ ulong ret;
+
+ asm("move %0, $sp" : "=r"(ret) : );
+ return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index 50374671515..3cb59bd9777 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -10,6 +10,9 @@
#include <image.h>
#include <irq_func.h>
#include <log.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
#define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
@@ -60,3 +63,16 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
return 1;
}
+
+static ulong get_sp(void)
+{
+ ulong ret;
+
+ asm("mov %0, sp" : "=r"(ret) : );
+ return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 31c17b5bb38..8d65047aa4d 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -119,7 +119,7 @@ static void boot_jump_linux(bootm_headers_t *images)
void arch_lmb_reserve(struct lmb *lmb)
{
phys_size_t bootm_size;
- ulong size, sp, bootmap_base;
+ ulong size, bootmap_base;
bootmap_base = env_get_bootm_low();
bootm_size = env_get_bootm_size();
@@ -141,21 +141,7 @@ void arch_lmb_reserve(struct lmb *lmb)
lmb_reserve(lmb, base, bootm_size - size);
}
- /*
- * 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\n", sp);
-
- /* adjust sp by 4K to be safe */
- sp -= 4096;
- lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - sp));
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
#ifdef CONFIG_MP
cpu_mp_lmb_reserve(lmb);
diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index 8dd18205403..ff1bdf71318 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -135,3 +135,16 @@ int do_bootm_vxworks(int flag, int argc, char *const argv[],
{
return do_bootm_linux(flag, argc, argv, images);
}
+
+static ulong get_sp(void)
+{
+ ulong ret;
+
+ asm("mv %0, sp" : "=r"(ret) : );
+ return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c
index dc94f837856..9b71424dfe6 100644
--- a/arch/sh/lib/bootm.c
+++ b/arch/sh/lib/bootm.c
@@ -12,8 +12,11 @@
#include <env.h>
#include <image.h>
#include <asm/byteorder.h>
+#include <asm/global_data.h>
#include <asm/zimage.h>
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CONFIG_SYS_DEBUG
static void hexdump(unsigned char *buf, int len)
{
@@ -111,3 +114,16 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
/* does not return */
return 1;
}
+
+static ulong get_sp(void)
+{
+ ulong ret;
+
+ asm("mov r15, %0" : "=r"(ret) : );
+ return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 733dd712570..667e5e689e3 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -223,3 +223,21 @@ int do_bootm_linux(int flag, int argc, char *const argv[],
return boot_jump_linux(images);
}
+
+static ulong get_sp(void)
+{
+ ulong ret;
+
+#if CONFIG_IS_ENABLED(X86_64)
+ ret = gd->start_addr_sp;
+#else
+ asm("mov %%esp, %0" : "=r"(ret) : );
+#endif
+
+ return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}
diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c
index bb1e2886abc..277af181683 100644
--- a/arch/xtensa/lib/bootm.c
+++ b/arch/xtensa/lib/bootm.c
@@ -197,3 +197,15 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
return 1;
}
+static ulong get_sp(void)
+{
+ ulong ret;
+
+ asm("mov %0, a1" : "=r"(ret) : );
+ return ret;
+}
+
+void arch_lmb_reserve(struct lmb *lmb)
+{
+ arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 4096);
+}