summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDinesh Gehlot <digehlot@google.com>2024-07-30 12:53:50 +0530
committerFelix Held <felix-coreboot@felixheld.de>2024-08-02 14:44:10 +0000
commit5a70f8a09239415a612191d241354f9d223a7232 (patch)
tree8460155840e41742bc9922dc6db79a2937b22478
parent896c76c5c1cadb35812d0a5867b293a8b1138b71 (diff)
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>
-rw-r--r--src/soc/intel/common/block/cse/cse_lite.c35
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());
}