soc/intel/common/block/cse: Enforce CSE sync with pertinent GBB flag
The patch enforces CSE sync when the GBB flag GBB_FLAG_FORCE_CSE_SYNC is enabled and the system is currently booting from the RO section. Additionally, it integrates forced CSE sync into eSOL decision-making. BUG=b:353053317 TEST=Verified forced CSE sync on rex0 with GBB 0x200000 Cq-Depend: chromium:5718196 Change-Id: I228bc8ebf58719776f6c39e0bfbb7ad53d9bfb7f Signed-off-by: Dinesh Gehlot <digehlot@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/83686 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
committed by
Felix Held
parent
896c76c5c1
commit
5a70f8a092
@@ -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,13 +802,19 @@ 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)
|
||||
} 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,
|
||||
const void *cse_cbfs_rw, const size_t cse_cbfs_rw_sz)
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user