Module Name: src Committed By: thorpej Date: Sat Jan 16 01:23:04 UTC 2021
Modified Files: src/sys/dev/acpi: tpm_acpi.c Log Message: Match PNP0C31 as a TPM 1.2 device. Works on my ThinkPad X260, and eliminates the last of the devices that attach to "isa". To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/acpi/tpm_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/tpm_acpi.c diff -u src/sys/dev/acpi/tpm_acpi.c:1.11 src/sys/dev/acpi/tpm_acpi.c:1.12 --- src/sys/dev/acpi/tpm_acpi.c:1.11 Wed Oct 9 14:03:57 2019 +++ src/sys/dev/acpi/tpm_acpi.c Sat Jan 16 01:23:04 2021 @@ -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 @@ CFATTACH_DECL_NEW(tpm_acpi, sizeof(struc 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 @@ tpm_acpi_match(device_t parent, cfdata_t 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 @@ tpm_acpi_attach(device_t parent, device_ 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;