Blame SOURCES/0043-Support-DSDT-SSDT-in-a-big-endian-world.patch

214d7a
From 14d220a34462e61fe69141c86f4c3cd2ae68c279 Mon Sep 17 00:00:00 2001
214d7a
From: Al Stone <ahs3@redhat.com>
214d7a
Date: Wed, 30 Sep 2020 18:59:57 -0600
214d7a
Subject: [PATCH 43/45] Support DSDT/SSDT in a big-endian world.
214d7a
214d7a
NB: this is a very large diff.  The problem is that ResourceTemplates
214d7a
are treated differently during compilation and disassembly so each of
214d7a
the resource types had code that needed to be touched directly.
214d7a
214d7a
In general, however, just reading or writing individual AML opcodes
214d7a
wasn't that much of a change, and most of it was on the codegen side.
214d7a
214d7a
Signed-off-by: Al Stone <ahs3@redhat.com>
214d7a
---
214d7a
 source/common/adwalk.c                     |   3 +-
214d7a
 source/common/dmrestag.c                   |   2 +-
214d7a
 source/common/dmtables.c                   |  17 +-
214d7a
 source/common/dmtbdump.c                   |   3 +-
214d7a
 source/common/dmtbdump3.c                  |   8 +-
214d7a
 source/compiler/aslcodegen.c               |  59 ++++--
214d7a
 source/compiler/aslopcodes.c               |   3 +-
214d7a
 source/compiler/aslrestype1.c              |  60 ++++--
214d7a
 source/compiler/aslrestype1i.c             |  35 ++--
214d7a
 source/compiler/aslrestype2.c              |  20 +-
214d7a
 source/compiler/aslrestype2d.c             |  99 ++++++----
214d7a
 source/compiler/aslrestype2e.c             |  90 ++++++---
214d7a
 source/compiler/aslrestype2q.c             |  81 +++++---
214d7a
 source/compiler/aslrestype2s.c             | 214 +++++++++++++++++----
214d7a
 source/compiler/aslrestype2w.c             |  94 +++++----
214d7a
 source/compiler/dttable2.c                 |   3 +-
214d7a
 source/components/disassembler/dmbuffer.c  |  37 +++-
214d7a
 source/components/disassembler/dmopcode.c  |  21 +-
214d7a
 source/components/disassembler/dmresrc.c   |   2 +-
214d7a
 source/components/disassembler/dmresrcl.c  |  43 +++--
214d7a
 source/components/disassembler/dmresrcl2.c | 128 +++++++-----
214d7a
 source/components/disassembler/dmresrcs.c  |  18 +-
214d7a
 source/components/disassembler/dmwalk.c    |   2 +-
214d7a
 source/components/namespace/nsaccess.c     |   2 +-
214d7a
 source/components/namespace/nsnames.c      |   4 +-
214d7a
 source/components/namespace/nsparse.c      |   6 +-
214d7a
 source/components/namespace/nsutils.c      |   7 +-
214d7a
 source/components/utilities/utresrc.c      |   2 +-
214d7a
 28 files changed, 721 insertions(+), 341 deletions(-)
214d7a
214d7a
Index: acpica-unix2-20210604/source/common/adwalk.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/adwalk.c
214d7a
+++ acpica-unix2-20210604/source/common/adwalk.c
214d7a
@@ -679,7 +679,8 @@ AcpiDmLoadDescendingOp (
214d7a
 
214d7a
         if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
214d7a
         {
214d7a
-            *ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name;
214d7a
+            AcpiUtWriteUint (FieldPath, ACPI_NAMESEG_SIZE,
214d7a
+		             &Op->Named.Name, ACPI_NAMESEG_SIZE);
214d7a
             FieldPath[4] = 0;
214d7a
             Path = FieldPath;
214d7a
         }
214d7a
Index: acpica-unix2-20210604/source/common/dmrestag.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmrestag.c
214d7a
+++ acpica-unix2-20210604/source/common/dmrestag.c
214d7a
@@ -1048,7 +1048,7 @@ AcpiDmAddResourcesToNamespace (
214d7a
      * NextOp contains the Aml pointer and the Aml length
214d7a
      */
214d7a
     AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data,
214d7a
-        (ACPI_SIZE) NextOp->Common.Value.Integer,
214d7a
+        (ACPI_SIZE) NextOp->Common.Value.Size,
214d7a
         AcpiDmAddResourceToNamespace, (void **) BufferNode);
214d7a
 }
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/common/dmtables.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmtables.c
214d7a
+++ acpica-unix2-20210604/source/common/dmtables.c
214d7a
@@ -142,6 +142,10 @@ AdCreateTableHeader (
214d7a
     ACPI_TABLE_HEADER       *Table)
