blob: 477ae2776b39b39c9798d2397ef28c971b609b83 [file] [log] [blame]
Manish V Badarkhea74d9632021-09-14 23:12:42 +01001/*
Manish V Badarkhec774ec82023-06-16 13:03:51 +01002 * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
Manish V Badarkhea74d9632021-09-14 23:12:42 +01003 *
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 Badarkhe95af6a02023-04-11 14:46:10 +010011#include <tools_share/zero_oid.h>
Manish V Badarkhea74d9632021-09-14 23:12:42 +010012
13/* Event Log data */
14static uint8_t event_log[PLAT_ARM_EVENT_LOG_MAX_SIZE];
15
16/* FVP table with platform specific image IDs, names and PCRs */
17const event_log_metadata_t fvp_event_log_metadata[] = {
Manish V Badarkhe72e03692021-09-08 20:04:24 +010018 { FW_CONFIG_ID, EVLOG_FW_CONFIG_STRING, PCR_0 },
19 { TB_FW_CONFIG_ID, EVLOG_TB_FW_CONFIG_STRING, PCR_0 },
20 { BL2_IMAGE_ID, EVLOG_BL2_STRING, PCR_0 },
Manish V Badarkhe67009c32021-10-31 14:47:49 +000021
22 { EVLOG_INVALID_ID, NULL, (unsigned int)(-1) } /* Terminator */
Manish V Badarkhea74d9632021-09-14 23:12:42 +010023};
24
25void bl1_plat_mboot_init(void)
26{
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010027 event_log_init(event_log, event_log + sizeof(event_log));
28 event_log_write_header();
Manish V Badarkhea74d9632021-09-14 23:12:42 +010029}
30
31void bl1_plat_mboot_finish(void)
32{
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010033 size_t event_log_cur_size;
34
35 event_log_cur_size = event_log_get_cur_size(event_log);
36 int rc = arm_set_tb_fw_info((uintptr_t)event_log,
Manish V Badarkhe6e6df442023-03-20 14:58:06 +000037 event_log_cur_size,
38 PLAT_ARM_EVENT_LOG_MAX_SIZE);
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010039 if (rc != 0) {
40 /*
41 * It is a fatal error because on FVP platform, BL2 software
42 * assumes that a valid Event Log buffer exist and it will use
43 * same Event Log buffer to append image measurements.
44 */
45 panic();
46 }
Manish V Badarkhea74d9632021-09-14 23:12:42 +010047}