diff options
-rw-r--r-- | src/drivers/elog/gsmi.c | 25 | ||||
-rw-r--r-- | src/include/elog.h | 16 |
2 files changed, 41 insertions, 0 deletions
diff --git a/src/drivers/elog/gsmi.c b/src/drivers/elog/gsmi.c index cd94cf61b6..42bfd0f183 100644 --- a/src/drivers/elog/gsmi.c +++ b/src/drivers/elog/gsmi.c @@ -25,6 +25,8 @@ #define GSMI_CMD_SET_EVENT_LOG 0x08 #define GSMI_CMD_CLEAR_EVENT_LOG 0x09 +#define GSMI_CMD_LOG_S0IX_SUSPEND 0x0a +#define GSMI_CMD_LOG_S0IX_RESUME 0x0b #define GSMI_CMD_HANDSHAKE_TYPE 0xc1 #define GSMI_HANDSHAKE_NONE 0x7f @@ -46,6 +48,16 @@ struct gsmi_clear_eventlog_param { u32 data_type; } __packed; +void __attribute__((weak)) elog_gsmi_cb_platform_log_wake_source(void) +{ + /* Default weak implementation, does nothing. */ +} + +void __attribute__((weak)) elog_gsmi_cb_mainboard_log_wake_source(void) +{ + /* Default weak implementation, does nothing. */ +} + /* Param is usually EBX, ret in EAX */ u32 gsmi_exec(u8 command, u32 *param) { @@ -105,6 +117,19 @@ u32 gsmi_exec(u8 command, u32 *param) ret = GSMI_RET_SUCCESS; break; + case GSMI_CMD_LOG_S0IX_SUSPEND: + case GSMI_CMD_LOG_S0IX_RESUME: + ret = GSMI_RET_SUCCESS; + + if (command == GSMI_CMD_LOG_S0IX_SUSPEND) + elog_add_event(ELOG_TYPE_S0IX_ENTER); + else { + elog_add_event(ELOG_TYPE_S0IX_EXIT); + elog_gsmi_cb_platform_log_wake_source(); + elog_gsmi_cb_mainboard_log_wake_source(); + } + break; + default: printk(BIOS_DEBUG, "GSMI Unknown: 0x%02x\n", command); break; diff --git a/src/include/elog.h b/src/include/elog.h index bab7eb0594..0f6a811bbd 100644 --- a/src/include/elog.h +++ b/src/include/elog.h @@ -215,6 +215,10 @@ struct elog_event_mem_cache_update { #define ELOG_EC_DEVICE_EVENT_DSP 0x02 #define ELOG_EC_DEVICE_EVENT_WIFI 0x03 +/* S0ix sleep/wake */ +#define ELOG_TYPE_S0IX_ENTER 0xaf +#define ELOG_TYPE_S0IX_EXIT 0xb0 + #if IS_ENABLED(CONFIG_ELOG) /* Eventlog backing storage must be initialized before calling elog_init(). */ extern int elog_init(void); @@ -249,4 +253,16 @@ extern u32 gsmi_exec(u8 command, u32 *param); u32 boot_count_read(void); u32 boot_count_increment(void); +/* + * Callback from GSMI handler to allow platform to log any wake source + * information. + */ +void elog_gsmi_cb_platform_log_wake_source(void); + +/* + * Callback from GSMI handler to allow mainboard to log any wake source + * information. + */ +void elog_gsmi_cb_mainboard_log_wake_source(void); + #endif /* ELOG_H_ */ |