blob: f14dbffa45bf81e201a08e7c058e790c428ac8fd [file] [log] [blame]
Manish V Badarkhea74d9632021-09-14 23:12:42 +01001/*
Tamas Banb1cc0692023-06-05 11:11:28 +02002 * Copyright (c) 2021-2024, 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>
Tamas Banb1cc0692023-06-05 11:11:28 +020010#include <drivers/measured_boot/metadata.h>
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010011#include <plat/arm/common/plat_arm.h>
Manish V Badarkhe95af6a02023-04-11 14:46:10 +010012#include <tools_share/zero_oid.h>
Manish V Badarkhea74d9632021-09-14 23:12:42 +010013
14/* Event Log data */
15static uint8_t event_log[PLAT_ARM_EVENT_LOG_MAX_SIZE];
16
17/* FVP table with platform specific image IDs, names and PCRs */
18const event_log_metadata_t fvp_event_log_metadata[] = {
Tamas Banb1cc0692023-06-05 11:11:28 +020019 { FW_CONFIG_ID, MBOOT_FW_CONFIG_STRING, PCR_0 },
20 { TB_FW_CONFIG_ID, MBOOT_TB_FW_CONFIG_STRING, PCR_0 },
21 { BL2_IMAGE_ID, MBOOT_BL2_IMAGE_STRING, PCR_0 },
Manish V Badarkhe67009c32021-10-31 14:47:49 +000022
23 { EVLOG_INVALID_ID, NULL, (unsigned int)(-1) } /* Terminator */
Manish V Badarkhea74d9632021-09-14 23:12:42 +010024};
25
26void bl1_plat_mboot_init(void)
27{
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010028 event_log_init(event_log, event_log + sizeof(event_log));
29 event_log_write_header();
Manish V Badarkhea74d9632021-09-14 23:12:42 +010030}
31
32void bl1_plat_mboot_finish(void)
33{
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010034 size_t event_log_cur_size;
35
36 event_log_cur_size = event_log_get_cur_size(event_log);
37 int rc = arm_set_tb_fw_info((uintptr_t)event_log,
Manish V Badarkhe6e6df442023-03-20 14:58:06 +000038 event_log_cur_size,
39 PLAT_ARM_EVENT_LOG_MAX_SIZE);
Manish V Badarkhe4edf4bd2021-08-11 10:45:03 +010040 if (rc != 0) {
41 /*
42 * It is a fatal error because on FVP platform, BL2 software
43 * assumes that a valid Event Log buffer exist and it will use
44 * same Event Log buffer to append image measurements.
45 */
46 panic();
47 }
Manish V Badarkhea74d9632021-09-14 23:12:42 +010048}