summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAshish Kumar Mishra <ashish.k.mishra@intel.com>2023-04-25 17:23:21 +0530
committerSridhar Siricilla <sridhar.siricilla@intel.com>2023-04-26 17:23:32 +0000
commit2ee716227e663f9a8285de373383024671d37380 (patch)
tree8350f9297702a99f2f87b05f58ecf75505beb4fd /src
parent627f4c5deb712573ab66042a3eb481a62e7fa21f (diff)
intel/mtl: Add get_cse_ver_from_cbfs function
This patch implements helper function get_cse_ver_from_cbfs() to retrieve the CSE Lite version from CBFE RW's metadata and calls the helper function from cse_check_update_status() TEST=Verified CSE Lite version in coreboot boot log Signed-off-by: Ashish Kumar Mishra <ashish.k.mishra@intel.com> Change-Id: Ie1bf186adfc3f87826a7ce9b0167a6bbe6767299 Reviewed-on: https://review.coreboot.org/c/coreboot/+/74755 Reviewed-by: Sridhar Siricilla <sridhar.siricilla@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Himanshu Sahdev <himanshu.sahdev@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/block/cse/cse_lite.c46
1 files changed, 29 insertions, 17 deletions
diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c
index d6c83479de..460910bf30 100644
--- a/src/soc/intel/common/block/cse/cse_lite.c
+++ b/src/soc/intel/common/block/cse/cse_lite.c
@@ -630,40 +630,52 @@ static bool read_ver_field(const char *start, char **curr, size_t size, uint16_t
return true;
}
-static enum cse_update_status cse_check_update_status(const struct cse_bp_info *cse_bp_info,
- struct region_device *target_rdev)
+static enum cb_err get_cse_ver_from_cbfs(struct fw_version *cbfs_rw_version)
{
- int ret;
- struct fw_version cbfs_rw_version;
- char *version_str, *ptr;
+ char *version_str, *cbfs_ptr;
size_t size;
- if (!cse_is_rw_bp_sign_valid(target_rdev))
- return CSE_UPDATE_CORRUPTED;
+ if (cbfs_rw_version == NULL)
+ return CB_ERR;
- ptr = version_str = cbfs_map(CONFIG_SOC_INTEL_CSE_RW_VERSION_CBFS_NAME, &size);
+ cbfs_ptr = cbfs_map(CONFIG_SOC_INTEL_CSE_RW_VERSION_CBFS_NAME, &size);
+ version_str = cbfs_ptr;
if (!version_str) {
printk(BIOS_ERR, "cse_lite: Failed to get %s\n",
- CONFIG_SOC_INTEL_CSE_RW_VERSION_CBFS_NAME);
- return CSE_UPDATE_METADATA_ERROR;
+ CONFIG_SOC_INTEL_CSE_RW_VERSION_CBFS_NAME);
+ return CB_ERR;
}
- if (!read_ver_field(version_str, &ptr, size, &cbfs_rw_version.major) ||
- !read_ver_field(version_str, &ptr, size, &cbfs_rw_version.minor) ||
- !read_ver_field(version_str, &ptr, size, &cbfs_rw_version.hotfix) ||
- !read_ver_field(version_str, &ptr, size, &cbfs_rw_version.build)) {
+ if (!read_ver_field(version_str, &cbfs_ptr, size, &cbfs_rw_version->major) ||
+ !read_ver_field(version_str, &cbfs_ptr, size, &cbfs_rw_version->minor) ||
+ !read_ver_field(version_str, &cbfs_ptr, size, &cbfs_rw_version->hotfix) ||
+ !read_ver_field(version_str, &cbfs_ptr, size, &cbfs_rw_version->build)) {
cbfs_unmap(version_str);
- return CSE_UPDATE_METADATA_ERROR;
+ return CB_ERR;
}
+ cbfs_unmap(version_str);
+ return CB_SUCCESS;
+}
+
+static enum cse_update_status cse_check_update_status(const struct cse_bp_info *cse_bp_info,
+ struct region_device *target_rdev)
+{
+ int ret;
+ struct fw_version cbfs_rw_version;
+
+ if (!cse_is_rw_bp_sign_valid(target_rdev))
+ return CSE_UPDATE_CORRUPTED;
+
+ if (get_cse_ver_from_cbfs(&cbfs_rw_version) == CB_ERR)
+ return CSE_UPDATE_METADATA_ERROR;
+
printk(BIOS_DEBUG, "cse_lite: CSE CBFS RW version : %d.%d.%d.%d\n",
cbfs_rw_version.major,
cbfs_rw_version.minor,
cbfs_rw_version.hotfix,
cbfs_rw_version.build);
- cbfs_unmap(version_str);
-
ret = cse_compare_sub_part_version(&cbfs_rw_version, cse_get_rw_version(cse_bp_info));
if (ret == 0)
return CSE_UPDATE_NOT_REQUIRED;