ELOG: Add support for flash based event log

This is based around the SMBIOS event log specification but
expanded with OEM event types to support more specific and
relevant system events.

It requires flash storage and a minimum 4K block (or flash block
size) that should be allocated in the FMAP.

A copy of the event log is maintained in memory for convenience
and speed and the in-memory copy is written to flash at specific
points.

The log is automatically shunk when it reaches a configurable
full threshold in order to not get stuck with a full log that
needs OS help to clear.

ELOG implements the specification published here:
http://code.google.com/p/firmware-event-log/wiki/FirmwareEventLogDesign

And is similar to what we use in other firmware at Google.
This implementation does not support double-buffered flash
regions.  This is done because speed is valued over the log
reliability and it keeps the code simpler for the first version.

This is a large commit and by itself it just provides a new
driver that is made available to coreboot.  Without additional
patches it is not very useful, but the end result is an event
log that will contain entries like this:

171 | 2012-06-23 16:02:55 | System boot | 285
172 | 2012-06-23 16:02:55 | EC Event | Power Button
173 | 2012-06-23 16:02:55 | SUS Power Fail
174 | 2012-06-23 16:02:55 | System Reset
175 | 2012-06-23 16:02:55 | ACPI Wake | S5

Change-Id: I985524c67f525c8a268eccbd856c1a4c2a426889
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: http://review.coreboot.org/1311
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Duncan Laurie
2012-06-23 16:08:47 -07:00
committed by Ronald G. Minnich
parent d2e00b92ce
commit 7d2b81c18d
7 changed files with 1147 additions and 0 deletions

69
src/drivers/elog/Kconfig Normal file
View File

@@ -0,0 +1,69 @@
##
## This file is part of the coreboot project.
##
## Copyright (C) 2012 The Chromium OS Authors. All rights reserved.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
config ELOG
depends on SPI_FLASH
bool "Support for flash based event log"
default n
help
Enable support for flash based event logging.
if ELOG
config ELOG_DEBUG
bool "Enable debug output for event logging"
default n
config ELOG_FLASH_BASE
hex "Event log offset into flash"
default 0
help
Offset into the flash chip for the ELOG block.
This should be allocated in the FMAP.
config ELOG_AREA_SIZE
hex "Size of Event Log area in flash"
default 0x1000
help
This should be a multiple of flash block size.
Default is 4K.
config ELOG_FULL_THRESHOLD
hex "Threshold at which flash is considered full"
default 0xC00
help
When the Event Log size is larger than this it will be shrunk
to ELOG_SHRINK_SIZE. Must be greater than ELOG_AREA_SIZE, and
ELOG_AREA_SIZE - ELOG_FULL_THRESHOLD must be greater than the
maximum event size of 128.
Default is 75% of the log, or 3K.
config ELOG_SHRINK_SIZE
hex "Resulting size when the event log is shrunk"
default 0x400
help
When the Event Log is shrunk it will go to this size.
ELOG_AREA_SIZE - ELOG_SHRINK_SIZE must be less than
CONFIG_ELOG_FULL_THRESHOLD.
Default is 1K.
endif