Blame SOURCES/0038-Support-PMTT-in-a-big-endian-world.patch

214d7a
From bd19995fa268ed3e93c071162d0e9c2d35ada0d4 Mon Sep 17 00:00:00 2001
214d7a
From: Al Stone <ahs3@redhat.com>
214d7a
Date: Tue, 29 Jun 2021 16:23:30 -0600
214d7a
Subject: [PATCH 38/45] Support PMTT in a big-endian world
214d7a
214d7a
Signed-off-by: Al Stone <ahs3@redhat.com>
214d7a
---
214d7a
 source/common/dmtbdump2.c | 18 ++++++++++--------
214d7a
 1 file changed, 10 insertions(+), 8 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
@@ -1686,8 +1686,9 @@ AcpiDmDumpPmtt (
214d7a
 {
214d7a
     ACPI_STATUS             Status;
214d7a
     ACPI_PMTT_HEADER        *Subtable;
214d7a
-    UINT32                  Length = Table->Length;
214d7a
+    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
214d7a
     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
214d7a
+    UINT16                  SubtableLength;
214d7a
 
214d7a
 
214d7a
     /* Main table */
214d7a
@@ -1701,17 +1702,18 @@ AcpiDmDumpPmtt (
214d7a
     /* Subtables */
214d7a
 
214d7a
     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
214d7a
-    while (Offset < Table->Length)
214d7a
+    while (Offset < Length)
214d7a
     {
214d7a
         /* Each of the types below contain the common subtable header */
214d7a
 
214d7a
         AcpiOsPrintf ("\n");
214d7a
+	SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
214d7a
         switch (Subtable->Type)
214d7a
         {
214d7a
         case ACPI_PMTT_TYPE_SOCKET:
214d7a
 
214d7a
             Status = AcpiDmDumpTable (Length, Offset, Subtable,
214d7a
-                Subtable->Length, AcpiDmTableInfoPmtt0);
214d7a
+                SubtableLength, AcpiDmTableInfoPmtt0);
214d7a
             if (ACPI_FAILURE (Status))
214d7a
             {
214d7a
                 return;
214d7a
@@ -1720,7 +1722,7 @@ AcpiDmDumpPmtt (
214d7a
 
214d7a
         case ACPI_PMTT_TYPE_CONTROLLER:
214d7a
             Status = AcpiDmDumpTable (Length, Offset, Subtable,
214d7a
-                Subtable->Length, AcpiDmTableInfoPmtt1);
214d7a
+                SubtableLength, AcpiDmTableInfoPmtt1);
214d7a
             if (ACPI_FAILURE (Status))
214d7a
             {
214d7a
                 return;
214d7a
@@ -1729,7 +1731,7 @@ AcpiDmDumpPmtt (
214d7a
 
214d7a
        case ACPI_PMTT_TYPE_DIMM:
214d7a
             Status = AcpiDmDumpTable (Length, Offset, Subtable,
214d7a
-                Subtable->Length, AcpiDmTableInfoPmtt2);
214d7a
+                SubtableLength, AcpiDmTableInfoPmtt2);
214d7a
             if (ACPI_FAILURE (Status))
214d7a
             {
214d7a
                 return;
214d7a
@@ -1738,7 +1740,7 @@ AcpiDmDumpPmtt (
214d7a
 
214d7a
         case ACPI_PMTT_TYPE_VENDOR:
214d7a
             Status = AcpiDmDumpTable (Length, Offset, Subtable,
214d7a
-                Subtable->Length, AcpiDmTableInfoPmttVendor);
214d7a
+                SubtableLength, AcpiDmTableInfoPmttVendor);
214d7a
             if (ACPI_FAILURE (Status))
214d7a
             {
214d7a
                 return;
214d7a
@@ -1754,9 +1756,9 @@ AcpiDmDumpPmtt (
214d7a
 
214d7a
         /* Point to next subtable */
214d7a
 
214d7a
-        Offset += Subtable->Length;
214d7a
+        Offset += SubtableLength;
214d7a
         Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
214d7a
-            Subtable, Subtable->Length);
214d7a
+            Subtable, SubtableLength);
214d7a
     }
214d7a
 }
214d7a