Source-Changes-HG archive

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

[src/trunk]: src/sys/dev tpm@acpi: Require only one locality's worth of regis...



details:   https://anonhg.NetBSD.org/src/rev/e57678fecaf1
branches:  trunk
changeset: 1026256:e57678fecaf1
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Nov 14 21:18:30 2021 +0000

description:
tpm@acpi: Require only one locality's worth of register space.

We don't actually use the registers for the other localities, and
some older TPMs only have the first locality exposed via ACPI.

diffstat:

 sys/dev/acpi/tpm_acpi.c |  8 ++++----
 sys/dev/ic/tpmreg.h     |  7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (51 lines):

diff -r 52bcd9623774 -r e57678fecaf1 sys/dev/acpi/tpm_acpi.c
--- a/sys/dev/acpi/tpm_acpi.c   Sun Nov 14 20:51:57 2021 +0000
+++ b/sys/dev/acpi/tpm_acpi.c   Sun Nov 14 21:18:30 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tpm_acpi.c,v 1.13 2021/01/29 15:24:00 thorpej Exp $ */
+/* $NetBSD: tpm_acpi.c,v 1.14 2021/11/14 21:18:30 riastradh 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.13 2021/01/29 15:24:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm_acpi.c,v 1.14 2021/11/14 21:18:30 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -120,8 +120,8 @@
                aprint_error_dev(self, "cannot find mem\n");
                goto out;
        }
-       if (mem->ar_length != TPM_SPACE_SIZE) {
-               aprint_error_dev(self, "wrong size mem %"PRIu64" != %u\n",
+       if (mem->ar_length < TPM_SPACE_SIZE) {
+               aprint_error_dev(self, "wrong size mem %"PRIu64" < %u\n",
                    (uint64_t)mem->ar_length, TPM_SPACE_SIZE);
                goto out;
        }
diff -r 52bcd9623774 -r e57678fecaf1 sys/dev/ic/tpmreg.h
--- a/sys/dev/ic/tpmreg.h       Sun Nov 14 20:51:57 2021 +0000
+++ b/sys/dev/ic/tpmreg.h       Sun Nov 14 21:18:30 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tpmreg.h,v 1.9 2021/05/29 08:45:29 riastradh Exp $     */
+/*     $NetBSD: tpmreg.h,v 1.10 2021/11/14 21:18:30 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -110,9 +110,10 @@
 #define        TPM_REV                         0x0f04  /* 8bit register */
 
 /*
- * Five localities, 4K per locality.
+ * Five localities, 4K per locality.  But we only use the registers for
+ * the first locality, so this is 0x1000 rather than 0x5000.
  */
-#define        TPM_SPACE_SIZE  0x5000
+#define        TPM_SPACE_SIZE  0x1000
 
 #define        TPM_TAG_RQU_COMMAND             0x00c1
 #define        TPM_TAG_RSP_COMMAND             0x00c4



Home | Main Index | Thread Index | Old Index