]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.36.4/tpm-autodetect-itpm-devices.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.4 / tpm-autodetect-itpm-devices.patch
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
5
6 From: Matthew Garrett <mjg@redhat.com>
7
8 commit 3f0d3d016d89a5efb8b926d4707eb21fa13f3d27 upstream.
9
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.
17
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>
24
25 ---
26 drivers/char/tpm/tpm_tis.c | 24 ++++++++++++++++++++++++
27 1 file changed, 24 insertions(+)
28
29 --- a/drivers/char/tpm/tpm_tis.c
30 +++ b/drivers/char/tpm/tpm_tis.c
31 @@ -25,6 +25,7 @@
32 #include <linux/slab.h>
33 #include <linux/interrupt.h>
34 #include <linux/wait.h>
35 +#include <linux/acpi.h>
36 #include "tpm.h"
37
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);
42
43 +#ifdef CONFIG_ACPI
44 +static int is_itpm(struct pnp_dev *dev)
45 +{
46 + struct acpi_device *acpi = pnp_acpi_device(dev);
47 + struct acpi_hardware_id *id;
48 +
49 + list_for_each_entry(id, &acpi->pnp.ids, list) {
50 + if (!strcmp("INTC0102", id->id))
51 + return 1;
52 + }
53 +
54 + return 0;
55 +}
56 +#else
57 +static int is_itpm(struct pnp_dev *dev)
58 +{
59 + return 0;
60 +}
61 +#endif
62 +
63 static int check_locality(struct tpm_chip *chip, int l)
64 {
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)));
69
70 + if (is_itpm(to_pnp_dev(dev)))
71 + itpm = 1;
72 +
73 if (itpm)
74 dev_info(dev, "Intel iTPM workaround enabled\n");
75