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 <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65472
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
diff --git a/src/mainboard/google/corsola/chromeos.c b/src/mainboard/google/corsola/chromeos.c
index 7d36a17..9717f9c 100644
--- a/src/mainboard/google/corsola/chromeos.c
+++ b/src/mainboard/google/corsola/chromeos.c
@@ -2,8 +2,10 @@
#include <bootmode.h>
#include <boot/coreboot_tables.h>
+#include <ec/google/chromeec/ec.h>
#include <gpio.h>
#include <security/tpm/tis.h>
+#include <stdbool.h>
#include "gpio.h"
@@ -45,8 +47,21 @@
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. */