|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/4] libacpi: Build TPM2 tables for the TIS interface
TPM 2.0 can be exposed over either the CRB or TIS (FIFO) interface.
Add TIS support to libacpii's current CRB support.
An updated SSDT is needed for the 0x5000 MMIO region. Also the start
method changes.
Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
tools/libacpi/Makefile | 2 +-
tools/libacpi/acpi2_0.h | 1 +
tools/libacpi/build.c | 47 ++++++++++++++++++++++++---------
tools/libacpi/libacpi.h | 4 +++
tools/libacpi/ssdt_tpm2_tis.asl | 25 ++++++++++++++++++
5 files changed, 66 insertions(+), 13 deletions(-)
create mode 100644 tools/libacpi/ssdt_tpm2_tis.asl
diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
index 3b4c3d8c86..aa37d5662e 100644
--- a/tools/libacpi/Makefile
+++ b/tools/libacpi/Makefile
@@ -16,7 +16,7 @@ C_SRC-$(CONFIG_ARM_64) = dsdt_anycpu_arm.c
DSDT_FILES ?= $(C_SRC-y)
C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, $(DSDT_FILES))
H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h)
-H_SRC += $(addprefix $(ACPI_BUILD_DIR)/, ssdt_tpm.h ssdt_tpm2.h
ssdt_laptop_slate.h)
+H_SRC += $(addprefix $(ACPI_BUILD_DIR)/, ssdt_tpm.h ssdt_tpm2.h
ssdt_tpm2_tis.h ssdt_laptop_slate.h)
MKDSDT_CFLAGS-$(CONFIG_ARM_64) = -DCONFIG_ARM_64
MKDSDT_CFLAGS-$(CONFIG_X86) = -DCONFIG_X86
diff --git a/tools/libacpi/acpi2_0.h b/tools/libacpi/acpi2_0.h
index 51623e2a8a..759be9ba43 100644
--- a/tools/libacpi/acpi2_0.h
+++ b/tools/libacpi/acpi2_0.h
@@ -126,6 +126,7 @@ struct acpi_20_tpm2 {
uint64_t log_area_start_address;
};
#define TPM2_ACPI_CLASS_CLIENT 0
+#define TPM2_START_METHOD_MMIO 6
#define TPM2_START_METHOD_CRB 7
/*
diff --git a/tools/libacpi/build.c b/tools/libacpi/build.c
index 95188e217e..14779080a7 100644
--- a/tools/libacpi/build.c
+++ b/tools/libacpi/build.c
@@ -11,6 +11,7 @@
#include "ssdt_s4.h"
#include "ssdt_tpm.h"
#include "ssdt_tpm2.h"
+#include "ssdt_tpm2_tis.h"
#include "ssdt_pm.h"
#include "ssdt_laptop_slate.h"
#include <xen/hvm/hvm_info_table.h>
@@ -444,17 +445,30 @@ static int construct_secondary_tables(struct acpi_ctxt
*ctxt,
break;
case 2:
- /*
- * Check VID stored in bits 37:32 (3rd 16 bit word) of CRB
- * identifier register. See table 16 of TCG PC client platform
- * TPM profile specification for TPM 2.0.
- */
- if ( config->crb_id[2] == 0 || config->crb_id[2] == 0xffff )
- break;
+ if ( config->tpm_interface == ACPI_TPM_INTERFACE_TIS )
+ {
+ if ( config->tis_hdr[0] == 0 || config->tis_hdr[0] == 0xffff ||
+ config->tis_hdr[1] == 0 || config->tis_hdr[1] == 0xffff )
+ break;
- ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2), 16);
- if (!ssdt) return -1;
- memcpy(ssdt, ssdt_tpm2, sizeof(ssdt_tpm2));
+ ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2_tis), 16);
+ if (!ssdt) return -1;
+ memcpy(ssdt, ssdt_tpm2_tis, sizeof(ssdt_tpm2_tis));
+ }
+ else
+ {
+ /*
+ * Check VID stored in bits 37:32 (3rd 16 bit word) of CRB
+ * identifier register. See table 16 of TCG PC client
+ * platform TPM profile specification for TPM 2.0.
+ */
+ if ( config->crb_id[2] == 0 || config->crb_id[2] == 0xffff )
+ break;
+
+ ssdt = ctxt->mem_ops.alloc(ctxt, sizeof(ssdt_tpm2), 16);
+ if (!ssdt) return -1;
+ memcpy(ssdt, ssdt_tpm2, sizeof(ssdt_tpm2));
+ }
table_ptrs[nr_tables++] = ctxt->mem_ops.v2p(ctxt, ssdt);
tpm2 = ctxt->mem_ops.alloc(ctxt, sizeof(struct acpi_20_tpm2), 16);
@@ -471,8 +485,17 @@ static int construct_secondary_tables(struct acpi_ctxt
*ctxt,
tpm2->header.creator_id = ACPI_CREATOR_ID;
tpm2->header.creator_revision = ACPI_CREATOR_REVISION;
tpm2->platform_class = TPM2_ACPI_CLASS_CLIENT;
- tpm2->control_area_address = TPM_CRB_CTRL_REQ;
- tpm2->start_method = TPM2_START_METHOD_CRB;
+ if ( config->tpm_interface == ACPI_TPM_INTERFACE_TIS )
+ {
+ /* The FIFO interface has no control area. */
+ tpm2->control_area_address = 0;
+ tpm2->start_method = TPM2_START_METHOD_MMIO;
+ }
+ else
+ {
+ tpm2->control_area_address = TPM_CRB_CTRL_REQ;
+ tpm2->start_method = TPM2_START_METHOD_CRB;
+ }
tpm2->log_area_minimum_length = TPM_LOG_SIZE;
tpm2->log_area_start_address = TPM_LOG_AREA_ADDRESS;
diff --git a/tools/libacpi/libacpi.h b/tools/libacpi/libacpi.h
index deda39e5db..0b40896127 100644
--- a/tools/libacpi/libacpi.h
+++ b/tools/libacpi/libacpi.h
@@ -28,6 +28,9 @@
#define ACPI_HAS_CMOS_RTC (1<<14)
#define ACPI_HAS_SSDT_LAPTOP_SLATE (1<<15)
+#define ACPI_TPM_INTERFACE_CRB 0
+#define ACPI_TPM_INTERFACE_TIS 1
+
struct xen_vmemrange;
struct acpi_numa {
uint32_t nr_vmemranges;
@@ -58,6 +61,7 @@ struct acpi_config {
uint32_t table_flags;
uint8_t acpi_revision;
uint8_t tpm_version;
+ uint8_t tpm_interface; /* ACPI_TPM_INTERFACE_*, only used for TPM 2.0 */
uint64_t vm_gid[2];
unsigned long vm_gid_addr; /* OUT parameter */
diff --git a/tools/libacpi/ssdt_tpm2_tis.asl b/tools/libacpi/ssdt_tpm2_tis.asl
new file mode 100644
index 0000000000..837e50f90e
--- /dev/null
+++ b/tools/libacpi/ssdt_tpm2_tis.asl
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/*
+ * ssdt_tpm2_tis.asl
+ */
+
+/* SSDT for TPM 2.0 TIS Interface for Xen with Qemu device model. */
+
+DefinitionBlock ("SSDT_TPM2_TIS.aml", "SSDT", 2, "Xen", "HVM", 0)
+{
+ Device (TPM)
+ {
+ Name (_HID, "MSFT0101" /* TPM 2.0 Security Device */) // _HID:
Hardware ID
+ Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings
+ {
+ Memory32Fixed (ReadWrite,
+ 0xFED40000, // Address Base
+ 0x00005000, // Address Length
+ )
+ })
+ Method (_STA, 0, NotSerialized) // _STA: Status
+ {
+ Return (0x0F)
+ }
+ }
+}
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |