From 5a70f8a09239415a612191d241354f9d223a7232 Mon Sep 17 00:00:00 2001 From: Dinesh Gehlot Date: Tue, 30 Jul 2024 12:53:50 +0530 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/83686 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik --- src/soc/intel/common/block/cse/cse_lite.c | 35 ++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'src/soc/intel') 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()); } -- cgit v1.2.3