Al Stone f0defa
Re-use a patch originally created for Debian to enable big-endian
Al Stone f0defa
Al Stone f0defa
From: Al Stone <ahs3@redhat.com>
Al Stone f0defa
Al Stone f0defa
support
Al Stone f0defa
---
Al Stone f0defa
 source/compiler/aslcodegen.c      |  109 ++++++++++++++++++------------
Al Stone f0defa
 source/compiler/aslopcodes.c      |    4 +
Al Stone f0defa
 source/compiler/aslrestype1.c     |   68 +++++++++++++------
Al Stone f0defa
 source/compiler/aslrestype1i.c    |   38 +++++++---
Al Stone f0defa
 source/compiler/aslrestype2.c     |   25 ++++---
Al Stone f0defa
 source/compiler/aslrestype2d.c    |  134 +++++++++++++++++++++----------------
Al Stone f0defa
 source/compiler/aslrestype2e.c    |   39 +++++++----
Al Stone f0defa
 source/compiler/aslrestype2q.c    |  117 +++++++++++++++++++++-----------
Al Stone f0defa
 source/compiler/aslrestype2s.c    |   86 +++++++++++++++++-------
Al Stone f0defa
 source/compiler/aslrestype2w.c    |  127 +++++++++++++++++++++--------------
Al Stone f0defa
 source/include/acmacros.h         |   15 +++-
Al Stone f0defa
 source/include/platform/aclinux.h |    8 ++
Al Stone f0defa
 12 files changed, 487 insertions(+), 283 deletions(-)
Al Stone f0defa
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslcodegen.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslcodegen.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslcodegen.c
Al Stone 0a2fbe
@@ -238,16 +238,12 @@ CgWriteAmlOpcode (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *Op)
Al Stone afae4e
 {
Al Stone afae4e
     UINT8                   PkgLenFirstByte;
Al Stone afae4e
-    UINT32                  i;
Al Stone afae4e
-    union {
Al Stone afae4e
-        UINT16                  Opcode;
Al Stone afae4e
-        UINT8                   OpcodeBytes[2];
Al Stone afae4e
-    } Aml;
Al Stone afae4e
-    union {
Al Stone afae4e
-        UINT32                  Len;
Al Stone afae4e
-        UINT8                   LenBytes[4];
Al Stone afae4e
-    } PkgLen;
Al Stone afae4e
-
Al Stone afae4e
+    UINT8                   Byte;
Al Stone afae4e
+    UINT16                  Word;
Al Stone afae4e
+    UINT32                  DWord;
Al Stone afae4e
+    UINT64                  QWord;
Al Stone afae4e
+    UINT16                  AmlOpcode;
Al Stone afae4e
+    UINT32                  PkgLen;
Al Stone afae4e
 
Al Stone afae4e
     /* We expect some DEFAULT_ARGs, just ignore them */
Al Stone afae4e
 
Al Stone 0a2fbe
@@ -280,51 +276,52 @@ CgWriteAmlOpcode (
Al Stone afae4e
 
Al Stone afae4e
         /* Special opcodes for within a field definition */
Al Stone afae4e
 
Al Stone afae4e
-        Aml.Opcode = AML_FIELD_OFFSET_OP;
Al Stone afae4e
+        AmlOpcode = AML_FIELD_OFFSET_OP;
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case AML_INT_ACCESSFIELD_OP:
Al Stone afae4e
 
Al Stone afae4e
-        Aml.Opcode = AML_FIELD_ACCESS_OP;
Al Stone afae4e
+        AmlOpcode = AML_FIELD_ACCESS_OP;
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case AML_INT_CONNECTION_OP:
Al Stone afae4e
 
Al Stone afae4e
-        Aml.Opcode = AML_FIELD_CONNECTION_OP;
Al Stone afae4e
+        AmlOpcode = AML_FIELD_CONNECTION_OP;
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     default:
Al Stone afae4e
 
Al Stone afae4e
-        Aml.Opcode = Op->Asl.AmlOpcode;
Al Stone afae4e
+        AmlOpcode = Op->Asl.AmlOpcode;
Al Stone afae4e
         break;
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone afae4e
-    switch (Aml.Opcode)
Al Stone afae4e
+    switch (AmlOpcode)
Al Stone afae4e
     {
Al Stone afae4e
     case AML_PACKAGE_LENGTH:
Al Stone afae4e
 
Al Stone afae4e
         /* Value is the length to be encoded (Used in field definitions) */
Al Stone afae4e
 
Al Stone afae4e
-        PkgLen.Len = (UINT32) Op->Asl.Value.Integer;
Al Stone afae4e
+        PkgLen = (UINT32) Op->Asl.Value.Integer;
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     default:
Al Stone afae4e
 
Al Stone afae4e
         /* Check for two-byte opcode */
Al Stone afae4e
 
Al Stone afae4e
-        if (Aml.Opcode > 0x00FF)
Al Stone afae4e
+        if (AmlOpcode > 0x00FF)
Al Stone afae4e
         {
Al Stone afae4e
             /* Write the high byte first */
Al Stone afae4e
-
Al Stone afae4e
-            CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1);
Al Stone afae4e
+	    Byte = ACPI_HIBYTE(AmlOpcode);
Al Stone afae4e
+	    CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
         }
Al Stone afae4e
 
Al Stone afae4e
-        CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1);
Al Stone afae4e
+	Byte = ACPI_LOBYTE(AmlOpcode);
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
 
Al Stone afae4e
         /* Subtreelength doesn't include length of package length bytes */
Al Stone afae4e
 
Al Stone afae4e
-        PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
Al Stone afae4e
+        PkgLen = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
Al Stone afae4e
         break;
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone 0a2fbe
@@ -335,8 +332,8 @@ CgWriteAmlOpcode (
Al Stone afae4e
         if (Op->Asl.AmlPkgLenBytes == 1)
Al Stone afae4e
         {
Al Stone afae4e
             /* Simplest case -- no bytes to follow, just write the count */
Al Stone afae4e
-
Al Stone afae4e
-            CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
Al Stone afae4e
+            Byte = ACPI_LOBYTE(PkgLen);
Al Stone afae4e
+            CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
         }
Al Stone afae4e
         else if (Op->Asl.AmlPkgLenBytes != 0)
Al Stone afae4e
         {
Al Stone 0a2fbe
@@ -346,7 +343,7 @@ CgWriteAmlOpcode (
Al Stone afae4e
              */
Al Stone afae4e
             PkgLenFirstByte = (UINT8)
Al Stone afae4e
                 (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
Al Stone afae4e
-                (PkgLen.LenBytes[0] & 0x0F));
Al Stone afae4e
+                (PkgLen & 0x0F));
Al Stone afae4e
 
Al Stone afae4e
             CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
Al Stone afae4e
 
Al Stone 0a2fbe
@@ -354,39 +351,47 @@ CgWriteAmlOpcode (
Al Stone afae4e
              * Shift the length over by the 4 bits we just stuffed
Al Stone afae4e
              * in the first byte
Al Stone afae4e
              */
Al Stone afae4e
-            PkgLen.Len >>= 4;
Al Stone afae4e
+            PkgLen >>= 4;
Al Stone afae4e
 
Al Stone 5f1097
             /*
Al Stone 5f1097
              * Now we can write the remaining bytes -
Al Stone 5f1097
              * either 1, 2, or 3 bytes
Al Stone 5f1097
              */
Al Stone afae4e
-            for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
Al Stone afae4e
+            Byte = ACPI_LOBYTE(PkgLen);
Al Stone afae4e
+            CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
+            if (Op->Asl.AmlPkgLenBytes >= 3)
Al Stone afae4e
+            {
Al Stone afae4e
+                Byte = ACPI_HIBYTE(PkgLen);
Al Stone afae4e
+                CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
+            }
Al Stone afae4e
+            if (Op->Asl.AmlPkgLenBytes >= 4)
Al Stone afae4e
             {
Al Stone afae4e
-                CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
Al Stone afae4e
+                Byte = ACPI_LOBYTE(ACPI_HIWORD(PkgLen));
Al Stone afae4e
+                CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
             }
Al Stone afae4e
         }
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
-    switch (Aml.Opcode)
Al Stone afae4e
+    switch (AmlOpcode)
Al Stone afae4e
     {
Al Stone afae4e
     case AML_BYTE_OP:
Al Stone afae4e
-
Al Stone afae4e
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1);
Al Stone afae4e
+        Byte = (UINT8) Op->Asl.Value.Integer;
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case AML_WORD_OP:
Al Stone afae4e
-
Al Stone afae4e
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2);
Al Stone afae4e
+        ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer);
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &Word, 2);
Al Stone afae4e
        break;
