Frans Hendriks has uploaded this change for review. ( https://review.coreboot.org/29329
Change subject: src/drivers/pc80/rtc/mc146818rtc.c: Reset RTC time on RTC power failure ......................................................................
src/drivers/pc80/rtc/mc146818rtc.c: Reset RTC time on RTC power failure
RTC time contains invalid values on system without RTC battery Add config to enable reset of RTC time when RTC power failure has been detected.
BUG=N/A TEST=Portwell PQ-M107
Change-Id: I5eae57d00f328400a8b03c28b7ecdbbc71522206 Signed-off-by: Frans Hendriks fhendriks@eltan.com --- M src/drivers/pc80/rtc/Kconfig M src/drivers/pc80/rtc/mc146818rtc.c 2 files changed, 13 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/29/29329/1
diff --git a/src/drivers/pc80/rtc/Kconfig b/src/drivers/pc80/rtc/Kconfig index 350863e..fd4675a4 100644 --- a/src/drivers/pc80/rtc/Kconfig +++ b/src/drivers/pc80/rtc/Kconfig @@ -2,3 +2,8 @@ bool default y if ARCH_X86 depends on PC80_SYSTEM + +config RESET_TIME_ON_RTC_POWERFAIL + bool + default n + depends on PC80_SYSTEM diff --git a/src/drivers/pc80/rtc/mc146818rtc.c b/src/drivers/pc80/rtc/mc146818rtc.c index 3b22a46..81d10cd 100644 --- a/src/drivers/pc80/rtc/mc146818rtc.c +++ b/src/drivers/pc80/rtc/mc146818rtc.c @@ -3,6 +3,7 @@ * * Copyright 2014 The Chromium OS Authors. All rights reserved. * Copyright (C) 2015 Timothy Pearson tpearson@raptorengineeringinc.com, Raptor Engineering + * Copyright (C) 2018 Eltan B.V. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -122,6 +123,13 @@ x = cmos_read(RTC_VALID); cmos_invalid = !(x & RTC_VRT);
+#if IS_ENABLED(CONFIG_RESET_TIME_ON_RTC_POWERFAIL) + if (invalid == true) { + cmos_invalid = true; + printk(BIOS_DEBUG, "Force cmos_invalid to true\n"); + } +#endif + if (IS_ENABLED(CONFIG_USE_OPTION_TABLE)) { /* See if there is a CMOS checksum error */ checksum_invalid = !cmos_checksum_valid(PC_CKS_RANGE_START,