From 36a3989fc437c513bcbeee7977d96239e7fe6295 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Wed, 25 Jul 2012 18:17:08 +0000 Subject: [PATCH] don't crash when receiving ACPI query on legacy channel When updating the EC and BIOS, we have to run for some times the new EC with the old BIOS (after we have upgraded the first half of the EC and before rebooting the machine), let's handle the ACPI request so the kernel is not sending them into a loop triggering a reboot of the machine. Signed-off-by: Vincent Palatin BUG=chrome-os-partner:11821 TEST=update a Link EVT using "chromeos-firmware --mode=factory" from current BCS binaries (EC v1.1.104-b8d7d8f / Firmware 2476) to next candidates ( EC v1.1.301 / Firmware 2657). Change-Id: I115a42e6c33c143cbdc38341dcf7e0f61a8bd771 Reviewed-on: https://gerrit.chromium.org/gerrit/28409 Reviewed-by: Duncan Laurie Tested-by: Vincent Palatin Reviewed-by: Randall Spangler Commit-Ready: Vincent Palatin --- chip/lm4/lpc.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/chip/lm4/lpc.c b/chip/lm4/lpc.c index 78dbdb6dda..58bb1d4225 100644 --- a/chip/lm4/lpc.c +++ b/chip/lm4/lpc.c @@ -366,6 +366,30 @@ static void handle_acpi_command(void) lpc_generate_sci(); } +/** + * We have received an unexpected ACPI request on the normal command channel + * from an old firmware/kernel, try to somewhat answer it. + */ +static int acpi_on_bad_channel(struct host_cmd_handler_args *args) +{ + int i; + int result = 0; + + for (i = 0; i < 32; i++) { + if (host_events & (1 << i)) { + host_clear_events(1 << i); + result = i + 1; /* Events are 1-based */ + break; + } + } + + return result; +} +DECLARE_HOST_COMMAND(EC_CMD_ACPI_QUERY_EVENT, + acpi_on_bad_channel, + EC_VER_MASK(0)); + + /* Handle an incoming host command */ static void handle_host_command(int cmd) {