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

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