blob: ee7915848503f9ed363d75cdf6e47b05094d28d6 [file] [log] [blame]
Hadi Asyrafi616da772019-06-27 11:34:03 +08001/*
2 * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
Sieu Mun Tang85606722024-08-27 00:01:51 +08003 * Copyright (c) 2024, Altera Corporation. All rights reserved.
Hadi Asyrafi616da772019-06-27 11:34:03 +08004 *
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 ******************************************************************************/
14void plat_flush_next_bl_params(void)
15{
Sieu Mun Tang85606722024-08-27 00:01:51 +080016 /*
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
Hadi Asyrafi616da772019-06-27 11:34:03 +080021 flush_bl_params_desc();
Sieu Mun Tang85606722024-08-27 00:01:51 +080022#endif
Hadi Asyrafi616da772019-06-27 11:34:03 +080023}
24
25/*******************************************************************************
26 * This function returns the list of loadable images.
27 ******************************************************************************/
28bl_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 ******************************************************************************/
36bl_params_t *plat_get_next_bl_params(void)
37{
Hadi Asyrafi5fae68f2019-10-22 14:23:57 +080038 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
Hadi Asyrafi616da772019-06-27 11:34:03 +080064 return get_next_bl_params_from_mem_params_desc();
65}