From 6e5f22eb1c34fd70a58f8e016189689a843e4fb8 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Wed, 22 Apr 2015 13:28:21 +0200 Subject: elog: use CONFIG_RTC When RTC is not selected, return all 0. Change-Id: I892a9489fc1d82fb8e61cf02666f797dc6412e05 Signed-off-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/9955 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/drivers/elog/elog.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c index de18d5d82f..d7751c2012 100644 --- a/src/drivers/elog/elog.c +++ b/src/drivers/elog/elog.c @@ -649,6 +649,7 @@ int elog_init(void) */ static void elog_fill_timestamp(struct event_header *event) { +#if IS_ENABLED(CONFIG_RTC) struct rtc_time time; rtc_get(&time); @@ -659,9 +660,12 @@ static void elog_fill_timestamp(struct event_header *event) event->month = bin2bcd(time.mon); event->year = bin2bcd(time.year) & 0xff; + /* Basic sanity check of expected ranges */ if (event->month > 0x12 || event->day > 0x31 || event->hour > 0x23 || - event->minute > 0x59 || event->second > 0x59) { + event->minute > 0x59 || event->second > 0x59) +#endif + { event->year = 0; event->month = 0; event->day = 0; -- cgit v1.2.3