blob: 546855527074eb6295a67aeb125bc35725ef750b [file] [log] [blame]
Manish V Badarkhea74d9632021-09-14 23:12:42 +01001/*
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>
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010010#include <plat/arm/common/plat_arm.h>
Manish V Badarkhea74d9632021-09-14 23:12:42 +010011
12/* Event Log data */
13static uint8_t event_log[PLAT_ARM_EVENT_LOG_MAX_SIZE];
14
15/* FVP table with platform specific image IDs, names and PCRs */
16const event_log_metadata_t fvp_event_log_metadata[] = {
Manish V Badarkhe72e03692021-09-08 20:04:24 +010017 { 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 },
Manish V Badarkhe67009c32021-10-31 14:47:49 +000020
21 { EVLOG_INVALID_ID, NULL, (unsigned int)(-1) } /* Terminator */
Manish V Badarkhea74d9632021-09-14 23:12:42 +010022};
23
24void bl1_plat_mboot_init(void)
25{
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010026 event_log_init(event_log, event_log + sizeof(event_log));
27 event_log_write_header();
Manish V Badarkhea74d9632021-09-14 23:12:42 +010028}
29
30void bl1_plat_mboot_finish(void)
31{
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010032 size_t event_log_cur_size;
33
34 event_log_cur_size = event_log_get_cur_size(event_log);
35 int rc = arm_set_tb_fw_info((uintptr_t)event_log,
36 event_log_cur_size);
37 if (rc != 0) {
38 /*
39 * It is a fatal error because on FVP platform, BL2 software
40 * assumes that a valid Event Log buffer exist and it will use
41 * same Event Log buffer to append image measurements.
42 */
43 panic();
44 }
Manish V Badarkhea74d9632021-09-14 23:12:42 +010045}