From 3742308875a3e303b3f28f77016055c9f7d7d9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Tue, 13 Feb 2024 15:43:26 +0100 Subject: drivers/pc80/tpm: Disable device if TPM not present MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the TPM is not detected in the system it may mean it is inactive due to enabled ME with active PTT. In such case, the chipset will route the TPM traffic to PTT CRB TPM on Intel systems. If TPM is not probed, disable the PC80 TPM device driver, so that coreboot will not generate improper SSDT ACPI table. Change-Id: I05972ad74a36abaafa2f17a16f09710550a3a3f3 Signed-off-by: Michał Żygowski Reviewed-on: https://review.coreboot.org/c/coreboot/+/80455 Tested-by: build bot (Jenkins) Reviewed-by: Sergii Dmytruk --- src/drivers/pc80/tpm/tis.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/drivers/pc80/tpm/tis.c b/src/drivers/pc80/tpm/tis.c index f922714381..d811c52e90 100644 --- a/src/drivers/pc80/tpm/tis.c +++ b/src/drivers/pc80/tpm/tis.c @@ -905,11 +905,16 @@ static struct pnp_info pnp_dev_info[] = { static void enable_dev(struct device *dev) { - if (CONFIG(TPM)) - pnp_enable_devices(dev, &lpc_tpm_ops, - ARRAY_SIZE(pnp_dev_info), pnp_dev_info); - else + if (CONFIG(TPM)) { + if (pc80_tis_probe(NULL) == NULL) { + dev->enabled = 0; + return; + } + + pnp_enable_devices(dev, &lpc_tpm_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); + } else { pnp_enable_devices(dev, &noop_tpm_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info); + } } struct chip_operations drivers_pc80_tpm_ops = { -- cgit v1.2.3