Lean Sheng Tan submitted this change.

View Change

Approvals: Sean Rhodes: Looks good to me, but someone else must approve Lean Sheng Tan: Looks good to me, but someone else must approve build bot (Jenkins): Verified Michał Kopeć: Looks good to me, approved
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>
---
M src/drivers/crb/tis.c
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/drivers/crb/tis.c b/src/drivers/crb/tis.c
index 3893917..5e81935 100644
--- a/src/drivers/crb/tis.c
+++ b/src/drivers/crb/tis.c
@@ -50,6 +50,14 @@
{
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 @@
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;
}


To view, visit change 80453. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: If0ec6217b0e321b7d7a9410b70defde3c3195fc3
Gerrit-Change-Number: 80453
Gerrit-PatchSet: 3
Gerrit-Owner: Michał Żygowski <michal.zygowski@3mdeb.com>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Reviewer: Michał Kopeć <michal.kopec@3mdeb.com>
Gerrit-Reviewer: Sean Rhodes <sean@starlabs.systems>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged