From 071d1787fd5d2af3f5e5409836945e9bf2f2acac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sat, 6 Nov 2021 18:52:22 +0200 Subject: google/butterfly: Refactor get_recovery_mode_switch() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not place console output in low-level GPIO functions. The caller of get_recovery_mode_switch() is in vboot_logic.c that is linked in romstage. So presumably recovery mode is broken and is not fixed with this commit either. Change-Id: I2a0fdbb370d54898c72adb29a0e9b990a5fc0ce1 Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/59003 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner Reviewed-by: Angel Pons --- src/mainboard/google/butterfly/chromeos.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/butterfly/chromeos.c b/src/mainboard/google/butterfly/chromeos.c index 2293f93d62..83b6ba04c4 100644 --- a/src/mainboard/google/butterfly/chromeos.c +++ b/src/mainboard/google/butterfly/chromeos.c @@ -1,6 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include #include #include #include @@ -13,8 +12,6 @@ #include "ec.h" #include "onboard.h" -#define FORCE_RECOVERY_MODE 0 - void fill_lb_gpios(struct lb_gpios *gpios) { struct lb_gpio chromeos_gpios[] = { @@ -42,23 +39,13 @@ int get_lid_switch(void) return (ec_mem_read(EC_HW_GPI_STATUS) >> EC_GPI_LID_STAT_BIT) & 1; } +/* FIXME: VBOOT reads this in ENV_ROMSTAGE. */ int get_recovery_mode_switch(void) { - int ec_rec_mode = 0; - - if (FORCE_RECOVERY_MODE) { - printk(BIOS_DEBUG, "FORCING RECOVERY MODE.\n"); - return 1; - } - - if (ENV_RAMSTAGE) { - if (ec_mem_read(EC_CODE_STATE) == EC_COS_EC_RO) - ec_rec_mode = 1; - - printk(BIOS_DEBUG, "RECOVERY MODE FROM EC: %x\n", ec_rec_mode); - } + if (ENV_RAMSTAGE) + return (ec_mem_read(EC_CODE_STATE) == EC_COS_EC_RO); - return ec_rec_mode; + return 0; } static const struct cros_gpio cros_gpios[] = { -- cgit v1.2.3