Blame SOURCES/0017-Support-most-FPDTs-in-a-big-endian-world.patch

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