Al Stone 840f97
Big-endian support
Al Stone 840f97
Al Stone 840f97
This is a combined patch that folds all of the past and present changes
Al Stone 840f97
for big-endian support into a single patch, hopefully eliminating any sort
Al Stone 840f97
of redundancy but also capturing all such changes in a single location.
Al Stone 840f97
Al Stone 840f97
To date, this has been critical for the s390x architecture only.
Al Stone 840f97
Al Stone 840f97
Signed-off-by: Al Stone <ahs3@redhat.com>
Al Stone 840f97
Al Stone 840f97
---
Al Stone 840f97
 source/compiler/aslcodegen.c      |  109 ++++++++++++++++++------------
Al Stone 840f97
 source/compiler/aslopcodes.c      |    4 +
Al Stone 840f97
 source/compiler/aslrestype1.c     |   68 +++++++++++++------
Al Stone 840f97
 source/compiler/aslrestype1i.c    |   38 +++++++---
Al Stone 840f97
 source/compiler/aslrestype2.c     |   25 ++++---
Al Stone 840f97
 source/compiler/aslrestype2d.c    |  134 +++++++++++++++++++++----------------
Al Stone 840f97
 source/compiler/aslrestype2e.c    |   39 +++++++----
Al Stone 840f97
 source/compiler/aslrestype2q.c    |  117 +++++++++++++++++++++-----------
Al Stone 840f97
 source/compiler/aslrestype2s.c    |   86 +++++++++++++++++-------
Al Stone 840f97
 source/compiler/aslrestype2w.c    |  127 +++++++++++++++++++++--------------
Al Stone 840f97
 source/include/acmacros.h         |   15 +++-
Al Stone 840f97
 source/include/platform/aclinux.h |    8 ++
Al Stone 840f97
 12 files changed, 487 insertions(+), 283 deletions(-)
Al Stone 840f97
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslcodegen.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslcodegen.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslcodegen.c
Al Stone 840f97
@@ -240,16 +240,12 @@ CgWriteAmlOpcode (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *Op)
Al Stone 840f97
 {
Al Stone 840f97
     UINT8                   PkgLenFirstByte;
Al Stone 840f97
-    UINT32                  i;
Al Stone 840f97
-    union {
Al Stone 840f97
-        UINT16                  Opcode;
Al Stone 840f97
-        UINT8                   OpcodeBytes[2];
Al Stone 840f97
-    } Aml;
Al Stone 840f97
-    union {
Al Stone 840f97
-        UINT32                  Len;
Al Stone 840f97
-        UINT8                   LenBytes[4];
Al Stone 840f97
-    } PkgLen;
Al Stone 840f97
-
Al Stone 840f97
+    UINT8                   Byte;
Al Stone 840f97
+    UINT16                  Word;
Al Stone 840f97
+    UINT32                  DWord;
Al Stone 840f97
+    UINT64                  QWord;
Al Stone 840f97
+    UINT16                  AmlOpcode;
Al Stone 840f97
+    UINT32                  PkgLen;
Al Stone 840f97
 
Al Stone 840f97
     /* We expect some DEFAULT_ARGs, just ignore them */
Al Stone 840f97
 
Al Stone 840f97
@@ -282,51 +278,52 @@ CgWriteAmlOpcode (
Al Stone 840f97
 
Al Stone 840f97
         /* Special opcodes for within a field definition */
Al Stone 840f97
 
Al Stone 840f97
-        Aml.Opcode = AML_FIELD_OFFSET_OP;
Al Stone 840f97
+        AmlOpcode = AML_FIELD_OFFSET_OP;
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     case AML_INT_ACCESSFIELD_OP:
Al Stone 840f97
 
Al Stone 840f97
-        Aml.Opcode = AML_FIELD_ACCESS_OP;
Al Stone 840f97
+        AmlOpcode = AML_FIELD_ACCESS_OP;
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     case AML_INT_CONNECTION_OP:
Al Stone 840f97
 
Al Stone 840f97
-        Aml.Opcode = AML_FIELD_CONNECTION_OP;
Al Stone 840f97
+        AmlOpcode = AML_FIELD_CONNECTION_OP;
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     default:
Al Stone 840f97
 
Al Stone 840f97
-        Aml.Opcode = Op->Asl.AmlOpcode;
Al Stone 840f97
+        AmlOpcode = Op->Asl.AmlOpcode;
Al Stone 840f97
         break;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
-    switch (Aml.Opcode)
Al Stone 840f97
+    switch (AmlOpcode)
Al Stone 840f97
     {
Al Stone 840f97
     case AML_PACKAGE_LENGTH:
Al Stone 840f97
 
Al Stone 840f97
         /* Value is the length to be encoded (Used in field definitions) */
Al Stone 840f97
 
Al Stone 840f97
-        PkgLen.Len = (UINT32) Op->Asl.Value.Integer;
Al Stone 840f97
+        PkgLen = (UINT32) Op->Asl.Value.Integer;
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     default:
Al Stone 840f97
 
Al Stone 840f97
         /* Check for two-byte opcode */
Al Stone 840f97
 
Al Stone 840f97
-        if (Aml.Opcode > 0x00FF)
Al Stone 840f97
+        if (AmlOpcode > 0x00FF)
Al Stone 840f97
         {
Al Stone 840f97
             /* Write the high byte first */
Al Stone 840f97
-
Al Stone 840f97
-            CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1);
Al Stone 840f97
+	    Byte = ACPI_HIBYTE(AmlOpcode);
Al Stone 840f97
+	    CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
-        CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1);
Al Stone 840f97
+	Byte = ACPI_LOBYTE(AmlOpcode);
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
 
Al Stone 840f97
         /* Subtreelength doesn't include length of package length bytes */
Al Stone 840f97
 
Al Stone 840f97
-        PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
Al Stone 840f97
+        PkgLen = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
Al Stone 840f97
         break;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
@@ -337,8 +334,8 @@ CgWriteAmlOpcode (
Al Stone 840f97
         if (Op->Asl.AmlPkgLenBytes == 1)
Al Stone 840f97
         {
Al Stone 840f97
             /* Simplest case -- no bytes to follow, just write the count */
Al Stone 840f97
-
Al Stone 840f97
-            CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
Al Stone 840f97
+            Byte = ACPI_LOBYTE(PkgLen);
Al Stone 840f97
+            CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
         }
Al Stone 840f97
         else if (Op->Asl.AmlPkgLenBytes != 0)
Al Stone 840f97
         {
Al Stone 840f97
@@ -348,7 +345,7 @@ CgWriteAmlOpcode (
Al Stone 840f97
              */
Al Stone 840f97
             PkgLenFirstByte = (UINT8)
Al Stone 840f97
                 (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
Al Stone 840f97
-                (PkgLen.LenBytes[0] & 0x0F));
Al Stone 840f97
+                (PkgLen & 0x0F));
Al Stone 840f97
 
Al Stone 840f97
             CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
Al Stone 840f97
 
Al Stone 840f97
@@ -356,39 +353,47 @@ CgWriteAmlOpcode (
Al Stone 840f97
              * Shift the length over by the 4 bits we just stuffed
Al Stone 840f97
              * in the first byte
Al Stone 840f97
              */
Al Stone 840f97
-            PkgLen.Len >>= 4;
Al Stone 840f97
+            PkgLen >>= 4;
Al Stone 840f97
 
Al Stone 840f97
             /*
Al Stone 840f97
              * Now we can write the remaining bytes -
Al Stone 840f97
              * either 1, 2, or 3 bytes
Al Stone 840f97
              */
Al Stone 840f97
-            for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
Al Stone 840f97
+            Byte = ACPI_LOBYTE(PkgLen);
Al Stone 840f97
+            CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
+            if (Op->Asl.AmlPkgLenBytes >= 3)
Al Stone 840f97
+            {
Al Stone 840f97
+                Byte = ACPI_HIBYTE(PkgLen);
Al Stone 840f97
+                CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
+            }
Al Stone 840f97
+            if (Op->Asl.AmlPkgLenBytes >= 4)
Al Stone 840f97
             {
Al Stone 840f97
-                CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
Al Stone 840f97
+                Byte = ACPI_LOBYTE(ACPI_HIWORD(PkgLen));
Al Stone 840f97
+                CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
             }
Al Stone 840f97
         }
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    switch (Aml.Opcode)
Al Stone 840f97
+    switch (AmlOpcode)
Al Stone 840f97
     {
Al Stone 840f97
     case AML_BYTE_OP:
Al Stone 840f97
-
Al Stone 840f97
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1);
Al Stone 840f97
+        Byte = (UINT8) Op->Asl.Value.Integer;
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     case AML_WORD_OP:
Al Stone 840f97
-
Al Stone 840f97
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2);
Al Stone 840f97
+        ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer);
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &Word, 2);
Al Stone 840f97
        break;
Al Stone 840f97
 
Al Stone 840f97
     case AML_DWORD_OP:
Al Stone 840f97
-
Al Stone 840f97
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4);
Al Stone 840f97
+        ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer);
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &DWord, 4);
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     case AML_QWORD_OP:
Al Stone 840f97
-
Al Stone 840f97
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8);
Al Stone 840f97
+        ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &QWord, 8);
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     case AML_STRING_OP:
Al Stone 840f97
@@ -422,6 +427,7 @@ CgWriteTableHeader (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *Op)
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_PARSE_OBJECT       *Child;
Al Stone 840f97
+    UINT32                  DWord;
Al Stone 840f97
     UINT32                  CommentLength;
Al Stone 840f97
     ACPI_COMMENT_NODE       *Current;
Al Stone 840f97
 
Al Stone 840f97
@@ -475,7 +481,7 @@ CgWriteTableHeader (
Al Stone 840f97
     /* OEM Revision */
Al Stone 840f97
 
Al Stone 840f97
     Child = Child->Asl.Next;
Al Stone 840f97
-    TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
Al Stone 840f97
+    ACPI_MOVE_64_TO_32(&TableHeader.OemRevision, &Child->Asl.Value.Integer);
Al Stone 840f97
 
Al Stone 840f97
     /* Compiler ID */
Al Stone 840f97
 
Al Stone 840f97
@@ -483,12 +489,13 @@ CgWriteTableHeader (
Al Stone 840f97
 
Al Stone 840f97
     /* Compiler version */
Al Stone 840f97
 
Al Stone 840f97
-    TableHeader.AslCompilerRevision = ACPI_CA_VERSION;
Al Stone 840f97
+    DWord = ACPI_CA_VERSION;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&TableHeader.AslCompilerRevision, &DWord);
Al Stone 840f97
 
Al Stone 840f97
     /* Table length. Checksum zero for now, will rewrite later */
Al Stone 840f97
 
Al Stone 840f97
-    TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
Al Stone 840f97
-        Op->Asl.AmlSubtreeLength;
Al Stone 840f97
+    DWord = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&TableHeader.Length, &DWord);
Al Stone 840f97
 
Al Stone 840f97
     /* Calculate the comment lengths for this definition block parseOp */
Al Stone 840f97
 
Al Stone 840f97
@@ -645,7 +652,10 @@ CgWriteNode (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *Op)
Al Stone 840f97
 {
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
-
Al Stone 840f97
+    UINT8                   Byte;
Al Stone 840f97
+    UINT16                  Word;
Al Stone 840f97
+    UINT32                  DWord;
Al Stone 840f97
+    UINT64                  QWord;
Al Stone 840f97
 
Al Stone 840f97
     /* Write all comments here. */
Al Stone 226b59
 
Al Stone 226b59
@@ -675,13 +685,24 @@ CgWriteNode (
Al Stone 840f97
     switch (Op->Asl.AmlOpcode)
Al Stone 840f97
     {
Al Stone 840f97
     case AML_RAW_DATA_BYTE:
Al Stone 840f97
+        Byte = (UINT8) Op->Asl.Value.Integer;
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone 840f97
+        return;
Al Stone 840f97
+
Al Stone 840f97
     case AML_RAW_DATA_WORD:
Al Stone 840f97
-    case AML_RAW_DATA_DWORD:
Al Stone 840f97
-    case AML_RAW_DATA_QWORD:
Al Stone 840f97
+        ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer);
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &Word, 2);
Al Stone 840f97
+        return;
Al Stone 840f97
 
Al Stone 840f97
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength);
Al Stone 840f97
+    case AML_RAW_DATA_DWORD:
Al Stone 840f97
+        ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer);
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &DWord, 4);
Al Stone 840f97
         return;
Al Stone 840f97
 
Al Stone 840f97
+    case AML_RAW_DATA_QWORD:
Al Stone 840f97
+        ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
Al Stone 840f97
+        CgLocalWriteAmlData (Op, &QWord, 8);
Al Stone 840f97
+        return;
Al Stone 840f97
 
Al Stone 840f97
     case AML_RAW_DATA_BUFFER:
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslopcodes.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslopcodes.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslopcodes.c
Al Stone 840f97
@@ -485,6 +485,7 @@ OpcDoUnicode (
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     UINT8                   *AsciiString;
Al Stone 840f97
     UINT16                  *UnicodeString;
Al Stone 840f97
+    UINT16                  UChar;
Al Stone 840f97
     ACPI_PARSE_OBJECT       *BufferLengthOp;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -511,7 +512,8 @@ OpcDoUnicode (
Al Stone 840f97
 
Al Stone 840f97
     for (i = 0; i < Count; i++)
Al Stone 840f97
     {
Al Stone 840f97
-        UnicodeString[i] = (UINT16) AsciiString[i];
Al Stone 840f97
+        UChar = (UINT16) AsciiString[i];
Al Stone 840f97
+        ACPI_MOVE_16_TO_16(&UnicodeString[i], &UChar);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype1.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype1.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype1.c
Al Stone 840f97
@@ -142,6 +142,11 @@ RsDoMemory24Descriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *LengthOp = NULL;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
+    UINT16                  Minimum = 0;
Al Stone 840f97
+    UINT16                  Maximum = 0;
Al Stone 840f97
+    UINT16                  AddressLength = 0;
Al Stone 840f97
+    UINT16                  Alignment = 0;
Al Stone 840f97
+    UINT16                  ResourceLength;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -151,7 +156,8 @@ RsDoMemory24Descriptor (
Al Stone 840f97
 
Al Stone 840f97
     Descriptor = Rnode->Buffer;
Al Stone 840f97
     Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
Al Stone 840f97
-    Descriptor->Memory24.ResourceLength = 9;
Al Stone 840f97
+    ResourceLength = 9;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.ResourceLength, &ResourceLength);
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
 
Al Stone 840f97
@@ -168,7 +174,7 @@ RsDoMemory24Descriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 1: /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -176,7 +182,7 @@ RsDoMemory24Descriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -184,14 +190,14 @@ RsDoMemory24Descriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 3: /* Alignment */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 4: /* Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -214,12 +220,17 @@ RsDoMemory24Descriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
Al Stone 840f97
 
Al Stone 840f97
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
Al Stone 840f97
-        Descriptor->Memory24.Minimum,
Al Stone 840f97
-        Descriptor->Memory24.Maximum,
Al Stone 840f97
-        Descriptor->Memory24.AddressLength,
Al Stone 840f97
-        Descriptor->Memory24.Alignment,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Alignment,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Alignment, &Alignment);
Al Stone 840f97
+
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -248,6 +259,11 @@ RsDoMemory32Descriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *AlignOp = NULL;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
+    UINT32                  Minimum = 0;
Al Stone 840f97
+    UINT32                  Maximum = 0;
Al Stone 840f97
+    UINT32                  AddressLength = 0;
Al Stone 840f97
+    UINT32                  Alignment = 0;
Al Stone 840f97
+    UINT16                  ResourceLength;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -257,7 +273,8 @@ RsDoMemory32Descriptor (
Al Stone 840f97
 
Al Stone 840f97
     Descriptor = Rnode->Buffer;
Al Stone 840f97
     Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
Al Stone 840f97
-    Descriptor->Memory32.ResourceLength = 17;
Al Stone 840f97
+    ResourceLength = 17;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory32.ResourceLength, &ResourceLength);
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
 
Al Stone 840f97
@@ -274,7 +291,7 @@ RsDoMemory32Descriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 1:  /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -282,7 +299,7 @@ RsDoMemory32Descriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -290,7 +307,7 @@ RsDoMemory32Descriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 3: /* Alignment */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
Al Stone 840f97
             AlignOp = InitializerOp;
Al Stone 840f97
@@ -298,7 +315,7 @@ RsDoMemory32Descriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 4: /* Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -321,12 +338,17 @@ RsDoMemory32Descriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Align values */
Al Stone 840f97
 
Al Stone 840f97
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
Al Stone 840f97
-        Descriptor->Memory32.Minimum,
Al Stone 840f97
-        Descriptor->Memory32.Maximum,
Al Stone 840f97
-        Descriptor->Memory32.AddressLength,
Al Stone 840f97
-        Descriptor->Memory32.Alignment,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Alignment,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Alignment, &Alignment);
Al Stone 840f97
+
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -351,6 +373,7 @@ RsDoMemory32FixedDescriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
+    UINT16                  ResourceLength;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -360,7 +383,8 @@ RsDoMemory32FixedDescriptor (
Al Stone 840f97
 
Al Stone 840f97
     Descriptor = Rnode->Buffer;
Al Stone 840f97
     Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
Al Stone 840f97
-    Descriptor->FixedMemory32.ResourceLength = 9;
Al Stone 840f97
+    ResourceLength = 9;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedMemory32.ResourceLength, &ResourceLength);
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
 
Al Stone 840f97
@@ -377,14 +401,16 @@ RsDoMemory32FixedDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 1: /* Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.Address,
Al Stone 840f97
+                &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.AddressLength,
Al Stone 840f97
+                &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
Al Stone 840f97
             break;
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype1i.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype1i.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype1i.c
Al Stone 840f97
@@ -198,6 +198,8 @@ RsDoFixedDmaDescriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
+    UINT16                  RequestLines = 0;
Al Stone 840f97
+    UINT16                  Channels = 0;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -217,14 +219,14 @@ RsDoFixedDmaDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* DMA Request Lines [WORD] (_DMA) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 1: /* DMA Channel [WORD] (_TYP) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Channels = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels));
Al Stone 840f97
             break;
Al Stone 840f97
@@ -249,6 +251,9 @@ RsDoFixedDmaDescriptor (
Al Stone 840f97
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.RequestLines, &RequestLines);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.Channels, &Channels);
Al Stone 840f97
+
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -274,6 +279,7 @@ RsDoFixedIoDescriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *AddressOp = NULL;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
+    UINT16                  Address = 0;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -293,8 +299,7 @@ RsDoFixedIoDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* Base Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->FixedIo.Address =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Address = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
Al Stone 840f97
             AddressOp = InitializerOp;
Al Stone 840f97
@@ -324,11 +329,13 @@ RsDoFixedIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
     /* Error checks */
Al Stone 840f97
 
Al Stone 840f97
-    if (Descriptor->FixedIo.Address > 0x03FF)
Al Stone 840f97
+    if (Address > 0x03FF)
Al Stone 840f97
     {
Al Stone 840f97
         AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedIo.Address, &Address);
Al Stone 840f97
+
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -357,6 +364,8 @@ RsDoIoDescriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *AlignOp = NULL;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
+    UINT16                  Minimum = 0;
Al Stone 840f97
+    UINT16                  Maximum = 0;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -383,8 +392,7 @@ RsDoIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 1:  /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Io.Minimum =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -392,8 +400,7 @@ RsDoIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Io.Maximum =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -434,12 +441,15 @@ RsDoIoDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Align values */
Al Stone 840f97
 
Al Stone 840f97
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
Al Stone 840f97
-        Descriptor->Io.Minimum,
Al Stone 840f97
-        Descriptor->Io.Maximum,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
         Descriptor->Io.AddressLength,
Al Stone 840f97
         Descriptor->Io.Alignment,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Io.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Io.Maximum, &Maximum);
Al Stone 840f97
+
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -559,9 +569,9 @@ RsDoIrqDescriptor (
Al Stone 840f97
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    /* Now we can set the channel mask */
Al Stone 840f97
+    /* Now we can set the interrupt mask */
Al Stone 840f97
 
Al Stone 840f97
-    Descriptor->Irq.IrqMask = IrqMask;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -660,6 +670,6 @@ RsDoIrqNoFlagsDescriptor (
Al Stone 840f97
 
Al Stone 840f97
     /* Now we can set the interrupt mask */
Al Stone 840f97
 
Al Stone 840f97
-    Descriptor->Irq.IrqMask = IrqMask;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype2.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype2.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype2.c
Al Stone 840f97
@@ -76,6 +76,7 @@ RsDoGeneralRegisterDescriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
+    UINT16                  ResourceLength;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -85,7 +86,9 @@ RsDoGeneralRegisterDescriptor (
Al Stone 840f97
 
Al Stone 840f97
     Descriptor = Rnode->Buffer;
Al Stone 840f97
     Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
Al Stone 840f97
-    Descriptor->GenericReg.ResourceLength = 12;
Al Stone 840f97
+    ResourceLength = 12;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->GenericReg.ResourceLength,
Al Stone 840f97
+		    &ResourceLength);
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
 
Al Stone 840f97
@@ -95,35 +98,52 @@ RsDoGeneralRegisterDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* Address space */
Al Stone 840f97
 
Al Stone 840f97
+	    /*
Al Stone 840f97
             Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+	    */
Al Stone 840f97
+            ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.AddressSpaceId,
Al Stone 840f97
+			      &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId));
Al Stone 840f97
            break;
Al Stone 840f97
 
Al Stone 840f97
         case 1: /* Register Bit Width */
Al Stone 840f97
 
Al Stone 840f97
+	    /*
Al Stone 840f97
             Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+	    */
Al Stone 840f97
+            ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.BitWidth,
Al Stone 840f97
+			      &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Register Bit Offset */
Al Stone 840f97
 
Al Stone 840f97
+	    /*
Al Stone 840f97
             Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+	    */
Al Stone 840f97
+            ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.BitOffset,
Al Stone 840f97
+			      &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 3: /* Register Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+	    ACPI_MOVE_64_TO_64(&Descriptor->GenericReg.Address,
Al Stone 840f97
+			    &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 4: /* Access Size (ACPI 3.0) */
Al Stone 840f97
 
Al Stone 840f97
+	    /*
Al Stone 840f97
             Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+	    */
Al Stone 840f97
+	    ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.AccessSize,
Al Stone 840f97
+			      &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize));
Al Stone 840f97
 
