Dinesh Gehlot has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/83686?usp=email )
Change subject: src: Enforce CSE sync with pertinent GBB flag ......................................................................
src: Enforce CSE sync with pertinent GBB flag
The patch enforces CSE sync when the GBB flag GBB_FLAG_FORCE_CSME_SYNC is enabled and the system is currently booting from the RO section. Additionally, it integrates forced CSE sync into eSOL decision-making.
This patch is an enhancement of CB:5705989 featuring the new GBB flag.
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 --- M src/soc/intel/common/block/cse/cse_lite.c 1 file changed, 31 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/83686/1
diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c index 0917897..333a799 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -769,6 +769,22 @@ return CB_SUCCESS; }
+static bool is_cse_sync_enforced(void) +{ + /* + * Force test CSE firmware update scenario if below conditions are being met: + * - CSE Update not required + * - VB2_GBB_FLAG_FORCE_CSME_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_CSME_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 +803,18 @@ 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 +1064,10 @@ 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()); }