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

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