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

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