aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/common/vboot
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/common/vboot')
-rw-r--r--src/soc/amd/common/vboot/Makefile.inc6
-rw-r--r--src/soc/amd/common/vboot/vbnv_cmos.c10
2 files changed, 16 insertions, 0 deletions
diff --git a/src/soc/amd/common/vboot/Makefile.inc b/src/soc/amd/common/vboot/Makefile.inc
new file mode 100644
index 0000000000..aff927a5d0
--- /dev/null
+++ b/src/soc/amd/common/vboot/Makefile.inc
@@ -0,0 +1,6 @@
+ifeq ($(CONFIG_VBOOT_VBNV_CMOS),y)
+bootblock-y += vbnv_cmos.c
+verstage-y += vbnv_cmos.c
+romstage-y += vbnv_cmos.c
+ramstage-y += vbnv_cmos.c
+endif
diff --git a/src/soc/amd/common/vboot/vbnv_cmos.c b/src/soc/amd/common/vboot/vbnv_cmos.c
new file mode 100644
index 0000000000..5baf923939
--- /dev/null
+++ b/src/soc/amd/common/vboot/vbnv_cmos.c
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <security/vboot/vbnv.h>
+#include <pc80/mc146818rtc.h>
+
+int vbnv_cmos_failed(void)
+{
+ /* If CMOS power has failed, the century will be set to 0xff */
+ return cmos_read(RTC_CLK_ALTCENTURY) == 0xff;
+}