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>
This commit is contained in:
Subrata Banik 2024-11-04 15:35:45 +00:00
commit 1c69877328
2 changed files with 20 additions and 0 deletions

View file

@ -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;

View file

@ -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