diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | include/ec_commands.h | 14 | ||||
-rw-r--r-- | include/host_command.h | 31 | ||||
-rw-r--r-- | include/lpc.h | 11 | ||||
-rw-r--r-- | include/util.h | 1 |
5 files changed, 36 insertions, 25 deletions
diff --git a/include/config.h b/include/config.h index 083f81258d..dba87924db 100644 --- a/include/config.h +++ b/include/config.h @@ -1436,6 +1436,10 @@ /* clear bit(s) to mask reporting of an EC_HOST_EVENT_XXX event(s) */ #define CONFIG_HOST_EVENT_REPORT_MASK 0xffffffff +#define CONFIG_HOST_EVENT64_REPORT_MASK 0xffffffffffffffffULL + +/* Config option to support 64-bit hostevents and wake-masks. */ +#define CONFIG_HOST_EVENT64 /* * The host commands are sorted in the .rodata.hcmds section so use the binary diff --git a/include/ec_commands.h b/include/ec_commands.h index 09ebc75319..fb39644e19 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -83,8 +83,7 @@ /* Unused 0x28 - 0x2f */ #define EC_MEMMAP_SWITCHES 0x30 /* 8 bits */ /* Unused 0x31 - 0x33 */ -#define EC_MEMMAP_HOST_EVENTS 0x34 /* 32 bits */ -/* Reserve 0x38 - 0x3f for additional host event-related stuff */ +#define EC_MEMMAP_HOST_EVENTS 0x34 /* 64 bits */ /* Battery values are all 32 bits */ #define EC_MEMMAP_BATT_VOLT 0x40 /* Battery Present Voltage */ #define EC_MEMMAP_BATT_RATE 0x44 /* Battery Present Rate */ @@ -595,7 +594,7 @@ enum host_event_code { EC_HOST_EVENT_INVALID = 32 }; /* Host event mask */ -#define EC_HOST_EVENT_MASK(event_code) (1UL << ((event_code) - 1)) +#define EC_HOST_EVENT_MASK(event_code) (1ULL << ((event_code) - 1)) /* Arguments at EC_LPC_ADDR_HOST_ARGS */ struct __ec_align4 ec_lpc_host_args { @@ -1112,6 +1111,8 @@ enum ec_feature_code { EC_FEATURE_DEVICE_EVENT = 31, /* EC supports the unified wake masks for LPC/eSPI systems */ EC_FEATURE_UNIFIED_WAKE_MASKS = 32, + /* EC supports 64-bit host events */ + EC_FEATURE_HOST_EVENT64 = 33, }; #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) @@ -3016,6 +3017,12 @@ enum ec_mkbp_event { */ EC_MKBP_EVENT_SYSRQ = 6, + /* + * New 64-bit host event. + * The event data is 8 bytes of host event flags. + */ + EC_MKBP_EVENT_HOST_EVENT64 = 7, + /* Number of MKBP events */ EC_MKBP_EVENT_COUNT, }; @@ -3025,6 +3032,7 @@ union __ec_align_offset1 ec_response_get_next_data { /* Unaligned */ uint32_t host_event; + uint64_t host_event64; struct __ec_todo_unpacked { /* For aligning the fifo_info */ 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 /** diff --git a/include/lpc.h b/include/lpc.h index 7b9a7d7012..c95999a98e 100644 --- a/include/lpc.h +++ b/include/lpc.h @@ -9,6 +9,7 @@ #define __CROS_EC_LPC_H #include "common.h" +#include "host_command.h" /** * Return a pointer to the memory-mapped buffer. @@ -78,14 +79,14 @@ enum lpc_host_event_type { /** * Get current state of host events. */ -uint32_t lpc_get_host_events(void); +host_event_t lpc_get_host_events(void); /** * Get host events that are set based on the type provided. * * @param type Event type */ -uint32_t lpc_get_host_events_by_type(enum lpc_host_event_type type); +host_event_t lpc_get_host_events_by_type(enum lpc_host_event_type type); /** * Set the event mask for the specified event type. @@ -93,14 +94,14 @@ uint32_t lpc_get_host_events_by_type(enum lpc_host_event_type type); * @param type Event type * @param mask New event mask */ -void lpc_set_host_event_mask(enum lpc_host_event_type type, uint32_t mask); +void lpc_set_host_event_mask(enum lpc_host_event_type type, host_event_t mask); /** * Get host event mask based on the type provided. * * @param type Event type */ -uint32_t lpc_get_host_event_mask(enum lpc_host_event_type type); +host_event_t lpc_get_host_event_mask(enum lpc_host_event_type type); /** * Clear and return the lowest host event. @@ -147,7 +148,7 @@ void lpc_update_host_event_status(void); * LPC_HOST_EVENT_ALWAYS_REPORT mask. It can be implemented by boards if there * is a need to use custom mask. */ -uint32_t lpc_override_always_report_mask(void); +host_event_t lpc_override_always_report_mask(void); /* Initialize LPC masks. */ void lpc_init_mask(void); diff --git a/include/util.h b/include/util.h index bf3405728a..453ff8c739 100644 --- a/include/util.h +++ b/include/util.h @@ -77,6 +77,7 @@ int strncmp(const char *s1, const char *s2, size_t n); /* Like strtol(), but for integers. */ int strtoi(const char *nptr, char **endptr, int base); +uint64_t strtoul(const char *nptr, char **endptr, int base); /* Like strncpy(), but guarantees null termination. */ char *strzcpy(char *dest, const char *src, int len); |