mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
plat/arm/arm_image_load: refine plat_add_sp_images_load_info
Refine the function plat_add_sp_images_load_info() by saving the previous node and only setting its next link when the current node is valid. This can reduce the check for the next node and simply the total logic. Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com> Change-Id: I4061428bf49ef0c3816ac22aaeb2e50315531f88
This commit is contained in:
parent
47fe4c4fe2
commit
abe6ce1d1b
1 changed files with 18 additions and 25 deletions
|
@ -38,43 +38,36 @@ void plat_flush_next_bl_params(void)
|
|||
******************************************************************************/
|
||||
static void plat_add_sp_images_load_info(struct bl_load_info *load_info)
|
||||
{
|
||||
bl_load_info_node_t *node_info = load_info->head;
|
||||
unsigned int index = 0;
|
||||
bl_load_info_node_t *curr_node = load_info->head;
|
||||
bl_load_info_node_t *prev_node;
|
||||
|
||||
if (sp_mem_params_descs[index].image_id == 0) {
|
||||
/* Shortcut for empty SP list */
|
||||
if (sp_mem_params_descs[0].image_id == 0) {
|
||||
ERROR("No Secure Partition Image available\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Traverse through the bl images list */
|
||||
do {
|
||||
node_info = node_info->next_load_info;
|
||||
} while (node_info->next_load_info != NULL);
|
||||
curr_node = curr_node->next_load_info;
|
||||
} while (curr_node->next_load_info != NULL);
|
||||
|
||||
bl_load_info_node_t *sp_node =
|
||||
&sp_mem_params_descs[index].load_node_mem;
|
||||
prev_node = curr_node;
|
||||
|
||||
node_info->next_load_info = sp_node;
|
||||
|
||||
for (; index < MAX_SP_IDS; index++) {
|
||||
for (unsigned int index = 0; index < MAX_SP_IDS; index++) {
|
||||
if (sp_mem_params_descs[index].image_id == 0) {
|
||||
return;
|
||||
}
|
||||
curr_node = &sp_mem_params_descs[index].load_node_mem;
|
||||
/* Populate the image information */
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
if (sp_mem_params_descs[index + 1U].image_id == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
sp_node->next_load_info =
|
||||
&sp_mem_params_descs[index + 1U].load_node_mem;
|
||||
sp_node = sp_node->next_load_info;
|
||||
curr_node->image_id = sp_mem_params_descs[index].image_id;
|
||||
curr_node->image_info = &sp_mem_params_descs[index].image_info;
|
||||
|
||||
prev_node->next_load_info = curr_node;
|
||||
prev_node = curr_node;
|
||||
}
|
||||
|
||||
INFO("Reached Max number of SPs\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue