diff options
author | York Sun <yorksun@freescale.com> | 2015-12-04 11:57:07 -0800 |
---|---|---|
committer | York Sun <yorksun@freescale.com> | 2015-12-15 08:57:32 +0800 |
commit | e81495224f732f17ae6f379baf23b90cd1d5cb5f (patch) | |
tree | f0e798cad86d64d6c2978307c94299f7f30eb208 /common | |
parent | 000f4e7686f4291fbd74d8920b586caf10f9241f (diff) | |
download | u-boot-imx-e81495224f732f17ae6f379baf23b90cd1d5cb5f.zip u-boot-imx-e81495224f732f17ae6f379baf23b90cd1d5cb5f.tar.gz u-boot-imx-e81495224f732f17ae6f379baf23b90cd1d5cb5f.tar.bz2 |
Reserve secure memory
Secure memory is at the end of memory, separated and reserved
from OS, tracked by gd->secure_ram. Secure memory can host
MMU tables, security monitor, etc. This is different from PRAM
used to reserve private memory. PRAM offers memory at the top
of u-boot memory, not necessarily the real end of memory for
systems with very large DDR. Using the end of memory simplifies
MMU setup and avoid memory fragmentation.
"bdinfo" command shows gd->secure_ram value if this memory is
marked as secured.
Signed-off-by: York Sun <yorksun@freescale.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/board_f.c | 9 | ||||
-rw-r--r-- | common/cmd_bdinfo.c | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/common/board_f.c b/common/board_f.c index b407354..bd5a486 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -324,6 +324,15 @@ 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->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 diff --git a/common/cmd_bdinfo.c b/common/cmd_bdinfo.c index adda55a..deed6d8 100644 --- a/common/cmd_bdinfo.c +++ b/common/cmd_bdinfo.c @@ -382,6 +382,12 @@ static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, print_num("-> size", bd->bi_dram[i].size); } +#ifdef CONFIG_SYS_MEM_RESERVE_SECURE + if (gd->secure_ram & MEM_RESERVE_SECURE_SECURED) { + print_num("Secure ram", + gd->secure_ram & MEM_RESERVE_SECURE_ADDR_MASK); + } +#endif #if defined(CONFIG_CMD_NET) && !defined(CONFIG_DM_ETH) print_eths(); #endif |