summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCHLin <CHLIN56@nuvoton.com>2019-10-07 15:25:54 +0800
committerCommit Bot <commit-bot@chromium.org>2019-10-08 04:50:37 +0000
commit334974ad85adc097dd942ed703590e47639d30c4 (patch)
tree29406701d971735031241659e8700c617f7d0ab3
parentdc2e624d8387c34da2ea65a916985a147c814a48 (diff)
downloadchrome-ec-334974ad85adc097dd942ed703590e47639d30c4.tar.gz
npcx: espi: guard to call power_signal_interrupt
The source of the SLP_Sx power signals can come from only either GPIO or virtual wire. The firmware now assumes that, when the GPIO is chosen, (i.e. CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS is not enabled.) there should be no virtual wire SLP_Sx event is triggered. However if the host accidentally sends a SLP_Sx VW to EC, EC will call the power_singal_interrput(signal) by passing an invalid enum signal number. (i.e. The index is of the range of GPIO table.) It may cause the system problematic when the firmware uses the enum signal number to access the GPIO table. BUG=b:141730279 BRANCH=none TEST=No error for "make buildall" TEST=Test on trembyle, the crash symptom can be fixed. Change-Id: I0fa606f812b377d6616e314ca1f1c9675a04e2a8 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1844658 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
-rw-r--r--chip/npcx/espi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/chip/npcx/espi.c b/chip/npcx/espi.c
index 5dc7e258cf..e6d0a37bac 100644
--- a/chip/npcx/espi.c
+++ b/chip/npcx/espi.c
@@ -260,8 +260,9 @@ static int espi_vw_get_signal_index(enum espi_vw_signal event)
/* The ISRs of VW signals which used for power sequences */
void espi_vw_power_signal_interrupt(enum espi_vw_signal signal)
{
- /* TODO: Add VW handler in power/common.c */
- power_signal_interrupt((enum gpio_signal) signal);
+ if (IS_ENABLED(CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS))
+ /* TODO: Add VW handler in power/common.c */
+ power_signal_interrupt((enum gpio_signal) signal);
}
/*****************************************************************************/