linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: stefanb@linux.vnet.ibm.com, tpmdd-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Cc: srajiv@linux.vnet.ibm.com
Subject: [PATCH 1/2] Only probe iTPMs
Date: Fri, 20 Jan 2012 12:58:49 -0500	[thread overview]
Message-ID: <20120120175930.702036458@linux.vnet.ibm.com> (raw)
In-Reply-To: 20120120175848.310554335@linux.vnet.ibm.com

[-- Attachment #1: tpm_intel_only.diff --]
[-- Type: text/plain, Size: 1579 bytes --]

Detect iTPMs through the vendor ID on the hardware interface and only
probe the device if the manufacturer is found to be Intel. This
obsoletes a previously added delay necessary for some TPMs but not iTPMs. 

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

---
 drivers/char/tpm/tpm.h     |    2 ++
 drivers/char/tpm/tpm_tis.c |    8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/char/tpm/tpm.h
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm.h
+++ linux-2.6/drivers/char/tpm/tpm.h
@@ -99,6 +99,8 @@ struct tpm_vendor_specific {
 	wait_queue_head_t int_queue;
 };
 
+#define TPM_VID_INTEL    0x8086
+
 struct tpm_chip {
 	struct device *dev;	/* Device stuff */
 
Index: linux-2.6/drivers/char/tpm/tpm_tis.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm_tis.c
+++ linux-2.6/drivers/char/tpm/tpm_tis.c
@@ -368,6 +368,11 @@ static int probe_itpm(struct tpm_chip *c
 	};
 	size_t len = sizeof(cmd_getticks);
 	int rem_itpm = itpm;
+	u16 vendor = ioread16(chip->vendor.iobase + TPM_DID_VID(0));
+
+	/* probe only iTPMS */
+	if (vendor != TPM_VID_INTEL)
+		return 0;
 
 	itpm = 0;
 
@@ -390,9 +395,6 @@ static int probe_itpm(struct tpm_chip *c
 out:
 	itpm = rem_itpm;
 	tpm_tis_ready(chip);
-	/* some TPMs need a break here otherwise they will not work
-	 * correctly on the immediately subsequent command */
-	msleep(chip->vendor.timeout_b);
 	release_locality(chip, chip->vendor.locality, 0);
 
 	return rc;


  reply	other threads:[~2012-01-20 17:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 17:58 [PATCH 0/2] tpm_tis: Some smaller fixes Stefan Berger
2012-01-20 17:58 ` Stefan Berger [this message]
2012-02-03 17:35   ` [PATCH 1/2] Only probe iTPMs Rajiv Andrade
2012-01-20 17:58 ` [PATCH 2/2] tpm_tis: Clean up after module_param cleanup Stefan Berger
2012-02-03 17:35   ` Rajiv Andrade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120120175930.702036458@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srajiv@linux.vnet.ibm.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).