summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/plat/arm/common/arm_def.h14
-rw-r--r--include/plat/arm/common/plat_arm_lfa_components.h4
-rw-r--r--plat/arm/board/fvp/fvp_common.c11
-rw-r--r--plat/arm/board/fvp/fvp_lfa.c45
-rw-r--r--plat/arm/board/fvp/include/platform_def.h21
5 files changed, 92 insertions, 3 deletions
diff --git a/include/plat/arm/common/arm_def.h b/include/plat/arm/common/arm_def.h
index ce44352b0..f1828f094 100644
--- a/include/plat/arm/common/arm_def.h
+++ b/include/plat/arm/common/arm_def.h
@@ -362,6 +362,20 @@ MEASURED_BOOT
MT_MEMORY | MT_RW | EL3_PAS)
#endif
+#if ENABLE_LFA_BL31
+#define ARM_MAP_LFA_RELOCATABLE_CODE \
+ MAP_REGION_FLAT( \
+ BL31_LIMIT - (2 * PAGE_SIZE), \
+ PAGE_SIZE, \
+ MT_CODE | EL3_PAS)
+
+#define ARM_MAP_LFA_RELOCATABLE_DATA \
+ MAP_REGION_FLAT( \
+ BL31_LIMIT - PAGE_SIZE, \
+ PAGE_SIZE, \
+ MT_MEMORY | MT_RW | EL3_PAS)
+#endif /* ENABLE_LFA_BL31 */
+
#if ENABLE_RMM
/*
* We add the EL3_RMM_SHARED size to RMM mapping to map the region as a block.
diff --git a/include/plat/arm/common/plat_arm_lfa_components.h b/include/plat/arm/common/plat_arm_lfa_components.h
index c7e825773..e97150edd 100644
--- a/include/plat/arm/common/plat_arm_lfa_components.h
+++ b/include/plat/arm/common/plat_arm_lfa_components.h
@@ -29,7 +29,9 @@
* Define platform-specific numeric IDs for LFA FVP components.
*/
typedef enum {
- LFA_BL31_COMPONENT = 0,
+#if ENABLE_LFA_BL31
+ LFA_BL31_COMPONENT,
+#endif
#if BL32_BASE
LFA_BL32_COMPONENT,
#endif /* BL32_BASE */
diff --git a/plat/arm/board/fvp/fvp_common.c b/plat/arm/board/fvp/fvp_common.c
index 0e8f0ac14..d834ee2ec 100644
--- a/plat/arm/board/fvp/fvp_common.c
+++ b/plat/arm/board/fvp/fvp_common.c
@@ -109,6 +109,12 @@ arm_config_t arm_config;
#endif
#endif
+#if ENABLE_LFA_BL31
+#define MAP_LFA_STORE \
+ MAP_REGION_FLAT(PLAT_LFA_STORE_BASE, PLAT_LFA_STORE_SIZE, \
+ MT_MEMORY | MT_RO | MT_NS)
+#endif /* ENABLE_LFA_BL31 */
+
/*
* Table of memory regions for various BL stages to map using the MMU.
* This doesn't include Trusted SRAM as setup_page_tables() already takes care
@@ -237,6 +243,11 @@ const mmap_region_t plat_arm_mmap[] = {
#if defined(MAP_EL3_FW_HANDOFF) && !RESET_TO_BL31
MAP_EL3_FW_HANDOFF,
#endif
+#if ENABLE_LFA_BL31
+ ARM_MAP_LFA_RELOCATABLE_DATA,
+ ARM_MAP_LFA_RELOCATABLE_CODE,
+ MAP_LFA_STORE,
+#endif /* ENABLE_LFA_BL31 */
{ 0 }
};
diff --git a/plat/arm/board/fvp/fvp_lfa.c b/plat/arm/board/fvp/fvp_lfa.c
index bb26ccc18..efab8f53f 100644
--- a/plat/arm/board/fvp/fvp_lfa.c
+++ b/plat/arm/board/fvp/fvp_lfa.c
@@ -5,9 +5,12 @@
*/
#include <errno.h>
+
+#include <common/debug.h>
#include <plat/common/platform.h>
#include <services/bl31_lfa.h>
#include <services/el3_spmd_logical_sp.h>
+#include <services/lfa_svc.h>
#include <services/rmmd_rmm_lfa.h>
#include <tools_share/firmware_image_package.h>
@@ -15,17 +18,24 @@
/* Keep this array consistent with enum fvp_lfa_component_id_t */
static plat_lfa_component_info_t fvp_lfa_components[LFA_MAX_DEFINED_COMPONENTS] = {
+
+#if ENABLE_LFA_BL31
[LFA_BL31_COMPONENT] = {LFA_BL31_COMPONENT, UUID_EL3_RUNTIME_FIRMWARE_BL31,
NULL, false},
+#endif /* ENABLE_LFA_BL31 */
+
#if BL32_BASE
[LFA_BL32_COMPONENT] = {LFA_BL32_COMPONENT, UUID_SECURE_PAYLOAD_BL32,
NULL, false},
#endif /* BL32_BASE */
+
[LFA_BL33_COMPONENT] = {LFA_BL33_COMPONENT, UUID_NON_TRUSTED_FIRMWARE_BL33,
NULL, false},
+
#if ENABLE_RMM
[LFA_RMM_COMPONENT] = {LFA_RMM_COMPONENT, UUID_REALM_MONITOR_MGMT_FIRMWARE,
NULL, false},
+
#endif /* ENABLE_RMM */
#if SUPPORT_SP_LIVE_ACTIVATION
@@ -42,7 +52,10 @@ uint32_t plat_lfa_get_components(plat_lfa_component_info_t **components)
return -EINVAL;
}
+#if ENABLE_LFA_BL31
fvp_lfa_components[LFA_BL31_COMPONENT].activator = get_bl31_activator();
+#endif /* ENABLE_LFA_BL31 */
+
#if ENABLE_RMM
fvp_lfa_components[LFA_RMM_COMPONENT].activator = get_rmm_activator();
#endif /* ENABLE_RMM */
@@ -73,6 +86,12 @@ bool is_plat_lfa_activation_pending(uint32_t lfa_component_id)
}
#endif /* SUPPORT_SP_LIVE_ACTIVATION */
+#if ENABLE_LFA_BL31
+ if (lfa_component_id == LFA_BL31_COMPONENT) {
+ return true;
+ }
+#endif /* ENABLE_LFA_BL31 */
+
return false;
}
@@ -84,15 +103,39 @@ int plat_lfa_cancel(uint32_t lfa_component_id)
int plat_lfa_load_auth_image(uint32_t lfa_component_id)
{
+ return 0;
+}
+
+int plat_lfa_get_image_info(uint32_t lfa_component_id, uintptr_t *image_address,
+ size_t *image_size)
+{
+#if ENABLE_LFA_BL31
/*
* In AEM FVP, we don't want to bloat the code by adding
* loading and authentication mechanism, so here we assumed
* that the components are pre-loaded and authenticated already.
+ *
+ * The image is pre-loaded at 0xFB000000, size is not used for
+ * sectional copy.
*/
- return 0;
+ if (lfa_component_id == LFA_BL31_COMPONENT) {
+ *image_size = 0;
+ *image_address = (uintptr_t)(PLAT_LFA_STORE_BASE);
+ VERBOSE("FVP BL31 LFA image at 0x%lX with size %ld bytes\n",
+ (uint64_t)*image_address, *image_size);
+ return 0;
+ }
+#endif
+
+ return -EPERM;
}
int plat_lfa_notify_activate(uint32_t lfa_component_id)
{
return 0;
}
+
+uint64_t plat_lfa_mailbox_base(void)
+{
+ return PLAT_ARM_TRUSTED_MAILBOX_BASE;
+}
diff --git a/plat/arm/board/fvp/include/platform_def.h b/plat/arm/board/fvp/include/platform_def.h
index 34ff23b47..523fb749b 100644
--- a/plat/arm/board/fvp/include/platform_def.h
+++ b/plat/arm/board/fvp/include/platform_def.h
@@ -237,7 +237,11 @@
# define PLAT_SP_IMAGE_MMAP_REGIONS 31
# define PLAT_SP_IMAGE_MAX_XLAT_TABLES 13
# else
-# define PLAT_ARM_MMAP_ENTRIES 9
+# if ENABLE_LFA_BL31
+# define PLAT_ARM_MMAP_ENTRIES 12
+# else
+# define PLAT_ARM_MMAP_ENTRIES 9
+# endif
# if USE_DEBUGFS
# if ENABLE_RMM
# define MAX_XLAT_TABLES 9
@@ -648,4 +652,19 @@ FVP_TRUSTED_SRAM_SIZE == 512
*/
#define PLAT_DRTM_MMAP_ENTRIES PLAT_ARM_MMAP_ENTRIES
+#if ENABLE_LFA_BL31
+/*
+ * A 16MB carved out shared region with Non-Secure to preload firmware image to
+ * live activate for FVP test platforms.
+ */
+#define PLAT_LFA_STORE_BASE UL(0xFB000000)
+#define PLAT_LFA_STORE_SIZE SZ_16M
+
+/*
+ * The errata section is padded to allow for growth without affecting the rest
+ * of the binary.
+ */
+#define PLAT_LFA_ERRATA_SECTION_SIZE U(0x1000)
+#endif /* ENABLE_LFA_BL31 */
+
#endif /* PLATFORM_DEF_H */