summaryrefslogtreecommitdiffstats
path: root/lib_ppc
diff options
context:
space:
mode:
authorPeter Tyser <ptyser@xes-inc.com>2009-08-21 23:05:20 -0500
committerWolfgang Denk <wd@denx.de>2009-09-04 21:46:32 +0200
commita483a167bc8d808145ca1224a2c238cda90aa60c (patch)
treefde71dcae066c865872f5c990c593e98a0750265 /lib_ppc
parent5e93bd1c9aaea886c5e5c7c1b6114ab36c30668f (diff)
downloadtalos-obmc-uboot-a483a167bc8d808145ca1224a2c238cda90aa60c.tar.gz
talos-obmc-uboot-a483a167bc8d808145ca1224a2c238cda90aa60c.zip
Standardize mem_malloc_init() implementation
This lays the groundwork to allow architectures to share a common mem_malloc_init(). Note that the x86 implementation was not modified as it did not fit the mold of all other architectures. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Diffstat (limited to 'lib_ppc')
-rw-r--r--lib_ppc/board.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index f0cc3ce8d8..6cf7730095 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -144,17 +144,13 @@ ulong monitor_flash_len;
/*
* The Malloc area is immediately below the monitor copy in DRAM
*/
-static void mem_malloc_init (void)
+static void mem_malloc_init(ulong start, ulong size)
{
-#if !defined(CONFIG_RELOC_FIXUP_WORKS)
- mem_malloc_end = CONFIG_SYS_MONITOR_BASE + gd->reloc_off;
-#endif
- mem_malloc_start = mem_malloc_end - TOTAL_MALLOC_LEN;
- mem_malloc_brk = mem_malloc_start;
+ mem_malloc_start = start;
+ mem_malloc_end = start + size;
+ mem_malloc_brk = start;
- memset ((void *) mem_malloc_start,
- 0,
- mem_malloc_end - mem_malloc_start);
+ memset ((void *)mem_malloc_start, 0, size);
}
/*
@@ -650,6 +646,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
#ifndef CONFIG_ENV_IS_NOWHERE
extern char * env_name_spec;
#endif
+ ulong malloc_start;
#ifndef CONFIG_SYS_NO_FLASH
ulong flash_size;
@@ -662,9 +659,11 @@ void board_init_r (gd_t *id, ulong dest_addr)
#if defined(CONFIG_RELOC_FIXUP_WORKS)
gd->reloc_off = 0;
- mem_malloc_end = dest_addr;
+ malloc_start = dest_addr - TOTAL_MALLOC_LEN;
#else
gd->reloc_off = dest_addr - CONFIG_SYS_MONITOR_BASE;
+ malloc_start = CONFIG_SYS_MONITOR_BASE + gd->reloc_off -
+ TOTAL_MALLOC_LEN;
#endif
#ifdef CONFIG_SERIAL_MULTI
@@ -760,7 +759,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
asm ("sync ; isync");
/* initialize malloc() area */
- mem_malloc_init ();
+ mem_malloc_init (malloc_start, TOTAL_MALLOC_LEN);
malloc_bin_reloc ();
#if !defined(CONFIG_SYS_NO_FLASH)
OpenPOWER on IntegriCloud