summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-09-04 16:47:27 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-09-06 19:51:13 +0000
commit5025ff0db9895382af0e97f84b925edf65971216 (patch)
treeb7bbe3d001febfd3de595db8352a399da29e2445
parentec32d307698e674db7a5d665397ecf6a1bc1516c (diff)
downloadchrome-ec-5025ff0db9895382af0e97f84b925edf65971216.tar.gz
Add command for Haswell to pause in s5 at shutdown
At normal AP shutdown, Haswell systems skip S5 entirely and go directly to G3. It's sometimes handy to pause in S5 as the other systems do, for things like power-cycle tests that use the RTC to do a delayed wake from S5. This CL adds a console command and a host command to enable/disable that pause in S5. The default is to skip S5, and the override value is not persistent across EC reboots, so whenever the EC hibernates or reboots (Refresh + Power, software sync), you'll have to re-enable it again. BUG=chrome-os-partner:22346 BRANCH=falco,ToT TEST=manual On Haswell systems only. To enable the pause in S5 at shutdown, do either of these: EC console: gsv s5 1 root shell: ectool pause_in_s5 on Shut the AP down politely, and it should pause in S5 for 10 seconds before continuing to G3. You can see this by watching the EC console. To disable the pause in S5 at shutdown, do any of these: EC console: gsv s5 0 root shell: ectool pause_in_s5 off or press Refresh + POWER Boot the system, then politely shut down. This time it should go directly to G3 without pausing in S5. Original-Change-Id: I324e6e2373bc20b61a731b4ef443d7bb8edb6b83 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/168086 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 2a31e2ac4bc899de7dfbfcca191376ce7063fd2c) Change-Id: Iea1db204e904385e9615e3a379af53810f17ad5a Reviewed-on: https://chromium-review.googlesource.com/168378 Commit-Queue: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--board/falco/board.h1
-rw-r--r--board/peppy/board.h1
-rw-r--r--board/slippy/board.h1
-rw-r--r--common/chipset_haswell.c5
-rw-r--r--include/getset_value_list.h2
-rw-r--r--util/ectool.c40
6 files changed, 48 insertions, 2 deletions
diff --git a/board/falco/board.h b/board/falco/board.h
index 19136f7d26..91c43da285 100644
--- a/board/falco/board.h
+++ b/board/falco/board.h
@@ -18,6 +18,7 @@
#define CONFIG_CHIPSET_HASWELL
#define CONFIG_CHIPSET_X86
#endif
+#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_FALCO
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_KEYBOARD_BOARD_CONFIG
diff --git a/board/peppy/board.h b/board/peppy/board.h
index ecf22fba7c..857f7aab65 100644
--- a/board/peppy/board.h
+++ b/board/peppy/board.h
@@ -20,6 +20,7 @@
#define CONFIG_CHIPSET_HASWELL
#define CONFIG_CHIPSET_X86
#endif
+#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_KEYBOARD_BOARD_CONFIG
#ifdef HAS_TASK_KEYPROTO
diff --git a/board/slippy/board.h b/board/slippy/board.h
index 70fc1cca27..7eb0dec662 100644
--- a/board/slippy/board.h
+++ b/board/slippy/board.h
@@ -20,6 +20,7 @@
#define CONFIG_CHIPSET_HASWELL
#define CONFIG_CHIPSET_X86
#endif
+#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_KEYBOARD_BOARD_CONFIG
#ifdef HAS_TASK_KEYPROTO
diff --git a/common/chipset_haswell.c b/common/chipset_haswell.c
index 795164511a..9e5ecf72d2 100644
--- a/common/chipset_haswell.c
+++ b/common/chipset_haswell.c
@@ -9,6 +9,7 @@
#include "chipset_x86_common.h"
#include "common.h"
#include "console.h"
+#include "getset.h"
#include "gpio.h"
#include "hooks.h"
#include "system.h"
@@ -321,7 +322,9 @@ enum x86_state x86_handle_state(enum x86_state state)
/* Disable PP5000 (5V) rail. */
gpio_set_level(GPIO_PP5000_EN, 0);
- return X86_S5G3;
+
+ /* Start shutting down */
+ return gsv[GSV_PARAM_s5] ? X86_S5 : X86_S5G3;
case X86_S5G3:
/* Deassert DPWROK, assert RSMRST# */
diff --git a/include/getset_value_list.h b/include/getset_value_list.h
index 99f6beefc1..b78dc25d14 100644
--- a/include/getset_value_list.h
+++ b/include/getset_value_list.h
@@ -7,5 +7,5 @@
* List of get/set value items: <name, init_val>
*/
#define GSV_LIST \
- GSV_ITEM(s5, 0xdeadbeef) \
+ GSV_ITEM(s5, 0) \
/* end */
diff --git a/util/ectool.c b/util/ectool.c
index 0ee39dcb9e..ffc29fb9f2 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -17,6 +17,7 @@
#include "compile_time_macros.h"
#include "ec_flash.h"
#include "ectool.h"
+#include "getset.h"
#include "lightbar.h"
#include "lock/gec_lock.h"
#include "misc_util.h"
@@ -104,6 +105,8 @@ const char help_str[] =
" Various lightbar control commands\n"
" panicinfo\n"
" Prints saved panic info\n"
+ " pause_in_s5 [on|off]\n"
+ " Whether or not the AP should pause in S5 on shutdown\n"
" port80flood\n"
" Rapidly write bytes to port 80\n"
" powerinfo\n"
@@ -179,6 +182,20 @@ int is_battery_range(int val)
return (val >= 0 && val <= 65535) ? 1 : 0;
}
+int parse_bool(const char *s, int *dest)
+{
+ if (!strcasecmp(s, "off") || !strncasecmp(s, "dis", 3) ||
+ tolower(*s) == 'f' || tolower(*s) == 'n') {
+ *dest = 0;
+ return 1;
+ } else if (!strcasecmp(s, "on") || !strncasecmp(s, "ena", 3) ||
+ tolower(*s) == 't' || tolower(*s) == 'y') {
+ *dest = 1;
+ return 1;
+ } else {
+ return 0;
+ }
+}
void print_help(const char *prog)
{
@@ -300,6 +317,28 @@ int cmd_test(int argc, char *argv[])
return rv;
}
+int cmd_s5(int argc, char *argv[])
+{
+ struct ec_cmd_get_set_value s;
+ int rv;
+
+ s.flags = GSV_PARAM_s5;
+
+ if (argc > 1) {
+ s.flags |= EC_GSV_SET;
+ if (!parse_bool(argv[1], &s.value)) {
+ fprintf(stderr, "invalid arg \"%s\"\n", argv[1]);
+ return -1;
+ }
+ }
+
+ rv = ec_command(EC_CMD_GET_SET_VALUE, 0,
+ &s, sizeof(s), &s, sizeof(s));
+ if (rv > 0)
+ printf("%s\n", s.value ? "on" : "off");
+
+ return rv < 0;
+}
int cmd_cmdversions(int argc, char *argv[])
@@ -3169,6 +3208,7 @@ const struct command commands[] = {
{"keyconfig", cmd_keyconfig},
{"keyscan", cmd_keyscan},
{"panicinfo", cmd_panic_info},
+ {"pause_in_s5", cmd_s5},
{"powerinfo", cmd_power_info},
{"protoinfo", cmd_proto_info},
{"pstoreinfo", cmd_pstore_info},