mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-23 22:14:54 +00:00
stm32mp: update MMU config before the relocation
Mark the top of ram, used for relocated U-Boot as a normal memory (cacheable and executable) to avoid permission access issue when U-Boot jumps to this relocated code. When MMU is activated in pre-reloc stage; only the beginning of DDR is marked executable. This patch avoids access issue when DACR is correctly managed. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
This commit is contained in:
parent
35b65dd8ef
commit
1419e5b516
1 changed files with 9 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <log.h>
|
#include <log.h>
|
||||||
#include <ram.h>
|
#include <ram.h>
|
||||||
#include <asm/global_data.h>
|
#include <asm/global_data.h>
|
||||||
|
#include <asm/system.h>
|
||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ int dram_init(void)
|
||||||
|
|
||||||
ulong board_get_usable_ram_top(ulong total_size)
|
ulong board_get_usable_ram_top(ulong total_size)
|
||||||
{
|
{
|
||||||
|
phys_size_t size;
|
||||||
phys_addr_t reg;
|
phys_addr_t reg;
|
||||||
struct lmb lmb;
|
struct lmb lmb;
|
||||||
|
|
||||||
|
@ -48,10 +50,13 @@ ulong board_get_usable_ram_top(ulong total_size)
|
||||||
lmb_init(&lmb);
|
lmb_init(&lmb);
|
||||||
lmb_add(&lmb, gd->ram_base, gd->ram_size);
|
lmb_add(&lmb, gd->ram_base, gd->ram_size);
|
||||||
boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob);
|
boot_fdt_add_mem_rsv_regions(&lmb, (void *)gd->fdt_blob);
|
||||||
reg = lmb_alloc(&lmb, CONFIG_SYS_MALLOC_LEN + total_size, SZ_4K);
|
size = ALIGN(CONFIG_SYS_MALLOC_LEN + total_size, MMU_SECTION_SIZE),
|
||||||
|
reg = lmb_alloc(&lmb, size, MMU_SECTION_SIZE);
|
||||||
|
|
||||||
if (reg)
|
if (!reg)
|
||||||
return ALIGN(reg + CONFIG_SYS_MALLOC_LEN + total_size, SZ_4K);
|
reg = gd->ram_top - size;
|
||||||
|
|
||||||
return gd->ram_top;
|
mmu_set_region_dcache_behaviour(reg, size, DCACHE_DEFAULT_OPTION);
|
||||||
|
|
||||||
|
return reg + size;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue