diff options
author | Furquan Shaikh <furquan@chromium.org> | 2017-10-13 10:59:51 -0700 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2017-10-18 00:38:35 +0000 |
commit | e01bf6452fb215a4598fb0edcdbf6e532ee6505f (patch) | |
tree | 89e07316c8cd89a5aebd70913bf35cc0bb18acee /src | |
parent | 530c6f9cc8dd2c0cd0c586d3d14f11cb8021242f (diff) |
google/chromeec: Add new helper function to read MKBP events
This change adds a new helper function google_chromeec_get_mkbp_event
that allows coreboot to query EC for the next available MKBP event.
Change-Id: Ia6d64586ca62378d08025c96c2689c00c816041f
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/22007
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/ec/google/chromeec/ec.c | 15 | ||||
-rw-r--r-- | src/ec/google/chromeec/ec.h | 6 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 639719a85d..113de0ca2c 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -160,6 +160,21 @@ int google_chromeec_clear_events_b(u32 mask) EC_CMD_HOST_EVENT_CLEAR_B, mask); } +int google_chromeec_get_mkbp_event(struct ec_response_get_next_event *event) +{ + struct chromeec_command cmd; + + cmd.cmd_code = EC_CMD_GET_NEXT_EVENT; + cmd.cmd_version = 0; + cmd.cmd_data_in = NULL; + cmd.cmd_size_in = 0; + cmd.cmd_data_out = event; + cmd.cmd_size_out = sizeof(*event); + cmd.cmd_dev_index = 0; + + return google_chromeec_command(&cmd); +} + /* Get the current device event mask */ uint32_t google_chromeec_get_device_enabled_events(void) { diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 95d744358c..45d9b03df1 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -126,4 +126,10 @@ struct google_chromeec_event_info { void google_chromeec_events_init(const struct google_chromeec_event_info *info, bool is_s3_wakeup); +/* + * Get next available MKBP event in ec_response_get_next_event. Returns 0 on + * success, < 0 otherwise. + */ +int google_chromeec_get_mkbp_event(struct ec_response_get_next_event *event); + #endif /* _EC_GOOGLE_CHROMEEC_EC_H */ |