From 7287899ad0847e8f5f28c13b8fc42c3119ca411e Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 25 Sep 2012 15:28:55 -0700 Subject: Clean up reboot host command 1) Only send the host response immediately for commands which won't return. This prevents double-sending a response for the disable-jump command. 2) Remove references to the POWER_ON flag. This was never implemented or used, since with EC software sync the EC always powers on after rebooting. 3) Fix help text for reboot_ec command. (Both "A" and "RW" still do the same thing, but "RW" is now the preferred option string.) BUG=chrome-os-partner:12635 BRANCH=link (also applies to snow, but don't pick unless needed) TEST=from a root shell, flashrom -p internal:bus=lpc -r /tmp/ec.bin flashrom -p internal:bus=lpc -w /tmp/ec.bin ectool reboot_ec RW ectool reboot_ec RO ectool disable-jump All commands should succeed. Change-Id: Idd7cf8d3dd91c21cb5065836775b72ecbac3ae56 Original-Change-Id: Ibf5b4fb88d93e64fc7361a9f962ec7aa1df0cf3c Signed-off-by: Randall Spangler Reviewed-by: Yung-Chieh Lo (cherry picked from commit 5943e6c1f5ca86c96cfa38926651466d929278d2) Reviewed-on: https://gerrit.chromium.org/gerrit/35123 Tested-by: Doug Anderson Reviewed-by: Simon Glass --- common/system_common.c | 12 +++++++----- include/ec_commands.h | 3 +-- util/ectool.c | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common/system_common.c b/common/system_common.c index 5014d8579f..c62361ebd2 100644 --- a/common/system_common.c +++ b/common/system_common.c @@ -864,12 +864,14 @@ int host_command_reboot(struct host_cmd_handler_args *args) return EC_RES_SUCCESS; } - /* TODO: (crosbug.com/p/9040) handle EC_REBOOT_FLAG_POWER_ON */ - #ifdef CONFIG_TASK_HOSTCMD - /* Clean busy bits on host */ - args->result = EC_RES_SUCCESS; - host_send_response(args); + if (p.cmd == EC_REBOOT_JUMP_RO || + p.cmd == EC_REBOOT_JUMP_RW || + p.cmd == EC_REBOOT_COLD) { + /* Clean busy bits on host for commands that won't return */ + args->result = EC_RES_SUCCESS; + host_send_response(args); + } #endif CPRINTF("[%T Executing host reboot command %d]\n", p.cmd); diff --git a/include/ec_commands.h b/include/ec_commands.h index 12f5f84f94..0ccdff2dec 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -968,8 +968,7 @@ enum ec_reboot_cmd { /* Flags for ec_params_reboot_ec.reboot_flags */ #define EC_REBOOT_FLAG_RESERVED0 (1 << 0) /* Was recovery request */ -#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) -#define EC_REBOOT_FLAG_POWER_ON (1 << 2) +#define EC_REBOOT_FLAG_ON_AP_SHUTDOWN (1 << 1) /* Reboot after AP shutdown */ struct ec_params_reboot_ec { uint8_t cmd; /* enum ec_reboot_cmd */ diff --git a/util/ectool.c b/util/ectool.c index 160adae029..705b187f24 100644 --- a/util/ectool.c +++ b/util/ectool.c @@ -104,7 +104,7 @@ const char help_str[] = " Set keyboard backlight in percent\n" " readtest \n" " Reads a pattern from the EC via LPC\n" - " reboot_ec [at-shutdown]\n" + " reboot_ec [at-shutdown]\n" " Reboot EC to RO or RW\n" " sertest\n" " Serial output test for COM2\n" -- cgit v1.2.1