|
|
214d7a |
From c240ab3af6a4ad4405def7188e3d64da06a69f37 Mon Sep 17 00:00:00 2001
|
|
|
214d7a |
From: Al Stone <ahs3@redhat.com>
|
|
|
214d7a |
Date: Wed, 30 Sep 2020 18:42:38 -0600
|
|
|
214d7a |
Subject: [PATCH 39/45] Support TPM2 in a big-endian world
|
|
|
214d7a |
|
|
|
214d7a |
Signed-off-by: Al Stone <ahs3@redhat.com>
|
|
|
214d7a |
---
|
|
|
214d7a |
source/common/dmtbdump3.c | 18 ++++++++++--------
|
|
|
214d7a |
source/compiler/dttable2.c | 8 +++++---
|
|
|
214d7a |
2 files changed, 15 insertions(+), 11 deletions(-)
|
|
|
214d7a |
|
|
|
214d7a |
Index: acpica-unix2-20210604/source/common/dmtbdump3.c
|
|
|
214d7a |
===================================================================
|
|
|
214d7a |
--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c
|
|
|
214d7a |
+++ acpica-unix2-20210604/source/common/dmtbdump3.c
|
|
|
214d7a |
@@ -470,11 +470,12 @@ AcpiDmDumpTpm2Rev3 (
|
|
|
214d7a |
ACPI_TABLE_TPM23 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM23, Table);
|
|
|
214d7a |
ACPI_TPM23_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM23_TRAILER, Table, Offset);
|
|
|
214d7a |
ACPI_STATUS Status;
|
|
|
214d7a |
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
|
|
|
214d7a |
|
|
|
214d7a |
|
|
|
214d7a |
/* Main table */
|
|
|
214d7a |
|
|
|
214d7a |
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm23);
|
|
|
214d7a |
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTpm23);
|
|
|
214d7a |
if (ACPI_FAILURE (Status))
|
|
|
214d7a |
{
|
|
|
214d7a |
return;
|
|
|
214d7a |
@@ -486,8 +487,8 @@ AcpiDmDumpTpm2Rev3 (
|
|
|
214d7a |
{
|
|
|
214d7a |
case ACPI_TPM23_ACPI_START_METHOD:
|
|
|
214d7a |
|
|
|
214d7a |
- (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
|
|
|
214d7a |
- Table->Length - Offset, AcpiDmTableInfoTpm23a);
|
|
|
214d7a |
+ (void) AcpiDmDumpTable (TableLength, Offset, Subtable,
|
|
|
214d7a |
+ TableLength - Offset, AcpiDmTableInfoTpm23a);
|
|
|
214d7a |
break;
|
|
|
214d7a |
|
|
|
214d7a |
default:
|
|
|
214d7a |
@@ -517,6 +518,7 @@ AcpiDmDumpTpm2 (
|
|
|
214d7a |
ACPI_TPM2_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
|
|
|
214d7a |
ACPI_TPM2_ARM_SMC *ArmSubtable;
|
|
|
214d7a |
ACPI_STATUS Status;
|
|
|
214d7a |
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
|
|
|
214d7a |
|
|
|
214d7a |
|
|
|
214d7a |
if (Table->Revision == 3)
|
|
|
214d7a |
@@ -527,7 +529,7 @@ AcpiDmDumpTpm2 (
|
|
|
214d7a |
|
|
|
214d7a |
/* Main table */
|
|
|
214d7a |
|
|
|
214d7a |
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
|
|
|
214d7a |
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTpm2);
|
|
|
214d7a |
|
|
|
214d7a |
if (ACPI_FAILURE (Status))
|
|
|
214d7a |
{
|
|
|
214d7a |
@@ -535,8 +537,8 @@ AcpiDmDumpTpm2 (
|
|
|
214d7a |
}
|
|
|
214d7a |
|
|
|
214d7a |
AcpiOsPrintf ("\n");
|
|
|
214d7a |
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
|
|
|
214d7a |
- Table->Length - Offset, AcpiDmTableInfoTpm2a);
|
|
|
214d7a |
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
|
|
|
214d7a |
+ TableLength - Offset, AcpiDmTableInfoTpm2a);
|
|
|
214d7a |
if (ACPI_FAILURE (Status))
|
|
|
214d7a |
{
|
|
|
214d7a |
return;
|
|
|
214d7a |
@@ -551,8 +553,8 @@ AcpiDmDumpTpm2 (
|
|
|
214d7a |
Offset += sizeof (ACPI_TPM2_TRAILER);
|
|
|
214d7a |
|
|
|
214d7a |
AcpiOsPrintf ("\n");
|
|
|
214d7a |
- (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
|
|
|
214d7a |
- Table->Length - Offset, AcpiDmTableInfoTpm211);
|
|
|
214d7a |
+ (void) AcpiDmDumpTable (TableLength, Offset, ArmSubtable,
|
|
|
214d7a |
+ TableLength - Offset, AcpiDmTableInfoTpm211);
|
|
|
214d7a |
break;
|
|
|
214d7a |
|
|
|
214d7a |
default:
|
|
|
214d7a |
Index: acpica-unix2-20210604/source/compiler/dttable2.c
|
|
|
214d7a |
===================================================================
|
|
|
214d7a |
--- acpica-unix2-20210604.orig/source/compiler/dttable2.c
|
|
|
214d7a |
+++ acpica-unix2-20210604/source/compiler/dttable2.c
|
|
|
214d7a |
@@ -2267,6 +2267,7 @@ DtCompileTpm2 (
|
|
|
214d7a |
DT_SUBTABLE *ParentTable;
|
|
|
214d7a |
ACPI_STATUS Status = AE_OK;
|
|
|
214d7a |
ACPI_TABLE_HEADER *Header;
|
|
|
214d7a |
+ UINT8 StartMethod;
|
|
|
214d7a |
|
|
|
214d7a |
|
|
|
214d7a |
ParentTable = DtPeekSubtable ();
|
|
|
214d7a |
@@ -2310,7 +2311,8 @@ DtCompileTpm2 (
|
|
|
214d7a |
|
|
|
214d7a |
/* Subtable type depends on the StartMethod */
|
|
|
214d7a |
|
|
|
214d7a |
- switch (Tpm2Header->StartMethod)
|
|
|
214d7a |
+ StartMethod = *(UINT8 *) &Tpm2Header->StartMethod;
|
|
|
214d7a |
+ switch (StartMethod)
|
|
|
214d7a |
{
|
|
|
214d7a |
case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
|
|
|
214d7a |
|
|
|
214d7a |
@@ -2341,7 +2343,7 @@ DtCompileTpm2 (
|
|
|
214d7a |
case ACPI_TPM2_RESERVED10:
|
|
|
214d7a |
|
|
|
214d7a |
AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n",
|
|
|
214d7a |
- Tpm2Header->StartMethod);
|
|
|
214d7a |
+ StartMethod);
|
|
|
214d7a |
Status = AE_ERROR;
|
|
|
214d7a |
break;
|
|
|
214d7a |
|
|
|
214d7a |
@@ -2349,7 +2351,7 @@ DtCompileTpm2 (
|
|
|
214d7a |
default:
|
|
|
214d7a |
|
|
|
214d7a |
AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n",
|
|
|
214d7a |
- Tpm2Header->StartMethod);
|
|
|
214d7a |
+ StartMethod);
|
|
|
214d7a |
Status = AE_ERROR;
|
|
|
214d7a |
break;
|
|
|
214d7a |
}
|