Blame SOURCES/0030-Support-PPTT-in-a-big-endian-world.patch

9897bb
From 8923211d8bc1b0e4d3af6ff31ed6479057f612f6 Mon Sep 17 00:00:00 2001
9897bb
From: Al Stone <ahs3@redhat.com>
9897bb
Date: Fri, 25 Sep 2020 17:16:12 -0600
9897bb
Subject: [PATCH 30/45] Support PPTT in a big-endian world
9897bb
9897bb
Signed-off-by: Al Stone <ahs3@redhat.com>
9897bb
---
9897bb
 source/common/dmtbdump2.c  | 17 ++++++++++-------
9897bb
 source/compiler/dttable2.c |  7 +++++--
9897bb
 2 files changed, 15 insertions(+), 9 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
@@ -1785,6 +1785,8 @@ AcpiDmDumpPptt (
9897bb
     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
9897bb
     ACPI_DMTABLE_INFO       *InfoTable;
9897bb
     UINT32                  i;
9897bb
+    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
9897bb
+    UINT32                  NumPrivRes;
9897bb
 
9897bb
 
9897bb
     /* There is no main table (other than the standard ACPI header) */
9897bb
@@ -1792,7 +1794,7 @@ AcpiDmDumpPptt (
9897bb
     /* Subtables */
9897bb
 
9897bb
     Offset = sizeof (ACPI_TABLE_HEADER);
9897bb
-    while (Offset < Table->Length)
9897bb
+    while (Offset < TableLength)
9897bb
     {
9897bb
         AcpiOsPrintf ("\n");
9897bb
 
9897bb
@@ -1804,7 +1806,7 @@ AcpiDmDumpPptt (
9897bb
             AcpiOsPrintf ("Invalid subtable length\n");
9897bb
             return;
9897bb
         }
9897bb
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
9897bb
+        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
9897bb
             Subtable->Length, AcpiDmTableInfoPpttHdr);
9897bb
         if (ACPI_FAILURE (Status))
9897bb
         {
9897bb
@@ -1846,7 +1848,7 @@ AcpiDmDumpPptt (
9897bb
             AcpiOsPrintf ("Invalid subtable length\n");
9897bb
             return;
9897bb
         }
9897bb
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
9897bb
+        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
9897bb
             Subtable->Length, InfoTable);
9897bb
         if (ACPI_FAILURE (Status))
9897bb
         {
9897bb
@@ -1862,15 +1864,16 @@ AcpiDmDumpPptt (
9897bb
 
9897bb
             /* Dump SMBIOS handles */
9897bb
 
9897bb
-            if ((UINT8)(Subtable->Length - SubtableOffset) <
9897bb
-                (UINT8)(PpttProcessor->NumberOfPrivResources * 4))
9897bb
+            NumPrivRes = AcpiUtReadUint32 (&PpttProcessor->NumberOfPrivResources);
9897bb
+            if ((UINT8) (Subtable->Length - SubtableOffset) <
9897bb
+                (UINT8) (NumPrivRes * 4))
9897bb
             {
9897bb
                 AcpiOsPrintf ("Invalid private resource number\n");
9897bb
                 return;
9897bb
             }
9897bb
-            for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++)
9897bb
+            for (i = 0; i < NumPrivRes; i++)
9897bb
             {
9897bb
-                Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset,
9897bb
+                Status = AcpiDmDumpTable (TableLength, Offset + SubtableOffset,
9897bb
                     ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset),
9897bb
                     4, AcpiDmTableInfoPptt0a);
9897bb
                 if (ACPI_FAILURE (Status))
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
@@ -1123,6 +1123,7 @@ DtCompilePptt (
9897bb
     DT_FIELD                **PFieldList = (DT_FIELD **) List;
9897bb
     DT_FIELD                *SubtableStart;
9897bb
     ACPI_TABLE_HEADER       *PpttAcpiHeader;
9897bb
+    UINT32                  NumPrivRes;
9897bb
 
9897bb
 
9897bb
     ParentTable = DtPeekSubtable ();
9897bb
@@ -1187,7 +1188,7 @@ DtCompilePptt (
9897bb
             {
9897bb
                 /* Compile initiator proximity domain list */
9897bb
 
9897bb
-                PpttProcessor->NumberOfPrivResources = 0;
9897bb
+                NumPrivRes = 0;
9897bb
                 while (*PFieldList)
9897bb
                 {
9897bb
                     Status = DtCompileTable (PFieldList,
9897bb
@@ -1203,8 +1204,10 @@ DtCompilePptt (
9897bb
 
9897bb
                     DtInsertSubtable (ParentTable, Subtable);
9897bb
                     PpttHeader->Length += (UINT8)(Subtable->Length);
9897bb
-                    PpttProcessor->NumberOfPrivResources++;
9897bb
+                    NumPrivRes++;
9897bb
                 }
9897bb
+                PpttProcessor->NumberOfPrivResources =
9897bb
+                        AcpiUtReadUint32 (&NumPrivRes);
9897bb
             }
9897bb
             break;
9897bb