Commit 5c380888 authored by Scott Branden's avatar Scott Branden Committed by Sheetal Tigadoli
Browse files

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: default avatarScott Branden <scott.branden@broadcom.com>
Signed-off-by: default avatarSheetal Tigadoli <sheetal.tigadoli@broadcom.com>
parent 0edfd377
/*
* 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;
}
/*
* 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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment