Blame SOURCES/0047-Support-PRMT-in-a-big-endian-world.patch

82efdd
Signed-off-by: Dean Nelson <dnelson@redhat.com>
82efdd
Reviewed-by: Al Stone <ahs3@redhat.com>
82efdd
---
82efdd
 source/common/dmtbdump2.c  |   11 ++++++-----
82efdd
 source/compiler/dttable2.c |    4 ++--
82efdd
 2 files changed, 8 insertions(+), 7 deletions(-)
82efdd
82efdd
Index: acpica-unix2-20210604/source/common/dmtbdump2.c
82efdd
===================================================================
82efdd
--- acpica-unix2-20210604.orig/source/common/dmtbdump2.c
82efdd
+++ acpica-unix2-20210604/source/common/dmtbdump2.c
82efdd
@@ -1959,13 +1959,14 @@ AcpiDmDumpPrmt (
82efdd
     ACPI_PRMT_MODULE_INFO   *PrmtModuleInfo;
82efdd
     ACPI_PRMT_HANDLER_INFO  *PrmtHandlerInfo;
82efdd
     ACPI_STATUS             Status;
82efdd
+    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
82efdd
     UINT32                  i, j;
82efdd
 
82efdd
 
82efdd
     /* Main table header */
82efdd
 
82efdd
     PrmtHeader = ACPI_ADD_PTR (ACPI_TABLE_PRMT_HEADER, Table, CurrentOffset);
82efdd
-    Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHeader,
82efdd
+    Status = AcpiDmDumpTable (TableLength, CurrentOffset, PrmtHeader,
82efdd
         sizeof (ACPI_TABLE_PRMT_HEADER), AcpiDmTableInfoPrmtHdr);
82efdd
     if (ACPI_FAILURE (Status))
82efdd
     {
82efdd
@@ -1977,20 +1978,20 @@ AcpiDmDumpPrmt (
82efdd
 
82efdd
     /* PRM Module Information Structure array */
82efdd
 
82efdd
-    for (i = 0; i < PrmtHeader->ModuleInfoCount; ++i)
82efdd
+    for (i = 0; i < AcpiUtReadUint32 (&PrmtHeader->ModuleInfoCount); ++i)
82efdd
     {
82efdd
         PrmtModuleInfo = ACPI_ADD_PTR (ACPI_PRMT_MODULE_INFO, Table, CurrentOffset);
82efdd
-        Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtModuleInfo,
82efdd
+        Status = AcpiDmDumpTable (TableLength, CurrentOffset, PrmtModuleInfo,
82efdd
             sizeof (ACPI_PRMT_MODULE_INFO), AcpiDmTableInfoPrmtModule);
82efdd
 
82efdd
         CurrentOffset += sizeof (ACPI_PRMT_MODULE_INFO);
82efdd
 
82efdd
         /* PRM handler information structure array */
82efdd
 
82efdd
-        for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; ++j)
82efdd
+        for (j = 0; j < AcpiUtReadUint16 (&PrmtModuleInfo->HandlerInfoCount); ++j)
82efdd
         {
82efdd
             PrmtHandlerInfo = ACPI_ADD_PTR (ACPI_PRMT_HANDLER_INFO, Table, CurrentOffset);
82efdd
-            Status = AcpiDmDumpTable (Table->Length, CurrentOffset, PrmtHandlerInfo,
82efdd
+            Status = AcpiDmDumpTable (TableLength, CurrentOffset, PrmtHandlerInfo,
82efdd
                 sizeof (ACPI_PRMT_HANDLER_INFO), AcpiDmTableInfoPrmtHandler);
82efdd
 
82efdd
             CurrentOffset += sizeof (ACPI_PRMT_HANDLER_INFO);
82efdd
Index: acpica-unix2-20210604/source/compiler/dttable2.c
82efdd
===================================================================
82efdd
--- acpica-unix2-20210604.orig/source/compiler/dttable2.c
82efdd
+++ acpica-unix2-20210604/source/compiler/dttable2.c
82efdd
@@ -1278,7 +1278,7 @@ DtCompilePrmt (
82efdd
     DtInsertSubtable (ParentTable, Subtable);
82efdd
     PrmtHeader = ACPI_CAST_PTR (ACPI_TABLE_PRMT_HEADER, Subtable->Buffer);
82efdd
 
82efdd
-    for (i = 0; i < PrmtHeader->ModuleInfoCount; i++)
82efdd
+    for (i = 0; i < AcpiUtReadUint32 (&PrmtHeader->ModuleInfoCount); i++)
82efdd
     {
82efdd
         Status = DtCompileTable (PFieldList, AcpiDmTableInfoPrmtModule,
82efdd
             &Subtable);
82efdd
@@ -1289,7 +1289,7 @@ DtCompilePrmt (
82efdd
         DtInsertSubtable (ParentTable, Subtable);
82efdd
         PrmtModuleInfo = ACPI_CAST_PTR (ACPI_PRMT_MODULE_INFO, Subtable->Buffer);
82efdd
 
82efdd
-        for (j = 0; j < PrmtModuleInfo->HandlerInfoCount; j++)
82efdd
+        for (j = 0; j < AcpiUtReadUint16 (&PrmtModuleInfo->HandlerInfoCount); j++)
82efdd
         {
82efdd
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoPrmtHandler,
82efdd
                 &Subtable);