soc/intel/common/block/cse: Add API to match current PM event

Introduce an API to read the Converged Security and Management Engine
(CSME) host firmware status register to obtain the current Power
Management event and compare it with a specified input event.

BUG=b:391449110
TEST=Build Brox BIOS image and boot to OS.

Change-Id: Ie9a49382ee2c1a8f59da6233e510cf2e38ac32ad
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86169
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Dinesh Gehlot <digehlot@google.com>
This commit is contained in:
Karthikeyan Ramasubramanian 2025-01-27 14:20:01 -07:00 committed by Karthik Ramasubramanian
commit 0212e4c3a2
2 changed files with 33 additions and 0 deletions

View file

@ -298,6 +298,28 @@ bool cse_is_hfs1_spi_protected(void)
return !hfs1.fields.mfg_mode;
}
#define ME_HFSTS2_CUR_PM_EVENT_SHIFT 24
#define ME_HFSTS2_CUR_PM_EVENT_MASK (0xf << ME_HFSTS2_CUR_PM_EVENT_SHIFT)
static uint8_t cse_get_hfs2_current_pm_event(void)
{
uint32_t data = me_read_config32(PCI_ME_HFSTS2);
return (uint8_t)((data & ME_HFSTS2_CUR_PM_EVENT_MASK) >>
ME_HFSTS2_CUR_PM_EVENT_SHIFT);
}
bool cse_check_host_cold_reset(void)
{
uint8_t event = cse_get_hfs2_current_pm_event();
switch (event) {
case PWR_CYCLE_RESET_CMOFF:
return true;
default:
return false;
}
}
bool cse_is_hfs3_fw_sku_lite(void)
{
union me_hfsts3 hfs3;

View file

@ -383,6 +383,10 @@ enum rst_req_type {
CSE_RESET_ONLY = 3,
};
enum cse_fw_sts_current_pm_event {
PWR_CYCLE_RESET_CMOFF = 0xb,
};
/*
* Sends GLOBAL_RESET_REQ cmd to CSE with reset type GLOBAL_RESET.
* Returns 0 on failure and 1 on success.
@ -618,4 +622,11 @@ bool is_cse_fw_update_required(void);
*/
bool is_cse_boot_to_rw(void);
/*
* Check if the CSE FW Status Current Power Management Event indicates that the
* host came out of cold reset.
* Returns true if the host came out of a cold reset, false otherwise.
*/
bool cse_check_host_cold_reset(void);
#endif // SOC_INTEL_COMMON_CSE_H