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>
This commit is contained in:
Yu-Ping Wu 2022-06-28 17:29:20 +08:00 committed by Felix Held
parent 3fa36f63ae
commit c7730dd9b6
1 changed files with 16 additions and 1 deletions

View File

@ -2,8 +2,10 @@
#include <bootmode.h> #include <bootmode.h>
#include <boot/coreboot_tables.h> #include <boot/coreboot_tables.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h> #include <gpio.h>
#include <security/tpm/tis.h> #include <security/tpm/tis.h>
#include <stdbool.h>
#include "gpio.h" #include "gpio.h"
@ -45,8 +47,21 @@ void fill_lb_gpios(struct lb_gpios *gpios)
int get_ec_is_trusted(void) 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. */ /* 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; return 0;
/* EC is trusted if not in RW. This is active low. */ /* EC is trusted if not in RW. This is active low. */