aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManish V Badarkhe <Manish.Badarkhe@arm.com>2021-03-16 10:01:27 +0000
committerManish V Badarkhe <Manish.Badarkhe@arm.com>2021-08-02 14:39:41 +0100
commit5357f83d4ee89fb831d7e4f6149ae2f652e1b9af (patch)
tree3d87ac080cf4984baf3f57e8bde02d099888afd5
parent6881f7be465a60a6bda54da2a07bd68aacf816b2 (diff)
downloadtrusted-firmware-a-5357f83d4ee89fb831d7e4f6149ae2f652e1b9af.tar.gz
feat(fwu_metadata): add FWU metadata header and build options
Added a firmware update metadata structure as per section 4.1 in the specification document[1]. Also, added the build options used in defining the firmware update metadata structure. [1]: https://developer.arm.com/documentation/den0118/a/ Change-Id: I8f43264a46fde777ceae7fd2a5bb0326f1711928 Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
-rw-r--r--Makefile4
-rw-r--r--include/drivers/fwu/fwu_metadata.h74
-rw-r--r--make_helpers/defaults.mk8
3 files changed, 86 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 4dbc2be99f..edc0d49fb7 100644
--- a/Makefile
+++ b/Makefile
@@ -967,6 +967,8 @@ $(eval $(call assert_numerics,\
ARM_ARCH_MINOR \
BRANCH_PROTECTION \
FW_ENC_STATUS \
+ NR_OF_FW_BANKS \
+ NR_OF_IMAGES_IN_FW_BANK \
)))
ifdef KEY_SIZE
@@ -1054,6 +1056,8 @@ $(eval $(call add_defines,\
USE_SP804_TIMER \
ENABLE_FEAT_RNG \
ENABLE_FEAT_SB \
+ NR_OF_FW_BANKS \
+ NR_OF_IMAGES_IN_FW_BANK \
)))
ifeq (${SANITIZE_UB},trap)
diff --git a/include/drivers/fwu/fwu_metadata.h b/include/drivers/fwu/fwu_metadata.h
new file mode 100644
index 0000000000..2e88de5ec8
--- /dev/null
+++ b/include/drivers/fwu/fwu_metadata.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * FWU metadata information as per the specification section 4.1:
+ * https://developer.arm.com/documentation/den0118/a/
+ *
+ */
+
+#ifndef FWU_METADATA_H
+#define FWU_METADATA_H
+
+#include <stdint.h>
+#include <tools_share/uuid.h>
+
+/* Properties of image in a bank */
+struct fwu_image_properties {
+
+ /* UUID of the image in this bank */
+ uuid_t img_uuid;
+
+ /* [0]: bit describing the image acceptance status –
+ * 1 means the image is accepted
+ * [31:1]: MBZ
+ */
+ uint32_t accepted;
+
+ /* reserved (MBZ) */
+ uint32_t reserved;
+
+} __packed;
+
+/* Image entry information */
+struct fwu_image_entry {
+
+ /* UUID identifying the image type */
+ uuid_t img_type_uuid;
+
+ /* UUID of the storage volume where the image is located */
+ uuid_t location_uuid;
+
+ /* Properties of images with img_type_uuid in the different FW banks */
+ struct fwu_image_properties img_props[NR_OF_FW_BANKS];
+
+} __packed;
+
+/*
+ * FWU metadata filled by the updater and consumed by TF-A for
+ * various purposes as below:
+ * 1. Get active FW bank.
+ * 2. Rollback to previous working FW bank.
+ * 3. Get properties of all images present in all banks.
+ */
+struct fwu_metadata {
+
+ /* Metadata CRC value */
+ uint32_t crc_32;
+
+ /* Metadata version */
+ uint32_t version;
+
+ /* Bank index with which device boots */
+ uint32_t active_index;
+
+ /* Previous bank index with which device booted successfully */
+ uint32_t previous_active_index;
+
+ /* Image entry information */
+ struct fwu_image_entry img_entry[NR_OF_IMAGES_IN_FW_BANK];
+
+} __packed;
+
+#endif /* FWU_METADATA_H */
diff --git a/make_helpers/defaults.mk b/make_helpers/defaults.mk
index b2d1ee2674..53d9605df8 100644
--- a/make_helpers/defaults.mk
+++ b/make_helpers/defaults.mk
@@ -344,3 +344,11 @@ OPENSSL_DIR := /usr
# Build option to use the SP804 timer instead of the generic one
USE_SP804_TIMER := 0
+
+# Build option to define number of firmware banks, used in firmware update
+# metadata structure.
+NR_OF_FW_BANKS := 2
+
+# Build option to define number of images in firmware bank, used in firmware
+# update metadata structure.
+NR_OF_IMAGES_IN_FW_BANK := 1