diff options
Diffstat (limited to 'common/host_event_commands.c')
-rw-r--r-- | common/host_event_commands.c | 53 |
1 files changed, 44 insertions, 9 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 507d603f7b..0d87fcac38 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -10,6 +10,39 @@ #include "lpc.h" #include "util.h" +uint32_t host_get_events(void) +{ +#ifdef CONFIG_LPC + return lpc_get_host_events(); +#else + uint32_t *mapped_raw_events = + (uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS); + return *mapped_raw_events; +#endif +} + +void host_set_events(uint32_t mask) +{ +#ifdef CONFIG_LPC + lpc_set_host_events(mask); +#else + uint32_t *mapped_raw_events = + (uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS); + *mapped_raw_events |= mask; +#endif +} + +void host_clear_events(uint32_t mask) +{ +#ifdef CONFIG_LPC + lpc_clear_host_events(mask); +#else + uint32_t *mapped_raw_events = + (uint32_t *)host_get_memmap(EC_MEMMAP_HOST_EVENTS); + *mapped_raw_events &= ~mask; +#endif +} + /*****************************************************************************/ /* Console commands */ @@ -23,27 +56,31 @@ static int command_host_event(int argc, char **argv) return EC_ERROR_PARAM2; if (!strcasecmp(argv[1], "set")) - lpc_set_host_events(i); + host_set_events(i); else if (!strcasecmp(argv[1], "clear")) - lpc_clear_host_events(i); + host_clear_events(i); +#ifdef CONFIG_LPC else if (!strcasecmp(argv[1], "smi")) lpc_set_host_event_mask(LPC_HOST_EVENT_SMI, i); else if (!strcasecmp(argv[1], "sci")) lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, i); else if (!strcasecmp(argv[1], "wake")) lpc_set_host_event_mask(LPC_HOST_EVENT_WAKE, i); +#endif else return EC_ERROR_PARAM1; } /* Print current SMI/SCI status */ - ccprintf("Events: 0x%08x\n", lpc_get_host_events()); + ccprintf("Events: 0x%08x\n", host_get_events()); +#ifdef CONFIG_LPC ccprintf("SMI mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_SMI)); ccprintf("SCI mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_SCI)); ccprintf("Wake mask: 0x%08x\n", lpc_get_host_event_mask(LPC_HOST_EVENT_WAKE)); +#endif return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(hostevent, command_host_event, @@ -54,6 +91,8 @@ DECLARE_CONSOLE_COMMAND(hostevent, command_host_event, /*****************************************************************************/ /* Host commands */ +#ifdef CONFIG_LPC + static int host_event_get_smi_mask(uint8_t *data, int *resp_size) { struct ec_response_host_event_mask *r = @@ -66,7 +105,6 @@ static int host_event_get_smi_mask(uint8_t *data, int *resp_size) DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_SMI_MASK, host_event_get_smi_mask); - static int host_event_get_sci_mask(uint8_t *data, int *resp_size) { struct ec_response_host_event_mask *r = @@ -79,7 +117,6 @@ static int host_event_get_sci_mask(uint8_t *data, int *resp_size) DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_SCI_MASK, host_event_get_sci_mask); - static int host_event_get_wake_mask(uint8_t *data, int *resp_size) { struct ec_response_host_event_mask *r = @@ -92,7 +129,6 @@ static int host_event_get_wake_mask(uint8_t *data, int *resp_size) DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_GET_WAKE_MASK, host_event_get_wake_mask); - static int host_event_set_smi_mask(uint8_t *data, int *resp_size) { const struct ec_params_host_event_mask *p = @@ -104,7 +140,6 @@ static int host_event_set_smi_mask(uint8_t *data, int *resp_size) DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_SMI_MASK, host_event_set_smi_mask); - static int host_event_set_sci_mask(uint8_t *data, int *resp_size) { const struct ec_params_host_event_mask *p = @@ -116,7 +151,6 @@ static int host_event_set_sci_mask(uint8_t *data, int *resp_size) DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_SCI_MASK, host_event_set_sci_mask); - static int host_event_set_wake_mask(uint8_t *data, int *resp_size) { const struct ec_params_host_event_mask *p = @@ -128,13 +162,14 @@ static int host_event_set_wake_mask(uint8_t *data, int *resp_size) DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_SET_WAKE_MASK, host_event_set_wake_mask); +#endif /* CONFIG_LPC */ static int host_event_clear(uint8_t *data, int *resp_size) { const struct ec_params_host_event_mask *p = (const struct ec_params_host_event_mask *)data; - lpc_clear_host_events(p->mask); + host_clear_events(p->mask); return EC_RES_SUCCESS; } DECLARE_HOST_COMMAND(EC_CMD_HOST_EVENT_CLEAR, host_event_clear); |