mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 17:44:19 +00:00
feat(fconf): add a helper to get image index
A new function dyn_cfg_dtb_info_get_index() is created to get the index of the given image config_id in the dtb_infos pool. This allows checking if an image with a specific ID is in the FIP. Change-Id: Ib300ed08e5b8a683dc7980a90221c305fb3f457d Signed-off-by: Yann Gautier <yann.gautier@st.com>
This commit is contained in:
parent
a5645148a6
commit
9e3f409398
2 changed files with 20 additions and 4 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue