Thread (31 messages) flat view 31 messages, 2 authors, 2014-12-01

Re: [tpmdd-devel] [PATCH v7 09/10] tpm: TPM 2.0 FIFO Interface

From: Stefan Berger <hidden>
Date: 2014-11-27 01:38:46
Also in: lkml

On 11/11/2014 08:45 AM, Jarkko Sakkinen wrote:
From: Will Arthur <redacted>

Detect TPM 2.0 by using the extended STS (STS3) register. For TPM 2.0,
instead of calling tpm_get_timeouts(), assign duration and timeout
values defined in the TPM 2.0 PTP specification.
quoted hunk ↗ jump to hunk
Signed-off-by: Will Arthur <redacted>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
  drivers/char/tpm/tpm_tis.c | 71 ++++++++++++++++++++++++++++++++++++----------
  1 file changed, 56 insertions(+), 15 deletions(-)
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 7a2c59b..0b3c089 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -1,5 +1,6 @@
  /*
   * Copyright (C) 2005, 2006 IBM Corporation
+ * Copyright (C) 2014 Intel Corporation
   *
   * Authors:
   * Leendert van Doorn <leendert-aZOuKsOsJu3MbYB6QlFGEg@public.gmane.org>
@@ -44,6 +45,10 @@ enum tis_status {
  	TPM_STS_DATA_EXPECT = 0x08,
  };

+enum tis_status3 {
+	TPM_STS3_TPM2_FAM = 0x04,
+};
+
I just looked at the specs: You have to define a mask for bits 2 and 3 
-> 0xc0.

quoted hunk ↗ jump to hunk
@@ -554,11 +567,28 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle,
  	if (!chip->vendor.iobase)
  		return -EIO;

+	sts3 = ioread8(chip->vendor.iobase + TPM_STS3(1));
+	if (sts3 & TPM_STS3_TPM2_FAM)
+		chip->flags = TPM_CHIP_FLAG_TPM2;
And use the mask here.

((sts3 & XYZ_MASK) == TPM_STS3_TPM2_FAM)
     chip->flags = TPM_CHIP_FLAG_TPM2;

Since the bits 00 indicate TPM 1.2, 01 TPM2 and 10 and 11 are reserved!


    Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help