From 21568304ef48cb66acc9fb7d89b7d2fa8bd95e48 Mon Sep 17 00:00:00 2001 From: Dimitris Papastamos Date: Wed, 7 Jun 2017 13:45:41 +0100 Subject: [PATCH] sp_min: Implement `sp_min_plat_runtime_setup()` On ARM platforms before exiting from SP_MIN ensure that the default console is switched to the runtime serial port. Change-Id: I0ca0d42cc47e345d56179eac16aa3d6712767c9b Signed-off-by: Dimitris Papastamos --- bl32/sp_min/sp_min_main.c | 6 ++++++ include/bl32/sp_min/platform_sp_min.h | 5 +++-- include/plat/arm/board/common/board_css_def.h | 3 +++ include/plat/arm/common/plat_arm.h | 1 + plat/arm/board/fvp/include/platform_def.h | 3 +++ plat/arm/common/sp_min/arm_sp_min_setup.c | 18 +++++++++++++++++- plat/common/aarch32/plat_common.c | 11 +++++++++++ 7 files changed, 44 insertions(+), 3 deletions(-) diff --git a/bl32/sp_min/sp_min_main.c b/bl32/sp_min/sp_min_main.c index 45ad03f99..73a5d69a4 100644 --- a/bl32/sp_min/sp_min_main.c +++ b/bl32/sp_min/sp_min_main.c @@ -176,6 +176,12 @@ void sp_min_main(void) * corresponding to the desired security state after the next ERET. */ sp_min_prepare_next_image_entry(); + + /* + * Perform any platform specific runtime setup prior to cold boot exit + * from SP_MIN. + */ + sp_min_plat_runtime_setup(); } /****************************************************************************** diff --git a/include/bl32/sp_min/platform_sp_min.h b/include/bl32/sp_min/platform_sp_min.h index 5b4a5c341..70c5c14da 100644 --- a/include/bl32/sp_min/platform_sp_min.h +++ b/include/bl32/sp_min/platform_sp_min.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -12,8 +12,9 @@ ******************************************************************************/ void sp_min_early_platform_setup(void *from_bl2, void *plat_params_from_bl2); -void sp_min_plat_arch_setup(void); void sp_min_platform_setup(void); +void sp_min_plat_runtime_setup(void); +void sp_min_plat_arch_setup(void); entry_point_info_t *sp_min_plat_get_bl33_ep_info(void); #endif /* __PLATFORM_SP_MIN_H__ */ diff --git a/include/plat/arm/board/common/board_css_def.h b/include/plat/arm/board/common/board_css_def.h index 11c4b1779..b0a6baf35 100644 --- a/include/plat/arm/board/common/board_css_def.h +++ b/include/plat/arm/board/common/board_css_def.h @@ -54,6 +54,9 @@ #define PLAT_ARM_BL31_RUN_UART_BASE SOC_CSS_UART1_BASE #define PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ SOC_CSS_UART1_CLK_IN_HZ +#define PLAT_ARM_SP_MIN_RUN_UART_BASE SOC_CSS_UART1_BASE +#define PLAT_ARM_SP_MIN_RUN_UART_CLK_IN_HZ SOC_CSS_UART1_CLK_IN_HZ + #define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_BL31_RUN_UART_BASE #define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ diff --git a/include/plat/arm/common/plat_arm.h b/include/plat/arm/common/plat_arm.h index 62c0ce7e6..e61c22f53 100644 --- a/include/plat/arm/common/plat_arm.h +++ b/include/plat/arm/common/plat_arm.h @@ -163,6 +163,7 @@ void arm_tsp_early_platform_setup(void); /* SP_MIN utility functions */ void arm_sp_min_early_platform_setup(void *from_bl2, void *plat_params_from_bl2); +void arm_sp_min_plat_runtime_setup(void); /* FIP TOC validity check */ int arm_io_is_toc_valid(void); diff --git a/plat/arm/board/fvp/include/platform_def.h b/plat/arm/board/fvp/include/platform_def.h index d9d6eb18e..f13fc8e61 100644 --- a/plat/arm/board/fvp/include/platform_def.h +++ b/plat/arm/board/fvp/include/platform_def.h @@ -56,6 +56,9 @@ #define PLAT_ARM_BL31_RUN_UART_BASE V2M_IOFPGA_UART1_BASE #define PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ V2M_IOFPGA_UART1_CLK_IN_HZ +#define PLAT_ARM_SP_MIN_RUN_UART_BASE V2M_IOFPGA_UART1_BASE +#define PLAT_ARM_SP_MIN_RUN_UART_CLK_IN_HZ V2M_IOFPGA_UART1_CLK_IN_HZ + #define PLAT_ARM_CRASH_UART_BASE PLAT_ARM_BL31_RUN_UART_BASE #define PLAT_ARM_CRASH_UART_CLK_IN_HZ PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ diff --git a/plat/arm/common/sp_min/arm_sp_min_setup.c b/plat/arm/common/sp_min/arm_sp_min_setup.c index 79a4b6b4b..c5408c8f9 100644 --- a/plat/arm/common/sp_min/arm_sp_min_setup.c +++ b/plat/arm/common/sp_min/arm_sp_min_setup.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -127,6 +127,17 @@ void sp_min_early_platform_setup(void *from_bl2, plat_arm_interconnect_enter_coherency(); } +/******************************************************************************* + * Perform any SP_MIN platform runtime setup prior to SP_MIN exit. + * Common to ARM standard platforms. + ******************************************************************************/ +void arm_sp_min_plat_runtime_setup(void) +{ + /* Initialize the runtime console */ + console_init(PLAT_ARM_SP_MIN_RUN_UART_BASE, + PLAT_ARM_SP_MIN_RUN_UART_CLK_IN_HZ, ARM_CONSOLE_BAUDRATE); +} + /******************************************************************************* * Perform platform specific setup for SP_MIN ******************************************************************************/ @@ -155,6 +166,11 @@ void sp_min_platform_setup(void) plat_arm_pwrc_setup(); } +void sp_min_plat_runtime_setup(void) +{ + arm_sp_min_plat_runtime_setup(); +} + /******************************************************************************* * Perform the very early platform specific architectural setup here. At the * moment this only initializes the MMU diff --git a/plat/common/aarch32/plat_common.c b/plat/common/aarch32/plat_common.c index f5cfee5b3..d3799d28b 100644 --- a/plat/common/aarch32/plat_common.c +++ b/plat/common/aarch32/plat_common.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ +#include #include #include @@ -13,8 +14,18 @@ * platforms but may also be overridden by a platform if required. */ #pragma weak bl32_plat_enable_mmu +#pragma weak sp_min_plat_runtime_setup void bl32_plat_enable_mmu(uint32_t flags) { enable_mmu_secure(flags); } + +void sp_min_plat_runtime_setup(void) +{ + /* + * Finish the use of console driver in SP_MIN so that any runtime logs + * from SP_MIN will be suppressed. + */ + console_uninit(); +}