mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-15 00:54:22 +00:00
feat(console): introduce EARLY_CONSOLE
This is a generic porting of what was done on ST platforms with flag STM32MP_EARLY_CONSOLE. It creates the flag and the prototype for plat_setup_early_console(). This function depends on platform implementation. This function call is added at the beginning of each BL image early setup function. The patch also introduce an extra log macro: EARLY_ERROR. This can replace ERROR macro in code that will only be executed before the default console is enabled, and will do nothing when the EARLY_CONSOLE is not enabled. This can then save some space in memory. Signed-off-by: Yann Gautier <yann.gautier@st.com> Change-Id: I77bf0a0c4289b4c7df94e4bfb783a938e05bf023
This commit is contained in:
parent
a1255c7585
commit
ae770fedf4
11 changed files with 62 additions and 7 deletions
2
Makefile
2
Makefile
|
@ -1197,6 +1197,7 @@ $(eval $(call assert_booleans,\
|
||||||
ENABLE_CONSOLE_GETC \
|
ENABLE_CONSOLE_GETC \
|
||||||
INIT_UNUSED_NS_EL2 \
|
INIT_UNUSED_NS_EL2 \
|
||||||
PLATFORM_REPORT_CTX_MEM_USE \
|
PLATFORM_REPORT_CTX_MEM_USE \
|
||||||
|
EARLY_CONSOLE \
|
||||||
)))
|
)))
|
||||||
|
|
||||||
# Numeric_Flags
|
# Numeric_Flags
|
||||||
|
@ -1394,6 +1395,7 @@ $(eval $(call add_defines,\
|
||||||
ENABLE_CONSOLE_GETC \
|
ENABLE_CONSOLE_GETC \
|
||||||
INIT_UNUSED_NS_EL2 \
|
INIT_UNUSED_NS_EL2 \
|
||||||
PLATFORM_REPORT_CTX_MEM_USE \
|
PLATFORM_REPORT_CTX_MEM_USE \
|
||||||
|
EARLY_CONSOLE \
|
||||||
)))
|
)))
|
||||||
|
|
||||||
ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1)
|
ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -64,6 +64,9 @@ void bl1_calc_bl2_mem_layout(const meminfo_t *bl1_mem_layout,
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void bl1_setup(void)
|
void bl1_setup(void)
|
||||||
{
|
{
|
||||||
|
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||||
|
plat_setup_early_console();
|
||||||
|
|
||||||
/* Perform early platform-specific setup */
|
/* Perform early platform-specific setup */
|
||||||
bl1_early_platform_setup();
|
bl1_early_platform_setup();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +41,9 @@
|
||||||
void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||||
u_register_t arg3)
|
u_register_t arg3)
|
||||||
{
|
{
|
||||||
|
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||||
|
plat_setup_early_console();
|
||||||
|
|
||||||
/* Perform early platform-specific setup */
|
/* Perform early platform-specific setup */
|
||||||
bl2_el3_early_platform_setup(arg0, arg1, arg2, arg3);
|
bl2_el3_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||||
|
|
||||||
|
@ -63,6 +66,9 @@ void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||||
void bl2_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
void bl2_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||||
u_register_t arg3)
|
u_register_t arg3)
|
||||||
{
|
{
|
||||||
|
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||||
|
plat_setup_early_console();
|
||||||
|
|
||||||
/* Perform early platform-specific setup */
|
/* Perform early platform-specific setup */
|
||||||
bl2_early_platform_setup2(arg0, arg1, arg2, arg3);
|
bl2_early_platform_setup2(arg0, arg1, arg2, arg3);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -94,6 +94,9 @@ static void __init bl31_lib_init(void)
|
||||||
void bl31_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
void bl31_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||||
u_register_t arg3)
|
u_register_t arg3)
|
||||||
{
|
{
|
||||||
|
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||||
|
plat_setup_early_console();
|
||||||
|
|
||||||
/* Perform early platform-specific setup */
|
/* Perform early platform-specific setup */
|
||||||
bl31_early_platform_setup2(arg0, arg1, arg2, arg3);
|
bl31_early_platform_setup2(arg0, arg1, arg2, arg3);
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,9 @@ uintptr_t get_arm_std_svc_args(unsigned int svc_mask)
|
||||||
void sp_min_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
void sp_min_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||||
u_register_t arg3)
|
u_register_t arg3)
|
||||||
{
|
{
|
||||||
|
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||||
|
plat_setup_early_console();
|
||||||
|
|
||||||
/* Perform early platform-specific setup */
|
/* Perform early platform-specific setup */
|
||||||
sp_min_early_platform_setup2(arg0, arg1, arg2, arg3);
|
sp_min_early_platform_setup2(arg0, arg1, arg2, arg3);
|
||||||
sp_min_plat_arch_setup();
|
sp_min_plat_arch_setup();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, ARM Limited and Contributors. All rights reserved.
|
* Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -66,6 +66,9 @@ smc_args_t *set_smc_args(uint64_t arg0,
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
void tsp_setup(void)
|
void tsp_setup(void)
|
||||||
{
|
{
|
||||||
|
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||||
|
plat_setup_early_console();
|
||||||
|
|
||||||
/* Perform early platform-specific setup. */
|
/* Perform early platform-specific setup. */
|
||||||
tsp_early_platform_setup();
|
tsp_early_platform_setup();
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,13 @@ Common build options
|
||||||
contributions are still expected to build with ``W=0`` and ``E=1`` (the
|
contributions are still expected to build with ``W=0`` and ``E=1`` (the
|
||||||
default).
|
default).
|
||||||
|
|
||||||
|
- ``EARLY_CONSOLE``: This option is used to enable early traces before default
|
||||||
|
console is properly setup. It introduces EARLY_* traces macros, that will
|
||||||
|
use the non-EARLY traces macros if the flag is enabled, or do nothing
|
||||||
|
otherwise. To use this feature, platforms will have to create the function
|
||||||
|
plat_setup_early_console().
|
||||||
|
Default is 0 (disabled)
|
||||||
|
|
||||||
- ``EL3_PAYLOAD_BASE``: This option enables booting an EL3 payload instead of
|
- ``EL3_PAYLOAD_BASE``: This option enables booting an EL3 payload instead of
|
||||||
the normal boot flow. It must specify the entry point address of the EL3
|
the normal boot flow. It must specify the entry point address of the EL3
|
||||||
payload. Please refer to the "Booting an EL3 payload" section for more
|
payload. Please refer to the "Booting an EL3 payload" section for more
|
||||||
|
|
|
@ -3274,6 +3274,17 @@ This API is used by the crash reporting mechanism to force write of all buffered
|
||||||
data on the designated crash console. It should only use general purpose
|
data on the designated crash console. It should only use general purpose
|
||||||
registers x0 through x5 to do its work.
|
registers x0 through x5 to do its work.
|
||||||
|
|
||||||
|
Function : plat_setup_early_console [optional]
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
Argument : void
|
||||||
|
Return : void
|
||||||
|
|
||||||
|
This API is used to setup the early console, it is required only if the flag
|
||||||
|
``EARLY_CONSOLE`` is enabled.
|
||||||
|
|
||||||
.. _External Abort handling and RAS Support:
|
.. _External Abort handling and RAS Support:
|
||||||
|
|
||||||
External Abort handling and RAS Support
|
External Abort handling and RAS Support
|
||||||
|
@ -3560,7 +3571,7 @@ to :ref:`Measured Boot Design` for more details.
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
*Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.*
|
*Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.*
|
||||||
|
|
||||||
.. _PSCI: https://developer.arm.com/documentation/den0022/latest/
|
.. _PSCI: https://developer.arm.com/documentation/den0022/latest/
|
||||||
.. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html
|
.. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
|
* Copyright (c) 2013-2024, Arm Limited and Contributors. All rights reserved.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -91,6 +91,12 @@
|
||||||
# define VERBOSE(...) no_tf_log(LOG_MARKER_VERBOSE __VA_ARGS__)
|
# define VERBOSE(...) no_tf_log(LOG_MARKER_VERBOSE __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if EARLY_CONSOLE
|
||||||
|
#define EARLY_ERROR(...) ERROR(__VA_ARGS__)
|
||||||
|
#else /* !EARLY_CONSOLE */
|
||||||
|
#define EARLY_ERROR(...) no_tf_log(LOG_MARKER_ERROR __VA_ARGS__)
|
||||||
|
#endif /* EARLY_CONSOLE */
|
||||||
|
|
||||||
const char *get_el_str(unsigned int el);
|
const char *get_el_str(unsigned int el);
|
||||||
|
|
||||||
#if ENABLE_BACKTRACE
|
#if ENABLE_BACKTRACE
|
||||||
|
|
|
@ -184,6 +184,14 @@ static inline int plat_mboot_measure_key(const void *pk_oid __unused,
|
||||||
}
|
}
|
||||||
#endif /* MEASURED_BOOT */
|
#endif /* MEASURED_BOOT */
|
||||||
|
|
||||||
|
#if EARLY_CONSOLE
|
||||||
|
void plat_setup_early_console(void);
|
||||||
|
#else
|
||||||
|
static inline void plat_setup_early_console(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif /* EARLY_CONSOLE */
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Mandatory BL1 functions
|
* Mandatory BL1 functions
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2016-2023, Arm Limited. All rights reserved.
|
# Copyright (c) 2016-2024, Arm Limited. All rights reserved.
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: BSD-3-Clause
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
#
|
#
|
||||||
|
@ -392,3 +392,6 @@ CTX_INCLUDE_MPAM_REGS := 0
|
||||||
|
|
||||||
# Enable context memory usage reporting during BL31 setup.
|
# Enable context memory usage reporting during BL31 setup.
|
||||||
PLATFORM_REPORT_CTX_MEM_USE := 0
|
PLATFORM_REPORT_CTX_MEM_USE := 0
|
||||||
|
|
||||||
|
# Enable early console
|
||||||
|
EARLY_CONSOLE := 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue