summaryrefslogtreecommitdiff
path: root/lib/xlat_tables_v2
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-07-15 16:42:01 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-07-15 16:42:01 +0100
commit63ddbae3655d267fd76eef65798a48f58de75485 (patch)
tree96a2de03f10468b5ef039ab274bfb88a74149317 /lib/xlat_tables_v2
parent6563c0beb8b64168debba5e6ea40719fc810796c (diff)
xlat v2: Make setup_mmu_config public
This allows other parts of the code to reuse it. No functional changes. Change-Id: Ib052ae235c422d9179958bd3016c3e678779ae9b Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'lib/xlat_tables_v2')
-rw-r--r--lib/xlat_tables_v2/aarch32/xlat_tables_arch.c14
-rw-r--r--lib/xlat_tables_v2/aarch64/xlat_tables_arch.c13
-rw-r--r--lib/xlat_tables_v2/xlat_tables_context.c15
-rw-r--r--lib/xlat_tables_v2/xlat_tables_private.h5
4 files changed, 24 insertions, 23 deletions
diff --git a/lib/xlat_tables_v2/aarch32/xlat_tables_arch.c b/lib/xlat_tables_v2/aarch32/xlat_tables_arch.c
index 6eb1d2c1..2f71110c 100644
--- a/lib/xlat_tables_v2/aarch32/xlat_tables_arch.c
+++ b/lib/xlat_tables_v2/aarch32/xlat_tables_arch.c
@@ -18,8 +18,6 @@
#error ARMv7 target does not support LPAE MMU descriptors
#endif
-uint64_t mmu_cfg_params[MMU_CFG_PARAM_MAX];
-
/*
* Returns 1 if the provided granule size is supported, 0 otherwise.
*/
@@ -109,9 +107,9 @@ int xlat_arch_current_el(void)
* Function for enabling the MMU in Secure PL1, assuming that the page tables
* have already been created.
******************************************************************************/
-void setup_mmu_cfg(unsigned int flags, const uint64_t *base_table,
- unsigned long long max_pa, uintptr_t max_va,
- __unused int xlat_regime)
+void setup_mmu_cfg(uint64_t *params, unsigned int flags,
+ const uint64_t *base_table, unsigned long long max_pa,
+ uintptr_t max_va, __unused int xlat_regime)
{
uint64_t mair, ttbr0;
uint32_t ttbcr;
@@ -180,7 +178,7 @@ void setup_mmu_cfg(unsigned int flags, const uint64_t *base_table,
#endif
/* Now populate MMU configuration */
- mmu_cfg_params[MMU_CFG_MAIR] = mair;
- mmu_cfg_params[MMU_CFG_TCR] = (uint64_t) ttbcr;
- mmu_cfg_params[MMU_CFG_TTBR0] = ttbr0;
+ params[MMU_CFG_MAIR] = mair;
+ params[MMU_CFG_TCR] = (uint64_t) ttbcr;
+ params[MMU_CFG_TTBR0] = ttbr0;
}
diff --git a/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c b/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
index 06628db2..0f289e28 100644
--- a/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
+++ b/lib/xlat_tables_v2/aarch64/xlat_tables_arch.c
@@ -13,8 +13,6 @@
#include <xlat_tables_v2.h>
#include "../xlat_tables_private.h"
-uint64_t mmu_cfg_params[MMU_CFG_PARAM_MAX];
-
/*
* Returns 1 if the provided granule size is supported, 0 otherwise.
*/
@@ -180,8 +178,9 @@ int xlat_arch_current_el(void)
return el;
}
-void setup_mmu_cfg(unsigned int flags, const uint64_t *base_table,
- unsigned long long max_pa, uintptr_t max_va, int xlat_regime)
+void setup_mmu_cfg(uint64_t *params, unsigned int flags,
+ const uint64_t *base_table, unsigned long long max_pa,
+ uintptr_t max_va, int xlat_regime)
{
uint64_t mair, ttbr0, tcr;
uintptr_t virtual_addr_space_size;
@@ -248,7 +247,7 @@ void setup_mmu_cfg(unsigned int flags, const uint64_t *base_table,
ttbr0 |= TTBR_CNP_BIT;
#endif
- mmu_cfg_params[MMU_CFG_MAIR] = mair;
- mmu_cfg_params[MMU_CFG_TCR] = tcr;
- mmu_cfg_params[MMU_CFG_TTBR0] = ttbr0;
+ params[MMU_CFG_MAIR] = mair;
+ params[MMU_CFG_TCR] = tcr;
+ params[MMU_CFG_TTBR0] = ttbr0;
}
diff --git a/lib/xlat_tables_v2/xlat_tables_context.c b/lib/xlat_tables_v2/xlat_tables_context.c
index 671d8948..76c429d7 100644
--- a/lib/xlat_tables_v2/xlat_tables_context.c
+++ b/lib/xlat_tables_v2/xlat_tables_context.c
@@ -13,6 +13,12 @@
#include "xlat_tables_private.h"
/*
+ * MMU configuration register values for the active translation context. Used
+ * from the MMU assembly helpers.
+ */
+uint64_t mmu_cfg_params[MMU_CFG_PARAM_MAX];
+
+/*
* Each platform can define the size of its physical and virtual address spaces.
* If the platform hasn't defined one or both of them, default to
* ADDR_SPACE_SIZE. The latter is deprecated, though.
@@ -105,7 +111,8 @@ void init_xlat_tables(void)
void enable_mmu_secure(unsigned int flags)
{
- setup_mmu_cfg(flags, tf_xlat_ctx.base_table, MAX_PHYS_ADDR,
+ setup_mmu_cfg((uint64_t *)&mmu_cfg_params, flags,
+ tf_xlat_ctx.base_table, MAX_PHYS_ADDR,
tf_xlat_ctx.va_max_address, EL1_EL0_REGIME);
enable_mmu_direct(flags);
}
@@ -114,14 +121,16 @@ void enable_mmu_secure(unsigned int flags)
void enable_mmu_el1(unsigned int flags)
{
- setup_mmu_cfg(flags, tf_xlat_ctx.base_table, MAX_PHYS_ADDR,
+ setup_mmu_cfg((uint64_t *)&mmu_cfg_params, flags,
+ tf_xlat_ctx.base_table, MAX_PHYS_ADDR,
tf_xlat_ctx.va_max_address, EL1_EL0_REGIME);
enable_mmu_direct_el1(flags);
}
void enable_mmu_el3(unsigned int flags)
{
- setup_mmu_cfg(flags, tf_xlat_ctx.base_table, MAX_PHYS_ADDR,
+ setup_mmu_cfg((uint64_t *)&mmu_cfg_params, flags,
+ tf_xlat_ctx.base_table, MAX_PHYS_ADDR,
tf_xlat_ctx.va_max_address, EL3_REGIME);
enable_mmu_direct_el3(flags);
}
diff --git a/lib/xlat_tables_v2/xlat_tables_private.h b/lib/xlat_tables_v2/xlat_tables_private.h
index fa770dbb..93640ddb 100644
--- a/lib/xlat_tables_v2/xlat_tables_private.h
+++ b/lib/xlat_tables_v2/xlat_tables_private.h
@@ -88,11 +88,6 @@ int xlat_arch_current_el(void);
*/
unsigned long long xlat_arch_get_max_supported_pa(void);
-/* Enable MMU and configure it to use the specified translation tables. */
-void setup_mmu_cfg(unsigned int flags, const uint64_t *base_table,
- unsigned long long max_pa, uintptr_t max_va,
- int xlat_regime);
-
/*
* Return 1 if the MMU of the translation regime managed by the given xlat_ctx_t
* is enabled, 0 otherwise.