mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
Merge pull request #462 from soby-mathew/sm/runtime_console
Enable BL31 to configure a runtime console
This commit is contained in:
commit
7ee2b8b3f8
11 changed files with 79 additions and 7 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -1172,6 +1172,21 @@ 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.
|
||||
|
||||
In ARM Standard platforms, this function will initialize the BL31 runtime
|
||||
console which will cause all further BL31 logs to be output to the
|
||||
runtime console.
|
||||
|
||||
|
||||
### Function : bl31_get_next_image_info() [mandatory]
|
||||
|
||||
Argument : unsigned int
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <asm_macros.S>
|
||||
|
||||
.globl console_init
|
||||
.globl console_uninit
|
||||
.globl console_putc
|
||||
.globl console_getc
|
||||
|
||||
|
@ -66,6 +67,20 @@ init_fail:
|
|||
ret
|
||||
endfunc console_init
|
||||
|
||||
/* -----------------------------------------------
|
||||
* void console_uninit(void)
|
||||
* Function to finish the use of console driver.
|
||||
* It sets the console_base as NULL so that any
|
||||
* further invocation of `console_putc` or
|
||||
* `console_getc` APIs would return error.
|
||||
* -----------------------------------------------
|
||||
*/
|
||||
func console_uninit
|
||||
mov x0, #0
|
||||
adrp x3, console_base
|
||||
str x0, [x3, :lo12:console_base]
|
||||
endfunc console_uninit
|
||||
|
||||
/* ---------------------------------------------
|
||||
* int console_putc(int c)
|
||||
* Function to output a character over the
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
int console_init(uintptr_t base_addr,
|
||||
unsigned int uart_clk, unsigned int baud_rate);
|
||||
void console_uninit(void);
|
||||
int console_putc(int c);
|
||||
int console_getc(void);
|
||||
|
||||
|
|
|
@ -74,8 +74,11 @@
|
|||
#define PLAT_ARM_BOOT_UART_BASE SOC_CSS_UART0_BASE
|
||||
#define PLAT_ARM_BOOT_UART_CLK_IN_HZ SOC_CSS_UART0_CLK_IN_HZ
|
||||
|
||||
#define PLAT_ARM_CRASH_UART_BASE SOC_CSS_UART1_BASE
|
||||
#define PLAT_ARM_CRASH_UART_CLK_IN_HZ SOC_CSS_UART1_CLK_IN_HZ
|
||||
#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_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
|
||||
|
||||
#define PLAT_ARM_TSP_UART_BASE V2M_IOFPGA_UART0_BASE
|
||||
#define PLAT_ARM_TSP_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ
|
||||
|
|
|
@ -175,6 +175,7 @@ void arm_bl2u_plat_arch_setup(void);
|
|||
void arm_bl31_early_platform_setup(bl31_params_t *from_bl2,
|
||||
void *plat_params_from_bl2);
|
||||
void arm_bl31_platform_setup(void);
|
||||
void arm_bl31_plat_runtime_setup(void);
|
||||
void arm_bl31_plat_arch_setup(void);
|
||||
|
||||
/* TSP utility functions */
|
||||
|
|
|
@ -216,6 +216,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);
|
||||
|
||||
/*******************************************************************************
|
||||
|
|
|
@ -78,8 +78,11 @@
|
|||
#define PLAT_ARM_BOOT_UART_BASE V2M_IOFPGA_UART0_BASE
|
||||
#define PLAT_ARM_BOOT_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ
|
||||
|
||||
#define PLAT_ARM_CRASH_UART_BASE V2M_IOFPGA_UART1_BASE
|
||||
#define PLAT_ARM_CRASH_UART_CLK_IN_HZ V2M_IOFPGA_UART1_CLK_IN_HZ
|
||||
#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_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
|
||||
|
||||
#define PLAT_ARM_TSP_UART_BASE V2M_IOFPGA_UART2_BASE
|
||||
#define PLAT_ARM_TSP_UART_CLK_IN_HZ V2M_IOFPGA_UART2_CLK_IN_HZ
|
||||
|
|
|
@ -223,11 +223,27 @@ void arm_bl31_platform_setup(void)
|
|||
plat_arm_pwrc_setup();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Perform any BL3-1 platform runtime setup prior to BL3-1 exit common to ARM
|
||||
* standard platforms
|
||||
******************************************************************************/
|
||||
void arm_bl31_plat_runtime_setup(void)
|
||||
{
|
||||
/* Initialize the runtime console */
|
||||
console_init(PLAT_ARM_BL31_RUN_UART_BASE, PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ,
|
||||
ARM_CONSOLE_BAUDRATE);
|
||||
}
|
||||
|
||||
void bl31_platform_setup(void)
|
||||
{
|
||||
arm_bl31_platform_setup();
|
||||
}
|
||||
|
||||
void bl31_plat_runtime_setup(void)
|
||||
{
|
||||
arm_bl31_plat_runtime_setup();
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Perform the very early platform specific architectural setup here. At the
|
||||
* moment this is only intializes the mmu in a quick and dirty way.
|
||||
|
|
|
@ -158,7 +158,7 @@ int arm_validate_ns_entrypoint(uintptr_t entrypoint)
|
|||
*****************************************************************************/
|
||||
void arm_system_pwr_domain_resume(void)
|
||||
{
|
||||
console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ,
|
||||
console_init(PLAT_ARM_BL31_RUN_UART_BASE, PLAT_ARM_BL31_RUN_UART_CLK_IN_HZ,
|
||||
ARM_CONSOLE_BAUDRATE);
|
||||
|
||||
/* Assert system power domain is available on the platform */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue