提交 e3866163 编写于 作者: Y York Sun 提交者: Tom Rini

common: Add get_effective_memsize() to memsize.c

This function has been around for powerpc. It is used for systems with
memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory,
this feature can limit U-boot to one block without going over the limit.
Signed-off-by: NYork Sun <yorksun@freescale.com>
Acked-by: NAlbert ARIBAUD <albert.u.boot@aribaud.net>
上级 6b1e1254
......@@ -318,7 +318,7 @@ void board_init_f(ulong bootflag)
gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
#endif
addr = CONFIG_SYS_SDRAM_BASE + gd->ram_size;
addr = CONFIG_SYS_SDRAM_BASE + get_effective_memsize();
#ifdef CONFIG_LOGBUFFER
#ifndef CONFIG_ALT_LB_ADDR
......
......@@ -27,7 +27,6 @@ extern unsigned long search_exception_table(unsigned long);
* amount of memory on the system if we're unable to keep all
* the memory mapped in.
*/
extern ulong get_effective_memsize(void);
#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize())
/*
......
......@@ -35,7 +35,6 @@ extern unsigned long search_exception_table(unsigned long);
* amount of memory on the system if we're unable to keep all
* the memory mapped in.
*/
extern ulong get_effective_memsize(void);
#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize())
static __inline__ void set_tsr(unsigned long val)
......
......@@ -29,7 +29,6 @@ extern unsigned long search_exception_table(unsigned long);
* amount of memory on the system if we're unable to keep all
* the memory mapped in.
*/
extern ulong get_effective_memsize(void);
#define END_OF_MEM (gd->bd->bi_memstart + get_effective_memsize())
/*
......
......@@ -312,17 +312,6 @@ static init_fnc_t *init_sequence[] = {
NULL, /* Terminate this list */
};
ulong get_effective_memsize(void)
{
#ifndef CONFIG_VERY_BIG_RAM
return gd->ram_size;
#else
/* limit stack to what we can reasonable map */
return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
CONFIG_MAX_MEM_MAPPED : gd->ram_size);
#endif
}
static int __fixup_cpu(void)
{
return 0;
......@@ -343,13 +332,6 @@ int fixup_cpu(void) __attribute__((weak, alias("__fixup_cpu")));
* initialized, and stack space is limited to a few kB.
*/
#ifdef CONFIG_LOGBUFFER
unsigned long logbuffer_base(void)
{
return CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
}
#endif
void board_init_f(ulong bootflag)
{
bd_t *bd;
......
......@@ -30,7 +30,6 @@
DECLARE_GLOBAL_DATA_PTR;
extern ulong get_effective_memsize(void);
static ulong get_sp (void);
extern void ft_fixup_num_cores(void *blob);
static void set_clocks_in_mhz (bd_t *kbd);
......
......@@ -12,7 +12,7 @@
DECLARE_GLOBAL_DATA_PTR;
ulong get_effective_memsize(void)
phys_size_t get_effective_memsize(void)
{
return CONFIG_SYS_L2_SIZE;
}
......
......@@ -21,7 +21,7 @@ static const u32 sysclk_tbl[] = {
99999000, 11111000, 12499800, 13333200
};
ulong get_effective_memsize(void)
phys_size_t get_effective_memsize(void)
{
return CONFIG_SYS_L2_SIZE;
}
......
......@@ -20,7 +20,7 @@ static const u32 sysclk_tbl[] = {
99999000, 11111000, 12499800, 13333200
};
ulong get_effective_memsize(void)
phys_size_t get_effective_memsize(void)
{
return CONFIG_SYS_L2_SIZE;
}
......
......@@ -223,17 +223,6 @@ static int show_dram_config(void)
return 0;
}
ulong get_effective_memsize(void)
{
#ifndef CONFIG_VERY_BIG_RAM
return gd->ram_size;
#else
/* limit stack to what we can reasonable map */
return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
CONFIG_MAX_MEM_MAPPED : gd->ram_size);
#endif
}
void __dram_init_banksize(void)
{
#if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE)
......
......@@ -52,7 +52,7 @@ static char *lbuf;
unsigned long __logbuffer_base(void)
{
return CONFIG_SYS_SDRAM_BASE + gd->ram_size - LOGBUFF_LEN;
return CONFIG_SYS_SDRAM_BASE + get_effective_memsize() - LOGBUFF_LEN;
}
unsigned long logbuffer_base(void)
__attribute__((weak, alias("__logbuffer_base")));
......
......@@ -5,7 +5,10 @@
* SPDX-License-Identifier: GPL-2.0+
*/
#include <config.h>
#include <common.h>
DECLARE_GLOBAL_DATA_PTR;
#ifdef __PPC__
/*
* At least on G2 PowerPC cores, sequential accesses to non-existent
......@@ -76,3 +79,14 @@ long get_ram_size(long *base, long maxsize)
return (maxsize);
}
phys_size_t __weak get_effective_memsize(void)
{
#ifndef CONFIG_VERY_BIG_RAM
return gd->ram_size;
#else
/* limit stack to what we can reasonable map */
return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ?
CONFIG_MAX_MEM_MAPPED : gd->ram_size);
#endif
}
......@@ -461,6 +461,7 @@ void api_init (void);
/* common/memsize.c */
long get_ram_size (long *, long);
phys_size_t get_effective_memsize(void);
/* $(BOARD)/$(BOARD).c */
void reset_phy (void);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册