diff mbox series

[09/12] lmb: riscv: Add arch_lmb_reserve()

Message ID 20210910204718.17765-9-marek.vasut+renesas@gmail.com
State Accepted
Commit eeaa3fe65270758ab0bdb1515e14f9bf936d3a25
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.

Reviewed-by: Rick Chen <rick@andestech.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Atish Patra <atish.patra@wdc.com>
Cc: Leo <ycliang@andestech.com>
Cc: Rick Chen <rick@andestech.com>
Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Cc: Tom Rini <trini@konsulko.com>
---
V2: Add RB from Rick
---
 arch/riscv/lib/bootm.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Tom Rini Sept. 24, 2021, 2:42 a.m. UTC | #1
On Fri, Sep 10, 2021 at 10:47:15PM +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.
> 
> Reviewed-by: Rick Chen <rick@andestech.com>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
> Cc: Atish Patra <atish.patra@wdc.com>
> Cc: Leo <ycliang@andestech.com>
> Cc: Rick Chen <rick@andestech.com>
> 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/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index 8dd1820540..ff1bdf7131 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);
+}