Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Match PNP0C31 as a TPM 1.2 device. Works on my...



details:   https://anonhg.NetBSD.org/src/rev/bdbb46bbbb6d
branches:  trunk
changeset: 979878:bdbb46bbbb6d
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Jan 16 01:23:04 2021 +0000

description:
Match PNP0C31 as a TPM 1.2 device.  Works on my ThinkPad X260, and
eliminates the last of the devices that attach to "isa".

diffstat:

 sys/dev/acpi/tpm_acpi.c |  23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diffs (58 lines):

diff -r 63f7873716bc -r bdbb46bbbb6d sys/dev/acpi/tpm_acpi.c
--- a/sys/dev/acpi/tpm_acpi.c   Sat Jan 16 00:43:03 2021 +0000
+++ b/sys/dev/acpi/tpm_acpi.c   Sat Jan 16 01:23:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tpm_acpi.c,v 1.11 2019/10/09 14:03:57 maxv Exp $ */
+/* $NetBSD: tpm_acpi.c,v 1.12 2021/01/16 01:23:04 thorpej Exp $ */
 
 /*
  * Copyright (c) 2012, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tpm_acpi.c,v 1.11 2019/10/09 14:03:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm_acpi.c,v 1.12 2021/01/16 01:23:04 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -56,6 +56,14 @@
     tpm_acpi_attach, NULL, NULL);
 
 /*
+ * Supported TPM 1.2 devices.
+ */
+static const char * const tpm_1_2_acpi_ids[] = {
+       "PNP0C31",
+       NULL
+};
+
+/*
  * Supported TPM 2.0 devices.
  */
 static const char * const tpm2_acpi_ids[] = {
@@ -77,6 +85,11 @@
        if (tpm_cd.cd_devs && tpm_cd.cd_devs[0])
                return 0;
 
+       if (acpi_match_hid(aa->aa_node->ad_devinfo, tpm_1_2_acpi_ids)) {
+               /* XXX assume TPM 1.2 devices are memory-mapped. */
+               return 1;
+       }
+
        if (!acpi_match_hid(aa->aa_node->ad_devinfo, tpm2_acpi_ids))
                return 0;
 
@@ -122,7 +135,11 @@
        size = mem->ar_length;
 
        sc->sc_dev = self;
-       sc->sc_ver = TPM_2_0;
+       if (acpi_match_hid(aa->aa_node->ad_devinfo, tpm_1_2_acpi_ids)) {
+               sc->sc_ver = TPM_1_2;
+       } else {
+               sc->sc_ver = TPM_2_0;
+       }
        mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_NONE);
        sc->sc_busy = false;
        sc->sc_intf = &tpm_intf_tis12;



Home | Main Index | Thread Index | Old Index