From d64385f307943caf7f2a612992bf4afaf71bfa25 Mon Sep 17 00:00:00 2001 From: Sean Rhodes Date: Wed, 19 Feb 2025 09:47:40 +0000 Subject: [PATCH] acpi: Fix incorrect TPM2 table generation for CRB_TPM If CONFIG(CRB_TPM) is enabled but the TPM is inactive, and no other TPM interface (SPI, I2C, Memory-Mapped) is configured, the function would incorrectly fallback to generate a TPM2 table for FIFO mode. This commit adds a check to ensure crb_tpm_is_active() is only called if CONFIG(CRB_TPM) is enabled and no other TPM interface is present. If the CRB TPM is inactive and no other TPMs are available, the function now exits early to prevent generating an invalid TPM2 table. Test=boot `starlabs/starlite_adl` and check Linux doesn't probe for a TPM when PTT is not active. Change-Id: I153779aa1f3d84ffeb694543f9da1d09b120f98f Signed-off-by: Sean Rhodes Reviewed-on: https://review.coreboot.org/c/coreboot/+/86513 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier --- src/acpi/acpi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/acpi/acpi.c b/src/acpi/acpi.c index 8f5c09fd08..06879540bf 100644 --- a/src/acpi/acpi.c +++ b/src/acpi/acpi.c @@ -258,6 +258,10 @@ static void acpi_create_tpm2(acpi_header_t *header, void *unused) if (tlcl_get_family() != TPM_2) return; + if (CONFIG(CRB_TPM) && !(CONFIG(SPI_TPM) || CONFIG(I2C_TPM) || CONFIG(MEMORY_MAPPED_TPM))) + if (!crb_tpm_is_active()) + return; + acpi_tpm2_t *tpm2 = (acpi_tpm2_t *)header; u32 tpm2_log_len; void *lasa; @@ -275,7 +279,7 @@ static void acpi_create_tpm2(acpi_header_t *header, void *unused) /* Hard to detect for coreboot. Just set it to 0 */ tpm2->platform_class = 0; - if (CONFIG(CRB_TPM) && crb_tpm_is_active()) { + if (CONFIG(CRB_TPM)) { /* Must be set to 7 for CRB Support */ tpm2->control_area = CONFIG_CRB_TPM_BASE_ADDRESS + 0x40; tpm2->start_method = 7;