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 21 { EVLOG_INVALID_ID, NULL, (unsigned int)(-1) } /* Terminator */ 22 }; 23 24 void bl1_plat_mboot_init(void) 25 { 26 event_log_init(event_log, event_log + sizeof(event_log)); 27 event_log_write_header(); 28 } 29 30 void bl1_plat_mboot_finish(void) 31 { 32 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 } 45 } 46