diff options
author | Manish V Badarkhe <Manish.Badarkhe@arm.com> | 2022-11-18 20:43:07 +0000 |
---|---|---|
committer | Manish V Badarkhe <Manish.Badarkhe@arm.com> | 2022-11-22 13:20:44 +0000 |
commit | abef3fe55c5d80e56cb64d5fdf5174d25089a18a (patch) | |
tree | 68d63451e61233298a78da4d65796d697b2c128f /plat/qemu | |
parent | de10522af77a6457716b33e55ce7ea7898443742 (diff) | |
download | arm-trusted-firmware-abef3fe55c5d80e56cb64d5fdf5174d25089a18a.tar.gz |
refactor(qemu): pass platform metadata as a function's argument
Based on the prototype modification of the event_log_measure_and_record
function in the previous patch, platform metadata was passed as an
argument.
Change-Id: I9d8316914c046f47cdc6875b16649479e82087aa
Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Diffstat (limited to 'plat/qemu')
-rw-r--r-- | plat/qemu/qemu/platform.mk | 1 | ||||
-rw-r--r-- | plat/qemu/qemu/qemu_common_measured_boot.c | 34 | ||||
-rw-r--r-- | plat/qemu/qemu/qemu_measured_boot.c | 21 |
3 files changed, 19 insertions, 37 deletions
diff --git a/plat/qemu/qemu/platform.mk b/plat/qemu/qemu/platform.mk index 6becc32fa..dfc5de2ce 100644 --- a/plat/qemu/qemu/platform.mk +++ b/plat/qemu/qemu/platform.mk @@ -109,7 +109,6 @@ ifeq (${MEASURED_BOOT},1) endif BL2_SOURCES += plat/qemu/qemu/qemu_measured_boot.c \ - plat/qemu/qemu/qemu_common_measured_boot.c \ plat/qemu/qemu/qemu_helpers.c \ ${EVENT_LOG_SOURCES} diff --git a/plat/qemu/qemu/qemu_common_measured_boot.c b/plat/qemu/qemu/qemu_common_measured_boot.c deleted file mode 100644 index 41f7f87c9..000000000 --- a/plat/qemu/qemu/qemu_common_measured_boot.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2022, Linaro. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include <assert.h> -#include <stdint.h> - -#include <common/desc_image_load.h> -#include <drivers/measured_boot/event_log/event_log.h> -#include <plat/common/platform.h> - -extern event_log_metadata_t qemu_event_log_metadata[]; - -const event_log_metadata_t *plat_event_log_get_metadata(void) -{ - return qemu_event_log_metadata; -} - -int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data) -{ - /* Calculate image hash and record data in Event Log */ - int err = event_log_measure_and_record(image_data->image_base, - image_data->image_size, - image_id); - if (err != 0) { - ERROR("%s%s image id %u (%i)\n", - "Failed to ", "record", image_id, err); - return err; - } - - return 0; -} diff --git a/plat/qemu/qemu/qemu_measured_boot.c b/plat/qemu/qemu/qemu_measured_boot.c index d9e475abe..122bb23b1 100644 --- a/plat/qemu/qemu/qemu_measured_boot.c +++ b/plat/qemu/qemu/qemu_measured_boot.c @@ -9,6 +9,7 @@ #include <drivers/measured_boot/event_log/event_log.h> #include <plat/common/common_def.h> +#include <plat/common/platform.h> #include <tools_share/tbbr_oid.h> #include "../common/qemu_private.h" @@ -17,8 +18,8 @@ static uint8_t event_log[PLAT_EVENT_LOG_MAX_SIZE]; static uint64_t event_log_base; -/* FVP table with platform specific image IDs, names and PCRs */ -const event_log_metadata_t qemu_event_log_metadata[] = { +/* QEMU table with platform specific image IDs, names and PCRs */ +static const event_log_metadata_t qemu_event_log_metadata[] = { { BL31_IMAGE_ID, EVLOG_BL31_STRING, PCR_0 }, { BL32_IMAGE_ID, EVLOG_BL32_STRING, PCR_0 }, { BL32_EXTRA1_IMAGE_ID, EVLOG_BL32_EXTRA1_STRING, PCR_0 }, @@ -101,3 +102,19 @@ void bl2_plat_mboot_finish(void) dump_event_log((uint8_t *)event_log_base, event_log_cur_size); } + +int plat_mboot_measure_image(unsigned int image_id, image_info_t *image_data) +{ + /* Calculate image hash and record data in Event Log */ + int err = event_log_measure_and_record(image_data->image_base, + image_data->image_size, + image_id, + qemu_event_log_metadata); + if (err != 0) { + ERROR("%s%s image id %u (%i)\n", + "Failed to ", "record", image_id, err); + return err; + } + + return 0; +} |