Al Stone 840f97
@@ -177,6 +197,7 @@ RsDoInterruptDescriptor (
Al Stone 840f97
     AML_RESOURCE            *Rover = NULL;
Al Stone 840f97
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
@@ -225,7 +246,7 @@ RsDoInterruptDescriptor (
Al Stone 840f97
      * Initial descriptor length -- may be enlarged if there are
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
-    Descriptor->ExtendedIrq.ResourceLength  = 2;  /* Flags and table length byte */
Al Stone 840f97
+    ResourceLength  = 2;  /* Flags and table length byte */
Al Stone 840f97
     Descriptor->ExtendedIrq.InterruptCount  = 0;
Al Stone 840f97
 
Al Stone 840f97
     Rover = ACPI_CAST_PTR (AML_RESOURCE,
Al Stone 840f97
@@ -333,10 +354,11 @@ RsDoInterruptDescriptor (
Al Stone 840f97
 
Al Stone 840f97
             /* Save the integer and move pointer to the next one */
Al Stone 840f97
 
Al Stone 840f97
-            Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            ACPI_MOVE_64_TO_32(&Rover->DwordItem,
Al Stone 840f97
+                &InitializerOp->Asl.Value.Integer);
Al Stone 840f97
             Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);
Al Stone 840f97
             Descriptor->ExtendedIrq.InterruptCount++;
Al Stone 840f97
-            Descriptor->ExtendedIrq.ResourceLength += 4;
Al Stone 840f97
+            ResourceLength += 4;
Al Stone 840f97
 
Al Stone 840f97
             /* Case 7: First interrupt number in list */
Al Stone 840f97
 
Al Stone 840f97
@@ -372,7 +394,7 @@ RsDoInterruptDescriptor (
Al Stone 840f97
     {
Al Stone 840f97
         Rover->ByteItem = ResSourceIndex;
Al Stone 840f97
         Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1);
Al Stone 840f97
-        Descriptor->ExtendedIrq.ResourceLength += 1;
Al Stone 840f97
+        ResourceLength += 1;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     /* Add optional ResSource string if present */
Al Stone 840f97
@@ -384,14 +406,15 @@ RsDoInterruptDescriptor (
Al Stone 840f97
         Rover = ACPI_ADD_PTR (
Al Stone 840f97
                     AML_RESOURCE, &(Rover->ByteItem), StringLength);
Al Stone 840f97
 
Al Stone 840f97
-        Descriptor->ExtendedIrq.ResourceLength = (UINT16)
Al Stone 840f97
-            (Descriptor->ExtendedIrq.ResourceLength + StringLength);
Al Stone 840f97
+        ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     Rnode->BufferLength =
Al Stone 840f97
         (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
Al Stone 840f97
         ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))
Al Stone 840f97
         + OptionIndex + StringLength;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->ExtendedIrq.ResourceLength,
Al Stone 840f97
+		    &ResourceLength);
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -439,7 +462,7 @@ RsDoVendorLargeDescriptor (
Al Stone 840f97
 
Al Stone 840f97
     Descriptor = Rnode->Buffer;
Al Stone 840f97
     Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
Al Stone 840f97
-    Descriptor->VendorLarge.ResourceLength = (UINT16) i;
Al Stone 840f97
+    ACPI_MOVE_32_TO_16(&Descriptor->VendorLarge.ResourceLength, &i);
Al Stone 840f97
 
Al Stone 840f97
     /* Point to end-of-descriptor for vendor data */
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype2d.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype2d.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype2d.c
Al Stone 840f97
@@ -79,7 +79,13 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *GranOp = NULL;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT32                  Minimum = 0;
Al Stone 840f97
+    UINT32                  Maximum = 0;
Al Stone 840f97
+    UINT32                  AddressLength = 0;
Al Stone 840f97
+    UINT32                  Granularity = 0;
Al Stone 840f97
+    UINT32                  TranslationOffset = 0;
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
@@ -102,8 +108,7 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
Al Stone 840f97
-    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -147,8 +152,7 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 5: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Granularity =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -156,8 +160,7 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Min */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Minimum =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -165,8 +168,7 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Address Max */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Maximum =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -174,16 +176,14 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.TranslationOffset =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.AddressLength =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -197,7 +197,7 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address32.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -211,8 +211,7 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
                 {
Al Stone 840f97
                     /* Found a valid ResourceSource */
Al Stone 840f97
 
Al Stone 840f97
-                    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address32.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -272,13 +271,20 @@ RsDoDwordIoDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Minimum,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Maximum,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.AddressLength,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address32.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
@@ -310,7 +316,13 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT32                  Minimum = 0;
Al Stone 840f97
+    UINT32                  Maximum = 0;
Al Stone 840f97
+    UINT32                  AddressLength = 0;
Al Stone 840f97
+    UINT32                  Granularity = 0;
Al Stone 840f97
+    UINT32                  TranslationOffset = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
@@ -332,11 +344,9 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
Al Stone 840f97
-    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
-
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
 
Al Stone 840f97
     for (i = 0; InitializerOp; i++)
Al Stone 840f97
@@ -385,8 +395,7 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Granularity =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -394,8 +403,7 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Minimum =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -403,8 +411,7 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Maximum =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -412,16 +419,14 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.TranslationOffset =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 10: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.AddressLength =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -433,7 +438,7 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address32.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -445,8 +450,8 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address32.ResourceLength + StringLength);
Al Stone 840f97
+
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -507,13 +512,20 @@ RsDoDwordMemoryDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Minimum,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Maximum,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.AddressLength,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address32.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
@@ -545,7 +557,13 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT32                  Minimum = 0;
Al Stone 840f97
+    UINT32                  Maximum = 0;
Al Stone 840f97
+    UINT32                  AddressLength = 0;
Al Stone 840f97
+    UINT32                  Granularity = 0;
Al Stone 840f97
+    UINT32                  TranslationOffset = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
@@ -566,8 +584,7 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
Al Stone 840f97
-    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -616,8 +633,7 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Granularity =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -625,8 +641,7 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Minimum =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -634,8 +649,7 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.Maximum =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -643,16 +657,14 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.TranslationOffset =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 10: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address32.AddressLength =
Al Stone 840f97
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -664,7 +676,7 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address32.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -676,8 +688,7 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address32.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -724,13 +735,20 @@ RsDoDwordSpaceDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Minimum,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Maximum,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.AddressLength,
Al Stone 840f97
-        (UINT64) Descriptor->Address32.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address32.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype2e.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype2e.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype2e.c
Al Stone 840f97
@@ -78,6 +78,13 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *GranOp = NULL;
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
+    UINT64                  Minimum = 0;
Al Stone 840f97
+    UINT64                  Maximum = 0;
Al Stone 840f97
+    UINT64                  AddressLength = 0;
Al Stone 840f97
+    UINT64                  Granularity = 0;
Al Stone 840f97
+    UINT64                  TranslationOffset = 0;
Al Stone 840f97
+    UINT64                  TypeSpecific = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
@@ -94,9 +101,10 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
     Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
Al Stone 840f97
     Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Al Stone 840f97
 
Al Stone 840f97
-    Descriptor->ExtAddress64.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
Al Stone 840f97
+    ResourceLength  = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->ExtAddress64.ResourceLength,
Al Stone 840f97
+        &ResourceLength);
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
 
Al Stone 840f97
@@ -139,7 +147,7 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 5: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -147,7 +155,7 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Min */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -155,7 +163,7 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Address Max */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -163,14 +171,14 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -178,7 +186,7 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 10: /* Type-Specific Attributes */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TypeSpecific = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
Al Stone 840f97
             break;
Al Stone 840f97
@@ -214,13 +222,20 @@ RsDoExtendedIoDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        Descriptor->ExtAddress64.Minimum,
Al Stone 840f97
-        Descriptor->ExtAddress64.Maximum,
Al Stone 840f97
-        Descriptor->ExtAddress64.AddressLength,
Al Stone 840f97
-        Descriptor->ExtAddress64.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->ExtAddress64.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TypeSpecific, &TypeSpecific);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
Al Stone 840f97
         StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype2q.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype2q.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype2q.c
Al Stone 840f97
@@ -80,7 +80,13 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT64                  Minimum = 0;
Al Stone 840f97
+    UINT64                  Maximum = 0;
Al Stone 840f97
+    UINT64                  AddressLength = 0;
Al Stone 840f97
+    UINT64                  Granularity = 0;
Al Stone 840f97
+    UINT64                  TranslationOffset = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
@@ -102,8 +108,7 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
Al Stone 840f97
-    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -147,7 +152,7 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 5: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -155,7 +160,7 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Min */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -163,7 +168,7 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Address Max */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -171,14 +176,14 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -190,7 +195,7 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address64.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -202,8 +207,7 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address64.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -263,13 +267,20 @@ RsDoQwordIoDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        Descriptor->Address64.Minimum,
Al Stone 840f97
-        Descriptor->Address64.Maximum,
Al Stone 840f97
-        Descriptor->Address64.AddressLength,
Al Stone 840f97
-        Descriptor->Address64.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address64.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
@@ -301,7 +312,13 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT64                  Minimum = 0;
Al Stone 840f97
+    UINT64                  Maximum = 0;
Al Stone 840f97
+    UINT64                  AddressLength = 0;
Al Stone 840f97
+    UINT64                  Granularity = 0;
Al Stone 840f97
+    UINT64                  TranslationOffset = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
@@ -323,8 +340,7 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
Al Stone 840f97
-    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -375,7 +391,7 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -383,7 +399,7 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -391,7 +407,7 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -399,14 +415,14 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 10: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -418,7 +434,7 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address64.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -430,8 +446,7 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address64.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -492,13 +507,20 @@ RsDoQwordMemoryDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        Descriptor->Address64.Minimum,
Al Stone 840f97
-        Descriptor->Address64.Maximum,
Al Stone 840f97
-        Descriptor->Address64.AddressLength,
Al Stone 840f97
-        Descriptor->Address64.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address64.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
@@ -530,9 +552,15 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
     ASL_RESOURCE_NODE       *Rnode;
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
+    UINT64                  Minimum = 0;
Al Stone 840f97
+    UINT64                  Maximum = 0;
Al Stone 840f97
+    UINT64                  AddressLength = 0;
Al Stone 840f97
+    UINT64                  Granularity = 0;
Al Stone 840f97
+    UINT64                  TranslationOffset = 0;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -551,8 +579,7 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
Al Stone 840f97
-    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -601,7 +628,7 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -609,7 +636,7 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -617,7 +644,7 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -625,14 +652,14 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 10: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -644,7 +671,7 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address64.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -656,8 +683,7 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address64.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -703,13 +729,20 @@ RsDoQwordSpaceDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        Descriptor->Address64.Minimum,
Al Stone 840f97
-        Descriptor->Address64.Maximum,
Al Stone 840f97
-        Descriptor->Address64.AddressLength,
Al Stone 840f97
-        Descriptor->Address64.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address64.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype2s.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype2s.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype2s.c
Al Stone c045b7
@@ -340,9 +340,14 @@ RsDoGpioIntDescriptor (
Al Stone 840f97
     UINT16                  VendorLength;
Al Stone 840f97
     UINT16                  InterruptLength;
Al Stone 840f97
     UINT16                  DescriptorSize;
Al Stone 840f97
+    UINT16                  IntFlags = 0;
Al Stone 840f97
+    UINT16                  DebounceTimeout = 0;
Al Stone 840f97
+    UINT16                  Flags = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  PinCount = 0;
Al Stone 840f97
     UINT32                  i;
Al Stone c045b7
+    UINT16		    Tmp16;
Al Stone c045b7
+    UINT16		    Val16;
Al Stone c045b7
 
Al Stone c045b7
 
Al Stone c045b7
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
Al Stone c045b7
@@ -367,7 +372,7 @@ RsDoGpioIntDescriptor (
Al Stone c045b7
         sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone c045b7
 
Al Stone c045b7
     Descriptor = Rnode->Buffer;
Al Stone c045b7
-    Descriptor->Gpio.ResourceLength = DescriptorSize;
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResourceLength, &DescriptorSize);
Al Stone c045b7
     Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
Al Stone c045b7
     Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
Al Stone c045b7
     Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT;
Al Stone c045b7
@@ -382,11 +387,11 @@ RsDoGpioIntDescriptor (
Al Stone c045b7
 
Al Stone c045b7
     /* Setup offsets within the descriptor */
Al Stone c045b7
 
Al Stone c045b7
-    Descriptor->Gpio.PinTableOffset = (UINT16)
Al Stone c045b7
-        ACPI_PTR_DIFF (InterruptList, Descriptor);
Al Stone c045b7
+    Tmp16 = (UINT16) ACPI_PTR_DIFF (InterruptList, Descriptor);
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.PinTableOffset, &Tmp16);
Al Stone c045b7
 
Al Stone c045b7
-    Descriptor->Gpio.ResSourceOffset = (UINT16)
Al Stone c045b7
-        ACPI_PTR_DIFF (ResourceSource, Descriptor);
Al Stone c045b7
+    Tmp16 = (UINT16) ACPI_PTR_DIFF (ResourceSource, Descriptor);
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResSourceOffset, &Tmp16);
Al Stone c045b7
 
Al Stone c045b7
     /* Process all child initialization nodes */
Al Stone c045b7
 
Al Stone c045b7
@@ -396,21 +401,21 @@ RsDoGpioIntDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0);
Al Stone 840f97
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 1, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 1, 0);
Al Stone 840f97
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_POLARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 1, 2);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0);
Al Stone 840f97
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3, 2);
Al Stone 840f97
             break;
Al Stone c045b7
@@ -424,7 +429,7 @@ RsDoGpioIntDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 4: /* Debounce Timeout [WORD] (_DBT) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
Al Stone 840f97
             break;
Al Stone c045b7
@@ -451,7 +456,7 @@ RsDoGpioIntDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Resource Usage (consumer/producer) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
Al Stone 840f97
+            RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Resource Tag (Descriptor Name) */
Al Stone c045b7
@@ -466,13 +471,14 @@ RsDoGpioIntDescriptor (
Al Stone c045b7
              * This field is required in order to calculate the length
Al Stone c045b7
              * of the ResourceSource at runtime.
Al Stone c045b7
              */
Al Stone c045b7
-            Descriptor->Gpio.VendorOffset = (UINT16)
Al Stone c045b7
-                ACPI_PTR_DIFF (VendorData, Descriptor);
Al Stone c045b7
+            Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor);
Al Stone c045b7
+            ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorOffset, &Tmp16);
Al Stone c045b7
 
Al Stone c045b7
             if (RsGetVendorData (InitializerOp, VendorData,
Al Stone c045b7
-                (CurrentByteOffset +  Descriptor->Gpio.VendorOffset)))
Al Stone c045b7
+                (CurrentByteOffset + Tmp16)))
Al Stone c045b7
             {
Al Stone c045b7
-                Descriptor->Gpio.VendorLength = VendorLength;
Al Stone c045b7
+                ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorLength,
Al Stone c045b7
+				   &VendorLength);
Al Stone c045b7
             }
Al Stone c045b7
             break;
Al Stone c045b7
 
Al Stone c045b7
@@ -485,7 +491,9 @@ RsDoGpioIntDescriptor (
Al Stone c045b7
              *  (implies resource source must immediately follow the pin list.)
Al Stone c045b7
              *  Name: _PIN
Al Stone c045b7
              */
Al Stone c045b7
-            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone c045b7
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone c045b7
+            ACPI_MOVE_16_TO_16(&Val16, &Tmp16);
Al Stone c045b7
+            *InterruptList = Val16;
Al Stone c045b7
             InterruptList++;
Al Stone c045b7
             PinCount++;
Al Stone c045b7
 
Al Stone c045b7
@@ -507,8 +515,10 @@ RsDoGpioIntDescriptor (
Al Stone c045b7
 
Al Stone c045b7
                 /* Create a named field at the start of the list */
Al Stone c045b7
 
Al Stone c045b7
-                RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
Al Stone c045b7
-                    CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
Al Stone c045b7
+		ACPI_MOVE_16_TO_16(&Tmp16, &Descriptor->Gpio.PinTableOffset);
Al Stone c045b7
+		Tmp16 += CurrentByteOffset;
Al Stone c045b7
+	        ACPI_MOVE_16_TO_16(&Val16, &Tmp16);
Al Stone c045b7
+                RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, Val16);
Al Stone c045b7
             }
Al Stone c045b7
             break;
Al Stone c045b7
         }
Al Stone c045b7
@@ -516,6 +526,10 @@ RsDoGpioIntDescriptor (
Al Stone 840f97
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags);
Al Stone 840f97
+
Al Stone 840f97
     MpSaveGpioInfo (Info->MappingOp, Descriptor,
Al Stone 840f97
         PinCount, PinList, ResourceSource);
Al Stone 840f97
     return (Rnode);
Al Stone c045b7
@@ -549,9 +563,15 @@ RsDoGpioIoDescriptor (
Al Stone 840f97
     UINT16                  VendorLength;
Al Stone 840f97
     UINT16                  InterruptLength;
Al Stone 840f97
     UINT16                  DescriptorSize;
Al Stone 840f97
+    UINT16                  IntFlags = 0;
Al Stone 840f97
+    UINT16                  DebounceTimeout = 0;
Al Stone 840f97
+    UINT16                  DriveStrength = 0;
Al Stone 840f97
+    UINT16                  Flags = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  PinCount = 0;
Al Stone 840f97
     UINT32                  i;
Al Stone c045b7
+    UINT16		    Tmp16;
Al Stone c045b7
+    UINT16		    Val16;
Al Stone c045b7
 
Al Stone c045b7
 
Al Stone c045b7
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
Al Stone c045b7
@@ -577,7 +597,7 @@ RsDoGpioIoDescriptor (
Al Stone c045b7
         sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone c045b7
 
Al Stone c045b7
     Descriptor = Rnode->Buffer;
Al Stone c045b7
-    Descriptor->Gpio.ResourceLength = DescriptorSize;
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResourceLength, &DescriptorSize);
Al Stone c045b7
     Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
Al Stone c045b7
     Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
Al Stone c045b7
     Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
Al Stone c045b7
@@ -591,11 +611,11 @@ RsDoGpioIoDescriptor (
Al Stone c045b7
 
Al Stone c045b7
     /* Setup offsets within the descriptor */
Al Stone c045b7
 
Al Stone c045b7
-    Descriptor->Gpio.PinTableOffset = (UINT16)
Al Stone c045b7
-        ACPI_PTR_DIFF (InterruptList, Descriptor);
Al Stone c045b7
+    Tmp16 = (UINT16) ACPI_PTR_DIFF (InterruptList, Descriptor);
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.PinTableOffset, &Tmp16);
Al Stone c045b7
 
Al Stone c045b7
-    Descriptor->Gpio.ResSourceOffset = (UINT16)
Al Stone c045b7
-        ACPI_PTR_DIFF (ResourceSource, Descriptor);
Al Stone c045b7
+    Tmp16 = (UINT16) ACPI_PTR_DIFF (ResourceSource, Descriptor);
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResSourceOffset, &Tmp16);
Al Stone c045b7
 
Al Stone c045b7
     /* Process all child initialization nodes */
Al Stone c045b7
 
Al Stone c045b7
@@ -605,7 +625,7 @@ RsDoGpioIoDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* Share Type [Flags] (_SHR) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0);
Al Stone 840f97
             RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3);
Al Stone 840f97
             break;
Al Stone c045b7
@@ -619,21 +639,21 @@ RsDoGpioIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Debounce Timeout [WORD] (_DBT) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 3: /* Drive Strength [WORD] (_DRS) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 4: /* I/O Restriction [Flag] (_IOR) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0);
Al Stone 840f97
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2);
Al Stone 840f97
             break;
Al Stone c045b7
@@ -659,7 +679,7 @@ RsDoGpioIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Resource Usage (consumer/producer) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
Al Stone 840f97
+            RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Resource Tag (Descriptor Name) */
Al Stone c045b7
@@ -673,13 +693,14 @@ RsDoGpioIoDescriptor (
Al Stone c045b7
              * This field is required in order to calculate the length
Al Stone c045b7
              * of the ResourceSource at runtime.
Al Stone c045b7
              */
Al Stone c045b7
-            Descriptor->Gpio.VendorOffset = (UINT16)
Al Stone c045b7
-                ACPI_PTR_DIFF (VendorData, Descriptor);
Al Stone c045b7
+            Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor);
Al Stone c045b7
+            ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorOffset, &Tmp16);
Al Stone c045b7
 
