diff options
-rw-r--r-- | src/soc/intel/common/block/cse/cse_lite.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c index 0917897e30..8f59724023 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -769,6 +769,21 @@ static enum cb_err get_cse_ver_from_cbfs(struct fw_version *cbfs_rw_version) return CB_SUCCESS; } +static bool is_cse_sync_enforced(void) +{ + /* + * Force test CSE firmware update scenario if below conditions are being met: + * - VB2_GBB_FLAG_FORCE_CSE_SYNC flag is set + * - CSE FW is in RO + */ + struct vb2_context *ctx = vboot_get_context(); + if ((vb2api_gbb_get_flags(ctx) & VB2_GBB_FLAG_FORCE_CSE_SYNC) && + cse_get_current_bp() == RO) { + return true; + } + return false; +} + static enum cse_update_status cse_check_update_status(struct region_device *target_rdev) { int ret; @@ -787,12 +802,18 @@ static enum cse_update_status cse_check_update_status(struct region_device *targ cbfs_rw_version.build); ret = cse_compare_sub_part_version(&cbfs_rw_version, cse_get_rw_version()); - if (ret == 0) + if (ret == 0) { + if (is_cse_sync_enforced()) { + printk(BIOS_WARNING, "Force CSE Firmware upgrade for Autotest\n"); + return CSE_UPDATE_UPGRADE; + } return CSE_UPDATE_NOT_REQUIRED; - else if (ret < 0) - return CSE_UPDATE_DOWNGRADE; - else - return CSE_UPDATE_UPGRADE; + } else { + if (ret < 0) + return CSE_UPDATE_DOWNGRADE; + else + return CSE_UPDATE_UPGRADE; + } } static enum cb_err cse_write_rw_region(const struct region_device *target_rdev, @@ -1042,6 +1063,10 @@ bool is_cse_fw_update_required(void) if (get_cse_ver_from_cbfs(&cbfs_rw_version) == CB_ERR) return false; + /* Check if CSE sync is enforced */ + if (is_cse_sync_enforced()) { + return true; + } return !!cse_compare_sub_part_version(&cbfs_rw_version, cse_get_rw_version()); } |