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
4c51badf
Commit
4c51badf
authored
Mar 31, 2016
by
danh-arm
Browse files
Merge pull request #570 from davwan01/bl31-in-dram
Add support to load BL31 in DRAM
parents
aaa416a4
4518dd9a
Changes
7
Hide whitespace changes
Inline
Side-by-side
docs/user-guide.md
View file @
4c51badf
...
@@ -498,6 +498,12 @@ map is explained in the [Firmware Design].
...
@@ -498,6 +498,12 @@ map is explained in the [Firmware Design].
that wish to optimise memory usage for page tables need to set this flag to 1
that wish to optimise memory usage for page tables need to set this flag to 1
and must override the related macros.
and must override the related macros.
*
'ARM_BL31_IN_DRAM': Boolean option to select loading of BL31 in TZC secured
DRAM. By default, BL31 is in the secure SRAM. Set this flag to 1 to load
BL31 in TZC secured DRAM. If TSP is present, then setting this option also
sets the TSP location to DRAM and ignores the
`ARM_TSP_RAM_LOCATION`
build
flag.
#### ARM CSS platform specific build options
#### ARM CSS platform specific build options
*
`CSS_DETECT_PRE_1_7_0_SCP`
: Boolean flag to detect SCP version
*
`CSS_DETECT_PRE_1_7_0_SCP`
: Boolean flag to detect SCP version
...
...
include/plat/arm/board/common/board_arm_def.h
View file @
4c51badf
...
@@ -75,10 +75,10 @@
...
@@ -75,10 +75,10 @@
*/
*/
#if IMAGE_BL31 || IMAGE_BL32
#if IMAGE_BL31 || IMAGE_BL32
# define PLAT_ARM_MMAP_ENTRIES 6
# define PLAT_ARM_MMAP_ENTRIES 6
# define MAX_XLAT_TABLES 3
#else
# define PLAT_ARM_MMAP_ENTRIES 9
# define MAX_XLAT_TABLES 4
# define MAX_XLAT_TABLES 4
#else
# define PLAT_ARM_MMAP_ENTRIES 10
# define MAX_XLAT_TABLES 5
#endif
#endif
#endif
/* ARM_BOARD_OPTIMISE_MMAP */
#endif
/* ARM_BOARD_OPTIMISE_MMAP */
...
...
include/plat/arm/common/arm_def.h
View file @
4c51badf
...
@@ -165,6 +165,12 @@
...
@@ -165,6 +165,12 @@
TSP_SEC_MEM_SIZE, \
TSP_SEC_MEM_SIZE, \
MT_MEMORY | MT_RW | MT_SECURE)
MT_MEMORY | MT_RW | MT_SECURE)
#if ARM_BL31_IN_DRAM
#define ARM_MAP_BL31_SEC_DRAM MAP_REGION_FLAT( \
BL31_BASE, \
PLAT_ARM_MAX_BL31_SIZE, \
MT_MEMORY | MT_RW | MT_SECURE)
#endif
/*
/*
* The number of regions like RO(code), coherent and data required by
* The number of regions like RO(code), coherent and data required by
...
@@ -240,15 +246,32 @@
...
@@ -240,15 +246,32 @@
/*******************************************************************************
/*******************************************************************************
* BL2 specific defines.
* BL2 specific defines.
******************************************************************************/
******************************************************************************/
#if ARM_BL31_IN_DRAM
/*
* BL31 is loaded in the DRAM.
* Put BL2 just below BL1.
*/
#define BL2_BASE (BL1_RW_BASE - PLAT_ARM_MAX_BL2_SIZE)
#define BL2_LIMIT BL1_RW_BASE
#else
/*
/*
* Put BL2 just below BL31.
* Put BL2 just below BL31.
*/
*/
#define BL2_BASE (BL31_BASE - PLAT_ARM_MAX_BL2_SIZE)
#define BL2_BASE (BL31_BASE - PLAT_ARM_MAX_BL2_SIZE)
#define BL2_LIMIT BL31_BASE
#define BL2_LIMIT BL31_BASE
#endif
/*******************************************************************************
/*******************************************************************************
* BL31 specific defines.
* BL31 specific defines.
******************************************************************************/
******************************************************************************/
#if ARM_BL31_IN_DRAM
/*
* Put BL31 at the bottom of TZC secured DRAM
*/
#define BL31_BASE ARM_AP_TZC_DRAM1_BASE
#define BL31_LIMIT (ARM_AP_TZC_DRAM1_BASE + \
PLAT_ARM_MAX_BL31_SIZE)
#else
/*
/*
* Put BL31 at the top of the Trusted SRAM.
* Put BL31 at the top of the Trusted SRAM.
*/
*/
...
@@ -257,6 +280,7 @@
...
@@ -257,6 +280,7 @@
PLAT_ARM_MAX_BL31_SIZE)
PLAT_ARM_MAX_BL31_SIZE)
#define BL31_PROGBITS_LIMIT BL1_RW_BASE
#define BL31_PROGBITS_LIMIT BL1_RW_BASE
#define BL31_LIMIT (ARM_BL_RAM_BASE + ARM_BL_RAM_SIZE)
#define BL31_LIMIT (ARM_BL_RAM_BASE + ARM_BL_RAM_SIZE)
#endif
/*******************************************************************************
/*******************************************************************************
* BL32 specific defines.
* BL32 specific defines.
...
@@ -266,7 +290,16 @@
...
@@ -266,7 +290,16 @@
* Trusted DRAM (if available) or the DRAM region secured by the TrustZone
* Trusted DRAM (if available) or the DRAM region secured by the TrustZone
* controller.
* controller.
*/
*/
#if ARM_TSP_RAM_LOCATION_ID == ARM_TRUSTED_SRAM_ID
#if ARM_BL31_IN_DRAM
# define TSP_SEC_MEM_BASE (ARM_AP_TZC_DRAM1_BASE + \
PLAT_ARM_MAX_BL31_SIZE)
# define TSP_SEC_MEM_SIZE (ARM_AP_TZC_DRAM1_SIZE - \
PLAT_ARM_MAX_BL31_SIZE)
# define BL32_BASE (ARM_AP_TZC_DRAM1_BASE + \
PLAT_ARM_MAX_BL31_SIZE)
# define BL32_LIMIT (ARM_AP_TZC_DRAM1_BASE + \
ARM_AP_TZC_DRAM1_SIZE)
#elif ARM_TSP_RAM_LOCATION_ID == ARM_TRUSTED_SRAM_ID
# define TSP_SEC_MEM_BASE ARM_BL_RAM_BASE
# define TSP_SEC_MEM_BASE ARM_BL_RAM_BASE
# define TSP_SEC_MEM_SIZE ARM_BL_RAM_SIZE
# define TSP_SEC_MEM_SIZE ARM_BL_RAM_SIZE
# define TSP_PROGBITS_LIMIT BL2_BASE
# define TSP_PROGBITS_LIMIT BL2_BASE
...
@@ -292,7 +325,11 @@
...
@@ -292,7 +325,11 @@
* FWU Images: NS_BL1U, BL2U & NS_BL2U defines.
* FWU Images: NS_BL1U, BL2U & NS_BL2U defines.
******************************************************************************/
******************************************************************************/
#define BL2U_BASE BL2_BASE
#define BL2U_BASE BL2_BASE
#if ARM_BL31_IN_DRAM
#define BL2U_LIMIT BL1_RW_BASE
#else
#define BL2U_LIMIT BL31_BASE
#define BL2U_LIMIT BL31_BASE
#endif
#define NS_BL2U_BASE ARM_NS_DRAM1_BASE
#define NS_BL2U_BASE ARM_NS_DRAM1_BASE
#define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + 0x03EB8000)
#define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + 0x03EB8000)
...
...
plat/arm/board/fvp/aarch64/fvp_common.c
View file @
4c51badf
...
@@ -97,6 +97,9 @@ const mmap_region_t plat_arm_mmap[] = {
...
@@ -97,6 +97,9 @@ const mmap_region_t plat_arm_mmap[] = {
MAP_DEVICE2
,
MAP_DEVICE2
,
ARM_MAP_NS_DRAM1
,
ARM_MAP_NS_DRAM1
,
ARM_MAP_TSP_SEC_MEM
,
ARM_MAP_TSP_SEC_MEM
,
#if ARM_BL31_IN_DRAM
ARM_MAP_BL31_SEC_DRAM
,
#endif
{
0
}
{
0
}
};
};
#endif
#endif
...
...
plat/arm/board/fvp/include/platform_def.h
View file @
4c51badf
...
@@ -146,11 +146,7 @@
...
@@ -146,11 +146,7 @@
* PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
* PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size
* plus a little space for growth.
* plus a little space for growth.
*/
*/
#if TRUSTED_BOARD_BOOT
#define PLAT_ARM_MAX_BL1_RW_SIZE 0xA000
# define PLAT_ARM_MAX_BL1_RW_SIZE 0x9000
#else
# define PLAT_ARM_MAX_BL1_RW_SIZE 0x6000
#endif
/*
/*
* PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
* PLAT_ARM_MAX_BL2_SIZE is calculated using the current BL2 debug size plus a
...
...
plat/arm/common/arm_bl2_setup.c
View file @
4c51badf
/*
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015
-2016
, ARM Limited and Contributors. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -96,11 +96,27 @@ static bl2_to_bl31_params_mem_t bl31_params_mem;
...
@@ -96,11 +96,27 @@ static bl2_to_bl31_params_mem_t bl31_params_mem;
#pragma weak bl2_plat_get_bl33_meminfo
#pragma weak bl2_plat_get_bl33_meminfo
#pragma weak bl2_plat_set_bl33_ep_info
#pragma weak bl2_plat_set_bl33_ep_info
#if ARM_BL31_IN_DRAM
meminfo_t
*
bl2_plat_sec_mem_layout
(
void
)
{
static
meminfo_t
bl2_dram_layout
__aligned
(
CACHE_WRITEBACK_GRANULE
)
=
{
.
total_base
=
BL31_BASE
,
.
total_size
=
(
ARM_AP_TZC_DRAM1_BASE
+
ARM_AP_TZC_DRAM1_SIZE
)
-
BL31_BASE
,
.
free_base
=
BL31_BASE
,
.
free_size
=
(
ARM_AP_TZC_DRAM1_BASE
+
ARM_AP_TZC_DRAM1_SIZE
)
-
BL31_BASE
};
return
&
bl2_dram_layout
;
}
#else
meminfo_t
*
bl2_plat_sec_mem_layout
(
void
)
meminfo_t
*
bl2_plat_sec_mem_layout
(
void
)
{
{
return
&
bl2_tzram_layout
;
return
&
bl2_tzram_layout
;
}
}
#endif
/*******************************************************************************
/*******************************************************************************
* This function assigns a pointer to the memory that the platform has kept
* This function assigns a pointer to the memory that the platform has kept
...
...
plat/arm/common/arm_common.mk
View file @
4c51badf
...
@@ -77,6 +77,11 @@ ARM_CONFIG_CNTACR := 1
...
@@ -77,6 +77,11 @@ ARM_CONFIG_CNTACR := 1
$(eval
$(call
assert_boolean,ARM_CONFIG_CNTACR))
$(eval
$(call
assert_boolean,ARM_CONFIG_CNTACR))
$(eval
$(call
add_define,ARM_CONFIG_CNTACR))
$(eval
$(call
add_define,ARM_CONFIG_CNTACR))
# Process ARM_BL31_IN_DRAM flag
ARM_BL31_IN_DRAM
:=
0
$(eval
$(call
assert_boolean,ARM_BL31_IN_DRAM))
$(eval
$(call
add_define,ARM_BL31_IN_DRAM))
PLAT_INCLUDES
+=
-Iinclude
/common/tbbr
\
PLAT_INCLUDES
+=
-Iinclude
/common/tbbr
\
-Iinclude
/plat/arm/common
\
-Iinclude
/plat/arm/common
\
-Iinclude
/plat/arm/common/aarch64
-Iinclude
/plat/arm/common/aarch64
...
...
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