aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_tis.c
diff options
context:
space:
mode:
authorRajiv Andrade <srajiv@linux.vnet.ibm.com>2009-09-10 16:09:35 -0400
committerJames Morris <jmorris@namei.org>2009-11-01 17:09:04 -0500
commit3507d612366a4e81226295f646410130a1f62a5c (patch)
tree046ef656112c1ee650518a0bbeab43adf1522b93 /drivers/char/tpm/tpm_tis.c
parent5975c725dfd6f7d36f493ab1453fbdbd35c1f0e3 (diff)
tpm_tis: TPM_STS_DATA_EXPECT workaround
Some newer Lenovo models are shipped with a TPM that doesn't seem to set the TPM_STS_DATA_EXPECT status bit when sending it a burst of data, so the code understands it as a failure and doesn't proceed sending the chip the intended data. In this patch we bypass this bit check in case the itpm module parameter was set. This patch is based on Andy Isaacson's one: http://marc.info/?l=linux-kernel&m=124650185023495&w=2 It was heavily discussed how should we deal with identifying the chip in kernel space, but the required patch to do so was NACK'd: http://marc.info/?l=linux-kernel&m=124650186423711&w=2 This way we let the user choose using this workaround or not based on his observations on this code behavior when trying to use the TPM. Fixed a checkpatch issue present on the previous patch, thanks to Daniel Walker. Signed-off-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com> Acked-by: Eric Paris <eparis@redhat.com> Tested-by: Seiji Munetoh <seiji.munetoh@gmail.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/char/tpm/tpm_tis.c')
-rw-r--r--drivers/char/tpm/tpm_tis.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 0b73e4ec1add..27e8de415309 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -257,6 +257,10 @@ out:
257 return size; 257 return size;
258} 258}
259 259
260static int itpm;
261module_param(itpm, bool, 0444);
262MODULE_PARM_DESC(itpm, "Force iTPM workarounds (found on some Lenovo laptops)");
263
260/* 264/*
261 * If interrupts are used (signaled by an irq set in the vendor structure) 265 * If interrupts are used (signaled by an irq set in the vendor structure)
262 * tpm.c can skip polling for the data to be available as the interrupt is 266 * tpm.c can skip polling for the data to be available as the interrupt is
@@ -293,7 +297,7 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
293 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, 297 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
294 &chip->vendor.int_queue); 298 &chip->vendor.int_queue);
295 status = tpm_tis_status(chip); 299 status = tpm_tis_status(chip);
296 if ((status & TPM_STS_DATA_EXPECT) == 0) { 300 if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) {
297 rc = -EIO; 301 rc = -EIO;
298 goto out_err; 302 goto out_err;
299 } 303 }
@@ -467,6 +471,10 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
467 "1.2 TPM (device-id 0x%X, rev-id %d)\n", 471 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
468 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); 472 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
469 473
474 if (itpm)
475 dev_info(dev, "Intel iTPM workaround enabled\n");
476
477
470 /* Figure out the capabilities */ 478 /* Figure out the capabilities */
471 intfcaps = 479 intfcaps =
472 ioread32(chip->vendor.iobase + 480 ioread32(chip->vendor.iobase +