[U-Boot] Fwd: [PATCH] arm/lib: Add get_effective_memsize() to board.c

York Sun yorksun at freescale.com
Mon Feb 10 23:18:24 CET 2014




-------- Original Message --------
Subject: [PATCH] arm/lib: Add get_effective_memsize() to board.c
Date: Mon, 10 Feb 2014 14:04:19 -0800
From: York Sun <yorksun at freescale.com>
To: <albert.u.boot at aribaud.net>
CC: <scottwood at freescale.com>, York Sun <yorksun at freescale.com>

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: York Sun <yorksun at freescale.com>
---
 arch/arm/lib/board.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index b770e25..b31c8ff 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -263,6 +263,24 @@ init_fnc_t *init_sequence[] = {
 	NULL,
 };

+phys_size_t 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
+}
+
+#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;
@@ -322,7 +340,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
-- 
1.7.9.5






More information about the U-Boot mailing list