Commit 0f99bf32 authored by Alexei Fedorov's avatar Alexei Fedorov Committed by TrustedFirmware Code Review
Browse files

Merge "Add support to pass the nt_fw_config DTB to OP-TEE." into integration

parents 7c49d398 42c33ba3
...@@ -214,11 +214,12 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params) ...@@ -214,11 +214,12 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
{ {
bl_params_node_t *params_node; bl_params_node_t *params_node;
unsigned int fw_config_id; unsigned int fw_config_id;
uintptr_t hw_config_base = 0, fw_config_base; #ifdef SPD_spmd
#if defined(SPD_spmd)
uint32_t fw_config_size = 0; uint32_t fw_config_size = 0;
#endif #endif
uintptr_t fw_config_base;
bl_mem_params_node_t *mem_params; bl_mem_params_node_t *mem_params;
uintptr_t hw_config_base = 0;
assert(bl2_to_next_bl_params != NULL); 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) ...@@ -227,6 +228,7 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
* if available. * if available.
*/ */
mem_params = get_bl_mem_params_node(HW_CONFIG_ID); mem_params = get_bl_mem_params_node(HW_CONFIG_ID);
if (mem_params != NULL) if (mem_params != NULL)
hw_config_base = mem_params->image_info.image_base; 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) ...@@ -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; fw_config_id = SOC_FW_CONFIG_ID;
break; break;
case BL32_IMAGE_ID: 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; fw_config_id = TOS_FW_CONFIG_ID;
break; break;
#endif
case BL33_IMAGE_ID: case BL33_IMAGE_ID:
fw_config_id = NT_FW_CONFIG_ID; fw_config_id = NT_FW_CONFIG_ID;
break; break;
...@@ -254,17 +264,33 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params) ...@@ -254,17 +264,33 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
mem_params = get_bl_mem_params_node(fw_config_id); mem_params = get_bl_mem_params_node(fw_config_id);
if (mem_params != NULL) { if (mem_params != NULL) {
fw_config_base = mem_params->image_info.image_base; fw_config_base = mem_params->image_info.image_base;
#if defined(SPD_spmd) #ifdef SPD_spmd
fw_config_size = fw_config_size =
mem_params->image_info.image_size; mem_params->image_info.image_size;
#endif #endif
} }
} }
#ifdef SPD_opteed
/* /*
* Pass hw and tb_fw config addresses to next images. NOTE - for * If SPD_opteed is enabled, arg[0,2] are populated by
* EL3 runtime images (BL31 for AArch64 and BL32 for AArch32), * parse_optee_header(), which is called by
* arg0 is already used by generic code. Take care of not * arm_bl2_handle_post_image_load(). The meaning of the
* overwriting the previous initialisations. * arguments are:
* arg0 <-- MODE_RW
* arg1 <-- Paged image base
* arg2 <-- Paged image size
*/
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 == bl2_to_next_bl_params->head) {
if (params_node->ep_info->args.arg1 == 0U) if (params_node->ep_info->args.arg1 == 0U)
...@@ -280,12 +306,15 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params) ...@@ -280,12 +306,15 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
if (params_node->ep_info->args.arg1 == 0U) if (params_node->ep_info->args.arg1 == 0U)
params_node->ep_info->args.arg1 = params_node->ep_info->args.arg1 =
hw_config_base; hw_config_base;
#if defined(SPD_spmd) #ifdef SPD_spmd
if (params_node->ep_info->args.arg2 == 0U) if (params_node->ep_info->args.arg2 == 0U)
params_node->ep_info->args.arg2 = params_node->ep_info->args.arg2 =
fw_config_size; fw_config_size;
#endif #endif
} }
#ifdef SPD_opteed
}
#endif
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment