summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Van Patten <timvp@google.com>2023-02-08 11:51:18 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-22 22:48:50 +0000
commit0f6fb5265caf5601f4a7569b5d5ff39851dbde2c (patch)
treeb60e4093c63f5451943980d0a2e80af2a7bd9aa2
parent5a411a31d1ef42b88af8d1808eb0bb3e325e8057 (diff)
downloadchrome-ec-0f6fb5265caf5601f4a7569b5d5ff39851dbde2c.tar.gz
Increase supported host events to 64
ectool is hard-coded to support 32 host events even though the EC supports 64 host events. Add an enum value to indicate what the current count of the host events is, so it can used by ectool in place of magic numbers. Also add an assert to enforce the 64 host event limit. BRANCH=none BUG=b:261141172 TEST=Manually build and flash, verify device boots TEST=ectool version Change-Id: If9724cf905a7d2eb42a2ad67c5e1da784ca05e8e Signed-off-by: Tim Van Patten <timvp@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4261961 Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--include/ec_commands.h6
-rw-r--r--util/ectool.cc9
2 files changed, 13 insertions, 2 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h
index 87985175a5..239f21d77e 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -779,7 +779,13 @@ enum host_event_code {
* not initialized on the EC, or improperly configured on the host.
*/
EC_HOST_EVENT_INVALID = 32,
+
+ /*
+ * Only 64 host events are supported. This enum uses 1-based counting so
+ * it can skip 0 (NONE), so the last legal host event number is 64.
+ */
};
+
/* Host event mask */
#define EC_HOST_EVENT_MASK(event_code) BIT_ULL((event_code)-1)
diff --git a/util/ectool.cc b/util/ectool.cc
index 86c4210fba..eac89a89dd 100644
--- a/util/ectool.cc
+++ b/util/ectool.cc
@@ -10874,7 +10874,12 @@ int cmd_wait_event(int argc, char *argv[])
char *e;
BUILD_ASSERT(ARRAY_SIZE(mkbp_event_text) == EC_MKBP_EVENT_COUNT);
- BUILD_ASSERT(ARRAY_SIZE(host_event_text) == 33); /* events start at 1 */
+ /*
+ * Only 64 host events are supported. The enum |host_event_code| uses
+ * 1-based counting so it can skip 0 (NONE). The last legal host event
+ * number is 64, so ARRAY_SIZE(host_event_text) <= 64+1.
+ */
+ BUILD_ASSERT(ARRAY_SIZE(host_event_text) <= 65);
if (!ec_pollevent) {
fprintf(stderr, "Polling for MKBP event not supported\n");
@@ -10922,7 +10927,7 @@ int cmd_wait_event(int argc, char *argv[])
switch (event_type) {
case EC_MKBP_EVENT_HOST_EVENT:
printf("Host events:");
- for (int evt = 1; evt <= 32; evt++) {
+ for (int evt = 1; evt < ARRAY_SIZE(host_event_text); evt++) {
if (buffer.data.host_event & EC_HOST_EVENT_MASK(evt)) {
const char *name = host_event_text[evt];