summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-01-22 11:53:10 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-01-23 00:28:45 +0000
commitda733f3aae80afa30f6d12a3032972eb08d06635 (patch)
tree4117ef58b88de30b705d030c5fd47bbf59921b35
parentf39dc502130ce1e5ae2b9589425c135781defba1 (diff)
downloadchrome-ec-da733f3aae80afa30f6d12a3032972eb08d06635.tar.gz
lm4: ignore overlapping LPC commands
If the AP ignores the LPC_ST_BUSY bit (which is software-defined) and tries to send a second host command while the first one is still processed, we discard it. This doesn't prevent the host to re-write the command arguments stored in LPC shared mem (aka LPC_POOL_CMD_DATA) but when we will call host_packet_receive, we will have either the old arguments or the new arguments (or even a mix of both, which is less unlikely to pass the checksum check), and we will copy them once before calling the HOSTCMD task. So the host command task will have a single coherent (not changing) view of the arguments when performing its input validation. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:31492 chrome-os-partner:23806 TEST=Boot Samus and play with ectool Change-Id: I9aa1b8cdac05e323b91998188bd873826e83c274 Reviewed-on: https://chromium-review.googlesource.com/242593 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Kees Cook <keescook@chromium.org>
-rw-r--r--chip/lm4/lpc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c
index 6bab4fb761..0f3e9b8b1c 100644
--- a/chip/lm4/lpc.c
+++ b/chip/lm4/lpc.c
@@ -473,8 +473,8 @@ static void handle_acpi_write(int is_cmd)
*/
static void handle_host_write(int is_cmd)
{
- /* Ignore data writes */
- if (!is_cmd) {
+ /* Ignore data writes or overlapping commands from host */
+ if (!is_cmd || (LM4_LPC_ST(LPC_CH_CMD) & LM4_LPC_ST_BUSY)) {
LM4_LPC_ST(LPC_CH_CMD) &= ~LM4_LPC_ST_FRMH;
return;
}