summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;