Al Stone afae4e
 
Al Stone afae4e
     case AML_DWORD_OP:
Al Stone afae4e
-
Al Stone afae4e
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4);
Al Stone afae4e
+        ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer);
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &DWord, 4);
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case AML_QWORD_OP:
Al Stone afae4e
-
Al Stone afae4e
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8);
Al Stone afae4e
+        ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &QWord, 8);
Al Stone afae4e
         break;
Al Stone afae4e
 
Al Stone afae4e
     case AML_STRING_OP:
Al Stone 0a2fbe
@@ -420,6 +425,7 @@ CgWriteTableHeader (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *Op)
Al Stone afae4e
 {
Al Stone afae4e
     ACPI_PARSE_OBJECT       *Child;
Al Stone 0a2fbe
+    UINT32                  DWord;
Al Stone 0a2fbe
     UINT32                  CommentLength;
Al Stone 0a2fbe
     ACPI_COMMENT_NODE       *Current;
Al Stone afae4e
 
Al Stone 0a2fbe
@@ -473,7 +479,7 @@ CgWriteTableHeader (
Al Stone afae4e
     /* OEM Revision */
Al Stone afae4e
 
Al Stone afae4e
     Child = Child->Asl.Next;
Al Stone afae4e
-    TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
Al Stone afae4e
+    ACPI_MOVE_64_TO_32(&TableHeader.OemRevision, &Child->Asl.Value.Integer);
Al Stone afae4e
 
Al Stone afae4e
     /* Compiler ID */
Al Stone afae4e
 
Al Stone 0a2fbe
@@ -481,12 +487,13 @@ CgWriteTableHeader (
Al Stone afae4e
 
Al Stone afae4e
     /* Compiler version */
Al Stone afae4e
 
Al Stone 938de5
-    TableHeader.AslCompilerRevision = ACPI_CA_VERSION;
Al Stone 938de5
+    DWord = ACPI_CA_VERSION;
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&TableHeader.AslCompilerRevision, &DWord);
Al Stone afae4e
 
Al Stone afae4e
     /* Table length. Checksum zero for now, will rewrite later */
Al Stone afae4e
 
Al Stone 5f1097
-    TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
Al Stone 5f1097
-        Op->Asl.AmlSubtreeLength;
Al Stone 5f1097
+    DWord = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
Al Stone 5f1097
+    ACPI_MOVE_32_TO_32(&TableHeader.Length, &DWord);
Al Stone afae4e
 
Al Stone 0a2fbe
     /* Calculate the comment lengths for this definition block parseOp */
Al Stone 0a2fbe
 
Al Stone 0a2fbe
@@ -643,7 +650,10 @@ CgWriteNode (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *Op)
Al Stone afae4e
 {
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
-
Al Stone afae4e
+    UINT8                   Byte;
Al Stone afae4e
+    UINT16                  Word;
Al Stone afae4e
+    UINT32                  DWord;
Al Stone afae4e
+    UINT64                  QWord;
Al Stone afae4e
 
Al Stone 0a2fbe
     /* Write all comments here. */
Al Stone 0a2fbe
     if (Gbl_CaptureComments)
Al Stone 0a2fbe
@@ -672,13 +682,24 @@ CgWriteNode (
Al Stone afae4e
     switch (Op->Asl.AmlOpcode)
Al Stone afae4e
     {
Al Stone afae4e
     case AML_RAW_DATA_BYTE:
Al Stone afae4e
+        Byte = (UINT8) Op->Asl.Value.Integer;
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &Byte, 1);
Al Stone afae4e
+        return;
Al Stone afae4e
+
Al Stone afae4e
     case AML_RAW_DATA_WORD:
Al Stone afae4e
-    case AML_RAW_DATA_DWORD:
Al Stone afae4e
-    case AML_RAW_DATA_QWORD:
Al Stone afae4e
+        ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer);
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &Word, 2);
Al Stone afae4e
+        return;
Al Stone afae4e
 
Al Stone afae4e
-        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength);
Al Stone afae4e
+    case AML_RAW_DATA_DWORD:
Al Stone afae4e
+        ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer);
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &DWord, 4);
Al Stone afae4e
         return;
Al Stone afae4e
 
Al Stone afae4e
+    case AML_RAW_DATA_QWORD:
Al Stone afae4e
+        ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
Al Stone afae4e
+        CgLocalWriteAmlData (Op, &QWord, 8);
Al Stone afae4e
+        return;
Al Stone afae4e
 
Al Stone afae4e
     case AML_RAW_DATA_BUFFER:
