summaryrefslogtreecommitdiff
path: root/src/ec/google/chromeec/ec.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@chromium.org>2015-12-01 19:14:09 -0800
committerMartin Roth <martinroth@google.com>2016-02-04 17:21:04 +0100
commite2cea4f4582dad7f202a3f6d4fc884b01ec1d52d (patch)
treedf4f4315bc15d4c7ca54b4e712bdce5c16e15774 /src/ec/google/chromeec/ec.c
parenteb31685bbba0b58aea0cd6900ed59eae76c80ad4 (diff)
google/chromeec: Add temporary storage interface
Add support functions for the Chrome EC temporary storage interface. BUG=chrome-os-partner:46049 BRANCH=none TEST=tested on glados with modified coreboot Change-Id: Id2bc46df9cb2d82b15e3309e78d07407a622b6f0 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: a7e6f693666b162e11eb0611715f10a8f465ad88 Original-Change-Id: Ieefabfc5bcb9d8a5064f0da967c46d0f377ca320 Original-Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/315217 Original-Commit-Ready: Aaron Durbin <adurbin@chromium.org> Original-Tested-by: Aaron Durbin <adurbin@chromium.org> Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13572 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/ec/google/chromeec/ec.c')
-rw-r--r--src/ec/google/chromeec/ec.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 5db387009e..87ab13acec 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -121,6 +121,27 @@ int google_chromeec_clear_events_b(u32 mask)
EC_CMD_HOST_EVENT_CLEAR_B, mask);
}
+int google_chromeec_check_feature(int feature)
+{
+ struct chromeec_command cmd;
+ struct ec_response_get_features r;
+
+ cmd.cmd_code = EC_CMD_GET_FEATURES;
+ cmd.cmd_version = 0;
+ cmd.cmd_size_in = 0;
+ cmd.cmd_data_out = &r;
+ cmd.cmd_size_out = sizeof(r);
+ cmd.cmd_dev_index = 0;
+
+ if (google_chromeec_command(&cmd) != 0)
+ return -1;
+
+ if (feature >= 8 * sizeof(r.flags))
+ return -1;
+
+ return r.flags[feature / 32] & EC_FEATURE_MASK_0(feature);
+}
+
#ifndef __SMM__
#ifdef __PRE_RAM__
void google_chromeec_check_ec_image(int expected_type)