Browse Source

refactor(imx8mp): cleanup the mmap region settings

Introduce the bl_regions array to gather all regions and make use of the
MAP_REGION_FLAT() macro. The array is than passed to mmap_add() to map
all regions. While on it introduce some defines so the addr, size and
flags can be read more easily. No functional change done.

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Change-Id: I7f637beea61138a86d691cd78fba2dd17e4dc925
pull/1989/head
Marco Felsch 2 years ago
parent
commit
c995943de8
  1. 29
      plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c

29
plat/imx/imx8m/imx8mp/imx8mp_bl31_setup.c

@ -175,21 +175,30 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
bl31_tzc380_setup(); bl31_tzc380_setup();
} }
#define MAP_BL31_TOTAL \
MAP_REGION_FLAT(BL31_BASE, BL31_LIMIT - BL31_BASE, MT_MEMORY | MT_RW | MT_SECURE)
#define MAP_BL31_RO \
MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, MT_MEMORY | MT_RO | MT_SECURE)
#define MAP_COHERENT_MEM \
MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, \
MT_DEVICE | MT_RW | MT_SECURE)
#define MAP_BL32_TOTAL \
MAP_REGION_FLAT(BL32_BASE, BL32_SIZE, MT_MEMORY | MT_RW)
void bl31_plat_arch_setup(void) void bl31_plat_arch_setup(void)
{ {
mmap_add_region(BL31_BASE, BL31_BASE, (BL31_LIMIT - BL31_BASE), const mmap_region_t bl_regions[] = {
MT_MEMORY | MT_RW | MT_SECURE); MAP_BL31_TOTAL,
mmap_add_region(BL_CODE_BASE, BL_CODE_BASE, (BL_CODE_END - BL_CODE_BASE), MAP_BL31_RO,
MT_MEMORY | MT_RO | MT_SECURE);
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
mmap_add_region(BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_BASE, MAP_COHERENT_MEM,
(BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE),
MT_DEVICE | MT_RW | MT_SECURE);
#endif #endif
/* Map TEE memory */
MAP_BL32_TOTAL,
{0}
};
/* Map TEE memory */ mmap_add(bl_regions);
mmap_add_region(BL32_BASE, BL32_BASE, BL32_SIZE, MT_MEMORY | MT_RW);
mmap_add(imx_mmap); mmap_add(imx_mmap);
init_xlat_tables(); init_xlat_tables();

Loading…
Cancel
Save