Dinesh Gehlot has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/75687?usp=email )
Change subject: soc/intel/cmd/blk/cse: Update CBMEM stored CSE version ......................................................................
soc/intel/cmd/blk/cse: Update CBMEM stored CSE version
This patch updates the CBMEM stored CSE version to the current version.
BUG=b:280722061
Signed-off-by: Dinesh Gehlot digehlot@google.com Change-Id: I97fc7a693bdb9dd67e711fd3d478b4e04f966e68 --- M src/soc/intel/common/block/cse/cse_lite.c 1 file changed, 16 insertions(+), 21 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/87/75687/1
diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c index 2b4ec7a..cf1df2b 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -1172,26 +1172,6 @@ timestamp_add_now(TS_CSE_FW_SYNC_END); }
-/* - * Helper function that stores current CSE firmware version to CBMEM memory, - * except during recovery mode. - */ -static void store_cse_rw_fw_version(void) -{ - if (vboot_recovery_mode_enabled()) - return; - - struct get_bp_info_rsp cse_bp_info; - if (cse_get_bp_info(&cse_bp_info) != CB_SUCCESS) { - printk(BIOS_ERR, "cse_lite: Failed to get CSE boot partition info\n"); - return; - } - const struct cse_bp_entry *cse_bp = cse_get_bp_entry(RW, &cse_bp_info.bp_info); - struct cse_fw_partition_info *version; - version = cbmem_add(CBMEM_ID_CSE_PARTITION_VERSION, sizeof(*version)); - memcpy(&(version->cur_cse_fw_version), &(cse_bp->fw_ver), sizeof(struct fw_version)); -} - static enum cb_err send_get_fpt_partition_info_cmd(enum fpt_partition_id id, struct fw_version_resp *resp) { @@ -1323,10 +1303,13 @@ return; } const struct cse_bp_entry *cse_bp = cse_get_bp_entry(RW, &cse_bp_info.bp_info); + struct cse_fw_partition_info *cbmem_fw; size_t vers_size = sizeof(struct fw_version); struct fw_version prev_cse_fw_version; get_cmos_cse_version(&prev_cse_fw_version);
+ cbmem_fw = cbmem_add(CBMEM_ID_CSE_PARTITION_VERSION, sizeof(*cbmem_fw)); + /* * Compare if stored cse version (from the previous boot) is same as current * running cse version. @@ -1334,6 +1317,19 @@ if (memcmp(&prev_cse_fw_version, &(cse_bp->fw_ver), vers_size)) { /* write cse rw fw version to CMOS */ set_cmos_cse_version(&(cse_bp->fw_ver)); + + /* write cse rw fw version to CBMEM */ + memcpy(&(cbmem_fw->cur_cse_fw_version), &(cse_bp->fw_ver), sizeof(struct fw_version)); + } else { + /* Current running CSE version is same as previous stored CSE version */ + + if (memcmp(&(cbmem_fw->cur_cse_fw_version), &(cse_bp->fw_ver), vers_size)) { + /* + * The CBMEM memory was reset during cold reboot, so the CSE version in + * CBMEM needs to be updated to the version stored in CMOS. + */ + memcpy(&(cbmem_fw->cur_cse_fw_version), &(cse_bp->fw_ver), sizeof(struct fw_version)); + } } }
@@ -1352,7 +1348,6 @@ if (CONFIG(SOC_INTEL_STORE_CSE_FPT_PARTITION_VERSION) && soc_is_ish_partition_enabled()) { store_cse_fw_partition_version_info(); - store_cse_rw_fw_version(); store_ish_version(); } }