summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoby Mathew <soby.mathew@arm.com>2015-12-09 11:28:43 +0000
committerSoby Mathew <soby.mathew@arm.com>2015-12-09 16:38:29 +0000
commit78e61613738e53738e1cc8ddefd4cef2f2443f4c (patch)
treed6ec13195f7839b1f0b7d6db0513c1aa4834fd7b
parent487461cb6e367a5db397c34ed75fbcfdd6bda1c9 (diff)
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
-rw-r--r--bl31/bl31_main.c8
-rw-r--r--docs/porting-guide.md11
-rw-r--r--include/plat/common/platform.h1
-rw-r--r--plat/common/aarch64/plat_common.c13
4 files changed, 31 insertions, 2 deletions
diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c
index 9abc395b..f22e6121 100644
--- a/bl31/bl31_main.c
+++ b/bl31/bl31_main.c
@@ -77,7 +77,7 @@ void bl31_main(void)
/* Perform remaining generic architectural setup from EL3 */
bl31_arch_setup();
- /* Perform platform setup in BL1 */
+ /* Perform platform setup in BL31 */
bl31_platform_setup();
/* Initialise helper libraries */
@@ -109,6 +109,12 @@ void bl31_main(void)
* corresponding to the desired security state after the next ERET.
*/
bl31_prepare_next_image_entry();
+
+ /*
+ * Perform any platform specific runtime setup prior to cold boot exit
+ * from BL31
+ */
+ bl31_plat_runtime_setup();
}
/*******************************************************************************
diff --git a/docs/porting-guide.md b/docs/porting-guide.md
index e5b4a9c7..2f71d80a 100644
--- a/docs/porting-guide.md
+++ b/docs/porting-guide.md
@@ -1172,6 +1172,17 @@ In ARM standard platforms, this function does the following:
* Detects the system topology.
+### Function : bl31_plat_runtime_setup() [optional]
+
+ Argument : void
+ Return : void
+
+The purpose of this function is allow 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.
+
+
### Function : bl31_get_next_image_info() [mandatory]
Argument : unsigned int
diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h
index de9848b7..956d17f7 100644
--- a/include/plat/common/platform.h
+++ b/include/plat/common/platform.h
@@ -179,6 +179,7 @@ void bl31_early_platform_setup(struct bl31_params *from_bl2,
void *plat_params_from_bl2);
void bl31_plat_arch_setup(void);
void bl31_platform_setup(void);
+void bl31_plat_runtime_setup(void);
struct entry_point_info *bl31_plat_get_next_image_ep_info(uint32_t type);
/*******************************************************************************
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 <assert.h>
+#include <console.h>
#include <platform.h>
#include <xlat_tables.h>
/*
- * 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