summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Green <evgreen@chromium.org>2021-11-17 14:02:42 -0800
committerCommit Bot <commit-bot@chromium.org>2021-12-01 19:02:21 +0000
commit5d6dfc1e5f91583c7e26d27073a6401224fe32c5 (patch)
tree2c1e0c906f3c7d6d9fc8b71a8666a54b575d1fc1
parentd89e49b2016c69d1762fae2e2786d4867934b4d6 (diff)
downloadchrome-ec-5d6dfc1e5f91583c7e26d27073a6401224fe32c5.tar.gz
Add EC feature flag for S4 residency
On systems with Intel Key Locker, the AP must hibernate to S4 in order to preserve active Key Locker state. Until recently, the EC did not support camping out in S4. Add a feature bit so the AP can distinguish EC versions which are capable of going to S4 from those that are not. BRANCH=None BUG=b:204947672 TEST=hiberman hibernate --test-keys on volteer Signed-off-by: Evan Green <evgreen@chromium.org> Change-Id: I9d01c689e90cd479d8d3f06a224ef7f9ed309fc4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3290310 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--common/ec_features.c3
-rw-r--r--include/config.h15
-rw-r--r--include/ec_commands.h4
-rw-r--r--util/ectool.c1
-rw-r--r--zephyr/Kconfig.powerseq10
-rw-r--r--zephyr/shim/include/config_chip.h5
6 files changed, 38 insertions, 0 deletions
diff --git a/common/ec_features.c b/common/ec_features.c
index a7e097e733..2147c1b48a 100644
--- a/common/ec_features.c
+++ b/common/ec_features.c
@@ -147,6 +147,9 @@ uint32_t get_feature_flags1(void)
#ifdef CONFIG_USB_MUX_AP_ACK_REQUEST
| EC_FEATURE_MASK_1(EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK)
#endif
+#ifdef CONFIG_POWER_S4_RESIDENCY
+ | EC_FEATURE_MASK_1(EC_FEATURE_S4_RESIDENCY)
+#endif
;
return board_override_feature_flags1(result);
}
diff --git a/include/config.h b/include/config.h
index f5e52cdc7f..02f49f93ec 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3531,6 +3531,9 @@
/* Support S0ix */
#undef CONFIG_POWER_S0IX
+/* Advertise S4 residency */
+#undef CONFIG_POWER_S4_RESIDENCY
+
/* Support detecting failure to enter a sleep state (S0ix/S3) */
#undef CONFIG_POWER_SLEEP_FAILURE_DETECTION
@@ -5540,6 +5543,18 @@
#endif
/*
+ * S4 residency works by observing SLP_S5 via virtual wire (as SLP_S5 has not
+ * traditionally been routed to the EC). If the board family wants S4 residency,
+ * they need to use ECs that support eSPI. Note that S4 residency is not
+ * strictly a requirement to support suspend-to-disk, except on Intel platforms
+ * with Key Locker support (TGL+).
+ */
+#if defined(CONFIG_POWER_S4_RESIDENCY) && \
+ !defined(CONFIG_HOSTCMD_ESPI_VW_SLP_S5)
+#error "S4_RESIDENCY needs eSPI support or SLP_S5 routed"
+#endif
+
+/*
* Note that in Zephyr OS, eSPI can be enabled for virtual wires
* without using eSPI for host commands.
*/
diff --git a/include/ec_commands.h b/include/ec_commands.h
index b089cd08d4..41153dae1d 100644
--- a/include/ec_commands.h
+++ b/include/ec_commands.h
@@ -1502,6 +1502,10 @@ enum ec_feature_code {
* mux.
*/
EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK = 43,
+ /*
+ * The EC supports entering and residing in S4.
+ */
+ EC_FEATURE_S4_RESIDENCY = 44,
};
#define EC_FEATURE_MASK_0(event_code) BIT(event_code % 32)
diff --git a/util/ectool.c b/util/ectool.c
index 0bc35ef3b4..4da67aae52 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -896,6 +896,7 @@ static const char * const ec_feature_names[] = {
"Host-controlled Type-C mode entry",
[EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK] =
"AP ack for Type-C mux configuration",
+ [EC_FEATURE_S4_RESIDENCY] = "S4 residency",
};
int cmd_inventory(int argc, char *argv[])
diff --git a/zephyr/Kconfig.powerseq b/zephyr/Kconfig.powerseq
index 27abd68e7c..d35caf6900 100644
--- a/zephyr/Kconfig.powerseq
+++ b/zephyr/Kconfig.powerseq
@@ -109,6 +109,16 @@ config PLATFORM_EC_POWERSEQ_S0IX
option, Intel's low-power idle sleep state, also known as
"modern sleep".
+config PLATFORM_EC_POWERSEQ_S4
+ bool "Advertise S4 residency"
+ depends on PLATFORM_EC_ESPI_VW_SLP_S5
+ default y if AP_X86_INTEL_TGL
+ default y if AP_X86_INTEL_ADL
+ help
+ Advertise S4 residency capabilities to the AP. This is required for
+ AP hibernate (suspend-to-disk) on Intel platforms with Key Locker
+ support (TGL+)
+
config PLATFORM_EC_POWERSEQ_COMETLAKE
bool "Use common Comet Lake code for power sequencing"
depends on AP_X86_INTEL_CML
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index d23ac30a50..572942bcee 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -659,6 +659,11 @@
#define CONFIG_POWER_S0IX
#endif
+#undef CONFIG_POWER_S4_RESIDENCY
+#ifdef CONFIG_PLATFORM_EC_POWERSEQ_S4
+#define CONFIG_POWER_S4_RESIDENCY
+#endif
+
#undef CONFIG_POWER_BUTTON_X86
#ifdef CONFIG_PLATFORM_EC_POWERSEQ_INTEL
#define CONFIG_POWER_BUTTON_X86