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>
This commit is contained in:
parent
0770f25899
commit
6e5f22eb1c
|
@ -649,6 +649,7 @@ int elog_init(void)
|
||||||
*/
|
*/
|
||||||
static void elog_fill_timestamp(struct event_header *event)
|
static void elog_fill_timestamp(struct event_header *event)
|
||||||
{
|
{
|
||||||
|
#if IS_ENABLED(CONFIG_RTC)
|
||||||
struct rtc_time time;
|
struct rtc_time time;
|
||||||
|
|
||||||
rtc_get(&time);
|
rtc_get(&time);
|
||||||
|
@ -659,9 +660,12 @@ static void elog_fill_timestamp(struct event_header *event)
|
||||||
event->month = bin2bcd(time.mon);
|
event->month = bin2bcd(time.mon);
|
||||||
event->year = bin2bcd(time.year) & 0xff;
|
event->year = bin2bcd(time.year) & 0xff;
|
||||||
|
|
||||||
|
|
||||||
/* Basic sanity check of expected ranges */
|
/* Basic sanity check of expected ranges */
|
||||||
if (event->month > 0x12 || event->day > 0x31 || event->hour > 0x23 ||
|
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->year = 0;
|
||||||
event->month = 0;
|
event->month = 0;
|
||||||
event->day = 0;
|
event->day = 0;
|
||||||
|
|
Loading…
Reference in New Issue