aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/cse/cse_rw_metadata.c
diff options
context:
space:
mode:
authorV Sowmya <v.sowmya@intel.com>2020-11-11 07:04:13 +0530
committerFurquan Shaikh <furquan@google.com>2020-11-18 01:26:23 +0000
commit338b83c7b840198b537427ade46c54d7ddb217b1 (patch)
treed791125c9242b0b2b178d1e1774bbc1b19b3497a /src/soc/intel/common/block/cse/cse_rw_metadata.c
parentf99055266bf2dba0cd85ade3bb0ba3ddeec5f7c7 (diff)
soc/intel/common: Generate the CSE RW metadata and add to FW_MAIN_A/B
In the existing implementation CSE RW metadata file is generated by scripts and to avoid incompitable issues between coreboot and the scripts this patch adds the follwing changes, * Move the metadata generation to the coreboot Makefile. * Add CBFS component type struct to create a metadata file during the compile time. * Extract the CSE RW version from SOC_INTEL_CSE_RW_VERSION config and update the major, minor, hotfix and build versions using the compile time flags. * Compute the hash of CSE RW binary in hex format using the openssl and use the HASH_BYTEARRAY macro to convert the 64 character hex values into the array. * Add the me_rw.metadata cbfs file to FW_MAIN_A and FW_MAIN_B regions. BUG=b:169077783 TEST= Built for dedede. Verify that metadata file was generated and added to the FW_MAIN_A/B. Extracted it using cbfstool and verfied that metadata was generated properly. Change-Id: I412581400a9606fa17cf4398faffda923f07b320 Signed-off-by: V Sowmya <v.sowmya@intel.com> Signed-off-by: Maulik V Vaghela <maulik.v.vaghela@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47431 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Diffstat (limited to 'src/soc/intel/common/block/cse/cse_rw_metadata.c')
-rw-r--r--src/soc/intel/common/block/cse/cse_rw_metadata.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/cse/cse_rw_metadata.c b/src/soc/intel/common/block/cse/cse_rw_metadata.c
new file mode 100644
index 0000000000..3f7e779907
--- /dev/null
+++ b/src/soc/intel/common/block/cse/cse_rw_metadata.c
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <intelblocks/cse.h>
+
+#define HASH_TO_ARRAY(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16,\
+ x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30,\
+ x31, x32) { 0x##x1, 0x##x2, 0x##x3, 0x##x4, 0x##x5, 0x##x6, 0x##x7,\
+ 0x##x8, 0x##x9, 0x##x10, 0x##x11, 0x##x12, 0x##x13, 0x##x14, 0x##x15,\
+ 0x##x16, 0x##x17, 0x##x18, 0x##x19, 0x##x20, 0x##x21, 0x##x22, 0x##x23,\
+ 0x##x24, 0x##x25, 0x##x26, 0x##x27, 0x##x28, 0x##x29, 0x##x30, 0x##x31,\
+ 0x##x32 }
+#define HASH_BYTEARRAY(...) HASH_TO_ARRAY(__VA_ARGS__)
+
+/*
+ * This structure contains the CSE RW version and hash details which are filled during the
+ * compile time.
+ * Makefile will extract the following details and updates the structure variable via the
+ * compile time flags.
+ * CSE RW version: Extract the version string from the SOC_INTEL_CSE_RW_VERSION config and
+ * assign the major, minor, hotfix and build versions.
+ * CSE RW hash: Compute the hash of CSE RW binary in hex format using the openssl and use the
+ * HASH_BYTEARRAY macro to convert the 64 character hex values into the array.
+ */
+struct cse_rw_metadata metadata = {
+ .version = {
+ .major = CSE_RW_MAJOR,
+ .minor = CSE_RW_MINOR,
+ .build = CSE_RW_BUILD,
+ .hotfix = CSE_RW_HOTFIX,
+ },
+ .sha256 = HASH_BYTEARRAY(CSE_RW_SHA256),
+};