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

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