diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-07-03 15:55:09 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-07-07 17:36:46 -0700 |
commit | e129d5f1fa1a686c6f06aecbcc28e27cc8334483 (patch) | |
tree | 7e7d22a5824f29a023da6e5ef6800dbc415d3471 /common/host_event_commands.c | |
parent | 7f5f7be3e5df92ec2e9447b3d5d0b8ddeb96c9a0 (diff) | |
download | chrome-ec-e129d5f1fa1a686c6f06aecbcc28e27cc8334483.tar.gz |
Support host event get/set/clear on all host interfaces
BUG=chrome-os-partner:11090
TEST=suspend laptop, then press power button; should resume from suspend
Change-Id: I36b7c62b2e115bb97d37defcd3c783af0f91d5f8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26730
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); |