soc/intel/common/block/cse: Move cse_trigger_recovery function
This function could be applicable in situations other than just for the CSE Lite SKU, therefore move this from cse_lite.c to cse.c Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: Ibc541f2e30ef06856da10f1f1219930dff493afa Reviewed-on: https://review.coreboot.org/c/coreboot/+/55673 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Karthik Ramasubramanian <kramasub@google.com> Reviewed-by: Subrata Banik <subrata.banik@intel.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
f100e204ec
commit
09635f418b
|
@ -9,6 +9,8 @@
|
||||||
#include <device/pci_ids.h>
|
#include <device/pci_ids.h>
|
||||||
#include <device/pci_ops.h>
|
#include <device/pci_ops.h>
|
||||||
#include <intelblocks/cse.h>
|
#include <intelblocks/cse.h>
|
||||||
|
#include <security/vboot/misc.h>
|
||||||
|
#include <security/vboot/vboot_common.h>
|
||||||
#include <soc/iomap.h>
|
#include <soc/iomap.h>
|
||||||
#include <soc/pci_devs.h>
|
#include <soc/pci_devs.h>
|
||||||
#include <soc/me.h>
|
#include <soc/me.h>
|
||||||
|
@ -859,6 +861,24 @@ fail:
|
||||||
printk(BIOS_DEBUG, "ME: Version: Unavailable\n");
|
printk(BIOS_DEBUG, "ME: Version: Unavailable\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cse_trigger_vboot_recovery(enum csme_failure_reason reason)
|
||||||
|
{
|
||||||
|
printk(BIOS_DEBUG, "cse: CSE status registers: HFSTS1: 0x%x, HFSTS2: 0x%x "
|
||||||
|
"HFSTS3: 0x%x\n", me_read_config32(PCI_ME_HFSTS1),
|
||||||
|
me_read_config32(PCI_ME_HFSTS2), me_read_config32(PCI_ME_HFSTS3));
|
||||||
|
|
||||||
|
if (CONFIG(VBOOT)) {
|
||||||
|
struct vb2_context *ctx = vboot_get_context();
|
||||||
|
if (ctx == NULL)
|
||||||
|
goto failure;
|
||||||
|
vb2api_fail(ctx, VB2_RECOVERY_INTEL_CSE_LITE_SKU, reason);
|
||||||
|
vboot_save_data(ctx);
|
||||||
|
vboot_reboot();
|
||||||
|
}
|
||||||
|
failure:
|
||||||
|
die("cse: Failed to trigger recovery mode(recovery subcode:%d)\n", reason);
|
||||||
|
}
|
||||||
|
|
||||||
#if ENV_RAMSTAGE
|
#if ENV_RAMSTAGE
|
||||||
|
|
||||||
static void update_sec_bar(struct device *dev)
|
static void update_sec_bar(struct device *dev)
|
||||||
|
|
|
@ -120,29 +120,6 @@ struct get_bp_info_rsp {
|
||||||
struct cse_bp_info bp_info;
|
struct cse_bp_info bp_info;
|
||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
static void cse_log_status_registers(void)
|
|
||||||
{
|
|
||||||
printk(BIOS_DEBUG, "cse_lite: CSE status registers: HFSTS1: 0x%x, HFSTS2: 0x%x "
|
|
||||||
"HFSTS3: 0x%x\n", me_read_config32(PCI_ME_HFSTS1),
|
|
||||||
me_read_config32(PCI_ME_HFSTS2), me_read_config32(PCI_ME_HFSTS3));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cse_trigger_recovery(uint8_t rec_sub_code)
|
|
||||||
{
|
|
||||||
/* Log CSE Firmware Status Registers to help debugging */
|
|
||||||
cse_log_status_registers();
|
|
||||||
if (CONFIG(VBOOT)) {
|
|
||||||
struct vb2_context *ctx = vboot_get_context();
|
|
||||||
if (ctx == NULL)
|
|
||||||
goto failure;
|
|
||||||
vb2api_fail(ctx, VB2_RECOVERY_INTEL_CSE_LITE_SKU, rec_sub_code);
|
|
||||||
vboot_save_data(ctx);
|
|
||||||
vboot_reboot();
|
|
||||||
}
|
|
||||||
failure:
|
|
||||||
die("cse_lite: Failed to trigger recovery mode(recovery subcode:%d)\n", rec_sub_code);
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint8_t cse_get_current_bp(const struct cse_bp_info *cse_bp_info)
|
static uint8_t cse_get_current_bp(const struct cse_bp_info *cse_bp_info)
|
||||||
{
|
{
|
||||||
return cse_bp_info->current_bp;
|
return cse_bp_info->current_bp;
|
||||||
|
@ -748,11 +725,11 @@ void cse_fw_sync(void)
|
||||||
|
|
||||||
if (!cse_get_bp_info(&cse_bp_info)) {
|
if (!cse_get_bp_info(&cse_bp_info)) {
|
||||||
printk(BIOS_ERR, "cse_lite: Failed to get CSE boot partition info\n");
|
printk(BIOS_ERR, "cse_lite: Failed to get CSE boot partition info\n");
|
||||||
cse_trigger_recovery(CSE_COMMUNICATION_ERROR);
|
cse_trigger_vboot_recovery(CSE_COMMUNICATION_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cse_fix_data_failure_err(&cse_bp_info.bp_info))
|
if (!cse_fix_data_failure_err(&cse_bp_info.bp_info))
|
||||||
cse_trigger_recovery(CSE_LITE_SKU_DATA_WIPE_ERROR);
|
cse_trigger_vboot_recovery(CSE_LITE_SKU_DATA_WIPE_ERROR);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If SOC_INTEL_CSE_RW_UPDATE is defined , then trigger CSE firmware update. The driver
|
* If SOC_INTEL_CSE_RW_UPDATE is defined , then trigger CSE firmware update. The driver
|
||||||
|
@ -762,7 +739,7 @@ void cse_fw_sync(void)
|
||||||
uint8_t rv;
|
uint8_t rv;
|
||||||
rv = cse_fw_update(&cse_bp_info.bp_info);
|
rv = cse_fw_update(&cse_bp_info.bp_info);
|
||||||
if (rv)
|
if (rv)
|
||||||
cse_trigger_recovery(rv);
|
cse_trigger_vboot_recovery(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cse_is_rw_bp_status_valid(&cse_bp_info.bp_info))
|
if (!cse_is_rw_bp_status_valid(&cse_bp_info.bp_info))
|
||||||
|
@ -770,6 +747,6 @@ void cse_fw_sync(void)
|
||||||
|
|
||||||
if (!cse_boot_to_rw(&cse_bp_info.bp_info)) {
|
if (!cse_boot_to_rw(&cse_bp_info.bp_info)) {
|
||||||
printk(BIOS_ERR, "cse_lite: Failed to switch to RW\n");
|
printk(BIOS_ERR, "cse_lite: Failed to switch to RW\n");
|
||||||
cse_trigger_recovery(CSE_LITE_SKU_RW_SWITCH_ERROR);
|
cse_trigger_vboot_recovery(CSE_LITE_SKU_RW_SWITCH_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -280,4 +280,7 @@ void cse_fw_sync(void);
|
||||||
/* Perform a board-specific reset sequence for CSE RO<->RW jump */
|
/* Perform a board-specific reset sequence for CSE RO<->RW jump */
|
||||||
void cse_board_reset(void);
|
void cse_board_reset(void);
|
||||||
|
|
||||||
|
/* Trigger vboot recovery mode on a CSE error */
|
||||||
|
void cse_trigger_vboot_recovery(enum csme_failure_reason reason);
|
||||||
|
|
||||||
#endif // SOC_INTEL_COMMON_CSE_H
|
#endif // SOC_INTEL_COMMON_CSE_H
|
||||||
|
|
Loading…
Reference in New Issue