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 <sean@starlabs.systems>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/86513
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
Sean Rhodes 2025-02-19 09:47:40 +00:00
commit d64385f307

View file

@ -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;