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