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

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