Al Stone afae4e
 
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslopcodes.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslopcodes.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslopcodes.c
Al Stone 5c5a61
@@ -485,6 +485,7 @@ OpcDoUnicode (
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     UINT8                   *AsciiString;
Al Stone afae4e
     UINT16                  *UnicodeString;
Al Stone afae4e
+    UINT16                  UChar;
Al Stone afae4e
     ACPI_PARSE_OBJECT       *BufferLengthOp;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 5c5a61
@@ -511,7 +512,8 @@ OpcDoUnicode (
Al Stone afae4e
 
Al Stone afae4e
     for (i = 0; i < Count; i++)
Al Stone afae4e
     {
Al Stone afae4e
-        UnicodeString[i] = (UINT16) AsciiString[i];
Al Stone afae4e
+        UChar = (UINT16) AsciiString[i];
Al Stone afae4e
+        ACPI_MOVE_16_TO_16(&UnicodeString[i], &UChar);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
     /*
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype1.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype1.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype1.c
Al Stone 5f1097
@@ -142,6 +142,11 @@ RsDoMemory24Descriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *LengthOp = NULL;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
+    UINT16                  Minimum = 0;
Al Stone afae4e
+    UINT16                  Maximum = 0;
Al Stone afae4e
+    UINT16                  AddressLength = 0;
Al Stone afae4e
+    UINT16                  Alignment = 0;
Al Stone afae4e
+    UINT16                  ResourceLength;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 5f1097
@@ -151,7 +156,8 @@ RsDoMemory24Descriptor (
Al Stone afae4e
 
Al Stone afae4e
     Descriptor = Rnode->Buffer;
Al Stone 5f1097
     Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
Al Stone afae4e
-    Descriptor->Memory24.ResourceLength = 9;
Al Stone afae4e
+    ResourceLength = 9;
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.ResourceLength, &ResourceLength);
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone afae4e
 
Al Stone 5f1097
@@ -168,7 +174,7 @@ RsDoMemory24Descriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 1: /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 5f1097
@@ -176,7 +182,7 @@ RsDoMemory24Descriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 5f1097
@@ -184,14 +190,14 @@ RsDoMemory24Descriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 3: /* Alignment */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 4: /* Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 5f1097
@@ -214,12 +220,17 @@ RsDoMemory24Descriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
Al Stone afae4e
 
Al Stone afae4e
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
Al Stone afae4e
-        Descriptor->Memory24.Minimum,
Al Stone afae4e
-        Descriptor->Memory24.Maximum,
Al Stone afae4e
-        Descriptor->Memory24.AddressLength,
Al Stone afae4e
-        Descriptor->Memory24.Alignment,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Alignment,
Al Stone c32859
         MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Alignment, &Alignment);
Al Stone afae4e
+
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone afae4e
 
Al Stone 5f1097
@@ -248,6 +259,11 @@ RsDoMemory32Descriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *AlignOp = NULL;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
+    UINT32                  Minimum = 0;
Al Stone afae4e
+    UINT32                  Maximum = 0;
Al Stone afae4e
+    UINT32                  AddressLength = 0;
Al Stone afae4e
+    UINT32                  Alignment = 0;
Al Stone afae4e
+    UINT16                  ResourceLength;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 5f1097
@@ -257,7 +273,8 @@ RsDoMemory32Descriptor (
Al Stone afae4e
 
Al Stone afae4e
     Descriptor = Rnode->Buffer;
Al Stone 5f1097
     Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
Al Stone afae4e
-    Descriptor->Memory32.ResourceLength = 17;
Al Stone afae4e
+    ResourceLength = 17;
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Memory32.ResourceLength, &ResourceLength);
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone afae4e
 
Al Stone 5f1097
@@ -274,7 +291,7 @@ RsDoMemory32Descriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 1:  /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 5f1097
@@ -282,7 +299,7 @@ RsDoMemory32Descriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 5f1097
@@ -290,7 +307,7 @@ RsDoMemory32Descriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 3: /* Alignment */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
Al Stone afae4e
             AlignOp = InitializerOp;
Al Stone 5f1097
@@ -298,7 +315,7 @@ RsDoMemory32Descriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 4: /* Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 5f1097
@@ -321,12 +338,17 @@ RsDoMemory32Descriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Align values */
Al Stone afae4e
 
Al Stone afae4e
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
Al Stone afae4e
-        Descriptor->Memory32.Minimum,
Al Stone afae4e
-        Descriptor->Memory32.Maximum,
Al Stone afae4e
-        Descriptor->Memory32.AddressLength,
Al Stone afae4e
-        Descriptor->Memory32.Alignment,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Alignment,
Al Stone c32859
         MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Alignment, &Alignment);
Al Stone afae4e
+
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone afae4e
 
Al Stone 5f1097
@@ -351,6 +373,7 @@ RsDoMemory32FixedDescriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
+    UINT16                  ResourceLength;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 5f1097
@@ -360,7 +383,8 @@ RsDoMemory32FixedDescriptor (
Al Stone afae4e
 
Al Stone afae4e
     Descriptor = Rnode->Buffer;
Al Stone 5f1097
     Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
Al Stone afae4e
-    Descriptor->FixedMemory32.ResourceLength = 9;
Al Stone afae4e
+    ResourceLength = 9;
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedMemory32.ResourceLength, &ResourceLength);
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone afae4e
 
Al Stone 5f1097
@@ -377,14 +401,16 @@ RsDoMemory32FixedDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 1: /* Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.Address,
Al Stone afae4e
+                &InitializerOp->Asl.Value.Integer);
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.AddressLength,
Al Stone afae4e
+                &InitializerOp->Asl.Value.Integer);
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
Al Stone afae4e
             break;
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype1i.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype1i.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype1i.c
Al Stone 938de5
@@ -198,6 +198,8 @@ RsDoFixedDmaDescriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
+    UINT16                  RequestLines = 0;
Al Stone afae4e
+    UINT16                  Channels = 0;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 938de5
@@ -217,14 +219,14 @@ RsDoFixedDmaDescriptor (
Al Stone afae4e
         {
Al Stone afae4e
         case 0: /* DMA Request Lines [WORD] (_DMA) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 1: /* DMA Channel [WORD] (_TYP) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Channels = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels));
Al Stone afae4e
             break;
Al Stone 938de5
@@ -249,6 +251,9 @@ RsDoFixedDmaDescriptor (
Al Stone afae4e
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.RequestLines, &RequestLines);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.Channels, &Channels);
Al Stone afae4e
+
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone afae4e
 
Al Stone 938de5
@@ -274,6 +279,7 @@ RsDoFixedIoDescriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *AddressOp = NULL;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
+    UINT16                  Address = 0;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 938de5
@@ -293,8 +299,7 @@ RsDoFixedIoDescriptor (
Al Stone afae4e
         {
Al Stone afae4e
         case 0: /* Base Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->FixedIo.Address =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Address = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
Al Stone afae4e
             AddressOp = InitializerOp;
Al Stone 938de5
@@ -324,11 +329,13 @@ RsDoFixedIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
     /* Error checks */
Al Stone afae4e
 
Al Stone afae4e
-    if (Descriptor->FixedIo.Address > 0x03FF)
Al Stone afae4e
+    if (Address > 0x03FF)
Al Stone afae4e
     {
Al Stone afae4e
         AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->FixedIo.Address, &Address);
Al Stone afae4e
+
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone afae4e
 
Al Stone 938de5
@@ -357,6 +364,8 @@ RsDoIoDescriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *AlignOp = NULL;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
+    UINT16                  Minimum = 0;
Al Stone afae4e
+    UINT16                  Maximum = 0;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 938de5
@@ -383,8 +392,7 @@ RsDoIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 1:  /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Io.Minimum =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -392,8 +400,7 @@ RsDoIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Io.Maximum =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -434,12 +441,15 @@ RsDoIoDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Align values */
Al Stone afae4e
 
Al Stone afae4e
     RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
Al Stone afae4e
-        Descriptor->Io.Minimum,
Al Stone afae4e
-        Descriptor->Io.Maximum,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
         Descriptor->Io.AddressLength,
Al Stone afae4e
         Descriptor->Io.Alignment,
Al Stone c32859
         MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Io.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Io.Maximum, &Maximum);
Al Stone afae4e
+
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone afae4e
 
Al Stone 938de5
@@ -559,9 +569,9 @@ RsDoIrqDescriptor (
Al Stone afae4e
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
-    /* Now we can set the channel mask */
Al Stone afae4e
+    /* Now we can set the interrupt mask */
Al Stone afae4e
 
Al Stone afae4e
-    Descriptor->Irq.IrqMask = IrqMask;
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone afae4e
 
Al Stone 938de5
@@ -660,6 +670,6 @@ RsDoIrqNoFlagsDescriptor (
Al Stone afae4e
 
Al Stone afae4e
     /* Now we can set the interrupt mask */
Al Stone afae4e
 
Al Stone afae4e
-    Descriptor->Irq.IrqMask = IrqMask;
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype2.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype2.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype2.c
Al Stone 938de5
@@ -76,6 +76,7 @@ RsDoGeneralRegisterDescriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
+    UINT16                  ResourceLength;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 938de5
@@ -85,7 +86,9 @@ RsDoGeneralRegisterDescriptor (
Al Stone afae4e
 
Al Stone afae4e
     Descriptor = Rnode->Buffer;
Al Stone afae4e
     Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
Al Stone afae4e
-    Descriptor->GenericReg.ResourceLength = 12;
Al Stone afae4e
+    ResourceLength = 12;
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->GenericReg.ResourceLength,
Al Stone afae4e
+		    &ResourceLength);
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone afae4e
 
Al Stone 938de5
@@ -116,7 +119,8 @@ RsDoGeneralRegisterDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 3: /* Register Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+	    ACPI_MOVE_64_TO_64(&Descriptor->GenericReg.Address,
Al Stone afae4e
+			    &InitializerOp->Asl.Value.Integer);
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
Al Stone afae4e
             break;
Al Stone 5c5a61
@@ -177,6 +181,7 @@ RsDoInterruptDescriptor (
Al Stone afae4e
     AML_RESOURCE            *Rover = NULL;
Al Stone afae4e
     ACPI_PARSE_OBJECT       *InitializerOp;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone 5c5a61
@@ -225,7 +230,7 @@ RsDoInterruptDescriptor (
Al Stone afae4e
      * Initial descriptor length -- may be enlarged if there are
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
-    Descriptor->ExtendedIrq.ResourceLength  = 2;  /* Flags and table length byte */
Al Stone afae4e
+    ResourceLength  = 2;  /* Flags and table length byte */
Al Stone afae4e
     Descriptor->ExtendedIrq.InterruptCount  = 0;
Al Stone afae4e
 
Al Stone afae4e
     Rover = ACPI_CAST_PTR (AML_RESOURCE,
Al Stone 5c5a61
@@ -333,10 +338,11 @@ RsDoInterruptDescriptor (
Al Stone afae4e
 
Al Stone afae4e
             /* Save the integer and move pointer to the next one */
Al Stone afae4e
 
Al Stone afae4e
-            Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            ACPI_MOVE_64_TO_32(&Rover->DwordItem,
Al Stone afae4e
+                &InitializerOp->Asl.Value.Integer);
Al Stone afae4e
             Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);
Al Stone afae4e
             Descriptor->ExtendedIrq.InterruptCount++;
Al Stone afae4e
-            Descriptor->ExtendedIrq.ResourceLength += 4;
Al Stone afae4e
+            ResourceLength += 4;
Al Stone afae4e
 
Al Stone afae4e
             /* Case 7: First interrupt number in list */
Al Stone afae4e
 
Al Stone 5c5a61
@@ -372,7 +378,7 @@ RsDoInterruptDescriptor (
Al Stone afae4e
     {
Al Stone afae4e
         Rover->ByteItem = ResSourceIndex;
Al Stone afae4e
         Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1);
Al Stone afae4e
-        Descriptor->ExtendedIrq.ResourceLength += 1;
Al Stone afae4e
+        ResourceLength += 1;
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
     /* Add optional ResSource string if present */
Al Stone 5c5a61
@@ -384,14 +390,15 @@ RsDoInterruptDescriptor (
Al Stone afae4e
         Rover = ACPI_ADD_PTR (
Al Stone afae4e
                     AML_RESOURCE, &(Rover->ByteItem), StringLength);
Al Stone afae4e
 
Al Stone afae4e
-        Descriptor->ExtendedIrq.ResourceLength = (UINT16)
Al Stone afae4e
-            (Descriptor->ExtendedIrq.ResourceLength + StringLength);
Al Stone afae4e
+        ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone 5f1097
     Rnode->BufferLength =
Al Stone 5f1097
         (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
Al Stone 5f1097
         ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))
Al Stone 5f1097
         + OptionIndex + StringLength;
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->ExtendedIrq.ResourceLength,
Al Stone afae4e
+		    &ResourceLength);
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone afae4e
 
Al Stone 5c5a61
@@ -439,7 +446,7 @@ RsDoVendorLargeDescriptor (
Al Stone afae4e
 
Al Stone afae4e
     Descriptor = Rnode->Buffer;
Al Stone 5f1097
     Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
Al Stone afae4e
-    Descriptor->VendorLarge.ResourceLength = (UINT16) i;
Al Stone afae4e
+    ACPI_MOVE_32_TO_16(&Descriptor->VendorLarge.ResourceLength, &i);
Al Stone afae4e
 
Al Stone afae4e
     /* Point to end-of-descriptor for vendor data */
Al Stone afae4e
 
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype2d.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype2d.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype2d.c
Al Stone 938de5
@@ -79,7 +79,13 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *GranOp = NULL;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT32                  Minimum = 0;
Al Stone afae4e
+    UINT32                  Maximum = 0;
Al Stone afae4e
+    UINT32                  AddressLength = 0;
Al Stone afae4e
+    UINT32                  Granularity = 0;
Al Stone afae4e
+    UINT32                  TranslationOffset = 0;
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone 938de5
@@ -102,8 +108,7 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
Al Stone afae4e
-    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -147,8 +152,7 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 5: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Granularity =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -156,8 +160,7 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Min */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Minimum =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -165,8 +168,7 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Address Max */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Maximum =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -174,16 +176,14 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.TranslationOffset =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.AddressLength =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone c32859
@@ -197,7 +197,7 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address32.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -211,8 +211,7 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
                 {
Al Stone afae4e
                     /* Found a valid ResourceSource */
Al Stone afae4e
 
Al Stone afae4e
-                    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address32.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -272,13 +271,20 @@ RsDoDwordIoDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Minimum,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Maximum,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.AddressLength,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address32.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone c32859
@@ -310,7 +316,13 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT32                  Minimum = 0;
Al Stone afae4e
+    UINT32                  Maximum = 0;
Al Stone afae4e
+    UINT32                  AddressLength = 0;
Al Stone afae4e
+    UINT32                  Granularity = 0;
Al Stone afae4e
+    UINT32                  TranslationOffset = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 938de5
@@ -332,11 +344,9 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
Al Stone afae4e
-    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
-
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone afae4e
 
Al Stone afae4e
     for (i = 0; InitializerOp; i++)
Al Stone 938de5
@@ -385,8 +395,7 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Granularity =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -394,8 +403,7 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Minimum =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -403,8 +411,7 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Maximum =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -412,16 +419,14 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.TranslationOffset =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 10: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.AddressLength =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -433,7 +438,7 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address32.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -445,8 +450,8 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address32.ResourceLength + StringLength);
Al Stone afae4e
+
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -507,13 +512,20 @@ RsDoDwordMemoryDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Minimum,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Maximum,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.AddressLength,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address32.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone 938de5
@@ -545,7 +557,13 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT32                  Minimum = 0;
Al Stone afae4e
+    UINT32                  Maximum = 0;
Al Stone afae4e
+    UINT32                  AddressLength = 0;
Al Stone afae4e
+    UINT32                  Granularity = 0;
Al Stone afae4e
+    UINT32                  TranslationOffset = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 938de5
@@ -566,8 +584,7 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
Al Stone afae4e
-    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -616,8 +633,7 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Granularity =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -625,8 +641,7 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Minimum =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -634,8 +649,7 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.Maximum =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -643,16 +657,14 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.TranslationOffset =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 10: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address32.AddressLength =
Al Stone afae4e
-                (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -664,7 +676,7 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address32.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -676,8 +688,7 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address32.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address32.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -724,13 +735,20 @@ RsDoDwordSpaceDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Minimum,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Maximum,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.AddressLength,
Al Stone afae4e
-        (UINT64) Descriptor->Address32.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address32.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype2e.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype2e.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype2e.c
Al Stone 938de5
@@ -78,6 +78,13 @@ RsDoExtendedIoDescriptor (
Al Stone afae4e
     ACPI_PARSE_OBJECT       *GranOp = NULL;
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
+    UINT64                  Minimum = 0;
Al Stone afae4e
+    UINT64                  Maximum = 0;
Al Stone afae4e
+    UINT64                  AddressLength = 0;
Al Stone afae4e
+    UINT64                  Granularity = 0;
Al Stone afae4e
+    UINT64                  TranslationOffset = 0;
Al Stone afae4e
+    UINT64                  TypeSpecific = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone 938de5
@@ -94,9 +101,10 @@ RsDoExtendedIoDescriptor (
Al Stone 5f1097
     Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
Al Stone 5f1097
     Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
Al Stone afae4e
 
Al Stone 5f1097
-    Descriptor->ExtAddress64.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
Al Stone afae4e
+    ResourceLength  = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->ExtAddress64.ResourceLength,
Al Stone afae4e
+        &ResourceLength);
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone afae4e
 
Al Stone 938de5
@@ -139,7 +147,7 @@ RsDoExtendedIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 5: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -147,7 +155,7 @@ RsDoExtendedIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Min */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -155,7 +163,7 @@ RsDoExtendedIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Address Max */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -163,14 +171,14 @@ RsDoExtendedIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -178,7 +186,7 @@ RsDoExtendedIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 10: /* Type-Specific Attributes */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TypeSpecific = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
Al Stone afae4e
             break;
Al Stone 938de5
@@ -214,13 +222,20 @@ RsDoExtendedIoDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        Descriptor->ExtAddress64.Minimum,
Al Stone afae4e
-        Descriptor->ExtAddress64.Maximum,
Al Stone afae4e
-        Descriptor->ExtAddress64.AddressLength,
Al Stone afae4e
-        Descriptor->ExtAddress64.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->ExtAddress64.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TypeSpecific, &TypeSpecific);
Al Stone afae4e
+
Al Stone c32859
     Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
Al Stone c32859
         StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype2q.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype2q.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype2q.c
Al Stone 938de5
@@ -80,7 +80,13 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT64                  Minimum = 0;
Al Stone afae4e
+    UINT64                  Maximum = 0;
Al Stone afae4e
+    UINT64                  AddressLength = 0;
Al Stone afae4e
+    UINT64                  Granularity = 0;
Al Stone afae4e
+    UINT64                  TranslationOffset = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 938de5
@@ -102,8 +108,7 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
Al Stone afae4e
-    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -147,7 +152,7 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 5: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -155,7 +160,7 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Min */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -163,7 +168,7 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Address Max */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -171,14 +176,14 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -190,7 +195,7 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address64.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -202,8 +207,7 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address64.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -263,13 +267,20 @@ RsDoQwordIoDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        Descriptor->Address64.Minimum,
Al Stone afae4e
-        Descriptor->Address64.Maximum,
Al Stone afae4e
-        Descriptor->Address64.AddressLength,
Al Stone afae4e
-        Descriptor->Address64.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address64.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone 938de5
@@ -301,7 +312,13 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT64                  Minimum = 0;
Al Stone afae4e
+    UINT64                  Maximum = 0;
Al Stone afae4e
+    UINT64                  AddressLength = 0;
Al Stone afae4e
+    UINT64                  Granularity = 0;
Al Stone afae4e
+    UINT64                  TranslationOffset = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 938de5
@@ -323,8 +340,7 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
Al Stone afae4e
-    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -375,7 +391,7 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -383,7 +399,7 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -391,7 +407,7 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -399,14 +415,14 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 10: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -418,7 +434,7 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address64.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -430,8 +446,7 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address64.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -492,13 +507,20 @@ RsDoQwordMemoryDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        Descriptor->Address64.Minimum,
Al Stone afae4e
-        Descriptor->Address64.Maximum,
Al Stone afae4e
-        Descriptor->Address64.AddressLength,
Al Stone afae4e
-        Descriptor->Address64.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address64.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone 938de5
@@ -530,9 +552,15 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
     ASL_RESOURCE_NODE       *Rnode;
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
+    UINT64                  Minimum = 0;
Al Stone afae4e
+    UINT64                  Maximum = 0;
Al Stone afae4e
+    UINT64                  AddressLength = 0;
Al Stone afae4e
+    UINT64                  Granularity = 0;
Al Stone afae4e
+    UINT64                  TranslationOffset = 0;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone afae4e
 
Al Stone afae4e
 
Al Stone 938de5
@@ -551,8 +579,7 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
Al Stone afae4e
-    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -601,7 +628,7 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -609,7 +636,7 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -617,7 +644,7 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -625,14 +652,14 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 10: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -644,7 +671,7 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address64.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -656,8 +683,7 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address64.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address64.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -703,13 +729,20 @@ RsDoQwordSpaceDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        Descriptor->Address64.Minimum,
Al Stone afae4e
-        Descriptor->Address64.Maximum,
Al Stone afae4e
-        Descriptor->Address64.AddressLength,
Al Stone afae4e
-        Descriptor->Address64.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address64.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype2s.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype2s.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype2s.c
Al Stone b0fde5
@@ -340,6 +340,9 @@ RsDoGpioIntDescriptor (
Al Stone afae4e
     UINT16                  VendorLength;
Al Stone afae4e
     UINT16                  InterruptLength;
Al Stone afae4e
     UINT16                  DescriptorSize;
Al Stone afae4e
+    UINT16                  IntFlags = 0;
Al Stone afae4e
+    UINT16                  DebounceTimeout = 0;
Al Stone afae4e
+    UINT16                  Flags = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone c32859
     UINT32                  PinCount = 0;
Al Stone afae4e
     UINT32                  i;
Al Stone b0fde5
@@ -396,21 +399,21 @@ RsDoGpioIntDescriptor (
Al Stone afae4e
         {
Al Stone afae4e
         case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0);
Al Stone afae4e
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0);
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 1, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 1, 0);
Al Stone afae4e
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_POLARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 1, 2);
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0);
Al Stone afae4e
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3, 2);
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -424,7 +427,7 @@ RsDoGpioIntDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 4: /* Debounce Timeout [WORD] (_DBT) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -451,7 +454,7 @@ RsDoGpioIntDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Resource Usage (consumer/producer) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
Al Stone afae4e
+            RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Resource Tag (Descriptor Name) */
Al Stone b0fde5
@@ -516,6 +519,10 @@ RsDoGpioIntDescriptor (
Al Stone afae4e
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags);
Al Stone afae4e
+
Al Stone 5f1097
     MpSaveGpioInfo (Info->MappingOp, Descriptor,
Al Stone 5f1097
         PinCount, PinList, ResourceSource);
Al Stone afae4e
     return (Rnode);
Al Stone b0fde5
@@ -549,6 +556,10 @@ RsDoGpioIoDescriptor (
Al Stone afae4e
     UINT16                  VendorLength;
Al Stone afae4e
     UINT16                  InterruptLength;
Al Stone afae4e
     UINT16                  DescriptorSize;
Al Stone afae4e
+    UINT16                  IntFlags = 0;
Al Stone afae4e
+    UINT16                  DebounceTimeout = 0;
Al Stone afae4e
+    UINT16                  DriveStrength = 0;
Al Stone afae4e
+    UINT16                  Flags = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone c32859
     UINT32                  PinCount = 0;
Al Stone afae4e
     UINT32                  i;
Al Stone b0fde5
@@ -605,7 +616,7 @@ RsDoGpioIoDescriptor (
Al Stone afae4e
         {
Al Stone afae4e
         case 0: /* Share Type [Flags] (_SHR) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0);
Al Stone afae4e
             RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3);
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -619,21 +630,21 @@ RsDoGpioIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Debounce Timeout [WORD] (_DBT) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 3: /* Drive Strength [WORD] (_DRS) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 4: /* I/O Restriction [Flag] (_IOR) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0);
Al Stone afae4e
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2);
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -659,7 +670,7 @@ RsDoGpioIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Resource Usage (consumer/producer) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
Al Stone afae4e
+            RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Resource Tag (Descriptor Name) */
Al Stone b0fde5
@@ -723,6 +734,11 @@ RsDoGpioIoDescriptor (
Al Stone afae4e
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DriveStrength, &DriveStrength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags);
Al Stone afae4e
+
Al Stone 5f1097
     MpSaveGpioInfo (Info->MappingOp, Descriptor,
Al Stone 5f1097
         PinCount, PinList, ResourceSource);
Al Stone afae4e
     return (Rnode);
Al Stone b0fde5
@@ -753,6 +769,9 @@ RsDoI2cSerialBusDescriptor (
Al Stone afae4e
     UINT16                  ResSourceLength;
Al Stone afae4e
     UINT16                  VendorLength;
Al Stone afae4e
     UINT16                  DescriptorSize;
Al Stone afae4e
+    UINT16                  SlaveAddress = 0;
Al Stone afae4e
+    UINT32                  ConnectionSpeed = 0;
Al Stone afae4e
+    UINT16                  TypeSpecificFlags = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone b0fde5
@@ -802,7 +821,7 @@ RsDoI2cSerialBusDescriptor (
Al Stone afae4e
         {
Al Stone afae4e
         case 0: /* Slave Address [WORD] (_ADR) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -816,14 +835,14 @@ RsDoI2cSerialBusDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Connection Speed [DWORD] (_SPE) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 3: /* Addressing Mode [Flag] (_MOD) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone afae4e
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -883,6 +902,9 @@ RsDoI2cSerialBusDescriptor (
Al Stone afae4e
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.SlaveAddress, &SlaveAddress);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->I2cSerialBus.ConnectionSpeed, &ConnectionSpeed);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
Al Stone c32859
     MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone b0fde5
@@ -912,6 +934,9 @@ RsDoSpiSerialBusDescriptor (
Al Stone afae4e
     UINT16                  ResSourceLength;
Al Stone afae4e
     UINT16                  VendorLength;
Al Stone afae4e
     UINT16                  DescriptorSize;
Al Stone afae4e
+    UINT16                  DeviceSelection = 0;
Al Stone afae4e
+    UINT32                  ConnectionSpeed = 0;
Al Stone afae4e
+    UINT16                  TypeSpecificFlags = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone b0fde5
@@ -962,21 +987,21 @@ RsDoSpiSerialBusDescriptor (
Al Stone afae4e
         {
Al Stone afae4e
         case 0: /* Device Selection [WORD] (_ADR) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 1: /* Device Polarity [Flag] (_DPL) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 1, 0);
Al Stone afae4e
             RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Wire Mode [Flag] (_MOD) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone afae4e
             RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -997,7 +1022,7 @@ RsDoSpiSerialBusDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 5: /* Connection Speed [DWORD] (_SPE) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -1071,6 +1096,10 @@ RsDoSpiSerialBusDescriptor (
Al Stone afae4e
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.DeviceSelection, &DeviceSelection);
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->SpiSerialBus.ConnectionSpeed, &ConnectionSpeed);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
Al Stone afae4e
+
Al Stone c32859
     MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone b0fde5
@@ -1100,6 +1129,10 @@ RsDoUartSerialBusDescriptor (
Al Stone afae4e
     UINT16                  ResSourceLength;
Al Stone afae4e
     UINT16                  VendorLength;
Al Stone afae4e
     UINT16                  DescriptorSize;
Al Stone afae4e
+    UINT32                  DefaultBaudRate = 0;
Al Stone afae4e
+    UINT16                  TypeSpecificFlags = 0;
Al Stone afae4e
+    UINT16                  RxFifoSize = 0;
Al Stone afae4e
+    UINT16                  TxFifoSize = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
 
Al Stone b0fde5
@@ -1149,21 +1182,21 @@ RsDoUartSerialBusDescriptor (
Al Stone afae4e
         {
Al Stone afae4e
         case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 1: /* Bits Per Byte [Flags] (_LEN) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
Al Stone afae4e
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 4, 3);
Al Stone afae4e
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 2: /* Stop Bits [Flags] (_STB) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
Al Stone afae4e
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 2, 1);
Al Stone afae4e
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -1177,7 +1210,7 @@ RsDoUartSerialBusDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 4: /* Endianness [Flag] (_END) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 7, 0);
Al Stone afae4e
             RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -1191,21 +1224,21 @@ RsDoUartSerialBusDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Flow Control [Flags] (_FLC) */
Al Stone afae4e
 
Al Stone afae4e
-            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone afae4e
+            RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
Al Stone afae4e
             RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Rx Buffer Size [WORD] (_RXL) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Tx Buffer Size [WORD] (_TXL) */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
Al Stone afae4e
             break;
Al Stone b0fde5
@@ -1275,6 +1308,11 @@ RsDoUartSerialBusDescriptor (
Al Stone afae4e
         InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
Al Stone afae4e
     }
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_32_TO_32(&Descriptor->UartSerialBus.DefaultBaudRate, &DefaultBaudRate);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.RxFifoSize, &RxFifoSize);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TxFifoSize, &TxFifoSize);
Al Stone afae4e
+
Al Stone c32859
     MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
Al Stone afae4e
     return (Rnode);
Al Stone afae4e
 }
Al Stone b0fde5
Index: acpica-unix2-20170531/source/compiler/aslrestype2w.c
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/compiler/aslrestype2w.c
Al Stone b0fde5
+++ acpica-unix2-20170531/source/compiler/aslrestype2w.c
Al Stone 938de5
@@ -81,6 +81,12 @@ RsDoWordIoDescriptor (
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
+    UINT16                  Minimum = 0;
Al Stone afae4e
+    UINT16                  Maximum = 0;
Al Stone afae4e
+    UINT16                  AddressLength = 0;
Al Stone afae4e
+    UINT16                  Granularity = 0;
Al Stone afae4e
+    UINT16                  TranslationOffset = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 938de5
@@ -102,8 +108,7 @@ RsDoWordIoDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
Al Stone afae4e
-    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -147,7 +152,7 @@ RsDoWordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 5: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -155,7 +160,7 @@ RsDoWordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Min */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -163,7 +168,7 @@ RsDoWordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Address Max */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -171,14 +176,14 @@ RsDoWordIoDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -190,7 +195,7 @@ RsDoWordIoDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address16.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -202,8 +207,7 @@ RsDoWordIoDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address16.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -263,13 +267,20 @@ RsDoWordIoDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Minimum,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Maximum,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.AddressLength,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address16.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone 938de5
@@ -302,6 +313,12 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone afae4e
+    UINT16                  Minimum = 0;
Al Stone afae4e
+    UINT16                  Maximum = 0;
Al Stone afae4e
+    UINT16                  AddressLength = 0;
Al Stone afae4e
+    UINT16                  Granularity = 0;
Al Stone afae4e
+    UINT16                  TranslationOffset = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 938de5
@@ -323,8 +340,7 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
Al Stone afae4e
-    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -361,8 +377,7 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 4: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Granularity =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -370,8 +385,7 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 5: /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Minimum =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -379,8 +393,7 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Maximum =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -388,16 +401,14 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.TranslationOffset =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.AddressLength =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -409,7 +420,7 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address16.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -421,8 +432,7 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address16.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -468,13 +478,20 @@ RsDoWordBusNumberDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Minimum,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Maximum,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.AddressLength,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address16.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone 938de5
@@ -507,6 +524,12 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
     UINT8                   *OptionalFields;
Al Stone afae4e
     UINT16                  StringLength = 0;
Al Stone afae4e
     UINT32                  OptionIndex = 0;
Al Stone afae4e
+    UINT16                  Minimum = 0;
Al Stone afae4e
+    UINT16                  Maximum = 0;
Al Stone afae4e
+    UINT16                  AddressLength = 0;
Al Stone afae4e
+    UINT16                  Granularity = 0;
Al Stone afae4e
+    UINT16                  TranslationOffset = 0;
Al Stone afae4e
+    UINT16                  ResourceLength = 0;
Al Stone c32859
     UINT32                  CurrentByteOffset;
Al Stone afae4e
     UINT32                  i;
Al Stone afae4e
     BOOLEAN                 ResSourceIndex = FALSE;
Al Stone 938de5
@@ -527,8 +550,7 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
      * optional fields present
Al Stone afae4e
      */
Al Stone afae4e
     OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
Al Stone afae4e
-    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone afae4e
-        (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone afae4e
+    ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
Al Stone afae4e
          sizeof (AML_RESOURCE_LARGE_HEADER));
Al Stone afae4e
 
Al Stone afae4e
     /* Process all child initialization nodes */
Al Stone 938de5
@@ -577,8 +599,7 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 6: /* Address Granularity */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Granularity =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
Al Stone afae4e
             GranOp = InitializerOp;
Al Stone 938de5
@@ -586,8 +607,7 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 7: /* Min Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Minimum =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
Al Stone afae4e
             MinOp = InitializerOp;
Al Stone 938de5
@@ -595,8 +615,7 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 8: /* Max Address */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.Maximum =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
Al Stone afae4e
             MaxOp = InitializerOp;
Al Stone 938de5
@@ -604,16 +623,14 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
 
Al Stone afae4e
         case 9: /* Translation Offset */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.TranslationOffset =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
Al Stone afae4e
             break;
Al Stone afae4e
 
Al Stone afae4e
         case 10: /* Address Length */
Al Stone afae4e
 
Al Stone afae4e
-            Descriptor->Address16.AddressLength =
Al Stone afae4e
-                (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
+            AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
             RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
Al Stone afae4e
                 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
Al Stone afae4e
             LengthOp = InitializerOp;
Al Stone 938de5
@@ -625,7 +642,7 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
Al Stone afae4e
                 OptionIndex++;
Al Stone afae4e
-                Descriptor->Address16.ResourceLength++;
Al Stone afae4e
+                ResourceLength++;
Al Stone afae4e
                 ResSourceIndex = TRUE;
Al Stone afae4e
             }
Al Stone afae4e
             break;
Al Stone 938de5
@@ -637,8 +654,7 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
             {
Al Stone afae4e
                 if (StringLength)
Al Stone afae4e
                 {
Al Stone afae4e
-                    Descriptor->Address16.ResourceLength = (UINT16)
Al Stone afae4e
-                        (Descriptor->Address16.ResourceLength + StringLength);
Al Stone afae4e
+                    ResourceLength = (UINT16) (ResourceLength + StringLength);
Al Stone afae4e
 
Al Stone afae4e
                     strcpy ((char *)
Al Stone afae4e
                         &OptionalFields[OptionIndex],
Al Stone 938de5
@@ -684,13 +700,20 @@ RsDoWordSpaceDescriptor (
Al Stone afae4e
     /* Validate the Min/Max/Len/Gran values */
Al Stone afae4e
 
Al Stone afae4e
     RsLargeAddressCheck (
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Minimum,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Maximum,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.AddressLength,
Al Stone afae4e
-        (UINT64) Descriptor->Address16.Granularity,
Al Stone afae4e
+        Minimum,
Al Stone afae4e
+        Maximum,
Al Stone afae4e
+        AddressLength,
Al Stone afae4e
+        Granularity,
Al Stone afae4e
         Descriptor->Address16.Flags,
Al Stone c32859
         MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
Al Stone afae4e
 
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
Al Stone afae4e
+    ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
Al Stone afae4e
+
Al Stone afae4e
     Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
Al Stone c32859
         OptionIndex + StringLength;
Al Stone afae4e
     return (Rnode);
Al Stone b0fde5
Index: acpica-unix2-20170531/source/include/acmacros.h
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/include/acmacros.h
Al Stone b0fde5
+++ acpica-unix2-20170531/source/include/acmacros.h
Al Stone 938de5
@@ -100,7 +100,8 @@
Al Stone afae4e
 
Al Stone afae4e
 /* 32-bit source, 16/32/64 destination */
Al Stone afae4e
 
Al Stone afae4e
-#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone afae4e
+#define ACPI_MOVE_32_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
Al Stone afae4e
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];}
Al Stone afae4e
 
Al Stone afae4e
 #define ACPI_MOVE_32_TO_32(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
Al Stone afae4e
                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\
Al Stone 938de5
@@ -115,9 +116,13 @@
Al Stone afae4e
 
Al Stone afae4e
 /* 64-bit source, 16/32/64 destination */
Al Stone afae4e
 
Al Stone afae4e
-#define ACPI_MOVE_64_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone afae4e
+#define ACPI_MOVE_64_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
Al Stone afae4e
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];}
Al Stone afae4e
 
Al Stone afae4e
-#define ACPI_MOVE_64_TO_32(d, s)        ACPI_MOVE_32_TO_32(d, s)    /* Truncate to 32 */
Al Stone afae4e
+#define ACPI_MOVE_64_TO_32(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
Al Stone afae4e
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
Al Stone afae4e
+                                         ((  UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\
Al Stone afae4e
+                                         ((  UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];}
Al Stone afae4e
 
Al Stone afae4e
 #define ACPI_MOVE_64_TO_64(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
Al Stone afae4e
                                          ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
Al Stone 938de5
@@ -144,7 +149,9 @@
Al Stone afae4e
 
Al Stone afae4e
 /* 32-bit source, 16/32/64 destination */
Al Stone afae4e
 
Al Stone afae4e
-#define ACPI_MOVE_32_TO_16(d, s)        ACPI_MOVE_16_TO_16(d, s)    /* Truncate to 16 */
Al Stone afae4e
+#define ACPI_MOVE_32_TO_16(d, s)        {((  UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
Al Stone afae4e
+                                         ((  UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
Al Stone afae4e
+
Al Stone afae4e
 #define ACPI_MOVE_32_TO_32(d, s)        *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
Al Stone afae4e
 #define ACPI_MOVE_32_TO_64(d, s)        *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s)
Al Stone afae4e
 
Al Stone b0fde5
Index: acpica-unix2-20170531/source/include/platform/aclinux.h
Al Stone 7d2a7f
===================================================================
Al Stone b0fde5
--- acpica-unix2-20170531.orig/source/include/platform/aclinux.h
Al Stone b0fde5
+++ acpica-unix2-20170531/source/include/platform/aclinux.h
Al Stone 461b6b
@@ -185,6 +185,7 @@
Al Stone d037c9
 
Al Stone d037c9
 #ifdef ACPI_USE_STANDARD_HEADERS
Al Stone afae4e
 #include <unistd.h>
Al Stone afae4e
+#include <endian.h>
Al Stone d037c9
 #endif
Al Stone afae4e
 
Al Stone 6794d0
 /* Define/disable kernel-specific declarators */