Module Name:    src
Committed By:   riastradh
Date:           Sun Nov 14 21:18:30 UTC 2021

Modified Files:
        src/sys/dev/acpi: tpm_acpi.c
        src/sys/dev/ic: tpmreg.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/tpm_acpi.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/tpmreg.h

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.13 src/sys/dev/acpi/tpm_acpi.c:1.14
--- src/sys/dev/acpi/tpm_acpi.c:1.13	Fri Jan 29 15:24:00 2021
+++ src/sys/dev/acpi/tpm_acpi.c	Sun Nov 14 21:18:30 2021
@@ -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 @@ tpm_acpi_attach(device_t parent, device_
 		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;
 	}

Index: src/sys/dev/ic/tpmreg.h
diff -u src/sys/dev/ic/tpmreg.h:1.9 src/sys/dev/ic/tpmreg.h:1.10
--- src/sys/dev/ic/tpmreg.h:1.9	Sat May 29 08:45:29 2021
+++ src/sys/dev/ic/tpmreg.h	Sun Nov 14 21:18:30 2021
@@ -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 @@ struct tpm_header {
 #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

Reply via email to