summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-09-04 16:47:27 -0700
committerBill Richardson <wfrichar@chromium.org>2013-09-06 00:13:17 +0000
commit2a31e2ac4bc899de7dfbfcca191376ce7063fd2c (patch)
treeeec0d306930c8d3915ca3ae8b5796e5dca30c08e
parent748154d55f10f260502eb19bdb81298878543329 (diff)
downloadchrome-ec-2a31e2ac4bc899de7dfbfcca191376ce7063fd2c.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. 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>
-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 63b14b1b3a..b8794fa201 100644
--- a/board/falco/board.h
+++ b/board/falco/board.h
@@ -16,6 +16,7 @@
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHIPSET_HASWELL
#define CONFIG_CHIPSET_X86
+#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_FALCO
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_FAN
diff --git a/board/peppy/board.h b/board/peppy/board.h
index 4c2517ece3..23f12fc3f0 100644
--- a/board/peppy/board.h
+++ b/board/peppy/board.h
@@ -18,6 +18,7 @@
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHIPSET_HASWELL
#define CONFIG_CHIPSET_X86
+#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_FAN
#define CONFIG_FAN_EN_GPIO GPIO_PP5000_FAN_EN
diff --git a/board/slippy/board.h b/board/slippy/board.h
index ace4cdd464..118f346045 100644
--- a/board/slippy/board.h
+++ b/board/slippy/board.h
@@ -18,6 +18,7 @@
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHIPSET_HASWELL
#define CONFIG_CHIPSET_X86
+#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_FAN
#define CONFIG_FAN_RPM_MIN 1000
diff --git a/common/chipset_haswell.c b/common/chipset_haswell.c
index f4417ce2a1..1885f76d3c 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"
@@ -315,7 +316,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 59ebde3e9a..ddf1295baf 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[])
@@ -3337,6 +3376,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},