mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-08 05:43:53 +00:00
feat(fvp): add Event Log maximum size property in DT
Updated the code to get and set the 'tpm_event_log_max_size' property in the event_log.dtsi. In this change, the maximum Event Log buffer size allocated by BL1 is passed to BL2, rather than both relying on the maximum Event Log buffer size macro. Change-Id: I7aa6256390872171e362b6f166f3f7335aa6e425 Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
This commit is contained in:
parent
0223d15764
commit
1cf3e2f0a8
6 changed files with 53 additions and 12 deletions
|
@ -33,3 +33,11 @@ and this property should be removed when this feature is supported.
|
|||
- tpm_event_log_size [mandatory]
|
||||
- value type: <u32>
|
||||
- Event Log size.
|
||||
|
||||
- tpm_event_log_max_size [mandatory]
|
||||
- value type: <u32>
|
||||
- Event Log maximum size.
|
||||
|
||||
--------------
|
||||
|
||||
*Copyright (c) 2023, Arm Limited and Contributors. All rights reserved.*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2022, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -267,8 +267,10 @@ int arm_set_nt_fw_info(
|
|||
uintptr_t log_addr,
|
||||
#endif
|
||||
size_t log_size, uintptr_t *ns_log_addr);
|
||||
int arm_set_tb_fw_info(uintptr_t log_addr, size_t log_size);
|
||||
int arm_get_tb_fw_info(uint64_t *log_addr, size_t *log_size);
|
||||
int arm_set_tb_fw_info(uintptr_t log_addr, size_t log_size,
|
||||
size_t log_max_size);
|
||||
int arm_get_tb_fw_info(uint64_t *log_addr, size_t *log_size,
|
||||
size_t *log_max_size);
|
||||
#endif /* MEASURED_BOOT */
|
||||
|
||||
/*
|
||||
|
|
|
@ -9,4 +9,5 @@ event_log: tpm_event_log {
|
|||
compatible = "arm,tpm_event_log";
|
||||
tpm_event_log_addr = <0x0 0x0>;
|
||||
tpm_event_log_size = <0x0>;
|
||||
tpm_event_log_max_size = <0x0>;
|
||||
};
|
||||
|
|
|
@ -63,7 +63,8 @@ void bl1_plat_mboot_finish(void)
|
|||
|
||||
event_log_cur_size = event_log_get_cur_size(event_log);
|
||||
int rc = arm_set_tb_fw_info((uintptr_t)event_log,
|
||||
event_log_cur_size);
|
||||
event_log_cur_size,
|
||||
PLAT_ARM_EVENT_LOG_MAX_SIZE);
|
||||
if (rc != 0) {
|
||||
/*
|
||||
* It is a fatal error because on FVP platform, BL2 software
|
||||
|
|
|
@ -90,9 +90,11 @@ void bl2_plat_mboot_init(void)
|
|||
uint8_t *event_log_start;
|
||||
uint8_t *event_log_finish;
|
||||
size_t bl1_event_log_size;
|
||||
size_t event_log_max_size;
|
||||
int rc;
|
||||
|
||||
rc = arm_get_tb_fw_info(&event_log_base, &bl1_event_log_size);
|
||||
rc = arm_get_tb_fw_info(&event_log_base, &bl1_event_log_size,
|
||||
&event_log_max_size);
|
||||
if (rc != 0) {
|
||||
ERROR("%s(): Unable to get Event Log info from TB_FW_CONFIG\n",
|
||||
__func__);
|
||||
|
@ -111,7 +113,7 @@ void bl2_plat_mboot_init(void)
|
|||
event_log_start = (uint8_t *)((uintptr_t)event_log_base +
|
||||
bl1_event_log_size);
|
||||
event_log_finish = (uint8_t *)((uintptr_t)event_log_base +
|
||||
PLAT_ARM_EVENT_LOG_MAX_SIZE);
|
||||
event_log_max_size);
|
||||
|
||||
event_log_init((uint8_t *)event_log_start, event_log_finish);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -28,12 +28,15 @@
|
|||
* Currently OP-TEE does not support reading DTBs from Secure memory
|
||||
* and this property should be removed when this feature is supported.
|
||||
*/
|
||||
#define DTB_PROP_HW_SM_LOG_ADDR "tpm_event_log_sm_addr"
|
||||
#define DTB_PROP_HW_SM_LOG_ADDR "tpm_event_log_sm_addr"
|
||||
#endif /* SPD_opteed */
|
||||
#define DTB_PROP_HW_LOG_ADDR "tpm_event_log_addr"
|
||||
#define DTB_PROP_HW_LOG_SIZE "tpm_event_log_size"
|
||||
#define DTB_PROP_HW_LOG_ADDR "tpm_event_log_addr"
|
||||
#define DTB_PROP_HW_LOG_SIZE "tpm_event_log_size"
|
||||
#define DTB_PROP_HW_LOG_MAX_SIZE "tpm_event_log_max_size"
|
||||
#endif /* MEASURED_BOOT */
|
||||
|
||||
static size_t event_log_max_size __unused;
|
||||
|
||||
/*******************************************************************************
|
||||
* Validate the tb_fw_config is a valid DTB file and returns the node offset
|
||||
* to "arm,tb_fw" property.
|
||||
|
@ -180,6 +183,16 @@ static int arm_set_event_log_info(uintptr_t config_base,
|
|||
return err;
|
||||
}
|
||||
|
||||
assert(event_log_max_size != 0U);
|
||||
err = fdtw_write_inplace_cells(dtb, node,
|
||||
DTB_PROP_HW_LOG_MAX_SIZE, 1,
|
||||
&event_log_max_size);
|
||||
if (err < 0) {
|
||||
ERROR("%sDTB property '%s'\n",
|
||||
"Unable to write ", DTB_PROP_HW_LOG_MAX_SIZE);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = fdtw_write_inplace_cells(dtb, node,
|
||||
DTB_PROP_HW_LOG_SIZE, 1, &log_size);
|
||||
if (err < 0) {
|
||||
|
@ -294,7 +307,7 @@ int arm_set_nt_fw_info(
|
|||
* 0 = success
|
||||
* < 0 = error
|
||||
*/
|
||||
int arm_set_tb_fw_info(uintptr_t log_addr, size_t log_size)
|
||||
int arm_set_tb_fw_info(uintptr_t log_addr, size_t log_size, size_t log_max_size)
|
||||
{
|
||||
/*
|
||||
* Read tb_fw_config device tree for Event Log properties
|
||||
|
@ -309,6 +322,8 @@ int arm_set_tb_fw_info(uintptr_t log_addr, size_t log_size)
|
|||
|
||||
tb_fw_cfg_dtb = tb_fw_config_info->config_addr;
|
||||
|
||||
event_log_max_size = log_max_size;
|
||||
|
||||
err = arm_set_event_log_info(tb_fw_cfg_dtb,
|
||||
#ifdef SPD_opteed
|
||||
0UL,
|
||||
|
@ -329,7 +344,8 @@ int arm_set_tb_fw_info(uintptr_t log_addr, size_t log_size)
|
|||
* Alongside returns Event Log address and its size.
|
||||
*/
|
||||
|
||||
int arm_get_tb_fw_info(uint64_t *log_addr, size_t *log_size)
|
||||
int arm_get_tb_fw_info(uint64_t *log_addr, size_t *log_size,
|
||||
size_t *log_max_size)
|
||||
{
|
||||
/* As libfdt uses void *, we can't avoid this cast */
|
||||
const struct dyn_cfg_dtb_info_t *tb_fw_config_info;
|
||||
|
@ -362,6 +378,17 @@ int arm_get_tb_fw_info(uint64_t *log_addr, size_t *log_size)
|
|||
if (rc != 0) {
|
||||
ERROR("%s%s", DTB_PROP_HW_LOG_SIZE,
|
||||
" not specified in TB_FW config.\n");
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = fdt_read_uint32(dtb, node, DTB_PROP_HW_LOG_MAX_SIZE,
|
||||
(uint32_t *)log_max_size);
|
||||
if (rc != 0) {
|
||||
ERROR("%s%s", DTB_PROP_HW_LOG_MAX_SIZE,
|
||||
" not specified in TB_FW config.\n");
|
||||
return rc;
|
||||
} else {
|
||||
event_log_max_size = *log_max_size;
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
|
Loading…
Add table
Reference in a new issue