diff options
author | Patrick Georgi <pgeorgi@chromium.org> | 2015-04-22 13:28:21 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-22 16:18:19 +0200 |
commit | 6e5f22eb1c34fd70a58f8e016189689a843e4fb8 (patch) | |
tree | 4f341e4820f2418b918f1a17641be5766e7281ad /src/drivers/elog | |
parent | 0770f258991ab84d893d6514e785cfc16aa3582d (diff) | |
download | coreboot-6e5f22eb1c34fd70a58f8e016189689a843e4fb8.tar.xz |
elog: use CONFIG_RTC
When RTC is not selected, return all 0.
Change-Id: I892a9489fc1d82fb8e61cf02666f797dc6412e05
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/9955
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/elog')
-rw-r--r-- | src/drivers/elog/elog.c | 6 |
1 files changed, 5 insertions, 1 deletions
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; |