Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
7ee2b8b3
Commit
7ee2b8b3
authored
Dec 09, 2015
by
danh-arm
Browse files
Merge pull request #462 from soby-mathew/sm/runtime_console
Enable BL31 to configure a runtime console
parents
ab5a53ef
080225da
Changes
11
Hide whitespace changes
Inline
Side-by-side
bl31/bl31_main.c
View file @
7ee2b8b3
...
@@ -77,7 +77,7 @@ void bl31_main(void)
...
@@ -77,7 +77,7 @@ void bl31_main(void)
/* Perform remaining generic architectural setup from EL3 */
/* Perform remaining generic architectural setup from EL3 */
bl31_arch_setup
();
bl31_arch_setup
();
/* Perform platform setup in BL1 */
/* Perform platform setup in BL
3
1 */
bl31_platform_setup
();
bl31_platform_setup
();
/* Initialise helper libraries */
/* Initialise helper libraries */
...
@@ -109,6 +109,12 @@ void bl31_main(void)
...
@@ -109,6 +109,12 @@ void bl31_main(void)
* corresponding to the desired security state after the next ERET.
* corresponding to the desired security state after the next ERET.
*/
*/
bl31_prepare_next_image_entry
();
bl31_prepare_next_image_entry
();
/*
* Perform any platform specific runtime setup prior to cold boot exit
* from BL31
*/
bl31_plat_runtime_setup
();
}
}
/*******************************************************************************
/*******************************************************************************
...
...
docs/porting-guide.md
View file @
7ee2b8b3
...
@@ -1172,6 +1172,21 @@ In ARM standard platforms, this function does the following:
...
@@ -1172,6 +1172,21 @@ In ARM standard platforms, this function does the following:
*
Detects the system topology.
*
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]
### Function : bl31_get_next_image_info() [mandatory]
Argument : unsigned int
Argument : unsigned int
...
...
drivers/console/console.S
View file @
7ee2b8b3
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <asm_macros.S>
#include <asm_macros.S>
.
globl
console_init
.
globl
console_init
.
globl
console_uninit
.
globl
console_putc
.
globl
console_putc
.
globl
console_getc
.
globl
console_getc
...
@@ -66,6 +67,20 @@ init_fail:
...
@@ -66,6 +67,20 @@ init_fail:
ret
ret
endfunc
console_init
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
)
*
int
console_putc
(
int
c
)
*
Function
to
output
a
character
over
the
*
Function
to
output
a
character
over
the
...
...
include/drivers/console.h
View file @
7ee2b8b3
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
int
console_init
(
uintptr_t
base_addr
,
int
console_init
(
uintptr_t
base_addr
,
unsigned
int
uart_clk
,
unsigned
int
baud_rate
);
unsigned
int
uart_clk
,
unsigned
int
baud_rate
);
void
console_uninit
(
void
);
int
console_putc
(
int
c
);
int
console_putc
(
int
c
);
int
console_getc
(
void
);
int
console_getc
(
void
);
...
...
include/plat/arm/board/common/board_css_def.h
View file @
7ee2b8b3
...
@@ -74,8 +74,11 @@
...
@@ -74,8 +74,11 @@
#define PLAT_ARM_BOOT_UART_BASE SOC_CSS_UART0_BASE
#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_BOOT_UART_CLK_IN_HZ SOC_CSS_UART0_CLK_IN_HZ
#define PLAT_ARM_CRASH_UART_BASE SOC_CSS_UART1_BASE
#define PLAT_ARM_BL31_RUN_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_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_BASE V2M_IOFPGA_UART0_BASE
#define PLAT_ARM_TSP_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ
#define PLAT_ARM_TSP_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ
...
...
include/plat/arm/common/plat_arm.h
View file @
7ee2b8b3
...
@@ -175,6 +175,7 @@ void arm_bl2u_plat_arch_setup(void);
...
@@ -175,6 +175,7 @@ void arm_bl2u_plat_arch_setup(void);
void
arm_bl31_early_platform_setup
(
bl31_params_t
*
from_bl2
,
void
arm_bl31_early_platform_setup
(
bl31_params_t
*
from_bl2
,
void
*
plat_params_from_bl2
);
void
*
plat_params_from_bl2
);
void
arm_bl31_platform_setup
(
void
);
void
arm_bl31_platform_setup
(
void
);
void
arm_bl31_plat_runtime_setup
(
void
);
void
arm_bl31_plat_arch_setup
(
void
);
void
arm_bl31_plat_arch_setup
(
void
);
/* TSP utility functions */
/* TSP utility functions */
...
...
include/plat/common/platform.h
View file @
7ee2b8b3
...
@@ -216,6 +216,7 @@ void bl31_early_platform_setup(struct bl31_params *from_bl2,
...
@@ -216,6 +216,7 @@ void bl31_early_platform_setup(struct bl31_params *from_bl2,
void
*
plat_params_from_bl2
);
void
*
plat_params_from_bl2
);
void
bl31_plat_arch_setup
(
void
);
void
bl31_plat_arch_setup
(
void
);
void
bl31_platform_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
);
struct
entry_point_info
*
bl31_plat_get_next_image_ep_info
(
uint32_t
type
);
/*******************************************************************************
/*******************************************************************************
...
...
plat/arm/board/fvp/include/platform_def.h
View file @
7ee2b8b3
...
@@ -78,8 +78,11 @@
...
@@ -78,8 +78,11 @@
#define PLAT_ARM_BOOT_UART_BASE V2M_IOFPGA_UART0_BASE
#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_BOOT_UART_CLK_IN_HZ V2M_IOFPGA_UART0_CLK_IN_HZ
#define PLAT_ARM_CRASH_UART_BASE V2M_IOFPGA_UART1_BASE
#define PLAT_ARM_BL31_RUN_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_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_BASE V2M_IOFPGA_UART2_BASE
#define PLAT_ARM_TSP_UART_CLK_IN_HZ V2M_IOFPGA_UART2_CLK_IN_HZ
#define PLAT_ARM_TSP_UART_CLK_IN_HZ V2M_IOFPGA_UART2_CLK_IN_HZ
...
...
plat/arm/common/arm_bl31_setup.c
View file @
7ee2b8b3
...
@@ -223,11 +223,27 @@ void arm_bl31_platform_setup(void)
...
@@ -223,11 +223,27 @@ void arm_bl31_platform_setup(void)
plat_arm_pwrc_setup
();
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
)
void
bl31_platform_setup
(
void
)
{
{
arm_bl31_platform_setup
();
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
* Perform the very early platform specific architectural setup here. At the
* moment this is only intializes the mmu in a quick and dirty way.
* moment this is only intializes the mmu in a quick and dirty way.
...
...
plat/arm/common/arm_pm.c
View file @
7ee2b8b3
...
@@ -158,7 +158,7 @@ int arm_validate_ns_entrypoint(uintptr_t entrypoint)
...
@@ -158,7 +158,7 @@ int arm_validate_ns_entrypoint(uintptr_t entrypoint)
*****************************************************************************/
*****************************************************************************/
void
arm_system_pwr_domain_resume
(
void
)
void
arm_system_pwr_domain_resume
(
void
)
{
{
console_init
(
PLAT_ARM_B
OOT
_UART_BASE
,
PLAT_ARM_B
OOT
_UART_CLK_IN_HZ
,
console_init
(
PLAT_ARM_B
L31_RUN
_UART_BASE
,
PLAT_ARM_B
L31_RUN
_UART_CLK_IN_HZ
,
ARM_CONSOLE_BAUDRATE
);
ARM_CONSOLE_BAUDRATE
);
/* Assert system power domain is available on the platform */
/* Assert system power domain is available on the platform */
...
...
plat/common/aarch64/plat_common.c
View file @
7ee2b8b3
...
@@ -28,16 +28,18 @@
...
@@ -28,16 +28,18 @@
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#include <assert.h>
#include <assert.h>
#include <console.h>
#include <platform.h>
#include <platform.h>
#include <xlat_tables.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
* provide typical implementations that may be re-used by multiple
* platforms but may also be overridden by a platform if required.
* platforms but may also be overridden by a platform if required.
*/
*/
#pragma weak bl31_plat_enable_mmu
#pragma weak bl31_plat_enable_mmu
#pragma weak bl32_plat_enable_mmu
#pragma weak bl32_plat_enable_mmu
#pragma weak bl31_plat_runtime_setup
void
bl31_plat_enable_mmu
(
uint32_t
flags
)
void
bl31_plat_enable_mmu
(
uint32_t
flags
)
{
{
...
@@ -49,6 +51,15 @@ void bl32_plat_enable_mmu(uint32_t flags)
...
@@ -49,6 +51,15 @@ void bl32_plat_enable_mmu(uint32_t flags)
enable_mmu_el1
(
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
#if !ENABLE_PLAT_COMPAT
/*
/*
* Helper function for platform_get_pos() when platform compatibility is
* Helper function for platform_get_pos() when platform compatibility is
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment