drivers/crb: Check for PTT before attempting to initialize CRB TPM

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 <michal.zygowski@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80453
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Michał Kopeć <michal.kopec@3mdeb.com>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
This commit is contained in:
Michał Żygowski
2024-02-13 15:32:26 +01:00
committed by Lean Sheng Tan
parent 11afdb3afc
commit 3979dd6df0

View File

@@ -50,6 +50,14 @@ tis_sendrecv_fn crb_tis_probe(enum tpm_family *family)
{ {
struct crb_tpm_info info; 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) */ /* Wake TPM up (if necessary) */
if (crb_tpm_init()) if (crb_tpm_init())
return NULL; 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), printk(BIOS_INFO, "Initialized TPM device %s revision %d\n", tis_get_dev_name(&info),
info.revision); 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; return &crb_tpm_sendrecv;
} }