diff options
author | Keith Short <keithshort@chromium.org> | 2019-10-09 13:39:31 -0600 |
---|---|---|
committer | Denis Brockus <dbrockus@chromium.org> | 2019-10-11 18:47:27 +0000 |
commit | 29b062e276b8d55788cd7157b9b38a584ca4a62f (patch) | |
tree | 126ef308b1f74b4e836d86c5ae3ea59cf67581c2 | |
parent | 2461586d902615cf53f335c7d9ba161533dde4b8 (diff) | |
download | chrome-ec-29b062e276b8d55788cd7157b9b38a584ca4a62f.tar.gz |
power: Fix CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS checks
Regardless of the state of CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS, if
CONFIG_HOSTCMD_ESPI is enabled, then the AP can still generate virtual
wire interrupts.
Replace checks of CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS for power signals
with CONFIG_HOSTCMD_ESPI.
This fixes a processor exception that was caused by siglog_add() when
the AP generated a virtual wire interrupt. The VW signals start at
GPIO_COUNT so were causing buffer overflows of gpio_list[].
BUG=b:142406787
BRANCH=none
TEST=buildall -j
TEST=Enable CONFIG_BRINGUP on kohaku. Without change RO causes
processor exception, with change RO and RW boots and AP boots.
Change-Id: I81ab6f2fed217f5aad3ca7fae64c850e3af49f43
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1850275
Reviewed-by: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
-rw-r--r-- | power/common.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/power/common.c b/power/common.c index e309944b95..a45bbcf2f0 100644 --- a/power/common.c +++ b/power/common.c @@ -78,31 +78,31 @@ static int pause_in_s5; int power_signal_get_level(enum gpio_signal signal) { -#ifdef CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS - /* Check signal is from GPIOs or VWs */ - if (espi_signal_is_vw(signal)) - return espi_vw_get_wire(signal); -#endif + if (IS_ENABLED(CONFIG_HOSTCMD_ESPI)) { + /* Check signal is from GPIOs or VWs */ + if (espi_signal_is_vw(signal)) + return espi_vw_get_wire(signal); + } return gpio_get_level(signal); } int power_signal_disable_interrupt(enum gpio_signal signal) { -#ifdef CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS - /* Check signal is from GPIOs or VWs */ - if (espi_signal_is_vw(signal)) - return espi_vw_disable_wire_int(signal); -#endif + if (IS_ENABLED(CONFIG_HOSTCMD_ESPI)) { + /* Check signal is from GPIOs or VWs */ + if (espi_signal_is_vw(signal)) + return espi_vw_disable_wire_int(signal); + } return gpio_disable_interrupt(signal); } int power_signal_enable_interrupt(enum gpio_signal signal) { -#ifdef CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS - /* Check signal is from GPIOs or VWs */ - if (espi_signal_is_vw(signal)) - return espi_vw_enable_wire_int(signal); -#endif + if (IS_ENABLED(CONFIG_HOSTCMD_ESPI)) { + /* Check signal is from GPIOs or VWs */ + if (espi_signal_is_vw(signal)) + return espi_vw_enable_wire_int(signal); + } return gpio_enable_interrupt(signal); } @@ -115,11 +115,11 @@ int power_signal_is_asserted(const struct power_signal_info *s) #ifdef CONFIG_BRINGUP static const char *power_signal_get_name(enum gpio_signal signal) { -#ifdef CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS - /* Check signal is from GPIOs or VWs */ - if (espi_signal_is_vw(signal)) - return espi_vw_get_wire_name(signal); -#endif + if (IS_ENABLED(CONFIG_HOSTCMD_ESPI)) { + /* Check signal is from GPIOs or VWs */ + if (espi_signal_is_vw(signal)) + return espi_vw_get_wire_name(signal); + } return gpio_get_name(signal); } #endif |