acpica-tools/0038-Support-TPM2-in-a-big-endian-world.patch
DistroBaker 80dc240519 Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/acpica-tools.git#defe2b64332fc44bf9915c8f57d2614c529cdb43
2020-10-31 12:18:15 +01:00

120 lines
4.1 KiB
Diff

From 1e1129d788087025cf31b0c3babdb9bca01f1c4e Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Wed, 30 Sep 2020 18:42:38 -0600
Subject: [PATCH 38/40] 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-20200925/source/common/dmtbdump3.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump3.c
+++ acpica-unix2-20200925/source/common/dmtbdump3.c
@@ -409,11 +409,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;
@@ -425,8 +426,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:
@@ -456,6 +457,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)
@@ -466,7 +468,7 @@ AcpiDmDumpTpm2 (
/* Main table */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2);
+ Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTpm2);
if (ACPI_FAILURE (Status))
{
@@ -474,8 +476,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;
@@ -490,8 +492,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-20200925/source/compiler/dttable2.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable2.c
+++ acpica-unix2-20200925/source/compiler/dttable2.c
@@ -1904,6 +1904,7 @@ DtCompileTpm2 (
DT_SUBTABLE *ParentTable;
ACPI_STATUS Status = AE_OK;
ACPI_TABLE_HEADER *Header;
+ UINT8 StartMethod;
ParentTable = DtPeekSubtable ();
@@ -1947,7 +1948,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:
@@ -1978,7 +1980,7 @@ DtCompileTpm2 (
case ACPI_TPM2_RESERVED10:
AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n",
- Tpm2Header->StartMethod);
+ StartMethod);
Status = AE_ERROR;
break;
@@ -1986,7 +1988,7 @@ DtCompileTpm2 (
default:
AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n",
- Tpm2Header->StartMethod);
+ StartMethod);
Status = AE_ERROR;
break;
}