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

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