diff options
author | Sergii Dmytruk <sergii.dmytruk@3mdeb.com> | 2022-11-01 00:48:43 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-04-16 13:52:14 +0000 |
commit | 3e5cefcc45d7ef7da9fd9b6ecc499a05f8134039 (patch) | |
tree | 676b2369f6559b7d0028aaafc0c9b84af798ade6 /src/security/tpm/tss | |
parent | 7c75f8e5b2c3877487b424a1523c1e2a0caa4111 (diff) |
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 <sergii.dmytruk@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69162
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/security/tpm/tss')
-rw-r--r-- | src/security/tpm/tss/tss.c | 18 |
1 files changed, 15 insertions, 3 deletions
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 <console/console.h> +#include <drivers/crb/tpm.h> +#include <drivers/i2c/tpm/tpm.h> +#include <drivers/pc80/tpm/tpm.h> +#include <drivers/spi/tpm/tpm.h> #include <security/tpm/tis.h> #include <security/tpm/tss.h> @@ -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; } |