refactor(arm): console runtime switch on bl31 exit

Any BL31 setup and Runtime initialization within BL31 is still part of
the BOOT process. As such, the console flush and switch must be the
last calls before BL31 exit. Flush the console print buffer before
switching to runtime. This is so that there is no lingering chars in
the print buffer when we move to the runtime console.

This patch adds console flush before switching to runtime in
bl31_plat_runtime_setup() function (before BL31 exits). The plan is to
move flush and switch calls to bl31_main before BL31 exits, until then
console_flush() in bl31_main.c has been left as is.

This patch affects the Arm platform only.

Change-Id: I4d367b9e9640686ac15246ad24318ae4685c12c5
Signed-off-by: Salman Nabi <salman.nabi@arm.com>
This commit is contained in:
Salman Nabi 2024-02-19 17:03:44 +00:00
parent b90bbd1af4
commit c864af9891
2 changed files with 6 additions and 6 deletions

View file

@ -154,10 +154,10 @@ void __init bl31_plat_arch_setup(void)
#if defined(SPD_spmd) && (SPMC_AT_EL3 == 0)
void tc_bl31_plat_runtime_setup(void)
{
arm_bl31_plat_runtime_setup();
/* Start secure watchdog timer. */
plat_arm_secure_wdt_start();
arm_bl31_plat_runtime_setup();
}
void bl31_plat_runtime_setup(void)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -325,12 +325,9 @@ void arm_bl31_platform_setup(void)
/*******************************************************************************
* Perform any BL31 platform runtime setup prior to BL31 exit common to ARM
* standard platforms
* Perform BL31 platform setup
******************************************************************************/
void arm_bl31_plat_runtime_setup(void)
{
console_switch_state(CONSOLE_FLAG_RUNTIME);
/* Initialize the runtime console */
arm_console_runtime_init();
@ -341,6 +338,9 @@ void arm_bl31_plat_runtime_setup(void)
#if PLAT_RO_XLAT_TABLES
arm_xlat_make_tables_readonly();
#endif
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
#if RECLAIM_INIT_CODE