Derek Huang has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/77632?usp=email )
Change subject: chromeos/cse_board_reset.c: Clear EC AP_IDLE flag ......................................................................
chromeos/cse_board_reset.c: Clear EC AP_IDLE flag
When CSE jumps between RO and RW, it trigger global reset so the AP goes down to S5 and back to S0. For Chromebox, when AP goes down to S5 EC set AP_IDLE flag. This cause an issue to warm reset the Chromebox device when it is in recovery mode and powered by USB-C adapter. This patch allows AP to direct EC to clear AP_IDLE flag before trigger reset.
BUG=b:296173534 BRANCH=firmware-dedede-136-6.B TEST=DUT boots up after warm reset in recovery mode
Change-Id: Ib0002c1b8313c6f25d2b8767c60639aed8a4f904 Signed-off-by: Derek Huang derekhuang@google.com --- M src/mainboard/google/dedede/Kconfig.name M src/soc/intel/common/block/cse/Kconfig M src/vendorcode/google/chromeos/Makefile.inc M src/vendorcode/google/chromeos/clear_ec_ap_idle.c M src/vendorcode/google/chromeos/cse_board_reset.c 5 files changed, 18 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/77632/1
diff --git a/src/mainboard/google/dedede/Kconfig.name b/src/mainboard/google/dedede/Kconfig.name index 10cf5e2..c8e2cc3 100644 --- a/src/mainboard/google/dedede/Kconfig.name +++ b/src/mainboard/google/dedede/Kconfig.name @@ -14,6 +14,7 @@ select RT8168_GEN_ACPI_POWER_RESOURCE select RT8168_GET_MAC_FROM_VPD select RT8168_SET_LED_MODE + select CSE_RESET_CLEAR_EC_AP_IDLE_FLAG
config BOARD_GOOGLE_DEDEDE bool "-> Dedede" @@ -208,6 +209,7 @@ select RT8168_GEN_ACPI_POWER_RESOURCE select RT8168_GET_MAC_FROM_VPD select RT8168_SET_LED_MODE + select CSE_RESET_CLEAR_EC_AP_IDLE_FLAG
config BOARD_GOOGLE_BOXY bool "-> Boxy" @@ -215,3 +217,4 @@ select RT8168_GEN_ACPI_POWER_RESOURCE select RT8168_GET_MAC_FROM_VPD select RT8168_SET_LED_MODE + select CSE_RESET_CLEAR_EC_AP_IDLE_FLAG diff --git a/src/soc/intel/common/block/cse/Kconfig b/src/soc/intel/common/block/cse/Kconfig index 26c623f..63011b4 100644 --- a/src/soc/intel/common/block/cse/Kconfig +++ b/src/soc/intel/common/block/cse/Kconfig @@ -388,4 +388,12 @@ OEM created binaries to be loaded. This binary is generated by signing with the key owned by trusted owner.
+config CSE_RESET_CLEAR_EC_AP_IDLE_FLAG + bool n + default n + help + Select this if the variant is a Chromebox/base. This allows AP to direct EC + to clear AP_IDLE flag before triggering reset to make sure AP can boot up + after reset. + endif diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc index dbe7545..2087097 100644 --- a/src/vendorcode/google/chromeos/Makefile.inc +++ b/src/vendorcode/google/chromeos/Makefile.inc @@ -14,6 +14,8 @@ ramstage-$(CONFIG_CHROMEOS_CSE_BOARD_RESET_OVERRIDE) += cse_board_reset.c
ramstage-$(CONFIG_CR50_RESET_CLEAR_EC_AP_IDLE_FLAG) += clear_ec_ap_idle.c +ramstage-$(CONFIG_CSE_RESET_CLEAR_EC_AP_IDLE_FLAG) += clear_ec_ap_idle.c +romstage-$(CONFIG_CSE_RESET_CLEAR_EC_AP_IDLE_FLAG) += clear_ec_ap_idle.c
bootblock-y += watchdog.c verstage-y += watchdog.c diff --git a/src/vendorcode/google/chromeos/clear_ec_ap_idle.c b/src/vendorcode/google/chromeos/clear_ec_ap_idle.c index 697ad23..1959a49 100644 --- a/src/vendorcode/google/chromeos/clear_ec_ap_idle.c +++ b/src/vendorcode/google/chromeos/clear_ec_ap_idle.c @@ -4,7 +4,8 @@
void clear_ec_ap_idle(void) { - if (!CONFIG(CR50_RESET_CLEAR_EC_AP_IDLE_FLAG)) + if (!CONFIG(CR50_RESET_CLEAR_EC_AP_IDLE_FLAG) && + !CONFIG(CSE_RESET_CLEAR_EC_AP_IDLE_FLAG)) return;
/* Send EC command to clear AP_IDLE flag */ diff --git a/src/vendorcode/google/chromeos/cse_board_reset.c b/src/vendorcode/google/chromeos/cse_board_reset.c index 08db7e2..307ece1 100644 --- a/src/vendorcode/google/chromeos/cse_board_reset.c +++ b/src/vendorcode/google/chromeos/cse_board_reset.c @@ -10,12 +10,15 @@ #include <intelblocks/cse.h> #include <security/tpm/tss.h> #include <vb2_api.h> +#include <vendorcode/google/chromeos/chromeos.h>
void cse_board_reset(void) { int ret; struct cr50_firmware_version version;
+ clear_ec_ap_idle(); + if (CONFIG(TPM2) && CONFIG(TPM_GOOGLE_CR50)) { /* Initialize TPM and get the cr50 firmware version. */ ret = tlcl_lib_init();