From 3e5cefcc45d7ef7da9fd9b6ecc499a05f8134039 Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Tue, 1 Nov 2022 00:48:43 +0200 Subject: security/tpm: support compiling in multiple TPM drivers Starting from here CONFIG_TPM1 and CONFIG_TPM2 are no longer mutually exclusive. Change-Id: I44c5a1d825afe414c2f5c2c90f4cfe41ba9bef5f Ticket: https://ticket.coreboot.org/issues/433 Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/69162 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- src/security/tpm/tss/tss.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/security/tpm/tss') diff --git a/src/security/tpm/tss/tss.c b/src/security/tpm/tss/tss.c index bd0e98582b..8e52de73e9 100644 --- a/src/security/tpm/tss/tss.c +++ b/src/security/tpm/tss/tss.c @@ -1,6 +1,10 @@ /* SPDX-License-Identifier: BSD-3-Clause */ #include +#include +#include +#include +#include #include #include @@ -24,13 +28,21 @@ tpm_result_t tlcl_lib_init(void) /* Set right away to make recursion impossible. */ init_done = true; - tlcl_tis_sendrecv = tis_probe(&tlcl_tpm_family); + tlcl_tis_sendrecv = NULL; + if (CONFIG(CRB_TPM)) + tlcl_tis_sendrecv = crb_tis_probe(&tlcl_tpm_family); + if (CONFIG(MEMORY_MAPPED_TPM) && tlcl_tis_sendrecv == NULL) + tlcl_tis_sendrecv = pc80_tis_probe(&tlcl_tpm_family); + if (CONFIG(I2C_TPM) && tlcl_tis_sendrecv == NULL) + tlcl_tis_sendrecv = i2c_tis_probe(&tlcl_tpm_family); + if (CONFIG(SPI_TPM) && tlcl_tis_sendrecv == NULL) + tlcl_tis_sendrecv = spi_tis_probe(&tlcl_tpm_family); if (tlcl_tis_sendrecv == NULL) { - printk(BIOS_ERR, "%s: tis_probe failed\n", __func__); + printk(BIOS_ERR, "%s: TIS probe failed\n", __func__); tlcl_tpm_family = TPM_UNKNOWN; } else if (tlcl_tpm_family != TPM_1 && tlcl_tpm_family != TPM_2) { - printk(BIOS_ERR, "%s: tis_probe returned incorrect TPM family: %d\n", __func__, + printk(BIOS_ERR, "%s: TIS probe returned incorrect TPM family: %d\n", __func__, tlcl_tpm_family); tlcl_tpm_family = TPM_UNKNOWN; } -- cgit v1.2.3