soc/intel/cse: Add entries to eventlog on PSR backup events

This patch adds eventlog entries for the below scenarios:
1. To indicate success or failure of PSR data back-up command
2. To indicate the loss of PSR data when CSE update is corrupted, and
data clear command is issued to clear the data.
3. To indicate the loss of PSR data when CSE boot partition info
response is corrupted and data back-up is not initiated.

BRANCH=None
BUG=b:273207144
TEST=Verify elog event added after PSR data backup command is sent
cse_lite: PSR_HECI_FW_DOWNGRADE_BACKUP command sent
...
ELOG: Event(B9) added with size 10 at 2023-06-27 06:44:49 UTC

Change-Id: I2459a2b941d28a87b6c78f75dbe8779d73328d7a
Signed-off-by: Krishna Prasad Bhat <krishna.p.bhat.d@intel.com>
Signed-off-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75760
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Anil Kumar K <anil.kumar.k@intel.com>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Krishna Prasad Bhat 2023-06-12 15:04:08 +05:30 committed by Subrata Banik
parent a2d10bb029
commit b58fd2de04
1 changed files with 19 additions and 5 deletions

View File

@ -7,6 +7,7 @@
#include <console/console.h> #include <console/console.h>
#include <cpu/cpu.h> #include <cpu/cpu.h>
#include <crc_byte.h> #include <crc_byte.h>
#include <elog.h>
#include <fmap.h> #include <fmap.h>
#include <intelbasecode/debug_feature.h> #include <intelbasecode/debug_feature.h>
#include <intelblocks/cse.h> #include <intelblocks/cse.h>
@ -986,6 +987,8 @@ static enum csme_failure_reason cse_update_rw(const void *cse_cbfs_rw, const siz
static enum cb_err cse_prep_for_rw_update(enum cse_update_status status) static enum cb_err cse_prep_for_rw_update(enum cse_update_status status)
{ {
if (status == CSE_UPDATE_CORRUPTED)
elog_add_event(ELOG_TYPE_PSR_DATA_LOST);
/* /*
* To set CSE's operation mode to HMRFPO mode: * To set CSE's operation mode to HMRFPO mode:
* 1. Ensure CSE to boot from RO(BP1) * 1. Ensure CSE to boot from RO(BP1)
@ -1095,9 +1098,10 @@ static void backup_psr_data(void)
{ {
printk(BIOS_DEBUG, "cse_lite: Initiate PSR data backup flow\n"); printk(BIOS_DEBUG, "cse_lite: Initiate PSR data backup flow\n");
/* Switch CSE to RW to send PSR_HECI_FW_DOWNGRADE_BACKUP command */ /* Switch CSE to RW to send PSR_HECI_FW_DOWNGRADE_BACKUP command */
if (cse_boot_to_rw() != CB_SUCCESS) if (cse_boot_to_rw() != CB_SUCCESS) {
elog_add_event(ELOG_TYPE_PSR_DATA_LOST);
goto update_and_exit; goto update_and_exit;
}
/* /*
* The function to check for PSR feature support can only be called after * The function to check for PSR feature support can only be called after
* switching to RW partition. The command MKHI_FWCAPS_GET_FW_FEATURE_STATE * switching to RW partition. The command MKHI_FWCAPS_GET_FW_FEATURE_STATE
@ -1116,6 +1120,7 @@ static void backup_psr_data(void)
if (!cse_is_hfs1_cws_normal() || !cse_is_hfs1_com_normal()) { if (!cse_is_hfs1_cws_normal() || !cse_is_hfs1_com_normal()) {
printk(BIOS_DEBUG, "cse_lite: PSR_HECI_FW_DOWNGRADE_BACKUP command " printk(BIOS_DEBUG, "cse_lite: PSR_HECI_FW_DOWNGRADE_BACKUP command "
"prerequisites not met!\n"); "prerequisites not met!\n");
elog_add_event(ELOG_TYPE_PSR_DATA_LOST);
goto update_and_exit; goto update_and_exit;
} }
@ -1138,18 +1143,27 @@ static void backup_psr_data(void)
printk(BIOS_DEBUG, "cse_lite: Send PSR_HECI_FW_DOWNGRADE_BACKUP command\n"); printk(BIOS_DEBUG, "cse_lite: Send PSR_HECI_FW_DOWNGRADE_BACKUP command\n");
if (heci_send_receive(&req, sizeof(req), if (heci_send_receive(&req, sizeof(req),
&backup_psr_resp, &resp_size, HECI_PSR_ADDR)) &backup_psr_resp, &resp_size, HECI_PSR_ADDR)) {
printk(BIOS_ERR, "cse_lite: could not backup PSR data\n"); printk(BIOS_ERR, "cse_lite: could not backup PSR data\n");
else elog_add_event_byte(ELOG_TYPE_PSR_DATA_BACKUP, ELOG_PSR_DATA_BACKUP_FAILED);
if (backup_psr_resp.status != PSR_STATUS_SUCCESS) } else {
if (backup_psr_resp.status != PSR_STATUS_SUCCESS) {
printk(BIOS_ERR, "cse_lite: PSR_HECI_FW_DOWNGRADE_BACKUP command " printk(BIOS_ERR, "cse_lite: PSR_HECI_FW_DOWNGRADE_BACKUP command "
"returned %u\n", backup_psr_resp.status); "returned %u\n", backup_psr_resp.status);
elog_add_event_byte(ELOG_TYPE_PSR_DATA_BACKUP,
ELOG_PSR_DATA_BACKUP_FAILED);
} else {
elog_add_event_byte(ELOG_TYPE_PSR_DATA_BACKUP,
ELOG_PSR_DATA_BACKUP_SUCCESS);
}
}
update_and_exit: update_and_exit:
/* /*
* An attempt to send PSR back-up command has been made. Update this info in CMOS and * An attempt to send PSR back-up command has been made. Update this info in CMOS and
* send success once backup_psr_data() has been called. We do not want to put the system * send success once backup_psr_data() has been called. We do not want to put the system
* into recovery for PSR data backup command pre-requisites not being met. * into recovery for PSR data backup command pre-requisites not being met.
* We cannot do much if CSE fails to backup the PSR data, except create an event log.
*/ */
update_psr_backup_status(PSR_BACKUP_DONE); update_psr_backup_status(PSR_BACKUP_DONE);
return; return;