plat/arm/arm_image_load: fix bug of overriding the last node

The traverse flow in function plat_add_sp_images_load_info() will find
the last node in the main load info list, with its
next_load_info==NULL. However this node is still useful and should not
be overridden with SP node info.

The bug will cause below error on RDN2 for spmd enabled:

ERROR:   Invalid NT_FW_CONFIG DTB passed

Fix the bug by only setting the next_load_info of the last node in the
original main node list.

Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com>
Change-Id: Icaee5da1f2d53b29fdd6085a8cc507446186fd57
This commit is contained in:
Heyi Guo 2021-01-25 21:45:47 +08:00 committed by David Horstmann
parent 045b209cc2
commit 47fe4c4fe2
1 changed files with 9 additions and 4 deletions

View File

@ -51,10 +51,15 @@ static void plat_add_sp_images_load_info(struct bl_load_info *load_info)
node_info = node_info->next_load_info;
} while (node_info->next_load_info != NULL);
bl_load_info_node_t *sp_node =
&sp_mem_params_descs[index].load_node_mem;
node_info->next_load_info = sp_node;
for (; index < MAX_SP_IDS; index++) {
/* Populate the image information */
node_info->image_id = sp_mem_params_descs[index].image_id;
node_info->image_info = &sp_mem_params_descs[index].image_info;
sp_node->image_id = sp_mem_params_descs[index].image_id;
sp_node->image_info = &sp_mem_params_descs[index].image_info;
if ((index + 1U) == MAX_SP_IDS) {
INFO("Reached Max number of SPs\n");
@ -65,9 +70,9 @@ static void plat_add_sp_images_load_info(struct bl_load_info *load_info)
return;
}
node_info->next_load_info =
sp_node->next_load_info =
&sp_mem_params_descs[index + 1U].load_node_mem;
node_info = node_info->next_load_info;
sp_node = sp_node->next_load_info;
}
}