Blame SOURCES/0050-Support-CEDT-in-a-big-endian-world.patch

82efdd
Signed-off-by: Dean Nelson <dnelson@redhat.com>
82efdd
---
82efdd
 source/common/dmtbdump1.c |   29 ++++++++++++++++-------------
82efdd
 1 file changed, 16 insertions(+), 13 deletions(-)
82efdd
82efdd
Index: acpica-unix2-20210604/source/common/dmtbdump1.c
82efdd
===================================================================
82efdd
--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c
82efdd
+++ acpica-unix2-20210604/source/common/dmtbdump1.c
82efdd
@@ -242,20 +242,23 @@ AcpiDmDumpCedt (
82efdd
 {
82efdd
     ACPI_STATUS             Status;
82efdd
     ACPI_CEDT_HEADER        *Subtable;
82efdd
-    UINT32                  Length = Table->Length;
82efdd
+    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
82efdd
     UINT32                  Offset = sizeof (ACPI_TABLE_CEDT);
82efdd
+    UINT16                  SubtableLength;
82efdd
 
82efdd
 
82efdd
     /* There is no main table (other than the standard ACPI header) */
82efdd
 
82efdd
     Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Table, Offset);
82efdd
-    while (Offset < Table->Length)
82efdd
+    while (Offset < TableLength)
82efdd
     {
82efdd
         /* Common subtable header */
82efdd
 
82efdd
+        SubtableLength = AcpiUtReadUint16 (&Subtable->Length);
82efdd
+
82efdd
         AcpiOsPrintf ("\n");
82efdd
-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
82efdd
-            Subtable->Length, AcpiDmTableInfoCedtHdr);
82efdd
+        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
82efdd
+            SubtableLength, AcpiDmTableInfoCedtHdr);
82efdd
         if (ACPI_FAILURE (Status))
82efdd
         {
82efdd
             return;
82efdd
@@ -264,8 +267,8 @@ AcpiDmDumpCedt (
82efdd
         switch (Subtable->Type)
82efdd
         {
82efdd
         case ACPI_CEDT_TYPE_CHBS:
82efdd
-            Status = AcpiDmDumpTable (Length, Offset, Subtable,
82efdd
-                Subtable->Length, AcpiDmTableInfoCedt0);
82efdd
+            Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
82efdd
+                SubtableLength, AcpiDmTableInfoCedt0);
82efdd
             if (ACPI_FAILURE (Status)) {
82efdd
                 return;
82efdd
             }
82efdd
@@ -277,8 +280,8 @@ AcpiDmDumpCedt (
82efdd
 
82efdd
             /* print out table with first "Interleave target" */
82efdd
 
82efdd
-            Status = AcpiDmDumpTable (Length, Offset, Subtable,
82efdd
-                Subtable->Length, AcpiDmTableInfoCedt1);
82efdd
+            Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
82efdd
+                SubtableLength, AcpiDmTableInfoCedt1);
82efdd
             if (ACPI_FAILURE (Status)) {
82efdd
                 return;
82efdd
             }
82efdd
@@ -288,8 +291,8 @@ AcpiDmDumpCedt (
82efdd
             for (i = 1; i < max; i++) {
82efdd
                 unsigned int loc_offset = Offset + (i * 4) + ACPI_OFFSET(ACPI_CEDT_CFMWS, InterleaveTargets);
82efdd
                 unsigned int *trg = &(ptr->InterleaveTargets[i]);
82efdd
-                Status = AcpiDmDumpTable (Length, loc_offset, trg,
82efdd
-                        Subtable->Length, AcpiDmTableInfoCedt1_te);
82efdd
+                Status = AcpiDmDumpTable (TableLength, loc_offset, trg,
82efdd
+                        SubtableLength, AcpiDmTableInfoCedt1_te);
82efdd
                 if (ACPI_FAILURE (Status)) {
82efdd
                     return;
82efdd
                 }
82efdd
@@ -302,7 +305,7 @@ AcpiDmDumpCedt (
82efdd
                 Subtable->Type);
82efdd
 
82efdd
             /* Attempt to continue */
82efdd
-            if (!Subtable->Length)
82efdd
+            if (!SubtableLength)
82efdd
             {
82efdd
                 AcpiOsPrintf ("Invalid zero length subtable\n");
82efdd
                 return;
82efdd
@@ -310,9 +313,9 @@ AcpiDmDumpCedt (
82efdd
         }
82efdd
 
82efdd
         /* Point to next subtable */
82efdd
-        Offset += Subtable->Length;
82efdd
+        Offset += SubtableLength;
82efdd
         Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable,
82efdd
-            Subtable->Length);
82efdd
+            SubtableLength);
82efdd
     }
82efdd
 }
82efdd