Blame SOURCES/0023-Support-SLIT-in-a-big-endian-world.patch

214d7a
From b11d50752feb9f1b52db076d1fb4753b30a53642 Mon Sep 17 00:00:00 2001
214d7a
From: Al Stone <ahs3@redhat.com>
214d7a
Date: Wed, 23 Sep 2020 12:49:52 -0600
214d7a
Subject: [PATCH 23/45] Support SLIT in a big-endian world
214d7a
214d7a
Signed-off-by: Al Stone <ahs3@redhat.com>
214d7a
---
214d7a
 source/common/dmtbdump3.c  | 8 +++++---
214d7a
 source/compiler/dttable2.c | 2 +-
214d7a
 2 files changed, 6 insertions(+), 4 deletions(-)
214d7a
214d7a
Index: acpica-unix2-20210604/source/common/dmtbdump3.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c
214d7a
+++ acpica-unix2-20210604/source/common/dmtbdump3.c
214d7a
@@ -96,11 +96,12 @@ AcpiDmDumpSlit (
214d7a
     UINT32                  Localities;
214d7a
     UINT32                  i;
214d7a
     UINT32                  j;
214d7a
+    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
214d7a
 
214d7a
 
214d7a
     /* Main table */
214d7a
 
214d7a
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
214d7a
+    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoSlit);
214d7a
     if (ACPI_FAILURE (Status))
214d7a
     {
214d7a
         return;
214d7a
@@ -108,7 +109,8 @@ AcpiDmDumpSlit (
214d7a
 
214d7a
     /* Display the Locality NxN Matrix */
214d7a
 
214d7a
-    Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
214d7a
+    Localities = (UINT32)
214d7a
+        AcpiUtReadUint64 (&ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount);
214d7a
     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
214d7a
     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
214d7a
 
214d7a
@@ -121,7 +123,7 @@ AcpiDmDumpSlit (
214d7a
         {
214d7a
             /* Check for beyond EOT */
214d7a
 
214d7a
-            if (Offset >= Table->Length)
214d7a
+            if (Offset >= TableLength)
214d7a
             {
214d7a
                 AcpiOsPrintf (
214d7a
                     "\n**** Not enough room in table for all localities\n");
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
@@ -1837,7 +1837,7 @@ DtCompileSlit (
214d7a
     ParentTable = DtPeekSubtable ();
214d7a
     DtInsertSubtable (ParentTable, Subtable);
214d7a
 
214d7a
-    Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
214d7a
+    Localities = (UINT32) AcpiUtReadUint64 (Subtable->Buffer);
214d7a
     LocalityBuffer = UtLocalCalloc (Localities);
214d7a
     LocalityListLength = 0;
214d7a