diff options
author | Ricardo Quesada <ricardoq@google.com> | 2021-07-16 16:49:04 -0700 |
---|---|---|
committer | Paul Fagerburg <pfagerburg@chromium.org> | 2021-08-05 22:00:35 +0000 |
commit | c2cf3946c95cca7a84b87725b453fdf2b8932ffd (patch) | |
tree | 0600ce9b494b28bafcb56d8ffc171443e7c648f3 /src/commonlib/bsd/include | |
parent | cb4bb393b52d8feb0979afd972c2fb0c6e41d9eb (diff) |
util/elogtool: add tool to print elog events
Add a new tool that that prints elog events.
The tool, as input, accepts either a file with the RW_ELOG contents, or
if the file is not provided it reads the contents of RW_ELOG by calling
the "flashrom" tool.
The tool is based on "mosys eventlog list"[1]. For the moment it only
supports "list", but future commits will add additional functionality.
This commit also adds missing ELOG defines needed for the tool. These
defines are added with the rest of the ELOG defines, in
include/commonlib/bsd/elog.h
The tool is placed inside util/cbfstool. The rationale behind the
decision, is that this tool shares a lot in common with the other tools
located in cbfstool: vboot dependency, shared files like common.o and
valstr.o, and in spirit is similar to some of the tools located in
cbfstool/.
As an example, you call the tool like the following:
$ elogtool list -f rw_elog_dump.bin
[1]: https://chromium.googlesource.com/chromiumos/platform/mosys/+/refs/heads/main/lib/eventlog/elog.c
BUG=b:172210863
Signed-off-by: Ricardo Quesada <ricardoq@google.com>
Change-Id: Ia1fe1c9ed3c4c6bda846055d4b10943b54463935
Reviewed-on: https://review.coreboot.org/c/coreboot/+/56406
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'src/commonlib/bsd/include')
-rw-r--r-- | src/commonlib/bsd/include/commonlib/bsd/elog.h | 77 |
1 files changed, 75 insertions, 2 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/elog.h b/src/commonlib/bsd/include/commonlib/bsd/elog.h index 3a6830c46d..0d41157758 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/elog.h +++ b/src/commonlib/bsd/include/commonlib/bsd/elog.h @@ -71,12 +71,57 @@ struct event_header { /* OS/kernel events */ #define ELOG_TYPE_OS_EVENT 0x81 +#define ELOG_OS_EVENT_CLEAN 0 /* Clean Shutdown */ +#define ELOG_OS_EVENT_NMIWDT 1 /* NMI Watchdog */ +#define ELOG_OS_EVENT_PANIC 2 /* Panic */ +#define ELOG_OS_EVENT_OOPS 3 /* Oops */ +#define ELOG_OS_EVENT_DIE 4 /* Die */ +#define ELOG_OS_EVENT_MCE 5 /* MCE */ +#define ELOG_OS_EVENT_SOFTWDT 6 /* Software Watchdog */ +#define ELOG_OS_EVENT_MBE 7 /* MBE */ +#define ELOG_OS_EVENT_TRIPLE 8 /* Triple Fault */ +#define ELOG_OS_EVENT_THERMAL 9 /* Critical Thermal Threshold */ /* Last event from coreboot */ #define ELOG_TYPE_OS_BOOT 0x90 /* Embedded controller event */ #define ELOG_TYPE_EC_EVENT 0x91 +#define EC_EVENT_LID_CLOSED 0x01 +#define EC_EVENT_LID_OPEN 0x02 +#define EC_EVENT_POWER_BUTTON 0x03 +#define EC_EVENT_AC_CONNECTED 0x04 +#define EC_EVENT_AC_DISCONNECTED 0x05 +#define EC_EVENT_BATTERY_LOW 0x06 +#define EC_EVENT_BATTERY_CRITICAL 0x07 +#define EC_EVENT_BATTERY 0x08 +#define EC_EVENT_THERMAL_THRESHOLD 0x09 +#define EC_EVENT_DEVICE_EVENT 0x0a +#define EC_EVENT_THERMAL 0x0b +#define EC_EVENT_USB_CHARGER 0x0c +#define EC_EVENT_KEY_PRESSED 0x0d +#define EC_EVENT_INTERFACE_READY 0x0e +#define EC_EVENT_KEYBOARD_RECOVERY 0x0f +#define EC_EVENT_THERMAL_SHUTDOWN 0x10 +#define EC_EVENT_BATTERY_SHUTDOWN 0x11 +#define EC_EVENT_THROTTLE_START 0x12 +#define EC_EVENT_THROTTLE_STOP 0x13 +#define EC_EVENT_HANG_DETECT 0x14 +#define EC_EVENT_HANG_REBOOT 0x15 +#define EC_EVENT_PD_MCU 0x16 +#define EC_EVENT_BATTERY_STATUS 0x17 +#define EC_EVENT_PANIC 0x18 +#define EC_EVENT_KEYBOARD_FASTBOOT 0x19 +#define EC_EVENT_RTC 0x1a +#define EC_EVENT_MKBP 0x1b +#define EC_EVENT_USB_MUX 0x1c +#define EC_EVENT_MODE_CHANGE 0x1d +#define EC_EVENT_KEYBOARD_RECOVERY_HWREINIT 0x1e +#define EC_EVENT_EXTENDED 0x1f +struct elog_ec_event { + uint8_t event; + uint8_t checksum; +} __packed; /* Power */ #define ELOG_TYPE_POWER_FAIL 0x92 @@ -163,8 +208,22 @@ struct elog_event_data_wake { #define ELOG_CROS_RECOVERY_MODE_BUTTON 0x02 /* Management Engine Events */ -#define ELOG_TYPE_MANAGEMENT_ENGINE 0xa2 -#define ELOG_TYPE_MANAGEMENT_ENGINE_EXT 0xa4 +#define ELOG_TYPE_MANAGEMENT_ENGINE 0xa2 +#define ELOG_ME_PATH_NORMAL 0x00 +#define ELOG_ME_PATH_S3WAKE 0x01 +#define ELOG_ME_PATH_ERROR 0x02 +#define ELOG_ME_PATH_RECOVERY 0x03 +#define ELOG_ME_PATH_DISABLED 0x04 +#define ELOG_ME_PATH_FW_UPDATE 0x05 + +#define ELOG_TYPE_MANAGEMENT_ENGINE_EXT 0xa4 +#define ELOG_ME_PHASE_ROM 0 +#define ELOG_ME_PHASE_BRINGUP 1 +#define ELOG_ME_PHASE_UKERNEL 2 +#define ELOG_ME_PHASE_POLICY 3 +#define ELOG_ME_PHASE_MODULE 4 +#define ELOG_ME_PHASE_UNKNOWN 5 +#define ELOG_ME_PHASE_HOST 6 struct elog_event_data_me_extended { uint8_t current_working_state; uint8_t operation_state; @@ -178,6 +237,18 @@ struct elog_event_data_me_extended { /* Last post code from previous boot */ #define ELOG_TYPE_LAST_POST_CODE 0xa3 #define ELOG_TYPE_POST_EXTRA 0xa6 +#define ELOG_TYPE_POST_EXTRA_PATH 0x01 +#define ELOG_DEV_PATH_TYPE_NONE 0 +#define ELOG_DEV_PATH_TYPE_ROOT 1 +#define ELOG_DEV_PATH_TYPE_PCI 2 +#define ELOG_DEV_PATH_TYPE_PNP 3 +#define ELOG_DEV_PATH_TYPE_I2C 4 +#define ELOG_DEV_PATH_TYPE_APIC 5 +#define ELOG_DEV_PATH_TYPE_DOMAIN 6 +#define ELOG_DEV_PATH_TYPE_CPU_CLUSTER 7 +#define ELOG_DEV_PATH_TYPE_CPU 8 +#define ELOG_DEV_PATH_TYPE_CPU_BUS 9 +#define ELOG_DEV_PATH_TYPE_IOAPIC 10 /* EC Shutdown Reason */ #define ELOG_TYPE_EC_SHUTDOWN 0xa5 @@ -240,5 +311,7 @@ struct elog_event_extended_event { enum cb_err elog_verify_header(const struct elog_header *header); +const struct event_header *elog_get_next_event(const struct event_header *event); +const void *event_get_data(const struct event_header *event); #endif /* _COMMONLIB_BSD_ELOG_H_ */ |