[coreboot-gerrit] New patch to review for coreboot: elog: fix improper assumption for year values

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Nov 12 00:09:54 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12410

-gerrit

commit c7e0e559fc94cfa7d62c5ddcee6e95bb5408e10e
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Fri Nov 6 15:20:23 2015 -0600

    elog: fix improper assumption for year values
    
    The elog format stores the year of the event in bcd format.
    Semi-recently rtc_get() started returning the full year,
    e.g. 2015. However, bin2bcd takes a uint8_t as a parameter.
    Converting a full year (2015 or 0x7df) to a uint8_t results
    in passing bad values (223 or 0xdf) to bin2bcd. In other words
    the input value of bin2bcd needs to be a number between 0 and 99.
    Therefore fix that mistake.
    
    BUG=chrome-os-partner:47388
    BRANCH=None
    TEST=Events show up with correct year in eventlog now.
    
    Change-Id: I9209cb9175c0b4925337e2e5d4fea8316b30022a
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: 95a86013234dc999c988291f636e2db3803cc24a
    Original-Change-Id: I12734bc3a423ba9d739658b8edc402b8d445f22e
    Original-Signed-off-by: Aaron Durbin <adurbin at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/311263
    Original-Reviewed-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/drivers/elog/elog.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 97abf81..71eaad2 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -635,8 +635,7 @@ static void elog_fill_timestamp(struct event_header *event)
 	event->hour = bin2bcd(time.hour);
 	event->day = bin2bcd(time.mday);
 	event->month = bin2bcd(time.mon);
-	event->year = bin2bcd(time.year) & 0xff;
-
+	event->year = bin2bcd(time.year % 100);
 
 	/* Basic sanity check of expected ranges */
 	if (event->month > 0x12 || event->day > 0x31 || event->hour > 0x23 ||



More information about the coreboot-gerrit mailing list