aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJavier Almansa Sobrino <javier.almansasobrino@arm.com>2020-02-10 14:14:27 +0000
committerJavier Almansa Sobrino <javier.almansasobrino@arm.com>2020-04-01 13:50:59 +0100
commit42c33ba3bb4bb17de6e163a7f4acbd519e091715 (patch)
tree9e79d1a64ce67ca3bd833a283884852018844e82 /common
parent0a43db84af8cafaf35155d0e96e679b79a775272 (diff)
downloadarm-trusted-firmware-42c33ba3bb4bb17de6e163a7f4acbd519e091715.tar.gz
Add support to pass the nt_fw_config DTB to OP-TEE.
At the moment, OP-TEE has no support to receive a DTB in Secure Memory so it cannot receive TOS_FW_CONFIG_ID as it is supposed to happen on any BL32 image. Instead, when OP-TEE is enable as BL32 payload, NT_FW_CONFIG_ID is passed. This MUST be reverted as soon as OP-TEE has support for receiving DTBs from Secure Memory. Change-Id: I9a873f42e94f2f99a60b638333e7afba1505aec9 Signed-off-by: Javier Almansa Sobrino <javier.almansasobrino@arm.com>
Diffstat (limited to 'common')
-rw-r--r--common/desc_image_load.c69
1 files changed, 49 insertions, 20 deletions
diff --git a/common/desc_image_load.c b/common/desc_image_load.c
index 07692260e..47c80aa86 100644
--- a/common/desc_image_load.c
+++ b/common/desc_image_load.c
@@ -214,11 +214,12 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
{
bl_params_node_t *params_node;
unsigned int fw_config_id;
- uintptr_t hw_config_base = 0, fw_config_base;
-#if defined(SPD_spmd)
+#ifdef SPD_spmd
uint32_t fw_config_size = 0;
#endif
+ uintptr_t fw_config_base;
bl_mem_params_node_t *mem_params;
+ uintptr_t hw_config_base = 0;
assert(bl2_to_next_bl_params != NULL);
@@ -227,6 +228,7 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
* if available.
*/
mem_params = get_bl_mem_params_node(HW_CONFIG_ID);
+
if (mem_params != NULL)
hw_config_base = mem_params->image_info.image_base;
@@ -240,8 +242,16 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
fw_config_id = SOC_FW_CONFIG_ID;
break;
case BL32_IMAGE_ID:
+ /*
+ * At the moment, OPTEE cannot accept a DTB in secure memory,
+ * so fall back and use NT_FW_CONFIG instead.
+ * This MUST be fixed as soon as OPTEE has support to
+ * receive DTBs in secure memory.
+ */
+#ifndef SPD_opteed
fw_config_id = TOS_FW_CONFIG_ID;
break;
+#endif
case BL33_IMAGE_ID:
fw_config_id = NT_FW_CONFIG_ID;
break;
@@ -254,38 +264,57 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
mem_params = get_bl_mem_params_node(fw_config_id);
if (mem_params != NULL) {
fw_config_base = mem_params->image_info.image_base;
-#if defined(SPD_spmd)
+#ifdef SPD_spmd
fw_config_size =
mem_params->image_info.image_size;
#endif
}
}
+
+#ifdef SPD_opteed
/*
- * Pass hw and tb_fw config addresses to next images. NOTE - for
- * EL3 runtime images (BL31 for AArch64 and BL32 for AArch32),
- * arg0 is already used by generic code. Take care of not
- * overwriting the previous initialisations.
+ * If SPD_opteed is enabled, arg[0,2] are populated by
+ * parse_optee_header(), which is called by
+ * arm_bl2_handle_post_image_load(). The meaning of the
+ * arguments are:
+ * arg0 <-- MODE_RW
+ * arg1 <-- Paged image base
+ * arg2 <-- Paged image size
*/
- if (params_node == bl2_to_next_bl_params->head) {
- if (params_node->ep_info->args.arg1 == 0U)
- params_node->ep_info->args.arg1 =
+ if (params_node->image_id == BL32_IMAGE_ID) {
+ params_node->ep_info->args.arg3 = fw_config_base;
+ } else {
+#endif
+ /*
+ * Pass hw and tb_fw config addresses to next images.
+ * NOTE - for EL3 runtime images (BL31 for AArch64
+ * and BL32 for AArch32), arg0 is already used by
+ * generic code. Take care of not overwriting the
+ * previous initialisations.
+ */
+ if (params_node == bl2_to_next_bl_params->head) {
+ if (params_node->ep_info->args.arg1 == 0U)
+ params_node->ep_info->args.arg1 =
fw_config_base;
- if (params_node->ep_info->args.arg2 == 0U)
- params_node->ep_info->args.arg2 =
+ if (params_node->ep_info->args.arg2 == 0U)
+ params_node->ep_info->args.arg2 =
hw_config_base;
- } else {
- if (params_node->ep_info->args.arg0 == 0U)
- params_node->ep_info->args.arg0 =
+ } else {
+ if (params_node->ep_info->args.arg0 == 0U)
+ params_node->ep_info->args.arg0 =
fw_config_base;
- if (params_node->ep_info->args.arg1 == 0U)
- params_node->ep_info->args.arg1 =
+ if (params_node->ep_info->args.arg1 == 0U)
+ params_node->ep_info->args.arg1 =
hw_config_base;
-#if defined(SPD_spmd)
- if (params_node->ep_info->args.arg2 == 0U)
- params_node->ep_info->args.arg2 =
+#ifdef SPD_spmd
+ if (params_node->ep_info->args.arg2 == 0U)
+ params_node->ep_info->args.arg2 =
fw_config_size;
#endif
+ }
+#ifdef SPD_opteed
}
+#endif
}
}