From a1e6a9c25a1d897fbb06f634bbee6e7983a95524 Mon Sep 17 00:00:00 2001 From: zbao Date: Thu, 2 Aug 2012 19:02:26 +0800 Subject: RTC: Add a routine to check if the CMOS date is valid If the CMOS is cleared or someone writes some random date/time on purpose, the CMOS date register has a invalid date. This will hurts some OS, like Windows 7, which hangs at MS logo forever. When we detect that, we need to write a reasonable date in CMOS. Alexandru Gagniuc: Hmm, it would be interesting to use the date the coreboot image was built and set that as the default date. At least until time travel is invented. Change-Id: Ic1c7a2d60e711265686441c77bdf7891a7efb42e Signed-off-by: Zheng Bao Signed-off-by: zbao Reviewed-on: http://review.coreboot.org/1389 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- src/include/pc80/mc146818rtc.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/include/pc80/mc146818rtc.h') diff --git a/src/include/pc80/mc146818rtc.h b/src/include/pc80/mc146818rtc.h index 9f18ba49e8..a916761222 100644 --- a/src/include/pc80/mc146818rtc.h +++ b/src/include/pc80/mc146818rtc.h @@ -87,6 +87,10 @@ #define RTC_CLK_DAYOFMONTH 7 #define RTC_CLK_MONTH 8 #define RTC_CLK_YEAR 9 +#define RTC_CLK_ALTCENTURY 0x32 + +#define RTC_HAS_ALTCENTURY 1 +#define RTC_HAS_NO_ALTCENTURY 0 /* On PCs, the checksum is built only over bytes 16..45 */ #define PC_CKS_RANGE_START 16 @@ -136,6 +140,7 @@ static inline void cmos_write32(u8 offset, u32 value) #if !defined(__ROMCC__) void rtc_init(int invalid); +void rtc_check_update_cmos_date(u8 has_century); #if CONFIG_USE_OPTION_TABLE int set_option(const char *name, void *val); int get_option(void *dest, const char *name); -- cgit v1.2.3