From b2e9a4397077ad56fea5a8b3f9f63ce3be65ae48 Mon Sep 17 00:00:00 2001 From: Al Stone Date: Sun, 27 Sep 2020 12:09:28 -0600 Subject: [PATCH 30/40] Support TCPA in a big-endian world Signed-off-by: Al Stone --- source/common/dmtbdump3.c | 13 ++++++++----- source/compiler/dttable2.c | 4 +++- 2 files changed, 11 insertions(+), 6 deletions(-) Index: acpica-unix2-20200925/source/common/dmtbdump3.c =================================================================== --- acpica-unix2-20200925.orig/source/common/dmtbdump3.c +++ acpica-unix2-20200925/source/common/dmtbdump3.c @@ -342,11 +342,13 @@ AcpiDmDumpTcpa ( ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR ( ACPI_TABLE_TCPA_HDR, Table, Offset); ACPI_STATUS Status; + UINT32 TableLength = AcpiUtReadUint32(&Table->Length); + UINT16 PlatformClass; /* Main table */ - Status = AcpiDmDumpTable (Table->Length, 0, Table, + Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoTcpaHdr); if (ACPI_FAILURE (Status)) { @@ -357,18 +359,19 @@ AcpiDmDumpTcpa ( * Examine the PlatformClass field to determine the table type. * Either a client or server table. Only one. */ - switch (CommonHeader->PlatformClass) + PlatformClass = AcpiUtReadUint16(&CommonHeader->PlatformClass); + switch (PlatformClass) { case ACPI_TCPA_CLIENT_TABLE: - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Status = AcpiDmDumpTable (TableLength, Offset, Subtable, Table->Length - Offset, AcpiDmTableInfoTcpaClient); break; case ACPI_TCPA_SERVER_TABLE: - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, - Table->Length - Offset, AcpiDmTableInfoTcpaServer); + Status = AcpiDmDumpTable (TableLength, Offset, Subtable, + TableLength - Offset, AcpiDmTableInfoTcpaServer); 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 @@ -1773,6 +1773,7 @@ DtCompileTcpa ( ACPI_TABLE_TCPA_HDR *TcpaHeader; DT_SUBTABLE *ParentTable; ACPI_STATUS Status; + UINT16 PlatformClass; /* Compile the main table */ @@ -1793,7 +1794,8 @@ DtCompileTcpa ( */ TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer); - switch (TcpaHeader->PlatformClass) + PlatformClass = AcpiUtReadUint16(&TcpaHeader->PlatformClass); + switch (PlatformClass) { case ACPI_TCPA_CLIENT_TABLE: