diff options
author | Subrata Banik <subratabanik@google.com> | 2024-11-04 15:35:45 +0000 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2024-11-07 18:38:51 +0000 |
commit | 1c69877328187b44c0327f15e84873ef6352c90c (patch) | |
tree | 5437dfa021522d432f69d80a9a256516903f25b4 | |
parent | fdf611482968eedfe6144138cdf4a6d65708f296 (diff) |
soc/intel/cmn/block/cse: Add API to check the current boot partition
This patch introduces an API to check whether CSE is booting from
the RW slot.
This information can be used to determine if a CSE firmware update is
pending, which would help to optimize the boot flow by knowing if any
reset is expected due to CSE sync.
TEST=Able to build google/brox.
Change-Id: I1a63ae9992d83b439a0f995d599ee475f7abd75b
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84995
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
-rw-r--r-- | src/soc/intel/common/block/cse/cse_lite.c | 13 | ||||
-rw-r--r-- | src/soc/intel/common/block/include/intelblocks/cse.h | 7 |
2 files changed, 20 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 c5f0560d2a..09281ab150 100644 --- a/src/soc/intel/common/block/cse/cse_lite.c +++ b/src/soc/intel/common/block/cse/cse_lite.c @@ -1071,6 +1071,19 @@ bool is_cse_fw_update_required(void) return !!cse_compare_sub_part_version(&cbfs_rw_version, cse_get_rw_version()); } +bool is_cse_boot_to_rw(void) +{ + if (cse_get_bp_info() != CB_SUCCESS) { + printk(BIOS_ERR, "cse_lite: Failed to get CSE boot partition info\n"); + return false; + } + + if (cse_get_current_bp() == RW) + return true; + + return false; +} + 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 552eb7b2d4..c97e4ec65c 100644 --- a/src/soc/intel/common/block/include/intelblocks/cse.h +++ b/src/soc/intel/common/block/include/intelblocks/cse.h @@ -611,4 +611,11 @@ void cse_fill_bp_info(void); * Returns true if an update is required, false otherwise */ bool is_cse_fw_update_required(void); + +/* + * Check if the CSE firmware is booting from RW slot. + * Returns true if CSE is booting from RW slot, false otherwise + */ +bool is_cse_boot_to_rw(void); + #endif // SOC_INTEL_COMMON_CSE_H |