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
0d3a27e7
Unverified
Commit
0d3a27e7
authored
Jan 19, 2018
by
davidcunado-arm
Committed by
GitHub
Jan 19, 2018
Browse files
Merge pull request #1200 from robertovargas-arm/bl2-el3
Add BL2_AT_EL3 build option
parents
0caaa03b
76d26733
Changes
35
Hide whitespace changes
Inline
Side-by-side
include/lib/cpus/aarch64/cpu_macros.S
View file @
0d3a27e7
...
...
@@ -21,6 +21,10 @@
/*
Word
size
for
64
-
bit
CPUs
*/
#define CPU_WORD_SIZE 8
#if defined(IMAGE_BL1) || defined(IMAGE_BL31) ||(defined(IMAGE_BL2) && BL2_AT_EL3)
#define IMAGE_AT_EL3
#endif
/*
*
Whether
errata
status
needs
reporting
.
Errata
status
is
printed
in
debug
*
builds
for
both
BL1
and
BL31
images
.
...
...
@@ -38,7 +42,7 @@
CPU_MIDR
:
/
*
cpu_ops
midr
*/
.
space
8
/*
Reset
fn
is
needed
in
BL
at
reset
vector
*/
#if defined(IMAGE_
BL1) || defined(IMAGE_B
L3
1
)
#if defined(IMAGE_
AT_E
L3)
CPU_RESET_FUNC
:
/
*
cpu_ops
reset_func
*/
.
space
8
#endif
...
...
@@ -54,7 +58,7 @@ CPU_PWR_DWN_OPS: /* cpu_ops power down functions */
#if REPORT_ERRATA
CPU_ERRATA_FUNC
:
.
space
8
#ifdef
IMAGE_BL31
#if
def
ined(
IMAGE_BL31
)
CPU_ERRATA_LOCK
:
.
space
8
CPU_ERRATA_PRINTED
:
...
...
@@ -124,7 +128,7 @@ CPU_OPS_SIZE = .
.
align
3
.
type
cpu_ops_
\
_name
,
%
object
.
quad
\
_midr
#if defined(IMAGE_
BL1) || defined(IMAGE_B
L3
1
)
#if defined(IMAGE_
AT_E
L3)
.
quad
\
_resetfunc
#endif
#ifdef IMAGE_BL31
...
...
include/lib/xlat_tables/xlat_tables_v2_helpers.h
View file @
0d3a27e7
...
...
@@ -168,7 +168,7 @@ struct xlat_ctx {
* This IMAGE_EL macro must not to be used outside the library, and it is only
* used in AArch64.
*/
#if defined(IMAGE_BL1) || defined(IMAGE_BL31)
#if defined(IMAGE_BL1) || defined(IMAGE_BL31)
|| (defined(IMAGE_BL2) && BL2_AT_EL3)
# define IMAGE_EL 3
# define IMAGE_XLAT_DEFAULT_REGIME EL3_REGIME
#else
...
...
include/plat/arm/common/arm_def.h
View file @
0d3a27e7
...
...
@@ -334,6 +334,11 @@
#define BL2_BASE (BL1_RW_BASE - PLAT_ARM_MAX_BL2_SIZE)
#define BL2_LIMIT BL1_RW_BASE
#elif BL2_AT_EL3
#define BL2_BASE ARM_BL_RAM_BASE
#define BL2_LIMIT (ARM_BL_RAM_BASE + ARM_BL_RAM_SIZE)
#elif defined(AARCH32) || JUNO_AARCH32_EL3_RUNTIME
/*
* Put BL2 just below BL32.
...
...
include/plat/arm/common/plat_arm.h
View file @
0d3a27e7
...
...
@@ -145,6 +145,10 @@ uint32_t arm_get_spsr_for_bl32_entry(void);
uint32_t
arm_get_spsr_for_bl33_entry
(
void
);
int
arm_bl2_handle_post_image_load
(
unsigned
int
image_id
);
/* BL2 at EL3 functions */
void
arm_bl2_el3_early_platform_setup
(
void
);
void
arm_bl2_el3_plat_arch_setup
(
void
);
/* BL2U utility functions */
void
arm_bl2u_early_platform_setup
(
struct
meminfo
*
mem_layout
,
void
*
plat_info
);
...
...
include/plat/common/platform.h
View file @
0d3a27e7
...
...
@@ -235,6 +235,21 @@ void bl2_plat_get_bl32_meminfo(struct meminfo *mem_info);
* Optional BL2 functions (may be overridden)
******************************************************************************/
/*******************************************************************************
* Mandatory BL2 at EL3 functions: Must be implemented if BL2_AT_EL3 image is
* supported
******************************************************************************/
void
bl2_el3_early_platform_setup
(
u_register_t
arg0
,
u_register_t
arg1
,
u_register_t
arg2
,
u_register_t
arg3
);
void
bl2_el3_plat_arch_setup
(
void
);
/*******************************************************************************
* Optional BL2 at EL3 functions (may be overridden)
******************************************************************************/
void
bl2_el3_plat_prepare_exit
(
void
);
/*******************************************************************************
* Mandatory BL2U functions.
******************************************************************************/
...
...
lib/cpus/aarch32/cpu_helpers.S
View file @
0d3a27e7
...
...
@@ -10,7 +10,7 @@
#include <cpu_data.h>
#include <cpu_macros.S>
#if defined(IMAGE_BL1) || defined(IMAGE_BL32)
#if defined(IMAGE_BL1) || defined(IMAGE_BL32)
|| (defined(IMAGE_BL2) && BL2_AT_EL3)
/
*
*
The
reset
handler
common
to
all
platforms
.
After
a
matching
*
cpu_ops
structure
entry
is
found
,
the
correponding
reset_handler
...
...
@@ -42,7 +42,7 @@ func reset_handler
bx
lr
endfunc
reset_handler
#endif
/* IMAGE_BL1 || IMAGE_BL32 */
#endif
#ifdef IMAGE_BL32 /* The power down core and cluster is needed only in BL32 */
/
*
...
...
lib/cpus/aarch64/cpu_helpers.S
View file @
0d3a27e7
...
...
@@ -7,7 +7,7 @@
#include <arch.h>
#include <asm_macros.S>
#include <assert_macros.S>
#ifdef
IMAGE_BL31
#if
def
ined(
IMAGE_BL31
) || (defined(IMAGE_BL2) && BL2_AT_EL3)
#include <cpu_data.h>
#endif
#include <cpu_macros.S>
...
...
@@ -15,7 +15,7 @@
#include <errata_report.h>
/
*
Reset
fn
is
needed
in
BL
at
reset
vector
*/
#if defined(IMAGE_BL1) || defined(IMAGE_BL31)
#if defined(IMAGE_BL1) || defined(IMAGE_BL31)
|| (defined(IMAGE_BL2) && BL2_AT_EL3)
/
*
*
The
reset
handler
common
to
all
platforms
.
After
a
matching
*
cpu_ops
structure
entry
is
found
,
the
correponding
reset_handler
...
...
@@ -47,7 +47,7 @@ func reset_handler
ret
endfunc
reset_handler
#endif
/* IMAGE_BL1 || IMAGE_BL31 */
#endif
#ifdef IMAGE_BL31 /* The power down core and cluster is needed only in BL31 */
/
*
...
...
lib/cpus/errata_report.c
View file @
0d3a27e7
...
...
@@ -20,6 +20,8 @@
# define BL_STRING "BL31"
#elif defined(AARCH32) && defined(IMAGE_BL32)
# define BL_STRING "BL32"
#elif defined(IMAGE_BL2) && BL2_AT_EL3
# define BL_STRING "BL2"
#else
# error This image should not be printing errata status
#endif
...
...
make_helpers/defaults.mk
View file @
0d3a27e7
...
...
@@ -27,6 +27,9 @@ ARM_GIC_ARCH := 2
# Base commit to perform code check on
BASE_COMMIT
:=
origin/master
# Execute BL2 at EL3
BL2_AT_EL3
:=
0
# By default, consider that the platform may release several CPUs out of reset.
# The platform Makefile is free to override this value.
COLD_BOOT_SINGLE_CPU
:=
0
...
...
make_helpers/tbbr/tbbr_tools.mk
View file @
0d3a27e7
...
...
@@ -64,7 +64,9 @@ $(if ${NON_TRUSTED_WORLD_KEY},$(eval $(call CERT_ADD_CMD_OPT,${NON_TRUSTED_WORLD
$(if
${BL2},$(eval
$(call
CERT_ADD_CMD_OPT,${BL2},--tb-fw,true)),\
$(eval
$(call
CERT_ADD_CMD_OPT,$(call
IMG_BIN,2),--tb-fw,true)))
$(eval
$(call
CERT_ADD_CMD_OPT,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
ifeq
(${BL2_AT_EL3}, 0)
$(eval
$(call
FIP_ADD_PAYLOAD,${BUILD_PLAT}/tb_fw.crt,--tb-fw-cert))
endif
# Add the SCP_BL2 CoT (key cert + img cert + image)
ifneq
(${SCP_BL2},)
...
...
plat/arm/board/fvp/fvp_bl2_el3_setup.c
0 → 100644
View file @
0d3a27e7
/*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <plat_arm.h>
#include "fvp_private.h"
void
bl2_el3_early_platform_setup
(
u_register_t
arg0
__unused
,
u_register_t
arg1
__unused
,
u_register_t
arg2
__unused
,
u_register_t
arg3
__unused
)
{
arm_bl2_el3_early_platform_setup
();
/* Initialize the platform config for future decision making */
fvp_config_setup
();
/*
* Initialize Interconnect for this cluster during cold boot.
* No need for locks as no other CPU is active.
*/
fvp_interconnect_init
();
/*
* Enable coherency in Interconnect for the primary CPU's cluster.
*/
fvp_interconnect_enable
();
}
plat/arm/board/fvp/platform.mk
View file @
0d3a27e7
...
...
@@ -126,6 +126,13 @@ BL2_SOURCES += drivers/io/io_semihosting.c \
plat/arm/board/fvp/fvp_trusted_boot.c
\
${FVP_SECURITY_SOURCES}
ifeq
(${BL2_AT_EL3},1)
BL2_SOURCES
+=
plat/arm/board/fvp/
${ARCH}
/fvp_helpers.S
\
plat/arm/board/fvp/fvp_bl2_el3_setup.c
\
${FVP_CPU_LIBS}
\
${FVP_INTERCONNECT_SOURCES}
endif
ifeq
(${FVP_USE_SP804_TIMER},1)
BL2_SOURCES
+=
drivers/arm/sp804/sp804_delay_timer.c
endif
...
...
@@ -165,5 +172,9 @@ endif
# Add support for platform supplied linker script for BL31 build
$(eval
$(call
add_define,PLAT_EXTRA_LD_SCRIPT))
ifneq
(${BL2_AT_EL3}, 0)
override
BL1_SOURCES
=
endif
include
plat/arm/board/common/board_common.mk
include
plat/arm/common/arm_common.mk
plat/arm/common/arm_bl2_el3_setup.c
0 → 100644
View file @
0d3a27e7
/*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <console.h>
#include <generic_delay_timer.h>
#include <plat_arm.h>
#include <platform.h>
#pragma weak bl2_el3_early_platform_setup
#pragma weak bl2_el3_plat_arch_setup
#pragma weak bl2_el3_plat_prepare_exit
static
meminfo_t
bl2_el3_tzram_layout
;
/*
* Perform arm specific early platform setup. At this moment we only initialize
* the console and the memory layout.
*/
void
arm_bl2_el3_early_platform_setup
(
void
)
{
/* Initialize the console to provide early debug support */
console_init
(
PLAT_ARM_BOOT_UART_BASE
,
PLAT_ARM_BOOT_UART_CLK_IN_HZ
,
ARM_CONSOLE_BAUDRATE
);
/*
* Allow BL2 to see the whole Trusted RAM. This is determined
* statically since we cannot rely on BL1 passing this information
* in the BL2_AT_EL3 case.
*/
bl2_el3_tzram_layout
.
total_base
=
ARM_BL_RAM_BASE
;
bl2_el3_tzram_layout
.
total_size
=
ARM_BL_RAM_SIZE
;
/* Initialise the IO layer and register platform IO devices */
plat_arm_io_setup
();
}
void
bl2_el3_early_platform_setup
(
u_register_t
arg0
__unused
,
u_register_t
arg1
__unused
,
u_register_t
arg2
__unused
,
u_register_t
arg3
__unused
)
{
arm_bl2_el3_early_platform_setup
();
/*
* Initialize Interconnect for this cluster during cold boot.
* No need for locks as no other CPU is active.
*/
plat_arm_interconnect_init
();
/*
* Enable Interconnect coherency for the primary CPU's cluster.
*/
plat_arm_interconnect_enter_coherency
();
generic_delay_timer_init
();
}
/*******************************************************************************
* Perform the very early platform specific architectural setup here. At the
* moment this is only initializes the mmu in a quick and dirty way.
******************************************************************************/
void
arm_bl2_el3_plat_arch_setup
(
void
)
{
arm_setup_page_tables
(
bl2_el3_tzram_layout
.
total_base
,
bl2_el3_tzram_layout
.
total_size
,
BL_CODE_BASE
,
BL_CODE_END
,
BL_RO_DATA_BASE
,
BL_RO_DATA_END
#if USE_COHERENT_MEM
,
BL_COHERENT_RAM_BASE
,
BL_COHERENT_RAM_END
#endif
);
#ifdef AARCH32
enable_mmu_secure
(
0
);
#else
enable_mmu_el3
(
0
);
#endif
}
void
bl2_el3_plat_arch_setup
(
void
)
{
arm_bl2_el3_plat_arch_setup
();
}
void
bl2_el3_plat_prepare_exit
(
void
)
{
}
plat/arm/common/arm_common.mk
View file @
0d3a27e7
...
...
@@ -150,6 +150,11 @@ BL2_SOURCES += drivers/delay_timer/delay_timer.c \
drivers/io/io_storage.c
\
plat/arm/common/arm_bl2_setup.c
\
plat/arm/common/arm_io_storage.c
ifeq
(${BL2_AT_EL3},1)
BL2_SOURCES
+=
plat/arm/common/arm_bl2_el3_setup.c
endif
ifeq
(${LOAD_IMAGE_V2},1)
# Because BL1/BL2 execute in AArch64 mode but BL32 in AArch32 we need to use
# the AArch32 descriptors.
...
...
plat/common/plat_bl2_el3_common.c
0 → 100644
View file @
0d3a27e7
/*
* Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch_helpers.h>
#include <assert.h>
#include <bl_common.h>
#include <debug.h>
#include <errno.h>
#include <platform_def.h>
/*
* The following platform functions are weakly defined. They
* are default implementations that allow BL2 to compile in
* absence of real definitions. The Platforms may override
* with more complex definitions.
*/
#pragma weak bl2_el3_plat_prepare_exit
void
bl2_el3_plat_prepare_exit
(
void
)
{
}
Prev
1
2
Next
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