drivers/elog/elog.c: Create extended event

For debug reasons, sometimes you not only want to log an event, but also
some extra information that would help debugging. Create an extended event
reporting event type with a dword complement, and define extended events
for failing to enter S3 due to pending wake event (one for pm1 and one for
gpe0).

BUG=b:111100312
TEST=Add a fake pending wake event, build and boot grunt, see the event in
eventlog.txt.

Change-Id: I3e8df0953db09197d6d8145b0fc1e583379deaa5
Signed-off-by: Richard Spiegel <richard.spiegel@silverbackltd.com>
Reviewed-on: https://review.coreboot.org/28246
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Martin Roth <martinroth@google.com>
This commit is contained in:
Richard Spiegel 2018-08-20 13:51:30 -07:00 committed by Martin Roth
parent a07366c9f9
commit e6809907e7
2 changed files with 28 additions and 1 deletions

View File

@ -933,6 +933,17 @@ int elog_add_event_wake(u8 source, u32 instance)
return elog_add_event_raw(ELOG_TYPE_WAKE_SOURCE, &wake, sizeof(wake));
}
int elog_add_extended_event(u8 type, u32 complement)
{
struct elog_event_extended_event event = {
.event_type = type,
.event_complement = complement
};
return elog_add_event_raw(ELOG_TYPE_EXTENDED_EVENT,
&event,
sizeof(event));
}
/* Make sure elog_init() runs at least once to log System Boot event. */
static void elog_bs_init(void *unused) { elog_init(); }
BOOT_STATE_INIT_ENTRY(BS_POST_DEVICE, BS_ON_ENTRY, elog_bs_init, NULL);

View File

@ -115,7 +115,11 @@
/* Sleep/Wake */
#define ELOG_TYPE_ACPI_ENTER 0x9d
/* Deep Sx wake variant is provided below - 0xad */
/*
* Deep Sx wake variant is provided below - 0xad
* Sleep/"wake pending" event log provided below - 0xb1 - 0x01/0x02
*/
#define ELOG_TYPE_ACPI_WAKE 0x9e
#define ELOG_TYPE_WAKE_SOURCE 0x9f
#define ELOG_WAKE_SOURCE_PCIE 0x00
@ -219,6 +223,16 @@ struct elog_event_mem_cache_update {
#define ELOG_TYPE_S0IX_ENTER 0xaf
#define ELOG_TYPE_S0IX_EXIT 0xb0
/* Extended events */
#define ELOG_TYPE_EXTENDED_EVENT 0xb1
#define ELOG_SLEEP_PENDING_PM1_WAKE 0x01
#define ELOG_SLEEP_PENDING_GPE0_WAKE 0x02
struct elog_event_extended_event {
u8 event_type;
u32 event_complement;
} __packed;
#if IS_ENABLED(CONFIG_ELOG)
/* Eventlog backing storage must be initialized before calling elog_init(). */
extern int elog_init(void);
@ -231,6 +245,7 @@ extern int elog_add_event_word(u8 event_type, u16 data);
extern int elog_add_event_dword(u8 event_type, u32 data);
extern int elog_add_event_wake(u8 source, u32 instance);
extern int elog_smbios_write_type15(unsigned long *current, int handle);
extern int elog_add_extended_event(u8 type, u32 complement);
#else
/* Stubs to help avoid littering sources with #if CONFIG_ELOG */
static inline int elog_init(void) { return -1; }
@ -246,6 +261,7 @@ static inline int elog_smbios_write_type15(unsigned long *current,
int handle) {
return 0;
}
static inline int elog_add_extended_event(u8 type, u32 complement) { return 0; }
#endif
extern u32 gsmi_exec(u8 command, u32 *param);