u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>,
	Simon Glass <sjg@chromium.org>,
	Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>,
	Tom Rini <trini@konsulko.com>
Subject: [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc
Date: Fri, 10 Sep 2021 22:47:08 +0200	[thread overview]
Message-ID: <20210910204718.17765-2-marek.vasut+renesas@gmail.com> (raw)
In-Reply-To: <20210910204718.17765-1-marek.vasut+renesas@gmail.com>

The arch_lmb_reserve() is called by lib/lmb.c lmb_reserve_common() even
if CMD_BOOTM is not enabled. However, the arc variant of arch_lmb_reserve()
is only compiled in if CMD_BOOTM 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 arc.

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

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/arc/lib/bootm.c | 30 ------------------------------
 arch/arc/lib/cache.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index 8a8d394a5f..41408c2b46 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 f807cd83d6..4ba180482c 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,32 @@ 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)
+{
+	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));
+}
-- 
2.33.0


  reply	other threads:[~2021-09-10 20:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 20:47 [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Marek Vasut
2021-09-10 20:47 ` Marek Vasut [this message]
2021-09-24  2:41   ` [PATCH 02/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arc Tom Rini
2021-09-10 20:47 ` [PATCH 03/12] lmb: Add generic arch_lmb_reserve_generic() Marek Vasut
2021-09-10 21:10   ` Tom Rini
2021-09-12 19:27   ` Daniel Schwierzeck
2021-09-13  2:08     ` Marek Vasut
2021-09-24  2:41   ` Tom Rini
2021-09-10 20:47 ` [PATCH 04/12] lmb: Switch to " Marek Vasut
2021-09-24  2:41   ` Tom Rini
2021-09-10 20:47 ` [PATCH 05/12] lmb: arm: Increase LMB alignment to 16k in arch_lmb_reserve_generic() Marek Vasut
2021-09-10 21:10   ` Tom Rini
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 06/12] lmb: Remove imx board_lmb_reserve() Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 07/12] lmb: nios2: Add arch_lmb_reserve() Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 08/12] lmb: nds32: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 09/12] lmb: riscv: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 10/12] lmb: sh: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 11/12] lmb: xtensa: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-10 20:47 ` [PATCH 12/12] lmb: x86: " Marek Vasut
2021-09-24  2:42   ` Tom Rini
2021-09-24  2:41 ` [PATCH 01/12] lmb: Always compile arch_lmb_reserve() into U-Boot on arm Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210910204718.17765-2-marek.vasut+renesas@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=simon.k.r.goldschmidt@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).