From 3979dd6df00e6534ba29f036a2774b08e31be5be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=C5=BBygowski?= Date: Tue, 13 Feb 2024 15:32:26 +0100 Subject: drivers/crb: Check for PTT before attempting to initialize CRB TPM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can assume that platforms, which select HAVE_INTEL_PTT, will not have any other CRB TPM than PTT. Check whether PTT is available before forcefully initializing the TPM and selecting the CRB interface in the TPM configuration registers. Change-Id: If0ec6217b0e321b7d7a9410b70defde3c3195fc3 Signed-off-by: Michał Żygowski Reviewed-on: https://review.coreboot.org/c/coreboot/+/80453 Reviewed-by: Sean Rhodes Tested-by: build bot (Jenkins) Reviewed-by: Michał Kopeć Reviewed-by: Lean Sheng Tan --- src/drivers/crb/tis.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/crb/tis.c b/src/drivers/crb/tis.c index 3893917118..5e81935d49 100644 --- a/src/drivers/crb/tis.c +++ b/src/drivers/crb/tis.c @@ -50,6 +50,14 @@ tis_sendrecv_fn crb_tis_probe(enum tpm_family *family) { struct crb_tpm_info info; + if (CONFIG(HAVE_INTEL_PTT)) { + if (!ptt_active()) { + printk(BIOS_ERR, "%s: Intel PTT is not active.\n", __func__); + return NULL; + } + printk(BIOS_DEBUG, "%s: Intel PTT is active.\n", __func__); + } + /* Wake TPM up (if necessary) */ if (crb_tpm_init()) return NULL; @@ -63,14 +71,6 @@ tis_sendrecv_fn crb_tis_probe(enum tpm_family *family) printk(BIOS_INFO, "Initialized TPM device %s revision %d\n", tis_get_dev_name(&info), info.revision); - if (CONFIG(HAVE_INTEL_PTT)) { - if (!ptt_active()) { - printk(BIOS_ERR, "%s: Intel PTT is not active.\n", __func__); - return NULL; - } - printk(BIOS_DEBUG, "%s: Intel PTT is active.\n", __func__); - } - return &crb_tpm_sendrecv; } -- cgit v1.2.3