1 /*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7 #include <stdint.h>
8
9 #include <drivers/measured_boot/event_log/event_log.h>
10 #include <plat/arm/common/plat_arm.h>
11
12 /* Event Log data */
13 static uint8_t event_log[PLAT_ARM_EVENT_LOG_MAX_SIZE];
14
15 /* FVP table with platform specific image IDs, names and PCRs */
16 const event_log_metadata_t fvp_event_log_metadata[] = {
17 { FW_CONFIG_ID, EVLOG_FW_CONFIG_STRING, PCR_0 },
18 { TB_FW_CONFIG_ID, EVLOG_TB_FW_CONFIG_STRING, PCR_0 },
19 { BL2_IMAGE_ID, EVLOG_BL2_STRING, PCR_0 },
20 { INVALID_ID, NULL, (unsigned int)(-1) } /* Terminator */
21 };
22
bl1_plat_mboot_init(void)23 void bl1_plat_mboot_init(void)
24 {
25 event_log_init(event_log, event_log + sizeof(event_log));
26 event_log_write_header();
27 }
28
bl1_plat_mboot_finish(void)29 void bl1_plat_mboot_finish(void)
30 {
31 size_t event_log_cur_size;
32
33 event_log_cur_size = event_log_get_cur_size(event_log);
34 int rc = arm_set_tb_fw_info((uintptr_t)event_log,
35 event_log_cur_size);
36 if (rc != 0) {
37 /*
38 * It is a fatal error because on FVP platform, BL2 software
39 * assumes that a valid Event Log buffer exist and it will use
40 * same Event Log buffer to append image measurements.
41 */
42 panic();
43 }
44 }
45