diff options
author | Anil Kumar <anil.kumar.k@intel.com> | 2023-10-03 21:31:53 -0700 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2023-12-11 05:06:48 +0000 |
commit | e46af3fca48f0d624d1380bca1e40741cb2c1caa (patch) | |
tree | c6a4e6abfc11a9b8b4621c86e751659ebca39b29 | |
parent | ebb28c523ef154beee3e9afdc6262df7ce28e03c (diff) |
soc/intel/cse: Add API to check if CSE Firmware update is required
This patch adds a function to check if a CSE FW update is required
during this boot. The function is expected to be used during use
cases like Pre-Memory Sign of Life text display to inform user of
a CSE Firmware update.
Bug=279173035
TEST=build and boot on google/rex board. Call the function in romstage
and confirm it returns True during CSE FW update and False otherwise
Signed-off-by: Anil Kumar <anil.kumar.k@intel.com>
Change-Id: If5fae95786d28d586566881bc4436812754636ae
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78243
Reviewed-by: Pratikkumar V Prajapati <pratikkumar.v.prajapati@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
-rw-r--r-- | src/soc/intel/common/block/cse/cse_lite.c | 24 | ||||
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/cse.h | 5 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/cse/cse_lite.c b/src/soc/intel/common/block/cse/cse_lite.c index 8e8e221687..bfa01e4dee 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -1122,6 +1122,30 @@ static void initiate_psr_data_backup(void) backup_psr_data(); } +/* + * Check if a CSE Firmware update is required + * returns true if an update is required, false otherwise + */ +bool is_cse_fw_update_required(void) +{ + struct fw_version cbfs_rw_version; + + if (!is_cse_fw_update_enabled()) + return false; + + /* + * First, check if cse_bp_info_rsp global structure is populated. + * If not, it implies that cse_fill_bp_info() function is not called. + */ + if (!is_cse_bp_info_valid(&cse_bp_info_rsp)) + return false; + + if (get_cse_ver_from_cbfs(&cbfs_rw_version) == CB_ERR) + return false; + + return !!cse_compare_sub_part_version(&cbfs_rw_version, cse_get_rw_version()); +} + static uint8_t cse_fw_update(void) { struct region_device target_rdev; diff --git a/src/soc/intel/common/block/include/intelblocks/cse.h b/src/soc/intel/common/block/include/intelblocks/cse.h index f84dba86f1..3db13248d2 100644 --- a/src/soc/intel/common/block/include/intelblocks/cse.h +++ b/src/soc/intel/common/block/include/intelblocks/cse.h @@ -611,4 +611,9 @@ enum cb_err cse_get_fw_feature_state(uint32_t *feature_state); /* Fills the CSE Boot Partition Info response */ void cse_fill_bp_info(void); +/* + * Check if a CSE Firmware update is required + * Returns true if an update is required, false otherwise + */ +bool is_cse_fw_update_required(void); #endif // SOC_INTEL_COMMON_CSE_H |