/*
- * 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
*/
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 */
/*
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__);
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);
/*
- * 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
*/
* 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.
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) {
* 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
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,
* 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;
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;