summaryrefslogtreecommitdiffstats
path: root/common/board_f.c
diff options
context:
space:
mode:
authorVikas Manocha <vikas.manocha@st.com>2019-08-16 09:57:44 -0700
committerTom Rini <trini@konsulko.com>2019-08-26 11:46:20 -0400
commit5f7adb5b1c02592e1a7037413a986ffdf864fcc2 (patch)
tree4ed22f6ce8a3e921e2736b7de9757c79127f582c /common/board_f.c
parent27e0f3bcf07530a9cd272953797efda54ebb8f5e (diff)
downloadu-boot-5f7adb5b1c02592e1a7037413a986ffdf864fcc2.tar.gz
u-boot-5f7adb5b1c02592e1a7037413a986ffdf864fcc2.tar.xz
u-boot-5f7adb5b1c02592e1a7037413a986ffdf864fcc2.zip
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>
Diffstat (limited to 'common/board_f.c')
-rw-r--r--common/board_f.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/common/board_f.c b/common/board_f.c
index 31181a9dc4..6867abc8e6 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -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;
}