aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2011-01-09 17:46:24 -0500
committerJames Morris <jmorris@namei.org>2011-01-09 17:46:24 -0500
commitd2e7ad19229f982fc1eb731827d82ceac90abfb3 (patch)
tree98a3741b4d4b27a48b3c7ea9babe331e539416a8 /drivers/char/tpm
parentd03a5d888fb688c832d470b749acc5ed38e0bc1d (diff)
parent0c21e3aaf6ae85bee804a325aa29c325209180fd (diff)
Merge branch 'master' into next
Conflicts: security/smack/smack_lsm.c Verified and added fix by Stephen Rothwell <sfr@canb.auug.org.au> Ok'd by Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm.c4
-rw-r--r--drivers/char/tpm/tpm_tis.c24
2 files changed, 26 insertions, 2 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 068bac858b4a..1f46f1cd9225 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -1002,7 +1002,7 @@ int tpm_release(struct inode *inode, struct file *file)
1002 struct tpm_chip *chip = file->private_data; 1002 struct tpm_chip *chip = file->private_data;
1003 1003
1004 del_singleshot_timer_sync(&chip->user_read_timer); 1004 del_singleshot_timer_sync(&chip->user_read_timer);
1005 flush_scheduled_work(); 1005 flush_work_sync(&chip->work);
1006 file->private_data = NULL; 1006 file->private_data = NULL;
1007 atomic_set(&chip->data_pending, 0); 1007 atomic_set(&chip->data_pending, 0);
1008 kfree(chip->data_buffer); 1008 kfree(chip->data_buffer);
@@ -1054,7 +1054,7 @@ ssize_t tpm_read(struct file *file, char __user *buf,
1054 ssize_t ret_size; 1054 ssize_t ret_size;
1055 1055
1056 del_singleshot_timer_sync(&chip->user_read_timer); 1056 del_singleshot_timer_sync(&chip->user_read_timer);
1057 flush_scheduled_work(); 1057 flush_work_sync(&chip->work);
1058 ret_size = atomic_read(&chip->data_pending); 1058 ret_size = atomic_read(&chip->data_pending);
1059 atomic_set(&chip->data_pending, 0); 1059 atomic_set(&chip->data_pending, 0);
1060 if (ret_size > 0) { /* relay data */ 1060 if (ret_size > 0) { /* relay data */
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 1030f8420137..c17a305ecb28 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/wait.h> 27#include <linux/wait.h>
28#include <linux/acpi.h>
28#include "tpm.h" 29#include "tpm.h"
29 30
30#define TPM_HEADER_SIZE 10 31#define TPM_HEADER_SIZE 10
@@ -78,6 +79,26 @@ enum tis_defaults {
78static LIST_HEAD(tis_chips); 79static LIST_HEAD(tis_chips);
79static DEFINE_SPINLOCK(tis_lock); 80static DEFINE_SPINLOCK(tis_lock);
80 81
82#ifdef CONFIG_ACPI
83static int is_itpm(struct pnp_dev *dev)
84{
85 struct acpi_device *acpi = pnp_acpi_device(dev);
86 struct acpi_hardware_id *id;
87
88 list_for_each_entry(id, &acpi->pnp.ids, list) {
89 if (!strcmp("INTC0102", id->id))
90 return 1;
91 }
92
93 return 0;
94}
95#else
96static int is_itpm(struct pnp_dev *dev)
97{
98 return 0;
99}
100#endif
101
81static int check_locality(struct tpm_chip *chip, int l) 102static int check_locality(struct tpm_chip *chip, int l)
82{ 103{
83 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) & 104 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
@@ -472,6 +493,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start,
472 "1.2 TPM (device-id 0x%X, rev-id %d)\n", 493 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
473 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0))); 494 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
474 495
496 if (is_itpm(to_pnp_dev(dev)))
497 itpm = 1;
498
475 if (itpm) 499 if (itpm)
476 dev_info(dev, "Intel iTPM workaround enabled\n"); 500 dev_info(dev, "Intel iTPM workaround enabled\n");
477 501