ELOG: Add support for a monotonic boot counter in CMOS

This maintains a 32bit monotonically increasing boot counter
that is stored in CMOS and logged on every non-S3 boot when
the event log is initialized.

In CMOS the count is prefixed with a 16bit signature and
appended with a 16bit checksum.

This counter is incremented in sandybridge early_init which is
called by romstage.  It is incremented early in order notice
when reboots happen after memory init.

The counter is then logged when ELOG is initialized and will
store the boot count as part of a 'System boot; event.

Reboot a few times and look for 'System boot' events in the
event log and check that they are increasing.  Also verify
that the counter does NOT increase when resuming from S3.

171 | 2012-06-23 16:02:55 | System boot | 285
176 | 2012-06-23 16:26:00 | System boot | 286
182 | 2012-06-23 16:27:04 | System boot | 287
189 | 2012-06-23 16:31:10 | System boot | 288

Change-Id: I23faeafcf155edfd10aa6882598b3883575f8a33
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: http://review.coreboot.org/1315
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Duncan Laurie
2012-06-23 16:37:45 -07:00
committed by Ronald G. Minnich
parent 472ec9cd7e
commit f4d362339f
6 changed files with 161 additions and 0 deletions

View File

@@ -67,3 +67,20 @@ config ELOG_SHRINK_SIZE
Default is 1K.
endif
config ELOG_BOOT_COUNT
depends on ELOG
bool "Maintain a monotonic boot number in CMOS"
default n
help
Store a monotonic boot number in CMOS and provide an interface
to read the current value and increment the counter. This boot
counter will be logged as part of the System Boot event.
config ELOG_BOOT_COUNT_CMOS_OFFSET
depends on ELOG && ELOG_BOOT_COUNT && !USE_OPTION_TABLE
int "Offset in CMOS to store the boot count"
default 0
help
This value must be greater than 16 bytes so as not to interfere
with the standard RTC region. Requires 8 bytes.