refactor(console): consolidate console runtime switch

Refactor console_flush() and console_switch_state(CONSOLE_FLAG_RUNTIME)
to bl31_main(). This has been done per the recommendation in TF-A
mailing list. These calls need to be the last calls, after any runtime
initialization has been done, before BL31 exits.

All platforms that override the generic implementation of
bl31_plat_runtime_setup() have been refactored. The console_flush()
and console_switch_state() calls have been removed as they become
part of bl31_main() function.

Any platform that don't need to make any change to the generic (weak)
implementation of bl31_plat_runtime_setup() don't need to override it
in their platforms.

Change-Id: I6d04d6daa9353daeaa7e3df9e9adf6f322a917b8
Signed-off-by: Salman Nabi <salman.nabi@arm.com>
This commit is contained in:
Salman Nabi 2024-02-21 17:07:24 +00:00
parent 92752355f5
commit af3e8e63b4
18 changed files with 4 additions and 68 deletions

View file

@ -212,8 +212,6 @@ void bl31_main(void)
*/
bl31_prepare_next_image_entry();
console_flush();
/*
* Perform any platform specific runtime setup prior to cold boot exit
* from BL31
@ -221,9 +219,12 @@ void bl31_main(void)
bl31_plat_runtime_setup();
#if ENABLE_RUNTIME_INSTRUMENTATION
PMF_CAPTURE_TIMESTAMP(bl_svc, BL31_EXIT, PMF_CACHE_MAINT);
console_flush();
PMF_CAPTURE_TIMESTAMP(bl_svc, BL31_EXIT, PMF_CACHE_MAINT);
#endif
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
/*******************************************************************************

View file

@ -186,9 +186,6 @@ void bl31_plat_runtime_setup(void)
{
/* Change the DTB if the configuration requires so. */
sunxi_prepare_dtb(fdt);
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)

View file

@ -237,9 +237,6 @@ void brcm_bl31_plat_runtime_setup(void)
{
/* Initialize the runtime console */
bcm_console_runtime_init();
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
void bl31_platform_setup(void)

View file

@ -35,8 +35,6 @@
void bl31_plat_runtime_setup(void)
{
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
/*

View file

@ -149,9 +149,3 @@ void bl31_platform_setup(void)
hisi_ipc_init();
hisi_pwrc_setup();
}
void bl31_plat_runtime_setup(void)
{
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}

View file

@ -270,7 +270,4 @@ void bl31_plat_runtime_setup(void)
if (rc != 0)
panic();
#endif
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}

View file

@ -118,12 +118,6 @@ void bl31_platform_setup(void)
hisi_tzpc_sec_init();
}
void bl31_plat_runtime_setup(void)
{
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
void bl31_plat_arch_setup(void)
{
plat_configure_mmu_el3(BL31_BASE,

View file

@ -408,9 +408,3 @@ unsigned int plat_get_syscnt_freq2(void)
{
return COUNTER_FREQUENCY;
}
void bl31_plat_runtime_setup(void)
{
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}

View file

@ -386,9 +386,3 @@ unsigned int plat_get_syscnt_freq2(void)
{
return COUNTER_FREQUENCY;
}
void bl31_plat_runtime_setup(void)
{
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}

View file

@ -136,12 +136,6 @@ void bl31_platform_setup(void)
plat_gic_init();
}
void bl31_plat_runtime_setup(void)
{
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
entry_point_info_t *bl31_plat_get_next_image_ep_info(unsigned int type)
{
if (type == NON_SECURE) {

View file

@ -183,9 +183,6 @@ void marvell_bl31_plat_runtime_setup(void)
{
/* Initialize the runtime console */
marvell_console_runtime_init();
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
void bl31_platform_setup(void)

View file

@ -166,9 +166,6 @@ void bl31_platform_setup(void)
void bl31_plat_runtime_setup(void)
{
mtk_init_one_level(MTK_INIT_LVL_PLAT_RUNTIME);
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
unsigned int plat_get_syscnt_freq2(void)

View file

@ -258,9 +258,6 @@ void bl31_plat_runtime_setup(void)
*/
boot_profiler_add_record("[TF] bl31 exit");
boot_profiler_deinit();
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
/*******************************************************************************

View file

@ -186,9 +186,6 @@ void bl31_plat_runtime_setup(void)
ls_el3_interrupt_config();
#endif
soc_runtime_setup();
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
/*******************************************************************************

View file

@ -209,9 +209,6 @@ void bl31_plat_runtime_setup(void)
struct draminfo *di = (struct draminfo *)(unsigned long)DRAMINFO_BASE;
sq_scp_get_draminfo(di);
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
void bl31_plat_arch_setup(void)

View file

@ -206,9 +206,6 @@ void bl31_plat_runtime_setup(void)
if (rc != 0) {
panic();
}
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
/*

View file

@ -231,9 +231,6 @@ void bl31_plat_runtime_setup(void)
if (rc != 0) {
panic();
}
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
/*

View file

@ -190,9 +190,6 @@ void bl31_plat_runtime_setup(void)
#endif
custom_runtime_setup();
console_flush();
console_switch_state(CONSOLE_FLAG_RUNTIME);
}
/*