mirror of
https://xff.cz/git/u-boot/
synced 2025-09-20 01:52:09 +02:00
lmb: Always compile arch_lmb_reserve() into U-Boot on arc
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>
This commit is contained in:
@@ -8,42 +8,12 @@
|
|||||||
#include <env.h>
|
#include <env.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <irq_func.h>
|
#include <irq_func.h>
|
||||||
#include <lmb.h>
|
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <asm/cache.h>
|
#include <asm/cache.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
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)
|
static int cleanup_before_linux(void)
|
||||||
{
|
{
|
||||||
disable_interrupts();
|
disable_interrupts();
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include <linux/compiler.h>
|
#include <linux/compiler.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/log2.h>
|
#include <linux/log2.h>
|
||||||
|
#include <lmb.h>
|
||||||
#include <asm/arcregs.h>
|
#include <asm/arcregs.h>
|
||||||
#include <asm/arc-bcr.h>
|
#include <asm/arc-bcr.h>
|
||||||
#include <asm/cache.h>
|
#include <asm/cache.h>
|
||||||
@@ -820,3 +821,32 @@ void sync_n_cleanup_cache_all(void)
|
|||||||
|
|
||||||
__ic_entire_invalidate();
|
__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));
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user