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 = (