acpica-tools/0014-Support-most-FPDTs-in-a-big-endian-world.patch

86 lines
2.9 KiB
Diff
Raw Normal View History

From f0cba59f1ce62095cb0a0cecdf8d661b77bf2baf Mon Sep 17 00:00:00 2001
From: Al Stone <ahs3@redhat.com>
Date: Tue, 22 Sep 2020 17:51:45 -0600
Subject: [PATCH 14/40] Support most FPDTs in a big-endian world
NB: there is no support for vendor specific records even in
the little-endian version.
Signed-off-by: Al Stone <ahs3@redhat.com>
---
source/common/dmtbdump1.c | 12 +++++++-----
source/compiler/dttable1.c | 4 +++-
2 files changed, 10 insertions(+), 6 deletions(-)
Index: acpica-unix2-20200925/source/common/dmtbdump1.c
===================================================================
--- acpica-unix2-20200925.orig/source/common/dmtbdump1.c
+++ acpica-unix2-20200925/source/common/dmtbdump1.c
@@ -910,9 +910,10 @@ AcpiDmDumpFpdt (
{
ACPI_STATUS Status;
ACPI_FPDT_HEADER *Subtable;
- UINT32 Length = Table->Length;
+ UINT32 TableLength = AcpiUtReadUint32(&Table->Length);
UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
ACPI_DMTABLE_INFO *InfoTable;
+ UINT16 SubtableType;
/* There is no main table (other than the standard ACPI header) */
@@ -920,19 +921,20 @@ AcpiDmDumpFpdt (
/* Subtables */
Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
- while (Offset < Table->Length)
+ while (Offset < TableLength)
{
/* Common subtable header */
AcpiOsPrintf ("\n");
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, AcpiDmTableInfoFpdtHdr);
if (ACPI_FAILURE (Status))
{
return;
}
- switch (Subtable->Type)
+ SubtableType = AcpiUtReadUint16(&Subtable->Type);
+ switch (SubtableType)
{
case ACPI_FPDT_TYPE_BOOT:
@@ -959,7 +961,7 @@ AcpiDmDumpFpdt (
goto NextSubtable;
}
- Status = AcpiDmDumpTable (Length, Offset, Subtable,
+ Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Subtable->Length, InfoTable);
if (ACPI_FAILURE (Status))
{
Index: acpica-unix2-20200925/source/compiler/dttable1.c
===================================================================
--- acpica-unix2-20200925.orig/source/compiler/dttable1.c
+++ acpica-unix2-20200925/source/compiler/dttable1.c
@@ -1051,6 +1051,7 @@ DtCompileFpdt (
ACPI_DMTABLE_INFO *InfoTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_FIELD *SubtableStart;
+ UINT16 SubtableType;
while (*PFieldList)
@@ -1069,7 +1070,8 @@ DtCompileFpdt (
FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
- switch (FpdtHeader->Type)
+ SubtableType = AcpiUtReadUint16(&FpdtHeader->Type);
+ switch (SubtableType)
{
case ACPI_FPDT_TYPE_BOOT: