summaryrefslogtreecommitdiff
path: root/include/host_command.h
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-11-14 18:51:42 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-11-21 18:53:35 -0800
commitc9cd870600b12123dddc88814446327337557369 (patch)
treee1e24ad901e91e98831b38c1ccd315cb272b9a6a /include/host_command.h
parent0da531fae0099080b7dd472ade0788c18162cc19 (diff)
downloadchrome-ec-c9cd870600b12123dddc88814446327337557369.tar.gz
host_events: Bump up host events and masks to 64-bit
With the upcoming change to add a new command to get/set/clear host events and masks, it seems to be the right time to bump up the host events and masks to 64-bit. We are already out of available host events. This change opens up at least 32 bits for new host events. Old EC commands to operate on host events/masks will still deal with lower 32-bits of the events/mask. On the other hand, the new command being added will take care of the entire 64-bit events/masks. This ensures that old BIOS and kernel versions can still work with the newer EC versions. BUG=b:69329196 BRANCH=None TEST=make -j buildall. Verified: 1. hostevent set 0x4000 ==> Sets correct bit in host events 2. hostevent clear 0x4000 ==> Clears correct bit in host events 3. Kernel is able to query and read correct host event bits from EC. Verified using evtest. 4. Coreboot is able to read correct wake reason from EC. Verified using mosys eventlog list. Change-Id: Idcb24ea364ac6c491efc2f8dd9e29a9df6149e07 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/770925 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/host_command.h')
-rw-r--r--include/host_command.h31
1 files changed, 14 insertions, 17 deletions
diff --git a/include/host_command.h b/include/host_command.h
index 78157231ca..6fdbc639e9 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -122,6 +122,16 @@ struct host_command {
int version_mask;
};
+#ifdef CONFIG_HOST_EVENT64
+typedef uint64_t host_event_t;
+#define HOST_EVENT_CPRINTS(str, e) CPRINTS("%s 0x%016lx", str, e)
+#define HOST_EVENT_CCPRINTF(str, e) ccprintf("%s 0x%016lx\n", str, e)
+#else
+typedef uint32_t host_event_t;
+#define HOST_EVENT_CPRINTS(str, e) CPRINTS("%s 0x%08x", str, e)
+#define HOST_EVENT_CCPRINTF(str, e) ccprintf("%s 0x%08x\n", str, e)
+#endif
+
/**
* Return a pointer to the memory-mapped buffer.
*
@@ -146,21 +156,11 @@ uint16_t host_command_process(struct host_cmd_handler_args *args);
#ifdef CONFIG_HOSTCMD_EVENTS
/**
- * Set one or more host event bits.
- *
- * @param mask Event bits to set (use EC_HOST_EVENT_MASK()).
- */
-void host_set_events(uint32_t mask);
-
-/**
* Set a single host event.
*
* @param event Event to set (EC_HOST_EVENT_*).
*/
-static inline void host_set_single_event(int event)
-{
- host_set_events(EC_HOST_EVENT_MASK(event));
-}
+void host_set_single_event(enum host_event_code event);
/**
* Clear one or more host event bits.
@@ -168,12 +168,12 @@ static inline void host_set_single_event(int event)
* @param mask Event bits to clear (use EC_HOST_EVENT_MASK()).
* Write 1 to a bit to clear it.
*/
-void host_clear_events(uint32_t mask);
+void host_clear_events(host_event_t mask);
/**
* Return the raw event state.
*/
-uint32_t host_get_events(void);
+host_event_t host_get_events(void);
/**
* Check a single host event.
@@ -181,10 +181,7 @@ uint32_t host_get_events(void);
* @param event Event to check
* @return true if <event> is set or false otherwise
*/
-static inline int host_is_event_set(enum host_event_code event)
-{
- return host_get_events() & EC_HOST_EVENT_MASK(event);
-}
+int host_is_event_set(enum host_event_code event);
#endif
/**