refactor(lib/xlat): split xlat_arch_setup_mmu_cfg
Decouple calculating from writing MMU registers. A new structure is
added that can hold the calculated values for mmu registers.
xlat_arch_setup_mmu_cfg only initialises this structure, while the
new function xlat_arch_write_mmu_cfg writes the values to the
registers.
Change-Id: Iea4be3c4594f10057bf35b4e2b2c8030cca2b764
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/plat/common/src/plat_common_init.c b/plat/common/src/plat_common_init.c
index 20634d2..7ad9986 100644
--- a/plat/common/src/plat_common_init.c
+++ b/plat/common/src/plat_common_init.c
@@ -199,15 +199,19 @@
int plat_cmn_warmboot_setup(void)
{
int ret;
+ struct xlat_mmu_cfg mmu_config;
+
/* Setup the MMU cfg for the low region (runtime context) */
- ret = xlat_arch_setup_mmu_cfg(&runtime_xlat_ctx);
+ ret = xlat_arch_setup_mmu_cfg(&runtime_xlat_ctx, &mmu_config);
if (ret != 0) {
ERROR("%s (%u): Failed to setup xlat tables for CPU[%u]\n",
__func__, __LINE__, my_cpuid());
return ret;
}
+ xlat_arch_write_mmu_cfg(&mmu_config);
+
/* Perform warm boot initialization of the high VA region */
ret = xlat_high_va_setup();
if (ret != 0) {