board_f: reserve noncached space below malloc area

Noncached area at present is being initialized to random space after malloc
area. It works in most the cases as it goes to stack area & stack is not
overwriting it being far from it.

Signed-off-by: Vikas Manocha <vikas.manocha@st.com>
This commit is contained in:
Vikas Manocha 2019-08-16 09:57:44 -07:00 committed by Tom Rini
parent 27e0f3bcf0
commit 5f7adb5b1c
1 changed files with 17 additions and 0 deletions

View File

@ -467,12 +467,29 @@ static int reserve_uboot(void)
return 0;
}
#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;
debug("Reserving %dM for noncached_alloc() at: %08lx\n",
CONFIG_SYS_NONCACHED_MEMORY >> 20, gd->start_addr_sp);
return 0;
}
#endif
/* reserve memory for malloc() area */
static int reserve_malloc(void)
{
gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN;
debug("Reserving %dk for malloc() at: %08lx\n",
TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp);
#ifdef CONFIG_SYS_NONCACHED_MEMORY
reserve_noncached();
#endif
return 0;
}