diff mbox series

[12/12] lmb: x86: Add arch_lmb_reserve()

Message ID 20210910204718.17765-12-marek.vasut+renesas@gmail.com
State Accepted
Commit a69753f31d5863c692522f0b92db6e9cad06d553
Delegated to: Tom Rini
Headers show
Series [01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm | expand

Commit Message

Marek Vasut Sept. 10, 2021, 8:47 p.m. UTC
Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
It is rather likely this architecture also needs to cover U-Boot with
LMB before booting Linux.

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>
---
V2: No change
---
 arch/x86/lib/bootm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Tom Rini Sept. 24, 2021, 2:42 a.m. UTC | #1
On Fri, Sep 10, 2021 at 10:47:18PM +0200, Marek Vasut wrote:

> Add arch_lmb_reserve() implemented using arch_lmb_reserve_generic().
> It is rather likely this architecture also needs to cover U-Boot with
> LMB before booting Linux.
> 
> 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>

Applied to u-boot/next, thanks!
diff mbox series

Patch

diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 733dd71257..667e5e689e 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);
+}