From bb559311c8b6077e8823a1f47d7e427f92ecc118 Mon Sep 17 00:00:00 2001 From: Daisuke Nojiri Date: Wed, 24 May 2017 12:17:04 -0700 Subject: [PATCH] power_button_x86: Set PB state to ON in recovery mode This patch sets the initial power button state to on if recovery mode is requested. BUG=b:37274183 BRANCH=none TEST=Verify EC boots AP immediately in recovery mode on Fizz. Verify EC doesn't boot AP immediately in normal mode. Change-Id: Ib24eb6c6b7e9200cf7ba6af3e486337da3c68355 Signed-off-by: Daisuke Nojiri Reviewed-on: https://chromium-review.googlesource.com/514209 Reviewed-by: Randall Spangler --- common/power_button_x86.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/common/power_button_x86.c b/common/power_button_x86.c index 7fd7101c29..096fd478ce 100644 --- a/common/power_button_x86.c +++ b/common/power_button_x86.c @@ -212,6 +212,7 @@ static void set_initial_pwrbtn_state(void) } else { CPRINTS("PB init-jumped"); } + return; } else if ((reset_flags & RESET_FLAG_AP_OFF) || (keyboard_scan_get_boot_keys() == BOOT_KEY_DOWN_ARROW)) { /* @@ -227,22 +228,18 @@ static void set_initial_pwrbtn_state(void) */ CPRINTS("PB init-off"); power_button_pch_release(); - } else if (power_button_is_pressed()) { - CPRINTS("PB init-on"); - pwrbtn_state = PWRBTN_STATE_INIT_ON; - } else { - /* - * All other EC reset conditions power on the main processor so - * it can verify the EC. - */ -#if defined(CONFIG_BRINGUP) || defined(CONFIG_POWER_BUTTON_INIT_IDLE) - CPRINTS("PB idle"); - pwrbtn_state = PWRBTN_STATE_IDLE; -#else - CPRINTS("PB init-on"); - pwrbtn_state = PWRBTN_STATE_INIT_ON; -#endif + return; } + + pwrbtn_state = PWRBTN_STATE_INIT_ON; + +#if defined(CONFIG_BRINGUP) || defined(CONFIG_POWER_BUTTON_INIT_IDLE) + if (!power_button_is_pressed() && + !host_is_event_set(EC_HOST_EVENT_KEYBOARD_RECOVERY)) + pwrbtn_state = PWRBTN_STATE_IDLE; +#endif + CPRINTS("PB %s", + pwrbtn_state == PWRBTN_STATE_INIT_ON ? "init-on" : "idle"); } /**