mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2024-11-26 19:33:32 +08:00
Merge changes from topic "early_console" into integration
* changes: feat(stm32mp2): use early traces feat(st-bsec): use early traces refactor(st): replace STM32MP_EARLY_CONSOLE with EARLY_CONSOLE feat(console): introduce EARLY_CONSOLE feat(bl32): create an sp_min_setup function
This commit is contained in:
commit
a97e1f9747
2
Makefile
2
Makefile
@ -1206,6 +1206,7 @@ $(eval $(call assert_booleans,\
|
||||
ENABLE_CONSOLE_GETC \
|
||||
INIT_UNUSED_NS_EL2 \
|
||||
PLATFORM_REPORT_CTX_MEM_USE \
|
||||
EARLY_CONSOLE \
|
||||
)))
|
||||
|
||||
# Numeric_Flags
|
||||
@ -1403,6 +1404,7 @@ $(eval $(call add_defines,\
|
||||
ENABLE_CONSOLE_GETC \
|
||||
INIT_UNUSED_NS_EL2 \
|
||||
PLATFORM_REPORT_CTX_MEM_USE \
|
||||
EARLY_CONSOLE \
|
||||
)))
|
||||
|
||||
ifeq (${PLATFORM_REPORT_CTX_MEM_USE}, 1)
|
||||
|
@ -44,6 +44,9 @@ uint64_t bl1_apiakey[2];
|
||||
******************************************************************************/
|
||||
void bl1_setup(void)
|
||||
{
|
||||
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||
plat_setup_early_console();
|
||||
|
||||
/* Perform early platform-specific setup */
|
||||
bl1_early_platform_setup();
|
||||
|
||||
|
@ -42,6 +42,9 @@
|
||||
void bl2_el3_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||
u_register_t arg3)
|
||||
{
|
||||
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||
plat_setup_early_console();
|
||||
|
||||
/* Perform early platform-specific setup */
|
||||
bl2_el3_early_platform_setup(arg0, arg1, arg2, arg3);
|
||||
|
||||
@ -64,6 +67,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,
|
||||
u_register_t arg3)
|
||||
{
|
||||
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||
plat_setup_early_console();
|
||||
|
||||
/* Perform early platform-specific setup */
|
||||
bl2_early_platform_setup2(arg0, arg1, arg2, arg3);
|
||||
|
||||
|
@ -95,6 +95,9 @@ static void __init bl31_lib_init(void)
|
||||
void bl31_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||
u_register_t arg3)
|
||||
{
|
||||
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||
plat_setup_early_console();
|
||||
|
||||
/* Perform early platform-specific setup */
|
||||
bl31_early_platform_setup2(arg0, arg1, arg2, arg3);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2023, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
@ -118,8 +118,7 @@ func sp_min_entrypoint
|
||||
mov r1, r10
|
||||
mov r2, r11
|
||||
mov r3, r12
|
||||
bl sp_min_early_platform_setup2
|
||||
bl sp_min_plat_arch_setup
|
||||
bl sp_min_setup
|
||||
|
||||
/* Jump to the main function */
|
||||
bl sp_min_main
|
||||
|
@ -170,6 +170,20 @@ uintptr_t get_arm_std_svc_args(unsigned int svc_mask)
|
||||
return (uintptr_t)&psci_args;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* The SP_MIN setup function. Calls platforms init functions
|
||||
*****************************************************************************/
|
||||
void sp_min_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||
u_register_t arg3)
|
||||
{
|
||||
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||
plat_setup_early_console();
|
||||
|
||||
/* Perform early platform-specific setup */
|
||||
sp_min_early_platform_setup2(arg0, arg1, arg2, arg3);
|
||||
sp_min_plat_arch_setup();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* The SP_MIN main function. Do the platform and PSCI Library setup. Also
|
||||
* initialize the runtime service framework.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
@ -7,6 +7,10 @@
|
||||
#ifndef SP_MIN_PRIVATE_H
|
||||
#define SP_MIN_PRIVATE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void sp_min_setup(u_register_t arg0, u_register_t arg1, u_register_t arg2,
|
||||
u_register_t arg3);
|
||||
void sp_min_main(void);
|
||||
void sp_min_warm_boot(void);
|
||||
void sp_min_fiq(void);
|
||||
|
@ -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
|
||||
*/
|
||||
@ -66,6 +66,9 @@ smc_args_t *set_smc_args(uint64_t arg0,
|
||||
******************************************************************************/
|
||||
void tsp_setup(void)
|
||||
{
|
||||
/* Enable early console if EARLY_CONSOLE flag is enabled */
|
||||
plat_setup_early_console();
|
||||
|
||||
/* Perform early platform-specific 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
|
||||
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
|
||||
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
|
||||
|
@ -54,8 +54,6 @@ Other configuration flags:
|
||||
| Default: stm32mp157c-ev1.dtb
|
||||
- | ``DWL_BUFFER_BASE``: the 'serial boot' load address of FIP,
|
||||
| default location (end of the first 128MB) is used when absent
|
||||
- | ``STM32MP_EARLY_CONSOLE``: to enable early traces before clock driver is setup.
|
||||
| Default: 0 (disabled)
|
||||
- | ``STM32MP_RECONFIGURE_CONSOLE``: to re-configure crash console (especially after BL2).
|
||||
| Default: 0 (disabled)
|
||||
- | ``STM32MP_UART_BAUDRATE``: to select UART baud rate.
|
||||
|
@ -3286,6 +3286,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
|
||||
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
|
||||
@ -3572,7 +3583,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/
|
||||
.. _Arm Generic Interrupt Controller version 2.0 (GICv2): http://infocenter.arm.com/help/topic/com.arm.doc.ihi0048b/index.html
|
||||
|
@ -166,11 +166,13 @@ static void bsec_late_init(void)
|
||||
struct dt_node_info bsec_info;
|
||||
|
||||
if (fdt_get_address(&fdt) == 0) {
|
||||
EARLY_ERROR("%s: DT not found\n", __func__);
|
||||
panic();
|
||||
}
|
||||
|
||||
node = bsec_get_dt_node(&bsec_info);
|
||||
if (node < 0) {
|
||||
EARLY_ERROR("%s: BSEC node not found\n", __func__);
|
||||
panic();
|
||||
}
|
||||
|
||||
@ -226,13 +228,21 @@ static uint32_t bsec_check_error(uint32_t otp, bool check_disturbed)
|
||||
*/
|
||||
uint32_t bsec_probe(void)
|
||||
{
|
||||
uint32_t version;
|
||||
uint32_t id;
|
||||
|
||||
if (is_otp_invalid_mode()) {
|
||||
EARLY_ERROR("%s: otp_invalid_mod\n", __func__);
|
||||
return BSEC_ERROR;
|
||||
}
|
||||
|
||||
if (((bsec_get_version() != BSEC_IP_VERSION_1_1) &&
|
||||
(bsec_get_version() != BSEC_IP_VERSION_2_0)) ||
|
||||
(bsec_get_id() != BSEC_IP_ID_2)) {
|
||||
version = bsec_get_version();
|
||||
id = bsec_get_id();
|
||||
|
||||
if (((version != BSEC_IP_VERSION_1_1) &&
|
||||
(version != BSEC_IP_VERSION_2_0)) ||
|
||||
(id != BSEC_IP_ID_2)) {
|
||||
EARLY_ERROR("%s: version = 0x%x, id = 0x%x\n", __func__, version, id);
|
||||
panic();
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ uint32_t bsec_probe(void)
|
||||
uint32_t id = bsec_get_id();
|
||||
|
||||
if ((version != BSEC_IP_VERSION_1_0) || (id != BSEC_IP_ID_3)) {
|
||||
ERROR("%s: version = 0x%x, id = 0x%x\n", __func__, version, id);
|
||||
EARLY_ERROR("%s: version = 0x%x, id = 0x%x\n", __func__, version, id);
|
||||
panic();
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
@ -91,6 +91,12 @@
|
||||
# define VERBOSE(...) no_tf_log(LOG_MARKER_VERBOSE __VA_ARGS__)
|
||||
#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);
|
||||
|
||||
#if ENABLE_BACKTRACE
|
||||
|
@ -184,6 +184,14 @@ static inline int plat_mboot_measure_key(const void *pk_oid __unused,
|
||||
}
|
||||
#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
|
||||
******************************************************************************/
|
||||
|
@ -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
|
||||
#
|
||||
@ -392,3 +392,6 @@ CTX_INCLUDE_MPAM_REGS := 0
|
||||
|
||||
# Enable context memory usage reporting during BL31 setup.
|
||||
PLATFORM_REPORT_CTX_MEM_USE := 0
|
||||
|
||||
# Enable early console
|
||||
EARLY_CONSOLE := 0
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
RESET_TO_BL2 := 1
|
||||
|
||||
STM32MP_EARLY_CONSOLE ?= 0
|
||||
STM32MP_RECONFIGURE_CONSOLE ?= 0
|
||||
STM32MP_UART_BAUDRATE ?= 115200
|
||||
|
||||
@ -82,7 +81,6 @@ endif
|
||||
$(eval $(call assert_booleans,\
|
||||
$(sort \
|
||||
PLAT_XLAT_TABLES_DYNAMIC \
|
||||
STM32MP_EARLY_CONSOLE \
|
||||
STM32MP_EMMC \
|
||||
STM32MP_EMMC_BOOT \
|
||||
STM32MP_RAW_NAND \
|
||||
@ -104,7 +102,6 @@ $(eval $(call add_defines,\
|
||||
$(sort \
|
||||
PLAT_XLAT_TABLES_DYNAMIC \
|
||||
STM32_TF_VERSION \
|
||||
STM32MP_EARLY_CONSOLE \
|
||||
STM32MP_EMMC \
|
||||
STM32MP_EMMC_BOOT \
|
||||
STM32MP_RAW_NAND \
|
||||
|
@ -77,14 +77,6 @@ uintptr_t get_uart_address(uint32_t instance_nb);
|
||||
/* Setup the UART console */
|
||||
int stm32mp_uart_console_setup(void);
|
||||
|
||||
#if STM32MP_EARLY_CONSOLE
|
||||
void stm32mp_setup_early_console(void);
|
||||
#else
|
||||
static inline void stm32mp_setup_early_console(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Platform util functions for the GPIO driver
|
||||
* @bank: Target GPIO bank ID as per DT bindings
|
||||
|
@ -269,8 +269,8 @@ int stm32mp_uart_console_setup(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if STM32MP_EARLY_CONSOLE
|
||||
void stm32mp_setup_early_console(void)
|
||||
#if EARLY_CONSOLE
|
||||
void plat_setup_early_console(void)
|
||||
{
|
||||
#if defined(IMAGE_BL2) || STM32MP_RECONFIGURE_CONSOLE
|
||||
plat_crash_console_init();
|
||||
@ -278,7 +278,7 @@ void stm32mp_setup_early_console(void)
|
||||
set_console(STM32MP_DEBUG_USART_BASE, STM32MP_DEBUG_USART_CLK_FRQ);
|
||||
NOTICE("Early console setup\n");
|
||||
}
|
||||
#endif /* STM32MP_EARLY_CONSOLE */
|
||||
#endif /* EARLY_CONSOLE */
|
||||
|
||||
/*****************************************************************************
|
||||
* plat_is_smccc_feature_available() - This function checks whether SMCCC
|
||||
|
@ -142,8 +142,6 @@ void bl2_el3_early_platform_setup(u_register_t arg0,
|
||||
u_register_t arg2 __unused,
|
||||
u_register_t arg3 __unused)
|
||||
{
|
||||
stm32mp_setup_early_console();
|
||||
|
||||
stm32mp_save_boot_ctx_address(arg0);
|
||||
}
|
||||
|
||||
|
@ -116,8 +116,6 @@ void sp_min_early_platform_setup2(u_register_t arg0, u_register_t arg1,
|
||||
bl_params_t *params_from_bl2 = (bl_params_t *)arg0;
|
||||
uintptr_t dt_addr = arg1;
|
||||
|
||||
stm32mp_setup_early_console();
|
||||
|
||||
/* Imprecise aborts can be masked in NonSecure */
|
||||
write_scr(read_scr() | SCR_AW_BIT);
|
||||
|
||||
|
@ -18,7 +18,6 @@ void bl2_el3_early_platform_setup(u_register_t arg0 __unused,
|
||||
u_register_t arg2 __unused,
|
||||
u_register_t arg3 __unused)
|
||||
{
|
||||
stm32mp_setup_early_console();
|
||||
}
|
||||
|
||||
void bl2_platform_setup(void)
|
||||
@ -28,7 +27,7 @@ void bl2_platform_setup(void)
|
||||
void bl2_el3_plat_arch_setup(void)
|
||||
{
|
||||
if (stm32_otp_probe() != 0U) {
|
||||
ERROR("OTP probe failed\n");
|
||||
EARLY_ERROR("OTP probe failed\n");
|
||||
panic();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user