ELOG: Add support for SMM and kernel GSMI driver

The linux kernel contains an SMI driver that was written by
me (Duncan) and upstreamed a couple years ago called GSMI.
This driver will format a parameter buffer and pass pointers
to this parameter buffer to the SMI handler.  It uses this to
generate events for kernel shutdown reasons:  Clean, Panic, Oops,
etc.

This function expects to be passed pointers into the SMM state
save area that correspond to the prameter buffer and the return
code, which are typically EAX and EBX.

The format of the parameter buffer is defined in the kernel
driver so we implement the same interface here in order to be
compatible.

GSMI_CMD_HANDSHAKE: this is an early call that it does to try
and detect what kind of BIOS is running.

GSMI_CMD_SET_EVENT_LOG: this contains a parameter buffer that
has event type and data.  The kernel-specific events are
translated here and raw events are passed through as well which
allows any run-time event to be added for testing.

GSMI_CMD_CLEAR_EVENT_LOG: this command clears the event log.

First the gsmi driver must be enabled in the kernel with
CONFIG_GOOGLE_GSMI and then events can be added via sysfs
and events are automatically generated for various kernel
shutdown reasons.

These can be seen in the event log as the 'Kernel Event' type:

169 | 2012-06-23 15:03:04 | Kernl Event | Clean Shutdown
181 | 2012-06-23 16:26:32 | Kernl Event | Oops
181 | 2012-06-23 16:26:32 | Kernl Event | Panic

Change-Id: Ic0a3916401f0d9811e4aa8b2c560657dccc920c1
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: http://review.coreboot.org/1316
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Duncan Laurie
2012-06-23 16:48:38 -07:00
committed by Ronald G. Minnich
parent 62f1ad98c4
commit 79bbbd9db3
4 changed files with 132 additions and 0 deletions

View File

@@ -68,6 +68,15 @@ config ELOG_SHRINK_SIZE
endif
config ELOG_GSMI
depends on ELOG && SPI_FLASH_SMM && SMM_TSEG
bool "SMI interface to write and clear event log"
default n
help
This interface is compatible with the linux kernel driver
available with CONFIG_GOOGLE_GSMI and can be used to write
kernel reset/shutdown messages to the event log.
config ELOG_BOOT_COUNT
depends on ELOG
bool "Maintain a monotonic boot number in CMOS"