summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/soc/intel/xeon_sp/spr/include/soc/soc_util.h17
-rw-r--r--src/soc/intel/xeon_sp/spr/soc_util.c12
2 files changed, 28 insertions, 1 deletions
diff --git a/src/soc/intel/xeon_sp/spr/include/soc/soc_util.h b/src/soc/intel/xeon_sp/spr/include/soc/soc_util.h
index c96103059a..e1ed41458b 100644
--- a/src/soc/intel/xeon_sp/spr/include/soc/soc_util.h
+++ b/src/soc/intel/xeon_sp/spr/include/soc/soc_util.h
@@ -9,6 +9,22 @@
#include <hob_systeminfo.h>
#include <hob_enhancedwarningloglib.h>
+/*
+ * Address of the MRC status byte in CMOS. Should be reserved
+ * in mainboards' cmos.layout and not covered by checksum.
+ */
+#define CMOS_OFFSET_MRC_STATUS 0x47
+
+#if CONFIG(USE_OPTION_TABLE)
+#include "option_table.h"
+#if CMOS_VSTART_mrc_status != CMOS_OFFSET_MRC_STATUS * 8
+#error "CMOS start for CPX-SP MRC status byte is not correct, check your cmos.layout"
+#endif
+#if CMOS_VLEN_mrc_status != 8
+#error "CMOS length for CPX-SP MRC status byte is not correct, check your cmos.layout"
+#endif
+#endif
+
const struct SystemMemoryMapHob *get_system_memory_map(void);
const struct SystemMemoryMapElement *get_system_memory_map_elment(uint8_t *num);
@@ -28,5 +44,6 @@ const EWL_PRIVATE_DATA *get_ewl_hob(void);
uint32_t get_ubox_busno(uint32_t socket, uint8_t offset);
uint32_t get_socket_ubox_busno(uint32_t socket);
+void set_cmos_mrc_cold_boot_flag(bool cold_boot_required);
#endif /* _SOC_UTIL_H_ */
diff --git a/src/soc/intel/xeon_sp/spr/soc_util.c b/src/soc/intel/xeon_sp/spr/soc_util.c
index f8d40e3bea..94d172c37a 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 @@ void bios_done_msr(void *unused)
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);
+
+}