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>
This commit is contained in:
Vincent Palatin
2015-01-22 11:53:10 -08:00
committed by ChromeOS Commit Bot
parent f39dc50213
commit da733f3aae

View File

@@ -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;
}