aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/bl_common.c7
-rw-r--r--include/lib/aarch64/arch_helpers.h5
-rw-r--r--plat/fvp/aarch64/plat_common.c3
3 files changed, 8 insertions, 7 deletions
diff --git a/common/bl_common.c b/common/bl_common.c
index 5361c38..86b0cc5 100644
--- a/common/bl_common.c
+++ b/common/bl_common.c
@@ -106,9 +106,7 @@ void __dead2 raise_el(aapcs64_params_t *args)
*/
void __dead2 change_el(el_change_info_t *info)
{
- unsigned long current_el = read_current_el();
-
- if (GET_EL(current_el) == MODE_EL3) {
+ if (IS_IN_EL3()) {
/*
* We can go anywhere from EL3. So find where.
* TODO: Lots to do if we are going non-secure.
@@ -551,7 +549,6 @@ void __dead2 run_image(unsigned long entrypoint,
void *second_arg)
{
el_change_info_t run_image_info;
- unsigned long current_el = read_current_el();
/* Tell next EL what we want done */
run_image_info.args.arg0 = RUN_IMAGE;
@@ -565,7 +562,7 @@ void __dead2 run_image(unsigned long entrypoint,
* to jump to a higher EL and issue an SMC. Contents of argY
* will go into the general purpose register xY e.g. arg0->x0
*/
- if (GET_EL(current_el) == MODE_EL3) {
+ if (IS_IN_EL3()) {
run_image_info.args.arg1 = (unsigned long) first_arg;
run_image_info.args.arg2 = (unsigned long) second_arg;
} else {
diff --git a/include/lib/aarch64/arch_helpers.h b/include/lib/aarch64/arch_helpers.h
index 517e25a..67b452b 100644
--- a/include/lib/aarch64/arch_helpers.h
+++ b/include/lib/aarch64/arch_helpers.h
@@ -264,5 +264,10 @@ extern void write_cpuectlr(unsigned long);
extern void write_cptr_el2(unsigned long);
extern void write_cptr_el3(unsigned long);
+#define IS_IN_EL(x) \
+ (GET_EL(read_current_el()) == MODE_EL##x)
+
+#define IS_IN_EL1() IS_IN_EL(1)
+#define IS_IN_EL3() IS_IN_EL(3)
#endif /* __ARCH_HELPERS_H__ */
diff --git a/plat/fvp/aarch64/plat_common.c b/plat/fvp/aarch64/plat_common.c
index edeb6e0..9e205a0 100644
--- a/plat/fvp/aarch64/plat_common.c
+++ b/plat/fvp/aarch64/plat_common.c
@@ -52,7 +52,6 @@ static unsigned long platform_config[CONFIG_LIMIT];
void enable_mmu()
{
unsigned long mair, tcr, ttbr, sctlr;
- unsigned long current_el = read_current_el();
/* Set the attributes in the right indices of the MAIR */
mair = MAIR_ATTR_SET(ATTR_DEVICE, ATTR_DEVICE_INDEX);
@@ -68,7 +67,7 @@ void enable_mmu()
/* Set TTBR bits as well */
ttbr = (unsigned long) l1_xlation_table;
- if (GET_EL(current_el) == MODE_EL3) {
+ if (IS_IN_EL3()) {
assert((read_sctlr_el3() & SCTLR_M_BIT) == 0);
write_mair_el3(mair);