elog: Use the RTC driver interface instead of reading CMOS directly.
Use the RTC driver interface to find the timestamp for events instead of reading the CMOS based RTC directly on x86 or punting on ARM. This makes timestamps available on both architectures, assuming an RTC driver is available. BUG=None TEST=Built and booted on nyan_big and link and verified that the timestamps in the event log were accurate. BRANCH=nyan Original-Change-Id: Id45da53bc7ddfac8dd0978e7f2a3b8bc2c7ea753 Original-Signed-off-by: Gabe Black <gabeblack@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/197798 Original-Reviewed-by: David Hendricks <dhendrix@chromium.org> Original-Tested-by: Gabe Black <gabeblack@chromium.org> Original-Commit-Queue: Gabe Black <gabeblack@chromium.org> (cherry picked from commit 493b05e06dd461532c9366fb09025efb3568a975) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Change-Id: I8481adde86d836b5f0b019c815bada6d232a4186 Reviewed-on: http://review.coreboot.org/7833 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
259e49a2c7
commit
474313d1b6
|
@ -25,6 +25,8 @@
|
||||||
#if CONFIG_ARCH_X86
|
#if CONFIG_ARCH_X86
|
||||||
#include <pc80/mc146818rtc.h>
|
#include <pc80/mc146818rtc.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <bcd.h>
|
||||||
|
#include <rtc.h>
|
||||||
#include <smbios.h>
|
#include <smbios.h>
|
||||||
#include <spi-generic.h>
|
#include <spi-generic.h>
|
||||||
#include <spi_flash.h>
|
#include <spi_flash.h>
|
||||||
|
@ -638,20 +640,15 @@ int elog_init(void)
|
||||||
*/
|
*/
|
||||||
static void elog_fill_timestamp(struct event_header *event)
|
static void elog_fill_timestamp(struct event_header *event)
|
||||||
{
|
{
|
||||||
#if CONFIG_ARCH_X86
|
struct rtc_time time;
|
||||||
event->second = cmos_read(RTC_CLK_SECOND);
|
|
||||||
event->minute = cmos_read(RTC_CLK_MINUTE);
|
rtc_get(&time);
|
||||||
event->hour = cmos_read(RTC_CLK_HOUR);
|
event->second = bin2bcd(time.sec);
|
||||||
event->day = cmos_read(RTC_CLK_DAYOFMONTH);
|
event->minute = bin2bcd(time.min);
|
||||||
event->month = cmos_read(RTC_CLK_MONTH);
|
event->hour = bin2bcd(time.hour);
|
||||||
event->year = cmos_read(RTC_CLK_YEAR);
|
event->day = bin2bcd(time.mday);
|
||||||
#else
|
event->month = bin2bcd(time.mon);
|
||||||
/*
|
event->year = bin2bcd(time.year) & 0xff;
|
||||||
* FIXME: We need to abstract the CMOS stuff on non-x86 platforms.
|
|
||||||
* Until then, use bogus data here to force the values to 0.
|
|
||||||
*/
|
|
||||||
event->month = 0xff;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 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 ||
|
||||||
|
|
Loading…
Reference in New Issue