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

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