summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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];