Blame SOURCES/0018-Support-GTDT-in-a-big-endian-world.patch

214d7a
From 492e41a24fd088c7ab609ee8ad518f69c9cd29e3 Mon Sep 17 00:00:00 2001
214d7a
From: Al Stone <ahs3@redhat.com>
214d7a
Date: Tue, 22 Sep 2020 18:12:01 -0600
214d7a
Subject: [PATCH 18/45] Support GTDT in a big-endian world
214d7a
214d7a
Signed-off-by: Al Stone <ahs3@redhat.com>
214d7a
---
214d7a
 source/common/dmtbdump1.c  | 13 +++++++++----
214d7a
 source/compiler/dttable1.c |  9 +++++++--
214d7a
 2 files changed, 16 insertions(+), 6 deletions(-)
214d7a
214d7a
Index: acpica-unix2-20210604/source/common/dmtbdump1.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmtbdump1.c
214d7a
+++ acpica-unix2-20210604/source/common/dmtbdump1.c
214d7a
@@ -1075,7 +1075,7 @@ AcpiDmDumpGtdt (
214d7a
 {
214d7a
     ACPI_STATUS             Status;
214d7a
     ACPI_GTDT_HEADER        *Subtable;
214d7a
-    UINT32                  Length = Table->Length;
214d7a
+    UINT32                  Length = AcpiUtReadUint32 (&Table->Length);
214d7a
     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
214d7a
     ACPI_DMTABLE_INFO       *InfoTable;
214d7a
     UINT32                  SubtableLength;
214d7a
@@ -1111,7 +1111,7 @@ AcpiDmDumpGtdt (
214d7a
 
214d7a
     /* Subtables */
214d7a
 
214d7a
-    while (Offset < Table->Length)
214d7a
+    while (Offset < Length)
214d7a
     {
214d7a
         /* Common subtable header */
214d7a
 
214d7a
@@ -1129,8 +1129,13 @@ AcpiDmDumpGtdt (
214d7a
         case ACPI_GTDT_TYPE_TIMER_BLOCK:
214d7a
 
214d7a
             SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
214d7a
-            GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
214d7a
-                Subtable))->TimerCount;
214d7a
+            {
214d7a
+                UINT32 Tmp32;
214d7a
+
214d7a
+                Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
214d7a
+                    Subtable))->TimerCount;
214d7a
+                GtCount = AcpiUtReadUint32 (&Tmp32);
214d7a
+            }
214d7a
 
214d7a
             InfoTable = AcpiDmTableInfoGtdt0;
214d7a
             break;
214d7a
Index: acpica-unix2-20210604/source/compiler/dttable1.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/dttable1.c
214d7a
+++ acpica-unix2-20210604/source/compiler/dttable1.c
214d7a
@@ -1071,8 +1071,13 @@ DtCompileGtdt (
214d7a
             DtPushSubtable (Subtable);
214d7a
             ParentTable = DtPeekSubtable ();
214d7a
 
214d7a
-            GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
214d7a
-                Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
214d7a
+            {
214d7a
+                UINT32 Tmp32;
214d7a
+
214d7a
+                Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
214d7a
+                    Subtable->Buffer - sizeof (ACPI_GTDT_HEADER)))->TimerCount;
214d7a
+                GtCount = AcpiUtReadUint32 (&Tmp32);
214d7a
+            }
214d7a
 
214d7a
             while (GtCount)
214d7a
             {