diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2017-02-18 10:38:28 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-03-02 11:29:07 -0800 |
commit | 899fba96494e022f8e083611c328e7b57cf18079 (patch) | |
tree | 12cb7e0a6ade6f96bb5c8cc9c82917eb4716bb81 /common/host_command.c | |
parent | a990e4e832010c6967eb0243de8ba7ce9c3a7825 (diff) | |
download | chrome-ec-899fba96494e022f8e083611c328e7b57cf18079.tar.gz |
switch: Initialize switch state earlier during HOOK_INIT
The host may ask for our switch state at any time, so do initialization
immediately after lid + power button are initialized.
BUG=chrome-os-partner:63073
BRANCH=gru
TEST=On kevin, verify system boots when EC reset is triggered with lid
open. Verify lid close and power button press still succeed to
power-down from dev screen.
Change-Id: I8e37c02ef4f4d2d7c06beb383cdbda8eea67bc5c
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/444322
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 106d33cd3a8e4f3356950a3b2b92ea587977b4e7)
Reviewed-on: https://chromium-review.googlesource.com/445276
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'common/host_command.c')
-rw-r--r-- | common/host_command.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/host_command.c b/common/host_command.c index 57cfe506c9..7ff327c726 100644 --- a/common/host_command.c +++ b/common/host_command.c @@ -518,6 +518,11 @@ static int host_command_read_memmap(struct host_cmd_handler_args *args) offset + size > EC_MEMMAP_SIZE) return EC_RES_INVALID_PARAM; + /* Make sure switch data is initialized */ + if (offset == EC_MEMMAP_SWITCHES && + *host_get_memmap(EC_MEMMAP_SWITCHES_VERSION) == 0) + return EC_RES_UNAVAILABLE; + memcpy(args->response, host_get_memmap(offset), size); args->response_size = size; |