mb/google/brya: Correct Ti50 EC-is-trusted logic

With Cr50, the GPIO EC_IN_RW is used to determine whether EC is trusted. However, With the switch to Ti50, it is determined by Ti50's boot mode. If the boot mode is TRUSTED_RO, the VB2_CONTEXT_EC_TRUSTED flag will be set in check_boot_mode(). Therefore in the Ti50 case get_ec_is_trusted() can just return 0.

The current code of get_ec_is_trusted() only checks the GPIO, which
causes the EC to be always considered "trusted". Therefore, correct the return value to 0 for TPM_GOOGLE_TI50.

BUG=b:321172119
TEST=emerge-nissa coreboot chromeos-bootimage
TEST=firmware_DevMode passed in FAFT test

Change-Id: I308f8b36411030911c4421d80827fc49ff325a1b
Signed-off-by: Qinghong Zeng <zengqinghong@huaqin.corp- partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80158
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-by: Tyler Wang <tyler.wang@quanta.corp-partner.google.com>
Reviewed-by: Ian Feng <ian_feng@compal.corp-partner.google.com>
Reviewed-by: Weimin Wu <wuweimin@huaqin.corp-partner.google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
This commit is contained in:
zengqinghong 2024-01-24 21:00:14 +08:00 committed by Subrata Banik
parent 269b23280f
commit f4c496d3e3
1 changed files with 4 additions and 0 deletions

View File

@ -24,6 +24,10 @@ int get_write_protect_state(void)
int get_ec_is_trusted(void)
{
/* With Ti50, VB2_CONTEXT_EC_TRUSTED should be set according to the boot mode. */
if (CONFIG(TPM_GOOGLE_TI50))
return 0;
/* EC is trusted if not in RW. */
return !gpio_get(GPIO_EC_IN_RW);
}