summaryrefslogtreecommitdiff
path: root/src/soc/amd/common/vboot
diff options
context:
space:
mode:
authorFelix Held <felix-coreboot@felixheld.de>2020-11-14 01:58:47 +0100
committerFelix Held <felix-coreboot@felixheld.de>2020-11-21 19:40:20 +0000
commitea3402213ff4b80bf8ebfb8502e49aa071cf3d74 (patch)
tree993432c5d1f0d59f3324b0ffcee57e87db053152 /src/soc/amd/common/vboot
parent65d9a7ae3116b636f6fa75311a1fb648d944f91b (diff)
soc/amd: factor out vbnv_cmos_failed() into soc/amd/common/vboot
Change-Id: I7f976c6c5a2a715e1a5372bb93fe657d0d86c848 Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47584 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
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;
+}