mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 10:04:26 +00:00
drivers: Add support to retrieve plat_toc_flags
Add support to retrieve plat_toc_flags value from FIP header flags. plat_toc_flags is for platform specific use. It is stored in FIP header by fiptool using --plat-toc-flags option. Change-Id: Ibadd91b4f28e6503f4426e4efd404bbe512ad124 Signed-off-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: Sheetal Tigadoli <sheetal.tigadoli@broadcom.com>
This commit is contained in:
parent
0edfd3772a
commit
5c38088881
2 changed files with 28 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2019, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -46,6 +46,7 @@ typedef struct {
|
|||
*/
|
||||
typedef struct {
|
||||
uintptr_t dev_spec;
|
||||
uint16_t plat_toc_flag;
|
||||
} fip_dev_state_t;
|
||||
|
||||
static const uuid_t uuid_null;
|
||||
|
@ -220,6 +221,11 @@ static int fip_dev_init(io_dev_info_t *dev_info, const uintptr_t init_params)
|
|||
uintptr_t backend_handle;
|
||||
fip_toc_header_t header;
|
||||
size_t bytes_read;
|
||||
fip_dev_state_t *state;
|
||||
|
||||
assert(dev_info != NULL);
|
||||
|
||||
state = (fip_dev_state_t *)dev_info->info;
|
||||
|
||||
/* Obtain a reference to the image by querying the platform layer */
|
||||
result = plat_get_image_source(image_id, &backend_dev_handle,
|
||||
|
@ -248,6 +254,11 @@ static int fip_dev_init(io_dev_info_t *dev_info, const uintptr_t init_params)
|
|||
result = -ENOENT;
|
||||
} else {
|
||||
VERBOSE("FIP header looks OK.\n");
|
||||
/*
|
||||
* Store 16-bit Platform ToC flags field which occupies
|
||||
* bits [32-47] in fip header.
|
||||
*/
|
||||
state->plat_toc_flag = (header.flags >> 32) & 0xffff;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,3 +464,17 @@ int register_io_dev_fip(const io_dev_connector_t **dev_con)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Function to retrieve plat_toc_flags, previously saved in FIP dev */
|
||||
int fip_dev_get_plat_toc_flag(io_dev_info_t *dev_info, uint16_t *plat_toc_flag)
|
||||
{
|
||||
fip_dev_state_t *state;
|
||||
|
||||
assert(dev_info != NULL);
|
||||
|
||||
state = (fip_dev_state_t *)dev_info->info;
|
||||
|
||||
*plat_toc_flag = state->plat_toc_flag;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -10,5 +10,6 @@
|
|||
struct io_dev_connector;
|
||||
|
||||
int register_io_dev_fip(const struct io_dev_connector **dev_con);
|
||||
int fip_dev_get_plat_toc_flag(io_dev_info_t *dev_info, uint16_t *plat_toc_flag);
|
||||
|
||||
#endif /* IO_FIP_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue