From 42d4d3baacb3b11c68163ec85de1bf2e34e0c882 Mon Sep 17 00:00:00 2001 From: Arvind Ram Prakash Date: Tue, 22 Nov 2022 14:41:00 -0600 Subject: refactor(build): distinguish BL2 as TF-A entry point and BL2 running at EL3 BL2_AT_EL3 is an overloaded macro which has two uses: 1. When BL2 is entry point into TF-A(no BL1) 2. When BL2 is running at EL3 exception level These two scenarios are not exactly same even though first implicitly means second to be true. To distinguish between these two use cases we introduce new macros. BL2_AT_EL3 is renamed to RESET_TO_BL2 to better convey both 1. and 2. Additional macro BL2_RUNS_AT_EL3 is added to cover all scenarious where BL2 runs at EL3 (including four world systems). BREAKING CHANGE: BL2_AT_EL3 renamed to RESET_TO_BL2 across the repository. Change-Id: I477e1d0f843b44b799c216670e028fcb3509fb72 Signed-off-by: Arvind Ram Prakash Signed-off-by: Maksims Svecovs --- bl2/bl2.mk | 2 +- bl2/bl2_main.c | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) (limited to 'bl2') diff --git a/bl2/bl2.mk b/bl2/bl2.mk index a18abab13..778e2c3b6 100644 --- a/bl2/bl2.mk +++ b/bl2/bl2.mk @@ -25,7 +25,7 @@ BL2_SOURCES += bl2/${ARCH}/bl2_rme_entrypoint.S \ ${GPT_LIB_SRCS} BL2_DEFAULT_LINKER_SCRIPT_SOURCE := bl2/bl2.ld.S -else ifeq (${BL2_AT_EL3},0) +else ifeq (${RESET_TO_BL2},0) # Normal operation, no RME, no BL2 at EL3 BL2_SOURCES += bl2/${ARCH}/bl2_entrypoint.S BL2_DEFAULT_LINKER_SCRIPT_SOURCE := bl2/bl2.ld.S diff --git a/bl2/bl2_main.c b/bl2/bl2_main.c index 5da803795..ce83692e0 100644 --- a/bl2/bl2_main.c +++ b/bl2/bl2_main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2022, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -27,9 +27,9 @@ #define NEXT_IMAGE "BL32" #endif -#if BL2_AT_EL3 +#if RESET_TO_BL2 /******************************************************************************* - * Setup function for BL2 when BL2_AT_EL3=1 + * Setup function for BL2 when RESET_TO_BL2=1 ******************************************************************************/ void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) @@ -48,9 +48,10 @@ void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2, assert(is_armv8_3_pauth_present()); #endif /* CTX_INCLUDE_PAUTH_REGS */ } -#else /* BL2_AT_EL3 */ +#else /* RESET_TO_BL2 */ + /******************************************************************************* - * Setup function for BL2 when BL2_AT_EL3=0 + * Setup function for BL2 when RESET_TO_BL2=0 ******************************************************************************/ void bl2_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) @@ -69,7 +70,7 @@ void bl2_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2, assert(is_armv8_3_pauth_present()); #endif /* CTX_INCLUDE_PAUTH_REGS */ } -#endif /* BL2_AT_EL3 */ +#endif /* RESET_TO_BL2 */ /******************************************************************************* * The only thing to do in BL2 is to load further images and pass control to @@ -107,7 +108,7 @@ void bl2_main(void) /* Teardown the Measured Boot backend */ bl2_plat_mboot_finish(); -#if !BL2_AT_EL3 && !ENABLE_RME +#if !BL2_RUNS_AT_EL3 #ifndef __aarch64__ /* * For AArch32 state BL1 and BL2 share the MMU setup. @@ -132,7 +133,8 @@ void bl2_main(void) * be passed to next BL image as an argument. */ smc(BL1_SMC_RUN_IMAGE, (unsigned long)next_bl_ep_info, 0, 0, 0, 0, 0, 0); -#else /* if BL2_AT_EL3 || ENABLE_RME */ +#else /* if BL2_RUNS_AT_EL3 */ + NOTICE("BL2: Booting " NEXT_IMAGE "\n"); print_entry_point_info(next_bl_ep_info); console_flush(); @@ -145,5 +147,5 @@ void bl2_main(void) #endif /* ENABLE_PAUTH */ bl2_run_next_image(next_bl_ep_info); -#endif /* BL2_AT_EL3 && ENABLE_RME */ +#endif /* BL2_RUNS_AT_EL3 */ } -- cgit v1.2.3