summaryrefslogtreecommitdiff
path: root/common/board_f.c
diff options
context:
space:
mode:
authorYork Sun <york.sun@nxp.com>2017-03-06 17:02:28 (GMT)
committerYork Sun <york.sun@nxp.com>2017-03-14 15:44:03 (GMT)
commit36cc0de0b919c0e185739142742e0a76a7c5c30a (patch)
tree23c4bf83f6b7546e45df69ebfc1161549fbf3284 /common/board_f.c
parent426337455e06c2d05c40f48e488b95a12e4aa056 (diff)
downloadu-boot-36cc0de0b919c0e185739142742e0a76a7c5c30a.tar.xz
armv8: layerscape: Rewrite memory reservation
For ARMv8 Layerscape SoCs, secure memory and MC memorey are reserved at the end of DDR. DDR is spit into two or three banks. This patch reverts commit aabd7ddb and simplifies the calculation of reserved memory, and moves the code into common SoC file. Secure memory is carved out first. DDR bank size is reduced. Reserved memory is then allocated on the top of available memory. U-Boot still has access to reserved memory as data transferring is needed. Device tree is fixed with reduced memory size to hide the reserved memory from OS. The same region is reserved for efi_loader. Signed-off-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'common/board_f.c')
-rw-r--r--common/board_f.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/common/board_f.c b/common/board_f.c
index ae6cd85..7d1ede0 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -325,15 +325,6 @@ __weak ulong board_get_usable_ram_top(ulong total_size)
return gd->ram_top;
}
-__weak phys_size_t board_reserve_ram_top(phys_size_t ram_size)
-{
-#ifdef CONFIG_SYS_MEM_TOP_HIDE
- return ram_size - CONFIG_SYS_MEM_TOP_HIDE;
-#else
- return ram_size;
-#endif
-}
-
static int setup_dest_addr(void)
{
debug("Monitor len: %08lX\n", gd->mon_len);
@@ -341,26 +332,19 @@ static int setup_dest_addr(void)
* Ram is setup, size stored in gd !!
*/
debug("Ram size: %08lX\n", (ulong)gd->ram_size);
-#ifdef CONFIG_SYS_MEM_RESERVE_SECURE
- /* Reserve memory for secure MMU tables, and/or security monitor */
- gd->ram_size -= CONFIG_SYS_MEM_RESERVE_SECURE;
- /*
- * Record secure memory location. Need recalcuate if memory splits
- * into banks, or the ram base is not zero.
- */
- gd->arch.secure_ram = gd->ram_size;
-#endif
+#if defined(CONFIG_SYS_MEM_TOP_HIDE)
/*
* Subtract specified amount of memory to hide so that it won't
* get "touched" at all by U-Boot. By fixing up gd->ram_size
* the Linux kernel should now get passed the now "corrected"
- * memory size and won't touch it either. This has been used
- * by arch/powerpc exclusively. Now ARMv8 takes advantage of
- * thie mechanism. If memory is split into banks, addresses
- * need to be calculated.
+ * memory size and won't touch it either. This should work
+ * for arch/ppc and arch/powerpc. Only Linux board ports in
+ * arch/powerpc with bootwrapper support, that recalculate the
+ * memory size from the SDRAM controller setup will have to
+ * get fixed.
*/
- gd->ram_size = board_reserve_ram_top(gd->ram_size);
-
+ gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE;
+#endif
#ifdef CONFIG_SYS_SDRAM_BASE
gd->ram_top = CONFIG_SYS_SDRAM_BASE;
#endif