acpica-tools/0039-Support-TPM2-in-a-big-endian-world.patch
Al Stone 97df1c2ef7 Update all patches to match upstream 20211217 release
Signed-off-by: Al Stone <ahs3@redhat.com>
2022-03-18 16:08:40 -06:00

120 lines
4.1 KiB
Diff

From c240ab3af6a4ad4405def7188e3d64da06a69f37 Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 30 Sep 2020 18:42:38 -0600
Subject: [PATCH 39/45] Support TPM2 in a big-endian world
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump3.c | 18 ++++++++++--------
source/compiler/dttable2.c | 8 +++++---
2 files changed, 15 insertions(+), 11 deletions(-)
Index: acpica-unix2-20211217/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20211217.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20211217/source/common/dmtbdump3.c
@@ -475,11 +475,12 @@ AcpiDmDumpTpm2Rev3 (
ACPI_TABLE_TPM23 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM23, Table);
ACPI_TPM23_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM23_TRAILER, Table, Offset);
ACPI_STATUS Status;
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm23);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTpm23);
if (ACPI_FAILURE (Status))
{
return;
@@ -491,8 +492,8 @@ AcpiDmDumpTpm2Rev3 (
{
case ACPI_TPM23_ACPI_START_METHOD:
- (void) AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTpm23a);
+ (void) AcpiDmDumpTable (TableLength, Offset, Subtable,
+ TableLength - Offset, AcpiDmTableInfoTpm23a);
break;
default:
@@ -522,6 +523,7 @@ AcpiDmDumpTpm2 (
ACPI_TPM2_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset);
ACPI_TPM2_ARM_SMC *ArmSubtable;
ACPI_STATUS Status;
+ UINT32 TableLength = AcpiUtReadUint32 (&Table->Length);
if (Table->Revision == 3)
@@ -532,7 +534,7 @@ AcpiDmDumpTpm2 (
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTpm2);
if (ACPI_FAILURE (Status))
{
@@ -540,8 +542,8 @@ AcpiDmDumpTpm2 (
}
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
- Table->Length - Offset, AcpiDmTableInfoTpm2a);
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
+ TableLength - Offset, AcpiDmTableInfoTpm2a);
if (ACPI_FAILURE (Status))
{
return;
@@ -556,8 +558,8 @@ AcpiDmDumpTpm2 (
Offset += sizeof (ACPI_TPM2_TRAILER);
AcpiOsPrintf ("\n");
- (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable,
- Table->Length - Offset, AcpiDmTableInfoTpm211);
+ (void) AcpiDmDumpTable (TableLength, Offset, ArmSubtable,
+ TableLength - Offset, AcpiDmTableInfoTpm211);
break;
default:
Index: acpica-unix2-20211217/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20211217.orig/source/compiler/dttable2.c
+++ acpica-unix2-20211217/source/compiler/dttable2.c
@@ -2655,6 +2655,7 @@ DtCompileTpm2 (
DT_SUBTABLE *ParentTable;
ACPI_STATUS Status = AE_OK;
ACPI_TABLE_HEADER *Header;
+ UINT8 StartMethod;
ParentTable = DtPeekSubtable ();
@@ -2698,7 +2699,8 @@ DtCompileTpm2 (
/* Subtable type depends on the StartMethod */
- switch (Tpm2Header->StartMethod)
+ StartMethod = *(UINT8 *) &Tpm2Header->StartMethod;
+ switch (StartMethod)
{
case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
@@ -2729,7 +2731,7 @@ DtCompileTpm2 (
case ACPI_TPM2_RESERVED10:
AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n",
- Tpm2Header->StartMethod);
+ StartMethod);
Status = AE_ERROR;
break;
@@ -2737,7 +2739,7 @@ DtCompileTpm2 (
default:
AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n",
- Tpm2Header->StartMethod);
+ StartMethod);
Status = AE_ERROR;
break;
}