diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/board_f.c | 15 | ||||
-rw-r--r-- | common/board_r.c | 4 |
2 files changed, 16 insertions, 3 deletions
diff --git a/common/board_f.c b/common/board_f.c index 6867abc8e6..591f18f391 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -470,9 +470,18 @@ static int reserve_uboot(void) #ifdef CONFIG_SYS_NONCACHED_MEMORY static int reserve_noncached(void) { - /* round down to SECTION SIZE (typicaly 1MB) limit */ - gd->start_addr_sp &= ~(MMU_SECTION_SIZE - 1); - gd->start_addr_sp -= CONFIG_SYS_NONCACHED_MEMORY; + /* + * The value of gd->start_addr_sp must match the value of malloc_start + * calculated in boatrd_f.c:initr_malloc(), which is passed to + * board_r.c:mem_malloc_init() and then used by + * cache.c:noncached_init() + * + * These calculations must match the code in cache.c:noncached_init() + */ + gd->start_addr_sp = ALIGN(gd->start_addr_sp, MMU_SECTION_SIZE) - + MMU_SECTION_SIZE; + gd->start_addr_sp -= ALIGN(CONFIG_SYS_NONCACHED_MEMORY, + MMU_SECTION_SIZE); debug("Reserving %dM for noncached_alloc() at: %08lx\n", CONFIG_SYS_NONCACHED_MEMORY >> 20, gd->start_addr_sp); diff --git a/common/board_r.c b/common/board_r.c index b7f68bba4a..d6fb5047a2 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -247,6 +247,10 @@ static int initr_malloc(void) gd->malloc_ptr / 1024); #endif /* The malloc area is immediately below the monitor copy in DRAM */ + /* + * This value MUST match the value of gd->start_addr_sp in board_f.c: + * reserve_noncached(). + */ malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN; mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN), TOTAL_MALLOC_LEN); |