Manish V Badarkhe | a74d963 | 2021-09-14 23:12:42 +0100 | [diff] [blame] | 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> |
Manish V Badarkhe | 4edf4bd | 2021-08-11 10:45:03 +0100 | [diff] [blame] | 10 | #include <plat/arm/common/plat_arm.h> |
Manish V Badarkhe | a74d963 | 2021-09-14 23:12:42 +0100 | [diff] [blame] | 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[] = { |
Manish V Badarkhe | 72e0369 | 2021-09-08 20:04:24 +0100 | [diff] [blame] | 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 }, |
Manish V Badarkhe | 67009c3 | 2021-10-31 14:47:49 +0000 | [diff] [blame] | 20 | |
| 21 | { EVLOG_INVALID_ID, NULL, (unsigned int)(-1) } /* Terminator */ |
Manish V Badarkhe | a74d963 | 2021-09-14 23:12:42 +0100 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | void bl1_plat_mboot_init(void) |
| 25 | { |
Manish V Badarkhe | 4edf4bd | 2021-08-11 10:45:03 +0100 | [diff] [blame] | 26 | event_log_init(event_log, event_log + sizeof(event_log)); |
| 27 | event_log_write_header(); |
Manish V Badarkhe | a74d963 | 2021-09-14 23:12:42 +0100 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | void bl1_plat_mboot_finish(void) |
| 31 | { |
Manish V Badarkhe | 4edf4bd | 2021-08-11 10:45:03 +0100 | [diff] [blame] | 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 | } |
Manish V Badarkhe | a74d963 | 2021-09-14 23:12:42 +0100 | [diff] [blame] | 45 | } |