diff options
author | Wai-Hong Tam <waihong@google.com> | 2018-11-08 14:28:12 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-15 02:16:28 -0800 |
commit | 38b16336b7d254f52261bb0ba12d6a8d691323ab (patch) | |
tree | 6986956c5e5e4c45e46906990b9eb41dc80051af | |
parent | f02c6f83fae3cdce2933da60a0de44206295489f (diff) | |
download | chrome-ec-38b16336b7d254f52261bb0ba12d6a8d691323ab.tar.gz |
chipset: Add a host command to issue AP reset
The host command is enabled by defining CONFIG_HOSTCMD_AP_RESET.
It calls the chipset_reset() function, similar to the console
command "apreset".
BRANCH=none
BUG=b:119261783
TEST=Manually tested as follow:
Enabled CONFIG_HOSTCMD_AP_RESET on Cheza and flashed EC image.
Copied the compiled ectool to Cheza. Ran "ectool apreset".
Checked EC console:
[6698.093141 chipset_reset(4)]
[6698.093753 power off 5]
...
the power state changing S0 -> S5 -> S0
Change-Id: I09f26f0c7ccd22905979e8b8675185505ad739eb
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1327841
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | common/chipset.c | 13 | ||||
-rw-r--r-- | include/chipset.h | 2 | ||||
-rw-r--r-- | include/config.h | 3 | ||||
-rw-r--r-- | include/ec_commands.h | 3 | ||||
-rw-r--r-- | util/ectool.c | 9 |
5 files changed, 30 insertions, 0 deletions
diff --git a/common/chipset.c b/common/chipset.c index 4342ba5fab..f6481e5de8 100644 --- a/common/chipset.c +++ b/common/chipset.c @@ -45,6 +45,19 @@ DECLARE_CONSOLE_COMMAND(apshutdown, command_apshutdown, #endif +#ifdef CONFIG_HOSTCMD_AP_RESET +static int host_command_apreset(struct host_cmd_handler_args *args) +{ + /* Force the chipset to reset */ + chipset_reset(CHIPSET_RESET_HOST_CMD); + return EC_RES_SUCCESS; +} +DECLARE_HOST_COMMAND(EC_CMD_AP_RESET, + host_command_apreset, + EC_VER_MASK(0)); + +#endif + #ifdef CONFIG_CMD_AP_RESET_LOG static struct mutex reset_log_mutex; static int next_reset_log; diff --git a/include/chipset.h b/include/chipset.h index 7363707b38..772114d356 100644 --- a/include/chipset.h +++ b/include/chipset.h @@ -58,6 +58,8 @@ enum chipset_reset_reason { CHIPSET_RESET_HANG_REBOOT, /* Reset by EC console command */ CHIPSET_RESET_CONSOLE_CMD, + /* Reset by EC host command */ + CHIPSET_RESET_HOST_CMD, /* Keyboard module reset key combination */ CHIPSET_RESET_KB_SYSRESET, /* Keyboard module warm reboot */ diff --git a/include/config.h b/include/config.h index a4aecc1ffe..dd63927933 100644 --- a/include/config.h +++ b/include/config.h @@ -1887,6 +1887,9 @@ /* Set SKU ID from AP */ #undef CONFIG_HOSTCMD_AP_SET_SKUID +/* Command to issue AP reset */ +#undef CONFIG_HOSTCMD_AP_RESET + /* List of host commands whose debug output will be suppressed */ #undef CONFIG_SUPPRESSED_HOST_COMMANDS diff --git a/include/ec_commands.h b/include/ec_commands.h index 5508e448d3..32f83efde3 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -4922,6 +4922,9 @@ struct __ec_align4 ec_response_rollback_info { }; +/* Issue AP reset */ +#define EC_CMD_AP_RESET 0x0125 + /*****************************************************************************/ /* The command range 0x200-0x2FF is reserved for Rotor. */ diff --git a/util/ectool.c b/util/ectool.c index ece78749c6..24c0c7955e 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -58,6 +58,8 @@ const char help_str[] = " Read an ADC channel.\n" " addentropy [reset]\n" " Add entropy to device secret\n" + " apreset\n" + " Issue AP reset\n" " autofanctrl <on>\n" " Turn on automatic fan speed control.\n" " backlight <enabled>\n" @@ -715,6 +717,7 @@ static const char *reset_cause_to_str(uint16_t cause) "reset: board custom", "reset: ap hang detected", "reset: console command", + "reset: host command", "reset: keyboard sysreset", "reset: keyboard warm reboot", "reset: debug warm reboot", @@ -1332,6 +1335,11 @@ int cmd_rollback_info(int argc, char *argv[]) return rv; } +int cmd_apreset(int argc, char *argv[]) +{ + return ec_command(EC_CMD_AP_RESET, 0, NULL, 0, NULL, 0); +} + #define FP_FRAME_INDEX_SIMPLE_IMAGE -1 /* @@ -8338,6 +8346,7 @@ int cmd_cec(int argc, char *argv[]) const struct command commands[] = { {"adcread", cmd_adc_read}, {"addentropy", cmd_add_entropy}, + {"apreset", cmd_apreset}, {"autofanctrl", cmd_thermal_auto_fan_ctrl}, {"backlight", cmd_lcd_backlight}, {"battery", cmd_battery}, |