mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Andy Isaacson <adi@vmware.com>,
	linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net,
	adi@hexapodia.org, dds@google.com,
	Mimi Zohar <zohar@linux.vnet.ibm.com>,
	Shahbaz Khan <shaz.linux@gmail.com>,
	seiji.munetoh@gmail.com
Subject: [PATCH] TPM: DATA_EXPECT bit check bypass
Date: Thu, 16 Jul 2009 14:43:32 -0300	[thread overview]
Message-ID: <1247766212.30736.17.camel@dyn531421.br.ibm.com> (raw)
In-Reply-To: <1247765210.30736.3.camel@dyn531421.br.ibm.com>

Sending now inline in order to work ok with git-am, sorry for the flood.

This patch depends on patch http://patchwork.kernel.org/patch/33486/

Since the iTPM doesn't set the DATA_EXPECT bit when it should, we bypass
this bit check in case we're running the code over this specific TPM.

Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
---
 drivers/char/tpm/tpm.h     |    1 +
 drivers/char/tpm/tpm_tis.c |   11 ++++++++++-
 2 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 8e00b4d..ed4ecf0 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -109,6 +109,7 @@ struct tpm_chip {
 
        struct list_head list;
        void (*release) (struct device *);
+       bool is_itpm;
 };
 
 #define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor)
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index aec1931..74a60d7 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -27,6 +27,7 @@
 #include "tpm.h"
 
 #define TPM_HEADER_SIZE 10
+#define ITPM_ID "INTC0102"
 
 enum tis_access {
        TPM_ACCESS_VALID = 0x80,
@@ -293,7 +294,9 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
                wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
                              &chip->vendor.int_queue);
                status = tpm_tis_status(chip);
-               if ((status & TPM_STS_DATA_EXPECT) == 0) {
+               /* iTPM never sets the DATA_EXPECT bit */
+               if (((status & TPM_STS_DATA_EXPECT) == 0) &&
+                    (!chip->is_itpm)) {
                        rc = -EIO;
                        goto out_err;
                }
@@ -582,6 +585,12 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
        tpm_get_timeouts(chip);
        tpm_continue_selftest(chip);
 
+       for (i=0; i < 8; i++)
+               if (ITPM_ID[i] != to_pnp_dev(dev)->id->id[i])
+                       break;
+       if (i == 8)
+               chip->is_itpm = 1;
+
        return 0;
 out_err:
        if (chip->vendor.iobase)
-- 
1.6.3.1



  reply	other threads:[~2009-07-16 17:44 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-01  1:04 [PATCH 0/6] tpm_tis: various cleanups, and support for Intel iTPM Andy Isaacson
2009-07-01  1:04 ` [PATCH 1/6] tpm_tis: various cleanups Andy Isaacson
2009-09-10 19:56   ` Rajiv Andrade
2009-07-01  1:04 ` [PATCH 2/6] tpm_tis: add MODULE_DEVICE_TABLE to enable autoload Andy Isaacson
2009-09-10 19:56   ` Rajiv Andrade
2009-07-01  1:04 ` [PATCH 3/6] tpm_tis: set timeouts before calling request_locality Andy Isaacson
2009-07-01  1:04 ` [PATCH 4/6] tpm_tis: print complete vendor information Andy Isaacson
2009-09-10 19:57   ` Rajiv Andrade
2009-07-01  1:04 ` [PATCH 5/6] tpm_tis: convert from pnp_driver to acpi_driver Andy Isaacson
2009-07-01 10:01   ` Alan Cox
2009-07-01 13:45     ` Rajiv Andrade
2009-07-16 17:26       ` Rajiv Andrade
2009-07-16 17:43         ` Rajiv Andrade [this message]
2009-07-16 20:08           ` [PATCH] TPM: DATA_EXPECT bit check bypass Valdis.Kletnieks
2009-07-16 20:50             ` Rajiv Andrade
2009-07-16 21:20             ` Rajiv Andrade
2009-07-20 23:28               ` Andy Isaacson
2009-07-24 17:12                 ` Rajiv Andrade
2009-07-20 18:27       ` [PATCH 5/6] tpm_tis: convert from pnp_driver to acpi_driver Andy Isaacson
2009-09-10 19:08         ` Rajiv Andrade
2009-09-10 19:54           ` [PATCH] tpm_tis: TPM_STS_DATA_EXPECT workaround Rajiv Andrade
2009-09-10 19:58             ` Daniel Walker
2009-09-10 20:06               ` Rajiv Andrade
2009-09-10 20:09               ` Rajiv Andrade
2009-09-11 23:34                 ` Seiji Munetoh
2009-09-24 18:43                   ` Rajiv Andrade
2009-10-28  2:45                     ` David Smith
2009-10-31 14:24                       ` Eric Paris
2009-11-01 22:09                         ` James Morris
2009-09-10 20:27               ` Andy Isaacson
2009-07-01  1:04 ` [PATCH 6/6] tpm_tis: add workarounds for iTPM Andy Isaacson
2009-07-03 18:18   ` [tpmdd-devel] " Marcin Obara
2009-07-03 19:33     ` Andy Isaacson
2009-07-03 20:10       ` Marcin Obara
2009-07-03 20:20         ` Andy Isaacson

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=1247766212.30736.17.camel@dyn531421.br.ibm.com \
    --to=srajiv@linux.vnet.ibm.com \
    --cc=adi@hexapodia.org \
    --cc=adi@vmware.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dds@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seiji.munetoh@gmail.com \
    --cc=shaz.linux@gmail.com \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=zohar@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®