summaryrefslogtreecommitdiff
path: root/plat/common
diff options
context:
space:
mode:
authorRoberto Vargas <roberto.vargas@arm.com>2018-10-19 16:44:18 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-10-26 14:55:30 +0100
commit0916c38deca4a2e26720da6b1aa1e15de87f9a34 (patch)
treef15d1c6d4e6a0f6055d8b6b470fad942ce947db3 /plat/common
parent03987d01e9effe2b896e1ddb16894238d37e099a (diff)
Convert arm_setup_page_tables into a generic helper
This function is not related to Arm platforms and can be reused by other platforms if needed. Change-Id: Ia9c328ce57ce7e917b825a9e09a42b0abb1a53e8 Co-authored-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com> Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'plat/common')
-rw-r--r--plat/common/plat_bl_common.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/plat/common/plat_bl_common.c b/plat/common/plat_bl_common.c
index 50d79d42..4cf1cc57 100644
--- a/plat/common/plat_bl_common.c
+++ b/plat/common/plat_bl_common.c
@@ -73,3 +73,40 @@ int plat_get_mbedtls_heap(void **heap_addr, size_t *heap_size)
return 0;
}
#endif /* TRUSTED_BOARD_BOOT */
+
+/*
+ * Set up the page tables for the generic and platform-specific memory regions.
+ * The size of the Trusted SRAM seen by the BL image must be specified as well
+ * as an array specifying the generic memory regions which can be;
+ * - Code section;
+ * - Read-only data section;
+ * - Init code section, if applicable
+ * - Coherent memory region, if applicable.
+ */
+
+void __init setup_page_tables(const mmap_region_t *bl_regions,
+ const mmap_region_t *plat_regions)
+{
+#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
+ const mmap_region_t *regions = bl_regions;
+
+ while (regions->size != 0U) {
+ VERBOSE("Region: 0x%lx - 0x%lx has attributes 0x%x\n",
+ regions->base_va,
+ regions->base_va + regions->size,
+ regions->attr);
+ regions++;
+ }
+#endif
+ /*
+ * Map the Trusted SRAM with appropriate memory attributes.
+ * Subsequent mappings will adjust the attributes for specific regions.
+ */
+ mmap_add(bl_regions);
+
+ /* Now (re-)map the platform-specific memory regions */
+ mmap_add(plat_regions);
+
+ /* Create the page tables to reflect the above mappings */
+ init_xlat_tables();
+}