soc/intel/xeon_sp/spr: Add soc set_cmos_mrc_cold_boot_flag
This soc utility function can set cmos flag to enforce
FSP MRC training.
Change-Id: I88004cbfdcbe8870726493576dfc31de4b6036a9
Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72598
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
diff --git a/src/soc/intel/xeon_sp/spr/soc_util.c b/src/soc/intel/xeon_sp/spr/soc_util.c
index f8d40e3..94d172c 100644
--- a/src/soc/intel/xeon_sp/spr/soc_util.c
+++ b/src/soc/intel/xeon_sp/spr/soc_util.c
@@ -5,7 +5,6 @@
#include <device/pci.h>
#include <hob_cxlnode.h>
#include <intelblocks/cpulib.h>
-#include <soc/cpu.h>
#include <soc/msr.h>
#include <soc/numa.h>
#include <soc/pci_devs.h>
@@ -13,6 +12,7 @@
#include <soc/util.h>
#include <stdlib.h>
#include <string.h>
+#include <pc80/mc146818rtc.h>
const EWL_PRIVATE_DATA *get_ewl_hob(void)
{
@@ -161,3 +161,13 @@
wrmsr(MSR_BIOS_DONE, msr);
}
}
+
+void set_cmos_mrc_cold_boot_flag(bool cold_boot_required)
+{
+ uint8_t mrc_status = cmos_read(CMOS_OFFSET_MRC_STATUS);
+ uint8_t new_mrc_status = (mrc_status & 0xfe) | cold_boot_required;
+ printk(BIOS_SPEW, "MRC status: 0x%02x want 0x%02x\n", mrc_status, new_mrc_status);
+ if (new_mrc_status != mrc_status)
+ cmos_write(new_mrc_status, CMOS_OFFSET_MRC_STATUS);
+
+}