fvp_bl1_measured_boot.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <stdint.h>
  7. #include <drivers/measured_boot/event_log/event_log.h>
  8. #include <drivers/measured_boot/metadata.h>
  9. #include <plat/arm/common/plat_arm.h>
  10. #include <tools_share/zero_oid.h>
  11. /* Event Log data */
  12. static uint8_t event_log[PLAT_ARM_EVENT_LOG_MAX_SIZE];
  13. /* FVP table with platform specific image IDs, names and PCRs */
  14. const event_log_metadata_t fvp_event_log_metadata[] = {
  15. { FW_CONFIG_ID, MBOOT_FW_CONFIG_STRING, PCR_0 },
  16. { TB_FW_CONFIG_ID, MBOOT_TB_FW_CONFIG_STRING, PCR_0 },
  17. { BL2_IMAGE_ID, MBOOT_BL2_IMAGE_STRING, PCR_0 },
  18. { EVLOG_INVALID_ID, NULL, (unsigned int)(-1) } /* Terminator */
  19. };
  20. void bl1_plat_mboot_init(void)
  21. {
  22. event_log_init(event_log, event_log + sizeof(event_log));
  23. event_log_write_header();
  24. }
  25. void bl1_plat_mboot_finish(void)
  26. {
  27. size_t event_log_cur_size;
  28. event_log_cur_size = event_log_get_cur_size(event_log);
  29. int rc = arm_set_tb_fw_info((uintptr_t)event_log,
  30. event_log_cur_size,
  31. PLAT_ARM_EVENT_LOG_MAX_SIZE);
  32. if (rc != 0) {
  33. /*
  34. * It is a fatal error because on FVP platform, BL2 software
  35. * assumes that a valid Event Log buffer exist and it will use
  36. * same Event Log buffer to append image measurements.
  37. */
  38. panic();
  39. }
  40. }