Al Stone c045b7
             if (RsGetVendorData (InitializerOp, VendorData,
Al Stone c045b7
                 (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
Al Stone c045b7
             {
Al Stone c045b7
-                Descriptor->Gpio.VendorLength = VendorLength;
Al Stone c045b7
+                ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorLength,
Al Stone c045b7
+				   &VendorLength);
Al Stone c045b7
             }
Al Stone c045b7
             break;
Al Stone c045b7
 
Al Stone c045b7
@@ -692,7 +713,9 @@ RsDoGpioIoDescriptor (
Al Stone c045b7
              *  (implies resource source must immediately follow the pin list.)
Al Stone c045b7
              *  Name: _PIN
Al Stone c045b7
              */
Al Stone c045b7
-            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone c045b7
+            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone c045b7
+	    ACPI_MOVE_16_TO_16(&Val16, &Tmp16);
Al Stone c045b7
+            *InterruptList = Val16;
Al Stone c045b7
             InterruptList++;
Al Stone c045b7
             PinCount++;
Al Stone c045b7
 
Al Stone c045b7
@@ -723,6 +746,11 @@ RsDoGpioIoDescriptor (
Al Stone 840f97
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DriveStrength, &DriveStrength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags);
Al Stone 840f97
+
Al Stone 840f97
     MpSaveGpioInfo (Info->MappingOp, Descriptor,
Al Stone 840f97
         PinCount, PinList, ResourceSource);
Al Stone 840f97
     return (Rnode);
Al Stone c045b7
@@ -753,8 +781,12 @@ RsDoI2cSerialBusDescriptor (
Al Stone 840f97
     UINT16                  ResSourceLength;
Al Stone 840f97
     UINT16                  VendorLength;
Al Stone 840f97
     UINT16                  DescriptorSize;
Al Stone 840f97
+    UINT16                  SlaveAddress = 0;
Al Stone 840f97
+    UINT32                  ConnectionSpeed = 0;
Al Stone 840f97
+    UINT16                  TypeSpecificFlags = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone c045b7
+    UINT16		    Tmp16;
Al Stone c045b7
 
Al Stone c045b7
 
Al Stone c045b7
     InitializerOp = Info->DescriptorTypeOp->Asl.Child;
Al Stone c045b7
@@ -777,12 +809,14 @@ RsDoI2cSerialBusDescriptor (
Al Stone c045b7
         sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone c045b7
     Descriptor = Rnode->Buffer;
Al Stone c045b7
-    Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.ResourceLength,
Al Stone c045b7
+		       &DescriptorSize);
Al Stone c045b7
     Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
Al Stone c045b7
     Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
Al Stone c045b7
     Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
Al Stone c045b7
     Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
Al Stone c045b7
-    Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
Al Stone c045b7
+    Tmp16 = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.TypeDataLength, &Tmp16);
Al Stone c045b7
 
Al Stone c045b7
     if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
Al Stone c045b7
     {
Al Stone c045b7
@@ -802,7 +836,7 @@ RsDoI2cSerialBusDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* Slave Address [WORD] (_ADR) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
Al Stone 840f97
             break;
Al Stone c045b7
@@ -816,14 +850,14 @@ RsDoI2cSerialBusDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Connection Speed [DWORD] (_SPE) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 3: /* Addressing Mode [Flag] (_MOD) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone 840f97
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
Al Stone 840f97
             break;
Al Stone c045b7
@@ -883,6 +917,9 @@ RsDoI2cSerialBusDescriptor (
Al Stone 840f97
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.SlaveAddress, &SlaveAddress);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->I2cSerialBus.ConnectionSpeed, &ConnectionSpeed);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
Al Stone 840f97
     MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone c045b7
@@ -912,6 +949,9 @@ RsDoSpiSerialBusDescriptor (
Al Stone 840f97
     UINT16                  ResSourceLength;
Al Stone 840f97
     UINT16                  VendorLength;
Al Stone 840f97
     UINT16                  DescriptorSize;
Al Stone 840f97
+    UINT16                  DeviceSelection = 0;
Al Stone 840f97
+    UINT32                  ConnectionSpeed = 0;
Al Stone 840f97
+    UINT16                  TypeSpecificFlags = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone c045b7
@@ -962,21 +1002,21 @@ RsDoSpiSerialBusDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* Device Selection [WORD] (_ADR) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 1: /* Device Polarity [Flag] (_DPL) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 1, 0);
Al Stone 840f97
             RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Wire Mode [Flag] (_MOD) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone 840f97
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
Al Stone 840f97
             break;
Al Stone c045b7
@@ -997,7 +1037,7 @@ RsDoSpiSerialBusDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 5: /* Connection Speed [DWORD] (_SPE) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
Al Stone 840f97
             break;
Al Stone c045b7
@@ -1071,6 +1111,10 @@ RsDoSpiSerialBusDescriptor (
Al Stone 840f97
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.DeviceSelection, &DeviceSelection);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->SpiSerialBus.ConnectionSpeed, &ConnectionSpeed);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
Al Stone 840f97
+
Al Stone 840f97
     MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone c045b7
@@ -1100,6 +1144,10 @@ RsDoUartSerialBusDescriptor (
Al Stone 840f97
     UINT16                  ResSourceLength;
Al Stone 840f97
     UINT16                  VendorLength;
Al Stone 840f97
     UINT16                  DescriptorSize;
Al Stone 840f97
+    UINT32                  DefaultBaudRate = 0;
Al Stone 840f97
+    UINT16                  TypeSpecificFlags = 0;
Al Stone 840f97
+    UINT16                  RxFifoSize = 0;
Al Stone 840f97
+    UINT16                  TxFifoSize = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone c045b7
@@ -1149,21 +1197,21 @@ RsDoUartSerialBusDescriptor (
Al Stone 840f97
         {
Al Stone 840f97
         case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 1: /* Bits Per Byte [Flags] (_LEN) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
Al Stone 840f97
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 4, 3);
Al Stone 840f97
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 2: /* Stop Bits [Flags] (_STB) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
Al Stone 840f97
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 2, 1);
Al Stone 840f97
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
Al Stone 840f97
             break;
Al Stone c045b7
@@ -1177,7 +1225,7 @@ RsDoUartSerialBusDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 4: /* Endianness [Flag] (_END) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 7, 0);
Al Stone 840f97
             RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
Al Stone 840f97
             break;
Al Stone c045b7
@@ -1191,21 +1239,21 @@ RsDoUartSerialBusDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Flow Control [Flags] (_FLC) */
Al Stone 840f97
 
Al Stone 840f97
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone 840f97
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone 840f97
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Rx Buffer Size [WORD] (_RXL) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Tx Buffer Size [WORD] (_TXL) */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
Al Stone 840f97
             break;
Al Stone c045b7
@@ -1275,6 +1323,11 @@ RsDoUartSerialBusDescriptor (
Al Stone 840f97
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Descriptor->UartSerialBus.DefaultBaudRate, &DefaultBaudRate);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.RxFifoSize, &RxFifoSize);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TxFifoSize, &TxFifoSize);
Al Stone 840f97
+
Al Stone 840f97
     MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
 }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslrestype2w.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslrestype2w.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslrestype2w.c
Al Stone 840f97
@@ -81,6 +81,12 @@ RsDoWordIoDescriptor (
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
+    UINT16                  Minimum = 0;
Al Stone 840f97
+    UINT16                  Maximum = 0;
Al Stone 840f97
+    UINT16                  AddressLength = 0;
Al Stone 840f97
+    UINT16                  Granularity = 0;
Al Stone 840f97
+    UINT16                  TranslationOffset = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
@@ -102,8 +108,7 @@ RsDoWordIoDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
Al Stone 840f97
-    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -147,7 +152,7 @@ RsDoWordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 5: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -155,7 +160,7 @@ RsDoWordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Min */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -163,7 +168,7 @@ RsDoWordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Address Max */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -171,14 +176,14 @@ RsDoWordIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -190,7 +195,7 @@ RsDoWordIoDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address16.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -202,8 +207,7 @@ RsDoWordIoDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address16.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -263,13 +267,20 @@ RsDoWordIoDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Minimum,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Maximum,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.AddressLength,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address16.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
@@ -302,6 +313,12 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
+    UINT16                  Minimum = 0;
Al Stone 840f97
+    UINT16                  Maximum = 0;
Al Stone 840f97
+    UINT16                  AddressLength = 0;
Al Stone 840f97
+    UINT16                  Granularity = 0;
Al Stone 840f97
+    UINT16                  TranslationOffset = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
@@ -323,8 +340,7 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
Al Stone 840f97
-    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -361,8 +377,7 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 4: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Granularity =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -370,8 +385,7 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 5: /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Minimum =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -379,8 +393,7 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Maximum =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -388,16 +401,14 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.TranslationOffset =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.AddressLength =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -409,7 +420,7 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address16.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -421,8 +432,7 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address16.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -468,13 +478,20 @@ RsDoWordBusNumberDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Minimum,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Maximum,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.AddressLength,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address16.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 840f97
@@ -507,6 +524,12 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
     UINT8                   *OptionalFields;
Al Stone 840f97
     UINT16                  StringLength = 0;
Al Stone 840f97
     UINT32                  OptionIndex = 0;
Al Stone 840f97
+    UINT16                  Minimum = 0;
Al Stone 840f97
+    UINT16                  Maximum = 0;
Al Stone 840f97
+    UINT16                  AddressLength = 0;
Al Stone 840f97
+    UINT16                  Granularity = 0;
Al Stone 840f97
+    UINT16                  TranslationOffset = 0;
Al Stone 840f97
+    UINT16                  ResourceLength = 0;
Al Stone 840f97
     UINT32                  CurrentByteOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 840f97
@@ -527,8 +550,7 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
      * optional fields present
Al Stone 840f97
      */
Al Stone 840f97
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
Al Stone 840f97
-    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone 840f97
-        (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone 840f97
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone 840f97
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     /* Process all child initialization nodes */
Al Stone 840f97
@@ -577,8 +599,7 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 6: /* Address Granularity */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Granularity =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
Al Stone 840f97
             GranOp = InitializerOp;
Al Stone 840f97
@@ -586,8 +607,7 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 7: /* Min Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Minimum =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
Al Stone 840f97
             MinOp = InitializerOp;
Al Stone 840f97
@@ -595,8 +615,7 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 8: /* Max Address */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.Maximum =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
Al Stone 840f97
             MaxOp = InitializerOp;
Al Stone 840f97
@@ -604,16 +623,14 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
 
Al Stone 840f97
         case 9: /* Translation Offset */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.TranslationOffset =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 10: /* Address Length */
Al Stone 840f97
 
Al Stone 840f97
-            Descriptor->Address16.AddressLength =
Al Stone 840f97
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone 840f97
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
Al Stone 840f97
             LengthOp = InitializerOp;
Al Stone 840f97
@@ -625,7 +642,7 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone 840f97
                 OptionIndex++;
Al Stone 840f97
-                Descriptor->Address16.ResourceLength++;
Al Stone 840f97
+                ResourceLength++;
Al Stone 840f97
                 ResSourceIndex = TRUE;
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 840f97
@@ -637,8 +654,7 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
             {
Al Stone 840f97
                 if (StringLength)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone 840f97
-                        (Descriptor->Address16.ResourceLength + StringLength);
Al Stone 840f97
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone 840f97
 
Al Stone 840f97
                     strcpy ((char *)
Al Stone 840f97
                         &OptionalFields[OptionIndex],
Al Stone 840f97
@@ -684,13 +700,20 @@ RsDoWordSpaceDescriptor (
Al Stone 840f97
     /* Validate the Min/Max/Len/Gran values */
Al Stone 840f97
 
Al Stone 840f97
     RsLargeAddressCheck (
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Minimum,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Maximum,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.AddressLength,
Al Stone 840f97
-        (UINT64) Descriptor->Address16.Granularity,
Al Stone 840f97
+        Minimum,
Al Stone 840f97
+        Maximum,
Al Stone 840f97
+        AddressLength,
Al Stone 840f97
+        Granularity,
Al Stone 840f97
         Descriptor->Address16.Flags,
Al Stone 840f97
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
Al Stone 840f97
+
Al Stone 840f97
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
Al Stone 840f97
         OptionIndex + StringLength;
Al Stone 840f97
     return (Rnode);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/include/acmacros.h
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/include/acmacros.h
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/include/acmacros.h
Al Stone 840f97
@@ -98,9 +98,12 @@
Al Stone 840f97
                                            ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
Al Stone 840f97
                                            ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
Al Stone 840f97
 
Al Stone 840f97
-/* 32-bit source, 16/32/64 destination */
Al Stone 840f97
+/* 32-bit source, 8/16/32/64 destination */
Al Stone 840f97
 
Al Stone 840f97
-#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone 840f97
+#define ACPI_MOVE_32_TO_8(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];}
Al Stone 840f97
+
Al Stone 840f97
+#define ACPI_MOVE_32_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
Al Stone 840f97
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];}
Al Stone 840f97
 
Al Stone 840f97
 #define ACPI_MOVE_32_TO_32(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
Al Stone 840f97
                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\
Al Stone 840f97
@@ -113,11 +116,17 @@
Al Stone 840f97
                                            ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
Al Stone 840f97
                                            ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
Al Stone 840f97
 
Al Stone 840f97
-/* 64-bit source, 16/32/64 destination */
Al Stone 840f97
+/* 64-bit source, 8/16/32/64 destination */
Al Stone 840f97
 
Al Stone 840f97
-#define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone 840f97
+#define ACPI_MOVE_64_TO_8(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];}
Al Stone 840f97
 
Al Stone 840f97
-#define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)    /* Truncate to 32 */
Al Stone 840f97
+#define ACPI_MOVE_64_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
Al Stone 840f97
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];}
Al Stone 840f97
+
Al Stone 840f97
+#define ACPI_MOVE_64_TO_32(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
Al Stone 840f97
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
Al Stone 840f97
+                                         ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\
Al Stone 840f97
+                                         ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];}
Al Stone 840f97
 
Al Stone 840f97
 #define ACPI_MOVE_64_TO_64(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
Al Stone 840f97
                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
Al Stone 840f97
@@ -136,20 +145,26 @@
Al Stone 840f97
 
Al Stone 840f97
 /* The hardware supports unaligned transfers, just do the little-endian move */
Al Stone 840f97
 
Al Stone 840f97
-/* 16-bit source, 16/32/64 destination */
Al Stone 840f97
+/* 16-bit source, 8/16/32/64 destination */
Al Stone 840f97
 
Al Stone 840f97
+#define ACPI_MOVE_16_TO_8(d, s)         *(UINT8 *)(void *)(d) = *(UINT16 *)(void *)(s)
Al Stone 840f97
 #define ACPI_MOVE_16_TO_16(d, s)        *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
Al Stone 840f97
 #define ACPI_MOVE_16_TO_32(d, s)        *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
Al Stone 840f97
 #define ACPI_MOVE_16_TO_64(d, s)        *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s)
Al Stone 840f97
 
Al Stone 840f97
-/* 32-bit source, 16/32/64 destination */
Al Stone 840f97
+/* 32-bit source, 8/16/32/64 destination */
Al Stone 840f97
+
Al Stone 840f97
+#define ACPI_MOVE_32_TO_8(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];}
Al Stone 840f97
+
Al Stone 840f97
+#define ACPI_MOVE_32_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
Al Stone 840f97
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
Al Stone 840f97
 
Al Stone 840f97
-#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone 840f97
 #define ACPI_MOVE_32_TO_32(d, s)        *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
Al Stone 840f97
 #define ACPI_MOVE_32_TO_64(d, s)        *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s)
Al Stone 840f97
 
Al Stone 840f97
-/* 64-bit source, 16/32/64 destination */
Al Stone 840f97
+/* 64-bit source, 8/16/32/64 destination */
Al Stone 840f97
 
Al Stone 840f97
+#define ACPI_MOVE_64_TO_8(d, s)         ACPI_MOVE_16_TO_8(d, s)    /* Truncate to 8 */
Al Stone 840f97
 #define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone 840f97
 #define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)    /* Truncate to 32 */
Al Stone 840f97
 #define ACPI_MOVE_64_TO_64(d, s)        *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
Al Stone 840f97
@@ -169,7 +184,9 @@
Al Stone 840f97
 #define ACPI_MOVE_16_TO_32(d, s)        {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
Al Stone 840f97
 #define ACPI_MOVE_16_TO_64(d, s)        {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
Al Stone 840f97
 
Al Stone 840f97
-/* 32-bit source, 16/32/64 destination */
Al Stone 840f97
+/* 32-bit source, 8/16/32/64 destination */
Al Stone 840f97
+
Al Stone 840f97
+#define ACPI_MOVE_32_TO_8(d, s)         ACPI_MOVE_16_TO_8(d, s)    /* Truncate to 8 */
Al Stone 840f97
 
Al Stone 840f97
 #define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/include/platform/aclinux.h
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/include/platform/aclinux.h
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/include/platform/aclinux.h
Al Stone 49c3e9
@@ -192,6 +192,7 @@
Al Stone 840f97
 
Al Stone 840f97
 #ifdef ACPI_USE_STANDARD_HEADERS
Al Stone 840f97
 #include <unistd.h>
Al Stone 840f97
+#include <endian.h>
Al Stone 840f97
 #endif
Al Stone 840f97
 
Al Stone 840f97
 /* Define/disable kernel-specific declarators */
Al Stone 49c3e9
@@ -226,6 +227,10 @@
Al Stone 840f97
 #define __cdecl
Al Stone 840f97
 #endif
Al Stone 840f97
 
Al Stone 840f97
+#if defined(__PPC64__) || defined(__s390x__)
Al Stone 840f97
+#define ACPI_BIG_ENDIAN
Al Stone 840f97
+#endif
Al Stone 840f97
+
Al Stone 840f97
 #endif /* __KERNEL__ */
Al Stone 840f97
 
Al Stone 840f97
 #endif /* __ACLINUX_H__ */
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslanalyze.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslanalyze.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslanalyze.c
Al Stone 840f97
@@ -461,7 +461,7 @@ ApCheckForGpeNameConflict (
Al Stone 840f97
 
Al Stone 840f97
     /* Need a null-terminated string version of NameSeg */
Al Stone 840f97
 
Al Stone 840f97
-    ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg);
Al Stone 840f97
+    ACPI_MOVE_NAME (Name, &Op->Asl.NameSeg);
Al Stone 840f97
     Name[ACPI_NAME_SIZE] = 0;
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone 840f97
@@ -488,7 +488,7 @@ ApCheckForGpeNameConflict (
Al Stone 840f97
      * We are now sure we have an _Lxx or _Exx.
Al Stone 840f97
      * Create the target name that would cause collision (Flip E/L)
Al Stone 840f97
      */
Al Stone 840f97
-    ACPI_MOVE_32_TO_32 (Target, Name);
Al Stone 840f97
+    ACPI_MOVE_NAME (Target, Name);
Al Stone 840f97
 
Al Stone 840f97
     /* Inject opposite letter ("L" versus "E") */
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/asllookup.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/asllookup.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/asllookup.c
Al Stone 840f97
@@ -119,6 +119,7 @@ LkIsObjectUsed (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_NAMESPACE_NODE     *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
Al Stone 840f97
     ACPI_NAMESPACE_NODE     *Next;
Al Stone 840f97
+    ACPI_NAME_UNION         tmp, tmp2;
Al Stone 840f97
     ASL_METHOD_LOCAL        *MethodLocals;
Al Stone 840f97
     ASL_METHOD_LOCAL        *MethodArgs;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
@@ -175,7 +176,8 @@ LkIsObjectUsed (
Al Stone 840f97
                  * We ignore the predefined methods since often, not
Al Stone 840f97
                  * all arguments are needed or used.
Al Stone 840f97
                  */
Al Stone 840f97
-                if ((Node->Name.Ascii[0] != '_') &&
Al Stone 840f97
+                ACPI_MOVE_32_TO_32(&tmp.Ascii, Node->Name.Ascii);
Al Stone 840f97
+                if ((tmp.Ascii[0] != '_') &&
Al Stone 840f97
                     (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED)))
Al Stone 840f97
                 {
Al Stone 840f97
                     sprintf (MsgBuffer, "Arg%u", i);
Al Stone 840f97
@@ -228,8 +230,10 @@ LkIsObjectUsed (
Al Stone 840f97
              * Issue a remark even if it is a reserved name (starts
Al Stone 840f97
              * with an underscore).
Al Stone 840f97
              */
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&tmp.Ascii, Node->Name.Ascii);
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&tmp2.Ascii, Next->Name.Ascii);
Al Stone 840f97
             sprintf (MsgBuffer, "Name [%4.4s] is within a method [%4.4s]",
Al Stone 840f97
-                Node->Name.Ascii, Next->Name.Ascii);
Al Stone 840f97
+                tmp.Ascii, tmp2.Ascii);
Al Stone 840f97
             AslError (ASL_REMARK, ASL_MSG_NOT_REFERENCED,
Al Stone 840f97
                 LkGetNameOp (Node->Op), MsgBuffer);
Al Stone 840f97
             return (AE_OK);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/aslmain.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/aslmain.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/aslmain.c
Al Stone 840f97
@@ -102,18 +102,6 @@ main (
Al Stone 840f97
     signal (SIGINT, AslSignalHandler);
Al Stone 840f97
     signal (SIGSEGV, AslSignalHandler);
Al Stone 840f97
 
Al Stone 840f97
-    /*
Al Stone 840f97
-     * Big-endian machines are not currently supported. ACPI tables must
Al Stone 840f97
-     * be little-endian, and support for big-endian machines needs to
Al Stone 840f97
-     * be implemented.
Al Stone 840f97
-     */
Al Stone 840f97
-    if (UtIsBigEndianMachine ())
Al Stone 840f97
-    {
Al Stone 840f97
-        fprintf (stderr,
Al Stone 840f97
-            "iASL is not currently supported on big-endian machines.\n");
Al Stone 840f97
-        return (-1);
Al Stone 840f97
-    }
Al Stone 840f97
-
Al Stone 840f97
     AcpiOsInitialize ();
Al Stone 840f97
     ACPI_DEBUG_INITIALIZE (); /* For debug version only */
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/acfileio.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/acfileio.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/acfileio.c
Al Stone 840f97
@@ -280,6 +280,7 @@ AcGetOneTableFromFile (
Al Stone 840f97
     ACPI_TABLE_HEADER       *Table;
Al Stone 840f97
     INT32                   Count;
Al Stone 840f97
     long                    TableOffset;
Al Stone 840f97
+    UINT32		    TableLen;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     *ReturnTable = NULL;
Al Stone 840f97
@@ -319,7 +320,8 @@ AcGetOneTableFromFile (
Al Stone 840f97
 
Al Stone 840f97
     /* Allocate a buffer for the entire table */
Al Stone 840f97
 
Al Stone 840f97
-    Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&TableLen, &TableHeader.Length);
Al Stone 840f97
+    Table = AcpiOsAllocate ((ACPI_SIZE) TableLen);
Al Stone 840f97
     if (!Table)
Al Stone 840f97
     {
Al Stone 840f97
         return (AE_NO_MEMORY);
Al Stone 840f97
@@ -329,8 +331,8 @@ AcGetOneTableFromFile (
Al Stone 840f97
 
Al Stone 840f97
     fseek (File, TableOffset, SEEK_SET);
Al Stone 840f97
 
Al Stone 840f97
-    Count = fread (Table, 1, TableHeader.Length, File);
Al Stone 840f97
-    if (Count != (INT32) TableHeader.Length)
Al Stone 840f97
+    Count = fread (Table, 1, TableLen, File);
Al Stone 840f97
+    if (Count != (INT32) TableLen)
Al Stone 840f97
     {
Al Stone 840f97
         Status = AE_ERROR;
Al Stone 840f97
         goto ErrorExit;
Al Stone 840f97
@@ -338,7 +340,7 @@ AcGetOneTableFromFile (
Al Stone 840f97
 
Al Stone 840f97
     /* Validate the checksum (just issue a warning) */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
Al Stone 840f97
+    Status = AcpiTbVerifyChecksum (Table, TableLen);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         Status = AcCheckTextModeCorruption (Table);
Al Stone 840f97
@@ -430,6 +432,7 @@ AcValidateTableHeader (
Al Stone 840f97
     ACPI_SIZE               Actual;
Al Stone 840f97
     long                    OriginalOffset;
Al Stone 840f97
     UINT32                  FileSize;
Al Stone 840f97
+    UINT32                  TableLength;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -459,11 +462,12 @@ AcValidateTableHeader (
Al Stone 840f97
     /* Validate table length against bytes remaining in the file */
Al Stone 840f97
 
Al Stone 840f97
     FileSize = CmGetFileSize (File);
Al Stone 840f97
-    if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&TableLength, &TableHeader.Length);
Al Stone 840f97
+    if (TableLength > (UINT32) (FileSize - TableOffset))
Al Stone 840f97
     {
Al Stone 840f97
         fprintf (stderr, "Table [%4.4s] is too long for file - "
Al Stone 840f97
             "needs: 0x%.2X, remaining in file: 0x%.2X\n",
Al Stone 840f97
-            TableHeader.Signature, TableHeader.Length,
Al Stone 840f97
+            TableHeader.Signature, TableLength,
Al Stone 840f97
             (UINT32) (FileSize - TableOffset));
Al Stone 840f97
         return (AE_BAD_HEADER);
Al Stone 840f97
     }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/dmtable.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/dmtable.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/dmtable.c
Al Stone 9b3daa
@@ -550,7 +550,7 @@ AcpiDmDumpDataTable (
Al Stone 840f97
      */
Al Stone 840f97
     if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
Al Stone 840f97
     {
Al Stone 840f97
-        Length = Table->Length;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 9b3daa
@@ -564,13 +564,14 @@ AcpiDmDumpDataTable (
Al Stone 840f97
     else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_S3PT))
Al Stone 840f97
     {
Al Stone 840f97
         Length = AcpiDmDumpS3pt (Table);
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     }
Al Stone 840f97
     else
Al Stone 840f97
     {
Al Stone 840f97
         /*
Al Stone 840f97
          * All other tables must use the common ACPI table header, dump it now
Al Stone 840f97
          */
Al Stone 840f97
-        Length = Table->Length;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
         Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 9b3daa
@@ -781,6 +782,7 @@ AcpiDmDumpTable (
Al Stone 840f97
     BOOLEAN                 LastOutputBlankLine = FALSE;
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     char                    RepairedName[8];
Al Stone 840f97
+    UINT16		    Val16;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     if (!Info)
Al Stone 9b3daa
@@ -1177,8 +1179,9 @@ AcpiDmDumpTable (
Al Stone 840f97
             /* Checksum, display and validate */
Al Stone 840f97
 
Al Stone 840f97
             AcpiOsPrintf ("%2.2X", *Target);
Al Stone 840f97
-            Temp8 = AcpiDmGenerateChecksum (Table,
Al Stone 840f97
-                ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
Al Stone 840f97
+	    ACPI_MOVE_32_TO_32(&Temp32,
Al Stone 840f97
+			&ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length);
Al Stone 840f97
+            Temp8 = AcpiDmGenerateChecksum (Table, Temp32,
Al Stone 840f97
                 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
Al Stone 840f97
 
Al Stone 840f97
             if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
Al Stone 9b3daa
@@ -1243,14 +1246,14 @@ AcpiDmDumpTable (
Al Stone 840f97
 
Al Stone 840f97
             /* DMAR subtable types */
Al Stone 840f97
 
Al Stone 840f97
-            Temp16 = ACPI_GET16 (Target);
Al Stone 840f97
+            Val16 = ACPI_GET16 (Target);
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&Temp16, &Val16);
Al Stone 840f97
             if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
Al Stone 840f97
             {
Al Stone 840f97
                 Temp16 = ACPI_DMAR_TYPE_RESERVED;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
Al Stone 840f97
-                AcpiDmDmarSubnames[Temp16]);
Al Stone 840f97
+            AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmDmarSubnames[Temp16]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case ACPI_DMT_DMAR_SCOPE:
Al Stone 9b3daa
@@ -1341,14 +1344,14 @@ AcpiDmDumpTable (
Al Stone 840f97
 
Al Stone 840f97
             /* HEST subtable types */
Al Stone 840f97
 
Al Stone 840f97
-            Temp16 = ACPI_GET16 (Target);
Al Stone 840f97
+            Val16 = ACPI_GET16 (Target);
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&Temp16, &Val16);
Al Stone 840f97
             if (Temp16 > ACPI_HEST_TYPE_RESERVED)
Al Stone 840f97
             {
Al Stone 840f97
                 Temp16 = ACPI_HEST_TYPE_RESERVED;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
Al Stone 840f97
-                AcpiDmHestSubnames[Temp16]);
Al Stone 840f97
+            AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmHestSubnames[Temp16]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case ACPI_DMT_HESTNTFY:
Al Stone 9b3daa
@@ -1428,13 +1431,14 @@ AcpiDmDumpTable (
Al Stone 840f97
 
Al Stone 840f97
             /* NFIT subtable types */
Al Stone 840f97
 
Al Stone 840f97
-            Temp16 = ACPI_GET16 (Target);
Al Stone 840f97
+            Val16 = ACPI_GET16 (Target);
Al Stone 840f97
+            ACPI_MOVE_16_TO_16(&Temp16, &Val16);
Al Stone 840f97
             if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
Al Stone 840f97
             {
Al Stone 840f97
                 Temp16 = ACPI_NFIT_TYPE_RESERVED;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
Al Stone 840f97
+            AcpiOsPrintf (UINT16_FORMAT, Temp16,
Al Stone 840f97
                 AcpiDmNfitSubnames[Temp16]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/dmtables.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/dmtables.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/dmtables.c
Al Stone 840f97
@@ -142,7 +142,9 @@ AdCreateTableHeader (
Al Stone 840f97
     ACPI_TABLE_HEADER       *Table)
Al Stone 840f97
 {
Al Stone 840f97
     UINT8                   Checksum;
Al Stone 840f97
-
Al Stone 840f97
+    UINT32		    TableLen;
Al Stone 840f97
+    UINT32		    OemRev;
Al Stone 840f97
+    UINT32		    CompilerRev;
Al Stone 840f97
 
Al Stone 840f97
     /* Reset globals for External statements */
Al Stone 840f97
 
Al Stone 840f97
@@ -154,9 +156,10 @@ AdCreateTableHeader (
Al Stone 840f97
      */
Al Stone 840f97
     AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
Al Stone 840f97
     AcpiOsPrintf (" * Original Table Header:\n");
Al Stone 840f97
     AcpiOsPrintf (" *     Signature        \"%4.4s\"\n",    Table->Signature);
Al Stone 840f97
-    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", Table->Length, Table->Length);
Al Stone 840f97
+    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", TableLen, TableLen);
Al Stone 840f97
 
Al Stone 840f97
     /* Print and validate the revision */
Al Stone 840f97
 
Al Stone 840f97
@@ -188,7 +191,7 @@ AdCreateTableHeader (
Al Stone 840f97
 
Al Stone 840f97
     AcpiOsPrintf ("\n *     Checksum         0x%2.2X",        Table->Checksum);
Al Stone 840f97
 
Al Stone 840f97
-    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
Al Stone 840f97
+    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), TableLen);
Al Stone 840f97
     if (Checksum)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
Al Stone 840f97
@@ -198,9 +201,11 @@ AdCreateTableHeader (
Al Stone 840f97
     AcpiOsPrintf ("\n");
Al Stone 840f97
     AcpiOsPrintf (" *     OEM ID           \"%.6s\"\n",     Table->OemId);
Al Stone 840f97
     AcpiOsPrintf (" *     OEM Table ID     \"%.8s\"\n",     Table->OemTableId);
Al Stone 840f97
-    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&OemRev, &Table->OemRevision);
Al Stone 840f97
+    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", OemRev, OemRev);
Al Stone 840f97
     AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);
Al Stone 840f97
-    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&CompilerRev, &Table->AslCompilerRevision);
Al Stone 840f97
+    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", CompilerRev, CompilerRev);
Al Stone 840f97
     AcpiOsPrintf (" */\n");
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone 840f97
@@ -221,7 +226,7 @@ AdCreateTableHeader (
Al Stone 840f97
     AcpiOsPrintf (
Al Stone 840f97
         "DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
Al Stone 840f97
         Table->Signature, Table->Revision,
Al Stone 840f97
-        Table->OemId, Table->OemTableId, Table->OemRevision);
Al Stone 840f97
+        Table->OemId, Table->OemTableId, OemRev);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -396,7 +401,8 @@ AdParseTable (
Al Stone 840f97
 
Al Stone 840f97
     fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
Al Stone 840f97
 
Al Stone 840f97
-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&AmlLength, &Table->Length);
Al Stone 840f97
+    AmlLength -= sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
     AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
Al Stone 840f97
     ASL_CV_INIT_FILETREE(Table, AmlStart, AmlLength);
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/dmtbdump.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/dmtbdump.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/dmtbdump.c
Al Stone 840f97
@@ -277,6 +277,8 @@ AcpiDmDumpRsdt (
Al Stone 840f97
     UINT32                  Entries;
Al Stone 840f97
     UINT32                  Offset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
+    UINT32		    Address;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Point to start of table pointer array */
Al Stone 840f97
@@ -286,12 +288,14 @@ AcpiDmDumpRsdt (
Al Stone 840f97
 
Al Stone 840f97
     /* RSDT uses 32-bit pointers */
Al Stone 840f97
 
Al Stone 840f97
-    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
Al Stone 840f97
 
Al Stone 840f97
     for (i = 0; i < Entries; i++)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
Al Stone 840f97
-        AcpiOsPrintf ("%8.8X\n", Array[i]);
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Address, &Array[i]);
Al Stone 840f97
+        AcpiOsPrintf ("%8.8X\n", Address);
Al Stone 840f97
         Offset += sizeof (UINT32);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
@@ -317,6 +321,8 @@ AcpiDmDumpXsdt (
Al Stone 840f97
     UINT32                  Entries;
Al Stone 840f97
     UINT32                  Offset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
+    UINT64		    Address;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Point to start of table pointer array */
Al Stone 840f97
@@ -326,12 +332,14 @@ AcpiDmDumpXsdt (
Al Stone 840f97
 
Al Stone 840f97
     /* XSDT uses 64-bit pointers */
Al Stone 840f97
 
Al Stone 840f97
-    Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
Al Stone 840f97
 
Al Stone 840f97
     for (i = 0; i < Entries; i++)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
Al Stone 840f97
-        AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
Al Stone 840f97
+	ACPI_MOVE_64_TO_64(&Address, &Array[i]);
Al Stone 840f97
+        AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Address));
Al Stone 840f97
         Offset += sizeof (UINT64);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone c045b7
@@ -358,12 +366,12 @@ AcpiDmDumpFadt (
Al Stone c045b7
     ACPI_TABLE_HEADER       *Table)
Al Stone c045b7
 {
Al Stone c045b7
     ACPI_STATUS             Status;
Al Stone c045b7
-
Al Stone c045b7
+    UINT32		    Length;
Al Stone c045b7
 
Al Stone c045b7
     /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
Al Stone c045b7
 
Al Stone c045b7
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
Al Stone c045b7
-        AcpiDmTableInfoFadt1);
Al Stone c045b7
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone c045b7
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt1);
Al Stone c045b7
     if (ACPI_FAILURE (Status))
Al Stone c045b7
     {
Al Stone c045b7
         return;
Al Stone c045b7
@@ -371,11 +379,9 @@ AcpiDmDumpFadt (
Al Stone c045b7
 
Al Stone c045b7
     /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
Al Stone c045b7
 
Al Stone c045b7
-    if ((Table->Length > ACPI_FADT_V1_SIZE) &&
Al Stone c045b7
-        (Table->Length <= ACPI_FADT_V2_SIZE))
Al Stone c045b7
+    if ((Length > ACPI_FADT_V1_SIZE) && (Length <= ACPI_FADT_V2_SIZE))
Al Stone c045b7
     {
Al Stone c045b7
-        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
Al Stone c045b7
-            AcpiDmTableInfoFadt2);
Al Stone c045b7
+        Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt2);
Al Stone c045b7
         if (ACPI_FAILURE (Status))
Al Stone c045b7
         {
Al Stone c045b7
             return;
Al Stone c045b7
@@ -384,10 +390,9 @@ AcpiDmDumpFadt (
Al Stone c045b7
 
Al Stone c045b7
     /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
Al Stone c045b7
 
Al Stone c045b7
-    else if (Table->Length > ACPI_FADT_V2_SIZE)
Al Stone c045b7
+    else if (Length > ACPI_FADT_V2_SIZE)
Al Stone c045b7
     {
Al Stone c045b7
-        Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
Al Stone c045b7
-            AcpiDmTableInfoFadt3);
Al Stone c045b7
+        Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt3);
Al Stone c045b7
         if (ACPI_FAILURE (Status))
Al Stone c045b7
         {
Al Stone c045b7
             return;
Al Stone c045b7
@@ -395,9 +400,9 @@ AcpiDmDumpFadt (
Al Stone c045b7
 
Al Stone c045b7
         /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
Al Stone c045b7
 
Al Stone c045b7
-        if (Table->Length > ACPI_FADT_V3_SIZE)
Al Stone c045b7
+        if (Length > ACPI_FADT_V3_SIZE)
Al Stone c045b7
         {
Al Stone c045b7
-            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
Al Stone c045b7
+            Status = AcpiDmDumpTable (Length, 0, Table, 0,
Al Stone c045b7
                 AcpiDmTableInfoFadt5);
Al Stone c045b7
             if (ACPI_FAILURE (Status))
Al Stone c045b7
             {
Al Stone c045b7
@@ -407,9 +412,9 @@ AcpiDmDumpFadt (
Al Stone c045b7
 
Al Stone c045b7
         /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
Al Stone c045b7
 
Al Stone c045b7
-        if (Table->Length > ACPI_FADT_V3_SIZE)
Al Stone c045b7
+        if (Length > ACPI_FADT_V3_SIZE)
Al Stone c045b7
         {
Al Stone c045b7
-            Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
Al Stone c045b7
+            Status = AcpiDmDumpTable (Length, 0, Table, 0,
Al Stone c045b7
                 AcpiDmTableInfoFadt6);
Al Stone c045b7
             if (ACPI_FAILURE (Status))
Al Stone c045b7
             {
Al Stone c045b7
@@ -420,11 +425,11 @@ AcpiDmDumpFadt (
Al Stone c045b7
 
Al Stone c045b7
     /* Validate various fields in the FADT, including length */
Al Stone c045b7
 
Al Stone c045b7
-    AcpiTbCreateLocalFadt (Table, Table->Length);
Al Stone c045b7
+    AcpiTbCreateLocalFadt (Table, Length);
Al Stone c045b7
 
Al Stone c045b7
     /* Validate FADT length against the revision */
Al Stone c045b7
 
Al Stone c045b7
-    AcpiDmValidateFadtLength (Table->Revision, Table->Length);
Al Stone c045b7
+    AcpiDmValidateFadtLength (Table->Revision, Length);
Al Stone c045b7
 }
Al Stone c045b7
 
Al Stone c045b7
 
Al Stone c045b7
@@ -450,6 +455,7 @@ AcpiDmValidateFadtLength (
Al Stone c045b7
     UINT32                  Length)
Al Stone c045b7
 {
Al Stone c045b7
     UINT32                  ExpectedLength;
Al Stone c045b7
+    UINT32		    Tmp32;
Al Stone c045b7
 
Al Stone c045b7
 
Al Stone c045b7
     switch (Revision)
Al Stone c045b7
@@ -485,7 +491,8 @@ AcpiDmValidateFadtLength (
Al Stone c045b7
         return;
Al Stone c045b7
     }
Al Stone c045b7
 
Al Stone c045b7
-    if (Length == ExpectedLength)
Al Stone c045b7
+    ACPI_MOVE_32_TO_32(&Tmp32, &Length);
Al Stone c045b7
+    if (Tmp32 == ExpectedLength)
Al Stone c045b7
     {
Al Stone c045b7
         return;
Al Stone c045b7
     }
Al Stone 49c3e9
@@ -493,5 +500,5 @@ AcpiDmValidateFadtLength (
Al Stone c045b7
     AcpiOsPrintf (
Al Stone c045b7
         "\n// ACPI Warning: FADT revision %X does not match length: "
Al Stone c045b7
         "found %X expected %X\n",
Al Stone c045b7
-        Revision, Length, ExpectedLength);
Al Stone c045b7
+        Revision, Tmp32, ExpectedLength);
Al Stone c045b7
 }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/dmtbdump1.c
Al Stone 49c3e9
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/dmtbdump1.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/dmtbdump1.c
Al Stone 49c3e9
@@ -79,17 +79,21 @@ AcpiDmDumpAsf (
Al Stone 840f97
     UINT32                  DataOffset = 0;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     UINT8                   Type;
Al Stone 840f97
+    UINT32		    Len;
Al Stone 840f97
+    UINT16		    SubLen;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* No main table, only subtables */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Len, &Table->Length);
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Len)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&SubLen, &Subtable->Header.Length);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Len, Offset, Subtable,
Al Stone 840f97
+            SubLen, AcpiDmTableInfoAsfHdr);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -146,8 +150,7 @@ AcpiDmDumpAsf (
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Header.Length, InfoTable);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Len, Offset, Subtable, SubLen, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -163,7 +166,7 @@ AcpiDmDumpAsf (
Al Stone 840f97
             for (i = 0; i < DataCount; i++)
Al Stone 840f97
             {
Al Stone 840f97
                 AcpiOsPrintf ("\n");
Al Stone 840f97
-                Status = AcpiDmDumpTable (Table->Length, DataOffset,
Al Stone 840f97
+                Status = AcpiDmDumpTable (Len, DataOffset,
Al Stone 840f97
                     DataTable, DataLength, DataInfoTable);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 840f97
                 {
Al Stone 49c3e9
@@ -209,15 +212,14 @@ AcpiDmDumpAsf (
Al Stone 840f97
 
Al Stone 840f97
         /* Point to next subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-        if (!Subtable->Header.Length)
Al Stone 840f97
+        if (!SubLen)
Al Stone 840f97
         {
Al Stone 840f97
             AcpiOsPrintf ("Invalid zero subtable header length\n");
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
-        Offset += Subtable->Header.Length;
Al Stone 51ac8f
-        Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable,
Al Stone 51ac8f
-            Subtable->Header.Length);
Al Stone 840f97
+        Offset += SubLen;
Al Stone 51ac8f
+        Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, SubLen);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -241,12 +243,13 @@ AcpiDmDumpCpep (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_CPEP_POLLING       *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_CPEP);
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -256,7 +259,7 @@ AcpiDmDumpCpep (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 49c3e9
@@ -296,7 +299,10 @@ AcpiDmDumpCsrt (
Al Stone 51ac8f
     ACPI_CSRT_GROUP         *Subtable;
Al Stone 840f97
     ACPI_CSRT_SHARED_INFO   *SharedInfoTable;
Al Stone 51ac8f
     ACPI_CSRT_DESCRIPTOR    *SubSubtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
+    UINT32                  SubLength;
Al Stone 840f97
+    UINT32                  SubSubLength;
Al Stone 840f97
+    UINT32                  SharedInfoLength;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_CSRT);
Al Stone 840f97
     UINT32                  SubOffset;
Al Stone 840f97
     UINT32                  SubSubOffset;
Al Stone 49c3e9
@@ -307,14 +313,16 @@ AcpiDmDumpCsrt (
Al Stone 840f97
 
Al Stone 840f97
     /* Subtables (Resource Groups) */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Resource group subtable */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
+        ACPI_MOVE_32_TO_32(&SubLength, &Subtable->Length);
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoCsrt0);
Al Stone 840f97
+            SubLength, AcpiDmTableInfoCsrt0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -334,19 +342,20 @@ AcpiDmDumpCsrt (
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
-        SubOffset += Subtable->SharedInfoLength;
Al Stone 51ac8f
+	ACPI_MOVE_32_TO_32(&SharedInfoLength, &Subtable->SharedInfoLength);
Al Stone 840f97
+        SubOffset += SharedInfoLength;
Al Stone 840f97
 
Al Stone 840f97
         /* Sub-Subtables (Resource Descriptors) */
Al Stone 840f97
 
Al Stone 51ac8f
         SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
Al Stone 840f97
             Offset + SubOffset);
Al Stone 840f97
 
Al Stone 51ac8f
-        while ((SubOffset < Subtable->Length) &&
Al Stone 840f97
-              ((Offset + SubOffset) < Table->Length))
Al Stone 840f97
+        while ((SubOffset < SubLength) && ((Offset + SubOffset) < Length))
Al Stone 840f97
         {
Al Stone 840f97
             AcpiOsPrintf ("\n");
Al Stone 51ac8f
+	    ACPI_MOVE_32_TO_32(&SubSubLength, &SubSubtable->Length);
Al Stone 51ac8f
             Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
Al Stone 51ac8f
-                SubSubtable->Length, AcpiDmTableInfoCsrt2);
Al Stone 840f97
+                SubSubLength, AcpiDmTableInfoCsrt2);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -356,7 +365,7 @@ AcpiDmDumpCsrt (
Al Stone 840f97
 
Al Stone 840f97
             /* Resource-specific info buffer */
Al Stone 840f97
 
Al Stone 51ac8f
-            InfoLength = SubSubtable->Length - SubSubOffset;
Al Stone 840f97
+            InfoLength = SubSubLength - SubSubOffset;
Al Stone 840f97
             if (InfoLength)
Al Stone 840f97
             {
Al Stone 840f97
                 Status = AcpiDmDumpTable (Length,
Al Stone 49c3e9
@@ -371,16 +380,15 @@ AcpiDmDumpCsrt (
Al Stone 840f97
 
Al Stone 840f97
             /* Point to next sub-subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-            SubOffset += SubSubtable->Length;
Al Stone 840f97
+            SubOffset += SubSubLength;
Al Stone 51ac8f
             SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable,
Al Stone 51ac8f
-                SubSubtable->Length);
Al Stone 840f97
+                SubSubLength);
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
         /* Point to next subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-        Offset += Subtable->Length;
Al Stone 51ac8f
-        Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable,
Al Stone 51ac8f
-            Subtable->Length);
Al Stone 840f97
+        Offset += SubLength;
Al Stone 51ac8f
+        Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, SubLength);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -404,16 +412,20 @@ AcpiDmDumpDbg2 (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_DBG2_DEVICE        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
+    UINT16                  SubLength;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_DBG2);
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     UINT32                  ArrayOffset;
Al Stone 840f97
     UINT32                  AbsoluteOffset;
Al Stone 840f97
     UINT8                   *Array;
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
+    UINT16		    AlsoTmp16;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -423,11 +435,12 @@ AcpiDmDumpDbg2 (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
+        ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoDbg2Device);
Al Stone 840f97
+            SubLength, AcpiDmTableInfoDbg2Device);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -437,13 +450,13 @@ AcpiDmDumpDbg2 (
Al Stone 840f97
 
Al Stone 51ac8f
         for (i = 0; i < Subtable->RegisterCount; i++)
Al Stone 840f97
         {
Al Stone 51ac8f
-            ArrayOffset = Subtable->BaseAddressOffset +
Al Stone 840f97
-                (sizeof (ACPI_GENERIC_ADDRESS) * i);
Al Stone 51ac8f
+	    ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->BaseAddressOffset);
Al Stone 840f97
+            ArrayOffset = Tmp16 + (sizeof (ACPI_GENERIC_ADDRESS) * i);
Al Stone 840f97
             AbsoluteOffset = Offset + ArrayOffset;
Al Stone 51ac8f
             Array = (UINT8 *) Subtable + ArrayOffset;
Al Stone 840f97
 
Al Stone 840f97
             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
Al Stone 51ac8f
-                Subtable->Length, AcpiDmTableInfoDbg2Addr);
Al Stone 840f97
+                SubLength, AcpiDmTableInfoDbg2Addr);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -454,13 +467,13 @@ AcpiDmDumpDbg2 (
Al Stone 840f97
 
Al Stone 51ac8f
         for (i = 0; i < Subtable->RegisterCount; i++)
Al Stone 840f97
         {
Al Stone 51ac8f
-            ArrayOffset = Subtable->AddressSizeOffset +
Al Stone 840f97
-                (sizeof (UINT32) * i);
Al Stone 51ac8f
+	    ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->AddressSizeOffset);
Al Stone 840f97
+            ArrayOffset = Tmp16 + (sizeof (UINT32) * i);
Al Stone 840f97
             AbsoluteOffset = Offset + ArrayOffset;
Al Stone 51ac8f
             Array = (UINT8 *) Subtable + ArrayOffset;
Al Stone 840f97
 
Al Stone 840f97
             Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
Al Stone 51ac8f
-                Subtable->Length, AcpiDmTableInfoDbg2Size);
Al Stone 840f97
+                SubLength, AcpiDmTableInfoDbg2Size);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -470,12 +483,13 @@ AcpiDmDumpDbg2 (
Al Stone 840f97
         /* Dump the Namestring (required) */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        ArrayOffset = Subtable->NamepathOffset;
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->NamepathOffset);
Al Stone 840f97
+        ArrayOffset = Tmp16;
Al Stone 840f97
         AbsoluteOffset = Offset + ArrayOffset;
Al Stone 51ac8f
         Array = (UINT8 *) Subtable + ArrayOffset;
Al Stone 840f97
 
Al Stone 840f97
         Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoDbg2Name);
Al Stone 840f97
+            SubLength, AcpiDmTableInfoDbg2Name);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -485,9 +499,10 @@ AcpiDmDumpDbg2 (
Al Stone 840f97
 
Al Stone 51ac8f
         if (Subtable->OemDataOffset)
Al Stone 840f97
         {
Al Stone 51ac8f
-            Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset,
Al Stone 51ac8f
-                Table, Subtable->OemDataLength,
Al Stone 840f97
-                AcpiDmTableInfoDbg2OemData);
Al Stone 51ac8f
+	    ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->OemDataOffset);
Al Stone 51ac8f
+	    ACPI_MOVE_16_TO_16(&AlsoTmp16, &Subtable->OemDataLength);
Al Stone 840f97
+            Status = AcpiDmDumpTable (Length, Offset + Tmp16,
Al Stone 840f97
+                Table, AlsoTmp16, AcpiDmTableInfoDbg2OemData);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -496,9 +511,9 @@ AcpiDmDumpDbg2 (
Al Stone 840f97
 
Al Stone 840f97
         /* Point to next subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-        Offset += Subtable->Length;
Al Stone 840f97
+        Offset += SubLength;
Al Stone 51ac8f
         Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
Al Stone 51ac8f
-            Subtable->Length);
Al Stone 840f97
+            SubLength);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -522,17 +537,20 @@ AcpiDmDumpDmar (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_DMAR_HEADER        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
+    UINT16                  SubLength;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_DMAR);
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
     ACPI_DMAR_DEVICE_SCOPE  *ScopeTable;
Al Stone 840f97
     UINT32                  ScopeOffset;
Al Stone 840f97
     UINT8                   *PciPath;
Al Stone 840f97
     UINT32                  PathOffset;
Al Stone 840f97
+    UINT16		    SubType;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -542,13 +560,14 @@ AcpiDmDumpDmar (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoDmarHdr);
Al Stone 840f97
+            SubLength, AcpiDmTableInfoDmarHdr);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -556,7 +575,8 @@ AcpiDmDumpDmar (
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 840f97
 
Al Stone 51ac8f
-        switch (Subtable->Type)
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
Al Stone 840f97
+        switch (SubType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
Al Stone 840f97
 
Al Stone 49c3e9
@@ -591,12 +611,12 @@ AcpiDmDumpDmar (
Al Stone 840f97
         default:
Al Stone 840f97
 
Al Stone 840f97
             AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
Al Stone 51ac8f
-                Subtable->Type);
Al Stone 840f97
+                SubType);
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, InfoTable);
Al Stone 840f97
+            SubLength, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -605,8 +625,8 @@ AcpiDmDumpDmar (
Al Stone 840f97
         /*
Al Stone 840f97
          * Dump the optional device scope entries
Al Stone 840f97
          */
Al Stone 51ac8f
-        if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
Al Stone 51ac8f
-            (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
Al Stone 840f97
+        if ((SubType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
Al Stone 840f97
+            (SubType == ACPI_DMAR_TYPE_NAMESPACE))
Al Stone 840f97
         {
Al Stone 840f97
             /* These types do not support device scopes */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -614,7 +634,7 @@ AcpiDmDumpDmar (
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
         ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
Al Stone 51ac8f
-        while (ScopeOffset < Subtable->Length)
Al Stone 840f97
+        while (ScopeOffset < SubLength)
Al Stone 840f97
         {
Al Stone 840f97
             AcpiOsPrintf ("\n");
Al Stone 840f97
             Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
Al Stone 49c3e9
@@ -655,9 +675,8 @@ AcpiDmDumpDmar (
Al Stone 840f97
 NextSubtable:
Al Stone 840f97
         /* Point to next subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-        Offset += Subtable->Length;
Al Stone 51ac8f
-        Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
Al Stone 51ac8f
-            Subtable->Length);
Al Stone 840f97
+        Offset += SubLength;
Al Stone 51ac8f
+        Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable, SubLength);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -684,12 +703,15 @@ AcpiDmDumpDrtm (
Al Stone 840f97
     ACPI_DRTM_RESOURCE_LIST *DrtmRl;
Al Stone 840f97
     ACPI_DRTM_DPS_ID        *DrtmDps;
Al Stone 840f97
     UINT32                  Count;
Al Stone 840f97
+    UINT32                  ValidatedCount;
Al Stone 840f97
+    UINT32                  ResourceCount;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
Al Stone 840f97
-        AcpiDmTableInfoDrtm);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDrtm);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -703,7 +725,7 @@ AcpiDmDumpDrtm (
Al Stone 840f97
 
Al Stone 840f97
     DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
Al Stone 840f97
     AcpiOsPrintf ("\n");
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, Offset,
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, Offset,
Al Stone 840f97
         DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
Al Stone 840f97
         AcpiDmTableInfoDrtm0);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -716,10 +738,11 @@ AcpiDmDumpDrtm (
Al Stone 840f97
     /* Dump Validated table addresses */
Al Stone 840f97
 
Al Stone 840f97
     Count = 0;
Al Stone 840f97
-    while ((Offset < Table->Length) &&
Al Stone 840f97
-            (DrtmVtl->ValidatedTableCount > Count))
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&ValidatedCount, &DrtmVtl->ValidatedTableCount);
Al Stone 840f97
+    while ((Offset < Length) &&
Al Stone 840f97
+            (ValidatedCount > Count))
Al Stone 840f97
     {
Al Stone 840f97
-        Status = AcpiDmDumpTable (Table->Length, Offset,
Al Stone 840f97
+        Status = AcpiDmDumpTable (Length, Offset,
Al Stone 840f97
             ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
Al Stone 840f97
             AcpiDmTableInfoDrtm0a);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -735,7 +758,7 @@ AcpiDmDumpDrtm (
Al Stone 840f97
 
Al Stone 840f97
     DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
Al Stone 840f97
     AcpiOsPrintf ("\n");
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, Offset,
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, Offset,
Al Stone 840f97
         DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
Al Stone 840f97
         AcpiDmTableInfoDrtm1);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -748,10 +771,11 @@ AcpiDmDumpDrtm (
Al Stone 840f97
     /* Dump the Resource List */
Al Stone 840f97
 
Al Stone 840f97
     Count = 0;
Al Stone 840f97
-    while ((Offset < Table->Length) &&
Al Stone 840f97
-           (DrtmRl->ResourceCount > Count))
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&ResourceCount, &DrtmRl->ResourceCount);
Al Stone 840f97
+    while ((Offset < Length) &&
Al Stone 840f97
+           (ResourceCount > Count))
Al Stone 840f97
     {
Al Stone 840f97
-        Status = AcpiDmDumpTable (Table->Length, Offset,
Al Stone 840f97
+        Status = AcpiDmDumpTable (Length, Offset,
Al Stone 840f97
             ACPI_ADD_PTR (void, Table, Offset),
Al Stone 840f97
             sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -767,7 +791,7 @@ AcpiDmDumpDrtm (
Al Stone 840f97
 
Al Stone 840f97
     DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
Al Stone 840f97
     AcpiOsPrintf ("\n");
Al Stone 840f97
-    (void) AcpiDmDumpTable (Table->Length, Offset,
Al Stone 840f97
+    (void) AcpiDmDumpTable (Length, Offset,
Al Stone 840f97
         DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -791,12 +815,13 @@ AcpiDmDumpEinj (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_WHEA_HEADER        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_EINJ);
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -806,7 +831,7 @@ AcpiDmDumpEinj (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 49c3e9
@@ -844,12 +869,13 @@ AcpiDmDumpErst (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_WHEA_HEADER        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_ERST);
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -859,7 +885,7 @@ AcpiDmDumpErst (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 49c3e9
@@ -897,17 +923,19 @@ AcpiDmDumpFpdt (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_FPDT_HEADER        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_FPDT);
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
+    UINT16		    Type;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* There is no main table (other than the standard ACPI header) */
Al Stone 840f97
 
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -919,7 +947,8 @@ AcpiDmDumpFpdt (
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
-        switch (Subtable->Type)
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&Type, &Subtable->Type);
Al Stone 840f97
+        switch (Type)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_FPDT_TYPE_BOOT:
Al Stone 840f97
 
Al Stone 49c3e9
@@ -933,8 +962,7 @@ AcpiDmDumpFpdt (
Al Stone 840f97
 
Al Stone 840f97
         default:
Al Stone 840f97
 
Al Stone 840f97
-            AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
Al Stone 51ac8f
-                Subtable->Type);
Al Stone 840f97
+            AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", Type);
Al Stone 840f97
 
Al Stone 840f97
             /* Attempt to continue */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -982,16 +1010,19 @@ AcpiDmDumpGtdt (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_GTDT_HEADER        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
+    UINT16                  SubLength;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_GTDT);
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 51ac8f
     UINT32                  SubtableLength;
Al Stone 840f97
     UINT32                  GtCount;
Al Stone 840f97
+    UINT32                  Tmp32;
Al Stone 840f97
     ACPI_GTDT_TIMER_ENTRY   *GtxTable;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -1001,7 +1032,7 @@ AcpiDmDumpGtdt (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -1019,8 +1050,9 @@ AcpiDmDumpGtdt (
Al Stone 840f97
         case ACPI_GTDT_TYPE_TIMER_BLOCK:
Al Stone 840f97
 
Al Stone 51ac8f
             SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
Al Stone 840f97
-            GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
Al Stone 840f97
+            Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
Al Stone 51ac8f
                 Subtable))->TimerCount;
Al Stone 840f97
+	    ACPI_MOVE_32_TO_32(&GtCount, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
             InfoTable = AcpiDmTableInfoGtdt0;
Al Stone 840f97
             break;
Al Stone 49c3e9
@@ -1041,8 +1073,9 @@ AcpiDmDumpGtdt (
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, InfoTable);
Al Stone 840f97
+            SubLength, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -1101,16 +1134,18 @@ AcpiDmDumpHest (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_HEST_HEADER        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_HEST);
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 51ac8f
     UINT32                  SubtableLength;
Al Stone 840f97
     UINT32                  BankCount;
Al Stone 840f97
     ACPI_HEST_IA_ERROR_BANK *BankTable;
Al Stone 840f97
+    UINT16		    SubType;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -1120,10 +1155,11 @@ AcpiDmDumpHest (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         BankCount = 0;
Al Stone 51ac8f
-        switch (Subtable->Type)
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
Al Stone 840f97
+        switch (SubType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_HEST_TYPE_IA32_CHECK:
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/dmtbdump2.c
Al Stone 49c3e9
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/dmtbdump2.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/dmtbdump2.c
Al Stone 49c3e9
@@ -75,15 +75,21 @@ AcpiDmDumpIort (
Al Stone 840f97
     ACPI_IORT_SMMU          *IortSmmu = NULL;
Al Stone 840f97
     UINT32                  Offset;
Al Stone 840f97
     UINT32                  NodeOffset;
Al Stone 840f97
+    UINT16		    NodeLength;
Al Stone 840f97
     UINT32                  Length;
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
     char                    *String;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
-
Al Stone 840f97
+    UINT32		    TableLen;
Al Stone 840f97
+    UINT32		    ItsCount;
Al Stone 840f97
+    UINT32		    MappingCount;
Al Stone 840f97
+    UINT32		    CtxIntCount;
Al Stone 840f97
+    UINT32		    PmuIntCount;
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (TableLen, 0, Table, 0, AcpiDmTableInfoIort);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -94,18 +100,19 @@ AcpiDmDumpIort (
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the OptionalPadding (optional) */
Al Stone 840f97
 
Al Stone 840f97
-    if (Iort->NodeOffset > Offset)
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&NodeOffset, &Iort->NodeOffset);
Al Stone 840f97
+    if (NodeOffset > Offset)
Al Stone 840f97
     {
Al Stone 840f97
-        Status = AcpiDmDumpTable (Table->Length, Offset, Table,
Al Stone 840f97
-            Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
Al Stone 840f97
+        Status = AcpiDmDumpTable (TableLen, Offset, Table,
Al Stone 840f97
+            NodeOffset - Offset, AcpiDmTableInfoIortPad);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    Offset = Iort->NodeOffset;
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Offset, &Iort->NodeOffset);
Al Stone 840f97
+    while (Offset < TableLen)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -141,7 +148,8 @@ AcpiDmDumpIort (
Al Stone 840f97
         case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
Al Stone 840f97
 
Al Stone 840f97
             InfoTable = AcpiDmTableInfoIort2;
Al Stone 840f97
-            Length = IortNode->Length - NodeOffset;
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
Al Stone 840f97
+            Length = NodeLength - NodeOffset;
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case ACPI_IORT_NODE_SMMU:
Al Stone 49c3e9
@@ -154,7 +162,8 @@ AcpiDmDumpIort (
Al Stone 840f97
         case ACPI_IORT_NODE_SMMU_V3:
Al Stone 840f97
 
Al Stone 840f97
             InfoTable = AcpiDmTableInfoIort4;
Al Stone 840f97
-            Length = IortNode->Length - NodeOffset;
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
Al Stone 840f97
+            Length = NodeLength - NodeOffset;
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         default:
Al Stone 49c3e9
@@ -164,7 +173,8 @@ AcpiDmDumpIort (
Al Stone 840f97
 
Al Stone 840f97
             /* Attempt to continue */
Al Stone 840f97
 
Al Stone 840f97
-            if (!IortNode->Length)
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
Al Stone 840f97
+            if (!NodeLength)
Al Stone 840f97
             {
Al Stone 840f97
                 AcpiOsPrintf ("Invalid zero length IORT node\n");
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -175,7 +185,7 @@ AcpiDmDumpIort (
Al Stone 840f97
         /* Dump the node subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 840f97
-        Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
Al Stone 840f97
+        Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
Al Stone 840f97
             ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Al Stone 840f97
             Length, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -195,9 +205,10 @@ AcpiDmDumpIort (
Al Stone 840f97
 
Al Stone 840f97
             if (IortItsGroup)
Al Stone 840f97
             {
Al Stone 840f97
-                for (i = 0; i < IortItsGroup->ItsCount; i++)
Al Stone 840f97
+	        ACPI_MOVE_32_TO_32(&ItsCount, &IortItsGroup->ItsCount);
Al Stone 840f97
+                for (i = 0; i < ItsCount; i++)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
Al Stone 840f97
+                    Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
Al Stone 840f97
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Al Stone 840f97
                         4, AcpiDmTableInfoIort0a);
Al Stone 840f97
                     NodeOffset += 4;
Al Stone 49c3e9
@@ -209,11 +220,11 @@ AcpiDmDumpIort (
Al Stone 840f97
 
Al Stone 840f97
             /* Dump the Padding (optional) */
Al Stone 840f97
 
Al Stone 840f97
-            if (IortNode->Length > NodeOffset)
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
Al Stone 840f97
+            if (NodeLength > NodeOffset)
Al Stone 840f97
             {
Al Stone 840f97
-                Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
Al Stone 840f97
-                    Table, IortNode->Length - NodeOffset,
Al Stone 840f97
-                    AcpiDmTableInfoIort1a);
Al Stone 840f97
+                Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
Al Stone 840f97
+                    Table, NodeLength - NodeOffset, AcpiDmTableInfoIort1a);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 840f97
                 {
Al Stone 840f97
                     return;
Al Stone 49c3e9
@@ -230,8 +241,8 @@ AcpiDmDumpIort (
Al Stone 840f97
             if (IortSmmu)
Al Stone 840f97
             {
Al Stone 840f97
                 Length = 2 * sizeof (UINT64);
Al Stone 840f97
-                NodeOffset = IortSmmu->GlobalInterruptOffset;
Al Stone 840f97
-                Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
Al Stone 840f97
+                ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->GlobalInterruptOffset);
Al Stone 840f97
+                Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
Al Stone 840f97
                     ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Al Stone 840f97
                     Length, AcpiDmTableInfoIort3a);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -239,10 +250,11 @@ AcpiDmDumpIort (
Al Stone 840f97
                     return;
Al Stone 840f97
                 }
Al Stone 840f97
 
Al Stone 840f97
-                NodeOffset = IortSmmu->ContextInterruptOffset;
Al Stone 840f97
-                for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
Al Stone 840f97
+                ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->ContextInterruptOffset);
Al Stone 840f97
+                ACPI_MOVE_32_TO_32(&CtxIntCount, &IortSmmu->ContextInterruptCount);
Al Stone 840f97
+                for (i = 0; i < CtxIntCount; i++)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
Al Stone 840f97
+                    Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
Al Stone 840f97
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Al Stone 840f97
                         8, AcpiDmTableInfoIort3b);
Al Stone 840f97
                     if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -253,10 +265,11 @@ AcpiDmDumpIort (
Al Stone 840f97
                     NodeOffset += 8;
Al Stone 840f97
                 }
Al Stone 840f97
 
Al Stone 840f97
-                NodeOffset = IortSmmu->PmuInterruptOffset;
Al Stone 840f97
-                for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
Al Stone 840f97
+                ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->PmuInterruptOffset);
Al Stone 840f97
+                ACPI_MOVE_32_TO_32(&PmuIntCount, &IortSmmu->PmuInterruptCount);
Al Stone 840f97
+                for (i = 0; i < PmuIntCount; i++)
Al Stone 840f97
                 {
Al Stone 840f97
-                    Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
Al Stone 840f97
+                    Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
Al Stone 840f97
                         ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Al Stone 840f97
                         8, AcpiDmTableInfoIort3c);
Al Stone 840f97
                     if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -276,12 +289,13 @@ AcpiDmDumpIort (
Al Stone 840f97
 
Al Stone 840f97
         /* Dump the ID mappings */
Al Stone 840f97
 
Al Stone 840f97
-        NodeOffset = IortNode->MappingOffset;
Al Stone 840f97
-        for (i = 0; i < IortNode->MappingCount; i++)
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&NodeOffset, &IortNode->MappingOffset);
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&MappingCount, &IortNode->MappingCount);
Al Stone 840f97
+        for (i = 0; i < MappingCount; i++)
Al Stone 840f97
         {
Al Stone 840f97
             AcpiOsPrintf ("\n");
Al Stone 840f97
             Length = sizeof (ACPI_IORT_ID_MAPPING);
Al Stone 840f97
-            Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
Al Stone 840f97
+            Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
Al Stone 840f97
                 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
Al Stone 840f97
                 Length, AcpiDmTableInfoIortMap);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -295,8 +309,9 @@ AcpiDmDumpIort (
Al Stone 51ac8f
 NextSubtable:
Al Stone 840f97
         /* Point to next node subtable */
Al Stone 840f97
 
Al Stone 840f97
-        Offset += IortNode->Length;
Al Stone 840f97
-        IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length);
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
Al Stone 840f97
+        Offset += NodeLength;
Al Stone 840f97
+        IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeLength);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -327,11 +342,14 @@ AcpiDmDumpIvrs (
Al Stone 840f97
     ACPI_IVRS_DE_HEADER     *DeviceEntry;
Al Stone 51ac8f
     ACPI_IVRS_HEADER        *Subtable;
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
+    UINT16		    SubLength;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoIvrs);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -340,13 +358,14 @@ AcpiDmDumpIvrs (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoIvrsHdr);
Al Stone 51ac8f
+        ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
+            SubLength, AcpiDmTableInfoIvrsHdr);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -373,7 +392,7 @@ AcpiDmDumpIvrs (
Al Stone 840f97
 
Al Stone 840f97
             /* Attempt to continue */
Al Stone 840f97
 
Al Stone 51ac8f
-            if (!Subtable->Length)
Al Stone 840f97
+            if (!SubLength)
Al Stone 840f97
             {
Al Stone 840f97
                 AcpiOsPrintf ("Invalid zero length subtable\n");
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -384,8 +403,8 @@ AcpiDmDumpIvrs (
Al Stone 840f97
         /* Dump the subtable */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, InfoTable);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
+            SubLength, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -399,7 +418,7 @@ AcpiDmDumpIvrs (
Al Stone 51ac8f
             DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable,
Al Stone 840f97
                 sizeof (ACPI_IVRS_HARDWARE));
Al Stone 840f97
 
Al Stone 51ac8f
-            while (EntryOffset < (Offset + Subtable->Length))
Al Stone 840f97
+            while (EntryOffset < (Offset + SubLength))
Al Stone 840f97
             {
Al Stone 840f97
                 AcpiOsPrintf ("\n");
Al Stone 840f97
                 /*
Al Stone 49c3e9
@@ -461,7 +480,7 @@ AcpiDmDumpIvrs (
Al Stone 840f97
 
Al Stone 840f97
                 /* Dump the Device Entry */
Al Stone 840f97
 
Al Stone 840f97
-                Status = AcpiDmDumpTable (Table->Length, EntryOffset,
Al Stone 840f97
+                Status = AcpiDmDumpTable (Length, EntryOffset,
Al Stone 840f97
                     DeviceEntry, EntryLength, InfoTable);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 840f97
                 {
Al Stone 49c3e9
@@ -477,8 +496,8 @@ AcpiDmDumpIvrs (
Al Stone 51ac8f
 NextSubtable:
Al Stone 840f97
         /* Point to next subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-        Offset += Subtable->Length;
Al Stone 51ac8f
-        Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
Al Stone 840f97
+        Offset += SubLength;
Al Stone 51ac8f
+        Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, SubLength);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -504,7 +523,7 @@ AcpiDmDumpLpit (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_LPIT_HEADER        *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_LPIT);
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 51ac8f
     UINT32                  SubtableLength;
Al Stone 49c3e9
@@ -512,8 +531,9 @@ AcpiDmDumpLpit (
Al Stone 840f97
 
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -577,13 +597,14 @@ AcpiDmDumpMadt (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_SUBTABLE_HEADER    *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_MADT);
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -593,7 +614,7 @@ AcpiDmDumpMadt (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -739,11 +760,13 @@ AcpiDmDumpMcfg (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_MCFG);
Al Stone 51ac8f
     ACPI_MCFG_ALLOCATION    *Subtable;
Al Stone 840f97
+    UINT32		    Len;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Len, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Len, 0, Table, 0, AcpiDmTableInfoMcfg);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -752,17 +775,17 @@ AcpiDmDumpMcfg (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Len)
Al Stone 840f97
     {
Al Stone 840f97
-        if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
Al Stone 840f97
+        if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Len)
Al Stone 840f97
         {
Al Stone 840f97
             AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
Al Stone 840f97
-                sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
Al Stone 840f97
+                sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Len));
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Len, Offset, Subtable,
Al Stone 840f97
             sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -796,6 +819,7 @@ AcpiDmDumpMpst (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_MPST);
Al Stone 840f97
+    ACPI_TABLE_MPST	    *Mpst;
Al Stone 51ac8f
     ACPI_MPST_POWER_NODE    *Subtable0;
Al Stone 51ac8f
     ACPI_MPST_POWER_STATE   *Subtable0A;
Al Stone 51ac8f
     ACPI_MPST_COMPONENT     *Subtable0B;
Al Stone 49c3e9
@@ -804,11 +828,13 @@ AcpiDmDumpMpst (
Al Stone 840f97
     UINT16                  SubtableCount;
Al Stone 840f97
     UINT32                  PowerStateCount;
Al Stone 840f97
     UINT32                  ComponentCount;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMpst);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -816,13 +842,14 @@ AcpiDmDumpMpst (
Al Stone 840f97
 
Al Stone 840f97
     /* Subtable: Memory Power Node(s) */
Al Stone 840f97
 
Al Stone 840f97
-    SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
Al Stone 840f97
+    Mpst = ACPI_CAST_PTR (ACPI_TABLE_MPST, Table);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&SubtableCount, &Mpst->PowerNodeCount);
Al Stone 51ac8f
     Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
Al Stone 840f97
 
Al Stone 840f97
-    while ((Offset < Table->Length) && SubtableCount)
Al Stone 840f97
+    while ((Offset < Length) && SubtableCount)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable0,
Al Stone 840f97
             sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -831,8 +858,8 @@ AcpiDmDumpMpst (
Al Stone 840f97
 
Al Stone 840f97
         /* Extract the sub-subtable counts */
Al Stone 840f97
 
Al Stone 51ac8f
-        PowerStateCount = Subtable0->NumPowerStates;
Al Stone 51ac8f
-        ComponentCount = Subtable0->NumPhysicalComponents;
Al Stone 51ac8f
+        ACPI_MOVE_32_TO_32(&PowerStateCount, &Subtable0->NumPowerStates);
Al Stone 51ac8f
+        ACPI_MOVE_32_TO_32(&ComponentCount, &Subtable0->NumPhysicalComponents);
Al Stone 840f97
         Offset += sizeof (ACPI_MPST_POWER_NODE);
Al Stone 840f97
 
Al Stone 840f97
         /* Sub-subtables - Memory Power State Structure(s) */
Al Stone 49c3e9
@@ -843,7 +870,7 @@ AcpiDmDumpMpst (
Al Stone 840f97
         while (PowerStateCount)
Al Stone 840f97
         {
Al Stone 840f97
             AcpiOsPrintf ("\n");
Al Stone 51ac8f
-            Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
Al Stone 51ac8f
+            Status = AcpiDmDumpTable (Length, Offset, Subtable0A,
Al Stone 840f97
                 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 49c3e9
@@ -853,7 +880,7 @@ AcpiDmDumpMpst (
Al Stone 51ac8f
             Subtable0A++;
Al Stone 840f97
             PowerStateCount--;
Al Stone 840f97
             Offset += sizeof (ACPI_MPST_POWER_STATE);
Al Stone 840f97
-       }
Al Stone 840f97
+        }
Al Stone 840f97
 
Al Stone 840f97
         /* Sub-subtables - Physical Component ID Structure(s) */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -866,7 +893,7 @@ AcpiDmDumpMpst (
Al Stone 840f97
 
Al Stone 840f97
         while (ComponentCount)
Al Stone 840f97
         {
Al Stone 51ac8f
-            Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
Al Stone 51ac8f
+            Status = AcpiDmDumpTable (Length, Offset, Subtable0B,
Al Stone 840f97
                 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 49c3e9
@@ -881,17 +908,19 @@ AcpiDmDumpMpst (
Al Stone 840f97
         /* Point to next Memory Power Node subtable */
Al Stone 840f97
 
Al Stone 840f97
         SubtableCount--;
Al Stone 51ac8f
+        ACPI_MOVE_32_TO_32(&PowerStateCount, &Subtable0->NumPowerStates);
Al Stone 51ac8f
+        ACPI_MOVE_32_TO_32(&ComponentCount, &Subtable0->NumPhysicalComponents);
Al Stone 51ac8f
         Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
Al Stone 840f97
             sizeof (ACPI_MPST_POWER_NODE) +
Al Stone 51ac8f
-            (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
Al Stone 51ac8f
-            (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
Al Stone 840f97
+            (sizeof (ACPI_MPST_POWER_STATE) * PowerStateCount) +
Al Stone 840f97
+            (sizeof (ACPI_MPST_COMPONENT) * ComponentCount));
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     /* Subtable: Count of Memory Power State Characteristic structures */
Al Stone 840f97
 
Al Stone 840f97
     AcpiOsPrintf ("\n");
Al Stone 51ac8f
     Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
Al Stone 51ac8f
-    Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
Al Stone 51ac8f
+    Status = AcpiDmDumpTable (Length, Offset, Subtable1,
Al Stone 840f97
         sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -906,10 +935,10 @@ AcpiDmDumpMpst (
Al Stone 51ac8f
     Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
Al Stone 840f97
         sizeof (ACPI_MPST_DATA_HDR));
Al Stone 840f97
 
Al Stone 840f97
-    while ((Offset < Table->Length) && SubtableCount)
Al Stone 840f97
+    while ((Offset < Length) && SubtableCount)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable2,
Al Stone 840f97
             sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -942,11 +971,13 @@ AcpiDmDumpMsct (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_MSCT);
Al Stone 51ac8f
     ACPI_MSCT_PROXIMITY     *Subtable;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMsct);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -955,12 +986,12 @@ AcpiDmDumpMsct (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
             sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -995,11 +1026,13 @@ AcpiDmDumpMtmr (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_MTMR);
Al Stone 51ac8f
     ACPI_MTMR_ENTRY         *Subtable;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMtmr);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -1008,12 +1041,12 @@ AcpiDmDumpMtmr (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
             sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -1055,11 +1088,17 @@ AcpiDmDumpNfit (
Al Stone 840f97
     ACPI_NFIT_SMBIOS        *SmbiosInfo = NULL;
Al Stone 840f97
     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
+    UINT32                  TableLength;
Al Stone 840f97
+    UINT16                  SubLength;
Al Stone 840f97
+    UINT16                  SubType;
Al Stone 840f97
+    UINT32                  Count;
Al Stone 840f97
+    UINT16                  Count16;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&TableLength, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNfit);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -1068,19 +1107,21 @@ AcpiDmDumpNfit (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < TableLength)
Al Stone 840f97
     {
Al Stone 840f97
         /* NFIT subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoNfitHdr);
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Al Stone 840f97
+            SubLength, AcpiDmTableInfoNfitHdr);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
-        switch (Subtable->Type)
Al Stone 51ac8f
+	ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
Al Stone 840f97
+        switch (SubType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
Al Stone 840f97
 
Al Stone 49c3e9
@@ -1137,7 +1178,7 @@ AcpiDmDumpNfit (
Al Stone 840f97
 
Al Stone 840f97
             /* Attempt to continue */
Al Stone 840f97
 
Al Stone 51ac8f
-            if (!Subtable->Length)
Al Stone 840f97
+            if (!SubLength)
Al Stone 840f97
             {
Al Stone 840f97
                 AcpiOsPrintf ("Invalid zero length subtable\n");
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -1146,8 +1187,8 @@ AcpiDmDumpNfit (
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, InfoTable);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
Al Stone 840f97
+            SubLength, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -1155,13 +1196,14 @@ AcpiDmDumpNfit (
Al Stone 840f97
 
Al Stone 840f97
         /* Per-subtable variable-length fields */
Al Stone 840f97
 
Al Stone 51ac8f
-        switch (Subtable->Type)
Al Stone 840f97
+        switch (SubType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_NFIT_TYPE_INTERLEAVE:
Al Stone 840f97
 
Al Stone 840f97
-            for (i = 0; i < Interleave->LineCount; i++)
Al Stone 840f97
+	    ACPI_MOVE_32_TO_32(&Count, &Interleave->LineCount);
Al Stone 840f97
+            for (i = 0; i < Count; i++)
Al Stone 840f97
             {
Al Stone 840f97
-                Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
Al Stone 840f97
+                Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
Al Stone 840f97
                     &Interleave->LineOffset[i],
Al Stone 840f97
                     sizeof (UINT32), AcpiDmTableInfoNfit2a);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -1175,12 +1217,11 @@ AcpiDmDumpNfit (
Al Stone 840f97
 
Al Stone 840f97
         case ACPI_NFIT_TYPE_SMBIOS:
Al Stone 840f97
 
Al Stone 51ac8f
-            Length = Subtable->Length -
Al Stone 840f97
-                sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
Al Stone 840f97
+            Length = SubLength - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
Al Stone 840f97
 
Al Stone 840f97
             if (Length)
Al Stone 840f97
             {
Al Stone 840f97
-                Status = AcpiDmDumpTable (Table->Length,
Al Stone 840f97
+                Status = AcpiDmDumpTable (TableLength,
Al Stone 840f97
                     sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
Al Stone 840f97
                     SmbiosInfo,
Al Stone 840f97
                     Length, AcpiDmTableInfoNfit3a);
Al Stone 49c3e9
@@ -1194,9 +1235,10 @@ AcpiDmDumpNfit (
Al Stone 840f97
 
Al Stone 840f97
         case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
Al Stone 840f97
 
Al Stone 840f97
-            for (i = 0; i < Hint->HintCount; i++)
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&Count16, &Hint->HintCount);
Al Stone 840f97
+            for (i = 0; i < Count16; i++)
Al Stone 840f97
             {
Al Stone 840f97
-                Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
Al Stone 840f97
+                Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
Al Stone 840f97
                     &Hint->HintAddress[i],
Al Stone 840f97
                     sizeof (UINT64), AcpiDmTableInfoNfit6a);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 49c3e9
@@ -1215,8 +1257,8 @@ AcpiDmDumpNfit (
Al Stone 51ac8f
 NextSubtable:
Al Stone 840f97
         /* Point to next subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-        Offset += Subtable->Length;
Al Stone 51ac8f
-        Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
Al Stone 840f97
+        Offset += SubLength;
Al Stone 51ac8f
+        Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, SubLength);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -1241,12 +1283,13 @@ AcpiDmDumpPcct (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_PCCT_SUBSPACE      *Subtable;
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_PCCT);
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -1256,7 +1299,7 @@ AcpiDmDumpPcct (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -1396,16 +1439,21 @@ AcpiDmDumpPmtt (
Al Stone 51ac8f
     ACPI_PMTT_HEADER        *MemSubtable;
Al Stone 51ac8f
     ACPI_PMTT_HEADER        *DimmSubtable;
Al Stone 840f97
     ACPI_PMTT_DOMAIN        *DomainArray;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_PMTT);
Al Stone 840f97
     UINT32                  MemOffset;
Al Stone 840f97
     UINT32                  DimmOffset;
Al Stone 840f97
     UINT32                  DomainOffset;
Al Stone 840f97
-    UINT32                  DomainCount;
Al Stone 840f97
+    UINT16                  DomainCount;
Al Stone 840f97
+    UINT16		    SubLength;
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
+    UINT16		    MemLength;
Al Stone 840f97
+    UINT16		    DimmLength;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -1415,13 +1463,14 @@ AcpiDmDumpPmtt (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
+        ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoPmttHdr);
Al Stone 840f97
+            SubLength, AcpiDmTableInfoPmttHdr);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -1440,7 +1489,7 @@ AcpiDmDumpPmtt (
Al Stone 840f97
         /* Dump the fixed-length portion of the subtable */
Al Stone 840f97
 
Al Stone 51ac8f
         Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
-            Subtable->Length, AcpiDmTableInfoPmtt0);
Al Stone 840f97
+            SubLength, AcpiDmTableInfoPmtt0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return;
Al Stone 49c3e9
@@ -1452,15 +1501,16 @@ AcpiDmDumpPmtt (
Al Stone 51ac8f
         MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
Al Stone 840f97
             sizeof (ACPI_PMTT_SOCKET));
Al Stone 840f97
 
Al Stone 840f97
-        while (((Offset + MemOffset) < Table->Length) &&
Al Stone 51ac8f
-            (MemOffset < Subtable->Length))
Al Stone 840f97
+        while (((Offset + MemOffset) < Length) &&
Al Stone 840f97
+            (MemOffset < SubLength))
Al Stone 840f97
         {
Al Stone 840f97
             /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
             AcpiOsPrintf ("\n");
Al Stone 51ac8f
+	    ACPI_MOVE_16_TO_16(&MemLength, &MemSubtable->Length);
Al Stone 840f97
             Status = AcpiDmDumpTable (Length,
Al Stone 51ac8f
                 Offset + MemOffset, MemSubtable,
Al Stone 51ac8f
-                MemSubtable->Length, AcpiDmTableInfoPmttHdr);
Al Stone 840f97
+                MemLength, AcpiDmTableInfoPmttHdr);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -1480,7 +1530,7 @@ AcpiDmDumpPmtt (
Al Stone 840f97
 
Al Stone 840f97
             Status = AcpiDmDumpTable (Length,
Al Stone 51ac8f
                 Offset + MemOffset, MemSubtable,
Al Stone 51ac8f
-                MemSubtable->Length, AcpiDmTableInfoPmtt1);
Al Stone 840f97
+                MemLength, AcpiDmTableInfoPmtt1);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 840f97
                 return;
Al Stone 49c3e9
@@ -1488,13 +1538,14 @@ AcpiDmDumpPmtt (
Al Stone 840f97
 
Al Stone 840f97
             /* Walk the variable count of proximity domains */
Al Stone 840f97
 
Al Stone 51ac8f
-            DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
Al Stone 51ac8f
+	    Tmp16 = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
Al Stone 840f97
+            ACPI_MOVE_16_TO_16(&DomainCount, &Tmp16);
Al Stone 840f97
             DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
Al Stone 51ac8f
             DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
Al Stone 840f97
                 sizeof (ACPI_PMTT_CONTROLLER));
Al Stone 840f97
 
Al Stone 840f97
-            while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
Al Stone 51ac8f
-                ((MemOffset + DomainOffset) < Subtable->Length) &&
Al Stone 840f97
+            while (((Offset + MemOffset + DomainOffset) < Length) &&
Al Stone 840f97
+                ((MemOffset + DomainOffset) < SubLength) &&
Al Stone 840f97
                 DomainCount)
Al Stone 840f97
             {
Al Stone 840f97
                 Status = AcpiDmDumpTable (Length,
Al Stone 49c3e9
@@ -1522,15 +1573,16 @@ AcpiDmDumpPmtt (
Al Stone 51ac8f
             DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
Al Stone 840f97
                 DomainOffset);
Al Stone 840f97
 
Al Stone 840f97
-            while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
Al Stone 51ac8f
-                (DimmOffset < MemSubtable->Length))
Al Stone 840f97
+            while (((Offset + MemOffset + DimmOffset) < Length) &&
Al Stone 840f97
+                (DimmOffset < MemLength))
Al Stone 840f97
             {
Al Stone 840f97
                 /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
                 AcpiOsPrintf ("\n");
Al Stone 51ac8f
+		ACPI_MOVE_16_TO_16(&DimmLength, &DimmSubtable->Length);
Al Stone 840f97
                 Status = AcpiDmDumpTable (Length,
Al Stone 51ac8f
                     Offset + MemOffset + DimmOffset, DimmSubtable,
Al Stone 51ac8f
-                    DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
Al Stone 840f97
+                    DimmLength, AcpiDmTableInfoPmttHdr);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 840f97
                 {
Al Stone 840f97
                     return;
Al Stone 49c3e9
@@ -1550,7 +1602,7 @@ AcpiDmDumpPmtt (
Al Stone 840f97
 
Al Stone 840f97
                 Status = AcpiDmDumpTable (Length,
Al Stone 51ac8f
                     Offset + MemOffset + DimmOffset, DimmSubtable,
Al Stone 51ac8f
-                    DimmSubtable->Length, AcpiDmTableInfoPmtt2);
Al Stone 840f97
+                    DimmLength, AcpiDmTableInfoPmtt2);
Al Stone 840f97
                 if (ACPI_FAILURE (Status))
Al Stone 840f97
                 {
Al Stone 840f97
                     return;
Al Stone 49c3e9
@@ -1558,23 +1610,22 @@ AcpiDmDumpPmtt (
Al Stone 840f97
 
Al Stone 840f97
                 /* Point to next DIMM subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-                DimmOffset += DimmSubtable->Length;
Al Stone 840f97
+                DimmOffset += DimmLength;
Al Stone 51ac8f
                 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
Al Stone 51ac8f
-                    DimmSubtable, DimmSubtable->Length);
Al Stone 51ac8f
+                    DimmSubtable, DimmLength);
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
             /* Point to next Controller subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-            MemOffset += MemSubtable->Length;
Al Stone 840f97
+            MemOffset += MemLength;
Al Stone 51ac8f
             MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
Al Stone 51ac8f
-                MemSubtable, MemSubtable->Length);
Al Stone 51ac8f
+                MemSubtable, MemLength);
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
         /* Point to next Socket subtable */
Al Stone 840f97
 
Al Stone 51ac8f
-        Offset += Subtable->Length;
Al Stone 51ac8f
-        Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
Al Stone 51ac8f
-            Subtable, Subtable->Length);
Al Stone 840f97
+        Offset += SubLength;
Al Stone 51ac8f
+        Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, SubLength);
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
@@ -1730,6 +1781,8 @@ AcpiDmDumpS3pt (
Al Stone 51ac8f
     ACPI_FPDT_HEADER        *Subtable;
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
     ACPI_TABLE_S3PT         *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
+    UINT16                  SubType;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 49c3e9
@@ -1740,20 +1793,22 @@ AcpiDmDumpS3pt (
Al Stone 840f97
         return 0;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &S3ptTable->Length);
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
Al Stone 840f97
-    while (Offset < S3ptTable->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
             Subtable->Length, AcpiDmTableInfoS3ptHdr);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             return 0;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 51ac8f
-        switch (Subtable->Type)
Al Stone 51ac8f
+        ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
Al Stone 840f97
+        switch (SubType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_S3PT_TYPE_RESUME:
Al Stone 840f97
 
Al Stone 49c3e9
@@ -1768,7 +1823,7 @@ AcpiDmDumpS3pt (
Al Stone 840f97
         default:
Al Stone 840f97
 
Al Stone 840f97
             AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
Al Stone 51ac8f
-                Subtable->Type);
Al Stone 840f97
+                SubType);
Al Stone 840f97
 
Al Stone 840f97
             /* Attempt to continue */
Al Stone 840f97
 
Al Stone 49c3e9
@@ -1781,7 +1836,7 @@ AcpiDmDumpS3pt (
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
             Subtable->Length, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/dmtbdump3.c
Al Stone 49c3e9
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/dmtbdump3.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/dmtbdump3.c
Al Stone 49c3e9
@@ -68,9 +68,11 @@ void
Al Stone 840f97
 AcpiDmDumpSlic (
Al Stone 840f97
     ACPI_TABLE_HEADER       *Table)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT32	Length;
Al Stone 840f97
 
Al Stone 840f97
-    (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
Al Stone 840f97
-        Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    (void) AcpiDmDumpTable (Length, sizeof (ACPI_TABLE_HEADER), Table,
Al Stone 840f97
+        Length - sizeof (*Table), AcpiDmTableInfoSlic);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 49c3e9
@@ -93,14 +95,17 @@ AcpiDmDumpSlit (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  Offset;
Al Stone 840f97
     UINT8                   *Row;
Al Stone 840f97
-    UINT32                  Localities;
Al Stone 840f97
+    UINT64                  Localities;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     UINT32                  j;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
+    UINT64                  Tmp64;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSlit);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -108,7 +113,8 @@ AcpiDmDumpSlit (
Al Stone 840f97
 
Al Stone 840f97
     /* Display the Locality NxN Matrix */
Al Stone 840f97
 
Al Stone 840f97
-    Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
Al Stone 840f97
+    Tmp64 = (UINT64) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Localities, &Tmp64);
Al Stone 840f97
     Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
Al Stone 840f97
     Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
Al Stone 840f97
 
Al Stone 49c3e9
@@ -121,7 +127,7 @@ AcpiDmDumpSlit (
Al Stone 840f97
         {
Al Stone 840f97
             /* Check for beyond EOT */
Al Stone 840f97
 
Al Stone 840f97
-            if (Offset >= Table->Length)
Al Stone 840f97
+            if (Offset >= Length)
Al Stone 840f97
             {
Al Stone 840f97
                 AcpiOsPrintf (
Al Stone 840f97
                     "\n**** Not enough room in table for all localities\n");
Al Stone 49c3e9
@@ -173,11 +179,13 @@ AcpiDmDumpSrat (
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_SRAT);
Al Stone 51ac8f
     ACPI_SUBTABLE_HEADER    *Subtable;
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSrat);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -186,12 +194,12 @@ AcpiDmDumpSrat (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
             Subtable->Length, AcpiDmTableInfoSratHdr);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -240,7 +248,7 @@ AcpiDmDumpSrat (
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 51ac8f
             Subtable->Length, InfoTable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -277,13 +285,14 @@ AcpiDmDumpStao (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     char                    *Namepath;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT32                  StringLength;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_STAO);
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -292,7 +301,7 @@ AcpiDmDumpStao (
Al Stone 840f97
 
Al Stone 840f97
     /* The rest of the table consists of Namepath strings */
Al Stone 840f97
 
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         Namepath = ACPI_ADD_PTR (char, Table, Offset);
Al Stone 840f97
         StringLength = strlen (Namepath) + 1;
Al Stone 49c3e9
@@ -334,11 +343,14 @@ AcpiDmDumpTcpa (
Al Stone 51ac8f
     ACPI_TABLE_TCPA_HDR     *Subtable = ACPI_ADD_PTR (
Al Stone 840f97
                                 ACPI_TABLE_TCPA_HDR, Table, Offset);
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
+    UINT16		    PlatformClass;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table,
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table,
Al Stone 840f97
         0, AcpiDmTableInfoTcpaHdr);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -349,18 +361,19 @@ AcpiDmDumpTcpa (
Al Stone 840f97
      * Examine the PlatformClass field to determine the table type.
Al Stone 840f97
      * Either a client or server table. Only one.
Al Stone 840f97
      */
Al Stone 840f97
-    switch (CommonHeader->PlatformClass)
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&PlatformClass, &CommonHeader->PlatformClass);
Al Stone 840f97
+    switch (PlatformClass)
Al Stone 840f97
     {
Al Stone 840f97
     case ACPI_TCPA_CLIENT_TABLE:
Al Stone 840f97
 
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 840f97
-            Table->Length - Offset, AcpiDmTableInfoTcpaClient);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
+            Length - Offset, AcpiDmTableInfoTcpaClient);
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     case ACPI_TCPA_SERVER_TABLE:
Al Stone 840f97
 
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 840f97
-            Table->Length - Offset, AcpiDmTableInfoTcpaServer);
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
+            Length - Offset, AcpiDmTableInfoTcpaServer);
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
     default:
Al Stone 49c3e9
@@ -455,11 +468,13 @@ AcpiDmDumpVrtc (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_VRTC);
Al Stone 51ac8f
     ACPI_VRTC_ENTRY         *Subtable;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoVrtc);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -468,12 +483,12 @@ AcpiDmDumpVrtc (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
             sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -508,11 +523,13 @@ AcpiDmDumpWdat (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  Offset = sizeof (ACPI_TABLE_WDAT);
Al Stone 51ac8f
     ACPI_WDAT_ENTRY         *Subtable;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 840f97
 
Al Stone 840f97
-    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
+    Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWdat);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 49c3e9
@@ -521,12 +538,12 @@ AcpiDmDumpWdat (
Al Stone 840f97
     /* Subtables */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
Al Stone 840f97
-    while (Offset < Table->Length)
Al Stone 840f97
+    while (Offset < Length)
Al Stone 840f97
     {
Al Stone 840f97
         /* Common subtable header */
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 51ac8f
-        Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
Al Stone 51ac8f
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
Al Stone 840f97
             sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 49c3e9
@@ -561,12 +578,13 @@ AcpiDmDumpWpbt (
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 51ac8f
     ACPI_TABLE_WPBT         *Subtable;
Al Stone 840f97
-    UINT32                  Length = Table->Length;
Al Stone 840f97
+    UINT32                  Length;
Al Stone 840f97
     UINT16                  ArgumentsLength;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the main table */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 840f97
     {
Al Stone 49c3e9
@@ -576,10 +594,10 @@ AcpiDmDumpWpbt (
Al Stone 840f97
     /* Extract the arguments buffer length from the main table */
Al Stone 840f97
 
Al Stone 51ac8f
     Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
Al Stone 51ac8f
-    ArgumentsLength = Subtable->ArgumentsLength;
Al Stone 51ac8f
+    ACPI_MOVE_16_TO_16(&ArgumentsLength, &Subtable->ArgumentsLength);
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the arguments buffer */
Al Stone 840f97
 
Al Stone 840f97
-    (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
Al Stone 840f97
+    (void) AcpiDmDumpTable (Length, 0, Table, ArgumentsLength,
Al Stone 840f97
         AcpiDmTableInfoWpbt0);
Al Stone 840f97
 }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/dtfield.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/dtfield.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/dtfield.c
Al Stone 51ac8f
@@ -359,7 +359,27 @@ DtCompileInteger (
Al Stone 840f97
         DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, MsgBuffer);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    memcpy (Buffer, &Value, ByteLength);
Al Stone 840f97
+    switch (ByteLength) {
Al Stone 840f97
+    case 1:
Al Stone 840f97
+	ACPI_MOVE_64_TO_8(Buffer, &Value);
Al Stone 840f97
+	break;
Al Stone 840f97
+
Al Stone 840f97
+    case 2:
Al Stone 840f97
+	ACPI_MOVE_64_TO_16(Buffer, &Value);
Al Stone 840f97
+	break;
Al Stone 840f97
+
Al Stone 840f97
+    case 4:
Al Stone 840f97
+	ACPI_MOVE_64_TO_32(Buffer, &Value);
Al Stone 840f97
+	break;
Al Stone 840f97
+
Al Stone 840f97
+    case 8:
Al Stone 840f97
+	ACPI_MOVE_64_TO_64(Buffer, &Value);
Al Stone 840f97
+	break;
Al Stone 840f97
+
Al Stone 840f97
+    default:
Al Stone 840f97
+	memcpy (Buffer, &Value, ByteLength);
Al Stone 840f97
+	break;
Al Stone 840f97
+    }
Al Stone 840f97
     return;
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/dtsubtable.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/dtsubtable.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/dtsubtable.c
Al Stone 51ac8f
@@ -378,6 +378,21 @@ DtSetSubtableLength (
Al Stone 840f97
         return;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    memcpy (Subtable->LengthField, &Subtable->TotalLength,
Al Stone 840f97
-        Subtable->SizeOfLengthField);
Al Stone 840f97
+    switch(Subtable->SizeOfLengthField) {
Al Stone 840f97
+    case 1:
Al Stone 840f97
+	ACPI_MOVE_32_TO_8(Subtable->LengthField, &Subtable->TotalLength);
Al Stone 840f97
+	break;
Al Stone 840f97
+
Al Stone 840f97
+    case 2:
Al Stone 840f97
+	ACPI_MOVE_32_TO_16(Subtable->LengthField, &Subtable->TotalLength);
Al Stone 840f97
+	break;
Al Stone 840f97
+
Al Stone 840f97
+    case 4:
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(Subtable->LengthField, &Subtable->TotalLength);
Al Stone 840f97
+	break;
Al Stone 840f97
+
Al Stone 840f97
+    default:
Al Stone 840f97
+    	memcpy (Subtable->LengthField, &Subtable->TotalLength,
Al Stone 840f97
+        	Subtable->SizeOfLengthField);
Al Stone 840f97
+    }
Al Stone 840f97
 }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/dttable1.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/dttable1.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/dttable1.c
Al Stone 51ac8f
@@ -281,6 +281,8 @@ DtCompileCsrt (
Al Stone 840f97
     DT_FIELD                **PFieldList = (DT_FIELD **) List;
Al Stone 840f97
     UINT32                  DescriptorCount;
Al Stone 840f97
     UINT32                  GroupLength;
Al Stone 840f97
+    ACPI_CSRT_GROUP	    *Pgrp;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Subtables (Resource Groups) */
Al Stone 51ac8f
@@ -299,12 +301,20 @@ DtCompileCsrt (
Al Stone 840f97
 
Al Stone 840f97
         /* Compute the number of resource descriptors */
Al Stone 840f97
 
Al Stone 840f97
+	/*
Al Stone 840f97
         GroupLength =
Al Stone 840f97
             (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
Al Stone 840f97
                 Subtable->Buffer))->Length -
Al Stone 840f97
             (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
Al Stone 840f97
                 Subtable->Buffer))->SharedInfoLength -
Al Stone 840f97
             sizeof (ACPI_CSRT_GROUP);
Al Stone 840f97
+	*/
Al Stone 840f97
+	Pgrp = ACPI_CAST_PTR(ACPI_CSRT_GROUP, Subtable->Buffer);
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Tmp32, &Pgrp->Length);
Al Stone 840f97
+	GroupLength = Tmp32;
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Tmp32, &Pgrp->SharedInfoLength);
Al Stone 840f97
+	GroupLength -= Tmp32;
Al Stone 840f97
+        GroupLength -= sizeof (ACPI_CSRT_GROUP);
Al Stone 840f97
 
Al Stone 840f97
         DescriptorCount = (GroupLength  /
Al Stone 840f97
             sizeof (ACPI_CSRT_DESCRIPTOR));
Al Stone 51ac8f
@@ -392,6 +402,8 @@ DtCompileDbg2 (
Al Stone 840f97
     ACPI_DBG2_DEVICE        *DeviceInfo;
Al Stone 840f97
     UINT16                  CurrentOffset;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
+    UINT16                  Tmp16;
Al Stone 840f97
+    UINT32                  Tmp32;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 51ac8f
@@ -408,10 +420,11 @@ DtCompileDbg2 (
Al Stone 840f97
     /* Main table fields */
Al Stone 840f97
 
Al Stone 840f97
     Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
Al Stone 840f97
-    Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
Al Stone 840f97
+    Tmp32 = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
Al Stone 840f97
         ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Dbg2Header->InfoOffset, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
-    SubtableCount = Dbg2Header->InfoCount;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&SubtableCount, &Dbg2Header->InfoCount);
Al Stone 840f97
     DtPushSubtable (Subtable);
Al Stone 840f97
 
Al Stone 840f97
     /* Process all Device Information subtables (Count = InfoCount) */
Al Stone 51ac8f
@@ -438,7 +451,7 @@ DtCompileDbg2 (
Al Stone 840f97
 
Al Stone 840f97
         /* BaseAddressRegister GAS array (Required, size is RegisterCount) */
Al Stone 840f97
 
Al Stone 840f97
-        DeviceInfo->BaseAddressOffset = CurrentOffset;
Al Stone 840f97
+        ACPI_MOVE_16_TO_16(&DeviceInfo->BaseAddressOffset, &CurrentOffset);
Al Stone 840f97
         for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
Al Stone 840f97
         {
Al Stone 840f97
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
Al Stone 51ac8f
@@ -454,7 +467,7 @@ DtCompileDbg2 (
Al Stone 840f97
 
Al Stone 840f97
         /* AddressSize array (Required, size = RegisterCount) */
Al Stone 840f97
 
Al Stone 840f97
-        DeviceInfo->AddressSizeOffset = CurrentOffset;
Al Stone 840f97
+        ACPI_MOVE_16_TO_16(&DeviceInfo->AddressSizeOffset, &CurrentOffset);
Al Stone 840f97
         for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
Al Stone 840f97
         {
Al Stone 840f97
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
Al Stone 51ac8f
@@ -470,7 +483,7 @@ DtCompileDbg2 (
Al Stone 840f97
 
Al Stone 840f97
         /* NamespaceString device identifier (Required, size = NamePathLength) */
Al Stone 840f97
 
Al Stone 840f97
-        DeviceInfo->NamepathOffset = CurrentOffset;
Al Stone 840f97
+        ACPI_MOVE_16_TO_16(&DeviceInfo->NamepathOffset, &CurrentOffset);
Al Stone 840f97
         Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
Al Stone 49c3e9
             &Subtable);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 51ac8f
@@ -480,8 +493,9 @@ DtCompileDbg2 (
Al Stone 840f97
 
Al Stone 840f97
         /* Update the device info header */
Al Stone 840f97
 
Al Stone 840f97
-        DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
Al Stone 840f97
-        CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
Al Stone 840f97
+        ACPI_MOVE_32_TO_16(&DeviceInfo->NamepathLength, &Subtable->Length);
Al Stone 840f97
+        ACPI_MOVE_16_TO_16(&Tmp16, &DeviceInfo->NamepathLength);
Al Stone 840f97
+        CurrentOffset += Tmp16;
Al Stone 840f97
         DtInsertSubtable (ParentTable, Subtable);
Al Stone 840f97
 
Al Stone 840f97
         /* OemData - Variable-length data (Optional, size = OemDataLength) */
Al Stone 226b59
@@ -508,8 +522,8 @@ DtCompileDbg2 (
Al Stone 840f97
 
Al Stone 840f97
         if (Subtable && Subtable->Length)
Al Stone 840f97
         {
Al Stone 840f97
-            DeviceInfo->OemDataOffset = CurrentOffset;
Al Stone 840f97
-            DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
Al Stone 840f97
+            ACPI_MOVE_16_TO_16(&DeviceInfo->OemDataOffset, &CurrentOffset);
Al Stone 840f97
+            ACPI_MOVE_32_TO_16(&DeviceInfo->OemDataLength, &Subtable->Length);
Al Stone 840f97
 
Al Stone 840f97
             DtInsertSubtable (ParentTable, Subtable);
Al Stone 840f97
         }
Al Stone 226b59
@@ -549,6 +563,8 @@ DtCompileDmar (
Al Stone 840f97
     ACPI_DMAR_DEVICE_SCOPE  *DmarDeviceScope;
Al Stone 840f97
     UINT32                  DeviceScopeLength;
Al Stone 840f97
     UINT32                  PciPathLength;
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
+    UINT16		    HdrType;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 49c3e9
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
Al Stone 226b59
@@ -578,8 +594,11 @@ DtCompileDmar (
Al Stone 840f97
         DtPushSubtable (Subtable);
Al Stone 840f97
 
Al Stone 840f97
         DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &DmarHeader->Length);
Al Stone 840f97
+	DmarHeader->Length = Tmp16;
Al Stone 840f97
 
Al Stone 840f97
-        switch (DmarHeader->Type)
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&HdrType, &DmarHeader->Type);
Al Stone 840f97
+        switch (HdrType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_DMAR_TYPE_HARDWARE_UNIT:
Al Stone 840f97
 
Al Stone 226b59
@@ -626,8 +645,8 @@ DtCompileDmar (
Al Stone 840f97
         /*
Al Stone 840f97
          * Optional Device Scope subtables
Al Stone 840f97
          */
Al Stone 840f97
-        if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
Al Stone 840f97
-            (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
Al Stone 840f97
+        if ((HdrType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
Al Stone 840f97
+            (HdrType == ACPI_DMAR_TYPE_NAMESPACE))
Al Stone 840f97
         {
Al Stone 840f97
             /* These types do not support device scopes */
Al Stone 840f97
 
Al Stone 226b59
@@ -637,7 +656,7 @@ DtCompileDmar (
Al Stone 840f97
 
Al Stone 840f97
         DtPushSubtable (Subtable);
Al Stone 840f97
         DeviceScopeLength = DmarHeader->Length - Subtable->Length -
Al Stone 840f97
-            ParentTable->Length;
Al Stone 840f97
+		ParentTable->Length;
Al Stone 840f97
         while (DeviceScopeLength)
Al Stone 840f97
         {
Al Stone 840f97
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
Al Stone 226b59
@@ -762,7 +781,7 @@ DtCompileDrtm (
Al Stone 840f97
         Count++;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    DrtmVtl->ValidatedTableCount = Count;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&DrtmVtl->ValidatedTableCount, &Count);
Al Stone 840f97
     DtPopSubtable ();
Al Stone 840f97
     ParentTable = DtPeekSubtable ();
Al Stone 840f97
 
Al Stone 226b59
@@ -800,7 +819,7 @@ DtCompileDrtm (
Al Stone 840f97
         Count++;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    DrtmRl->ResourceCount = Count;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&DrtmRl->ResourceCount, &Count);
Al Stone 840f97
     DtPopSubtable ();
Al Stone 840f97
     ParentTable = DtPeekSubtable ();
Al Stone 840f97
 
Al Stone 226b59
@@ -894,6 +913,7 @@ DtCompileGtdt (
Al Stone 840f97
     ACPI_SUBTABLE_HEADER    *GtdtHeader;
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
     UINT32                  GtCount;
Al Stone 840f97
+    ACPI_GTDT_TIMER_BLOCK   *TimerBlock;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoGtdt,
Al Stone 226b59
@@ -960,8 +980,9 @@ DtCompileGtdt (
Al Stone 840f97
             DtPushSubtable (Subtable);
Al Stone 840f97
             ParentTable = DtPeekSubtable ();
Al Stone 840f97
 
Al Stone 840f97
-            GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
Al Stone 840f97
-                Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
Al Stone 840f97
+	    TimerBlock = ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
Al Stone 840f97
+                Subtable->Buffer - sizeof(ACPI_GTDT_HEADER));
Al Stone 840f97
+	    ACPI_MOVE_32_TO_32(&GtCount, &TimerBlock->TimerCount);
Al Stone 840f97
 
Al Stone 840f97
             while (GtCount)
Al Stone 840f97
             {
Al Stone 226b59
@@ -1014,6 +1035,7 @@ DtCompileFpdt (
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
     DT_FIELD                **PFieldList = (DT_FIELD **) List;
Al Stone 840f97
     DT_FIELD                *SubtableStart;
Al Stone 840f97
+    UINT16		    HdrType;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     while (*PFieldList)
Al Stone 226b59
@@ -1032,7 +1054,8 @@ DtCompileFpdt (
Al Stone 840f97
 
Al Stone 840f97
         FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
Al Stone 840f97
 
Al Stone 840f97
-        switch (FpdtHeader->Type)
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&HdrType, &FpdtHeader->Type);
Al Stone 840f97
+        switch (HdrType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_FPDT_TYPE_BOOT:
Al Stone 840f97
 
Al Stone 226b59
@@ -1090,6 +1113,7 @@ DtCompileHest (
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
     UINT16                  Type;
Al Stone 840f97
     UINT32                  BankCount;
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
Al Stone 226b59
@@ -1107,8 +1131,9 @@ DtCompileHest (
Al Stone 840f97
         /* Get subtable type */
Al Stone 840f97
 
Al Stone 840f97
         SubtableStart = *PFieldList;
Al Stone 840f97
-        DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
Al Stone 840f97
+        DtCompileInteger ((UINT8 *) &Tmp16, *PFieldList, 2, 0);
Al Stone 840f97
 
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Type, &Tmp16);
Al Stone 840f97
         switch (Type)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_HEST_TYPE_IA32_CHECK:
Al Stone 226b59
@@ -1458,11 +1483,13 @@ DtCompileIort (
Al Stone 840f97
     ACPI_IORT_SMMU          *IortSmmu;
Al Stone 840f97
     UINT32                  NodeNumber;
Al Stone 840f97
     UINT32                  NodeLength;
Al Stone 840f97
+    UINT32                  NodeOffset;
Al Stone 840f97
     UINT32                  IdMappingNumber;
Al Stone 840f97
     UINT32                  ItsNumber;
Al Stone 840f97
     UINT32                  ContextIrptNumber;
Al Stone 840f97
     UINT32                  PmuIrptNumber;
Al Stone 840f97
     UINT32                  PaddingLength;
Al Stone 840f97
+    UINT32                  MappingOffset;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ParentTable = DtPeekSubtable ();
Al Stone 226b59
@@ -1488,7 +1515,7 @@ DtCompileIort (
Al Stone 840f97
      * Optionally allows the generic data types to be used for filling
Al Stone 840f97
      * this field.
Al Stone 840f97
      */
Al Stone 840f97
-    Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
Al Stone 840f97
+    NodeOffset = sizeof (ACPI_TABLE_IORT);
Al Stone 840f97
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
Al Stone 49c3e9
         &Subtable);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 226b59
@@ -1498,7 +1525,7 @@ DtCompileIort (
Al Stone 840f97
     if (Subtable)
Al Stone 840f97
     {
Al Stone 840f97
         DtInsertSubtable (ParentTable, Subtable);
Al Stone 840f97
-        Iort->NodeOffset += Subtable->Length;
Al Stone 840f97
+        NodeOffset += Subtable->Length;
Al Stone 840f97
     }
Al Stone 840f97
     else
Al Stone 840f97
     {
Al Stone 226b59
@@ -1508,8 +1535,9 @@ DtCompileIort (
Al Stone 840f97
         {
Al Stone 840f97
             return (Status);
Al Stone 840f97
         }
Al Stone 840f97
-        Iort->NodeOffset += PaddingLength;
Al Stone 840f97
+        NodeOffset += PaddingLength;
Al Stone 840f97
     }
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Iort->NodeOffset, &NodeOffset);
Al Stone 840f97
 
Al Stone 840f97
     NodeNumber = 0;
Al Stone 840f97
     while (*PFieldList)
Al Stone 226b59
@@ -1563,7 +1591,7 @@ DtCompileIort (
Al Stone 840f97
                 ItsNumber++;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            IortItsGroup->ItsCount = ItsNumber;
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&IortItsGroup->ItsCount, &ItsNumber);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case ACPI_IORT_NODE_NAMED_COMPONENT:
Al Stone 226b59
@@ -1597,15 +1625,16 @@ DtCompileIort (
Al Stone 840f97
             }
Al Stone 840f97
             else
Al Stone 840f97
             {
Al Stone 840f97
-                if (NodeLength > IortNode->MappingOffset)
Al Stone 840f97
+		ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
Al Stone 840f97
+                if (NodeLength > MappingOffset)
Al Stone 840f97
                 {
Al Stone 840f97
                     return (AE_BAD_DATA);
Al Stone 840f97
                 }
Al Stone 840f97
 
Al Stone 840f97
-                if (NodeLength < IortNode->MappingOffset)
Al Stone 840f97
+                if (NodeLength < MappingOffset)
Al Stone 840f97
                 {
Al Stone 840f97
                     Status = DtCompilePadding (
Al Stone 840f97
-                        IortNode->MappingOffset - NodeLength,
Al Stone 840f97
+                        MappingOffset - NodeLength,
Al Stone 840f97
                         &Subtable);
Al Stone 840f97
                     if (ACPI_FAILURE (Status))
Al Stone 840f97
                     {
Al Stone 226b59
@@ -1613,7 +1642,8 @@ DtCompileIort (
Al Stone 840f97
                     }
Al Stone 840f97
 
Al Stone 840f97
                     DtInsertSubtable (ParentTable, Subtable);
Al Stone 840f97
-                    NodeLength = IortNode->MappingOffset;
Al Stone 840f97
+		    ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
Al Stone 840f97
+                    NodeLength = MappingOffset;
Al Stone 840f97
                 }
Al Stone 840f97
             }
Al Stone 840f97
             break;
Al Stone 226b59
@@ -1646,7 +1676,7 @@ DtCompileIort (
Al Stone 840f97
 
Al Stone 840f97
             /* Compile global interrupt array */
Al Stone 840f97
 
Al Stone 840f97
-            IortSmmu->GlobalInterruptOffset = NodeLength;
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&IortSmmu->GlobalInterruptOffset, &NodeLength);
Al Stone 840f97
             Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
Al Stone 49c3e9
                 &Subtable);
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 226b59
@@ -1660,7 +1690,7 @@ DtCompileIort (
Al Stone 840f97
             /* Compile context interrupt array */
Al Stone 840f97
 
Al Stone 840f97
             ContextIrptNumber = 0;
Al Stone 840f97
-            IortSmmu->ContextInterruptOffset = NodeLength;
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptOffset, &NodeLength);
Al Stone 840f97
             while (*PFieldList)
Al Stone 840f97
             {
Al Stone 840f97
                 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
Al Stone 226b59
@@ -1680,12 +1710,12 @@ DtCompileIort (
Al Stone 840f97
                 ContextIrptNumber++;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            IortSmmu->ContextInterruptCount = ContextIrptNumber;
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptCount, &ContextIrptNumber);
Al Stone 840f97
 
Al Stone 840f97
             /* Compile PMU interrupt array */
Al Stone 840f97
 
Al Stone 840f97
             PmuIrptNumber = 0;
Al Stone 840f97
-            IortSmmu->PmuInterruptOffset = NodeLength;
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptOffset, &NodeLength);
Al Stone 840f97
             while (*PFieldList)
Al Stone 840f97
             {
Al Stone 840f97
                 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
Al Stone 226b59
@@ -1705,7 +1735,7 @@ DtCompileIort (
Al Stone 840f97
                 PmuIrptNumber++;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            IortSmmu->PmuInterruptCount = PmuIrptNumber;
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptCount, &PmuIrptNumber);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case ACPI_IORT_NODE_SMMU_V3:
Al Stone 226b59
@@ -1729,7 +1759,7 @@ DtCompileIort (
Al Stone 840f97
 
Al Stone 840f97
         /* Compile Array of ID mappings */
Al Stone 840f97
 
Al Stone 840f97
-        IortNode->MappingOffset = NodeLength;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&IortNode->MappingOffset, &NodeLength);
Al Stone 840f97
         IdMappingNumber = 0;
Al Stone 840f97
         while (*PFieldList)
Al Stone 840f97
         {
Al Stone 226b59
@@ -1750,7 +1780,7 @@ DtCompileIort (
Al Stone 840f97
             IdMappingNumber++;
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone 840f97
-        IortNode->MappingCount = IdMappingNumber;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&IortNode->MappingCount, &IdMappingNumber);
Al Stone 840f97
         if (!IdMappingNumber)
Al Stone 840f97
         {
Al Stone 840f97
             IortNode->MappingOffset = 0;
Al Stone 226b59
@@ -1765,7 +1795,7 @@ DtCompileIort (
Al Stone 840f97
         NodeNumber++;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
-    Iort->NodeCount = NodeNumber;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Iort->NodeCount, &NodeNumber);
Al Stone 840f97
     return (AE_OK);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/compiler/dttable2.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/compiler/dttable2.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/compiler/dttable2.c
Al Stone 51ac8f
@@ -345,7 +345,7 @@ DtCompileMpst (
Al Stone 840f97
     DtPushSubtable (Subtable);
Al Stone 840f97
 
Al Stone 840f97
     MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
Al Stone 840f97
-    SubtableCount = MpstChannelInfo->PowerNodeCount;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&SubtableCount, &MpstChannelInfo->PowerNodeCount);
Al Stone 840f97
 
Al Stone 840f97
     while (*PFieldList && SubtableCount)
Al Stone 840f97
     {
Al Stone 51ac8f
@@ -363,8 +363,8 @@ DtCompileMpst (
Al Stone 840f97
         DtPushSubtable (Subtable);
Al Stone 840f97
 
Al Stone 840f97
         MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
Al Stone 840f97
-        PowerStateCount = MpstPowerNode->NumPowerStates;
Al Stone 840f97
-        ComponentCount = MpstPowerNode->NumPhysicalComponents;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&PowerStateCount, &MpstPowerNode->NumPowerStates);
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&ComponentCount, &MpstPowerNode->NumPhysicalComponents);
Al Stone 840f97
 
Al Stone 840f97
         ParentTable = DtPeekSubtable ();
Al Stone 840f97
 
Al Stone 51ac8f
@@ -517,6 +517,7 @@ DtCompileNfit (
Al Stone 840f97
     UINT32                  Count;
Al Stone 840f97
     ACPI_NFIT_INTERLEAVE    *Interleave = NULL;
Al Stone 840f97
     ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
Al Stone 840f97
+    UINT16		    SubType;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Main table */
Al Stone 51ac8f
@@ -550,7 +551,8 @@ DtCompileNfit (
Al Stone 840f97
 
Al Stone 840f97
         NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
Al Stone 840f97
 
Al Stone 840f97
-        switch (NfitHeader->Type)
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&SubType, &NfitHeader->Type);
Al Stone 840f97
+        switch (SubType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
Al Stone 840f97
 
Al Stone 9b3daa
@@ -610,7 +612,7 @@ DtCompileNfit (
Al Stone 840f97
         DtInsertSubtable (ParentTable, Subtable);
Al Stone 840f97
         DtPopSubtable ();
Al Stone 840f97
 
Al Stone 840f97
-        switch (NfitHeader->Type)
Al Stone 840f97
+        switch (SubType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_NFIT_TYPE_INTERLEAVE:
Al Stone 840f97
 
Al Stone 9b3daa
@@ -636,7 +638,7 @@ DtCompileNfit (
Al Stone 840f97
                 Count++;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            Interleave->LineCount = Count;
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&Interleave->LineCount, &Count);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 9b3daa
         case ACPI_NFIT_TYPE_SMBIOS:
Al Stone 9b3daa
@@ -681,7 +683,7 @@ DtCompileNfit (
Al Stone 840f97
                 Count++;
Al Stone 840f97
             }
Al Stone 840f97
 
Al Stone 840f97
-            Hint->HintCount = (UINT16) Count;
Al Stone 840f97
+            ACPI_MOVE_32_TO_16(&Hint->HintCount, &Count);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 9b3daa
         default:
Al Stone 9b3daa
@@ -957,7 +959,7 @@ DtCompilePmtt (
Al Stone 840f97
 
Al Stone 840f97
             PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
Al Stone 840f97
                 (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
Al Stone 840f97
-            DomainCount = PmttController->DomainCount;
Al Stone 840f97
+            ACPI_MOVE_16_TO_16(&DomainCount, &PmttController->DomainCount);
Al Stone 840f97
 
Al Stone 840f97
             while (DomainCount)
Al Stone 840f97
             {
Al Stone 9b3daa
@@ -1177,6 +1179,7 @@ DtCompileS3pt (
Al Stone 840f97
     DT_SUBTABLE             *ParentTable;
Al Stone 840f97
     ACPI_DMTABLE_INFO       *InfoTable;
Al Stone 840f97
     DT_FIELD                *SubtableStart;
Al Stone 840f97
+    UINT16		    HdrType;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
Al Stone 9b3daa
@@ -1204,7 +1207,8 @@ DtCompileS3pt (
Al Stone 840f97
 
Al Stone 840f97
         S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
Al Stone 840f97
 
Al Stone 840f97
-        switch (S3ptHeader->Type)
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&HdrType, &S3ptHeader->Type);
Al Stone 840f97
+        switch (HdrType)
Al Stone 840f97
         {
Al Stone 840f97
         case ACPI_S3PT_TYPE_RESUME:
Al Stone 840f97
 
Al Stone 9b3daa
@@ -1514,6 +1518,7 @@ DtCompileSlit (
Al Stone 840f97
     DT_FIELD                *FieldList;
Al Stone 840f97
     UINT32                  Localities;
Al Stone 840f97
     UINT8                   *LocalityBuffer;
Al Stone 840f97
+    UINT32		    Tmp;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
Al Stone 9b3daa
@@ -1526,7 +1531,8 @@ DtCompileSlit (
Al Stone 840f97
     ParentTable = DtPeekSubtable ();
Al Stone 840f97
     DtInsertSubtable (ParentTable, Subtable);
Al Stone 840f97
 
Al Stone 840f97
-    Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
Al Stone 840f97
+    Tmp = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Localities, &Tmp);
Al Stone 840f97
     LocalityBuffer = UtLocalCalloc (Localities);
Al Stone 840f97
 
Al Stone 840f97
     /* Compile each locality buffer */
Al Stone 9b3daa
@@ -1720,6 +1726,7 @@ DtCompileTcpa (
Al Stone 840f97
     ACPI_TABLE_TCPA_HDR     *TcpaHeader;
Al Stone 840f97
     DT_SUBTABLE             *ParentTable;
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
+    UINT16		    PlatClass;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Compile the main table */
Al Stone 9b3daa
@@ -1740,7 +1747,8 @@ DtCompileTcpa (
Al Stone 840f97
      */
Al Stone 840f97
     TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
Al Stone 840f97
 
Al Stone 840f97
-    switch (TcpaHeader->PlatformClass)
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&PlatClass, &TcpaHeader->PlatformClass);
Al Stone 840f97
+    switch (PlatClass)
Al Stone 840f97
     {
Al Stone 840f97
     case ACPI_TCPA_CLIENT_TABLE:
Al Stone 840f97
 
Al Stone 9b3daa
@@ -2039,6 +2047,9 @@ DtCompileWpbt (
Al Stone 840f97
     ACPI_TABLE_WPBT         *Table;
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT16                  Length;
Al Stone 840f97
+    UINT16                  Tmp16;
Al Stone 840f97
+    UINT16		    *Ptr16;
Al Stone 840f97
+    UINT32		    ii;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Compile the main table */
Al Stone 9b3daa
@@ -2066,7 +2077,16 @@ DtCompileWpbt (
Al Stone 840f97
 
Al Stone 840f97
     Length = (UINT16) Subtable->TotalLength;
Al Stone 840f97
     Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
Al Stone 840f97
-    Table->ArgumentsLength = Length;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Table->ArgumentsLength, &Length);
Al Stone 840f97
+
Al Stone 840f97
+    /* The arguments are in Unicode, so make sure the byte order is correct */
Al Stone 840f97
+    Ptr16 = (UINT16 *)Subtable->Buffer;
Al Stone 840f97
+    for (ii = 0; ii < Length; ii++)
Al Stone 840f97
+    {
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, Ptr16);
Al Stone 840f97
+	*Ptr16 = Tmp16;
Al Stone 840f97
+        Ptr16++;
Al Stone 840f97
+    }
Al Stone 840f97
 
Al Stone 840f97
     ParentTable = DtPeekSubtable ();
Al Stone 840f97
     DtInsertSubtable (ParentTable, Subtable);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/disassembler/dmbuffer.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/disassembler/dmbuffer.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/disassembler/dmbuffer.c
Al Stone 840f97
@@ -204,7 +204,7 @@ AcpiDmByteList (
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ByteData = Op->Named.Data;
Al Stone 840f97
-    ByteCount = (UINT32) Op->Common.Value.Integer;
Al Stone 840f97
+    ByteCount = (UINT32) Op->Common.Value.Size;
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone 840f97
      * The byte list belongs to a buffer, and can be produced by either
Al Stone 840f97
@@ -304,7 +304,8 @@ AcpiDmIsUuidBuffer (
Al Stone 840f97
     /* Extract the byte list info */
Al Stone 840f97
 
Al Stone 840f97
     ByteData = NextOp->Named.Data;
Al Stone 840f97
-    ByteCount = (UINT32) NextOp->Common.Value.Integer;
Al Stone 840f97
+    /* ByteCount = (UINT32) NextOp->Common.Value.Integer; */
Al Stone 840f97
+    ByteCount = (UINT32) NextOp->Common.Value.Size;
Al Stone 840f97
 
Al Stone 840f97
     /* Byte count must be exactly 16 */
Al Stone 840f97
 
Al Stone 840f97
@@ -424,7 +425,8 @@ AcpiDmIsUnicodeBuffer (
Al Stone 840f97
     /* Extract the byte list info */
Al Stone 840f97
 
Al Stone 840f97
     ByteData = NextOp->Named.Data;
Al Stone 840f97
-    ByteCount = (UINT32) NextOp->Common.Value.Integer;
Al Stone 840f97
+    /* ByteCount = (UINT32) NextOp->Common.Value.Integer; */
Al Stone 840f97
+    ByteCount = (UINT32) NextOp->Common.Value.Size;
Al Stone 840f97
     WordCount = ACPI_DIV_2 (ByteCount);
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone 840f97
@@ -852,19 +854,22 @@ AcpiDmUnicode (
Al Stone 840f97
     UINT32                  WordCount;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
     int                     OutputValue;
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Extract the buffer info as a WORD buffer */
Al Stone 840f97
 
Al Stone 840f97
     WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
Al Stone 840f97
-    WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
Al Stone 840f97
+    WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Size));
Al Stone 840f97
 
Al Stone 840f97
     /* Write every other byte as an ASCII character */
Al Stone 840f97
 
Al Stone 840f97
     AcpiOsPrintf ("\"");
Al Stone 840f97
     for (i = 0; i < (WordCount - 1); i++)
Al Stone 840f97
     {
Al Stone 840f97
-        OutputValue = (int) WordData[i];
Al Stone 840f97
+        /* OutputValue = (int) WordData[i]; */
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &WordData[i]);
Al Stone 840f97
+	OutputValue = (int) Tmp16;
Al Stone 840f97
 
Al Stone 840f97
         /* Handle values that must be escaped */
Al Stone 840f97
 
Al Stone 840f97
@@ -973,16 +978,18 @@ AcpiDmCheckForHardwareId (
Al Stone 840f97
     ACPI_PARSE_OBJECT       *Op)
Al Stone 840f97
 {
Al Stone 840f97
     UINT32                  Name;
Al Stone 840f97
+    UINT32                  TmpName;
Al Stone 840f97
     ACPI_PARSE_OBJECT       *NextOp;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Get the NameSegment */
Al Stone 840f97
 
Al Stone 840f97
-    Name = AcpiPsGetName (Op);
Al Stone 840f97
-    if (!Name)
Al Stone 840f97
+    TmpName = AcpiPsGetName (Op);
Al Stone 840f97
+    if (!TmpName)
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 840f97
     }
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Name, &TmpName);
Al Stone 840f97
 
Al Stone 840f97
     NextOp = AcpiPsGetDepthNext (NULL, Op);
Al Stone 840f97
     if (!NextOp)
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/disassembler/dmopcode.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/disassembler/dmopcode.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/disassembler/dmopcode.c
Al Stone 840f97
@@ -244,6 +244,7 @@ AcpiDmPredefinedDescription (
Al Stone 840f97
     char                        *NameString;
Al Stone 840f97
     int                         LastCharIsDigit;
Al Stone 840f97
     int                         LastCharsAreHex;
Al Stone 840f97
+    char			TmpName[ACPI_NAME_SIZE + 1];
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     if (!Op)
Al Stone 840f97
@@ -261,7 +262,9 @@ AcpiDmPredefinedDescription (
Al Stone 840f97
 
Al Stone 840f97
     /* Predefined name must start with an underscore */
Al Stone 840f97
 
Al Stone 840f97
-    NameString = ACPI_CAST_PTR (char, &Op->Named.Name);
Al Stone 840f97
+    memset(TmpName, 0, ACPI_NAME_SIZE + 1);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(TmpName, &Op->Named.Name);
Al Stone 840f97
+    NameString = TmpName;
Al Stone 840f97
     if (NameString[0] != '_')
Al Stone 840f97
     {
Al Stone 840f97
         return;
Al Stone 840f97
@@ -880,25 +883,29 @@ AcpiDmDisassembleOneOp (
Al Stone 840f97
         AcpiDmNamestring (Op->Common.Value.Name);
Al Stone 840f97
         break;
Al Stone 840f97
 
Al Stone 840f97
-    case AML_INT_NAMEDFIELD_OP:
Al Stone 840f97
+    case AML_INT_NAMEDFIELD_OP: {
Al Stone 840f97
 
Al Stone 840f97
-        Length = AcpiDmDumpName (Op->Named.Name);
Al Stone 840f97
+	UINT32 TmpName;
Al Stone 840f97
+
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&TmpName, &Op->Named.Name);
Al Stone 840f97
+        Length = AcpiDmDumpName (TmpName);
Al Stone 840f97
 
Al Stone 840f97
         AcpiOsPrintf (",");
Al Stone 840f97
         ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0);
Al Stone 840f97
         AcpiOsPrintf ("%*.s  %u", (unsigned) (5 - Length), " ",
Al Stone 840f97
-            (UINT32) Op->Common.Value.Integer);
Al Stone 840f97
+            (UINT32) Op->Common.Value.Size);
Al Stone 840f97
 
Al Stone 840f97
         AcpiDmCommaIfFieldMember (Op);
Al Stone 840f97
 
Al Stone 840f97
-        Info->BitOffset += (UINT32) Op->Common.Value.Integer;
Al Stone 840f97
+        Info->BitOffset += (UINT32) Op->Common.Value.Size;
Al Stone 840f97
         break;
Al Stone 840f97
+    }
Al Stone 840f97
 
Al Stone 840f97
     case AML_INT_RESERVEDFIELD_OP:
Al Stone 840f97
 
Al Stone 840f97
         /* Offset() -- Must account for previous offsets */
Al Stone 840f97
 
Al Stone 840f97
-        Offset = (UINT32) Op->Common.Value.Integer;
Al Stone 840f97
+        Offset = Op->Common.Value.Size;
Al Stone 840f97
         Info->BitOffset += Offset;
Al Stone 840f97
 
Al Stone 840f97
         if (Info->BitOffset % 8 == 0)
Al Stone c045b7
@@ -942,10 +949,15 @@ AcpiDmDisassembleOneOp (
Al Stone c045b7
 
Al Stone c045b7
         if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
Al Stone c045b7
         {
Al Stone c045b7
+	    /* UINT64 Tmp64; */
Al Stone c045b7
+
Al Stone c045b7
             AcpiOsPrintf ("\n");
Al Stone c045b7
 
Al Stone c045b7
             Aml = Child->Named.Data;
Al Stone c045b7
+	    /*
Al Stone c045b7
             Length = (UINT32) Child->Common.Value.Integer;
Al Stone c045b7
+	    */
Al Stone c045b7
+            Length = (UINT32) Child->Common.Value.Size;
Al Stone c045b7
 
Al Stone c045b7
             Info->Level += 1;
Al Stone c045b7
             Info->MappingOp = Op;
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/disassembler/dmresrcl.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/disassembler/dmresrcl.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/disassembler/dmresrcl.c
Al Stone 840f97
@@ -141,7 +141,8 @@ AcpiDmMemoryFields (
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
-
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
 
Al Stone 840f97
     for (i = 0; i < 4; i++)
Al Stone 840f97
     {
Al Stone 840f97
@@ -151,14 +152,14 @@ AcpiDmMemoryFields (
Al Stone 840f97
         {
Al Stone 840f97
         case 16:
Al Stone 840f97
 
Al Stone 840f97
-            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
Al Stone 840f97
-                AcpiDmMemoryNames[i]);
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&Tmp16, &(ACPI_CAST_PTR (UINT16, Source)[i]));
Al Stone 840f97
+            AcpiDmDumpInteger16 (Tmp16, AcpiDmMemoryNames[i]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 32:
Al Stone 840f97
 
Al Stone 840f97
-            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
Al Stone 840f97
-                AcpiDmMemoryNames[i]);
Al Stone 840f97
+	    ACPI_MOVE_32_TO_32(&Tmp32, &(ACPI_CAST_PTR (UINT32, Source)[i]));
Al Stone 840f97
+            AcpiDmDumpInteger32 (Tmp32, AcpiDmMemoryNames[i]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         default:
Al Stone 840f97
@@ -190,7 +191,9 @@ AcpiDmAddressFields (
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
-
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
+    UINT64		    Tmp64;
Al Stone 840f97
 
Al Stone 840f97
     AcpiOsPrintf ("\n");
Al Stone 840f97
 
Al Stone 840f97
@@ -202,20 +205,20 @@ AcpiDmAddressFields (
Al Stone 840f97
         {
Al Stone 840f97
         case 16:
Al Stone 840f97
 
Al Stone 840f97
-            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
Al Stone 840f97
-                AcpiDmAddressNames[i]);
Al Stone 840f97
+	    ACPI_MOVE_16_TO_16(&Tmp16, &(ACPI_CAST_PTR (UINT16, Source)[i]));
Al Stone 840f97
+            AcpiDmDumpInteger16 (Tmp16, AcpiDmAddressNames[i]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 32:
Al Stone 840f97
 
Al Stone 840f97
-            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
Al Stone 840f97
-                AcpiDmAddressNames[i]);
Al Stone 840f97
+	    ACPI_MOVE_32_TO_32(&Tmp32, &(ACPI_CAST_PTR (UINT32, Source)[i]));
Al Stone 840f97
+            AcpiDmDumpInteger32 (Tmp32, AcpiDmAddressNames[i]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         case 64:
Al Stone 840f97
 
Al Stone 840f97
-            AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
Al Stone 840f97
-                AcpiDmAddressNames[i]);
Al Stone 840f97
+	    ACPI_MOVE_64_TO_64(&Tmp64, &(ACPI_CAST_PTR (UINT64, Source)[i]));
Al Stone 840f97
+            AcpiDmDumpInteger64 (Tmp64, AcpiDmAddressNames[i]);
Al Stone 840f97
             break;
Al Stone 840f97
 
Al Stone 840f97
         default:
Al Stone 840f97
@@ -868,6 +871,7 @@ AcpiDmFixedMemory32Descriptor (
Al Stone 840f97
     UINT32                  Length,
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT32 Tmp;
Al Stone 840f97
 
Al Stone 840f97
     /* Dump name and read/write flag */
Al Stone 840f97
 
Al Stone 840f97
@@ -876,12 +880,12 @@ AcpiDmFixedMemory32Descriptor (
Al Stone 840f97
         AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
Al Stone 840f97
-        "Address Base");
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Tmp, &Resource->FixedMemory32.Address);
Al Stone 840f97
+    AcpiDmDumpInteger32 (Tmp, "Address Base");
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
Al Stone 840f97
-        "Address Length");
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Tmp, &Resource->FixedMemory32.AddressLength);
Al Stone 840f97
+    AcpiDmDumpInteger32 (Tmp, "Address Length");
Al Stone 840f97
 
Al Stone 840f97
     /* Insert a descriptor name */
Al Stone 840f97
 
Al Stone 840f97
@@ -913,6 +917,7 @@ AcpiDmGenericRegisterDescriptor (
Al Stone 840f97
     UINT32                  Length,
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT64		    Tmp64;
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
     AcpiOsPrintf ("Register (");
Al Stone 840f97
@@ -926,7 +931,9 @@ AcpiDmGenericRegisterDescriptor (
Al Stone 840f97
     AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
Al Stone 840f97
+    /* AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address"); */
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Tmp64, &Resource->GenericReg.Address);
Al Stone 840f97
+    AcpiDmDumpInteger64 (Tmp64, "Address");
Al Stone 840f97
 
Al Stone 840f97
     /* Optional field for ACPI 3.0 */
Al Stone 840f97
 
Al Stone 840f97
@@ -972,7 +979,7 @@ AcpiDmInterruptDescriptor (
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
-
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
     AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
Al Stone 840f97
@@ -986,10 +993,11 @@ AcpiDmInterruptDescriptor (
Al Stone 840f97
      * list. Must compute length based on length of the list. First xrupt
Al Stone 840f97
      * is included in the struct (reason for -1 below)
Al Stone 840f97
      */
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->ExtendedIrq.ResourceLength);
Al Stone 840f97
     AcpiDmResourceSource (Resource,
Al Stone 840f97
         sizeof (AML_RESOURCE_EXTENDED_IRQ) +
Al Stone 840f97
             ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
Al Stone 840f97
-        Resource->ExtendedIrq.ResourceLength);
Al Stone 840f97
+        Tmp16);
Al Stone 840f97
 
Al Stone 840f97
     /* Insert a descriptor name */
Al Stone 840f97
 
Al Stone 840f97
@@ -1002,9 +1010,12 @@ AcpiDmInterruptDescriptor (
Al Stone 840f97
     AcpiOsPrintf ("{\n");
Al Stone 840f97
     for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
Al Stone 840f97
     {
Al Stone 840f97
+	UINT32 Tmp32, Val32;
Al Stone 840f97
+
Al Stone 840f97
         AcpiDmIndent (Level + 1);
Al Stone 840f97
-        AcpiOsPrintf ("0x%8.8X,\n",
Al Stone 840f97
-            (UINT32) Resource->ExtendedIrq.Interrupts[i]);
Al Stone 840f97
+	Val32 = (UINT32) Resource->ExtendedIrq.Interrupts[i];
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Tmp32, &Val32);
Al Stone 840f97
+        AcpiOsPrintf ("0x%8.8X,\n", Tmp32);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/disassembler/dmresrcl2.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/disassembler/dmresrcl2.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/disassembler/dmresrcl2.c
Al Stone 840f97
@@ -191,22 +191,24 @@ AcpiDmGpioCommon (
Al Stone 840f97
     char                    *DeviceName = NULL;
Al Stone 840f97
     UINT32                  PinCount;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* ResourceSource, ResourceSourceIndex, ResourceType */
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    if (Resource->Gpio.ResSourceOffset)
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.ResSourceOffset);
Al Stone 840f97
+    if (Tmp16)
Al Stone 840f97
     {
Al Stone 840f97
-        DeviceName = ACPI_ADD_PTR (char,
Al Stone 840f97
-            Resource, Resource->Gpio.ResSourceOffset),
Al Stone 840f97
+        DeviceName = ACPI_ADD_PTR (char, Resource, Tmp16),
Al Stone 840f97
         AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     AcpiOsPrintf (", ");
Al Stone 840f97
     AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.Flags);
Al Stone 840f97
     AcpiOsPrintf ("%s, ",
Al Stone 840f97
-        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
Al Stone 840f97
+        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Tmp16)]);
Al Stone 840f97
 
Al Stone 840f97
     /* Insert a descriptor name */
Al Stone 840f97
 
Al Stone 840f97
@@ -215,15 +217,16 @@ AcpiDmGpioCommon (
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the vendor data */
Al Stone 840f97
 
Al Stone 840f97
-    if (Resource->Gpio.VendorOffset)
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorOffset);
Al Stone 840f97
+    if (Tmp16)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("\n");
Al Stone 840f97
         AcpiDmIndent (Level + 1);
Al Stone 840f97
-        VendorData = ACPI_ADD_PTR (UINT8, Resource,
Al Stone 840f97
-            Resource->Gpio.VendorOffset);
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorOffset);
Al Stone 840f97
+        VendorData = ACPI_ADD_PTR (UINT8, Resource, Tmp16);
Al Stone 840f97
 
Al Stone 840f97
-        AcpiDmDumpRawDataBuffer (VendorData,
Al Stone 840f97
-            Resource->Gpio.VendorLength, Level);
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorLength);
Al Stone 840f97
+        AcpiDmDumpRawDataBuffer (VendorData, Tmp16, Level);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     AcpiOsPrintf (")\n");
Al Stone 840f97
@@ -233,17 +236,25 @@ AcpiDmGpioCommon (
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
     AcpiOsPrintf ("{   // Pin list\n");
Al Stone 840f97
 
Al Stone 840f97
+    /*
Al Stone 840f97
     PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
Al Stone 840f97
         Resource->Gpio.PinTableOffset)) /
Al Stone 840f97
         sizeof (UINT16);
Al Stone 840f97
+    */
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.ResSourceOffset);
Al Stone 840f97
+    PinCount = (UINT32) Tmp16;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.PinTableOffset);
Al Stone 840f97
+    PinCount -= (UINT32) Tmp16;
Al Stone 840f97
+    PinCount /= sizeof (UINT16);
Al Stone 840f97
 
Al Stone 840f97
-    PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
Al Stone 840f97
-        Resource->Gpio.PinTableOffset);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.PinTableOffset);
Al Stone 840f97
+    PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, Tmp16);
Al Stone 840f97
 
Al Stone 840f97
     for (i = 0; i < PinCount; i++)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiDmIndent (Level + 2);
Al Stone 840f97
-        AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &PinList[i]);
Al Stone 840f97
+        AcpiOsPrintf ("0x%4.4X%s\n", Tmp16,
Al Stone 840f97
             ((i + 1) < PinCount) ? "," : "");
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
@@ -277,16 +288,18 @@ AcpiDmGpioIntDescriptor (
Al Stone 840f97
     UINT32                  Length,
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the GpioInt-specific portion of the descriptor */
Al Stone 840f97
 
Al Stone 840f97
     /* EdgeLevel, ActiveLevel, Shared */
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
Al Stone 840f97
     AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
Al Stone 840f97
-        AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
Al Stone 840f97
-        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
Al Stone 840f97
-        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
Al Stone 840f97
+        AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Tmp16)],
Al Stone 840f97
+        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 1)],
Al Stone 840f97
+        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
Al Stone 840f97
 
Al Stone 840f97
     /* PinConfig, DebounceTimeout */
Al Stone 840f97
 
Al Stone 840f97
@@ -299,7 +312,8 @@ AcpiDmGpioIntDescriptor (
Al Stone 840f97
     {
Al Stone 840f97
         AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
Al Stone 840f97
     }
Al Stone 840f97
-    AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DebounceTimeout);
Al Stone 840f97
+    AcpiOsPrintf ("0x%4.4X,\n", Tmp16);
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the GpioInt/GpioIo common portion of the descriptor */
Al Stone 840f97
 
Al Stone 840f97
@@ -329,14 +343,16 @@ AcpiDmGpioIoDescriptor (
Al Stone 840f97
     UINT32                  Length,
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the GpioIo-specific portion of the descriptor */
Al Stone 840f97
 
Al Stone 840f97
     /* Shared, PinConfig */
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
Al Stone 840f97
     AcpiOsPrintf ("GpioIo (%s, ",
Al Stone 840f97
-        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
Al Stone 840f97
+        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
Al Stone 840f97
 
Al Stone 840f97
     if (Resource->Gpio.PinConfig <= 3)
Al Stone 840f97
     {
Al Stone 840f97
@@ -350,10 +366,13 @@ AcpiDmGpioIoDescriptor (
Al Stone 840f97
 
Al Stone 840f97
     /* DebounceTimeout, DriveStrength, IoRestriction */
Al Stone 840f97
 
Al Stone 840f97
-    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
Al Stone 840f97
-    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DebounceTimeout);
Al Stone 840f97
+    AcpiOsPrintf ("0x%4.4X, ", Tmp16);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DriveStrength);
Al Stone 840f97
+    AcpiOsPrintf ("0x%4.4X, ", Tmp16);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
Al Stone 840f97
     AcpiOsPrintf ("%s,\n",
Al Stone 840f97
-        AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
Al Stone 840f97
+        AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Tmp16)]);
Al Stone 840f97
 
Al Stone 840f97
     /* Dump the GpioInt/GpioIo common portion of the descriptor */
Al Stone 840f97
 
Al Stone 840f97
@@ -533,6 +552,7 @@ AcpiDmDumpSerialBusVendorData (
Al Stone 840f97
 {
Al Stone 840f97
     UINT8                   *VendorData;
Al Stone 840f97
     UINT32                  VendorLength;
Al Stone 840f97
+    UINT16                  Tmp16;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* Get the (optional) vendor data and length */
Al Stone 840f97
@@ -541,8 +561,8 @@ AcpiDmDumpSerialBusVendorData (
Al Stone 840f97
     {
Al Stone 840f97
     case AML_RESOURCE_I2C_SERIALBUSTYPE:
Al Stone 840f97
 
Al Stone 840f97
-        VendorLength = Resource->CommonSerialBus.TypeDataLength -
Al Stone 840f97
-            AML_RESOURCE_I2C_MIN_DATA_LEN;
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
Al Stone 840f97
+        VendorLength = Tmp16 - AML_RESOURCE_I2C_MIN_DATA_LEN;
Al Stone 840f97
 
Al Stone 840f97
         VendorData = ACPI_ADD_PTR (UINT8, Resource,
Al Stone 840f97
             sizeof (AML_RESOURCE_I2C_SERIALBUS));
Al Stone 840f97
@@ -550,8 +570,8 @@ AcpiDmDumpSerialBusVendorData (
Al Stone 840f97
 
Al Stone 840f97
     case AML_RESOURCE_SPI_SERIALBUSTYPE:
Al Stone 840f97
 
Al Stone 840f97
-        VendorLength = Resource->CommonSerialBus.TypeDataLength -
Al Stone 840f97
-            AML_RESOURCE_SPI_MIN_DATA_LEN;
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
Al Stone 840f97
+        VendorLength = Tmp16 - AML_RESOURCE_SPI_MIN_DATA_LEN;
Al Stone 840f97
 
Al Stone 840f97
         VendorData = ACPI_ADD_PTR (UINT8, Resource,
Al Stone 840f97
             sizeof (AML_RESOURCE_SPI_SERIALBUS));
Al Stone 840f97
@@ -559,8 +579,8 @@ AcpiDmDumpSerialBusVendorData (
Al Stone 840f97
 
Al Stone 840f97
     case AML_RESOURCE_UART_SERIALBUSTYPE:
Al Stone 840f97
 
Al Stone 840f97
-        VendorLength = Resource->CommonSerialBus.TypeDataLength -
Al Stone 840f97
-            AML_RESOURCE_UART_MIN_DATA_LEN;
Al Stone 840f97
+	ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
Al Stone 840f97
+        VendorLength = Tmp16 - AML_RESOURCE_UART_MIN_DATA_LEN;
Al Stone 840f97
 
Al Stone 840f97
         VendorData = ACPI_ADD_PTR (UINT8, Resource,
Al Stone 840f97
             sizeof (AML_RESOURCE_UART_SERIALBUS));
Al Stone c045b7
@@ -601,24 +621,29 @@ AcpiDmI2cSerialBusDescriptor (
Al Stone 840f97
 {
Al Stone 840f97
     UINT32                  ResourceSourceOffset;
Al Stone 840f97
     char                    *DeviceName;
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->I2cSerialBus.SlaveAddress);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Tmp32, &Resource->I2cSerialBus.ConnectionSpeed);
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
     AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
Al Stone 840f97
-        Resource->I2cSerialBus.SlaveAddress,
Al Stone 840f97
+        Tmp16,
Al Stone 840f97
         AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
Al Stone 840f97
-        Resource->I2cSerialBus.ConnectionSpeed);
Al Stone 840f97
+        Tmp32);
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone c045b7
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->I2cSerialBus.TypeSpecificFlags);
Al Stone 840f97
     AcpiOsPrintf ("%s, ",
Al Stone c045b7
-        AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
Al Stone c045b7
+        AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Tmp16)]);
Al Stone 840f97
 
Al Stone 840f97
     /* ResourceSource is a required field */
Al Stone 840f97
 
Al Stone 840f97
-    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
Al Stone 840f97
-        Resource->CommonSerialBus.TypeDataLength;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
Al Stone 840f97
+    ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Tmp16;
Al Stone 840f97
 
Al Stone 840f97
     DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
Al Stone 840f97
     AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/disassembler/dmresrcs.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/disassembler/dmresrcs.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/disassembler/dmresrcs.c
Al Stone 840f97
@@ -72,6 +72,7 @@ AcpiDmIrqDescriptor (
Al Stone 840f97
     UINT32                  Length,
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT16 Tmp;
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
     AcpiOsPrintf ("%s (",
Al Stone 840f97
@@ -93,7 +94,8 @@ AcpiDmIrqDescriptor (
Al Stone 840f97
     AcpiOsPrintf (")\n");
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    AcpiDmBitList (Resource->Irq.IrqMask);
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp, &Resource->Irq.IrqMask);
Al Stone 840f97
+    AcpiDmBitList (Tmp);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -204,16 +206,19 @@ AcpiDmIoDescriptor (
Al Stone 840f97
     UINT32                  Length,
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT16 Tmp16;
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
     AcpiOsPrintf ("IO (%s,\n",
Al Stone 840f97
         AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Io.Minimum);
Al Stone 840f97
+    AcpiDmDumpInteger16 (Tmp16, "Range Minimum");
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Io.Maximum);
Al Stone 840f97
+    AcpiDmDumpInteger16 (Tmp16, "Range Maximum");
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
     AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
Al Stone 840f97
@@ -251,12 +256,14 @@ AcpiDmFixedIoDescriptor (
Al Stone 840f97
     UINT32                  Length,
Al Stone 840f97
     UINT32                  Level)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT16                  Tmp16;
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level);
Al Stone 840f97
     AcpiOsPrintf ("FixedIO (\n");
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
-    AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Tmp16, &Resource->FixedIo.Address);
Al Stone 840f97
+    AcpiDmDumpInteger16 (Tmp16, "Address");
Al Stone 840f97
 
Al Stone 840f97
     AcpiDmIndent (Level + 1);
Al Stone 840f97
     AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/dispatcher/dsfield.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/dispatcher/dsfield.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/dispatcher/dsfield.c
Al Stone 9b3daa
@@ -321,6 +321,7 @@ AcpiDsGetFieldNames (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT64                  Position;
Al Stone 840f97
     ACPI_PARSE_OBJECT       *Child;
Al Stone 840f97
+    UINT32 TmpName;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
Al Stone 9b3daa
@@ -428,10 +429,17 @@ AcpiDsGetFieldNames (
Al Stone 840f97
 
Al Stone 840f97
             /* Lookup the name, it should already exist */
Al Stone 840f97
 
Al Stone 840f97
+	    ACPI_MOVE_32_TO_32(&TmpName, &Arg->Named.Name);
Al Stone 840f97
+            Status = AcpiNsLookup (WalkState->ScopeInfo,
Al Stone 840f97
+                (char *) &TmpName, Info->FieldType,
Al Stone 840f97
+                ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
Al Stone 840f97
+                WalkState, &Info->FieldNode);
Al Stone 840f97
+	/*
Al Stone 840f97
             Status = AcpiNsLookup (WalkState->ScopeInfo,
Al Stone 840f97
                 (char *) &Arg->Named.Name, Info->FieldType,
Al Stone 840f97
                 ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
Al Stone 840f97
                 WalkState, &Info->FieldNode);
Al Stone 840f97
+	*/
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 9b3daa
                 ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Al Stone 9b3daa
@@ -660,9 +668,17 @@ AcpiDsInitFieldObjects (
Al Stone 840f97
          */
Al Stone 840f97
         if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
Al Stone 840f97
         {
Al Stone 840f97
+	    UINT32 TmpName;
Al Stone 840f97
+
Al Stone 840f97
+            ACPI_MOVE_32_TO_32(&TmpName, &Arg->Named.Name);
Al Stone 840f97
+            Status = AcpiNsLookup (WalkState->ScopeInfo,
Al Stone 840f97
+                (char *) &TmpName, Type, ACPI_IMODE_LOAD_PASS1,
Al Stone 840f97
+                Flags, WalkState, &Node);
Al Stone 840f97
+	/*
Al Stone 840f97
             Status = AcpiNsLookup (WalkState->ScopeInfo,
Al Stone 840f97
                 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
Al Stone 840f97
                 Flags, WalkState, &Node);
Al Stone 840f97
+	*/
Al Stone 840f97
             if (ACPI_FAILURE (Status))
Al Stone 840f97
             {
Al Stone 9b3daa
                 ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/events/evgpeblk.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/events/evgpeblk.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/events/evgpeblk.c
Al Stone 840f97
@@ -376,6 +376,7 @@ AcpiEvCreateGpeBlock (
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     ACPI_GPE_BLOCK_INFO     *GpeBlock;
Al Stone 840f97
     ACPI_GPE_WALK_INFO      WalkInfo;
Al Stone 840f97
+    char		    Name[ACPI_NAME_SIZE + 1];
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
Al Stone 840f97
@@ -396,7 +397,7 @@ AcpiEvCreateGpeBlock (
Al Stone 840f97
 
Al Stone 840f97
     /* Initialize the new GPE block */
Al Stone 840f97
 
Al Stone 840f97
-    GpeBlock->Address = Address;
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&GpeBlock->Address, &Address);
Al Stone 840f97
     GpeBlock->SpaceId = SpaceId;
Al Stone 840f97
     GpeBlock->Node = GpeDevice;
Al Stone 840f97
     GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH);
Al Stone 840f97
@@ -445,11 +446,13 @@ AcpiEvCreateGpeBlock (
Al Stone 840f97
         (*ReturnGpeBlock) = GpeBlock;
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
+    memset(&Name, 0, ACPI_NAME_SIZE + 1);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Name, &GpeDevice->Name.Ascii);
Al Stone 840f97
     ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
Al Stone 840f97
         "    Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n",
Al Stone 840f97
         (UINT32) GpeBlock->BlockBaseNumber,
Al Stone 840f97
         (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)),
Al Stone 840f97
-        GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber,
Al Stone 840f97
+        Name, GpeBlock->RegisterCount, InterruptNumber,
Al Stone 840f97
         InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : ""));
Al Stone 840f97
 
Al Stone 840f97
     /* Update global count of currently available GPEs */
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/hardware/hwregs.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/hardware/hwregs.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/hardware/hwregs.c
Al Stone 840f97
@@ -197,7 +197,7 @@ AcpiHwValidateRegister (
Al Stone 840f97
      * Address must not be null. A null address also indicates an optional
Al Stone 840f97
      * ACPI register that is not supported, so no error message.
Al Stone 840f97
      */
Al Stone 840f97
-    ACPI_MOVE_64_TO_64 (Address, &Reg->Address);
Al Stone 840f97
+    *Address =  Reg->Address;
Al Stone 840f97
     if (!(*Address))
Al Stone 840f97
     {
Al Stone 840f97
         return (AE_BAD_ADDRESS);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/hardware/hwvalid.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/hardware/hwvalid.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/hardware/hwvalid.c
Al Stone 840f97
@@ -135,6 +135,8 @@ AcpiHwValidateIoRequest (
Al Stone 840f97
     UINT32                  ByteWidth;
Al Stone 840f97
     ACPI_IO_ADDRESS         LastAddress;
Al Stone 840f97
     const ACPI_PORT_INFO    *PortInfo;
Al Stone 840f97
+    UINT64                  Max16;
Al Stone 840f97
+    UINT64                  Tmp64;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 226b59
     ACPI_FUNCTION_TRACE (HwValidateIoRequest);
Al Stone 226b59
@@ -162,7 +164,10 @@ AcpiHwValidateIoRequest (
Al Stone 840f97
 
Al Stone 840f97
     /* Maximum 16-bit address in I/O space */
Al Stone 840f97
 
Al Stone 840f97
-    if (LastAddress > ACPI_UINT16_MAX)
Al Stone 840f97
+    Max16 = (UINT64) ACPI_UINT16_MAX;
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&Tmp64, &Max16);
Al Stone 840f97
+
Al Stone 840f97
+    if ((UINT64)LastAddress > Tmp64)
Al Stone 840f97
     {
Al Stone 840f97
         ACPI_ERROR ((AE_INFO,
Al Stone 840f97
             "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/namespace/nsaccess.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/namespace/nsaccess.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/namespace/nsaccess.c
Al Stone 840f97
@@ -313,6 +313,7 @@ AcpiNsLookup (
Al Stone 840f97
     ACPI_OBJECT_TYPE        ThisSearchType;
Al Stone 840f97
     UINT32                  SearchParentFlag = ACPI_NS_SEARCH_PARENT;
Al Stone 840f97
     UINT32                  LocalFlags;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ACPI_FUNCTION_TRACE (NsLookup);
Al Stone 840f97
@@ -702,9 +703,10 @@ AcpiNsLookup (
Al Stone 840f97
             {
Al Stone 840f97
                 /* Complain about a type mismatch */
Al Stone 840f97
 
Al Stone 840f97
+		ACPI_MOVE_32_TO_32(&Tmp32, &SimpleName);
Al Stone 840f97
                 ACPI_WARNING ((AE_INFO,
Al Stone 840f97
                     "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
Al Stone 840f97
-                    ACPI_CAST_PTR (char, &SimpleName),
Al Stone 840f97
+                    ACPI_CAST_PTR (char, &Tmp32),
Al Stone 840f97
                     AcpiUtGetTypeName (ThisNode->Type),
Al Stone 840f97
                     AcpiUtGetTypeName (TypeToCheckFor)));
Al Stone 840f97
             }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/namespace/nsparse.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/namespace/nsparse.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/namespace/nsparse.c
Al Stone 49c3e9
@@ -197,13 +197,14 @@ AcpiNsOneCompleteParse (
Al Stone 840f97
 
Al Stone 840f97
     /* Table must consist of at least a complete header */
Al Stone 840f97
 
Al Stone 840f97
-    if (Table->Length < sizeof (ACPI_TABLE_HEADER))
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&AmlLength, &Table->Length);
Al Stone 840f97
+    if (AmlLength < sizeof (ACPI_TABLE_HEADER))
Al Stone 840f97
     {
Al Stone 840f97
         return_ACPI_STATUS (AE_BAD_HEADER);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
-    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
+    AmlLength -= sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
 
Al Stone 840f97
     Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
Al Stone 840f97
     if (ACPI_FAILURE (Status))
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/tables/tbdata.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/tables/tbdata.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/tables/tbdata.c
Al Stone 840f97
@@ -552,6 +552,7 @@ AcpiTbVerifyTempTable (
Al Stone 840f97
     UINT32                  *TableIndex)
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_STATUS             Status = AE_OK;
Al Stone 840f97
+    UINT32		    Length;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ACPI_FUNCTION_TRACE (TbVerifyTempTable);
Al Stone 840f97
@@ -581,7 +582,8 @@ AcpiTbVerifyTempTable (
Al Stone 840f97
     {
Al Stone 840f97
         /* Verify the checksum */
Al Stone 840f97
 
Al Stone 840f97
-        Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&Length, &TableDesc->Length);
Al Stone 840f97
+        Status = AcpiTbVerifyChecksum (TableDesc->Pointer, Length);
Al Stone 840f97
         if (ACPI_FAILURE (Status))
Al Stone 840f97
         {
Al Stone 840f97
             ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/tables/tbfadt.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/tables/tbfadt.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/tables/tbfadt.c
Al Stone c045b7
@@ -424,18 +424,20 @@ AcpiTbCreateLocalFadt (
Al Stone c045b7
     ACPI_TABLE_HEADER       *Table,
Al Stone c045b7
     UINT32                  Length)
Al Stone c045b7
 {
Al Stone c045b7
+    UINT32 Tmp32;
Al Stone c045b7
 
Al Stone c045b7
     /*
Al Stone c045b7
      * Check if the FADT is larger than the largest table that we expect
Al Stone c045b7
      * (typically the current ACPI specification version). If so, truncate
Al Stone c045b7
      * the table, and issue a warning.
Al Stone c045b7
      */
Al Stone c045b7
-    if (Length > sizeof (ACPI_TABLE_FADT))
Al Stone c045b7
+    ACPI_MOVE_32_TO_32(&Tmp32, &Length);
Al Stone c045b7
+    if (Tmp32 > sizeof (ACPI_TABLE_FADT))
Al Stone c045b7
     {
Al Stone c045b7
         ACPI_BIOS_WARNING ((AE_INFO,
Al Stone c045b7
             "FADT (revision %u) is longer than %s length, "
Al Stone c045b7
             "truncating length %u to %u",
Al Stone c045b7
-            Table->Revision, ACPI_FADT_CONFORMANCE, Length,
Al Stone c045b7
+            Table->Revision, ACPI_FADT_CONFORMANCE, Tmp32,
Al Stone c045b7
             (UINT32) sizeof (ACPI_TABLE_FADT)));
Al Stone c045b7
     }
Al Stone c045b7
 
Al Stone c045b7
@@ -446,7 +448,7 @@ AcpiTbCreateLocalFadt (
Al Stone c045b7
     /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
Al Stone c045b7
 
Al Stone c045b7
     memcpy (&AcpiGbl_FADT, Table,
Al Stone c045b7
-        ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
Al Stone c045b7
+        ACPI_MIN (Tmp32, sizeof (ACPI_TABLE_FADT)));
Al Stone c045b7
 
Al Stone c045b7
     /* Take a copy of the Hardware Reduced flag */
Al Stone c045b7
 
Al Stone c045b7
@@ -520,6 +522,8 @@ AcpiTbConvertFadt (
Al Stone 840f97
     UINT8                   Length;
Al Stone 840f97
     UINT8                   Flags;
Al Stone 840f97
     UINT32                  i;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
+    UINT64		    Tmp64;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone c045b7
@@ -533,7 +537,8 @@ AcpiTbConvertFadt (
Al Stone 840f97
      * Note: The FADT revision value is unreliable. Only the length can be
Al Stone 840f97
      * trusted.
Al Stone 840f97
      */
Al Stone 840f97
-    if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Tmp32, &AcpiGbl_FADT.Header.Length);
Al Stone 840f97
+    if (Tmp32 <= ACPI_FADT_V2_SIZE)
Al Stone 840f97
     {
Al Stone 840f97
         AcpiGbl_FADT.PreferredProfile = 0;
Al Stone 840f97
         AcpiGbl_FADT.PstateControl = 0;
Al Stone c045b7
@@ -546,14 +551,15 @@ AcpiTbConvertFadt (
Al Stone 840f97
      * current FADT version as defined by the ACPI specification.
Al Stone 840f97
      * Thus, we will have a common FADT internally.
Al Stone 840f97
      */
Al Stone 840f97
-    AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
Al Stone 840f97
+    Tmp32 = sizeof (ACPI_TABLE_FADT);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&AcpiGbl_FADT.Header.Length, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone 840f97
      * Expand the 32-bit DSDT addresses to 64-bit as necessary.
Al Stone 840f97
      * Later ACPICA code will always use the X 64-bit field.
Al Stone 840f97
      */
Al Stone 840f97
-    AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
Al Stone 840f97
-        AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
Al Stone 840f97
+    Tmp64 = AcpiTbSelectAddress ("DSDT", AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
Al Stone 840f97
+    ACPI_MOVE_64_TO_64(&AcpiGbl_FADT.XDsdt, &Tmp64);
Al Stone 840f97
 
Al Stone 840f97
     /* If Hardware Reduced flag is set, we are all done */
Al Stone 840f97
 
Al Stone c045b7
@@ -614,7 +620,9 @@ AcpiTbConvertFadt (
Al Stone 840f97
         {
Al Stone 840f97
             if (Address64->Address)
Al Stone 840f97
             {
Al Stone 840f97
-                if (Address64->Address != (UINT64) Address32)
Al Stone 840f97
+		ACPI_MOVE_32_TO_32(&Tmp32, &Address32);
Al Stone 840f97
+		ACPI_MOVE_64_TO_64(&Tmp64, &Address64->Address);
Al Stone 840f97
+                if (Tmp64 != (UINT64) Tmp32)
Al Stone 840f97
                 {
Al Stone 840f97
                     /* Address mismatch */
Al Stone 840f97
 
Al Stone c045b7
@@ -655,9 +663,11 @@ AcpiTbConvertFadt (
Al Stone 840f97
              */
Al Stone 840f97
             if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
Al Stone 840f97
             {
Al Stone 840f97
+		ACPI_MOVE_32_TO_32(&Tmp32, &Address32); /* back to host order */
Al Stone 840f97
+		Tmp64 = (UINT64) Tmp32;			/* promote only */
Al Stone 840f97
                 AcpiTbInitGenericAddress (Address64,
Al Stone 840f97
                     ACPI_ADR_SPACE_SYSTEM_IO, Length,
Al Stone 840f97
-                    (UINT64) Address32, Name, Flags);
Al Stone 840f97
+                    Tmp64, Name, Flags);
Al Stone 840f97
             }
Al Stone 840f97
         }
Al Stone 840f97
 
Al Stone c045b7
@@ -780,10 +790,14 @@ AcpiTbSetupFadtRegisters (
Al Stone 840f97
 
Al Stone 840f97
         if (Source64->Address)
Al Stone 840f97
         {
Al Stone 840f97
+	    UINT64 Tmp64, Addr64;
Al Stone 840f97
+
Al Stone 840f97
+	    ACPI_MOVE_64_TO_64(&Tmp64, &Source64->Address);
Al Stone 840f97
+	    Tmp64 += (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth);
Al Stone 840f97
+	    ACPI_MOVE_64_TO_64(&Addr64, &Tmp64);
Al Stone 840f97
             AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
Al Stone 840f97
                 Source64->SpaceId, Pm1RegisterByteWidth,
Al Stone 840f97
-                Source64->Address +
Al Stone 840f97
-                    (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
Al Stone 840f97
+                Addr64,
Al Stone 840f97
                 "PmRegisters", 0);
Al Stone 840f97
         }
Al Stone 840f97
     }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/tables/tbfind.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/tables/tbfind.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/tables/tbfind.c
Al Stone 840f97
@@ -108,8 +108,11 @@ AcpiTbFindTable (
Al Stone 840f97
     (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
Al Stone 840f97
     for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
Al Stone 840f97
     {
Al Stone 840f97
+        UINT32 Tmp32;
Al Stone 840f97
+
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&Tmp32, &Header.Signature);
Al Stone 840f97
         if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature),
Al Stone 840f97
-            Header.Signature, ACPI_NAME_SIZE))
Al Stone 840f97
+            &Tmp32, ACPI_NAME_SIZE))
Al Stone 840f97
         {
Al Stone 840f97
             /* Not the requested table */
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/tables/tbprint.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/tables/tbprint.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/tables/tbprint.c
Al Stone 840f97
@@ -143,15 +143,18 @@ AcpiTbPrintTableHeader (
Al Stone 840f97
     ACPI_TABLE_HEADER       *Header)
Al Stone 840f97
 {
Al Stone 840f97
     ACPI_TABLE_HEADER       LocalHeader;
Al Stone 840f97
+    UINT32		    Len;
Al Stone 840f97
+    UINT32		    OemRev;
Al Stone 840f97
+    UINT32		    CompilerRev;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
Al Stone 840f97
     {
Al Stone 840f97
         /* FACS only has signature and length fields */
Al Stone 840f97
 
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Len, &Header->Length);
Al Stone 840f97
         ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
Al Stone 840f97
-            Header->Signature, ACPI_FORMAT_UINT64 (Address),
Al Stone 840f97
-            Header->Length));
Al Stone 840f97
+            Header->Signature, ACPI_FORMAT_UINT64 (Address), Len));
Al Stone 840f97
     }
Al Stone 840f97
     else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
Al Stone 840f97
     {
Al Stone 840f97
@@ -174,13 +177,16 @@ AcpiTbPrintTableHeader (
Al Stone 840f97
 
Al Stone 840f97
         AcpiTbCleanupTableHeader (&LocalHeader, Header);
Al Stone 840f97
 
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Len, &LocalHeader.Length);
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&OemRev, &LocalHeader.OemRevision);
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&CompilerRev, &LocalHeader.AslCompilerRevision);
Al Stone 840f97
         ACPI_INFO ((
Al Stone 840f97
             "%-4.4s 0x%8.8X%8.8X"
Al Stone 840f97
             " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
Al Stone 840f97
             LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
Al Stone 840f97
-            LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
Al Stone 840f97
-            LocalHeader.OemTableId, LocalHeader.OemRevision,
Al Stone 840f97
-            LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
Al Stone 840f97
+            Len, LocalHeader.Revision, LocalHeader.OemId,
Al Stone 840f97
+            LocalHeader.OemTableId, OemRev,
Al Stone 840f97
+            LocalHeader.AslCompilerId, CompilerRev));
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/tables/tbutils.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/tables/tbutils.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/tables/tbutils.c
Al Stone 840f97
@@ -238,7 +238,7 @@ AcpiTbGetRootTableEntry (
Al Stone 840f97
          * 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
Al Stone 840f97
          *  return 64-bit
Al Stone 840f97
          */
Al Stone 840f97
-        ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
Al Stone 840f97
+	Address64 = (UINT64) TableEntry;
Al Stone 840f97
 
Al Stone 840f97
 #if ACPI_MACHINE_WIDTH == 32
Al Stone 840f97
         if (Address64 > ACPI_UINT32_MAX)
Al Stone 840f97
@@ -251,7 +251,8 @@ AcpiTbGetRootTableEntry (
Al Stone 840f97
                 ACPI_FORMAT_UINT64 (Address64)));
Al Stone 840f97
         }
Al Stone 840f97
 #endif
Al Stone 840f97
-        return ((ACPI_PHYSICAL_ADDRESS) (Address64));
Al Stone 840f97
+        return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
Al Stone 840f97
+            UINT64, Address64)));
Al Stone 840f97
     }
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
@@ -287,6 +288,7 @@ AcpiTbParseRootTable (
Al Stone 840f97
     UINT8                   *TableEntry;
Al Stone 840f97
     ACPI_STATUS             Status;
Al Stone 840f97
     UINT32                  TableIndex;
Al Stone 840f97
+    UINT32                  Tmp32;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ACPI_FUNCTION_TRACE (TbParseRootTable);
Al Stone 840f97
@@ -345,7 +347,7 @@ AcpiTbParseRootTable (
Al Stone 840f97
      * Validate length of the table, and map entire table.
Al Stone 840f97
      * Minimum length table must contain at least one entry.
Al Stone 840f97
      */
Al Stone 840f97
-    Length = Table->Length;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Length, &Table->Length);
Al Stone 840f97
     AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
     if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize))
Al Stone 840f97
@@ -372,7 +374,7 @@ AcpiTbParseRootTable (
Al Stone 840f97
 
Al Stone 840f97
     /* Get the number of entries and pointer to first entry */
Al Stone 840f97
 
Al Stone 840f97
-    TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /
Al Stone 840f97
+    TableCount = (UINT32) ((Length - sizeof (ACPI_TABLE_HEADER)) /
Al Stone 840f97
         TableEntrySize);
Al Stone 840f97
     TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER));
Al Stone 840f97
 
Al Stone 840f97
@@ -394,10 +396,10 @@ AcpiTbParseRootTable (
Al Stone 840f97
         Status = AcpiTbInstallStandardTable (Address,
Al Stone 840f97
             ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex);
Al Stone 840f97
 
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Tmp32,
Al Stone 840f97
+			   &AcpiGbl_RootTableList.Tables[TableIndex].Signature);
Al Stone 840f97
         if (ACPI_SUCCESS (Status) &&
Al Stone 840f97
-            ACPI_COMPARE_NAME (
Al Stone 840f97
-                &AcpiGbl_RootTableList.Tables[TableIndex].Signature,
Al Stone 840f97
-                ACPI_SIG_FADT))
Al Stone 840f97
+            ACPI_COMPARE_NAME (&Tmp32, ACPI_SIG_FADT))
Al Stone 840f97
         {
Al Stone 840f97
             AcpiGbl_FadtIndex = TableIndex;
Al Stone 840f97
             AcpiTbParseFadt ();
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/tables/tbxface.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/tables/tbxface.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/tables/tbxface.c
Al Stone d0bd8e
@@ -293,8 +293,11 @@ AcpiGetTableHeader (
Al Stone 840f97
 
Al Stone 840f97
     for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
Al Stone 840f97
     {
Al Stone 840f97
+	UINT32 Tmp32;
Al Stone 840f97
+
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Tmp32, (UINT32 *)Signature);
Al Stone 840f97
         if (!ACPI_COMPARE_NAME (
Al Stone 840f97
-                &(AcpiGbl_RootTableList.Tables[i].Signature), Signature))
Al Stone 840f97
+                &(AcpiGbl_RootTableList.Tables[i].Signature), &Tmp32))
Al Stone 840f97
         {
Al Stone 840f97
             continue;
Al Stone 840f97
         }
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/components/tables/tbxfload.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/components/tables/tbxfload.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/components/tables/tbxfload.c
Al Stone 840f97
@@ -156,6 +156,7 @@ AcpiTbLoadNamespace (
Al Stone 840f97
     ACPI_TABLE_DESC         *Table;
Al Stone 840f97
     UINT32                  TablesLoaded = 0;
Al Stone 840f97
     UINT32                  TablesFailed = 0;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     ACPI_FUNCTION_TRACE (TbLoadNamespace);
Al Stone 840f97
@@ -169,8 +170,9 @@ AcpiTbLoadNamespace (
Al Stone 840f97
      */
Al Stone 840f97
     Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex];
Al Stone 840f97
 
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Tmp32, &Table->Signature.Ascii);
Al Stone 840f97
     if (!AcpiGbl_RootTableList.CurrentTableCount ||
Al Stone 840f97
-        !ACPI_COMPARE_NAME (Table->Signature.Ascii, ACPI_SIG_DSDT) ||
Al Stone 840f97
+        !ACPI_COMPARE_NAME (&Tmp32, ACPI_SIG_DSDT) ||
Al Stone 840f97
          ACPI_FAILURE (AcpiTbValidateTable (Table)))
Al Stone 840f97
     {
Al Stone 840f97
         Status = AE_NO_ACPI_TABLES;
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/tools/acpiexec/aetables.c
Al Stone 840f97
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/tools/acpiexec/aetables.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/tools/acpiexec/aetables.c
Al Stone 840f97
@@ -146,21 +146,25 @@ AeInitializeTableHeader (
Al Stone 840f97
     char                    *Signature,
Al Stone 840f97
     UINT32                  Length)
Al Stone 840f97
 {
Al Stone 840f97
+    UINT16		    Tmp16;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
 
Al Stone 840f97
     ACPI_MOVE_NAME (Header->Signature, Signature);
Al Stone 840f97
-    Header->Length = Length;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Header->Length, &Length);
Al Stone 840f97
 
Al Stone 840f97
-    Header->OemRevision = 0x1001;
Al Stone 840f97
+    Tmp16 = 0x1001;
Al Stone 840f97
+    ACPI_MOVE_16_TO_16(&Header->OemRevision, &Tmp16);
Al Stone 840f97
     strncpy (Header->OemId, "Intel", ACPI_OEM_ID_SIZE);
Al Stone 840f97
     strncpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
Al Stone 840f97
     strncpy (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE);
Al Stone 840f97
-    Header->AslCompilerRevision = ACPI_CA_VERSION;
Al Stone 840f97
+    Tmp32 = ACPI_CA_VERSION;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&Header->AslCompilerRevision, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
     /* Set the checksum, must set to zero first */
Al Stone 840f97
 
Al Stone 840f97
     Header->Checksum = 0;
Al Stone 840f97
     Header->Checksum = (UINT8) -AcpiTbChecksum (
Al Stone 840f97
-        (void *) Header, Header->Length);
Al Stone 840f97
+        (void *) Header, Length);
Al Stone 840f97
 }
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
@@ -188,6 +192,7 @@ AeBuildLocalTables (
Al Stone 840f97
     ACPI_NEW_TABLE_DESC     *NextTable;
Al Stone 840f97
     UINT32                  NextIndex;
Al Stone 840f97
     ACPI_TABLE_FADT         *ExternalFadt = NULL;
Al Stone 840f97
+    UINT32		    Tmp32;
Al Stone 840f97
 
Al Stone 840f97
 
Al Stone 840f97
     /*
Al Stone 840f97
@@ -374,6 +379,8 @@ AeBuildLocalTables (
Al Stone 840f97
     }
Al Stone 840f97
     else
Al Stone 840f97
     {
Al Stone 840f97
+        UINT64		    Tmp64;
Al Stone 840f97
+
Al Stone 840f97
         /*
Al Stone 840f97
          * Build a local FADT so we can test the hardware/event init
Al Stone 840f97
          */
Al Stone 840f97
@@ -385,34 +392,44 @@ AeBuildLocalTables (
Al Stone 840f97
         LocalFADT.Facs = 0;
Al Stone 840f97
 
Al Stone 840f97
         LocalFADT.XDsdt = DsdtAddress;
Al Stone 840f97
-        LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
Al Stone 840f97
+        Tmp64 = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
Al Stone 840f97
+        ACPI_MOVE_64_TO_64(&LocalFADT.XFacs, &Tmp64);
Al Stone 840f97
 
Al Stone 840f97
         /* Miscellaneous FADT fields */
Al Stone 840f97
 
Al Stone 840f97
         LocalFADT.Gpe0BlockLength = 0x08;
Al Stone 840f97
-        LocalFADT.Gpe0Block = 0x00001234;
Al Stone 840f97
+        Tmp32 = 0x00001234;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalFADT.Gpe0Block, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
         LocalFADT.Gpe1BlockLength = 0x80;
Al Stone 840f97
-        LocalFADT.Gpe1Block = 0x00005678;
Al Stone 840f97
+        Tmp32 = 0x00005678;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalFADT.Gpe1Block, &Tmp32);
Al Stone 840f97
         LocalFADT.Gpe1Base = 100;
Al Stone 840f97
 
Al Stone 840f97
         LocalFADT.Pm1EventLength = 4;
Al Stone 840f97
-        LocalFADT.Pm1aEventBlock = 0x00001aaa;
Al Stone 840f97
-        LocalFADT.Pm1bEventBlock = 0x00001bbb;
Al Stone 840f97
+        Tmp32 = 0x00001aaa;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalFADT.Pm1aEventBlock, &Tmp32);
Al Stone 840f97
+        Tmp32 = 0x00001bbb;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalFADT.Pm1bEventBlock, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
         LocalFADT.Pm1ControlLength = 2;
Al Stone 840f97
-        LocalFADT.Pm1aControlBlock = 0xB0;
Al Stone 840f97
+        Tmp32 = 0xB0;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalFADT.Pm1aControlBlock, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
         LocalFADT.PmTimerLength = 4;
Al Stone 840f97
-        LocalFADT.PmTimerBlock = 0xA0;
Al Stone 840f97
+        Tmp32 = 0xA0;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalFADT.PmTimerBlock, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
-        LocalFADT.Pm2ControlBlock = 0xC0;
Al Stone 840f97
+        Tmp32 = 0xC0;
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalFADT.Pm2ControlBlock, &Tmp32);
Al Stone 840f97
         LocalFADT.Pm2ControlLength = 1;
Al Stone 840f97
 
Al Stone 840f97
         /* Setup one example X-64 GAS field */
Al Stone 840f97
 
Al Stone 840f97
         LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
Al Stone 840f97
-        LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock;
Al Stone 840f97
+	ACPI_MOVE_32_TO_32(&Tmp32, &LocalFADT.Pm1bEventBlock);
Al Stone 840f97
+	Tmp64 = (UINT64)Tmp32;
Al Stone 840f97
+        ACPI_MOVE_64_TO_64(&LocalFADT.XPm1bEventBlock.Address, &Tmp64);
Al Stone 840f97
         LocalFADT.XPm1bEventBlock.BitWidth = (UINT8)
Al Stone 840f97
             ACPI_MUL_8 (LocalFADT.Pm1EventLength);
Al Stone 840f97
     }
Al Stone 840f97
@@ -425,13 +442,17 @@ AeBuildLocalTables (
Al Stone 840f97
     memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
Al Stone 840f97
     ACPI_MOVE_NAME (LocalFACS.Signature, ACPI_SIG_FACS);
Al Stone 840f97
 
Al Stone 840f97
-    LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
Al Stone 840f97
-    LocalFACS.GlobalLock = 0x11AA0011;
Al Stone 840f97
+    Tmp32 = sizeof (ACPI_TABLE_FACS);
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&LocalFACS.Length, &Tmp32);
Al Stone 840f97
+    Tmp32 = 0x11AA0011;
Al Stone 840f97
+    ACPI_MOVE_32_TO_32(&LocalFACS.GlobalLock, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
     /* Build the optional local tables */
Al Stone 840f97
 
Al Stone 840f97
     if (AcpiGbl_LoadTestTables)
Al Stone 840f97
     {
Al Stone 840f97
+	UINT32 Tmp32;
Al Stone 840f97
+
Al Stone 840f97
         /*
Al Stone 840f97
          * Build a fake table [TEST] so that we make sure that the
Al Stone 840f97
          * ACPICA core ignores it
Al Stone 840f97
@@ -440,11 +461,12 @@ AeBuildLocalTables (
Al Stone 840f97
         ACPI_MOVE_NAME (LocalTEST.Signature, "TEST");
Al Stone 840f97
 
Al Stone 840f97
         LocalTEST.Revision = 1;
Al Stone 840f97
-        LocalTEST.Length = sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
+        Tmp32 = sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalTEST.Length, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
         LocalTEST.Checksum = 0;
Al Stone 840f97
         LocalTEST.Checksum = (UINT8) -AcpiTbChecksum (
Al Stone 840f97
-            (void *) &LocalTEST, LocalTEST.Length);
Al Stone 840f97
+            (void *) &LocalTEST, Tmp32);
Al Stone 840f97
 
Al Stone 840f97
         /*
Al Stone 840f97
          * Build a fake table with a bad signature [BAD!] so that we make
Al Stone 840f97
@@ -454,11 +476,12 @@ AeBuildLocalTables (
Al Stone 840f97
         ACPI_MOVE_NAME (LocalBADTABLE.Signature, "BAD!");
Al Stone 840f97
 
Al Stone 840f97
         LocalBADTABLE.Revision = 1;
Al Stone 840f97
-        LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
+        Tmp32 = sizeof (ACPI_TABLE_HEADER);
Al Stone 840f97
+        ACPI_MOVE_32_TO_32(&LocalBADTABLE.Length, &Tmp32);
Al Stone 840f97
 
Al Stone 840f97
         LocalBADTABLE.Checksum = 0;
Al Stone 840f97
         LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum (
Al Stone 840f97
-            (void *) &LocalBADTABLE, LocalBADTABLE.Length);
Al Stone 840f97
+            (void *) &LocalBADTABLE, Tmp32);
Al Stone 840f97
     }
Al Stone 840f97
 
Al Stone 840f97
     return (AE_OK);
Al Stone 49c3e9
Index: acpica-unix2-20180209/source/common/dmswitch.c
Al Stone c045b7
===================================================================
Al Stone 49c3e9
--- acpica-unix2-20180209.orig/source/common/dmswitch.c
Al Stone 49c3e9
+++ acpica-unix2-20180209/source/common/dmswitch.c
Al Stone c045b7
@@ -88,13 +88,15 @@ AcpiDmProcessSwitch (
Al Stone c045b7
     ACPI_PARSE_OBJECT_LIST  *Current;
Al Stone c045b7
     ACPI_PARSE_OBJECT_LIST  *Previous;
Al Stone c045b7
     BOOLEAN                 FoundTemp = FALSE;
Al Stone c045b7
+    UINT32		    Tmp32;
Al Stone c045b7
 
Al Stone c045b7
 
Al Stone c045b7
     switch (Op->Common.AmlOpcode)
Al Stone c045b7
     {
Al Stone c045b7
     case AML_NAME_OP:
Al Stone c045b7
 
Al Stone c045b7
-        Temp = (char *) (&Op->Named.Name);
Al Stone c045b7
+	ACPI_MOVE_32_TO_32(&Tmp32, &Op->Named.Name);
Al Stone c045b7
+        Temp = (char *) (&Tmp32);
Al Stone c045b7
 
Al Stone c045b7
         if (!strncmp(Temp, "_T_", 3))
Al Stone c045b7
         {
Al Stone c045b7
@@ -138,7 +140,10 @@ AcpiDmProcessSwitch (
Al Stone c045b7
         {
Al Stone c045b7
             /* Note, if we get here Temp is not NULL */
Al Stone c045b7
 
Al Stone c045b7
-            if (!strncmp(Temp, (char *) (&Current->Op->Named.Name), 4))
Al Stone c045b7
+   	    ACPI_MOVE_32_TO_32(&Tmp32, &Current->Op->Named.Name);
Al Stone c045b7
+
Al Stone c045b7
+            /* if (!strncmp(Temp, (char *) (&Current->Op->Named.Name), 4)) */
Al Stone c045b7
+            if (!strncmp(Temp, (char *) &Tmp32, 4))
Al Stone c045b7
             {
Al Stone c045b7
                 /* Match found. Ignore disassembly */
Al Stone c045b7