From c7730dd9b66e8909de8f4c2a51247894559ab997 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Tue, 28 Jun 2022 17:29:20 +0800 Subject: [PATCH] mb/google/corsola: Decide EC-is-trusted logic by board rev Kingler and Krabby's rev 0 boards both have Cr50 instead of Ti50. In order to support them with the new firmware where TPM_GOOGLE_TI50 is selected, use the board rev to determine the EC-is-trusted logic. BUG=b:237355198 TEST=emerge-corsola coreboot BRANCH=none Change-Id: I7797eafaa7a35355d241c4ea425a4716a35a7817 Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/65472 Tested-by: build bot (Jenkins) Reviewed-by: Hung-Te Lin --- src/mainboard/google/corsola/chromeos.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/mainboard/google/corsola/chromeos.c b/src/mainboard/google/corsola/chromeos.c index 7d36a170fd..9717f9c2e1 100644 --- a/src/mainboard/google/corsola/chromeos.c +++ b/src/mainboard/google/corsola/chromeos.c @@ -2,8 +2,10 @@ #include #include +#include #include #include +#include #include "gpio.h" @@ -45,8 +47,21 @@ void fill_lb_gpios(struct lb_gpios *gpios) int get_ec_is_trusted(void) { + uint32_t rev; + bool has_cr50 = false; + + /* + * Kingler and Krabby's rev 0 boards both use Cr50 instead of Ti50. In order to share + * the same firmware with newer rev, get the board rev from CBI, and ignore + * TPM_GOOGLE_TI50 when rev is 0. + */ + if (CONFIG(BOARD_GOOGLE_KINGLER) || CONFIG(BOARD_GOOGLE_KRABBY)) { + if (google_chromeec_cbi_get_board_version(&rev) == 0 && rev == 0) + has_cr50 = true; + } + /* With Ti50, VB2_CONTEXT_EC_TRUSTED should be set according to the boot mode. */ - if (CONFIG(TPM_GOOGLE_TI50)) + if (CONFIG(TPM_GOOGLE_TI50) && !has_cr50) return 0; /* EC is trusted if not in RW. This is active low. */