| 1 |
/* |
| 2 |
* Copyright (c) 2019, ARM Limited and Contributors. All rights reserved. |
| 3 |
* Copyright (c) 2024, Altera Corporation. All rights reserved. |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: BSD-3-Clause |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <common/desc_image_load.h> |
| 9 |
|
| 10 |
/******************************************************************************* |
| 11 |
* This function flushes the data structures so that they are visible |
| 12 |
* in memory for the next BL image. |
| 13 |
******************************************************************************/ |
| 14 |
void plat_flush_next_bl_params(void) |
| 15 |
{ |
| 16 |
/* |
| 17 |
* We cannot flush these descriptors on the Agilex5 platform, |
| 18 |
* since the BL2 runs on the OCRAM and this OCRAM is not cache coherent. |
| 19 |
*/ |
| 20 |
#if PLATFORM_MODEL != PLAT_SOCFPGA_AGILEX5 |
| 21 |
flush_bl_params_desc(); |
| 22 |
#endif |
| 23 |
} |
| 24 |
|
| 25 |
/******************************************************************************* |
| 26 |
* This function returns the list of loadable images. |
| 27 |
******************************************************************************/ |
| 28 |
bl_load_info_t *plat_get_bl_image_load_info(void) |
| 29 |
{ |
| 30 |
return get_bl_load_info_from_mem_params_desc(); |
| 31 |
} |
| 32 |
|
| 33 |
/******************************************************************************* |
| 34 |
* This function returns the list of executable images. |
| 35 |
******************************************************************************/ |
| 36 |
bl_params_t *plat_get_next_bl_params(void) |
| 37 |
{ |
| 38 |
unsigned int count; |
| 39 |
unsigned int img_id = 0U; |
| 40 |
unsigned int link_index = 0U; |
| 41 |
bl_params_node_t *bl_exec_node = NULL; |
| 42 |
bl_mem_params_node_t *desc_ptr; |
| 43 |
|
| 44 |
/* If there is no image to start with, return NULL */ |
| 45 |
if (bl_mem_params_desc_num == 0U) |
| 46 |
return NULL; |
| 47 |
|
| 48 |
/* Clean next_params_info in BL image node */ |
| 49 |
for (count = 0U; count < bl_mem_params_desc_num; count++) { |
| 50 |
|
| 51 |
desc_ptr = &bl_mem_params_desc_ptr[link_index]; |
| 52 |
bl_exec_node = &desc_ptr->params_node_mem; |
| 53 |
bl_exec_node->next_params_info = NULL; |
| 54 |
|
| 55 |
/* If no next hand-off image then break out */ |
| 56 |
img_id = desc_ptr->next_handoff_image_id; |
| 57 |
if (img_id == INVALID_IMAGE_ID) |
| 58 |
break; |
| 59 |
|
| 60 |
/* Get the index for the next hand-off image */ |
| 61 |
link_index = get_bl_params_node_index(img_id); |
| 62 |
} |
| 63 |
|
| 64 |
return get_next_bl_params_from_mem_params_desc(); |
| 65 |
} |