diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2020-09-19 10:30:14 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-09-22 06:22:32 +0000 |
commit | d945d6dfec09880be4aa2a8f67f3577fc9f344d4 (patch) | |
tree | 5d9b3b92b22bccc5a55e33cb07d5c0a62f78a325 /common/host_event_commands.c | |
parent | aa66f469cf4be213014d3e16440861e08ee57bca (diff) | |
download | chrome-ec-d945d6dfec09880be4aa2a8f67f3577fc9f344d4.tar.gz |
host_event_commands: Return access denied for prohibited access
Currently, EC_CMD_HOST_EVENT returns the same error code for
non-existing masks and prohibited access to the existing masks.
This patch makes the command return ACCESS_DENIED for the latter case
so that the host can distinguish the two cases.
ToT BIOS won't be affected because the EC's return codes are collapsed
to -1 or -(request size).
$ ectool hostevent set 1 0
Set isn't permitted for mask 1.
BUG=b:168939843
BRANCH=None
TEST=Verified on Atlas. See above.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: Ia346dbffd459985d5eea8a955e22822d402d5388
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2422805
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'common/host_event_commands.c')
-rw-r--r-- | common/host_event_commands.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/common/host_event_commands.c b/common/host_event_commands.c index 9fe5d339df..e8619c6a62 100644 --- a/common/host_event_commands.c +++ b/common/host_event_commands.c @@ -639,6 +639,9 @@ static enum ec_status host_event_action_get(struct host_cmd_handler_args *args) memset(r, 0, sizeof(*r)); switch (p->mask_type) { + case EC_HOST_EVENT_MAIN: + result = EC_RES_ACCESS_DENIED; + break; case EC_HOST_EVENT_B: r->value = events_copy_b; break; @@ -683,6 +686,10 @@ static enum ec_status host_event_action_set(struct host_cmd_handler_args *args) host_event_t mask_value __unused = (host_event_t)(p->value); switch (p->mask_type) { + case EC_HOST_EVENT_MAIN: + case EC_HOST_EVENT_B: + result = EC_RES_ACCESS_DENIED; + break; #ifdef CONFIG_HOSTCMD_X86 case EC_HOST_EVENT_SCI_MASK: lpc_set_host_event_mask(LPC_HOST_EVENT_SCI, mask_value); @@ -732,6 +739,19 @@ host_event_action_clear(struct host_cmd_handler_args *args) case EC_HOST_EVENT_B: host_clear_events_b(mask_value); break; +#ifdef CONFIG_HOSTCMD_X86 + case EC_HOST_EVENT_SCI_MASK: + case EC_HOST_EVENT_SMI_MASK: + case EC_HOST_EVENT_ALWAYS_REPORT_MASK: + case EC_HOST_EVENT_ACTIVE_WAKE_MASK: +#ifdef CONFIG_POWER_S0IX + case EC_HOST_EVENT_LAZY_WAKE_MASK_S0IX: +#endif + case EC_HOST_EVENT_LAZY_WAKE_MASK_S3: + case EC_HOST_EVENT_LAZY_WAKE_MASK_S5: + result = EC_RES_ACCESS_DENIED; + break; +#endif default: result = EC_RES_INVALID_PARAM; } |