From 78e61613738e53738e1cc8ddefd4cef2f2443f4c Mon Sep 17 00:00:00 2001 From: Soby Mathew Date: Wed, 9 Dec 2015 11:28:43 +0000 Subject: Ensure BL31 does not print to boot console by default It is not ideal for BL31 to continue to use boot console at runtime which could be potentially uninitialized. This patch introduces a new optional platform porting API `bl31_plat_runtime_setup()` which allows the platform to perform any BL31 runtime setup just prior to BL31 exit during cold boot. The default weak implementation of this function will invoke `console_uninit()` which will suppress any BL31 runtime logs. On the ARM Standard platforms, there is an anomaly that the boot console will be reinitialized on resumption from system suspend in `arm_system_pwr_domain_resume()`. This will be resolved in the following patch. NOTE: The default weak definition of `bl31_plat_runtime_setup()` disables the BL31 console. To print the BL31 runtime messages, platforms must override this API and initialize a runtime console. Fixes ARM-software/tf-issues#328 Change-Id: Ibaf8346fcceb447fe1a5674094c9f8eb4c09ac4a --- plat/common/aarch64/plat_common.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'plat/common') diff --git a/plat/common/aarch64/plat_common.c b/plat/common/aarch64/plat_common.c index a6a84765..9070c613 100644 --- a/plat/common/aarch64/plat_common.c +++ b/plat/common/aarch64/plat_common.c @@ -28,16 +28,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include +#include #include #include /* - * The following 2 platform setup functions are weakly defined. They + * The following platform setup functions are weakly defined. They * provide typical implementations that may be re-used by multiple * platforms but may also be overridden by a platform if required. */ #pragma weak bl31_plat_enable_mmu #pragma weak bl32_plat_enable_mmu +#pragma weak bl31_plat_runtime_setup void bl31_plat_enable_mmu(uint32_t flags) { @@ -49,6 +51,15 @@ void bl32_plat_enable_mmu(uint32_t flags) enable_mmu_el1(flags); } +void bl31_plat_runtime_setup(void) +{ + /* + * Finish the use of console driver in BL31 so that any runtime logs + * from BL31 will be suppressed. + */ + console_uninit(); +} + #if !ENABLE_PLAT_COMPAT /* * Helper function for platform_get_pos() when platform compatibility is -- cgit v1.2.3