214d7a
 {
214d7a
     UINT8                   Checksum;
214d7a
+    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
214d7a
+    UINT32                  OemRevision = AcpiUtReadUint32 (&Table->OemRevision);
214d7a
+    UINT32                  CompilerRevision =
214d7a
+                                AcpiUtReadUint32 (&Table->AslCompilerRevision);
214d7a
 
214d7a
 
214d7a
     /* Reset globals for External statements */
214d7a
@@ -156,7 +160,7 @@ AdCreateTableHeader (
214d7a
 
214d7a
     AcpiOsPrintf (" * Original Table Header:\n");
214d7a
     AcpiOsPrintf (" *     Signature        \"%4.4s\"\n",    Table->Signature);
214d7a
-    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", Table->Length, Table->Length);
214d7a
+    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", TableLength, TableLength);
214d7a
 
214d7a
     /* Print and validate the revision */
214d7a
 
214d7a
@@ -188,7 +192,7 @@ AdCreateTableHeader (
214d7a
 
214d7a
     AcpiOsPrintf ("\n *     Checksum         0x%2.2X",        Table->Checksum);
214d7a
 
214d7a
-    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
214d7a
+    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), TableLength);
214d7a
     if (Checksum)
214d7a
     {
214d7a
         AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
214d7a
@@ -198,9 +202,9 @@ AdCreateTableHeader (
214d7a
     AcpiOsPrintf ("\n");
214d7a
     AcpiOsPrintf (" *     OEM ID           \"%.6s\"\n",     Table->OemId);
214d7a
     AcpiOsPrintf (" *     OEM Table ID     \"%.8s\"\n",     Table->OemTableId);
214d7a
-    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
214d7a
+    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", OemRevision, OemRevision);
214d7a
     AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);
214d7a
-    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
214d7a
+    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", CompilerRevision, CompilerRevision);
214d7a
     AcpiOsPrintf (" */\n");
214d7a
 
214d7a
     /*
214d7a
@@ -221,7 +225,7 @@ AdCreateTableHeader (
214d7a
     AcpiOsPrintf (
214d7a
         "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
214d7a
         Table->Signature, Table->Revision,
214d7a
-        Table->OemId, Table->OemTableId, Table->OemRevision);
214d7a
+        Table->OemId, Table->OemTableId, OemRevision);
214d7a
 }
214d7a
 
214d7a
 
214d7a
@@ -396,7 +400,8 @@ AdParseTable (
214d7a
 
214d7a
     fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
214d7a
 
214d7a
-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
214d7a
+    AmlLength = AcpiUtReadUint32 (&Table->Length);
214d7a
+    AmlLength -= sizeof (ACPI_TABLE_HEADER);
214d7a
     AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
214d7a
 
214d7a
     AcpiUtSetIntegerWidth (Table->Revision);
214d7a
Index: acpica-unix2-20210604/source/common/dmtbdump.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmtbdump.c
214d7a
+++ acpica-unix2-20210604/source/common/dmtbdump.c
214d7a
@@ -338,8 +338,7 @@ AcpiDmDumpXsdt (
214d7a
     for (i = 0; i < Entries; i++)
214d7a
     {
214d7a
         AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
214d7a
-        AcpiOsPrintf ("%8.8X%8.8X\n",
214d7a
-                ACPI_FORMAT_UINT64 (AcpiUtReadUint64 (&Array[i])));
214d7a
+        AcpiOsPrintf ("%16.16lX\n", AcpiUtReadUint64 (&Array[i]));
214d7a
         Offset += sizeof (UINT64);
214d7a
     }
214d7a
 }
214d7a
Index: acpica-unix2-20210604/source/common/dmtbdump3.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c
214d7a
+++ acpica-unix2-20210604/source/common/dmtbdump3.c
214d7a
@@ -736,13 +736,13 @@ AcpiDmDumpWpbt (
214d7a
 {
214d7a
     ACPI_STATUS             Status;
214d7a
     ACPI_TABLE_WPBT         *Subtable;
214d7a
-    UINT32                  Length = Table->Length;
214d7a
+    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
214d7a
     UINT16                  ArgumentsLength;
214d7a
 
214d7a
 
214d7a
     /* Dump the main table */
214d7a
 
214d7a
-    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
214d7a
+    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoWpbt);
214d7a
     if (ACPI_FAILURE (Status))
214d7a
     {
214d7a
         return;
214d7a
@@ -751,10 +751,10 @@ AcpiDmDumpWpbt (
214d7a
     /* Extract the arguments buffer length from the main table */
214d7a
 
214d7a
     Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
214d7a
-    ArgumentsLength = Subtable->ArgumentsLength;
214d7a
+    ArgumentsLength = AcpiUtReadUint16 (&Subtable->ArgumentsLength);
214d7a
 
214d7a
     /* Dump the arguments buffer */
214d7a
 
214d7a
-    (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
214d7a
+    (void) AcpiDmDumpTable (TableLength, 0, Table, ArgumentsLength,
214d7a
         AcpiDmTableInfoWpbt0);
214d7a
 }
214d7a
Index: acpica-unix2-20210604/source/compiler/aslcodegen.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslcodegen.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslcodegen.c
214d7a
@@ -238,6 +238,10 @@ CgWriteAmlOpcode (
214d7a
 {
214d7a
     UINT8                   PkgLenFirstByte;
214d7a
     UINT32                  i;
214d7a
+    UINT8                   Tmp8;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
+    UINT64                  Tmp64;
214d7a
     union {
214d7a
         UINT16                  Opcode;
214d7a
         UINT8                   OpcodeBytes[2];
214d7a
@@ -312,14 +316,15 @@ CgWriteAmlOpcode (
214d7a
 
214d7a
         /* Check for two-byte opcode */
214d7a
 
214d7a
+        Tmp16 = AcpiUtReadUint16 (&Aml.Opcode);
214d7a
         if (Aml.Opcode > 0x00FF)
214d7a
         {
214d7a
             /* Write the high byte first */
214d7a
 
214d7a
-            CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1);
214d7a
+            CgLocalWriteAmlData (Op, ((UINT8 *) &Tmp16)+1, 1);
214d7a
         }
214d7a
 
214d7a
-        CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1);
214d7a
+        CgLocalWriteAmlData (Op, (UINT8 *) &Tmp16, 1);
214d7a
 
214d7a
         /* Subtreelength doesn't include length of package length bytes */
214d7a
 
214d7a
@@ -335,7 +340,8 @@ CgWriteAmlOpcode (
214d7a
         {
214d7a
             /* Simplest case -- no bytes to follow, just write the count */
214d7a
 
214d7a
-            CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
214d7a
+            Tmp8 = (UINT8) PkgLen.Len;
214d7a
+            CgLocalWriteAmlData (Op, &Tmp8, 1);
214d7a
         }
214d7a
         else if (Op->Asl.AmlPkgLenBytes != 0)
214d7a
         {
214d7a
@@ -343,9 +349,10 @@ CgWriteAmlOpcode (
214d7a
              * Encode the "bytes to follow" in the first byte, top two bits.
214d7a
              * The low-order nybble of the length is in the bottom 4 bits
214d7a
              */
214d7a
+            Tmp8 = (UINT8) PkgLen.Len;
214d7a
             PkgLenFirstByte = (UINT8)
214d7a
                 (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
214d7a
-                (PkgLen.LenBytes[0] & 0x0F));
214d7a
+                (Tmp8 & 0x0F));
214d7a
 
214d7a
             CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
214d7a
 
214d7a
@@ -359,6 +366,9 @@ CgWriteAmlOpcode (
214d7a
              * Now we can write the remaining bytes -
214d7a
              * either 1, 2, or 3 bytes
214d7a
              */
214d7a
+            Tmp32 = PkgLen.Len;
214d7a
+            AcpiUtWriteUint (&PkgLen.Len, Op->Asl.AmlPkgLenBytes,
214d7a
+                &Tmp32, sizeof (UINT32));
214d7a
             for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
214d7a
             {
214d7a
                 CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
214d7a
@@ -370,22 +380,30 @@ CgWriteAmlOpcode (
214d7a
     {
214d7a
     case AML_BYTE_OP:
214d7a
 
214d7a
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1);
214d7a
+        Tmp64 = 0;
214d7a
+        AcpiUtWriteUint (&Tmp64, 1, &Op->Asl.Value.Integer, 8);
214d7a
+        CgLocalWriteAmlData (Op, &Tmp64, 1);
214d7a
         break;
214d7a
 
214d7a
     case AML_WORD_OP:
214d7a
 
214d7a
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2);
214d7a
-       break;
214d7a
+        Tmp64 = 0;
214d7a
+        AcpiUtWriteUint (&Tmp64, 2, &Op->Asl.Value.Integer, 8);
214d7a
+        CgLocalWriteAmlData (Op, &Tmp64, 2);
214d7a
+        break;
214d7a
 
214d7a
     case AML_DWORD_OP:
214d7a
 
214d7a
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4);
214d7a
+        Tmp64 = 0;
214d7a
+        AcpiUtWriteUint (&Tmp64, 4, &Op->Asl.Value.Integer, 8);
214d7a
+        CgLocalWriteAmlData (Op, &Tmp64, 4);
214d7a
         break;
214d7a
 
214d7a
     case AML_QWORD_OP:
214d7a
 
214d7a
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8);
214d7a
+        Tmp64 = 0;
214d7a
+        AcpiUtWriteUint (&Tmp64, 8, &Op->Asl.Value.Integer, 8);
214d7a
+        CgLocalWriteAmlData (Op, &Tmp64, 8);
214d7a
         break;
214d7a
 
214d7a
     case AML_STRING_OP:
214d7a
@@ -423,6 +441,7 @@ CgWriteTableHeader (
214d7a
     ACPI_PARSE_OBJECT       *Child;
214d7a
     UINT32                  CommentLength;
214d7a
     ACPI_COMMENT_NODE       *Current;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     memset (&AslGbl_TableHeader, 0, sizeof (ACPI_TABLE_HEADER));
214d7a
@@ -478,7 +497,9 @@ CgWriteTableHeader (
214d7a
     /* OEM Revision */
214d7a
 
214d7a
     Child = Child->Asl.Next;
214d7a
-    AslGbl_TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
214d7a
+    AcpiUtWriteUint (&Tmp32, sizeof (UINT32),
214d7a
+           &Child->Asl.Value.Integer, sizeof (Child->Asl.Value.Integer));
214d7a
+    AslGbl_TableHeader.OemRevision = Tmp32;
214d7a
 
214d7a
     /* Compiler ID */
214d7a
 
214d7a
@@ -486,7 +507,8 @@ CgWriteTableHeader (
214d7a
 
214d7a
     /* Compiler version */
214d7a
 
214d7a
-    AslGbl_TableHeader.AslCompilerRevision = ACPI_CA_VERSION;
214d7a
+    Tmp32 = ACPI_CA_VERSION;
214d7a
+    AslGbl_TableHeader.AslCompilerRevision = AcpiUtReadUint32 (&Tmp32);
214d7a
 
214d7a
     /* Table length. Checksum zero for now, will rewrite later */
214d7a
 
214d7a
@@ -541,6 +563,15 @@ CgWriteTableHeader (
214d7a
     AslGbl_TableHeader.Checksum = 0;
214d7a
     Op->Asl.FinalAmlOffset = ftell (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle);
214d7a
 
214d7a
+    /*
214d7a
+     * Adjust the Table length; it will only change when big-endian
214d7a
+     * but we have to wait until here in case there is arithmetic to
214d7a
+     * be done on the length before this step in the function
214d7a
+     */
214d7a
+
214d7a
+    Tmp32 = AslGbl_TableHeader.Length;
214d7a
+    AslGbl_TableHeader.Length = AcpiUtReadUint32 (&Tmp32);
214d7a
+
214d7a
     /* Write entire header and clear the table header global */
214d7a
 
214d7a
     CgLocalWriteAmlData (Op, &AslGbl_TableHeader, sizeof (ACPI_TABLE_HEADER));
214d7a
@@ -625,6 +656,7 @@ CgWriteNode (
214d7a
     ACPI_PARSE_OBJECT       *Op)
214d7a
 {
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
+    UINT64                  Tmp64;
214d7a
 
214d7a
 
214d7a
     /* Write all comments here. */
214d7a
@@ -653,7 +685,10 @@ CgWriteNode (
214d7a
     case AML_RAW_DATA_DWORD:
214d7a
     case AML_RAW_DATA_QWORD:
214d7a
 
214d7a
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength);
214d7a
+        Tmp64 = 0;
214d7a
+        AcpiUtWriteUint (&Tmp64, Op->Asl.AmlLength,
214d7a
+            &Op->Asl.Value.Integer, sizeof (UINT64));
214d7a
+        CgLocalWriteAmlData (Op, &Tmp64, Op->Asl.AmlLength);
214d7a
         return;
214d7a
 
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/compiler/aslopcodes.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslopcodes.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslopcodes.c
214d7a
@@ -511,7 +511,8 @@ OpcDoUnicode (
214d7a
 
214d7a
     for (i = 0; i < Count; i++)
214d7a
     {
214d7a
-        UnicodeString[i] = (UINT16) AsciiString[i];
214d7a
+        AcpiUtWriteUint (&UnicodeString[i], sizeof (UINT16),
214d7a
+                &AsciiString[i], sizeof (UINT8));
214d7a
     }
214d7a
 
214d7a
     /*
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype1.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype1.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype1.c
214d7a
@@ -143,6 +143,7 @@ RsDoMemory24Descriptor (
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -151,7 +152,8 @@ RsDoMemory24Descriptor (
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
     Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
214d7a
-    Descriptor->Memory24.ResourceLength = 9;
214d7a
+    Tmp16 = 9;
214d7a
+    Descriptor->Memory24.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     /* Process all child initialization nodes */
214d7a
 
214d7a
@@ -168,7 +170,8 @@ RsDoMemory24Descriptor (
214d7a
 
214d7a
         case 1: /* Min Address */
214d7a
 
214d7a
-            Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory24.Minimum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -176,7 +179,8 @@ RsDoMemory24Descriptor (
214d7a
 
214d7a
         case 2: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory24.Maximum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -184,14 +188,16 @@ RsDoMemory24Descriptor (
214d7a
 
214d7a
         case 3: /* Alignment */
214d7a
 
214d7a
-            Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory24.Alignment = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
214d7a
             break;
214d7a
 
214d7a
         case 4: /* Length */
214d7a
 
214d7a
-            Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory24.AddressLength = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -214,10 +220,10 @@ RsDoMemory24Descriptor (
214d7a
     /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
214d7a
 
214d7a
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
214d7a
-        Descriptor->Memory24.Minimum,
214d7a
-        Descriptor->Memory24.Maximum,
214d7a
-        Descriptor->Memory24.AddressLength,
214d7a
-        Descriptor->Memory24.Alignment,
214d7a
+        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Minimum),
214d7a
+        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Maximum),
214d7a
+        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.AddressLength),
214d7a
+        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Alignment),
214d7a
         MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
214d7a
 
214d7a
     return (Rnode);
214d7a
@@ -249,6 +255,8 @@ RsDoMemory32Descriptor (
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -257,7 +265,8 @@ RsDoMemory32Descriptor (
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
     Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
214d7a
-    Descriptor->Memory32.ResourceLength = 17;
214d7a
+    Tmp16 = 17;
214d7a
+    Descriptor->Memory32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     /* Process all child initialization nodes */
214d7a
 
214d7a
@@ -274,7 +283,8 @@ RsDoMemory32Descriptor (
214d7a
 
214d7a
         case 1:  /* Min Address */
214d7a
 
214d7a
-            Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory32.Minimum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -282,7 +292,8 @@ RsDoMemory32Descriptor (
214d7a
 
214d7a
         case 2: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory32.Maximum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -290,7 +301,8 @@ RsDoMemory32Descriptor (
214d7a
 
214d7a
         case 3: /* Alignment */
214d7a
 
214d7a
-            Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory32.Alignment = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
214d7a
             AlignOp = InitializerOp;
214d7a
@@ -298,7 +310,8 @@ RsDoMemory32Descriptor (
214d7a
 
214d7a
         case 4: /* Length */
214d7a
 
214d7a
-            Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Memory32.AddressLength = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -321,10 +334,10 @@ RsDoMemory32Descriptor (
214d7a
     /* Validate the Min/Max/Len/Align values */
214d7a
 
214d7a
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
214d7a
-        Descriptor->Memory32.Minimum,
214d7a
-        Descriptor->Memory32.Maximum,
214d7a
-        Descriptor->Memory32.AddressLength,
214d7a
-        Descriptor->Memory32.Alignment,
214d7a
+        AcpiUtReadUint32 (&Descriptor->Memory32.Minimum),
214d7a
+        AcpiUtReadUint32 (&Descriptor->Memory32.Maximum),
214d7a
+        AcpiUtReadUint32 (&Descriptor->Memory32.AddressLength),
214d7a
+        AcpiUtReadUint32 (&Descriptor->Memory32.Alignment),
214d7a
         MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
     return (Rnode);
214d7a
@@ -352,6 +365,8 @@ RsDoMemory32FixedDescriptor (
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -360,7 +375,8 @@ RsDoMemory32FixedDescriptor (
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
     Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
214d7a
-    Descriptor->FixedMemory32.ResourceLength = 9;
214d7a
+    Tmp16 = 9;
214d7a
+    Descriptor->FixedMemory32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     /* Process all child initialization nodes */
214d7a
 
214d7a
@@ -377,14 +393,16 @@ RsDoMemory32FixedDescriptor (
214d7a
 
214d7a
         case 1: /* Address */
214d7a
 
214d7a
-            Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->FixedMemory32.Address = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
214d7a
             break;
214d7a
 
214d7a
         case 2: /* Length */
214d7a
 
214d7a
-            Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->FixedMemory32.AddressLength = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
214d7a
             break;
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype1i.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype1i.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype1i.c
214d7a
@@ -199,6 +199,7 @@ RsDoFixedDmaDescriptor (
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -217,14 +218,16 @@ RsDoFixedDmaDescriptor (
214d7a
         {
214d7a
         case 0: /* DMA Request Lines [WORD] (_DMA) */
214d7a
 
214d7a
-            Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->FixedDma.RequestLines = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines));
214d7a
             break;
214d7a
 
214d7a
         case 1: /* DMA Channel [WORD] (_TYP) */
214d7a
 
214d7a
-            Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->FixedDma.Channels = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels));
214d7a
             break;
214d7a
@@ -275,6 +278,7 @@ RsDoFixedIoDescriptor (
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -293,8 +297,8 @@ RsDoFixedIoDescriptor (
214d7a
         {
214d7a
         case 0: /* Base Address */
214d7a
 
214d7a
-            Descriptor->FixedIo.Address =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->FixedIo.Address = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
214d7a
             AddressOp = InitializerOp;
214d7a
@@ -324,7 +328,7 @@ RsDoFixedIoDescriptor (
214d7a
 
214d7a
     /* Error checks */
214d7a
 
214d7a
-    if (Descriptor->FixedIo.Address > 0x03FF)
214d7a
+    if (AcpiUtReadUint16 (&Descriptor->FixedIo.Address) > 0x03FF)
214d7a
     {
214d7a
         AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
214d7a
     }
214d7a
@@ -358,6 +362,7 @@ RsDoIoDescriptor (
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -383,8 +388,8 @@ RsDoIoDescriptor (
214d7a
 
214d7a
         case 1:  /* Min Address */
214d7a
 
214d7a
-            Descriptor->Io.Minimum =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Io.Minimum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -392,8 +397,8 @@ RsDoIoDescriptor (
214d7a
 
214d7a
         case 2: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Io.Maximum =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Io.Maximum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -434,10 +439,10 @@ RsDoIoDescriptor (
214d7a
     /* Validate the Min/Max/Len/Align values */
214d7a
 
214d7a
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
214d7a
-        Descriptor->Io.Minimum,
214d7a
-        Descriptor->Io.Maximum,
214d7a
-        Descriptor->Io.AddressLength,
214d7a
-        Descriptor->Io.Alignment,
214d7a
+        (UINT32) (AcpiUtReadUint16 (&Descriptor->Io.Minimum)),
214d7a
+        (UINT32) (AcpiUtReadUint16 (&Descriptor->Io.Maximum)),
214d7a
+        (UINT32) Descriptor->Io.AddressLength,
214d7a
+        (UINT32) Descriptor->Io.Alignment,
214d7a
         MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
     return (Rnode);
214d7a
@@ -561,7 +566,7 @@ RsDoIrqDescriptor (
214d7a
 
214d7a
     /* Now we can set the channel mask */
214d7a
 
214d7a
-    Descriptor->Irq.IrqMask = IrqMask;
214d7a
+    Descriptor->Irq.IrqMask = AcpiUtReadUint16 (&IrqMask);
214d7a
     return (Rnode);
214d7a
 }
214d7a
 
214d7a
@@ -660,6 +665,6 @@ RsDoIrqNoFlagsDescriptor (
214d7a
 
214d7a
     /* Now we can set the interrupt mask */
214d7a
 
214d7a
-    Descriptor->Irq.IrqMask = IrqMask;
214d7a
+    Descriptor->Irq.IrqMask = AcpiUtReadUint16(&IrqMask);
214d7a
     return (Rnode);
214d7a
 }
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype2.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype2.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype2.c
214d7a
@@ -77,6 +77,8 @@ RsDoGeneralRegisterDescriptor (
214d7a
     ASL_RESOURCE_NODE       *Rnode;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT64                  Tmp64;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -85,7 +87,8 @@ RsDoGeneralRegisterDescriptor (
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
     Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
214d7a
-    Descriptor->GenericReg.ResourceLength = 12;
214d7a
+    Tmp16 = 12;
214d7a
+    Descriptor->GenericReg.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     /* Process all child initialization nodes */
214d7a
 
214d7a
@@ -116,7 +119,8 @@ RsDoGeneralRegisterDescriptor (
214d7a
 
214d7a
         case 3: /* Register Address */
214d7a
 
214d7a
-            Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp64 = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->GenericReg.Address = AcpiUtReadUint64 (&Tmp64);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
214d7a
             break;
214d7a
@@ -184,6 +188,8 @@ RsDoInterruptDescriptor (
214d7a
     BOOLEAN                 HasResSourceIndex = FALSE;
214d7a
     UINT8                   ResSourceIndex = 0;
214d7a
     UINT8                   *ResSourceString = NULL;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -225,7 +231,7 @@ RsDoInterruptDescriptor (
214d7a
      * Initial descriptor length -- may be enlarged if there are
214d7a
      * optional fields present
214d7a
      */
214d7a
-    Descriptor->ExtendedIrq.ResourceLength  = 2;  /* Flags and table length byte */
214d7a
+    Descriptor->ExtendedIrq.ResourceLength  = 2; /* Flags and table length byte */
214d7a
     Descriptor->ExtendedIrq.InterruptCount  = 0;
214d7a
 
214d7a
     Rover = ACPI_CAST_PTR (AML_RESOURCE,
214d7a
@@ -333,7 +339,8 @@ RsDoInterruptDescriptor (
214d7a
 
214d7a
             /* Save the integer and move pointer to the next one */
214d7a
 
214d7a
-            Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Rover->DwordItem = AcpiUtReadUint32 (&Tmp32);
214d7a
             Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);
214d7a
             Descriptor->ExtendedIrq.InterruptCount++;
214d7a
             Descriptor->ExtendedIrq.ResourceLength += 4;
214d7a
@@ -384,6 +391,8 @@ RsDoInterruptDescriptor (
214d7a
         Descriptor->ExtendedIrq.ResourceLength = (UINT16)
214d7a
             (Descriptor->ExtendedIrq.ResourceLength + StringLength);
214d7a
     }
214d7a
+    Tmp16 = Descriptor->ExtendedIrq.ResourceLength;
214d7a
+    Descriptor->ExtendedIrq.ResourceLength  = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     Rnode->BufferLength =
214d7a
         (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
214d7a
@@ -436,7 +445,8 @@ RsDoVendorLargeDescriptor (
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
     Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
214d7a
-    Descriptor->VendorLarge.ResourceLength = (UINT16) i;
214d7a
+    AcpiUtWriteUint (&Descriptor->VendorLarge.ResourceLength, sizeof (UINT16),
214d7a
+            &i, sizeof (UINT32));
214d7a
 
214d7a
     /* Point to end-of-descriptor for vendor data */
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype2d.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype2d.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype2d.c
214d7a
@@ -84,6 +84,8 @@ RsDoDwordIoDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -147,8 +149,8 @@ RsDoDwordIoDescriptor (
214d7a
 
214d7a
         case 5: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address32.Granularity =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -156,8 +158,8 @@ RsDoDwordIoDescriptor (
214d7a
 
214d7a
         case 6: /* Address Min */
214d7a
 
214d7a
-            Descriptor->Address32.Minimum =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -165,8 +167,8 @@ RsDoDwordIoDescriptor (
214d7a
 
214d7a
         case 7: /* Address Max */
214d7a
 
214d7a
-            Descriptor->Address32.Maximum =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -174,16 +176,16 @@ RsDoDwordIoDescriptor (
214d7a
 
214d7a
         case 8: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address32.TranslationOffset =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 9: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address32.AddressLength =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -271,11 +273,14 @@ RsDoDwordIoDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->Address32.ResourceLength;
214d7a
+    Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        (UINT64) Descriptor->Address32.Minimum,
214d7a
-        (UINT64) Descriptor->Address32.Maximum,
214d7a
-        (UINT64) Descriptor->Address32.AddressLength,
214d7a
-        (UINT64) Descriptor->Address32.Granularity,
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity),
214d7a
         Descriptor->Address32.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
@@ -314,6 +319,8 @@ RsDoDwordMemoryDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -385,8 +392,8 @@ RsDoDwordMemoryDescriptor (
214d7a
 
214d7a
         case 6: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address32.Granularity =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -394,8 +401,8 @@ RsDoDwordMemoryDescriptor (
214d7a
 
214d7a
         case 7: /* Min Address */
214d7a
 
214d7a
-            Descriptor->Address32.Minimum =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -403,8 +410,8 @@ RsDoDwordMemoryDescriptor (
214d7a
 
214d7a
         case 8: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Address32.Maximum =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -412,16 +419,16 @@ RsDoDwordMemoryDescriptor (
214d7a
 
214d7a
         case 9: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address32.TranslationOffset =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 10: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address32.AddressLength =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -506,11 +513,14 @@ RsDoDwordMemoryDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->Address32.ResourceLength;
214d7a
+    Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        (UINT64) Descriptor->Address32.Minimum,
214d7a
-        (UINT64) Descriptor->Address32.Maximum,
214d7a
-        (UINT64) Descriptor->Address32.AddressLength,
214d7a
-        (UINT64) Descriptor->Address32.Granularity,
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity),
214d7a
         Descriptor->Address32.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
@@ -549,6 +559,8 @@ RsDoDwordSpaceDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -616,8 +628,8 @@ RsDoDwordSpaceDescriptor (
214d7a
 
214d7a
         case 6: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address32.Granularity =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -625,8 +637,8 @@ RsDoDwordSpaceDescriptor (
214d7a
 
214d7a
         case 7: /* Min Address */
214d7a
 
214d7a
-            Descriptor->Address32.Minimum =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -634,8 +646,8 @@ RsDoDwordSpaceDescriptor (
214d7a
 
214d7a
         case 8: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Address32.Maximum =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -643,16 +655,16 @@ RsDoDwordSpaceDescriptor (
214d7a
 
214d7a
         case 9: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address32.TranslationOffset =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 10: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address32.AddressLength =
214d7a
-                (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -723,11 +735,14 @@ RsDoDwordSpaceDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->Address32.ResourceLength;
214d7a
+    Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        (UINT64) Descriptor->Address32.Minimum,
214d7a
-        (UINT64) Descriptor->Address32.Maximum,
214d7a
-        (UINT64) Descriptor->Address32.AddressLength,
214d7a
-        (UINT64) Descriptor->Address32.Granularity,
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength),
214d7a
+        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity),
214d7a
         Descriptor->Address32.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype2q.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype2q.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype2q.c
214d7a
@@ -84,6 +84,7 @@ RsDoQwordIoDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -147,7 +148,8 @@ RsDoQwordIoDescriptor (
214d7a
 
214d7a
         case 5: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Granularity =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -155,7 +157,8 @@ RsDoQwordIoDescriptor (
214d7a
 
214d7a
         case 6: /* Address Min */
214d7a
 
214d7a
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Minimum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -163,7 +166,8 @@ RsDoQwordIoDescriptor (
214d7a
 
214d7a
         case 7: /* Address Max */
214d7a
 
214d7a
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Maximum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -171,14 +175,16 @@ RsDoQwordIoDescriptor (
214d7a
 
214d7a
         case 8: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.TranslationOffset =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 9: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.AddressLength =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -262,11 +268,14 @@ RsDoQwordIoDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->Address64.ResourceLength;
214d7a
+    Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        Descriptor->Address64.Minimum,
214d7a
-        Descriptor->Address64.Maximum,
214d7a
-        Descriptor->Address64.AddressLength,
214d7a
-        Descriptor->Address64.Granularity,
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Minimum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Maximum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.AddressLength),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Granularity),
214d7a
         Descriptor->Address64.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
@@ -305,6 +314,7 @@ RsDoQwordMemoryDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -375,7 +385,8 @@ RsDoQwordMemoryDescriptor (
214d7a
 
214d7a
         case 6: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Granularity =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -383,7 +394,8 @@ RsDoQwordMemoryDescriptor (
214d7a
 
214d7a
         case 7: /* Min Address */
214d7a
 
214d7a
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Minimum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -391,7 +403,8 @@ RsDoQwordMemoryDescriptor (
214d7a
 
214d7a
         case 8: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Maximum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -399,14 +412,16 @@ RsDoQwordMemoryDescriptor (
214d7a
 
214d7a
         case 9: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.TranslationOffset =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 10: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.AddressLength =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -491,11 +506,14 @@ RsDoQwordMemoryDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->Address64.ResourceLength;
214d7a
+    Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        Descriptor->Address64.Minimum,
214d7a
-        Descriptor->Address64.Maximum,
214d7a
-        Descriptor->Address64.AddressLength,
214d7a
-        Descriptor->Address64.Granularity,
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Minimum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Maximum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.AddressLength),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Granularity),
214d7a
         Descriptor->Address64.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
@@ -534,6 +552,7 @@ RsDoQwordSpaceDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -601,7 +620,8 @@ RsDoQwordSpaceDescriptor (
214d7a
 
214d7a
         case 6: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Granularity =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -609,7 +629,8 @@ RsDoQwordSpaceDescriptor (
214d7a
 
214d7a
         case 7: /* Min Address */
214d7a
 
214d7a
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Minimum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -617,7 +638,8 @@ RsDoQwordSpaceDescriptor (
214d7a
 
214d7a
         case 8: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.Maximum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -625,14 +647,16 @@ RsDoQwordSpaceDescriptor (
214d7a
 
214d7a
         case 9: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.TranslationOffset =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 10: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address64.AddressLength =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -702,11 +726,14 @@ RsDoQwordSpaceDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->Address64.ResourceLength;
214d7a
+    Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        Descriptor->Address64.Minimum,
214d7a
-        Descriptor->Address64.Maximum,
214d7a
-        Descriptor->Address64.AddressLength,
214d7a
-        Descriptor->Address64.Granularity,
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Minimum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Maximum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.AddressLength),
214d7a
+        AcpiUtReadUint64 (&Descriptor->Address64.Granularity),
214d7a
         Descriptor->Address64.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype2w.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype2w.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype2w.c
214d7a
@@ -84,6 +84,7 @@ RsDoWordIoDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -147,7 +148,8 @@ RsDoWordIoDescriptor (
214d7a
 
214d7a
         case 5: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -155,7 +157,8 @@ RsDoWordIoDescriptor (
214d7a
 
214d7a
         case 6: /* Address Min */
214d7a
 
214d7a
-            Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -163,7 +166,8 @@ RsDoWordIoDescriptor (
214d7a
 
214d7a
         case 7: /* Address Max */
214d7a
 
214d7a
-            Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -171,14 +175,16 @@ RsDoWordIoDescriptor (
214d7a
 
214d7a
         case 8: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 9: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -263,13 +269,17 @@ RsDoWordIoDescriptor (
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
     RsLargeAddressCheck (
214d7a
-        (UINT64) Descriptor->Address16.Minimum,
214d7a
-        (UINT64) Descriptor->Address16.Maximum,
214d7a
-        (UINT64) Descriptor->Address16.AddressLength,
214d7a
-        (UINT64) Descriptor->Address16.Granularity,
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity),
214d7a
         Descriptor->Address16.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
+    /* correct enddianness */
214d7a
+    Tmp16 = Descriptor->Address16.ResourceLength;
214d7a
+    Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
214d7a
         OptionIndex + StringLength;
214d7a
     return (Rnode);
214d7a
@@ -305,6 +315,7 @@ RsDoWordBusNumberDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -361,8 +372,8 @@ RsDoWordBusNumberDescriptor (
214d7a
 
214d7a
         case 4: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address16.Granularity =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -370,8 +381,8 @@ RsDoWordBusNumberDescriptor (
214d7a
 
214d7a
         case 5: /* Min Address */
214d7a
 
214d7a
-            Descriptor->Address16.Minimum =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -379,8 +390,8 @@ RsDoWordBusNumberDescriptor (
214d7a
 
214d7a
         case 6: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Address16.Maximum =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -388,16 +399,16 @@ RsDoWordBusNumberDescriptor (
214d7a
 
214d7a
         case 7: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address16.TranslationOffset =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 8: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address16.AddressLength =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -468,13 +479,17 @@ RsDoWordBusNumberDescriptor (
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
     RsLargeAddressCheck (
214d7a
-        (UINT64) Descriptor->Address16.Minimum,
214d7a
-        (UINT64) Descriptor->Address16.Maximum,
214d7a
-        (UINT64) Descriptor->Address16.AddressLength,
214d7a
-        (UINT64) Descriptor->Address16.Granularity,
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity),
214d7a
         Descriptor->Address16.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
+    /* correct enddianness */
214d7a
+    Tmp16 = Descriptor->Address16.ResourceLength;
214d7a
+    Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
214d7a
         OptionIndex + StringLength;
214d7a
     return (Rnode);
214d7a
@@ -510,6 +525,7 @@ RsDoWordSpaceDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
     BOOLEAN                 ResSourceIndex = FALSE;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -577,8 +593,8 @@ RsDoWordSpaceDescriptor (
214d7a
 
214d7a
         case 6: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->Address16.Granularity =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -586,8 +602,8 @@ RsDoWordSpaceDescriptor (
214d7a
 
214d7a
         case 7: /* Min Address */
214d7a
 
214d7a
-            Descriptor->Address16.Minimum =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -595,8 +611,8 @@ RsDoWordSpaceDescriptor (
214d7a
 
214d7a
         case 8: /* Max Address */
214d7a
 
214d7a
-            Descriptor->Address16.Maximum =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -604,16 +620,16 @@ RsDoWordSpaceDescriptor (
214d7a
 
214d7a
         case 9: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->Address16.TranslationOffset =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 10: /* Address Length */
214d7a
 
214d7a
-            Descriptor->Address16.AddressLength =
214d7a
-                (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -684,13 +700,17 @@ RsDoWordSpaceDescriptor (
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
     RsLargeAddressCheck (
214d7a
-        (UINT64) Descriptor->Address16.Minimum,
214d7a
-        (UINT64) Descriptor->Address16.Maximum,
214d7a
-        (UINT64) Descriptor->Address16.AddressLength,
214d7a
-        (UINT64) Descriptor->Address16.Granularity,
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength),
214d7a
+        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity),
214d7a
         Descriptor->Address16.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
+    /* correct enddianness */
214d7a
+    Tmp16 = Descriptor->Address16.ResourceLength;
214d7a
+    Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
214d7a
         OptionIndex + StringLength;
214d7a
     return (Rnode);
214d7a
Index: acpica-unix2-20210604/source/compiler/dttable2.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/dttable2.c
214d7a
+++ acpica-unix2-20210604/source/compiler/dttable2.c
214d7a
@@ -2635,7 +2635,8 @@ DtCompileWpbt (
214d7a
 
214d7a
     /* Extract the length of the Arguments buffer, insert into main table */
214d7a
 
214d7a
-    Length = (UINT16) Subtable->TotalLength;
214d7a
+    AcpiUtWriteUint (&Length, sizeof (UINT16),
214d7a
+           &Subtable->TotalLength, sizeof (UINT32));
214d7a
     Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
214d7a
     Table->ArgumentsLength = Length;
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/components/disassembler/dmbuffer.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/disassembler/dmbuffer.c
214d7a
+++ acpica-unix2-20210604/source/components/disassembler/dmbuffer.c
214d7a
@@ -204,7 +204,7 @@ AcpiDmByteList (
214d7a
 
214d7a
 
214d7a
     ByteData = Op->Named.Data;
214d7a
-    ByteCount = (UINT32) Op->Common.Value.Integer;
214d7a
+    ByteCount = (UINT32) Op->Common.Value.Size;
214d7a
 
214d7a
     /*
214d7a
      * The byte list belongs to a buffer, and can be produced by either
214d7a
@@ -308,7 +308,7 @@ AcpiDmIsUuidBuffer (
214d7a
     /* Extract the byte list info */
214d7a
 
214d7a
     ByteData = NextOp->Named.Data;
214d7a
-    ByteCount = (UINT32) NextOp->Common.Value.Integer;
214d7a
+    ByteCount = (UINT32) NextOp->Common.Value.Size;
214d7a
 
214d7a
     /* Byte count must be exactly 16 */
214d7a
 
214d7a
@@ -436,7 +436,7 @@ AcpiDmIsUnicodeBuffer (
214d7a
     /* Extract the byte list info */
214d7a
 
214d7a
     ByteData = NextOp->Named.Data;
214d7a
-    ByteCount = (UINT32) NextOp->Common.Value.Integer;
214d7a
+    ByteCount = (UINT32) NextOp->Common.Value.Size;
214d7a
     WordCount = ACPI_DIV_2 (ByteCount);
214d7a
 
214d7a
     /*
214d7a
@@ -878,14 +878,14 @@ AcpiDmUnicode (
214d7a
     /* Extract the buffer info as a WORD buffer */
214d7a
 
214d7a
     WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
214d7a
-    WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
214d7a
+    WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Size));
214d7a
 
214d7a
     /* Write every other byte as an ASCII character */
214d7a
 
214d7a
     AcpiOsPrintf ("\"");
214d7a
     for (i = 0; i < (WordCount - 1); i++)
214d7a
     {
214d7a
-        OutputValue = (int) WordData[i];
214d7a
+        OutputValue = (int) AcpiUtReadUint16 (&WordData[i]);
214d7a
 
214d7a
         /* Handle values that must be escaped */
214d7a
 
214d7a
@@ -947,7 +947,29 @@ AcpiDmGetHardwareIdType (
214d7a
 
214d7a
         /* Swap from little-endian to big-endian to simplify conversion */
214d7a
 
214d7a
-        BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
214d7a
+        BigEndianId = (UINT32) Op->Common.Value.Integer;
214d7a
+        if (UtIsBigEndianMachine())
214d7a
+        {
214d7a
+            /*
214d7a
+             * We'll need to store the bytes in little-endian order
214d7a
+             * so they can be re-used properly later since everything is
214d7a
+             * assumed to be in little-endian form.
214d7a
+             */
214d7a
+
214d7a
+	     UINT32 *Ptr = (UINT32 *)(&Op->Common.Value.Integer);
214d7a
+	     *Ptr = AcpiUtDwordByteSwap (BigEndianId);
214d7a
+        }
214d7a
+        else
214d7a
+        {
214d7a
+            /*
214d7a
+             * We'll need to just use the bytes in big-endian order;
214d7a
+             * they're already in little-endian order.
214d7a
+             */
214d7a
+
214d7a
+            UINT32 Tmp32 = BigEndianId;
214d7a
+
214d7a
+            BigEndianId = AcpiUtDwordByteSwap ((UINT32) Tmp32);
214d7a
+        }
214d7a
 
214d7a
         /* Create the 3 leading ASCII letters */
214d7a
 
214d7a
@@ -1073,11 +1095,12 @@ AcpiDmDecompressEisaId (
214d7a
 {
214d7a
     char                    IdBuffer[ACPI_EISAID_STRING_SIZE];
214d7a
     const AH_DEVICE_ID      *Info;
214d7a
+    UINT32                  Tmp32 = EncodedId;
214d7a
 
214d7a
 
214d7a
     /* Convert EISAID to a string an emit the statement */
214d7a
 
214d7a
-    AcpiExEisaIdToString (IdBuffer, EncodedId);
214d7a
+    AcpiExEisaIdToString (IdBuffer, AcpiUtReadUint32 (&Tmp32));
214d7a
     AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer);
214d7a
 
214d7a
     /* If we know about the ID, emit the description */
214d7a
Index: acpica-unix2-20210604/source/components/disassembler/dmopcode.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/disassembler/dmopcode.c
214d7a
+++ acpica-unix2-20210604/source/components/disassembler/dmopcode.c
214d7a
@@ -778,7 +778,9 @@ AcpiDmDisassembleOneOp (
214d7a
         }
214d7a
         else
214d7a
         {
214d7a
-            AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
214d7a
+            UINT16 Tmp16 = (UINT16) Op->Common.Value.Integer;
214d7a
+
214d7a
+            AcpiOsPrintf ("0x%4.4X", (UINT32) AcpiUtReadUint16 (&Tmp16));
214d7a
         }
214d7a
         break;
214d7a
 
214d7a
@@ -790,14 +792,19 @@ AcpiDmDisassembleOneOp (
214d7a
         }
214d7a
         else
214d7a
         {
214d7a
-            AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
214d7a
+            UINT32 Tmp32 = (UINT32) Op->Common.Value.Integer;
214d7a
+
214d7a
+            AcpiOsPrintf ("0x%8.8X", (UINT32) AcpiUtReadUint32 (&Tmp32));
214d7a
         }
214d7a
         break;
214d7a
 
214d7a
     case AML_QWORD_OP:
214d7a
 
214d7a
-        AcpiOsPrintf ("0x%8.8X%8.8X",
214d7a
-            ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
214d7a
+        {
214d7a
+	    UINT64 Tmp64 = AcpiUtReadUint64 (&Op->Common.Value.Integer);
214d7a
+
214d7a
+            AcpiOsPrintf ("0x%8.8X%8.8X", ACPI_FORMAT_UINT64 (Tmp64));
214d7a
+        }
214d7a
         break;
214d7a
 
214d7a
     case AML_STRING_OP:
214d7a
@@ -887,18 +894,18 @@ AcpiDmDisassembleOneOp (
214d7a
         AcpiOsPrintf (",");
214d7a
         ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0);
214d7a
         AcpiOsPrintf ("%*.s  %u", (unsigned) (5 - Length), " ",
214d7a
-            (UINT32) Op->Common.Value.Integer);
214d7a
+            (UINT32) Op->Common.Value.Size);
214d7a
 
214d7a
         AcpiDmCommaIfFieldMember (Op);
214d7a
 
214d7a
-        Info->BitOffset += (UINT32) Op->Common.Value.Integer;
214d7a
+        Info->BitOffset += (UINT32) Op->Common.Value.Size;
214d7a
         break;
214d7a
 
214d7a
     case AML_INT_RESERVEDFIELD_OP:
214d7a
 
214d7a
         /* Offset() -- Must account for previous offsets */
214d7a
 
214d7a
-        Offset = (UINT32) Op->Common.Value.Integer;
214d7a
+        Offset = (UINT32) Op->Common.Value.Size;
214d7a
         Info->BitOffset += Offset;
214d7a
 
214d7a
         if (Info->BitOffset % 8 == 0)
214d7a
Index: acpica-unix2-20210604/source/components/disassembler/dmresrc.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrc.c
214d7a
+++ acpica-unix2-20210604/source/components/disassembler/dmresrc.c
214d7a
@@ -417,7 +417,7 @@ AcpiDmIsResourceTemplate (
214d7a
         return (AE_TYPE);
214d7a
     }
214d7a
 
214d7a
-    DeclaredBufferLength = NextOp->Common.Value.Size;
214d7a
+    DeclaredBufferLength = NextOp->Common.Value.Integer;
214d7a
 
214d7a
     /* Get the length of the raw initialization byte list */
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/components/disassembler/dmresrcl.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrcl.c
214d7a
+++ acpica-unix2-20210604/source/components/disassembler/dmresrcl.c
214d7a
@@ -141,6 +141,8 @@ AcpiDmMemoryFields (
214d7a
     UINT32                  Level)
214d7a
 {
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     for (i = 0; i < 4; i++)
214d7a
@@ -151,14 +153,16 @@ AcpiDmMemoryFields (
214d7a
         {
214d7a
         case 16:
214d7a
 
214d7a
-            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
214d7a
-                AcpiDmMemoryNames[i]);
214d7a
+            Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i];
214d7a
+            AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Tmp16),
214d7a
+                     AcpiDmMemoryNames[i]);
214d7a
             break;
214d7a
 
214d7a
         case 32:
214d7a
 
214d7a
-            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
214d7a
-                AcpiDmMemoryNames[i]);
214d7a
+            Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i];
214d7a
+            AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Tmp32),
214d7a
+                     AcpiDmMemoryNames[i]);
214d7a
             break;
214d7a
 
214d7a
         default:
214d7a
@@ -190,6 +194,9 @@ AcpiDmAddressFields (
214d7a
     UINT32                  Level)
214d7a
 {
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
+    UINT64                  Tmp64;
214d7a
 
214d7a
 
214d7a
     AcpiOsPrintf ("\n");
214d7a
@@ -202,20 +209,23 @@ AcpiDmAddressFields (
214d7a
         {
214d7a
         case 16:
214d7a
 
214d7a
-            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
214d7a
-                AcpiDmAddressNames[i]);
214d7a
+            Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i];
214d7a
+            AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Tmp16),
214d7a
+                         AcpiDmAddressNames[i]);
214d7a
             break;
214d7a
 
214d7a
         case 32:
214d7a
 
214d7a
-            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
214d7a
-                AcpiDmAddressNames[i]);
214d7a
+            Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i];
214d7a
+            AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Tmp32),
214d7a
+                         AcpiDmAddressNames[i]);
214d7a
             break;
214d7a
 
214d7a
         case 64:
214d7a
 
214d7a
-            AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
214d7a
-                AcpiDmAddressNames[i]);
214d7a
+            Tmp64 = ACPI_CAST_PTR (UINT64, Source)[i];
214d7a
+            AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Tmp64),
214d7a
+                         AcpiDmAddressNames[i]);
214d7a
             break;
214d7a
 
214d7a
         default:
214d7a
@@ -749,7 +759,7 @@ AcpiDmExtendedDescriptor (
214d7a
     /* Extra field for this descriptor only */
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
214d7a
+    AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Resource->ExtAddress64.TypeSpecific),
214d7a
         "Type-Specific Attributes");
214d7a
 
214d7a
     /* Insert a descriptor name */
214d7a
@@ -876,11 +886,11 @@ AcpiDmFixedMemory32Descriptor (
214d7a
         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
214d7a
+    AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Resource->FixedMemory32.Address),
214d7a
         "Address Base");
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
214d7a
+    AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Resource->FixedMemory32.AddressLength),
214d7a
         "Address Length");
214d7a
 
214d7a
     /* Insert a descriptor name */
214d7a
@@ -926,7 +936,8 @@ AcpiDmGenericRegisterDescriptor (
214d7a
     AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
214d7a
+    AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Resource->GenericReg.Address),
214d7a
+                 "Address");
214d7a
 
214d7a
     /* Optional field for ACPI 3.0 */
214d7a
 
214d7a
@@ -989,7 +1000,7 @@ AcpiDmInterruptDescriptor (
214d7a
     AcpiDmResourceSource (Resource,
214d7a
         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
214d7a
             ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
214d7a
-        Resource->ExtendedIrq.ResourceLength);
214d7a
+            AcpiUtReadUint16 (&Resource->ExtendedIrq.ResourceLength));
214d7a
 
214d7a
     /* Insert a descriptor name */
214d7a
 
214d7a
@@ -1004,7 +1015,7 @@ AcpiDmInterruptDescriptor (
214d7a
     {
214d7a
         AcpiDmIndent (Level + 1);
214d7a
         AcpiOsPrintf ("0x%8.8X,\n",
214d7a
-            (UINT32) Resource->ExtendedIrq.Interrupts[i]);
214d7a
+            AcpiUtReadUint32 (&Resource->ExtendedIrq.Interrupts[i]));
214d7a
     }
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
Index: acpica-unix2-20210604/source/components/disassembler/dmresrcl2.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrcl2.c
214d7a
+++ acpica-unix2-20210604/source/components/disassembler/dmresrcl2.c
214d7a
@@ -199,22 +199,27 @@ AcpiDmGpioCommon (
214d7a
     char                    *DeviceName = NULL;
214d7a
     UINT32                  PinCount;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  ResSourceOffset;
214d7a
+    UINT16                  VendorOffset;
214d7a
+    UINT16                  VendorLength;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     /* ResourceSource, ResourceSourceIndex, ResourceType */
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    if (Resource->Gpio.ResSourceOffset)
214d7a
+    ResSourceOffset = AcpiUtReadUint16 (&Resource->Gpio.ResSourceOffset);
214d7a
+    if (ResSourceOffset)
214d7a
     {
214d7a
         DeviceName = ACPI_ADD_PTR (char,
214d7a
-            Resource, Resource->Gpio.ResSourceOffset),
214d7a
+            Resource, ResSourceOffset),
214d7a
         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
214d7a
     }
214d7a
 
214d7a
     AcpiOsPrintf (", ");
214d7a
     AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
214d7a
-    AcpiOsPrintf ("%s, ",
214d7a
-        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
214d7a
+    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.Flags);
214d7a
+    AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Tmp16)]);
214d7a
 
214d7a
     /* Insert a descriptor name */
214d7a
 
214d7a
@@ -223,15 +228,15 @@ AcpiDmGpioCommon (
214d7a
 
214d7a
     /* Dump the vendor data */
214d7a
 
214d7a
-    if (Resource->Gpio.VendorOffset)
214d7a
+    VendorOffset = AcpiUtReadUint16 (&Resource->Gpio.VendorOffset);
214d7a
+    VendorLength = AcpiUtReadUint16 (&Resource->Gpio.VendorLength);
214d7a
+    if (VendorOffset)
214d7a
     {
214d7a
         AcpiOsPrintf ("\n");
214d7a
         AcpiDmIndent (Level + 1);
214d7a
-        VendorData = ACPI_ADD_PTR (UINT8, Resource,
214d7a
-            Resource->Gpio.VendorOffset);
214d7a
+        VendorData = ACPI_ADD_PTR (UINT8, Resource, VendorOffset);
214d7a
 
214d7a
-        AcpiDmDumpRawDataBuffer (VendorData,
214d7a
-            Resource->Gpio.VendorLength, Level);
214d7a
+        AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
214d7a
     }
214d7a
 
214d7a
     AcpiOsPrintf (")\n");
214d7a
@@ -241,17 +246,17 @@ AcpiDmGpioCommon (
214d7a
     AcpiDmIndent (Level + 1);
214d7a
     AcpiOsPrintf ("{   // Pin list\n");
214d7a
 
214d7a
-    PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
214d7a
-        Resource->Gpio.PinTableOffset)) /
214d7a
-        sizeof (UINT16);
214d7a
+    PinCount = (UINT32) AcpiUtReadUint16 (&Resource->Gpio.ResSourceOffset);
214d7a
+    PinCount -= (UINT32) AcpiUtReadUint16 (&Resource->Gpio.PinTableOffset);
214d7a
+    PinCount /= sizeof (UINT16);
214d7a
 
214d7a
     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
214d7a
-        Resource->Gpio.PinTableOffset);
214d7a
+        AcpiUtReadUint16 (&Resource->Gpio.PinTableOffset));
214d7a
 
214d7a
     for (i = 0; i < PinCount; i++)
214d7a
     {
214d7a
         AcpiDmIndent (Level + 2);
214d7a
-        AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
214d7a
+        AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16 (&(PinList[i])),
214d7a
             ((i + 1) < PinCount) ? "," : "");
214d7a
     }
214d7a
 
214d7a
@@ -285,16 +290,18 @@ AcpiDmGpioIntDescriptor (
214d7a
     UINT32                  Length,
214d7a
     UINT32                  Level)
214d7a
 {
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
     /* Dump the GpioInt-specific portion of the descriptor */
214d7a
 
214d7a
     /* EdgeLevel, ActiveLevel, Shared */
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
+    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags);
214d7a
     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
214d7a
-        AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
214d7a
-        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
214d7a
-        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
214d7a
+        AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Tmp16)],
214d7a
+        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 1)],
214d7a
+        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
214d7a
 
214d7a
     /* PinConfig, DebounceTimeout */
214d7a
 
214d7a
@@ -307,7 +314,8 @@ AcpiDmGpioIntDescriptor (
214d7a
     {
214d7a
         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
214d7a
     }
214d7a
-    AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
214d7a
+    AcpiOsPrintf ("0x%4.4X,\n",
214d7a
+          AcpiUtReadUint16 (&Resource->Gpio.DebounceTimeout));
214d7a
 
214d7a
     /* Dump the GpioInt/GpioIo common portion of the descriptor */
214d7a
 
214d7a
@@ -337,14 +345,16 @@ AcpiDmGpioIoDescriptor (
214d7a
     UINT32                  Length,
214d7a
     UINT32                  Level)
214d7a
 {
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
     /* Dump the GpioIo-specific portion of the descriptor */
214d7a
 
214d7a
     /* Shared, PinConfig */
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
+    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags);
214d7a
     AcpiOsPrintf ("GpioIo (%s, ",
214d7a
-        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
214d7a
+        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
214d7a
 
214d7a
     if (Resource->Gpio.PinConfig <= 3)
214d7a
     {
214d7a
@@ -358,10 +368,10 @@ AcpiDmGpioIoDescriptor (
214d7a
 
214d7a
     /* DebounceTimeout, DriveStrength, IoRestriction */
214d7a
 
214d7a
-    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
214d7a
-    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
214d7a
-    AcpiOsPrintf ("%s,\n",
214d7a
-        AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
214d7a
+    AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16 (&Resource->Gpio.DebounceTimeout));
214d7a
+    AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16 (&Resource->Gpio.DriveStrength));
214d7a
+    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags);
214d7a
+    AcpiOsPrintf ("%s,\n", AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Tmp16)]);
214d7a
 
214d7a
     /* Dump the GpioInt/GpioIo common portion of the descriptor */
214d7a
 
214d7a
@@ -442,6 +452,9 @@ AcpiDmPinFunctionDescriptor (
214d7a
     char                    *DeviceName = NULL;
214d7a
     UINT32                  PinCount;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  ResSourceOffset;
214d7a
+    UINT16                  VendorOffset;
214d7a
+    UINT16                  VendorLength;
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
     AcpiOsPrintf ("PinFunction (%s, ",
214d7a
@@ -459,12 +472,14 @@ AcpiDmPinFunctionDescriptor (
214d7a
 
214d7a
     /* FunctionNumber */
214d7a
 
214d7a
-    AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
214d7a
+    AcpiOsPrintf ("0x%4.4X, ",
214d7a
+          AcpiUtReadUint16 (&Resource->PinFunction.FunctionNumber));
214d7a
 
214d7a
-    if (Resource->PinFunction.ResSourceOffset)
214d7a
+    ResSourceOffset = AcpiUtReadUint16 (&Resource->PinFunction.ResSourceOffset);
214d7a
+    if (ResSourceOffset)
214d7a
     {
214d7a
         DeviceName = ACPI_ADD_PTR (char,
214d7a
-            Resource, Resource->PinFunction.ResSourceOffset),
214d7a
+            Resource, ResSourceOffset),
214d7a
         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
214d7a
     }
214d7a
 
214d7a
@@ -484,15 +499,15 @@ AcpiDmPinFunctionDescriptor (
214d7a
 
214d7a
     /* Dump the vendor data */
214d7a
 
214d7a
-    if (Resource->PinFunction.VendorLength)
214d7a
+    VendorOffset = AcpiUtReadUint16 (&Resource->PinFunction.VendorOffset);
214d7a
+    VendorLength = AcpiUtReadUint16 (&Resource->PinFunction.VendorLength);
214d7a
+    if (VendorLength)
214d7a
     {
214d7a
         AcpiOsPrintf ("\n");
214d7a
         AcpiDmIndent (Level + 1);
214d7a
-        VendorData = ACPI_ADD_PTR (UINT8, Resource,
214d7a
-            Resource->PinFunction.VendorOffset);
214d7a
+        VendorData = ACPI_ADD_PTR (UINT8, Resource, VendorOffset);
214d7a
 
214d7a
-        AcpiDmDumpRawDataBuffer (VendorData,
214d7a
-            Resource->PinFunction.VendorLength, Level);
214d7a
+        AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
214d7a
     }
214d7a
 
214d7a
     AcpiOsPrintf (")\n");
214d7a
@@ -503,17 +518,17 @@ AcpiDmPinFunctionDescriptor (
214d7a
 
214d7a
     AcpiOsPrintf ("{   // Pin list\n");
214d7a
 
214d7a
-    PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
214d7a
-        Resource->PinFunction.PinTableOffset)) /
214d7a
-        sizeof (UINT16);
214d7a
+    PinCount = AcpiUtReadUint16 (&Resource->PinFunction.ResSourceOffset);
214d7a
+    PinCount -= AcpiUtReadUint16 (&Resource->PinFunction.PinTableOffset);
214d7a
+    PinCount /= sizeof (UINT16);
214d7a
 
214d7a
     PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
214d7a
-        Resource->PinFunction.PinTableOffset);
214d7a
+        AcpiUtReadUint16 (&Resource->PinFunction.PinTableOffset));
214d7a
 
214d7a
     for (i = 0; i < PinCount; i++)
214d7a
     {
214d7a
         AcpiDmIndent (Level + 2);
214d7a
-        AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
214d7a
+        AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16 (&(PinList[i])),
214d7a
             ((i + 1) < PinCount) ? "," : "");
214d7a
     }
214d7a
 
214d7a
@@ -549,7 +564,8 @@ AcpiDmDumpSerialBusVendorData (
214d7a
     {
214d7a
     case AML_RESOURCE_I2C_SERIALBUSTYPE:
214d7a
 
214d7a
-        VendorLength = Resource->CommonSerialBus.TypeDataLength -
214d7a
+        VendorLength =
214d7a
+            AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) -
214d7a
             AML_RESOURCE_I2C_MIN_DATA_LEN;
214d7a
 
214d7a
         VendorData = ACPI_ADD_PTR (UINT8, Resource,
214d7a
@@ -558,7 +574,8 @@ AcpiDmDumpSerialBusVendorData (
214d7a
 
214d7a
     case AML_RESOURCE_SPI_SERIALBUSTYPE:
214d7a
 
214d7a
-        VendorLength = Resource->CommonSerialBus.TypeDataLength -
214d7a
+        VendorLength =
214d7a
+            AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) -
214d7a
             AML_RESOURCE_SPI_MIN_DATA_LEN;
214d7a
 
214d7a
         VendorData = ACPI_ADD_PTR (UINT8, Resource,
214d7a
@@ -567,7 +584,8 @@ AcpiDmDumpSerialBusVendorData (
214d7a
 
214d7a
     case AML_RESOURCE_UART_SERIALBUSTYPE:
214d7a
 
214d7a
-        VendorLength = Resource->CommonSerialBus.TypeDataLength -
214d7a
+        VendorLength =
214d7a
+            AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) -
214d7a
             AML_RESOURCE_UART_MIN_DATA_LEN;
214d7a
 
214d7a
         VendorData = ACPI_ADD_PTR (UINT8, Resource,
214d7a
@@ -693,9 +711,9 @@ AcpiDmI2cSerialBusDescriptor (
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
214d7a
-        Resource->I2cSerialBus.SlaveAddress,
214d7a
+        AcpiUtReadUint16 (&Resource->I2cSerialBus.SlaveAddress),
214d7a
         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
214d7a
-        Resource->I2cSerialBus.ConnectionSpeed);
214d7a
+        AcpiUtReadUint32 (&Resource->I2cSerialBus.ConnectionSpeed));
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
     AcpiOsPrintf ("%s, ",
214d7a
@@ -704,7 +722,7 @@ AcpiDmI2cSerialBusDescriptor (
214d7a
     /* ResourceSource is a required field */
214d7a
 
214d7a
     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
214d7a
-        Resource->CommonSerialBus.TypeDataLength;
214d7a
+        AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength);
214d7a
 
214d7a
     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
214d7a
     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
214d7a
@@ -761,15 +779,17 @@ AcpiDmSpiSerialBusDescriptor (
214d7a
 {
214d7a
     UINT32                  ResourceSourceOffset;
214d7a
     char                    *DeviceName;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
+    Tmp16 = AcpiUtReadUint16 (&Resource->SpiSerialBus.TypeSpecificFlags);
214d7a
     AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
214d7a
-        Resource->SpiSerialBus.DeviceSelection,
214d7a
-        AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
214d7a
-        AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
214d7a
+        AcpiUtReadUint16 (&Resource->SpiSerialBus.DeviceSelection),
214d7a
+        AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Tmp16, 1)],
214d7a
+        AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Tmp16)],
214d7a
         Resource->SpiSerialBus.DataBitLength);
214d7a
 
214d7a
     /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
214d7a
@@ -777,7 +797,7 @@ AcpiDmSpiSerialBusDescriptor (
214d7a
     AcpiDmIndent (Level + 1);
214d7a
     AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
214d7a
         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
214d7a
-        Resource->SpiSerialBus.ConnectionSpeed,
214d7a
+        AcpiUtReadUint32 (&Resource->SpiSerialBus.ConnectionSpeed),
214d7a
         AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
@@ -787,7 +807,7 @@ AcpiDmSpiSerialBusDescriptor (
214d7a
     /* ResourceSource is a required field */
214d7a
 
214d7a
     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
214d7a
-        Resource->CommonSerialBus.TypeDataLength;
214d7a
+        AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength);
214d7a
 
214d7a
     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
214d7a
     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
214d7a
@@ -844,15 +864,17 @@ AcpiDmUartSerialBusDescriptor (
214d7a
 {
214d7a
     UINT32                  ResourceSourceOffset;
214d7a
     char                    *DeviceName;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     /* ConnectionSpeed, BitsPerByte, StopBits */
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
+    Tmp16 = AcpiUtReadUint16 (&Resource->UartSerialBus.TypeSpecificFlags);
214d7a
     AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
214d7a
-        Resource->UartSerialBus.DefaultBaudRate,
214d7a
-        AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
214d7a
-        AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
214d7a
+        AcpiUtReadUint32 (&Resource->UartSerialBus.DefaultBaudRate),
214d7a
+        AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Tmp16, 4)],
214d7a
+        AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 2)]);
214d7a
 
214d7a
     /* LinesInUse, IsBigEndian, Parity, FlowControl */
214d7a
 
214d7a
@@ -867,13 +889,13 @@ AcpiDmUartSerialBusDescriptor (
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
     AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
214d7a
-        Resource->UartSerialBus.RxFifoSize,
214d7a
-        Resource->UartSerialBus.TxFifoSize);
214d7a
+        AcpiUtReadUint16 (&Resource->UartSerialBus.RxFifoSize),
214d7a
+        AcpiUtReadUint16 (&Resource->UartSerialBus.TxFifoSize));
214d7a
 
214d7a
     /* ResourceSource is a required field */
214d7a
 
214d7a
     ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
214d7a
-        Resource->CommonSerialBus.TypeDataLength;
214d7a
+        AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength);
214d7a
 
214d7a
     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
214d7a
     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
214d7a
Index: acpica-unix2-20210604/source/components/disassembler/dmresrcs.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/disassembler/dmresrcs.c
214d7a
+++ acpica-unix2-20210604/source/components/disassembler/dmresrcs.c
214d7a
@@ -93,7 +93,7 @@ AcpiDmIrqDescriptor (
214d7a
     AcpiOsPrintf (")\n");
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmBitList (Resource->Irq.IrqMask);
214d7a
+    AcpiDmBitList (AcpiUtReadUint16 (&Resource->Irq.IrqMask));
214d7a
 }
214d7a
 
214d7a
 
214d7a
@@ -161,8 +161,8 @@ AcpiDmFixedDmaDescriptor (
214d7a
 
214d7a
     AcpiDmIndent (Level);
214d7a
     AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ",
214d7a
-        Resource->FixedDma.RequestLines,
214d7a
-        Resource->FixedDma.Channels);
214d7a
+        AcpiUtReadUint16 (&Resource->FixedDma.RequestLines),
214d7a
+        AcpiUtReadUint16 (&Resource->FixedDma.Channels));
214d7a
 
214d7a
     if (Resource->FixedDma.Width <= 5)
214d7a
     {
214d7a
@@ -210,10 +210,12 @@ AcpiDmIoDescriptor (
214d7a
         AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
214d7a
+    AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->Io.Minimum),
214d7a
+                 "Range Minimum");
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
214d7a
+    AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->Io.Maximum),
214d7a
+                 "Range Maximum");
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
     AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
214d7a
@@ -256,10 +258,12 @@ AcpiDmFixedIoDescriptor (
214d7a
     AcpiOsPrintf ("FixedIO (\n");
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
214d7a
+    AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->FixedIo.Address),
214d7a
+                 "Address");
214d7a
 
214d7a
     AcpiDmIndent (Level + 1);
214d7a
-    AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
214d7a
+    AcpiDmDumpInteger8 (AcpiUtReadUint16 (&Resource->FixedIo.AddressLength),
214d7a
+            "Length");
214d7a
 
214d7a
     /* Insert a descriptor name */
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/components/disassembler/dmwalk.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/disassembler/dmwalk.c
214d7a
+++ acpica-unix2-20210604/source/components/disassembler/dmwalk.c
214d7a
@@ -1155,7 +1155,7 @@ AcpiDmAscendingOp (
214d7a
         {
214d7a
             ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
214d7a
             ASL_CV_CLOSE_PAREN (Op, Level);
214d7a
-            AcpiOsPrintf ("{");
214d7a
+            AcpiOsPrintf (" {");
214d7a
         }
214d7a
     }
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/components/namespace/nsaccess.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/namespace/nsaccess.c
214d7a
+++ acpica-unix2-20210604/source/components/namespace/nsaccess.c
214d7a
@@ -644,7 +644,7 @@ AcpiNsLookup (
214d7a
 
214d7a
         /* Extract one ACPI name from the front of the pathname */
214d7a
 
214d7a
-        ACPI_MOVE_32_TO_32 (&SimpleName, Path);
214d7a
+        ACPI_COPY_NAMESEG (&SimpleName, Path);
214d7a
 
214d7a
         /* Try to find the single (4 character) ACPI name */
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/components/namespace/nsnames.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/namespace/nsnames.c
214d7a
+++ acpica-unix2-20210604/source/components/namespace/nsnames.c
214d7a
@@ -297,10 +297,10 @@ AcpiNsBuildNormalizedPath (
214d7a
     {
214d7a
         if (NextNode != Node)
214d7a
         {
214d7a
-            ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length);
214d7a
+            ACPI_PATH_PUT8 (FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length);
214d7a
         }
214d7a
 
214d7a
-        ACPI_MOVE_32_TO_32 (Name, &NextNode->Name);
214d7a
+        ACPI_COPY_NAMESEG (Name, &NextNode->Name);
214d7a
         DoNoTrailing = NoTrailing;
214d7a
         for (i = 0; i < 4; i++)
214d7a
         {
214d7a
Index: acpica-unix2-20210604/source/components/namespace/nsparse.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/namespace/nsparse.c
214d7a
+++ acpica-unix2-20210604/source/components/namespace/nsparse.c
214d7a
@@ -203,6 +203,7 @@ AcpiNsOneCompleteParse (
214d7a
     ACPI_WALK_STATE         *WalkState;
214d7a
     ACPI_TABLE_HEADER       *Table;
214d7a
     ACPI_OWNER_ID           OwnerId;
214d7a
+    UINT32                  TableLength;
214d7a
 
214d7a
 
214d7a
     ACPI_FUNCTION_TRACE (NsOneCompleteParse);
214d7a
@@ -216,13 +217,14 @@ AcpiNsOneCompleteParse (
214d7a
 
214d7a
     /* Table must consist of at least a complete header */
214d7a
 
214d7a
-    if (Table->Length < sizeof (ACPI_TABLE_HEADER))
214d7a
+    TableLength = AcpiUtReadUint32 (&Table->Length);
214d7a
+    if (TableLength < sizeof (ACPI_TABLE_HEADER))
214d7a
     {
214d7a
         return_ACPI_STATUS (AE_BAD_HEADER);
214d7a
     }
214d7a
 
214d7a
     AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
214d7a
-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
214d7a
+    AmlLength = TableLength - sizeof (ACPI_TABLE_HEADER);
214d7a
 
214d7a
     Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
214d7a
     if (ACPI_FAILURE (Status))
214d7a
Index: acpica-unix2-20210604/source/components/namespace/nsutils.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/namespace/nsutils.c
214d7a
+++ acpica-unix2-20210604/source/components/namespace/nsutils.c
214d7a
@@ -272,7 +272,6 @@ AcpiNsBuildInternalName (
214d7a
     const char              *ExternalName = Info->NextExternalChar;
214d7a
     char                    *Result = NULL;
214d7a
     UINT32                  i;
214d7a
-    char                    TmpSeg[ACPI_NAMESEG_SIZE+1];
214d7a
 
214d7a
 
214d7a
     ACPI_FUNCTION_TRACE (NsBuildInternalName);
214d7a
@@ -336,7 +335,6 @@ AcpiNsBuildInternalName (
214d7a
 
214d7a
     for (; NumSegments; NumSegments--)
214d7a
     {
214d7a
-        memset (TmpSeg, 0, ACPI_NAMESEG_SIZE+1);
214d7a
         for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
214d7a
         {
214d7a
             if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
214d7a
@@ -344,17 +342,16 @@ AcpiNsBuildInternalName (
214d7a
             {
214d7a
                 /* Pad the segment with underscore(s) if segment is short */
214d7a
 
214d7a
-                TmpSeg[i] = '_';
214d7a
+                Result[i] = '_';
214d7a
             }
214d7a
             else
214d7a
             {
214d7a
                 /* Convert the character to uppercase and save it */
214d7a
 
214d7a
-                TmpSeg[i] = (char) toupper ((int) *ExternalName);
214d7a
+                Result[i] = (char) toupper ((int) *ExternalName);
214d7a
                 ExternalName++;
214d7a
             }
214d7a
         }
214d7a
-    AcpiUtWriteUint (Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE);
214d7a
 
214d7a
         /* Now we must have a path separator, or the pathname is bad */
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/components/utilities/utresrc.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/components/utilities/utresrc.c
214d7a
+++ acpica-unix2-20210604/source/components/utilities/utresrc.c
214d7a
@@ -541,7 +541,7 @@ AcpiUtGetResourceLength (
214d7a
     {
214d7a
         /* Large Resource type -- bytes 1-2 contain the 16-bit length */
214d7a
 
214d7a
-        ACPI_MOVE_16_TO_16 (&ResourceLength, ACPI_ADD_PTR (UINT8, Aml, 1));
214d7a
+        ResourceLength = AcpiUtReadUint16 (ACPI_ADD_PTR (UINT8, Aml, 1));
214d7a
 
214d7a
     }
214d7a
     else
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype2e.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype2e.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype2e.c
214d7a
@@ -80,6 +80,7 @@ RsDoExtendedIoDescriptor (
214d7a
     UINT16                  StringLength = 0;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -139,7 +140,8 @@ RsDoExtendedIoDescriptor (
214d7a
 
214d7a
         case 5: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Granularity =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -147,7 +149,8 @@ RsDoExtendedIoDescriptor (
214d7a
 
214d7a
         case 6: /* Address Min */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Minimum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -155,7 +158,8 @@ RsDoExtendedIoDescriptor (
214d7a
 
214d7a
         case 7: /* Address Max */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Maximum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -163,14 +167,16 @@ RsDoExtendedIoDescriptor (
214d7a
 
214d7a
         case 8: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.TranslationOffset =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 9: /* Address Length */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.AddressLength =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -178,7 +184,8 @@ RsDoExtendedIoDescriptor (
214d7a
 
214d7a
         case 10: /* Type-Specific Attributes */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.TypeSpecific =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
214d7a
             break;
214d7a
@@ -213,11 +220,14 @@ RsDoExtendedIoDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->ExtAddress64.ResourceLength;
214d7a
+    Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        Descriptor->ExtAddress64.Minimum,
214d7a
-        Descriptor->ExtAddress64.Maximum,
214d7a
-        Descriptor->ExtAddress64.AddressLength,
214d7a
-        Descriptor->ExtAddress64.Granularity,
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity),
214d7a
         Descriptor->ExtAddress64.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
@@ -253,6 +263,7 @@ RsDoExtendedMemoryDescriptor (
214d7a
     UINT16                  StringLength = 0;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -319,7 +330,8 @@ RsDoExtendedMemoryDescriptor (
214d7a
 
214d7a
         case 6: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Granularity =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -327,7 +339,8 @@ RsDoExtendedMemoryDescriptor (
214d7a
 
214d7a
         case 7: /* Min Address */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Minimum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -335,7 +348,8 @@ RsDoExtendedMemoryDescriptor (
214d7a
 
214d7a
         case 8: /* Max Address */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Maximum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -343,14 +357,16 @@ RsDoExtendedMemoryDescriptor (
214d7a
 
214d7a
         case 9: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.TranslationOffset =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 10: /* Address Length */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.AddressLength =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -358,7 +374,8 @@ RsDoExtendedMemoryDescriptor (
214d7a
 
214d7a
         case 11: /* Type-Specific Attributes */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.TypeSpecific =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
214d7a
             break;
214d7a
@@ -394,11 +411,14 @@ RsDoExtendedMemoryDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->ExtAddress64.ResourceLength;
214d7a
+    Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        Descriptor->ExtAddress64.Minimum,
214d7a
-        Descriptor->ExtAddress64.Maximum,
214d7a
-        Descriptor->ExtAddress64.AddressLength,
214d7a
-        Descriptor->ExtAddress64.Granularity,
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity),
214d7a
         Descriptor->ExtAddress64.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
@@ -434,6 +454,7 @@ RsDoExtendedSpaceDescriptor (
214d7a
     UINT16                  StringLength = 0;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -497,7 +518,8 @@ RsDoExtendedSpaceDescriptor (
214d7a
 
214d7a
         case 6: /* Address Granularity */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Granularity =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
214d7a
             GranOp = InitializerOp;
214d7a
@@ -505,7 +527,8 @@ RsDoExtendedSpaceDescriptor (
214d7a
 
214d7a
         case 7: /* Min Address */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Minimum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
214d7a
             MinOp = InitializerOp;
214d7a
@@ -513,7 +536,8 @@ RsDoExtendedSpaceDescriptor (
214d7a
 
214d7a
         case 8: /* Max Address */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.Maximum =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
214d7a
             MaxOp = InitializerOp;
214d7a
@@ -521,14 +545,16 @@ RsDoExtendedSpaceDescriptor (
214d7a
 
214d7a
         case 9: /* Translation Offset */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.TranslationOffset =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
214d7a
             break;
214d7a
 
214d7a
         case 10: /* Address Length */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.AddressLength =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
214d7a
             LengthOp = InitializerOp;
214d7a
@@ -536,7 +562,8 @@ RsDoExtendedSpaceDescriptor (
214d7a
 
214d7a
         case 11: /* Type-Specific Attributes */
214d7a
 
214d7a
-            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->ExtAddress64.TypeSpecific =
214d7a
+                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
214d7a
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
214d7a
             break;
214d7a
@@ -557,11 +584,14 @@ RsDoExtendedSpaceDescriptor (
214d7a
 
214d7a
     /* Validate the Min/Max/Len/Gran values */
214d7a
 
214d7a
+    Tmp16 = Descriptor->ExtAddress64.ResourceLength;
214d7a
+    Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     RsLargeAddressCheck (
214d7a
-        Descriptor->ExtAddress64.Minimum,
214d7a
-        Descriptor->ExtAddress64.Maximum,
214d7a
-        Descriptor->ExtAddress64.AddressLength,
214d7a
-        Descriptor->ExtAddress64.Granularity,
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength),
214d7a
+        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity),
214d7a
         Descriptor->ExtAddress64.Flags,
214d7a
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
214d7a
 
214d7a
Index: acpica-unix2-20210604/source/compiler/aslrestype2s.c
214d7a
===================================================================
214d7a
--- acpica-unix2-20210604.orig/source/compiler/aslrestype2s.c
214d7a
+++ acpica-unix2-20210604/source/compiler/aslrestype2s.c
214d7a
@@ -343,6 +343,7 @@ RsDoGpioIntDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  PinCount = 0;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -485,7 +486,8 @@ RsDoGpioIntDescriptor (
214d7a
              *  (implies resource source must immediately follow the pin list.)
214d7a
              *  Name: _PIN
214d7a
              */
214d7a
-            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            *InterruptList = AcpiUtReadUint16 (&Tmp16);
214d7a
             InterruptList++;
214d7a
             PinCount++;
214d7a
 
214d7a
@@ -518,6 +520,27 @@ RsDoGpioIntDescriptor (
214d7a
 
214d7a
     MpSaveGpioInfo (Info->MappingOp, Descriptor,
214d7a
         PinCount, PinList, ResourceSource);
214d7a
+
214d7a
+    /* correct endian-ness issues */
214d7a
+    Tmp16 = Descriptor->Gpio.ResourceLength;
214d7a
+    Descriptor->Gpio.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.Flags;
214d7a
+    Descriptor->Gpio.Flags = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.IntFlags;
214d7a
+    Descriptor->Gpio.IntFlags = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.DriveStrength;
214d7a
+    Descriptor->Gpio.DriveStrength = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.DebounceTimeout;
214d7a
+    Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.PinTableOffset;
214d7a
+    Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.ResSourceOffset;
214d7a
+    Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.VendorOffset;
214d7a
+    Descriptor->Gpio.VendorOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.VendorLength;
214d7a
+    Descriptor->Gpio.VendorLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     return (Rnode);
214d7a
 }
214d7a
 
214d7a
@@ -552,6 +575,7 @@ RsDoGpioIoDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  PinCount = 0;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -691,7 +715,8 @@ RsDoGpioIoDescriptor (
214d7a
              *  (implies resource source must immediately follow the pin list.)
214d7a
              *  Name: _PIN
214d7a
              */
214d7a
-            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            *InterruptList = AcpiUtReadUint16 (&Tmp16);
214d7a
             InterruptList++;
214d7a
             PinCount++;
214d7a
 
214d7a
@@ -724,6 +749,27 @@ RsDoGpioIoDescriptor (
214d7a
 
214d7a
     MpSaveGpioInfo (Info->MappingOp, Descriptor,
214d7a
         PinCount, PinList, ResourceSource);
214d7a
+
214d7a
+    /* correct endian-ness issues */
214d7a
+    Tmp16 = Descriptor->Gpio.ResourceLength;
214d7a
+    Descriptor->Gpio.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.Flags;
214d7a
+    Descriptor->Gpio.Flags = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.IntFlags;
214d7a
+    Descriptor->Gpio.IntFlags = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.DriveStrength;
214d7a
+    Descriptor->Gpio.DriveStrength = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.DebounceTimeout;
214d7a
+    Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.PinTableOffset;
214d7a
+    Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.ResSourceOffset;
214d7a
+    Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.VendorOffset;
214d7a
+    Descriptor->Gpio.VendorOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->Gpio.VendorLength;
214d7a
+    Descriptor->Gpio.VendorLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     return (Rnode);
214d7a
 }
214d7a
 
214d7a
@@ -754,6 +800,8 @@ RsDoI2cSerialBusDescriptor (
214d7a
     UINT16                  DescriptorSize;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -781,7 +829,8 @@ RsDoI2cSerialBusDescriptor (
214d7a
     Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
214d7a
     Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
214d7a
     Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
214d7a
-    Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
214d7a
+    Tmp16 = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
214d7a
+    Descriptor->I2cSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
214d7a
     {
214d7a
@@ -795,13 +844,15 @@ RsDoI2cSerialBusDescriptor (
214d7a
 
214d7a
     /* Process all child initialization nodes */
214d7a
 
214d7a
+    Descriptor->I2cSerialBus.TypeSpecificFlags = 0;
214d7a
     for (i = 0; InitializerOp; i++)
214d7a
     {
214d7a
         switch (i)
214d7a
         {
214d7a
         case 0: /* Slave Address [WORD] (_ADR) */
214d7a
 
214d7a
-            Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->I2cSerialBus.SlaveAddress = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
214d7a
             break;
214d7a
@@ -815,16 +866,19 @@ RsDoI2cSerialBusDescriptor (
214d7a
 
214d7a
         case 2: /* Connection Speed [DWORD] (_SPE) */
214d7a
 
214d7a
-            Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->I2cSerialBus.ConnectionSpeed = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
214d7a
             break;
214d7a
 
214d7a
         case 3: /* Addressing Mode [Flag] (_MOD) */
214d7a
 
214d7a
-            RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
214d7a
+            Tmp16 = AcpiUtReadUint16 (&Descriptor->I2cSerialBus.TypeSpecificFlags);
214d7a
+            RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0);
214d7a
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
214d7a
+            Descriptor->I2cSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);
214d7a
             break;
214d7a
 
214d7a
         case 4: /* ResSource [Optional Field - STRING] */
214d7a
@@ -882,6 +936,8 @@ RsDoI2cSerialBusDescriptor (
214d7a
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
214d7a
     }
214d7a
 
214d7a
+    Tmp16 = Descriptor->I2cSerialBus.ResourceLength;
214d7a
+    Descriptor->I2cSerialBus.ResourceLength = AcpiUtReadUint16 (&Tmp16);
214d7a
     MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
214d7a
     return (Rnode);
214d7a
 }
214d7a
@@ -913,6 +969,8 @@ RsDoSpiSerialBusDescriptor (
214d7a
     UINT16                  DescriptorSize;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -935,12 +993,13 @@ RsDoSpiSerialBusDescriptor (
214d7a
         sizeof (AML_RESOURCE_LARGE_HEADER));
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
-    Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
214d7a
+    Descriptor->SpiSerialBus.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
214d7a
     Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
214d7a
     Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
214d7a
     Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
214d7a
     Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
214d7a
-    Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
214d7a
+    Tmp16 = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
214d7a
+    Descriptor->SpiSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2)
214d7a
     {
214d7a
@@ -955,29 +1014,35 @@ RsDoSpiSerialBusDescriptor (
214d7a
 
214d7a
     /* Process all child initialization nodes */
214d7a
 
214d7a
+    Descriptor->SpiSerialBus.TypeSpecificFlags = 0;
214d7a
     for (i = 0; InitializerOp; i++)
214d7a
     {
214d7a
         switch (i)
214d7a
         {
214d7a
         case 0: /* Device Selection [WORD] (_ADR) */
214d7a
 
214d7a
-            Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->SpiSerialBus.DeviceSelection = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
214d7a
             break;
214d7a
 
214d7a
         case 1: /* Device Polarity [Flag] (_DPL) */
214d7a
 
214d7a
-            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
214d7a
+            Tmp16 = AcpiUtReadUint16 (&Descriptor->SpiSerialBus.TypeSpecificFlags);
214d7a
+            RsSetFlagBits16 (&Tmp16, InitializerOp, 1, 0);
214d7a
             RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
214d7a
+            Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);
214d7a
             break;
214d7a
 
214d7a
         case 2: /* Wire Mode [Flag] (_MOD) */
214d7a
 
214d7a
-            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
214d7a
+            Tmp16 = AcpiUtReadUint16 (&Descriptor->SpiSerialBus.TypeSpecificFlags);
214d7a
+            RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0);
214d7a
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
214d7a
+            Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);
214d7a
             break;
214d7a
 
214d7a
         case 3: /* Device Bit Length [BYTE] (_LEN) */
214d7a
@@ -996,7 +1061,8 @@ RsDoSpiSerialBusDescriptor (
214d7a
 
214d7a
         case 5: /* Connection Speed [DWORD] (_SPE) */
214d7a
 
214d7a
-            Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->SpiSerialBus.ConnectionSpeed = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
214d7a
             break;
214d7a
@@ -1101,6 +1167,8 @@ RsDoUartSerialBusDescriptor (
214d7a
     UINT16                  DescriptorSize;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
@@ -1123,12 +1191,13 @@ RsDoUartSerialBusDescriptor (
214d7a
         sizeof (AML_RESOURCE_LARGE_HEADER));
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
-    Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
214d7a
+    Descriptor->UartSerialBus.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
214d7a
     Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
214d7a
     Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
214d7a
     Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
214d7a
     Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
214d7a
-    Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
214d7a
+    Tmp16 = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
214d7a
+    Descriptor->UartSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16);
214d7a
 
214d7a
     if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2)
214d7a
     {
214d7a
@@ -1142,29 +1211,35 @@ RsDoUartSerialBusDescriptor (
214d7a
 
214d7a
     /* Process all child initialization nodes */
214d7a
 
214d7a
+    Descriptor->UartSerialBus.TypeSpecificFlags = 0;
214d7a
     for (i = 0; InitializerOp; i++)
214d7a
     {
214d7a
         switch (i)
214d7a
         {
214d7a
         case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
214d7a
 
214d7a
-            Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->UartSerialBus.DefaultBaudRate = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
214d7a
             break;
214d7a
 
214d7a
         case 1: /* Bits Per Byte [Flags] (_LEN) */
214d7a
 
214d7a
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
214d7a
+            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
214d7a
+            RsSetFlagBits16 (&Tmp16, InitializerOp, 4, 3);
214d7a
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
214d7a
+            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
214d7a
             break;
214d7a
 
214d7a
         case 2: /* Stop Bits [Flags] (_STB) */
214d7a
 
214d7a
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
214d7a
+            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
214d7a
+            RsSetFlagBits16 (&Tmp16, InitializerOp, 2, 1);
214d7a
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
214d7a
+            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
214d7a
             break;
214d7a
 
214d7a
         case 3: /* Lines In Use [BYTE] (_LIN) */
214d7a
@@ -1176,9 +1251,11 @@ RsDoUartSerialBusDescriptor (
214d7a
 
214d7a
         case 4: /* Endianness [Flag] (_END) */
214d7a
 
214d7a
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
214d7a
+            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
214d7a
+            RsSetFlagBits16 (&Tmp16, InitializerOp, 7, 0);
214d7a
             RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
214d7a
+            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
214d7a
             break;
214d7a
 
214d7a
         case 5: /* Parity [BYTE] (_PAR) */
214d7a
@@ -1190,21 +1267,25 @@ RsDoUartSerialBusDescriptor (
214d7a
 
214d7a
         case 6: /* Flow Control [Flags] (_FLC) */
214d7a
 
214d7a
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
214d7a
+            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
214d7a
+            RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0);
214d7a
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
214d7a
+            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
214d7a
             break;
214d7a
 
214d7a
         case 7: /* Rx Buffer Size [WORD] (_RXL) */
214d7a
 
214d7a
-            Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->UartSerialBus.RxFifoSize = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
214d7a
             break;
214d7a
 
214d7a
         case 8: /* Tx Buffer Size [WORD] (_TXL) */
214d7a
 
214d7a
-            Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->UartSerialBus.TxFifoSize = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
214d7a
             break;
214d7a
@@ -1444,6 +1525,7 @@ RsDoPinFunctionDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  PinCount = 0;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
     CurrentByteOffset = Info->CurrentByteOffset;
214d7a
@@ -1467,7 +1549,7 @@ RsDoPinFunctionDescriptor (
214d7a
         sizeof (AML_RESOURCE_LARGE_HEADER));
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
-    Descriptor->PinFunction.ResourceLength = DescriptorSize;
214d7a
+    Descriptor->PinFunction.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
214d7a
     Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION;
214d7a
     Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION;
214d7a
 
214d7a
@@ -1507,7 +1589,8 @@ RsDoPinFunctionDescriptor (
214d7a
 
214d7a
         case 2: /* Function Number [WORD] (_FUN) */
214d7a
 
214d7a
-            Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->PinFunction.FunctionNumber = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber));
214d7a
             break;
214d7a
@@ -1555,6 +1638,12 @@ RsDoPinFunctionDescriptor (
214d7a
             {
214d7a
                 Descriptor->PinFunction.VendorLength = VendorLength;
214d7a
             }
214d7a
+            Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor);
214d7a
+            Descriptor->PinFunction.VendorOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
+            Tmp16 = Descriptor->PinFunction.VendorLength;
214d7a
+            Descriptor->PinFunction.VendorLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
             break;
214d7a
 
214d7a
         default:
214d7a
@@ -1566,7 +1655,8 @@ RsDoPinFunctionDescriptor (
214d7a
              *  (implies resource source must immediately follow the pin list.)
214d7a
              *  Name: _PIN
214d7a
              */
214d7a
-            *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            *PinList = AcpiUtReadUint16 (&Tmp16);
214d7a
             PinList++;
214d7a
             PinCount++;
214d7a
 
214d7a
@@ -1597,6 +1687,13 @@ RsDoPinFunctionDescriptor (
214d7a
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
214d7a
     }
214d7a
 
214d7a
+    /* correct the endian-ness of the values */
214d7a
+    Tmp16 = Descriptor->PinFunction.PinTableOffset;
214d7a
+    Descriptor->PinFunction.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
+    Tmp16 = Descriptor->PinFunction.ResSourceOffset;
214d7a
+    Descriptor->PinFunction.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     return (Rnode);
214d7a
 }
214d7a
 
214d7a
@@ -1630,6 +1727,8 @@ RsDoPinConfigDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  PinCount = 0;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
     CurrentByteOffset = Info->CurrentByteOffset;
214d7a
@@ -1653,7 +1752,7 @@ RsDoPinConfigDescriptor (
214d7a
         sizeof (AML_RESOURCE_LARGE_HEADER));
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
-    Descriptor->PinConfig.ResourceLength = DescriptorSize;
214d7a
+    Descriptor->PinConfig.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
214d7a
     Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG;
214d7a
     Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION;
214d7a
 
214d7a
@@ -1707,7 +1806,8 @@ RsDoPinConfigDescriptor (
214d7a
 
214d7a
         case 2: /* Pin Config Value [DWORD] (_VAL) */
214d7a
 
214d7a
-            Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->PinConfig.PinConfigValue = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue));
214d7a
             break;
214d7a
@@ -1766,7 +1866,8 @@ RsDoPinConfigDescriptor (
214d7a
              *  (implies resource source must immediately follow the pin list.)
214d7a
              *  Name: _PIN
214d7a
              */
214d7a
-            *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            *PinList = AcpiUtReadUint16 (&Tmp16);
214d7a
             PinList++;
214d7a
             PinCount++;
214d7a
 
214d7a
@@ -1797,6 +1898,16 @@ RsDoPinConfigDescriptor (
214d7a
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
214d7a
     }
214d7a
 
214d7a
+    /* correct the endianness if needed */
214d7a
+    Tmp16 = Descriptor->PinConfig.PinTableOffset;
214d7a
+    Descriptor->PinConfig.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinConfig.ResSourceOffset;
214d7a
+    Descriptor->PinConfig.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinConfig.VendorOffset;
214d7a
+    Descriptor->PinConfig.VendorOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinConfig.VendorLength;
214d7a
+    Descriptor->PinConfig.VendorLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     return (Rnode);
214d7a
 }
214d7a
 
214d7a
@@ -1830,6 +1941,7 @@ RsDoPinGroupDescriptor (
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  PinCount = 0;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
     CurrentByteOffset = Info->CurrentByteOffset;
214d7a
@@ -1853,7 +1965,7 @@ RsDoPinGroupDescriptor (
214d7a
         sizeof (AML_RESOURCE_LARGE_HEADER));
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
-    Descriptor->PinGroup.ResourceLength = DescriptorSize;
214d7a
+    Descriptor->PinGroup.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
214d7a
     Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP;
214d7a
     Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION;
214d7a
 
214d7a
@@ -1920,7 +2032,8 @@ RsDoPinGroupDescriptor (
214d7a
              *  (implies resource source must immediately follow the pin list.)
214d7a
              *  Name: _PIN
214d7a
              */
214d7a
-            *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+        Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            *PinList = AcpiUtReadUint16 (&Tmp16);
214d7a
             PinList++;
214d7a
             PinCount++;
214d7a
 
214d7a
@@ -1951,6 +2064,16 @@ RsDoPinGroupDescriptor (
214d7a
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
214d7a
     }
214d7a
 
214d7a
+    /* correct enddianness as needed */
214d7a
+    Tmp16 = Descriptor->PinGroup.PinTableOffset;
214d7a
+    Descriptor->PinGroup.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroup.LabelOffset;
214d7a
+    Descriptor->PinGroup.LabelOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroup.VendorOffset;
214d7a
+    Descriptor->PinGroup.VendorOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroup.VendorLength;
214d7a
+    Descriptor->PinGroup.VendorLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     return (Rnode);
214d7a
 }
214d7a
 
214d7a
@@ -1983,6 +2106,7 @@ RsDoPinGroupFunctionDescriptor (
214d7a
     UINT16                  DescriptorSize;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
     CurrentByteOffset = Info->CurrentByteOffset;
214d7a
@@ -2006,7 +2130,7 @@ RsDoPinGroupFunctionDescriptor (
214d7a
         sizeof (AML_RESOURCE_LARGE_HEADER));
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
-    Descriptor->PinGroupFunction.ResourceLength = DescriptorSize;
214d7a
+    Descriptor->PinGroupFunction.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
214d7a
     Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION;
214d7a
     Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION;
214d7a
 
214d7a
@@ -2038,7 +2162,8 @@ RsDoPinGroupFunctionDescriptor (
214d7a
 
214d7a
         case 1: /* Function Number [WORD] */
214d7a
 
214d7a
-            Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->PinGroupFunction.FunctionNumber = AcpiUtReadUint16 (&Tmp16);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber));
214d7a
             break;
214d7a
@@ -2097,6 +2222,16 @@ RsDoPinGroupFunctionDescriptor (
214d7a
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
214d7a
     }
214d7a
 
214d7a
+    /* correct enddianness as needed */
214d7a
+    Tmp16 = Descriptor->PinGroupFunction.ResSourceOffset;
214d7a
+    Descriptor->PinGroupFunction.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroupFunction.ResSourceLabelOffset;
214d7a
+    Descriptor->PinGroupFunction.ResSourceLabelOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroupFunction.VendorOffset;
214d7a
+    Descriptor->PinGroupFunction.VendorOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroupFunction.VendorLength;
214d7a
+    Descriptor->PinGroupFunction.VendorLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     return (Rnode);
214d7a
 }
214d7a
 
214d7a
@@ -2129,6 +2264,8 @@ RsDoPinGroupConfigDescriptor (
214d7a
     UINT16                  DescriptorSize;
214d7a
     UINT32                  CurrentByteOffset;
214d7a
     UINT32                  i;
214d7a
+    UINT16                  Tmp16;
214d7a
+    UINT32                  Tmp32;
214d7a
 
214d7a
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
214d7a
     CurrentByteOffset = Info->CurrentByteOffset;
214d7a
@@ -2152,7 +2289,7 @@ RsDoPinGroupConfigDescriptor (
214d7a
         sizeof (AML_RESOURCE_LARGE_HEADER));
214d7a
 
214d7a
     Descriptor = Rnode->Buffer;
214d7a
-    Descriptor->PinGroupConfig.ResourceLength = DescriptorSize;
214d7a
+    Descriptor->PinGroupConfig.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
214d7a
     Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG;
214d7a
     Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION;
214d7a
 
214d7a
@@ -2205,7 +2342,8 @@ RsDoPinGroupConfigDescriptor (
214d7a
 
214d7a
         case 2: /* Pin Config Value [DWORD] (_VAL) */
214d7a
 
214d7a
-            Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
214d7a
+            Descriptor->PinGroupConfig.PinConfigValue = AcpiUtReadUint32 (&Tmp32);
214d7a
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
214d7a
                 CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue));
214d7a
             break;
214d7a
@@ -2266,5 +2404,15 @@ RsDoPinGroupConfigDescriptor (
214d7a
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
214d7a
     }
214d7a
 
214d7a
+    /* correct enddianness as needed */
214d7a
+    Tmp16 = Descriptor->PinGroupConfig.ResSourceOffset;
214d7a
+    Descriptor->PinGroupConfig.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroupConfig.ResSourceLabelOffset;
214d7a
+    Descriptor->PinGroupConfig.ResSourceLabelOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroupConfig.VendorOffset;
214d7a
+    Descriptor->PinGroupConfig.VendorOffset = AcpiUtReadUint16 (&Tmp16);
214d7a
+    Tmp16 = Descriptor->PinGroupConfig.VendorLength;
214d7a
+    Descriptor->PinGroupConfig.VendorLength = AcpiUtReadUint16 (&Tmp16);
214d7a
+
214d7a
     return (Rnode);
214d7a
 }