Blame SOURCES/0040-Support-S3PT-in-a-big-endian-world.patch

214d7a
From 9fc0e46189feb926b13713422ea2722e273a31b5 Mon Sep 17 00:00:00 2001
214d7a
From: Al Stone <ahs3@redhat.com>
214d7a
Date: Mon, 19 Oct 2020 17:30:30 -0400
214d7a
Subject: [PATCH 40/45] Support S3PT in a big-endian world
214d7a
214d7a
---
214d7a
 source/common/dmtbdump2.c  | 15 +++++++++------
214d7a
 source/compiler/dttable2.c |  4 +++-
214d7a
 2 files changed, 12 insertions(+), 7 deletions(-)
214d7a
214d7a
Index: acpica-unix2-20210604/source/common/dmtbdump2.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c
214d7a
+++ acpica-unix2-20210604/source/common/dmtbdump2.c
214d7a
@@ -2039,6 +2039,8 @@ AcpiDmDumpS3pt (
214d7a
     ACPI_FPDT_HEADER        *Subtable;
214d7a
     ACPI_DMTABLE_INFO       *InfoTable;
214d7a
     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
214d7a
+    UINT32                  S3ptTableLength = AcpiUtReadUint32 (&S3ptTable->Length);
214d7a
+    UINT16                  SubtableType;
214d7a
 
214d7a
 
214d7a
     /* Main table */
214d7a
@@ -2050,19 +2052,20 @@ AcpiDmDumpS3pt (
214d7a
     }
214d7a
 
214d7a
     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
214d7a
-    while (Offset < S3ptTable->Length)
214d7a
+    while (Offset < S3ptTableLength)
214d7a
     {
214d7a
         /* Common subtable header */
214d7a
 
214d7a
         AcpiOsPrintf ("\n");
214d7a
-        Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
214d7a
+        Status = AcpiDmDumpTable (S3ptTableLength, Offset, Subtable,
214d7a
             Subtable->Length, AcpiDmTableInfoS3ptHdr);
214d7a
         if (ACPI_FAILURE (Status))
214d7a
         {
214d7a
             return 0;
214d7a
         }
214d7a
 
214d7a
-        switch (Subtable->Type)
214d7a
+        SubtableType = AcpiUtReadUint16 (&Subtable->Type);
214d7a
+        switch (SubtableType)
214d7a
         {
214d7a
         case ACPI_S3PT_TYPE_RESUME:
214d7a
 
214d7a
@@ -2077,7 +2080,7 @@ AcpiDmDumpS3pt (
214d7a
         default:
214d7a
 
214d7a
             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
214d7a
-                Subtable->Type);
214d7a
+                SubtableType);
214d7a
 
214d7a
             /* Attempt to continue */
214d7a
 
214d7a
@@ -2090,7 +2093,7 @@ AcpiDmDumpS3pt (
214d7a
         }
214d7a
 
214d7a
         AcpiOsPrintf ("\n");
214d7a
-        Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
214d7a
+        Status = AcpiDmDumpTable (S3ptTableLength, Offset, Subtable,
214d7a
             Subtable->Length, InfoTable);
214d7a
         if (ACPI_FAILURE (Status))
214d7a
         {
214d7a
@@ -2104,7 +2107,7 @@ NextSubtable:
214d7a
         Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length);
214d7a
     }
214d7a
 
214d7a
-    return (S3ptTable->Length);
214d7a
+    return (S3ptTableLength);
214d7a
 }
214d7a
 
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/compiler/dttable2.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/dttable2.c
214d7a
+++ acpica-unix2-20210604/source/compiler/dttable2.c
214d7a
@@ -1406,6 +1406,7 @@ DtCompileS3pt (
214d7a
     DT_SUBTABLE             *ParentTable;
214d7a
     ACPI_DMTABLE_INFO       *InfoTable;
214d7a
     DT_FIELD                *SubtableStart;
214d7a
+    UINT16                  S3ptHeaderType;
214d7a
 
214d7a
 
214d7a
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
214d7a
@@ -1433,7 +1434,8 @@ DtCompileS3pt (
214d7a
 
214d7a
         S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
214d7a
 
214d7a
-        switch (S3ptHeader->Type)
214d7a
+        S3ptHeaderType = AcpiUtReadUint16 (&S3ptHeader->Type);
214d7a
+        switch (S3ptHeaderType)
214d7a
         {
214d7a
         case ACPI_S3PT_TYPE_RESUME:
214d7a