Merge changes from topic "fconf_get_index" into integration

* changes:
  feat(stm32mp1): skip TOS_FW_CONFIG if not in FIP
  feat(fconf): add a helper to get image index
This commit is contained in:
Madhukar Pappireddy 2021-12-14 20:58:09 +01:00 committed by TrustedFirmware Code Review
commit 7468be1274
3 changed files with 27 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.
* Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -9,6 +9,8 @@
#include <lib/fconf/fconf.h>
#define FCONF_INVALID_IDX 0xFFFFFFFFU
/* Dynamic configuration related getter */
#define dyn_cfg__dtb_getter(id) dyn_cfg_dtb_info_getter(id)
@ -18,6 +20,7 @@ struct dyn_cfg_dtb_info_t {
unsigned int config_id;
};
unsigned int dyn_cfg_dtb_info_get_index(unsigned int config_id);
struct dyn_cfg_dtb_info_t *dyn_cfg_dtb_info_getter(unsigned int config_id);
int fconf_populate_dtb_registry(uintptr_t config);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2020, Arm Limited. All rights reserved.
* Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -40,17 +40,30 @@ void set_config_info(uintptr_t config_addr, uint32_t config_max_size,
dtb_info->config_id = config_id;
}
struct dyn_cfg_dtb_info_t *dyn_cfg_dtb_info_getter(unsigned int config_id)
/* Get index of the config_id image */
unsigned int dyn_cfg_dtb_info_get_index(unsigned int config_id)
{
unsigned int index;
/* Positions index to the proper config-id */
for (index = 0U; index < MAX_DTB_INFO; index++) {
if (dtb_infos[index].config_id == config_id) {
return &dtb_infos[index];
return index;
}
}
return FCONF_INVALID_IDX;
}
struct dyn_cfg_dtb_info_t *dyn_cfg_dtb_info_getter(unsigned int config_id)
{
/* Positions index to the proper config-id */
unsigned int index = dyn_cfg_dtb_info_get_index(config_id);
if (index < MAX_DTB_INFO) {
return &dtb_infos[index];
}
WARN("FCONF: Invalid config id %u\n", config_id);
return NULL;

View File

@ -321,6 +321,7 @@ int bl2_plat_handle_post_image_load(unsigned int image_id)
const struct dyn_cfg_dtb_info_t *config_info;
bl_mem_params_node_t *tos_fw_mem_params;
unsigned int i;
unsigned int idx;
unsigned long long ddr_top __unused;
const unsigned int image_ids[] = {
BL32_IMAGE_ID,
@ -339,8 +340,14 @@ int bl2_plat_handle_post_image_load(unsigned int image_id)
set_config_info(STM32MP_FW_CONFIG_BASE, STM32MP_FW_CONFIG_MAX_SIZE, FW_CONFIG_ID);
fconf_populate("FW_CONFIG", STM32MP_FW_CONFIG_BASE);
idx = dyn_cfg_dtb_info_get_index(TOS_FW_CONFIG_ID);
/* Iterate through all the fw config IDs */
for (i = 0U; i < ARRAY_SIZE(image_ids); i++) {
if ((image_ids[i] == TOS_FW_CONFIG_ID) && (idx == FCONF_INVALID_IDX)) {
continue;
}
bl_mem_params = get_bl_mem_params_node(image_ids[i]);
assert(bl_mem_params != NULL);