Hadi Asyrafi | 616da77 | 2019-06-27 11:34:03 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved. |
Sieu Mun Tang | 8560672 | 2024-08-27 00:01:51 +0800 | [diff] [blame] | 3 | * Copyright (c) 2024, Altera Corporation. All rights reserved. |
Hadi Asyrafi | 616da77 | 2019-06-27 11:34:03 +0800 | [diff] [blame] | 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 | { |
Sieu Mun Tang | 8560672 | 2024-08-27 00:01:51 +0800 | [diff] [blame] | 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 |
Hadi Asyrafi | 616da77 | 2019-06-27 11:34:03 +0800 | [diff] [blame] | 21 | flush_bl_params_desc(); |
Sieu Mun Tang | 8560672 | 2024-08-27 00:01:51 +0800 | [diff] [blame] | 22 | #endif |
Hadi Asyrafi | 616da77 | 2019-06-27 11:34:03 +0800 | [diff] [blame] | 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 | { |
Hadi Asyrafi | 5fae68f | 2019-10-22 14:23:57 +0800 | [diff] [blame] | 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 | |
Hadi Asyrafi | 616da77 | 2019-06-27 11:34:03 +0800 | [diff] [blame] | 64 | return get_next_bl_params_from_mem_params_desc(); |
| 65 | } |