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

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