1 From 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 Mon Sep 17 00:00:00 2001
2 From: Matthew Garrett <mjg@redhat.com>
3 Date: Thu, 21 Oct 2010 17:42:40 -0400
4 Subject: tpm: Autodetect itpm devices
6 From: Matthew Garrett <mjg@redhat.com>
8 commit 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 upstream.
10 Some Lenovos have TPMs that require a quirk to function correctly. This can
11 be autodetected by checking whether the device has a _HID of INTC0102. This
12 is an invalid PNPid, and as such is discarded by the pnp layer - however
13 it's still present in the ACPI code, so we can pull it out that way. This
14 means that the quirk won't be automatically applied on non-ACPI systems,
15 but without ACPI we don't have any way to identify the chip anyway so I
16 don't think that's a great concern.
18 Signed-off-by: Matthew Garrett <mjg@redhat.com>
19 Acked-by: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
20 Tested-by: Jiri Kosina <jkosina@suse.cz>
21 Tested-by: Andy Isaacson <adi@hexapodia.org>
22 Signed-off-by: James Morris <jmorris@namei.org>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
26 drivers/char/tpm/tpm_tis.c | 24 ++++++++++++++++++++++++
27 1 file changed, 24 insertions(+)
29 --- a/drivers/char/tpm/tpm_tis.c
30 +++ b/drivers/char/tpm/tpm_tis.c
32 #include <linux/slab.h>
33 #include <linux/interrupt.h>
34 #include <linux/wait.h>
35 +#include <linux/acpi.h>
38 #define TPM_HEADER_SIZE 10
39 @@ -78,6 +79,26 @@ enum tis_defaults {
40 static LIST_HEAD(tis_chips);
41 static DEFINE_SPINLOCK(tis_lock);
44 +static int is_itpm(struct pnp_dev *dev)
46 + struct acpi_device *acpi = pnp_acpi_device(dev);
47 + struct acpi_hardware_id *id;
49 + list_for_each_entry(id, &acpi->pnp.ids, list) {
50 + if (!strcmp("INTC0102", id->id))
57 +static int is_itpm(struct pnp_dev *dev)
63 static int check_locality(struct tpm_chip *chip, int l)
65 if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
66 @@ -474,6 +495,9 @@ static int tpm_tis_init(struct device *d
67 "1.2 TPM (device-id 0x%X, rev-id %d)\n",
68 vendor >> 16, ioread8(chip->vendor.iobase + TPM_RID(0)));
70 + if (is_itpm(to_pnp_dev(dev)))
74 dev_info(dev, "Intel iTPM workaround enabled\n");