]> git.pld-linux.org Git - packages/acpica.git/blob - 0043-Support-DSDT-SSDT-in-a-big-endian-world.patch
777f74a0ae4b23c1c15c53ea3cf25c92d8c829c7
[packages/acpica.git] / 0043-Support-DSDT-SSDT-in-a-big-endian-world.patch
1 From 14d220a34462e61fe69141c86f4c3cd2ae68c279 Mon Sep 17 00:00:00 2001
2 From: Al Stone <ahs3@redhat.com>
3 Date: Wed, 30 Sep 2020 18:59:57 -0600
4 Subject: [PATCH 43/45] Support DSDT/SSDT in a big-endian world.
5
6 NB: this is a very large diff.  The problem is that ResourceTemplates
7 are treated differently during compilation and disassembly so each of
8 the resource types had code that needed to be touched directly.
9
10 In general, however, just reading or writing individual AML opcodes
11 wasn't that much of a change, and most of it was on the codegen side.
12
13 Signed-off-by: Al Stone <ahs3@redhat.com>
14 ---
15  source/common/adwalk.c                     |   3 +-
16  source/common/dmrestag.c                   |   2 +-
17  source/common/dmtables.c                   |  17 +-
18  source/common/dmtbdump.c                   |   3 +-
19  source/common/dmtbdump3.c                  |   8 +-
20  source/compiler/aslcodegen.c               |  59 ++++--
21  source/compiler/aslopcodes.c               |   3 +-
22  source/compiler/aslrestype1.c              |  60 ++++--
23  source/compiler/aslrestype1i.c             |  35 ++--
24  source/compiler/aslrestype2.c              |  20 +-
25  source/compiler/aslrestype2d.c             |  99 ++++++----
26  source/compiler/aslrestype2e.c             |  90 ++++++---
27  source/compiler/aslrestype2q.c             |  81 +++++---
28  source/compiler/aslrestype2s.c             | 214 +++++++++++++++++----
29  source/compiler/aslrestype2w.c             |  94 +++++----
30  source/compiler/dttable2.c                 |   3 +-
31  source/components/disassembler/dmbuffer.c  |  37 +++-
32  source/components/disassembler/dmopcode.c  |  21 +-
33  source/components/disassembler/dmresrc.c   |   2 +-
34  source/components/disassembler/dmresrcl.c  |  43 +++--
35  source/components/disassembler/dmresrcl2.c | 128 +++++++-----
36  source/components/disassembler/dmresrcs.c  |  18 +-
37  source/components/disassembler/dmwalk.c    |   2 +-
38  source/components/namespace/nsaccess.c     |   2 +-
39  source/components/namespace/nsnames.c      |   4 +-
40  source/components/namespace/nsparse.c      |   6 +-
41  source/components/namespace/nsutils.c      |   7 +-
42  source/components/utilities/utresrc.c      |   2 +-
43  28 files changed, 721 insertions(+), 341 deletions(-)
44
45 Index: acpica-unix2-20220331/source/common/adwalk.c
46 ===================================================================
47 --- acpica-unix2-20220331.orig/source/common/adwalk.c
48 +++ acpica-unix2-20220331/source/common/adwalk.c
49 @@ -679,7 +679,8 @@ AcpiDmLoadDescendingOp (
50  
51          if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
52          {
53 -            *ACPI_CAST_PTR (UINT32, &FieldPath[0]) = Op->Named.Name;
54 +            AcpiUtWriteUint (FieldPath, ACPI_NAMESEG_SIZE,
55 +                            &Op->Named.Name, ACPI_NAMESEG_SIZE);
56              FieldPath[4] = 0;
57              Path = FieldPath;
58          }
59 Index: acpica-unix2-20220331/source/common/dmrestag.c
60 ===================================================================
61 --- acpica-unix2-20220331.orig/source/common/dmrestag.c
62 +++ acpica-unix2-20220331/source/common/dmrestag.c
63 @@ -1048,7 +1048,7 @@ AcpiDmAddResourcesToNamespace (
64       * NextOp contains the Aml pointer and the Aml length
65       */
66      AcpiUtWalkAmlResources (NULL, (UINT8 *) NextOp->Named.Data,
67 -        (ACPI_SIZE) NextOp->Common.Value.Integer,
68 +        (ACPI_SIZE) NextOp->Common.Value.Size,
69          AcpiDmAddResourceToNamespace, (void **) BufferNode);
70  }
71  
72 Index: acpica-unix2-20220331/source/common/dmtables.c
73 ===================================================================
74 --- acpica-unix2-20220331.orig/source/common/dmtables.c
75 +++ acpica-unix2-20220331/source/common/dmtables.c
76 @@ -142,6 +142,10 @@ AdCreateTableHeader (
77      ACPI_TABLE_HEADER       *Table)
78  {
79      UINT8                   Checksum;
80 +    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
81 +    UINT32                  OemRevision = AcpiUtReadUint32 (&Table->OemRevision);
82 +    UINT32                  CompilerRevision =
83 +                                AcpiUtReadUint32 (&Table->AslCompilerRevision);
84  
85  
86      /* Reset globals for External statements */
87 @@ -156,7 +160,7 @@ AdCreateTableHeader (
88  
89      AcpiOsPrintf (" * Original Table Header:\n");
90      AcpiOsPrintf (" *     Signature        \"%4.4s\"\n",    Table->Signature);
91 -    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", Table->Length, Table->Length);
92 +    AcpiOsPrintf (" *     Length           0x%8.8X (%u)\n", TableLength, TableLength);
93  
94      /* Print and validate the revision */
95  
96 @@ -188,7 +192,7 @@ AdCreateTableHeader (
97  
98      AcpiOsPrintf ("\n *     Checksum         0x%2.2X",        Table->Checksum);
99  
100 -    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
101 +    Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), TableLength);
102      if (Checksum)
103      {
104          AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
105 @@ -198,9 +202,9 @@ AdCreateTableHeader (
106      AcpiOsPrintf ("\n");
107      AcpiOsPrintf (" *     OEM ID           \"%.6s\"\n",     Table->OemId);
108      AcpiOsPrintf (" *     OEM Table ID     \"%.8s\"\n",     Table->OemTableId);
109 -    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
110 +    AcpiOsPrintf (" *     OEM Revision     0x%8.8X (%u)\n", OemRevision, OemRevision);
111      AcpiOsPrintf (" *     Compiler ID      \"%.4s\"\n",     Table->AslCompilerId);
112 -    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
113 +    AcpiOsPrintf (" *     Compiler Version 0x%8.8X (%u)\n", CompilerRevision, CompilerRevision);
114      AcpiOsPrintf (" */\n");
115  
116      /*
117 @@ -221,7 +225,7 @@ AdCreateTableHeader (
118      AcpiOsPrintf (
119          "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
120          Table->Signature, Table->Revision,
121 -        Table->OemId, Table->OemTableId, Table->OemRevision);
122 +        Table->OemId, Table->OemTableId, OemRevision);
123  }
124  
125  
126 @@ -396,7 +400,8 @@ AdParseTable (
127  
128      fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
129  
130 -    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
131 +    AmlLength = AcpiUtReadUint32 (&Table->Length);
132 +    AmlLength -= sizeof (ACPI_TABLE_HEADER);
133      AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
134  
135      AcpiUtSetIntegerWidth (Table->Revision);
136 Index: acpica-unix2-20220331/source/common/dmtbdump.c
137 ===================================================================
138 --- acpica-unix2-20220331.orig/source/common/dmtbdump.c
139 +++ acpica-unix2-20220331/source/common/dmtbdump.c
140 @@ -392,8 +392,7 @@ AcpiDmDumpXsdt (
141      for (i = 0; i < Entries; i++)
142      {
143          AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
144 -        AcpiOsPrintf ("%8.8X%8.8X\n",
145 -                ACPI_FORMAT_UINT64 (AcpiUtReadUint64 (&Array[i])));
146 +        AcpiOsPrintf ("%16.16lX\n", AcpiUtReadUint64 (&Array[i]));
147          Offset += sizeof (UINT64);
148      }
149  }
150 Index: acpica-unix2-20220331/source/common/dmtbdump3.c
151 ===================================================================
152 --- acpica-unix2-20220331.orig/source/common/dmtbdump3.c
153 +++ acpica-unix2-20220331/source/common/dmtbdump3.c
154 @@ -741,12 +741,13 @@ AcpiDmDumpWpbt (
155  {
156      ACPI_STATUS             Status;
157      ACPI_TABLE_WPBT         *Subtable;
158 +    UINT32                  TableLength = AcpiUtReadUint32 (&Table->Length);
159      UINT16                  ArgumentsLength;
160  
161  
162      /* Dump the main table */
163  
164 -    Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWpbt);
165 +    Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoWpbt);
166      if (ACPI_FAILURE (Status))
167      {
168          return;
169 @@ -755,13 +756,13 @@ AcpiDmDumpWpbt (
170      /* Extract the arguments buffer length from the main table */
171  
172      Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
173 -    ArgumentsLength = Subtable->ArgumentsLength;
174 +    ArgumentsLength = AcpiUtReadUint16 (&Subtable->ArgumentsLength);
175  
176      /* Dump the arguments buffer if present */
177  
178      if (ArgumentsLength)
179      {
180 -        (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
181 +        (void) AcpiDmDumpTable (TableLength, 0, Table, ArgumentsLength,
182              AcpiDmTableInfoWpbt0);
183      }
184  }
185 Index: acpica-unix2-20220331/source/compiler/aslcodegen.c
186 ===================================================================
187 --- acpica-unix2-20220331.orig/source/compiler/aslcodegen.c
188 +++ acpica-unix2-20220331/source/compiler/aslcodegen.c
189 @@ -238,6 +238,10 @@ CgWriteAmlOpcode (
190  {
191      UINT8                   PkgLenFirstByte;
192      UINT32                  i;
193 +    UINT8                   Tmp8;
194 +    UINT16                  Tmp16;
195 +    UINT32                  Tmp32;
196 +    UINT64                  Tmp64;
197      union {
198          UINT16                  Opcode;
199          UINT8                   OpcodeBytes[2];
200 @@ -312,14 +316,15 @@ CgWriteAmlOpcode (
201  
202          /* Check for two-byte opcode */
203  
204 +        Tmp16 = AcpiUtReadUint16 (&Aml.Opcode);
205          if (Aml.Opcode > 0x00FF)
206          {
207              /* Write the high byte first */
208  
209 -            CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1);
210 +            CgLocalWriteAmlData (Op, ((UINT8 *) &Tmp16)+1, 1);
211          }
212  
213 -        CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1);
214 +        CgLocalWriteAmlData (Op, (UINT8 *) &Tmp16, 1);
215  
216          /* Subtreelength doesn't include length of package length bytes */
217  
218 @@ -335,7 +340,8 @@ CgWriteAmlOpcode (
219          {
220              /* Simplest case -- no bytes to follow, just write the count */
221  
222 -            CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
223 +            Tmp8 = (UINT8) PkgLen.Len;
224 +            CgLocalWriteAmlData (Op, &Tmp8, 1);
225          }
226          else if (Op->Asl.AmlPkgLenBytes != 0)
227          {
228 @@ -343,9 +349,10 @@ CgWriteAmlOpcode (
229               * Encode the "bytes to follow" in the first byte, top two bits.
230               * The low-order nybble of the length is in the bottom 4 bits
231               */
232 +            Tmp8 = (UINT8) PkgLen.Len;
233              PkgLenFirstByte = (UINT8)
234                  (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
235 -                (PkgLen.LenBytes[0] & 0x0F));
236 +                (Tmp8 & 0x0F));
237  
238              CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
239  
240 @@ -359,6 +366,9 @@ CgWriteAmlOpcode (
241               * Now we can write the remaining bytes -
242               * either 1, 2, or 3 bytes
243               */
244 +            Tmp32 = PkgLen.Len;
245 +            AcpiUtWriteUint (&PkgLen.Len, Op->Asl.AmlPkgLenBytes,
246 +                &Tmp32, sizeof (UINT32));
247              for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
248              {
249                  CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
250 @@ -370,22 +380,30 @@ CgWriteAmlOpcode (
251      {
252      case AML_BYTE_OP:
253  
254 -        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1);
255 +        Tmp64 = 0;
256 +        AcpiUtWriteUint (&Tmp64, 1, &Op->Asl.Value.Integer, 8);
257 +        CgLocalWriteAmlData (Op, &Tmp64, 1);
258          break;
259  
260      case AML_WORD_OP:
261  
262 -        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2);
263 -       break;
264 +        Tmp64 = 0;
265 +        AcpiUtWriteUint (&Tmp64, 2, &Op->Asl.Value.Integer, 8);
266 +        CgLocalWriteAmlData (Op, &Tmp64, 2);
267 +        break;
268  
269      case AML_DWORD_OP:
270  
271 -        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4);
272 +        Tmp64 = 0;
273 +        AcpiUtWriteUint (&Tmp64, 4, &Op->Asl.Value.Integer, 8);
274 +        CgLocalWriteAmlData (Op, &Tmp64, 4);
275          break;
276  
277      case AML_QWORD_OP:
278  
279 -        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8);
280 +        Tmp64 = 0;
281 +        AcpiUtWriteUint (&Tmp64, 8, &Op->Asl.Value.Integer, 8);
282 +        CgLocalWriteAmlData (Op, &Tmp64, 8);
283          break;
284  
285      case AML_STRING_OP:
286 @@ -423,6 +441,7 @@ CgWriteTableHeader (
287      ACPI_PARSE_OBJECT       *Child;
288      UINT32                  CommentLength;
289      ACPI_COMMENT_NODE       *Current;
290 +    UINT32                  Tmp32;
291  
292  
293      memset (&AslGbl_TableHeader, 0, sizeof (ACPI_TABLE_HEADER));
294 @@ -478,7 +497,9 @@ CgWriteTableHeader (
295      /* OEM Revision */
296  
297      Child = Child->Asl.Next;
298 -    AslGbl_TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
299 +    AcpiUtWriteUint (&Tmp32, sizeof (UINT32),
300 +           &Child->Asl.Value.Integer, sizeof (Child->Asl.Value.Integer));
301 +    AslGbl_TableHeader.OemRevision = Tmp32;
302  
303      /* Compiler ID */
304  
305 @@ -486,7 +507,8 @@ CgWriteTableHeader (
306  
307      /* Compiler version */
308  
309 -    AslGbl_TableHeader.AslCompilerRevision = ACPI_CA_VERSION;
310 +    Tmp32 = ACPI_CA_VERSION;
311 +    AslGbl_TableHeader.AslCompilerRevision = AcpiUtReadUint32 (&Tmp32);
312  
313      /* Table length. Checksum zero for now, will rewrite later */
314  
315 @@ -541,6 +563,15 @@ CgWriteTableHeader (
316      AslGbl_TableHeader.Checksum = 0;
317      Op->Asl.FinalAmlOffset = ftell (AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle);
318  
319 +    /*
320 +     * Adjust the Table length; it will only change when big-endian
321 +     * but we have to wait until here in case there is arithmetic to
322 +     * be done on the length before this step in the function
323 +     */
324 +
325 +    Tmp32 = AslGbl_TableHeader.Length;
326 +    AslGbl_TableHeader.Length = AcpiUtReadUint32 (&Tmp32);
327 +
328      /* Write entire header and clear the table header global */
329  
330      CgLocalWriteAmlData (Op, &AslGbl_TableHeader, sizeof (ACPI_TABLE_HEADER));
331 @@ -625,6 +656,7 @@ CgWriteNode (
332      ACPI_PARSE_OBJECT       *Op)
333  {
334      ASL_RESOURCE_NODE       *Rnode;
335 +    UINT64                  Tmp64;
336  
337  
338      /* Write all comments here. */
339 @@ -653,7 +685,10 @@ CgWriteNode (
340      case AML_RAW_DATA_DWORD:
341      case AML_RAW_DATA_QWORD:
342  
343 -        CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength);
344 +        Tmp64 = 0;
345 +        AcpiUtWriteUint (&Tmp64, Op->Asl.AmlLength,
346 +            &Op->Asl.Value.Integer, sizeof (UINT64));
347 +        CgLocalWriteAmlData (Op, &Tmp64, Op->Asl.AmlLength);
348          return;
349  
350  
351 Index: acpica-unix2-20220331/source/compiler/aslopcodes.c
352 ===================================================================
353 --- acpica-unix2-20220331.orig/source/compiler/aslopcodes.c
354 +++ acpica-unix2-20220331/source/compiler/aslopcodes.c
355 @@ -511,7 +511,8 @@ OpcDoUnicode (
356  
357      for (i = 0; i < Count; i++)
358      {
359 -        UnicodeString[i] = (UINT16) AsciiString[i];
360 +        AcpiUtWriteUint (&UnicodeString[i], sizeof (UINT16),
361 +                &AsciiString[i], sizeof (UINT8));
362      }
363  
364      /*
365 Index: acpica-unix2-20220331/source/compiler/aslrestype1.c
366 ===================================================================
367 --- acpica-unix2-20220331.orig/source/compiler/aslrestype1.c
368 +++ acpica-unix2-20220331/source/compiler/aslrestype1.c
369 @@ -143,6 +143,7 @@ RsDoMemory24Descriptor (
370      ASL_RESOURCE_NODE       *Rnode;
371      UINT32                  CurrentByteOffset;
372      UINT32                  i;
373 +    UINT16                  Tmp16;
374  
375  
376      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
377 @@ -151,7 +152,8 @@ RsDoMemory24Descriptor (
378  
379      Descriptor = Rnode->Buffer;
380      Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
381 -    Descriptor->Memory24.ResourceLength = 9;
382 +    Tmp16 = 9;
383 +    Descriptor->Memory24.ResourceLength = AcpiUtReadUint16 (&Tmp16);
384  
385      /* Process all child initialization nodes */
386  
387 @@ -168,7 +170,8 @@ RsDoMemory24Descriptor (
388  
389          case 1: /* Min Address */
390  
391 -            Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
392 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
393 +            Descriptor->Memory24.Minimum = AcpiUtReadUint16 (&Tmp16);
394              RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
395                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
396              MinOp = InitializerOp;
397 @@ -176,7 +179,8 @@ RsDoMemory24Descriptor (
398  
399          case 2: /* Max Address */
400  
401 -            Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
402 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
403 +            Descriptor->Memory24.Maximum = AcpiUtReadUint16 (&Tmp16);
404              RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
405                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
406              MaxOp = InitializerOp;
407 @@ -184,14 +188,16 @@ RsDoMemory24Descriptor (
408  
409          case 3: /* Alignment */
410  
411 -            Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
412 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
413 +            Descriptor->Memory24.Alignment = AcpiUtReadUint16 (&Tmp16);
414              RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
415                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
416              break;
417  
418          case 4: /* Length */
419  
420 -            Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
421 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
422 +            Descriptor->Memory24.AddressLength = AcpiUtReadUint16 (&Tmp16);
423              RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
424                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
425              LengthOp = InitializerOp;
426 @@ -214,10 +220,10 @@ RsDoMemory24Descriptor (
427      /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
428  
429      RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
430 -        Descriptor->Memory24.Minimum,
431 -        Descriptor->Memory24.Maximum,
432 -        Descriptor->Memory24.AddressLength,
433 -        Descriptor->Memory24.Alignment,
434 +        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Minimum),
435 +        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Maximum),
436 +        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.AddressLength),
437 +        (UINT32) AcpiUtReadUint16 (&Descriptor->Memory24.Alignment),
438          MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
439  
440      return (Rnode);
441 @@ -249,6 +255,8 @@ RsDoMemory32Descriptor (
442      ASL_RESOURCE_NODE       *Rnode;
443      UINT32                  CurrentByteOffset;
444      UINT32                  i;
445 +    UINT16                  Tmp16;
446 +    UINT32                  Tmp32;
447  
448  
449      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
450 @@ -257,7 +265,8 @@ RsDoMemory32Descriptor (
451  
452      Descriptor = Rnode->Buffer;
453      Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
454 -    Descriptor->Memory32.ResourceLength = 17;
455 +    Tmp16 = 17;
456 +    Descriptor->Memory32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
457  
458      /* Process all child initialization nodes */
459  
460 @@ -274,7 +283,8 @@ RsDoMemory32Descriptor (
461  
462          case 1:  /* Min Address */
463  
464 -            Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
465 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
466 +            Descriptor->Memory32.Minimum = AcpiUtReadUint32 (&Tmp32);
467              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
468                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
469              MinOp = InitializerOp;
470 @@ -282,7 +292,8 @@ RsDoMemory32Descriptor (
471  
472          case 2: /* Max Address */
473  
474 -            Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
475 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
476 +            Descriptor->Memory32.Maximum = AcpiUtReadUint32 (&Tmp32);
477              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
478                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
479              MaxOp = InitializerOp;
480 @@ -290,7 +301,8 @@ RsDoMemory32Descriptor (
481  
482          case 3: /* Alignment */
483  
484 -            Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
485 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
486 +            Descriptor->Memory32.Alignment = AcpiUtReadUint32 (&Tmp32);
487              RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
488                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
489              AlignOp = InitializerOp;
490 @@ -298,7 +310,8 @@ RsDoMemory32Descriptor (
491  
492          case 4: /* Length */
493  
494 -            Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
495 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
496 +            Descriptor->Memory32.AddressLength = AcpiUtReadUint32 (&Tmp32);
497              RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
498                  CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
499              LengthOp = InitializerOp;
500 @@ -321,10 +334,10 @@ RsDoMemory32Descriptor (
501      /* Validate the Min/Max/Len/Align values */
502  
503      RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
504 -        Descriptor->Memory32.Minimum,
505 -        Descriptor->Memory32.Maximum,
506 -        Descriptor->Memory32.AddressLength,
507 -        Descriptor->Memory32.Alignment,
508 +        AcpiUtReadUint32 (&Descriptor->Memory32.Minimum),
509 +        AcpiUtReadUint32 (&Descriptor->Memory32.Maximum),
510 +        AcpiUtReadUint32 (&Descriptor->Memory32.AddressLength),
511 +        AcpiUtReadUint32 (&Descriptor->Memory32.Alignment),
512          MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
513  
514      return (Rnode);
515 @@ -352,6 +365,8 @@ RsDoMemory32FixedDescriptor (
516      ASL_RESOURCE_NODE       *Rnode;
517      UINT32                  CurrentByteOffset;
518      UINT32                  i;
519 +    UINT16                  Tmp16;
520 +    UINT32                  Tmp32;
521  
522  
523      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
524 @@ -360,7 +375,8 @@ RsDoMemory32FixedDescriptor (
525  
526      Descriptor = Rnode->Buffer;
527      Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
528 -    Descriptor->FixedMemory32.ResourceLength = 9;
529 +    Tmp16 = 9;
530 +    Descriptor->FixedMemory32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
531  
532      /* Process all child initialization nodes */
533  
534 @@ -377,14 +393,16 @@ RsDoMemory32FixedDescriptor (
535  
536          case 1: /* Address */
537  
538 -            Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
539 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
540 +            Descriptor->FixedMemory32.Address = AcpiUtReadUint32 (&Tmp32);
541              RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
542                  CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
543              break;
544  
545          case 2: /* Length */
546  
547 -            Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
548 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
549 +            Descriptor->FixedMemory32.AddressLength = AcpiUtReadUint32 (&Tmp32);
550              RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
551                  CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
552              break;
553 Index: acpica-unix2-20220331/source/compiler/aslrestype1i.c
554 ===================================================================
555 --- acpica-unix2-20220331.orig/source/compiler/aslrestype1i.c
556 +++ acpica-unix2-20220331/source/compiler/aslrestype1i.c
557 @@ -199,6 +199,7 @@ RsDoFixedDmaDescriptor (
558      ASL_RESOURCE_NODE       *Rnode;
559      UINT32                  CurrentByteOffset;
560      UINT32                  i;
561 +    UINT16                  Tmp16;
562  
563  
564      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
565 @@ -217,14 +218,16 @@ RsDoFixedDmaDescriptor (
566          {
567          case 0: /* DMA Request Lines [WORD] (_DMA) */
568  
569 -            Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
570 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
571 +            Descriptor->FixedDma.RequestLines = AcpiUtReadUint16 (&Tmp16);
572              RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA,
573                  CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines));
574              break;
575  
576          case 1: /* DMA Channel [WORD] (_TYP) */
577  
578 -            Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer;
579 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
580 +            Descriptor->FixedDma.Channels = AcpiUtReadUint16 (&Tmp16);
581              RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE,
582                  CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels));
583              break;
584 @@ -275,6 +278,7 @@ RsDoFixedIoDescriptor (
585      ASL_RESOURCE_NODE       *Rnode;
586      UINT32                  CurrentByteOffset;
587      UINT32                  i;
588 +    UINT16                  Tmp16;
589  
590  
591      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
592 @@ -293,8 +297,8 @@ RsDoFixedIoDescriptor (
593          {
594          case 0: /* Base Address */
595  
596 -            Descriptor->FixedIo.Address =
597 -                (UINT16) InitializerOp->Asl.Value.Integer;
598 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
599 +            Descriptor->FixedIo.Address = AcpiUtReadUint16 (&Tmp16);
600              RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
601                  CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
602              AddressOp = InitializerOp;
603 @@ -324,7 +328,7 @@ RsDoFixedIoDescriptor (
604  
605      /* Error checks */
606  
607 -    if (Descriptor->FixedIo.Address > 0x03FF)
608 +    if (AcpiUtReadUint16 (&Descriptor->FixedIo.Address) > 0x03FF)
609      {
610          AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
611      }
612 @@ -358,6 +362,7 @@ RsDoIoDescriptor (
613      ASL_RESOURCE_NODE       *Rnode;
614      UINT32                  CurrentByteOffset;
615      UINT32                  i;
616 +    UINT16                  Tmp16;
617  
618  
619      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
620 @@ -383,8 +388,8 @@ RsDoIoDescriptor (
621  
622          case 1:  /* Min Address */
623  
624 -            Descriptor->Io.Minimum =
625 -                (UINT16) InitializerOp->Asl.Value.Integer;
626 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
627 +            Descriptor->Io.Minimum = AcpiUtReadUint16 (&Tmp16);
628              RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
629                  CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
630              MinOp = InitializerOp;
631 @@ -392,8 +397,8 @@ RsDoIoDescriptor (
632  
633          case 2: /* Max Address */
634  
635 -            Descriptor->Io.Maximum =
636 -                (UINT16) InitializerOp->Asl.Value.Integer;
637 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
638 +            Descriptor->Io.Maximum = AcpiUtReadUint16 (&Tmp16);
639              RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
640                  CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
641              MaxOp = InitializerOp;
642 @@ -434,10 +439,10 @@ RsDoIoDescriptor (
643      /* Validate the Min/Max/Len/Align values */
644  
645      RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
646 -        Descriptor->Io.Minimum,
647 -        Descriptor->Io.Maximum,
648 -        Descriptor->Io.AddressLength,
649 -        Descriptor->Io.Alignment,
650 +        (UINT32) (AcpiUtReadUint16 (&Descriptor->Io.Minimum)),
651 +        (UINT32) (AcpiUtReadUint16 (&Descriptor->Io.Maximum)),
652 +        (UINT32) Descriptor->Io.AddressLength,
653 +        (UINT32) Descriptor->Io.Alignment,
654          MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
655  
656      return (Rnode);
657 @@ -561,7 +566,7 @@ RsDoIrqDescriptor (
658  
659      /* Now we can set the channel mask */
660  
661 -    Descriptor->Irq.IrqMask = IrqMask;
662 +    Descriptor->Irq.IrqMask = AcpiUtReadUint16 (&IrqMask);
663      return (Rnode);
664  }
665  
666 @@ -660,6 +665,6 @@ RsDoIrqNoFlagsDescriptor (
667  
668      /* Now we can set the interrupt mask */
669  
670 -    Descriptor->Irq.IrqMask = IrqMask;
671 +    Descriptor->Irq.IrqMask = AcpiUtReadUint16(&IrqMask);
672      return (Rnode);
673  }
674 Index: acpica-unix2-20220331/source/compiler/aslrestype2.c
675 ===================================================================
676 --- acpica-unix2-20220331.orig/source/compiler/aslrestype2.c
677 +++ acpica-unix2-20220331/source/compiler/aslrestype2.c
678 @@ -77,6 +77,8 @@ RsDoGeneralRegisterDescriptor (
679      ASL_RESOURCE_NODE       *Rnode;
680      UINT32                  CurrentByteOffset;
681      UINT32                  i;
682 +    UINT16                  Tmp16;
683 +    UINT64                  Tmp64;
684  
685  
686      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
687 @@ -85,7 +87,8 @@ RsDoGeneralRegisterDescriptor (
688  
689      Descriptor = Rnode->Buffer;
690      Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
691 -    Descriptor->GenericReg.ResourceLength = 12;
692 +    Tmp16 = 12;
693 +    Descriptor->GenericReg.ResourceLength = AcpiUtReadUint16 (&Tmp16);
694  
695      /* Process all child initialization nodes */
696  
697 @@ -116,7 +119,8 @@ RsDoGeneralRegisterDescriptor (
698  
699          case 3: /* Register Address */
700  
701 -            Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
702 +            Tmp64 = InitializerOp->Asl.Value.Integer;
703 +            Descriptor->GenericReg.Address = AcpiUtReadUint64 (&Tmp64);
704              RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS,
705                  CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
706              break;
707 @@ -184,6 +188,8 @@ RsDoInterruptDescriptor (
708      BOOLEAN                 HasResSourceIndex = FALSE;
709      UINT8                   ResSourceIndex = 0;
710      UINT8                   *ResSourceString = NULL;
711 +    UINT16                  Tmp16;
712 +    UINT32                  Tmp32;
713  
714  
715      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
716 @@ -225,7 +231,7 @@ RsDoInterruptDescriptor (
717       * Initial descriptor length -- may be enlarged if there are
718       * optional fields present
719       */
720 -    Descriptor->ExtendedIrq.ResourceLength  = 2;  /* Flags and table length byte */
721 +    Descriptor->ExtendedIrq.ResourceLength  = 2; /* Flags and table length byte */
722      Descriptor->ExtendedIrq.InterruptCount  = 0;
723  
724      Rover = ACPI_CAST_PTR (AML_RESOURCE,
725 @@ -333,7 +339,8 @@ RsDoInterruptDescriptor (
726  
727              /* Save the integer and move pointer to the next one */
728  
729 -            Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;
730 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
731 +            Rover->DwordItem = AcpiUtReadUint32 (&Tmp32);
732              Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);
733              Descriptor->ExtendedIrq.InterruptCount++;
734              Descriptor->ExtendedIrq.ResourceLength += 4;
735 @@ -384,6 +391,8 @@ RsDoInterruptDescriptor (
736          Descriptor->ExtendedIrq.ResourceLength = (UINT16)
737              (Descriptor->ExtendedIrq.ResourceLength + StringLength);
738      }
739 +    Tmp16 = Descriptor->ExtendedIrq.ResourceLength;
740 +    Descriptor->ExtendedIrq.ResourceLength  = AcpiUtReadUint16 (&Tmp16);
741  
742      Rnode->BufferLength =
743          (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
744 @@ -436,7 +445,8 @@ RsDoVendorLargeDescriptor (
745  
746      Descriptor = Rnode->Buffer;
747      Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
748 -    Descriptor->VendorLarge.ResourceLength = (UINT16) i;
749 +    AcpiUtWriteUint (&Descriptor->VendorLarge.ResourceLength, sizeof (UINT16),
750 +            &i, sizeof (UINT32));
751  
752      /* Point to end-of-descriptor for vendor data */
753  
754 Index: acpica-unix2-20220331/source/compiler/aslrestype2d.c
755 ===================================================================
756 --- acpica-unix2-20220331.orig/source/compiler/aslrestype2d.c
757 +++ acpica-unix2-20220331/source/compiler/aslrestype2d.c
758 @@ -84,6 +84,8 @@ RsDoDwordIoDescriptor (
759      UINT32                  CurrentByteOffset;
760      UINT32                  i;
761      BOOLEAN                 ResSourceIndex = FALSE;
762 +    UINT16                  Tmp16;
763 +    UINT32                  Tmp32;
764  
765  
766      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
767 @@ -147,8 +149,8 @@ RsDoDwordIoDescriptor (
768  
769          case 5: /* Address Granularity */
770  
771 -            Descriptor->Address32.Granularity =
772 -                (UINT32) InitializerOp->Asl.Value.Integer;
773 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
774 +            Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32);
775              RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
776                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
777              GranOp = InitializerOp;
778 @@ -156,8 +158,8 @@ RsDoDwordIoDescriptor (
779  
780          case 6: /* Address Min */
781  
782 -            Descriptor->Address32.Minimum =
783 -                (UINT32) InitializerOp->Asl.Value.Integer;
784 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
785 +            Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32);
786              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
787                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
788              MinOp = InitializerOp;
789 @@ -165,8 +167,8 @@ RsDoDwordIoDescriptor (
790  
791          case 7: /* Address Max */
792  
793 -            Descriptor->Address32.Maximum =
794 -                (UINT32) InitializerOp->Asl.Value.Integer;
795 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
796 +            Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32);
797              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
798                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
799              MaxOp = InitializerOp;
800 @@ -174,16 +176,16 @@ RsDoDwordIoDescriptor (
801  
802          case 8: /* Translation Offset */
803  
804 -            Descriptor->Address32.TranslationOffset =
805 -                (UINT32) InitializerOp->Asl.Value.Integer;
806 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
807 +            Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32);
808              RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
809                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
810              break;
811  
812          case 9: /* Address Length */
813  
814 -            Descriptor->Address32.AddressLength =
815 -                (UINT32) InitializerOp->Asl.Value.Integer;
816 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
817 +            Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32);
818              RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
819                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
820              LengthOp = InitializerOp;
821 @@ -271,11 +273,14 @@ RsDoDwordIoDescriptor (
822  
823      /* Validate the Min/Max/Len/Gran values */
824  
825 +    Tmp16 = Descriptor->Address32.ResourceLength;
826 +    Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
827 +
828      RsLargeAddressCheck (
829 -        (UINT64) Descriptor->Address32.Minimum,
830 -        (UINT64) Descriptor->Address32.Maximum,
831 -        (UINT64) Descriptor->Address32.AddressLength,
832 -        (UINT64) Descriptor->Address32.Granularity,
833 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum),
834 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum),
835 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength),
836 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity),
837          Descriptor->Address32.Flags,
838          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
839  
840 @@ -314,6 +319,8 @@ RsDoDwordMemoryDescriptor (
841      UINT32                  CurrentByteOffset;
842      UINT32                  i;
843      BOOLEAN                 ResSourceIndex = FALSE;
844 +    UINT16                  Tmp16;
845 +    UINT32                  Tmp32;
846  
847  
848      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
849 @@ -385,8 +392,8 @@ RsDoDwordMemoryDescriptor (
850  
851          case 6: /* Address Granularity */
852  
853 -            Descriptor->Address32.Granularity =
854 -                (UINT32) InitializerOp->Asl.Value.Integer;
855 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
856 +            Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32);
857              RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
858                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
859              GranOp = InitializerOp;
860 @@ -394,8 +401,8 @@ RsDoDwordMemoryDescriptor (
861  
862          case 7: /* Min Address */
863  
864 -            Descriptor->Address32.Minimum =
865 -                (UINT32) InitializerOp->Asl.Value.Integer;
866 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
867 +            Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32);
868              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
869                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
870              MinOp = InitializerOp;
871 @@ -403,8 +410,8 @@ RsDoDwordMemoryDescriptor (
872  
873          case 8: /* Max Address */
874  
875 -            Descriptor->Address32.Maximum =
876 -                (UINT32) InitializerOp->Asl.Value.Integer;
877 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
878 +            Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32);
879              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
880                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
881              MaxOp = InitializerOp;
882 @@ -412,16 +419,16 @@ RsDoDwordMemoryDescriptor (
883  
884          case 9: /* Translation Offset */
885  
886 -            Descriptor->Address32.TranslationOffset =
887 -                (UINT32) InitializerOp->Asl.Value.Integer;
888 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
889 +            Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32);
890              RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
891                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
892              break;
893  
894          case 10: /* Address Length */
895  
896 -            Descriptor->Address32.AddressLength =
897 -                (UINT32) InitializerOp->Asl.Value.Integer;
898 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
899 +            Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32);
900              RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
901                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
902              LengthOp = InitializerOp;
903 @@ -506,11 +513,14 @@ RsDoDwordMemoryDescriptor (
904  
905      /* Validate the Min/Max/Len/Gran values */
906  
907 +    Tmp16 = Descriptor->Address32.ResourceLength;
908 +    Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
909 +
910      RsLargeAddressCheck (
911 -        (UINT64) Descriptor->Address32.Minimum,
912 -        (UINT64) Descriptor->Address32.Maximum,
913 -        (UINT64) Descriptor->Address32.AddressLength,
914 -        (UINT64) Descriptor->Address32.Granularity,
915 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum),
916 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum),
917 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength),
918 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity),
919          Descriptor->Address32.Flags,
920          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
921  
922 @@ -549,6 +559,8 @@ RsDoDwordSpaceDescriptor (
923      UINT32                  CurrentByteOffset;
924      UINT32                  i;
925      BOOLEAN                 ResSourceIndex = FALSE;
926 +    UINT16                  Tmp16;
927 +    UINT32                  Tmp32;
928  
929  
930      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
931 @@ -616,8 +628,8 @@ RsDoDwordSpaceDescriptor (
932  
933          case 6: /* Address Granularity */
934  
935 -            Descriptor->Address32.Granularity =
936 -                (UINT32) InitializerOp->Asl.Value.Integer;
937 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
938 +            Descriptor->Address32.Granularity = AcpiUtReadUint32 (&Tmp32);
939              RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
940                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
941              GranOp = InitializerOp;
942 @@ -625,8 +637,8 @@ RsDoDwordSpaceDescriptor (
943  
944          case 7: /* Min Address */
945  
946 -            Descriptor->Address32.Minimum =
947 -                (UINT32) InitializerOp->Asl.Value.Integer;
948 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
949 +            Descriptor->Address32.Minimum = AcpiUtReadUint32 (&Tmp32);
950              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
951                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
952              MinOp = InitializerOp;
953 @@ -634,8 +646,8 @@ RsDoDwordSpaceDescriptor (
954  
955          case 8: /* Max Address */
956  
957 -            Descriptor->Address32.Maximum =
958 -                (UINT32) InitializerOp->Asl.Value.Integer;
959 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
960 +            Descriptor->Address32.Maximum = AcpiUtReadUint32 (&Tmp32);
961              RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
962                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
963              MaxOp = InitializerOp;
964 @@ -643,16 +655,16 @@ RsDoDwordSpaceDescriptor (
965  
966          case 9: /* Translation Offset */
967  
968 -            Descriptor->Address32.TranslationOffset =
969 -                (UINT32) InitializerOp->Asl.Value.Integer;
970 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
971 +            Descriptor->Address32.TranslationOffset = AcpiUtReadUint32 (&Tmp32);
972              RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
973                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
974              break;
975  
976          case 10: /* Address Length */
977  
978 -            Descriptor->Address32.AddressLength =
979 -                (UINT32) InitializerOp->Asl.Value.Integer;
980 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
981 +            Descriptor->Address32.AddressLength = AcpiUtReadUint32 (&Tmp32);
982              RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
983                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
984              LengthOp = InitializerOp;
985 @@ -723,11 +735,14 @@ RsDoDwordSpaceDescriptor (
986  
987      /* Validate the Min/Max/Len/Gran values */
988  
989 +    Tmp16 = Descriptor->Address32.ResourceLength;
990 +    Descriptor->Address32.ResourceLength = AcpiUtReadUint16 (&Tmp16);
991 +
992      RsLargeAddressCheck (
993 -        (UINT64) Descriptor->Address32.Minimum,
994 -        (UINT64) Descriptor->Address32.Maximum,
995 -        (UINT64) Descriptor->Address32.AddressLength,
996 -        (UINT64) Descriptor->Address32.Granularity,
997 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Minimum),
998 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Maximum),
999 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.AddressLength),
1000 +        (UINT64) AcpiUtReadUint32 (&Descriptor->Address32.Granularity),
1001          Descriptor->Address32.Flags,
1002          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1003  
1004 Index: acpica-unix2-20220331/source/compiler/aslrestype2q.c
1005 ===================================================================
1006 --- acpica-unix2-20220331.orig/source/compiler/aslrestype2q.c
1007 +++ acpica-unix2-20220331/source/compiler/aslrestype2q.c
1008 @@ -84,6 +84,7 @@ RsDoQwordIoDescriptor (
1009      UINT32                  CurrentByteOffset;
1010      UINT32                  i;
1011      BOOLEAN                 ResSourceIndex = FALSE;
1012 +    UINT16                  Tmp16;
1013  
1014  
1015      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1016 @@ -147,7 +148,8 @@ RsDoQwordIoDescriptor (
1017  
1018          case 5: /* Address Granularity */
1019  
1020 -            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
1021 +            Descriptor->Address64.Granularity =
1022 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1023              RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1024                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
1025              GranOp = InitializerOp;
1026 @@ -155,7 +157,8 @@ RsDoQwordIoDescriptor (
1027  
1028          case 6: /* Address Min */
1029  
1030 -            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
1031 +            Descriptor->Address64.Minimum =
1032 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1033              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1034                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
1035              MinOp = InitializerOp;
1036 @@ -163,7 +166,8 @@ RsDoQwordIoDescriptor (
1037  
1038          case 7: /* Address Max */
1039  
1040 -            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
1041 +            Descriptor->Address64.Maximum =
1042 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1043              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1044                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
1045              MaxOp = InitializerOp;
1046 @@ -171,14 +175,16 @@ RsDoQwordIoDescriptor (
1047  
1048          case 8: /* Translation Offset */
1049  
1050 -            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
1051 +            Descriptor->Address64.TranslationOffset =
1052 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1053              RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1054                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
1055              break;
1056  
1057          case 9: /* Address Length */
1058  
1059 -            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
1060 +            Descriptor->Address64.AddressLength =
1061 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1062              RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1063                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
1064              LengthOp = InitializerOp;
1065 @@ -262,11 +268,14 @@ RsDoQwordIoDescriptor (
1066  
1067      /* Validate the Min/Max/Len/Gran values */
1068  
1069 +    Tmp16 = Descriptor->Address64.ResourceLength;
1070 +    Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
1071 +
1072      RsLargeAddressCheck (
1073 -        Descriptor->Address64.Minimum,
1074 -        Descriptor->Address64.Maximum,
1075 -        Descriptor->Address64.AddressLength,
1076 -        Descriptor->Address64.Granularity,
1077 +        AcpiUtReadUint64 (&Descriptor->Address64.Minimum),
1078 +        AcpiUtReadUint64 (&Descriptor->Address64.Maximum),
1079 +        AcpiUtReadUint64 (&Descriptor->Address64.AddressLength),
1080 +        AcpiUtReadUint64 (&Descriptor->Address64.Granularity),
1081          Descriptor->Address64.Flags,
1082          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1083  
1084 @@ -305,6 +314,7 @@ RsDoQwordMemoryDescriptor (
1085      UINT32                  CurrentByteOffset;
1086      UINT32                  i;
1087      BOOLEAN                 ResSourceIndex = FALSE;
1088 +    UINT16                  Tmp16;
1089  
1090  
1091      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1092 @@ -375,7 +385,8 @@ RsDoQwordMemoryDescriptor (
1093  
1094          case 6: /* Address Granularity */
1095  
1096 -            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
1097 +            Descriptor->Address64.Granularity =
1098 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1099              RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1100                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
1101              GranOp = InitializerOp;
1102 @@ -383,7 +394,8 @@ RsDoQwordMemoryDescriptor (
1103  
1104          case 7: /* Min Address */
1105  
1106 -            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
1107 +            Descriptor->Address64.Minimum =
1108 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1109              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1110                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
1111              MinOp = InitializerOp;
1112 @@ -391,7 +403,8 @@ RsDoQwordMemoryDescriptor (
1113  
1114          case 8: /* Max Address */
1115  
1116 -            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
1117 +            Descriptor->Address64.Maximum =
1118 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1119              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1120                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
1121              MaxOp = InitializerOp;
1122 @@ -399,14 +412,16 @@ RsDoQwordMemoryDescriptor (
1123  
1124          case 9: /* Translation Offset */
1125  
1126 -            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
1127 +            Descriptor->Address64.TranslationOffset =
1128 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1129              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1130                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
1131              break;
1132  
1133          case 10: /* Address Length */
1134  
1135 -            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
1136 +            Descriptor->Address64.AddressLength =
1137 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1138              RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1139                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
1140              LengthOp = InitializerOp;
1141 @@ -491,11 +506,14 @@ RsDoQwordMemoryDescriptor (
1142  
1143      /* Validate the Min/Max/Len/Gran values */
1144  
1145 +    Tmp16 = Descriptor->Address64.ResourceLength;
1146 +    Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
1147 +
1148      RsLargeAddressCheck (
1149 -        Descriptor->Address64.Minimum,
1150 -        Descriptor->Address64.Maximum,
1151 -        Descriptor->Address64.AddressLength,
1152 -        Descriptor->Address64.Granularity,
1153 +        AcpiUtReadUint64 (&Descriptor->Address64.Minimum),
1154 +        AcpiUtReadUint64 (&Descriptor->Address64.Maximum),
1155 +        AcpiUtReadUint64 (&Descriptor->Address64.AddressLength),
1156 +        AcpiUtReadUint64 (&Descriptor->Address64.Granularity),
1157          Descriptor->Address64.Flags,
1158          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1159  
1160 @@ -534,6 +552,7 @@ RsDoQwordSpaceDescriptor (
1161      UINT32                  CurrentByteOffset;
1162      UINT32                  i;
1163      BOOLEAN                 ResSourceIndex = FALSE;
1164 +    UINT16                  Tmp16;
1165  
1166  
1167      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1168 @@ -601,7 +620,8 @@ RsDoQwordSpaceDescriptor (
1169  
1170          case 6: /* Address Granularity */
1171  
1172 -            Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
1173 +            Descriptor->Address64.Granularity =
1174 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1175              RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1176                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
1177              GranOp = InitializerOp;
1178 @@ -609,7 +629,8 @@ RsDoQwordSpaceDescriptor (
1179  
1180          case 7: /* Min Address */
1181  
1182 -            Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
1183 +            Descriptor->Address64.Minimum =
1184 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1185              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1186                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
1187              MinOp = InitializerOp;
1188 @@ -617,7 +638,8 @@ RsDoQwordSpaceDescriptor (
1189  
1190          case 8: /* Max Address */
1191  
1192 -            Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
1193 +            Descriptor->Address64.Maximum =
1194 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1195              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1196                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
1197              MaxOp = InitializerOp;
1198 @@ -625,14 +647,16 @@ RsDoQwordSpaceDescriptor (
1199  
1200          case 9: /* Translation Offset */
1201  
1202 -            Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
1203 +            Descriptor->Address64.TranslationOffset =
1204 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1205              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1206                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
1207              break;
1208  
1209          case 10: /* Address Length */
1210  
1211 -            Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
1212 +            Descriptor->Address64.AddressLength =
1213 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
1214              RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1215                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
1216              LengthOp = InitializerOp;
1217 @@ -702,11 +726,14 @@ RsDoQwordSpaceDescriptor (
1218  
1219      /* Validate the Min/Max/Len/Gran values */
1220  
1221 +    Tmp16 = Descriptor->Address64.ResourceLength;
1222 +    Descriptor->Address64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
1223 +
1224      RsLargeAddressCheck (
1225 -        Descriptor->Address64.Minimum,
1226 -        Descriptor->Address64.Maximum,
1227 -        Descriptor->Address64.AddressLength,
1228 -        Descriptor->Address64.Granularity,
1229 +        AcpiUtReadUint64 (&Descriptor->Address64.Minimum),
1230 +        AcpiUtReadUint64 (&Descriptor->Address64.Maximum),
1231 +        AcpiUtReadUint64 (&Descriptor->Address64.AddressLength),
1232 +        AcpiUtReadUint64 (&Descriptor->Address64.Granularity),
1233          Descriptor->Address64.Flags,
1234          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1235  
1236 Index: acpica-unix2-20220331/source/compiler/aslrestype2w.c
1237 ===================================================================
1238 --- acpica-unix2-20220331.orig/source/compiler/aslrestype2w.c
1239 +++ acpica-unix2-20220331/source/compiler/aslrestype2w.c
1240 @@ -84,6 +84,7 @@ RsDoWordIoDescriptor (
1241      UINT32                  CurrentByteOffset;
1242      UINT32                  i;
1243      BOOLEAN                 ResSourceIndex = FALSE;
1244 +    UINT16                  Tmp16;
1245  
1246  
1247      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1248 @@ -147,7 +148,8 @@ RsDoWordIoDescriptor (
1249  
1250          case 5: /* Address Granularity */
1251  
1252 -            Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
1253 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1254 +            Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16);
1255              RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1256                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
1257              GranOp = InitializerOp;
1258 @@ -155,7 +157,8 @@ RsDoWordIoDescriptor (
1259  
1260          case 6: /* Address Min */
1261  
1262 -            Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
1263 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1264 +            Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16);
1265              RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
1266                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
1267              MinOp = InitializerOp;
1268 @@ -163,7 +166,8 @@ RsDoWordIoDescriptor (
1269  
1270          case 7: /* Address Max */
1271  
1272 -            Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
1273 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1274 +            Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16);
1275              RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1276                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
1277              MaxOp = InitializerOp;
1278 @@ -171,14 +175,16 @@ RsDoWordIoDescriptor (
1279  
1280          case 8: /* Translation Offset */
1281  
1282 -            Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
1283 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1284 +            Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16);
1285              RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1286                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
1287              break;
1288  
1289          case 9: /* Address Length */
1290  
1291 -            Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
1292 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1293 +            Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16);
1294              RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
1295                   CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
1296              LengthOp = InitializerOp;
1297 @@ -263,13 +269,17 @@ RsDoWordIoDescriptor (
1298      /* Validate the Min/Max/Len/Gran values */
1299  
1300      RsLargeAddressCheck (
1301 -        (UINT64) Descriptor->Address16.Minimum,
1302 -        (UINT64) Descriptor->Address16.Maximum,
1303 -        (UINT64) Descriptor->Address16.AddressLength,
1304 -        (UINT64) Descriptor->Address16.Granularity,
1305 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum),
1306 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum),
1307 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength),
1308 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity),
1309          Descriptor->Address16.Flags,
1310          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1311  
1312 +    /* correct enddianness */
1313 +    Tmp16 = Descriptor->Address16.ResourceLength;
1314 +    Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16);
1315 +
1316      Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
1317          OptionIndex + StringLength;
1318      return (Rnode);
1319 @@ -305,6 +315,7 @@ RsDoWordBusNumberDescriptor (
1320      UINT32                  CurrentByteOffset;
1321      UINT32                  i;
1322      BOOLEAN                 ResSourceIndex = FALSE;
1323 +    UINT16                  Tmp16;
1324  
1325  
1326      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1327 @@ -361,8 +372,8 @@ RsDoWordBusNumberDescriptor (
1328  
1329          case 4: /* Address Granularity */
1330  
1331 -            Descriptor->Address16.Granularity =
1332 -                (UINT16) InitializerOp->Asl.Value.Integer;
1333 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1334 +            Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16);
1335              RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1336                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
1337              GranOp = InitializerOp;
1338 @@ -370,8 +381,8 @@ RsDoWordBusNumberDescriptor (
1339  
1340          case 5: /* Min Address */
1341  
1342 -            Descriptor->Address16.Minimum =
1343 -                (UINT16) InitializerOp->Asl.Value.Integer;
1344 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1345 +            Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16);
1346              RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
1347                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
1348              MinOp = InitializerOp;
1349 @@ -379,8 +390,8 @@ RsDoWordBusNumberDescriptor (
1350  
1351          case 6: /* Max Address */
1352  
1353 -            Descriptor->Address16.Maximum =
1354 -                (UINT16) InitializerOp->Asl.Value.Integer;
1355 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1356 +            Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16);
1357              RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1358                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
1359              MaxOp = InitializerOp;
1360 @@ -388,16 +399,16 @@ RsDoWordBusNumberDescriptor (
1361  
1362          case 7: /* Translation Offset */
1363  
1364 -            Descriptor->Address16.TranslationOffset =
1365 -                (UINT16) InitializerOp->Asl.Value.Integer;
1366 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1367 +            Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16);
1368              RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1369                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
1370              break;
1371  
1372          case 8: /* Address Length */
1373  
1374 -            Descriptor->Address16.AddressLength =
1375 -                (UINT16) InitializerOp->Asl.Value.Integer;
1376 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1377 +            Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16);
1378              RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
1379                   CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
1380              LengthOp = InitializerOp;
1381 @@ -468,13 +479,17 @@ RsDoWordBusNumberDescriptor (
1382      /* Validate the Min/Max/Len/Gran values */
1383  
1384      RsLargeAddressCheck (
1385 -        (UINT64) Descriptor->Address16.Minimum,
1386 -        (UINT64) Descriptor->Address16.Maximum,
1387 -        (UINT64) Descriptor->Address16.AddressLength,
1388 -        (UINT64) Descriptor->Address16.Granularity,
1389 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum),
1390 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum),
1391 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength),
1392 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity),
1393          Descriptor->Address16.Flags,
1394          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1395  
1396 +    /* correct enddianness */
1397 +    Tmp16 = Descriptor->Address16.ResourceLength;
1398 +    Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16);
1399 +
1400      Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
1401          OptionIndex + StringLength;
1402      return (Rnode);
1403 @@ -510,6 +525,7 @@ RsDoWordSpaceDescriptor (
1404      UINT32                  CurrentByteOffset;
1405      UINT32                  i;
1406      BOOLEAN                 ResSourceIndex = FALSE;
1407 +    UINT16                  Tmp16;
1408  
1409  
1410      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1411 @@ -577,8 +593,8 @@ RsDoWordSpaceDescriptor (
1412  
1413          case 6: /* Address Granularity */
1414  
1415 -            Descriptor->Address16.Granularity =
1416 -                (UINT16) InitializerOp->Asl.Value.Integer;
1417 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1418 +            Descriptor->Address16.Granularity = AcpiUtReadUint16 (&Tmp16);
1419              RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1420                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
1421              GranOp = InitializerOp;
1422 @@ -586,8 +602,8 @@ RsDoWordSpaceDescriptor (
1423  
1424          case 7: /* Min Address */
1425  
1426 -            Descriptor->Address16.Minimum =
1427 -                (UINT16) InitializerOp->Asl.Value.Integer;
1428 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1429 +            Descriptor->Address16.Minimum = AcpiUtReadUint16 (&Tmp16);
1430              RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
1431                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
1432              MinOp = InitializerOp;
1433 @@ -595,8 +611,8 @@ RsDoWordSpaceDescriptor (
1434  
1435          case 8: /* Max Address */
1436  
1437 -            Descriptor->Address16.Maximum =
1438 -                (UINT16) InitializerOp->Asl.Value.Integer;
1439 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1440 +            Descriptor->Address16.Maximum = AcpiUtReadUint16 (&Tmp16);
1441              RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1442                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
1443              MaxOp = InitializerOp;
1444 @@ -604,16 +620,16 @@ RsDoWordSpaceDescriptor (
1445  
1446          case 9: /* Translation Offset */
1447  
1448 -            Descriptor->Address16.TranslationOffset =
1449 -                (UINT16) InitializerOp->Asl.Value.Integer;
1450 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1451 +            Descriptor->Address16.TranslationOffset = AcpiUtReadUint16 (&Tmp16);
1452              RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1453                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
1454              break;
1455  
1456          case 10: /* Address Length */
1457  
1458 -            Descriptor->Address16.AddressLength =
1459 -                (UINT16) InitializerOp->Asl.Value.Integer;
1460 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1461 +            Descriptor->Address16.AddressLength = AcpiUtReadUint16 (&Tmp16);
1462              RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
1463                  CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
1464              LengthOp = InitializerOp;
1465 @@ -684,13 +700,17 @@ RsDoWordSpaceDescriptor (
1466      /* Validate the Min/Max/Len/Gran values */
1467  
1468      RsLargeAddressCheck (
1469 -        (UINT64) Descriptor->Address16.Minimum,
1470 -        (UINT64) Descriptor->Address16.Maximum,
1471 -        (UINT64) Descriptor->Address16.AddressLength,
1472 -        (UINT64) Descriptor->Address16.Granularity,
1473 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Minimum),
1474 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Maximum),
1475 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.AddressLength),
1476 +        (UINT64) AcpiUtReadUint16 (&Descriptor->Address16.Granularity),
1477          Descriptor->Address16.Flags,
1478          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1479  
1480 +    /* correct enddianness */
1481 +    Tmp16 = Descriptor->Address16.ResourceLength;
1482 +    Descriptor->Address16.ResourceLength = AcpiUtReadUint16 (&Tmp16);
1483 +
1484      Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
1485          OptionIndex + StringLength;
1486      return (Rnode);
1487 Index: acpica-unix2-20220331/source/compiler/dttable2.c
1488 ===================================================================
1489 --- acpica-unix2-20220331.orig/source/compiler/dttable2.c
1490 +++ acpica-unix2-20220331/source/compiler/dttable2.c
1491 @@ -3046,7 +3046,8 @@ DtCompileWpbt (
1492  
1493      /* Extract the length of the Arguments buffer, insert into main table */
1494  
1495 -    Table->ArgumentsLength = (UINT16) Subtable->TotalLength;
1496 +    AcpiUtWriteUint (&Table->ArgumentsLength, sizeof (UINT16),
1497 +           &Subtable->TotalLength, sizeof (UINT32));
1498      DtInsertSubtable (ParentTable, Subtable);
1499      return (AE_OK);
1500  }
1501 Index: acpica-unix2-20220331/source/components/disassembler/dmbuffer.c
1502 ===================================================================
1503 --- acpica-unix2-20220331.orig/source/components/disassembler/dmbuffer.c
1504 +++ acpica-unix2-20220331/source/components/disassembler/dmbuffer.c
1505 @@ -204,7 +204,7 @@ AcpiDmByteList (
1506  
1507  
1508      ByteData = Op->Named.Data;
1509 -    ByteCount = (UINT32) Op->Common.Value.Integer;
1510 +    ByteCount = (UINT32) Op->Common.Value.Size;
1511  
1512      /*
1513       * The byte list belongs to a buffer, and can be produced by either
1514 @@ -308,7 +308,7 @@ AcpiDmIsUuidBuffer (
1515      /* Extract the byte list info */
1516  
1517      ByteData = NextOp->Named.Data;
1518 -    ByteCount = (UINT32) NextOp->Common.Value.Integer;
1519 +    ByteCount = (UINT32) NextOp->Common.Value.Size;
1520  
1521      /* Byte count must be exactly 16 */
1522  
1523 @@ -436,7 +436,7 @@ AcpiDmIsUnicodeBuffer (
1524      /* Extract the byte list info */
1525  
1526      ByteData = NextOp->Named.Data;
1527 -    ByteCount = (UINT32) NextOp->Common.Value.Integer;
1528 +    ByteCount = (UINT32) NextOp->Common.Value.Size;
1529      WordCount = ACPI_DIV_2 (ByteCount);
1530  
1531      /*
1532 @@ -878,14 +878,14 @@ AcpiDmUnicode (
1533      /* Extract the buffer info as a WORD buffer */
1534  
1535      WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
1536 -    WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
1537 +    WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Size));
1538  
1539      /* Write every other byte as an ASCII character */
1540  
1541      AcpiOsPrintf ("\"");
1542      for (i = 0; i < (WordCount - 1); i++)
1543      {
1544 -        OutputValue = (int) WordData[i];
1545 +        OutputValue = (int) AcpiUtReadUint16 (&WordData[i]);
1546  
1547          /* Handle values that must be escaped */
1548  
1549 @@ -947,7 +947,29 @@ AcpiDmGetHardwareIdType (
1550  
1551          /* Swap from little-endian to big-endian to simplify conversion */
1552  
1553 -        BigEndianId = AcpiUtDwordByteSwap ((UINT32) Op->Common.Value.Integer);
1554 +        BigEndianId = (UINT32) Op->Common.Value.Integer;
1555 +        if (UtIsBigEndianMachine())
1556 +        {
1557 +            /*
1558 +             * We'll need to store the bytes in little-endian order
1559 +             * so they can be re-used properly later since everything is
1560 +             * assumed to be in little-endian form.
1561 +             */
1562 +
1563 +            UINT32 *Ptr = (UINT32 *)(&Op->Common.Value.Integer);
1564 +            *Ptr = AcpiUtDwordByteSwap (BigEndianId);
1565 +        }
1566 +        else
1567 +        {
1568 +            /*
1569 +             * We'll need to just use the bytes in big-endian order;
1570 +             * they're already in little-endian order.
1571 +             */
1572 +
1573 +            UINT32 Tmp32 = BigEndianId;
1574 +
1575 +            BigEndianId = AcpiUtDwordByteSwap ((UINT32) Tmp32);
1576 +        }
1577  
1578          /* Create the 3 leading ASCII letters */
1579  
1580 @@ -1073,11 +1095,12 @@ AcpiDmDecompressEisaId (
1581  {
1582      char                    IdBuffer[ACPI_EISAID_STRING_SIZE];
1583      const AH_DEVICE_ID      *Info;
1584 +    UINT32                  Tmp32 = EncodedId;
1585  
1586  
1587      /* Convert EISAID to a string an emit the statement */
1588  
1589 -    AcpiExEisaIdToString (IdBuffer, EncodedId);
1590 +    AcpiExEisaIdToString (IdBuffer, AcpiUtReadUint32 (&Tmp32));
1591      AcpiOsPrintf ("EisaId (\"%s\")", IdBuffer);
1592  
1593      /* If we know about the ID, emit the description */
1594 Index: acpica-unix2-20220331/source/components/disassembler/dmopcode.c
1595 ===================================================================
1596 --- acpica-unix2-20220331.orig/source/components/disassembler/dmopcode.c
1597 +++ acpica-unix2-20220331/source/components/disassembler/dmopcode.c
1598 @@ -778,7 +778,9 @@ AcpiDmDisassembleOneOp (
1599          }
1600          else
1601          {
1602 -            AcpiOsPrintf ("0x%4.4X", (UINT32) Op->Common.Value.Integer);
1603 +            UINT16 Tmp16 = (UINT16) Op->Common.Value.Integer;
1604 +
1605 +            AcpiOsPrintf ("0x%4.4X", (UINT32) AcpiUtReadUint16 (&Tmp16));
1606          }
1607          break;
1608  
1609 @@ -790,14 +792,19 @@ AcpiDmDisassembleOneOp (
1610          }
1611          else
1612          {
1613 -            AcpiOsPrintf ("0x%8.8X", (UINT32) Op->Common.Value.Integer);
1614 +            UINT32 Tmp32 = (UINT32) Op->Common.Value.Integer;
1615 +
1616 +            AcpiOsPrintf ("0x%8.8X", (UINT32) AcpiUtReadUint32 (&Tmp32));
1617          }
1618          break;
1619  
1620      case AML_QWORD_OP:
1621  
1622 -        AcpiOsPrintf ("0x%8.8X%8.8X",
1623 -            ACPI_FORMAT_UINT64 (Op->Common.Value.Integer));
1624 +        {
1625 +           UINT64 Tmp64 = AcpiUtReadUint64 (&Op->Common.Value.Integer);
1626 +
1627 +            AcpiOsPrintf ("0x%8.8X%8.8X", ACPI_FORMAT_UINT64 (Tmp64));
1628 +        }
1629          break;
1630  
1631      case AML_STRING_OP:
1632 @@ -887,18 +894,18 @@ AcpiDmDisassembleOneOp (
1633          AcpiOsPrintf (",");
1634          ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0);
1635          AcpiOsPrintf ("%*.s  %u", (unsigned) (5 - Length), " ",
1636 -            (UINT32) Op->Common.Value.Integer);
1637 +            (UINT32) Op->Common.Value.Size);
1638  
1639          AcpiDmCommaIfFieldMember (Op);
1640  
1641 -        Info->BitOffset += (UINT32) Op->Common.Value.Integer;
1642 +        Info->BitOffset += (UINT32) Op->Common.Value.Size;
1643          break;
1644  
1645      case AML_INT_RESERVEDFIELD_OP:
1646  
1647          /* Offset() -- Must account for previous offsets */
1648  
1649 -        Offset = (UINT32) Op->Common.Value.Integer;
1650 +        Offset = (UINT32) Op->Common.Value.Size;
1651          Info->BitOffset += Offset;
1652  
1653          if (Info->BitOffset % 8 == 0)
1654 Index: acpica-unix2-20220331/source/components/disassembler/dmresrc.c
1655 ===================================================================
1656 --- acpica-unix2-20220331.orig/source/components/disassembler/dmresrc.c
1657 +++ acpica-unix2-20220331/source/components/disassembler/dmresrc.c
1658 @@ -417,7 +417,7 @@ AcpiDmIsResourceTemplate (
1659          return (AE_TYPE);
1660      }
1661  
1662 -    DeclaredBufferLength = NextOp->Common.Value.Size;
1663 +    DeclaredBufferLength = NextOp->Common.Value.Integer;
1664  
1665      /* Get the length of the raw initialization byte list */
1666  
1667 Index: acpica-unix2-20220331/source/components/disassembler/dmresrcl.c
1668 ===================================================================
1669 --- acpica-unix2-20220331.orig/source/components/disassembler/dmresrcl.c
1670 +++ acpica-unix2-20220331/source/components/disassembler/dmresrcl.c
1671 @@ -141,6 +141,8 @@ AcpiDmMemoryFields (
1672      UINT32                  Level)
1673  {
1674      UINT32                  i;
1675 +    UINT16                  Tmp16;
1676 +    UINT32                  Tmp32;
1677  
1678  
1679      for (i = 0; i < 4; i++)
1680 @@ -151,14 +153,16 @@ AcpiDmMemoryFields (
1681          {
1682          case 16:
1683  
1684 -            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
1685 -                AcpiDmMemoryNames[i]);
1686 +            Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i];
1687 +            AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Tmp16),
1688 +                     AcpiDmMemoryNames[i]);
1689              break;
1690  
1691          case 32:
1692  
1693 -            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
1694 -                AcpiDmMemoryNames[i]);
1695 +            Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i];
1696 +            AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Tmp32),
1697 +                     AcpiDmMemoryNames[i]);
1698              break;
1699  
1700          default:
1701 @@ -190,6 +194,9 @@ AcpiDmAddressFields (
1702      UINT32                  Level)
1703  {
1704      UINT32                  i;
1705 +    UINT16                  Tmp16;
1706 +    UINT32                  Tmp32;
1707 +    UINT64                  Tmp64;
1708  
1709  
1710      AcpiOsPrintf ("\n");
1711 @@ -202,20 +209,23 @@ AcpiDmAddressFields (
1712          {
1713          case 16:
1714  
1715 -            AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
1716 -                AcpiDmAddressNames[i]);
1717 +            Tmp16 = ACPI_CAST_PTR (UINT16, Source)[i];
1718 +            AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Tmp16),
1719 +                         AcpiDmAddressNames[i]);
1720              break;
1721  
1722          case 32:
1723  
1724 -            AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
1725 -                AcpiDmAddressNames[i]);
1726 +            Tmp32 = ACPI_CAST_PTR (UINT32, Source)[i];
1727 +            AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Tmp32),
1728 +                         AcpiDmAddressNames[i]);
1729              break;
1730  
1731          case 64:
1732  
1733 -            AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
1734 -                AcpiDmAddressNames[i]);
1735 +            Tmp64 = ACPI_CAST_PTR (UINT64, Source)[i];
1736 +            AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Tmp64),
1737 +                         AcpiDmAddressNames[i]);
1738              break;
1739  
1740          default:
1741 @@ -749,7 +759,7 @@ AcpiDmExtendedDescriptor (
1742      /* Extra field for this descriptor only */
1743  
1744      AcpiDmIndent (Level + 1);
1745 -    AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
1746 +    AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Resource->ExtAddress64.TypeSpecific),
1747          "Type-Specific Attributes");
1748  
1749      /* Insert a descriptor name */
1750 @@ -876,11 +886,11 @@ AcpiDmFixedMemory32Descriptor (
1751          AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
1752  
1753      AcpiDmIndent (Level + 1);
1754 -    AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
1755 +    AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Resource->FixedMemory32.Address),
1756          "Address Base");
1757  
1758      AcpiDmIndent (Level + 1);
1759 -    AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
1760 +    AcpiDmDumpInteger32 (AcpiUtReadUint32 (&Resource->FixedMemory32.AddressLength),
1761          "Address Length");
1762  
1763      /* Insert a descriptor name */
1764 @@ -926,7 +936,8 @@ AcpiDmGenericRegisterDescriptor (
1765      AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
1766  
1767      AcpiDmIndent (Level + 1);
1768 -    AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
1769 +    AcpiDmDumpInteger64 (AcpiUtReadUint64 (&Resource->GenericReg.Address),
1770 +                 "Address");
1771  
1772      /* Optional field for ACPI 3.0 */
1773  
1774 @@ -989,7 +1000,7 @@ AcpiDmInterruptDescriptor (
1775      AcpiDmResourceSource (Resource,
1776          sizeof (AML_RESOURCE_EXTENDED_IRQ) +
1777              ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
1778 -        Resource->ExtendedIrq.ResourceLength);
1779 +            AcpiUtReadUint16 (&Resource->ExtendedIrq.ResourceLength));
1780  
1781      /* Insert a descriptor name */
1782  
1783 @@ -1004,7 +1015,7 @@ AcpiDmInterruptDescriptor (
1784      {
1785          AcpiDmIndent (Level + 1);
1786          AcpiOsPrintf ("0x%8.8X,\n",
1787 -            (UINT32) Resource->ExtendedIrq.Interrupts[i]);
1788 +            AcpiUtReadUint32 (&Resource->ExtendedIrq.Interrupts[i]));
1789      }
1790  
1791      AcpiDmIndent (Level);
1792 Index: acpica-unix2-20220331/source/components/disassembler/dmresrcl2.c
1793 ===================================================================
1794 --- acpica-unix2-20220331.orig/source/components/disassembler/dmresrcl2.c
1795 +++ acpica-unix2-20220331/source/components/disassembler/dmresrcl2.c
1796 @@ -199,22 +199,27 @@ AcpiDmGpioCommon (
1797      char                    *DeviceName = NULL;
1798      UINT32                  PinCount;
1799      UINT32                  i;
1800 +    UINT16                  ResSourceOffset;
1801 +    UINT16                  VendorOffset;
1802 +    UINT16                  VendorLength;
1803 +    UINT16                  Tmp16;
1804  
1805  
1806      /* ResourceSource, ResourceSourceIndex, ResourceType */
1807  
1808      AcpiDmIndent (Level + 1);
1809 -    if (Resource->Gpio.ResSourceOffset)
1810 +    ResSourceOffset = AcpiUtReadUint16 (&Resource->Gpio.ResSourceOffset);
1811 +    if (ResSourceOffset)
1812      {
1813          DeviceName = ACPI_ADD_PTR (char,
1814 -            Resource, Resource->Gpio.ResSourceOffset),
1815 +            Resource, ResSourceOffset),
1816          AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1817      }
1818  
1819      AcpiOsPrintf (", ");
1820      AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
1821 -    AcpiOsPrintf ("%s, ",
1822 -        AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
1823 +    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.Flags);
1824 +    AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Tmp16)]);
1825  
1826      /* Insert a descriptor name */
1827  
1828 @@ -223,15 +228,15 @@ AcpiDmGpioCommon (
1829  
1830      /* Dump the vendor data */
1831  
1832 -    if (Resource->Gpio.VendorOffset)
1833 +    VendorOffset = AcpiUtReadUint16 (&Resource->Gpio.VendorOffset);
1834 +    VendorLength = AcpiUtReadUint16 (&Resource->Gpio.VendorLength);
1835 +    if (VendorOffset)
1836      {
1837          AcpiOsPrintf ("\n");
1838          AcpiDmIndent (Level + 1);
1839 -        VendorData = ACPI_ADD_PTR (UINT8, Resource,
1840 -            Resource->Gpio.VendorOffset);
1841 +        VendorData = ACPI_ADD_PTR (UINT8, Resource, VendorOffset);
1842  
1843 -        AcpiDmDumpRawDataBuffer (VendorData,
1844 -            Resource->Gpio.VendorLength, Level);
1845 +        AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
1846      }
1847  
1848      AcpiOsPrintf (")\n");
1849 @@ -241,17 +246,17 @@ AcpiDmGpioCommon (
1850      AcpiDmIndent (Level + 1);
1851      AcpiOsPrintf ("{   // Pin list\n");
1852  
1853 -    PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
1854 -        Resource->Gpio.PinTableOffset)) /
1855 -        sizeof (UINT16);
1856 +    PinCount = (UINT32) AcpiUtReadUint16 (&Resource->Gpio.ResSourceOffset);
1857 +    PinCount -= (UINT32) AcpiUtReadUint16 (&Resource->Gpio.PinTableOffset);
1858 +    PinCount /= sizeof (UINT16);
1859  
1860      PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1861 -        Resource->Gpio.PinTableOffset);
1862 +        AcpiUtReadUint16 (&Resource->Gpio.PinTableOffset));
1863  
1864      for (i = 0; i < PinCount; i++)
1865      {
1866          AcpiDmIndent (Level + 2);
1867 -        AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
1868 +        AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16 (&(PinList[i])),
1869              ((i + 1) < PinCount) ? "," : "");
1870      }
1871  
1872 @@ -285,16 +290,18 @@ AcpiDmGpioIntDescriptor (
1873      UINT32                  Length,
1874      UINT32                  Level)
1875  {
1876 +    UINT16                  Tmp16;
1877  
1878      /* Dump the GpioInt-specific portion of the descriptor */
1879  
1880      /* EdgeLevel, ActiveLevel, Shared */
1881  
1882      AcpiDmIndent (Level);
1883 +    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags);
1884      AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
1885 -        AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
1886 -        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
1887 -        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
1888 +        AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Tmp16)],
1889 +        AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 1)],
1890 +        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
1891  
1892      /* PinConfig, DebounceTimeout */
1893  
1894 @@ -307,7 +314,8 @@ AcpiDmGpioIntDescriptor (
1895      {
1896          AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
1897      }
1898 -    AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
1899 +    AcpiOsPrintf ("0x%4.4X,\n",
1900 +          AcpiUtReadUint16 (&Resource->Gpio.DebounceTimeout));
1901  
1902      /* Dump the GpioInt/GpioIo common portion of the descriptor */
1903  
1904 @@ -337,14 +345,16 @@ AcpiDmGpioIoDescriptor (
1905      UINT32                  Length,
1906      UINT32                  Level)
1907  {
1908 +    UINT16                  Tmp16;
1909  
1910      /* Dump the GpioIo-specific portion of the descriptor */
1911  
1912      /* Shared, PinConfig */
1913  
1914      AcpiDmIndent (Level);
1915 +    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags);
1916      AcpiOsPrintf ("GpioIo (%s, ",
1917 -        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
1918 +        AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
1919  
1920      if (Resource->Gpio.PinConfig <= 3)
1921      {
1922 @@ -358,10 +368,10 @@ AcpiDmGpioIoDescriptor (
1923  
1924      /* DebounceTimeout, DriveStrength, IoRestriction */
1925  
1926 -    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
1927 -    AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
1928 -    AcpiOsPrintf ("%s,\n",
1929 -        AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
1930 +    AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16 (&Resource->Gpio.DebounceTimeout));
1931 +    AcpiOsPrintf ("0x%4.4X, ", AcpiUtReadUint16 (&Resource->Gpio.DriveStrength));
1932 +    Tmp16 = AcpiUtReadUint16 (&Resource->Gpio.IntFlags);
1933 +    AcpiOsPrintf ("%s,\n", AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Tmp16)]);
1934  
1935      /* Dump the GpioInt/GpioIo common portion of the descriptor */
1936  
1937 @@ -442,6 +452,9 @@ AcpiDmPinFunctionDescriptor (
1938      char                    *DeviceName = NULL;
1939      UINT32                  PinCount;
1940      UINT32                  i;
1941 +    UINT16                  ResSourceOffset;
1942 +    UINT16                  VendorOffset;
1943 +    UINT16                  VendorLength;
1944  
1945      AcpiDmIndent (Level);
1946      AcpiOsPrintf ("PinFunction (%s, ",
1947 @@ -459,12 +472,14 @@ AcpiDmPinFunctionDescriptor (
1948  
1949      /* FunctionNumber */
1950  
1951 -    AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber);
1952 +    AcpiOsPrintf ("0x%4.4X, ",
1953 +          AcpiUtReadUint16 (&Resource->PinFunction.FunctionNumber));
1954  
1955 -    if (Resource->PinFunction.ResSourceOffset)
1956 +    ResSourceOffset = AcpiUtReadUint16 (&Resource->PinFunction.ResSourceOffset);
1957 +    if (ResSourceOffset)
1958      {
1959          DeviceName = ACPI_ADD_PTR (char,
1960 -            Resource, Resource->PinFunction.ResSourceOffset),
1961 +            Resource, ResSourceOffset),
1962          AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
1963      }
1964  
1965 @@ -484,15 +499,15 @@ AcpiDmPinFunctionDescriptor (
1966  
1967      /* Dump the vendor data */
1968  
1969 -    if (Resource->PinFunction.VendorLength)
1970 +    VendorOffset = AcpiUtReadUint16 (&Resource->PinFunction.VendorOffset);
1971 +    VendorLength = AcpiUtReadUint16 (&Resource->PinFunction.VendorLength);
1972 +    if (VendorLength)
1973      {
1974          AcpiOsPrintf ("\n");
1975          AcpiDmIndent (Level + 1);
1976 -        VendorData = ACPI_ADD_PTR (UINT8, Resource,
1977 -            Resource->PinFunction.VendorOffset);
1978 +        VendorData = ACPI_ADD_PTR (UINT8, Resource, VendorOffset);
1979  
1980 -        AcpiDmDumpRawDataBuffer (VendorData,
1981 -            Resource->PinFunction.VendorLength, Level);
1982 +        AcpiDmDumpRawDataBuffer (VendorData, VendorLength, Level);
1983      }
1984  
1985      AcpiOsPrintf (")\n");
1986 @@ -503,17 +518,17 @@ AcpiDmPinFunctionDescriptor (
1987  
1988      AcpiOsPrintf ("{   // Pin list\n");
1989  
1990 -    PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset -
1991 -        Resource->PinFunction.PinTableOffset)) /
1992 -        sizeof (UINT16);
1993 +    PinCount = AcpiUtReadUint16 (&Resource->PinFunction.ResSourceOffset);
1994 +    PinCount -= AcpiUtReadUint16 (&Resource->PinFunction.PinTableOffset);
1995 +    PinCount /= sizeof (UINT16);
1996  
1997      PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
1998 -        Resource->PinFunction.PinTableOffset);
1999 +        AcpiUtReadUint16 (&Resource->PinFunction.PinTableOffset));
2000  
2001      for (i = 0; i < PinCount; i++)
2002      {
2003          AcpiDmIndent (Level + 2);
2004 -        AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
2005 +        AcpiOsPrintf ("0x%4.4X%s\n", AcpiUtReadUint16 (&(PinList[i])),
2006              ((i + 1) < PinCount) ? "," : "");
2007      }
2008  
2009 @@ -549,7 +564,8 @@ AcpiDmDumpSerialBusVendorData (
2010      {
2011      case AML_RESOURCE_I2C_SERIALBUSTYPE:
2012  
2013 -        VendorLength = Resource->CommonSerialBus.TypeDataLength -
2014 +        VendorLength =
2015 +            AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) -
2016              AML_RESOURCE_I2C_MIN_DATA_LEN;
2017  
2018          VendorData = ACPI_ADD_PTR (UINT8, Resource,
2019 @@ -558,7 +574,8 @@ AcpiDmDumpSerialBusVendorData (
2020  
2021      case AML_RESOURCE_SPI_SERIALBUSTYPE:
2022  
2023 -        VendorLength = Resource->CommonSerialBus.TypeDataLength -
2024 +        VendorLength =
2025 +            AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) -
2026              AML_RESOURCE_SPI_MIN_DATA_LEN;
2027  
2028          VendorData = ACPI_ADD_PTR (UINT8, Resource,
2029 @@ -567,7 +584,8 @@ AcpiDmDumpSerialBusVendorData (
2030  
2031      case AML_RESOURCE_UART_SERIALBUSTYPE:
2032  
2033 -        VendorLength = Resource->CommonSerialBus.TypeDataLength -
2034 +        VendorLength =
2035 +            AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength) -
2036              AML_RESOURCE_UART_MIN_DATA_LEN;
2037  
2038          VendorData = ACPI_ADD_PTR (UINT8, Resource,
2039 @@ -693,9 +711,9 @@ AcpiDmI2cSerialBusDescriptor (
2040  
2041      AcpiDmIndent (Level);
2042      AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
2043 -        Resource->I2cSerialBus.SlaveAddress,
2044 +        AcpiUtReadUint16 (&Resource->I2cSerialBus.SlaveAddress),
2045          AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
2046 -        Resource->I2cSerialBus.ConnectionSpeed);
2047 +        AcpiUtReadUint32 (&Resource->I2cSerialBus.ConnectionSpeed));
2048  
2049      AcpiDmIndent (Level + 1);
2050      AcpiOsPrintf ("%s, ",
2051 @@ -704,7 +722,7 @@ AcpiDmI2cSerialBusDescriptor (
2052      /* ResourceSource is a required field */
2053  
2054      ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
2055 -        Resource->CommonSerialBus.TypeDataLength;
2056 +        AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength);
2057  
2058      DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
2059      AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
2060 @@ -761,15 +779,17 @@ AcpiDmSpiSerialBusDescriptor (
2061  {
2062      UINT32                  ResourceSourceOffset;
2063      char                    *DeviceName;
2064 +    UINT16                  Tmp16;
2065  
2066  
2067      /* DeviceSelection, DeviceSelectionPolarity, WireMode, DataBitLength */
2068  
2069      AcpiDmIndent (Level);
2070 +    Tmp16 = AcpiUtReadUint16 (&Resource->SpiSerialBus.TypeSpecificFlags);
2071      AcpiOsPrintf ("SpiSerialBusV2 (0x%4.4X, %s, %s, 0x%2.2X,\n",
2072 -        Resource->SpiSerialBus.DeviceSelection,
2073 -        AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags, 1)],
2074 -        AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.TypeSpecificFlags)],
2075 +        AcpiUtReadUint16 (&Resource->SpiSerialBus.DeviceSelection),
2076 +        AcpiGbl_DpDecode [ACPI_EXTRACT_1BIT_FLAG (Tmp16, 1)],
2077 +        AcpiGbl_WmDecode [ACPI_GET_1BIT_FLAG (Tmp16)],
2078          Resource->SpiSerialBus.DataBitLength);
2079  
2080      /* SlaveMode, ConnectionSpeed, ClockPolarity, ClockPhase */
2081 @@ -777,7 +797,7 @@ AcpiDmSpiSerialBusDescriptor (
2082      AcpiDmIndent (Level + 1);
2083      AcpiOsPrintf ("%s, 0x%8.8X, %s,\n",
2084          AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.Flags)],
2085 -        Resource->SpiSerialBus.ConnectionSpeed,
2086 +        AcpiUtReadUint32 (&Resource->SpiSerialBus.ConnectionSpeed),
2087          AcpiGbl_CpoDecode [ACPI_GET_1BIT_FLAG (Resource->SpiSerialBus.ClockPolarity)]);
2088  
2089      AcpiDmIndent (Level + 1);
2090 @@ -787,7 +807,7 @@ AcpiDmSpiSerialBusDescriptor (
2091      /* ResourceSource is a required field */
2092  
2093      ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
2094 -        Resource->CommonSerialBus.TypeDataLength;
2095 +        AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength);
2096  
2097      DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
2098      AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
2099 @@ -844,15 +864,17 @@ AcpiDmUartSerialBusDescriptor (
2100  {
2101      UINT32                  ResourceSourceOffset;
2102      char                    *DeviceName;
2103 +    UINT16                  Tmp16;
2104  
2105  
2106      /* ConnectionSpeed, BitsPerByte, StopBits */
2107  
2108      AcpiDmIndent (Level);
2109 +    Tmp16 = AcpiUtReadUint16 (&Resource->UartSerialBus.TypeSpecificFlags);
2110      AcpiOsPrintf ("UartSerialBusV2 (0x%8.8X, %s, %s,\n",
2111 -        Resource->UartSerialBus.DefaultBaudRate,
2112 -        AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 4)],
2113 -        AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->UartSerialBus.TypeSpecificFlags, 2)]);
2114 +        AcpiUtReadUint32 (&Resource->UartSerialBus.DefaultBaudRate),
2115 +        AcpiGbl_BpbDecode [ACPI_EXTRACT_3BIT_FLAG (Tmp16, 4)],
2116 +        AcpiGbl_SbDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 2)]);
2117  
2118      /* LinesInUse, IsBigEndian, Parity, FlowControl */
2119  
2120 @@ -867,13 +889,13 @@ AcpiDmUartSerialBusDescriptor (
2121  
2122      AcpiDmIndent (Level + 1);
2123      AcpiOsPrintf ("0x%4.4X, 0x%4.4X, ",
2124 -        Resource->UartSerialBus.RxFifoSize,
2125 -        Resource->UartSerialBus.TxFifoSize);
2126 +        AcpiUtReadUint16 (&Resource->UartSerialBus.RxFifoSize),
2127 +        AcpiUtReadUint16 (&Resource->UartSerialBus.TxFifoSize));
2128  
2129      /* ResourceSource is a required field */
2130  
2131      ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
2132 -        Resource->CommonSerialBus.TypeDataLength;
2133 +        AcpiUtReadUint16 (&Resource->CommonSerialBus.TypeDataLength);
2134  
2135      DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
2136      AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
2137 Index: acpica-unix2-20220331/source/components/disassembler/dmresrcs.c
2138 ===================================================================
2139 --- acpica-unix2-20220331.orig/source/components/disassembler/dmresrcs.c
2140 +++ acpica-unix2-20220331/source/components/disassembler/dmresrcs.c
2141 @@ -93,7 +93,7 @@ AcpiDmIrqDescriptor (
2142      AcpiOsPrintf (")\n");
2143  
2144      AcpiDmIndent (Level + 1);
2145 -    AcpiDmBitList (Resource->Irq.IrqMask);
2146 +    AcpiDmBitList (AcpiUtReadUint16 (&Resource->Irq.IrqMask));
2147  }
2148  
2149  
2150 @@ -161,8 +161,8 @@ AcpiDmFixedDmaDescriptor (
2151  
2152      AcpiDmIndent (Level);
2153      AcpiOsPrintf ("FixedDMA (0x%4.4X, 0x%4.4X, ",
2154 -        Resource->FixedDma.RequestLines,
2155 -        Resource->FixedDma.Channels);
2156 +        AcpiUtReadUint16 (&Resource->FixedDma.RequestLines),
2157 +        AcpiUtReadUint16 (&Resource->FixedDma.Channels));
2158  
2159      if (Resource->FixedDma.Width <= 5)
2160      {
2161 @@ -210,10 +210,12 @@ AcpiDmIoDescriptor (
2162          AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
2163  
2164      AcpiDmIndent (Level + 1);
2165 -    AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
2166 +    AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->Io.Minimum),
2167 +                 "Range Minimum");
2168  
2169      AcpiDmIndent (Level + 1);
2170 -    AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
2171 +    AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->Io.Maximum),
2172 +                 "Range Maximum");
2173  
2174      AcpiDmIndent (Level + 1);
2175      AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
2176 @@ -256,10 +258,12 @@ AcpiDmFixedIoDescriptor (
2177      AcpiOsPrintf ("FixedIO (\n");
2178  
2179      AcpiDmIndent (Level + 1);
2180 -    AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
2181 +    AcpiDmDumpInteger16 (AcpiUtReadUint16 (&Resource->FixedIo.Address),
2182 +                 "Address");
2183  
2184      AcpiDmIndent (Level + 1);
2185 -    AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
2186 +    AcpiDmDumpInteger8 (AcpiUtReadUint16 (&Resource->FixedIo.AddressLength),
2187 +            "Length");
2188  
2189      /* Insert a descriptor name */
2190  
2191 Index: acpica-unix2-20220331/source/components/disassembler/dmwalk.c
2192 ===================================================================
2193 --- acpica-unix2-20220331.orig/source/components/disassembler/dmwalk.c
2194 +++ acpica-unix2-20220331/source/components/disassembler/dmwalk.c
2195 @@ -1163,7 +1163,7 @@ AcpiDmAscendingOp (
2196          {
2197              ParentOp->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
2198              ASL_CV_CLOSE_PAREN (Op, Level);
2199 -            AcpiOsPrintf ("{");
2200 +            AcpiOsPrintf (" {");
2201          }
2202      }
2203  
2204 Index: acpica-unix2-20220331/source/components/namespace/nsaccess.c
2205 ===================================================================
2206 --- acpica-unix2-20220331.orig/source/components/namespace/nsaccess.c
2207 +++ acpica-unix2-20220331/source/components/namespace/nsaccess.c
2208 @@ -644,7 +644,7 @@ AcpiNsLookup (
2209  
2210          /* Extract one ACPI name from the front of the pathname */
2211  
2212 -        ACPI_MOVE_32_TO_32 (&SimpleName, Path);
2213 +        ACPI_COPY_NAMESEG (&SimpleName, Path);
2214  
2215          /* Try to find the single (4 character) ACPI name */
2216  
2217 Index: acpica-unix2-20220331/source/components/namespace/nsnames.c
2218 ===================================================================
2219 --- acpica-unix2-20220331.orig/source/components/namespace/nsnames.c
2220 +++ acpica-unix2-20220331/source/components/namespace/nsnames.c
2221 @@ -297,10 +297,10 @@ AcpiNsBuildNormalizedPath (
2222      {
2223          if (NextNode != Node)
2224          {
2225 -            ACPI_PATH_PUT8(FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length);
2226 +            ACPI_PATH_PUT8 (FullPath, PathSize, AML_DUAL_NAME_PREFIX, Length);
2227          }
2228  
2229 -        ACPI_MOVE_32_TO_32 (Name, &NextNode->Name);
2230 +        ACPI_COPY_NAMESEG (Name, &NextNode->Name);
2231          DoNoTrailing = NoTrailing;
2232          for (i = 0; i < 4; i++)
2233          {
2234 Index: acpica-unix2-20220331/source/components/namespace/nsparse.c
2235 ===================================================================
2236 --- acpica-unix2-20220331.orig/source/components/namespace/nsparse.c
2237 +++ acpica-unix2-20220331/source/components/namespace/nsparse.c
2238 @@ -203,6 +203,7 @@ AcpiNsOneCompleteParse (
2239      ACPI_WALK_STATE         *WalkState;
2240      ACPI_TABLE_HEADER       *Table;
2241      ACPI_OWNER_ID           OwnerId;
2242 +    UINT32                  TableLength;
2243  
2244  
2245      ACPI_FUNCTION_TRACE (NsOneCompleteParse);
2246 @@ -216,13 +217,14 @@ AcpiNsOneCompleteParse (
2247  
2248      /* Table must consist of at least a complete header */
2249  
2250 -    if (Table->Length < sizeof (ACPI_TABLE_HEADER))
2251 +    TableLength = AcpiUtReadUint32 (&Table->Length);
2252 +    if (TableLength < sizeof (ACPI_TABLE_HEADER))
2253      {
2254          return_ACPI_STATUS (AE_BAD_HEADER);
2255      }
2256  
2257      AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
2258 -    AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
2259 +    AmlLength = TableLength - sizeof (ACPI_TABLE_HEADER);
2260  
2261      Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
2262      if (ACPI_FAILURE (Status))
2263 Index: acpica-unix2-20220331/source/components/namespace/nsutils.c
2264 ===================================================================
2265 --- acpica-unix2-20220331.orig/source/components/namespace/nsutils.c
2266 +++ acpica-unix2-20220331/source/components/namespace/nsutils.c
2267 @@ -272,7 +272,6 @@ AcpiNsBuildInternalName (
2268      const char              *ExternalName = Info->NextExternalChar;
2269      char                    *Result = NULL;
2270      UINT32                  i;
2271 -    char                    TmpSeg[ACPI_NAMESEG_SIZE+1];
2272  
2273  
2274      ACPI_FUNCTION_TRACE (NsBuildInternalName);
2275 @@ -336,7 +335,6 @@ AcpiNsBuildInternalName (
2276  
2277      for (; NumSegments; NumSegments--)
2278      {
2279 -        memset (TmpSeg, 0, ACPI_NAMESEG_SIZE+1);
2280          for (i = 0; i < ACPI_NAMESEG_SIZE; i++)
2281          {
2282              if (ACPI_IS_PATH_SEPARATOR (*ExternalName) ||
2283 @@ -344,17 +342,16 @@ AcpiNsBuildInternalName (
2284              {
2285                  /* Pad the segment with underscore(s) if segment is short */
2286  
2287 -                TmpSeg[i] = '_';
2288 +                Result[i] = '_';
2289              }
2290              else
2291              {
2292                  /* Convert the character to uppercase and save it */
2293  
2294 -                TmpSeg[i] = (char) toupper ((int) *ExternalName);
2295 +                Result[i] = (char) toupper ((int) *ExternalName);
2296                  ExternalName++;
2297              }
2298          }
2299 -    AcpiUtWriteUint (Result, ACPI_NAMESEG_SIZE, TmpSeg, ACPI_NAMESEG_SIZE);
2300  
2301          /* Now we must have a path separator, or the pathname is bad */
2302  
2303 Index: acpica-unix2-20220331/source/components/utilities/utresrc.c
2304 ===================================================================
2305 --- acpica-unix2-20220331.orig/source/components/utilities/utresrc.c
2306 +++ acpica-unix2-20220331/source/components/utilities/utresrc.c
2307 @@ -541,7 +541,7 @@ AcpiUtGetResourceLength (
2308      {
2309          /* Large Resource type -- bytes 1-2 contain the 16-bit length */
2310  
2311 -        ACPI_MOVE_16_TO_16 (&ResourceLength, ACPI_ADD_PTR (UINT8, Aml, 1));
2312 +        ResourceLength = AcpiUtReadUint16 (ACPI_ADD_PTR (UINT8, Aml, 1));
2313  
2314      }
2315      else
2316 Index: acpica-unix2-20220331/source/compiler/aslrestype2e.c
2317 ===================================================================
2318 --- acpica-unix2-20220331.orig/source/compiler/aslrestype2e.c
2319 +++ acpica-unix2-20220331/source/compiler/aslrestype2e.c
2320 @@ -80,6 +80,7 @@ RsDoExtendedIoDescriptor (
2321      UINT16                  StringLength = 0;
2322      UINT32                  CurrentByteOffset;
2323      UINT32                  i;
2324 +    UINT16                  Tmp16;
2325  
2326  
2327      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2328 @@ -139,7 +140,8 @@ RsDoExtendedIoDescriptor (
2329  
2330          case 5: /* Address Granularity */
2331  
2332 -            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
2333 +            Descriptor->ExtAddress64.Granularity =
2334 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2335              RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
2336                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
2337              GranOp = InitializerOp;
2338 @@ -147,7 +149,8 @@ RsDoExtendedIoDescriptor (
2339  
2340          case 6: /* Address Min */
2341  
2342 -            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
2343 +            Descriptor->ExtAddress64.Minimum =
2344 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2345              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
2346                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
2347              MinOp = InitializerOp;
2348 @@ -155,7 +158,8 @@ RsDoExtendedIoDescriptor (
2349  
2350          case 7: /* Address Max */
2351  
2352 -            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
2353 +            Descriptor->ExtAddress64.Maximum =
2354 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2355              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
2356                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
2357              MaxOp = InitializerOp;
2358 @@ -163,14 +167,16 @@ RsDoExtendedIoDescriptor (
2359  
2360          case 8: /* Translation Offset */
2361  
2362 -            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
2363 +            Descriptor->ExtAddress64.TranslationOffset =
2364 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2365              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
2366                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
2367              break;
2368  
2369          case 9: /* Address Length */
2370  
2371 -            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
2372 +            Descriptor->ExtAddress64.AddressLength =
2373 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2374              RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
2375                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
2376              LengthOp = InitializerOp;
2377 @@ -178,7 +184,8 @@ RsDoExtendedIoDescriptor (
2378  
2379          case 10: /* Type-Specific Attributes */
2380  
2381 -            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
2382 +            Descriptor->ExtAddress64.TypeSpecific =
2383 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2384              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
2385                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
2386              break;
2387 @@ -213,11 +220,14 @@ RsDoExtendedIoDescriptor (
2388  
2389      /* Validate the Min/Max/Len/Gran values */
2390  
2391 +    Tmp16 = Descriptor->ExtAddress64.ResourceLength;
2392 +    Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
2393 +
2394      RsLargeAddressCheck (
2395 -        Descriptor->ExtAddress64.Minimum,
2396 -        Descriptor->ExtAddress64.Maximum,
2397 -        Descriptor->ExtAddress64.AddressLength,
2398 -        Descriptor->ExtAddress64.Granularity,
2399 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum),
2400 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum),
2401 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength),
2402 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity),
2403          Descriptor->ExtAddress64.Flags,
2404          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2405  
2406 @@ -253,6 +263,7 @@ RsDoExtendedMemoryDescriptor (
2407      UINT16                  StringLength = 0;
2408      UINT32                  CurrentByteOffset;
2409      UINT32                  i;
2410 +    UINT16                  Tmp16;
2411  
2412  
2413      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2414 @@ -319,7 +330,8 @@ RsDoExtendedMemoryDescriptor (
2415  
2416          case 6: /* Address Granularity */
2417  
2418 -            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
2419 +            Descriptor->ExtAddress64.Granularity =
2420 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2421              RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
2422                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
2423              GranOp = InitializerOp;
2424 @@ -327,7 +339,8 @@ RsDoExtendedMemoryDescriptor (
2425  
2426          case 7: /* Min Address */
2427  
2428 -            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
2429 +            Descriptor->ExtAddress64.Minimum =
2430 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2431              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
2432                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
2433              MinOp = InitializerOp;
2434 @@ -335,7 +348,8 @@ RsDoExtendedMemoryDescriptor (
2435  
2436          case 8: /* Max Address */
2437  
2438 -            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
2439 +            Descriptor->ExtAddress64.Maximum =
2440 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2441              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
2442                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
2443              MaxOp = InitializerOp;
2444 @@ -343,14 +357,16 @@ RsDoExtendedMemoryDescriptor (
2445  
2446          case 9: /* Translation Offset */
2447  
2448 -            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
2449 +            Descriptor->ExtAddress64.TranslationOffset =
2450 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2451              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
2452                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
2453              break;
2454  
2455          case 10: /* Address Length */
2456  
2457 -            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
2458 +            Descriptor->ExtAddress64.AddressLength =
2459 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2460              RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
2461                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
2462              LengthOp = InitializerOp;
2463 @@ -358,7 +374,8 @@ RsDoExtendedMemoryDescriptor (
2464  
2465          case 11: /* Type-Specific Attributes */
2466  
2467 -            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
2468 +            Descriptor->ExtAddress64.TypeSpecific =
2469 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2470              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
2471                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
2472              break;
2473 @@ -394,11 +411,14 @@ RsDoExtendedMemoryDescriptor (
2474  
2475      /* Validate the Min/Max/Len/Gran values */
2476  
2477 +    Tmp16 = Descriptor->ExtAddress64.ResourceLength;
2478 +    Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
2479 +
2480      RsLargeAddressCheck (
2481 -        Descriptor->ExtAddress64.Minimum,
2482 -        Descriptor->ExtAddress64.Maximum,
2483 -        Descriptor->ExtAddress64.AddressLength,
2484 -        Descriptor->ExtAddress64.Granularity,
2485 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum),
2486 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum),
2487 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength),
2488 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity),
2489          Descriptor->ExtAddress64.Flags,
2490          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2491  
2492 @@ -434,6 +454,7 @@ RsDoExtendedSpaceDescriptor (
2493      UINT16                  StringLength = 0;
2494      UINT32                  CurrentByteOffset;
2495      UINT32                  i;
2496 +    UINT16                  Tmp16;
2497  
2498  
2499      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2500 @@ -497,7 +518,8 @@ RsDoExtendedSpaceDescriptor (
2501  
2502          case 6: /* Address Granularity */
2503  
2504 -            Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
2505 +            Descriptor->ExtAddress64.Granularity =
2506 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2507              RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
2508                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
2509              GranOp = InitializerOp;
2510 @@ -505,7 +527,8 @@ RsDoExtendedSpaceDescriptor (
2511  
2512          case 7: /* Min Address */
2513  
2514 -            Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
2515 +            Descriptor->ExtAddress64.Minimum =
2516 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2517              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
2518                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
2519              MinOp = InitializerOp;
2520 @@ -513,7 +536,8 @@ RsDoExtendedSpaceDescriptor (
2521  
2522          case 8: /* Max Address */
2523  
2524 -            Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
2525 +            Descriptor->ExtAddress64.Maximum =
2526 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2527              RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
2528                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
2529              MaxOp = InitializerOp;
2530 @@ -521,14 +545,16 @@ RsDoExtendedSpaceDescriptor (
2531  
2532          case 9: /* Translation Offset */
2533  
2534 -            Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
2535 +            Descriptor->ExtAddress64.TranslationOffset =
2536 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2537              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
2538                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
2539              break;
2540  
2541          case 10: /* Address Length */
2542  
2543 -            Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
2544 +            Descriptor->ExtAddress64.AddressLength =
2545 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2546              RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
2547                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
2548              LengthOp = InitializerOp;
2549 @@ -536,7 +562,8 @@ RsDoExtendedSpaceDescriptor (
2550  
2551          case 11: /* Type-Specific Attributes */
2552  
2553 -            Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
2554 +            Descriptor->ExtAddress64.TypeSpecific =
2555 +                AcpiUtReadUint64 (&InitializerOp->Asl.Value.Integer);
2556              RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
2557                  CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
2558              break;
2559 @@ -557,11 +584,14 @@ RsDoExtendedSpaceDescriptor (
2560  
2561      /* Validate the Min/Max/Len/Gran values */
2562  
2563 +    Tmp16 = Descriptor->ExtAddress64.ResourceLength;
2564 +    Descriptor->ExtAddress64.ResourceLength = AcpiUtReadUint16 (&Tmp16);
2565 +
2566      RsLargeAddressCheck (
2567 -        Descriptor->ExtAddress64.Minimum,
2568 -        Descriptor->ExtAddress64.Maximum,
2569 -        Descriptor->ExtAddress64.AddressLength,
2570 -        Descriptor->ExtAddress64.Granularity,
2571 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Minimum),
2572 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Maximum),
2573 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.AddressLength),
2574 +        AcpiUtReadUint64 (&Descriptor->ExtAddress64.Granularity),
2575          Descriptor->ExtAddress64.Flags,
2576          MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2577  
2578 Index: acpica-unix2-20220331/source/compiler/aslrestype2s.c
2579 ===================================================================
2580 --- acpica-unix2-20220331.orig/source/compiler/aslrestype2s.c
2581 +++ acpica-unix2-20220331/source/compiler/aslrestype2s.c
2582 @@ -343,6 +343,7 @@ RsDoGpioIntDescriptor (
2583      UINT32                  CurrentByteOffset;
2584      UINT32                  PinCount = 0;
2585      UINT32                  i;
2586 +    UINT16                  Tmp16;
2587  
2588  
2589      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2590 @@ -485,7 +486,8 @@ RsDoGpioIntDescriptor (
2591               *  (implies resource source must immediately follow the pin list.)
2592               *  Name: _PIN
2593               */
2594 -            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
2595 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2596 +            *InterruptList = AcpiUtReadUint16 (&Tmp16);
2597              InterruptList++;
2598              PinCount++;
2599  
2600 @@ -518,6 +520,27 @@ RsDoGpioIntDescriptor (
2601  
2602      MpSaveGpioInfo (Info->MappingOp, Descriptor,
2603          PinCount, PinList, ResourceSource);
2604 +
2605 +    /* correct endian-ness issues */
2606 +    Tmp16 = Descriptor->Gpio.ResourceLength;
2607 +    Descriptor->Gpio.ResourceLength = AcpiUtReadUint16 (&Tmp16);
2608 +    Tmp16 = Descriptor->Gpio.Flags;
2609 +    Descriptor->Gpio.Flags = AcpiUtReadUint16 (&Tmp16);
2610 +    Tmp16 = Descriptor->Gpio.IntFlags;
2611 +    Descriptor->Gpio.IntFlags = AcpiUtReadUint16 (&Tmp16);
2612 +    Tmp16 = Descriptor->Gpio.DriveStrength;
2613 +    Descriptor->Gpio.DriveStrength = AcpiUtReadUint16 (&Tmp16);
2614 +    Tmp16 = Descriptor->Gpio.DebounceTimeout;
2615 +    Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16 (&Tmp16);
2616 +    Tmp16 = Descriptor->Gpio.PinTableOffset;
2617 +    Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
2618 +    Tmp16 = Descriptor->Gpio.ResSourceOffset;
2619 +    Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
2620 +    Tmp16 = Descriptor->Gpio.VendorOffset;
2621 +    Descriptor->Gpio.VendorOffset = AcpiUtReadUint16 (&Tmp16);
2622 +    Tmp16 = Descriptor->Gpio.VendorLength;
2623 +    Descriptor->Gpio.VendorLength = AcpiUtReadUint16 (&Tmp16);
2624 +
2625      return (Rnode);
2626  }
2627  
2628 @@ -552,6 +575,7 @@ RsDoGpioIoDescriptor (
2629      UINT32                  CurrentByteOffset;
2630      UINT32                  PinCount = 0;
2631      UINT32                  i;
2632 +    UINT16                  Tmp16;
2633  
2634  
2635      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2636 @@ -691,7 +715,8 @@ RsDoGpioIoDescriptor (
2637               *  (implies resource source must immediately follow the pin list.)
2638               *  Name: _PIN
2639               */
2640 -            *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
2641 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2642 +            *InterruptList = AcpiUtReadUint16 (&Tmp16);
2643              InterruptList++;
2644              PinCount++;
2645  
2646 @@ -724,6 +749,27 @@ RsDoGpioIoDescriptor (
2647  
2648      MpSaveGpioInfo (Info->MappingOp, Descriptor,
2649          PinCount, PinList, ResourceSource);
2650 +
2651 +    /* correct endian-ness issues */
2652 +    Tmp16 = Descriptor->Gpio.ResourceLength;
2653 +    Descriptor->Gpio.ResourceLength = AcpiUtReadUint16 (&Tmp16);
2654 +    Tmp16 = Descriptor->Gpio.Flags;
2655 +    Descriptor->Gpio.Flags = AcpiUtReadUint16 (&Tmp16);
2656 +    Tmp16 = Descriptor->Gpio.IntFlags;
2657 +    Descriptor->Gpio.IntFlags = AcpiUtReadUint16 (&Tmp16);
2658 +    Tmp16 = Descriptor->Gpio.DriveStrength;
2659 +    Descriptor->Gpio.DriveStrength = AcpiUtReadUint16 (&Tmp16);
2660 +    Tmp16 = Descriptor->Gpio.DebounceTimeout;
2661 +    Descriptor->Gpio.DebounceTimeout = AcpiUtReadUint16 (&Tmp16);
2662 +    Tmp16 = Descriptor->Gpio.PinTableOffset;
2663 +    Descriptor->Gpio.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
2664 +    Tmp16 = Descriptor->Gpio.ResSourceOffset;
2665 +    Descriptor->Gpio.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
2666 +    Tmp16 = Descriptor->Gpio.VendorOffset;
2667 +    Descriptor->Gpio.VendorOffset = AcpiUtReadUint16 (&Tmp16);
2668 +    Tmp16 = Descriptor->Gpio.VendorLength;
2669 +    Descriptor->Gpio.VendorLength = AcpiUtReadUint16 (&Tmp16);
2670 +
2671      return (Rnode);
2672  }
2673  
2674 @@ -754,6 +800,8 @@ RsDoI2cSerialBusDescriptor (
2675      UINT16                  DescriptorSize;
2676      UINT32                  CurrentByteOffset;
2677      UINT32                  i;
2678 +    UINT16                  Tmp16;
2679 +    UINT32                  Tmp32;
2680  
2681  
2682      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2683 @@ -781,7 +829,8 @@ RsDoI2cSerialBusDescriptor (
2684      Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
2685      Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
2686      Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
2687 -    Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
2688 +    Tmp16 = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
2689 +    Descriptor->I2cSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16);
2690  
2691      if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
2692      {
2693 @@ -795,13 +844,15 @@ RsDoI2cSerialBusDescriptor (
2694  
2695      /* Process all child initialization nodes */
2696  
2697 +    Descriptor->I2cSerialBus.TypeSpecificFlags = 0;
2698      for (i = 0; InitializerOp; i++)
2699      {
2700          switch (i)
2701          {
2702          case 0: /* Slave Address [WORD] (_ADR) */
2703  
2704 -            Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
2705 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2706 +            Descriptor->I2cSerialBus.SlaveAddress = AcpiUtReadUint16 (&Tmp16);
2707              RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
2708                  CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
2709              break;
2710 @@ -815,16 +866,19 @@ RsDoI2cSerialBusDescriptor (
2711  
2712          case 2: /* Connection Speed [DWORD] (_SPE) */
2713  
2714 -            Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
2715 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
2716 +            Descriptor->I2cSerialBus.ConnectionSpeed = AcpiUtReadUint32 (&Tmp32);
2717              RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
2718                  CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
2719              break;
2720  
2721          case 3: /* Addressing Mode [Flag] (_MOD) */
2722  
2723 -            RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
2724 +            Tmp16 = AcpiUtReadUint16 (&Descriptor->I2cSerialBus.TypeSpecificFlags);
2725 +            RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0);
2726              RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
2727                  CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
2728 +            Descriptor->I2cSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);
2729              break;
2730  
2731          case 4: /* ResSource [Optional Field - STRING] */
2732 @@ -882,6 +936,8 @@ RsDoI2cSerialBusDescriptor (
2733          InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
2734      }
2735  
2736 +    Tmp16 = Descriptor->I2cSerialBus.ResourceLength;
2737 +    Descriptor->I2cSerialBus.ResourceLength = AcpiUtReadUint16 (&Tmp16);
2738      MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
2739      return (Rnode);
2740  }
2741 @@ -913,6 +969,8 @@ RsDoSpiSerialBusDescriptor (
2742      UINT16                  DescriptorSize;
2743      UINT32                  CurrentByteOffset;
2744      UINT32                  i;
2745 +    UINT16                  Tmp16;
2746 +    UINT32                  Tmp32;
2747  
2748  
2749      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2750 @@ -935,12 +993,13 @@ RsDoSpiSerialBusDescriptor (
2751          sizeof (AML_RESOURCE_LARGE_HEADER));
2752  
2753      Descriptor = Rnode->Buffer;
2754 -    Descriptor->SpiSerialBus.ResourceLength = DescriptorSize;
2755 +    Descriptor->SpiSerialBus.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
2756      Descriptor->SpiSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
2757      Descriptor->SpiSerialBus.RevisionId = AML_RESOURCE_SPI_REVISION;
2758      Descriptor->SpiSerialBus.TypeRevisionId = AML_RESOURCE_SPI_TYPE_REVISION;
2759      Descriptor->SpiSerialBus.Type = AML_RESOURCE_SPI_SERIALBUSTYPE;
2760 -    Descriptor->SpiSerialBus.TypeDataLength = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
2761 +    Tmp16 = AML_RESOURCE_SPI_MIN_DATA_LEN + VendorLength;
2762 +    Descriptor->SpiSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16);
2763  
2764      if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_SPI_SERIALBUS_V2)
2765      {
2766 @@ -955,29 +1014,35 @@ RsDoSpiSerialBusDescriptor (
2767  
2768      /* Process all child initialization nodes */
2769  
2770 +    Descriptor->SpiSerialBus.TypeSpecificFlags = 0;
2771      for (i = 0; InitializerOp; i++)
2772      {
2773          switch (i)
2774          {
2775          case 0: /* Device Selection [WORD] (_ADR) */
2776  
2777 -            Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
2778 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2779 +            Descriptor->SpiSerialBus.DeviceSelection = AcpiUtReadUint16 (&Tmp16);
2780              RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
2781                  CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
2782              break;
2783  
2784          case 1: /* Device Polarity [Flag] (_DPL) */
2785  
2786 -            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
2787 +            Tmp16 = AcpiUtReadUint16 (&Descriptor->SpiSerialBus.TypeSpecificFlags);
2788 +            RsSetFlagBits16 (&Tmp16, InitializerOp, 1, 0);
2789              RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
2790                  CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
2791 +            Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);
2792              break;
2793  
2794          case 2: /* Wire Mode [Flag] (_MOD) */
2795  
2796 -            RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
2797 +            Tmp16 = AcpiUtReadUint16 (&Descriptor->SpiSerialBus.TypeSpecificFlags);
2798 +            RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0);
2799              RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
2800                  CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
2801 +            Descriptor->SpiSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);
2802              break;
2803  
2804          case 3: /* Device Bit Length [BYTE] (_LEN) */
2805 @@ -996,7 +1061,8 @@ RsDoSpiSerialBusDescriptor (
2806  
2807          case 5: /* Connection Speed [DWORD] (_SPE) */
2808  
2809 -            Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
2810 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
2811 +            Descriptor->SpiSerialBus.ConnectionSpeed = AcpiUtReadUint32 (&Tmp32);
2812              RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
2813                  CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
2814              break;
2815 @@ -1101,6 +1167,8 @@ RsDoUartSerialBusDescriptor (
2816      UINT16                  DescriptorSize;
2817      UINT32                  CurrentByteOffset;
2818      UINT32                  i;
2819 +    UINT16                  Tmp16;
2820 +    UINT32                  Tmp32;
2821  
2822  
2823      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2824 @@ -1123,12 +1191,13 @@ RsDoUartSerialBusDescriptor (
2825          sizeof (AML_RESOURCE_LARGE_HEADER));
2826  
2827      Descriptor = Rnode->Buffer;
2828 -    Descriptor->UartSerialBus.ResourceLength = DescriptorSize;
2829 +    Descriptor->UartSerialBus.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
2830      Descriptor->UartSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
2831      Descriptor->UartSerialBus.RevisionId = AML_RESOURCE_UART_REVISION;
2832      Descriptor->UartSerialBus.TypeRevisionId = AML_RESOURCE_UART_TYPE_REVISION;
2833      Descriptor->UartSerialBus.Type = AML_RESOURCE_UART_SERIALBUSTYPE;
2834 -    Descriptor->UartSerialBus.TypeDataLength = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
2835 +    Tmp16 = AML_RESOURCE_UART_MIN_DATA_LEN + VendorLength;
2836 +    Descriptor->UartSerialBus.TypeDataLength = AcpiUtReadUint16 (&Tmp16);
2837  
2838      if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_UART_SERIALBUS_V2)
2839      {
2840 @@ -1142,29 +1211,35 @@ RsDoUartSerialBusDescriptor (
2841  
2842      /* Process all child initialization nodes */
2843  
2844 +    Descriptor->UartSerialBus.TypeSpecificFlags = 0;
2845      for (i = 0; InitializerOp; i++)
2846      {
2847          switch (i)
2848          {
2849          case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
2850  
2851 -            Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
2852 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
2853 +            Descriptor->UartSerialBus.DefaultBaudRate = AcpiUtReadUint32 (&Tmp32);
2854              RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
2855                  CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
2856              break;
2857  
2858          case 1: /* Bits Per Byte [Flags] (_LEN) */
2859  
2860 -            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
2861 +            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
2862 +            RsSetFlagBits16 (&Tmp16, InitializerOp, 4, 3);
2863              RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
2864                  CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
2865 +            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
2866              break;
2867  
2868          case 2: /* Stop Bits [Flags] (_STB) */
2869  
2870 -            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
2871 +            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
2872 +            RsSetFlagBits16 (&Tmp16, InitializerOp, 2, 1);
2873              RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
2874                  CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
2875 +            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
2876              break;
2877  
2878          case 3: /* Lines In Use [BYTE] (_LIN) */
2879 @@ -1176,9 +1251,11 @@ RsDoUartSerialBusDescriptor (
2880  
2881          case 4: /* Endianness [Flag] (_END) */
2882  
2883 -            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
2884 +            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
2885 +            RsSetFlagBits16 (&Tmp16, InitializerOp, 7, 0);
2886              RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
2887                  CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
2888 +            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
2889              break;
2890  
2891          case 5: /* Parity [BYTE] (_PAR) */
2892 @@ -1190,21 +1267,25 @@ RsDoUartSerialBusDescriptor (
2893  
2894          case 6: /* Flow Control [Flags] (_FLC) */
2895  
2896 -            RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
2897 +            Tmp16 = AcpiUtReadUint16 (&Descriptor->UartSerialBus.TypeSpecificFlags);
2898 +            RsSetFlagBits16 (&Tmp16, InitializerOp, 0, 0);
2899              RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
2900                  CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
2901 +            Descriptor->UartSerialBus.TypeSpecificFlags = AcpiUtReadUint16 (&Tmp16);;
2902              break;
2903  
2904          case 7: /* Rx Buffer Size [WORD] (_RXL) */
2905  
2906 -            Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
2907 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2908 +            Descriptor->UartSerialBus.RxFifoSize = AcpiUtReadUint16 (&Tmp16);
2909              RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
2910                  CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
2911              break;
2912  
2913          case 8: /* Tx Buffer Size [WORD] (_TXL) */
2914  
2915 -            Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
2916 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2917 +            Descriptor->UartSerialBus.TxFifoSize = AcpiUtReadUint16 (&Tmp16);
2918              RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
2919                  CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
2920              break;
2921 @@ -1444,6 +1525,7 @@ RsDoPinFunctionDescriptor (
2922      UINT32                  CurrentByteOffset;
2923      UINT32                  PinCount = 0;
2924      UINT32                  i;
2925 +    UINT16                  Tmp16;
2926  
2927      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2928      CurrentByteOffset = Info->CurrentByteOffset;
2929 @@ -1467,7 +1549,7 @@ RsDoPinFunctionDescriptor (
2930          sizeof (AML_RESOURCE_LARGE_HEADER));
2931  
2932      Descriptor = Rnode->Buffer;
2933 -    Descriptor->PinFunction.ResourceLength = DescriptorSize;
2934 +    Descriptor->PinFunction.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
2935      Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION;
2936      Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION;
2937  
2938 @@ -1507,7 +1589,8 @@ RsDoPinFunctionDescriptor (
2939  
2940          case 2: /* Function Number [WORD] (_FUN) */
2941  
2942 -            Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
2943 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2944 +            Descriptor->PinFunction.FunctionNumber = AcpiUtReadUint16 (&Tmp16);
2945              RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
2946                  CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber));
2947              break;
2948 @@ -1555,6 +1638,12 @@ RsDoPinFunctionDescriptor (
2949              {
2950                  Descriptor->PinFunction.VendorLength = VendorLength;
2951              }
2952 +            Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor);
2953 +            Descriptor->PinFunction.VendorOffset = AcpiUtReadUint16 (&Tmp16);
2954 +
2955 +            Tmp16 = Descriptor->PinFunction.VendorLength;
2956 +            Descriptor->PinFunction.VendorLength = AcpiUtReadUint16 (&Tmp16);
2957 +
2958              break;
2959  
2960          default:
2961 @@ -1566,7 +1655,8 @@ RsDoPinFunctionDescriptor (
2962               *  (implies resource source must immediately follow the pin list.)
2963               *  Name: _PIN
2964               */
2965 -            *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
2966 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
2967 +            *PinList = AcpiUtReadUint16 (&Tmp16);
2968              PinList++;
2969              PinCount++;
2970  
2971 @@ -1597,6 +1687,13 @@ RsDoPinFunctionDescriptor (
2972          InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
2973      }
2974  
2975 +    /* correct the endian-ness of the values */
2976 +    Tmp16 = Descriptor->PinFunction.PinTableOffset;
2977 +    Descriptor->PinFunction.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
2978 +
2979 +    Tmp16 = Descriptor->PinFunction.ResSourceOffset;
2980 +    Descriptor->PinFunction.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
2981 +
2982      return (Rnode);
2983  }
2984  
2985 @@ -1630,6 +1727,8 @@ RsDoPinConfigDescriptor (
2986      UINT32                  CurrentByteOffset;
2987      UINT32                  PinCount = 0;
2988      UINT32                  i;
2989 +    UINT16                  Tmp16;
2990 +    UINT32                  Tmp32;
2991  
2992      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
2993      CurrentByteOffset = Info->CurrentByteOffset;
2994 @@ -1653,7 +1752,7 @@ RsDoPinConfigDescriptor (
2995          sizeof (AML_RESOURCE_LARGE_HEADER));
2996  
2997      Descriptor = Rnode->Buffer;
2998 -    Descriptor->PinConfig.ResourceLength = DescriptorSize;
2999 +    Descriptor->PinConfig.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
3000      Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG;
3001      Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION;
3002  
3003 @@ -1707,7 +1806,8 @@ RsDoPinConfigDescriptor (
3004  
3005          case 2: /* Pin Config Value [DWORD] (_VAL) */
3006  
3007 -            Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
3008 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
3009 +            Descriptor->PinConfig.PinConfigValue = AcpiUtReadUint32 (&Tmp32);
3010              RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
3011                  CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue));
3012              break;
3013 @@ -1766,7 +1866,8 @@ RsDoPinConfigDescriptor (
3014               *  (implies resource source must immediately follow the pin list.)
3015               *  Name: _PIN
3016               */
3017 -            *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
3018 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
3019 +            *PinList = AcpiUtReadUint16 (&Tmp16);
3020              PinList++;
3021              PinCount++;
3022  
3023 @@ -1797,6 +1898,16 @@ RsDoPinConfigDescriptor (
3024          InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
3025      }
3026  
3027 +    /* correct the endianness if needed */
3028 +    Tmp16 = Descriptor->PinConfig.PinTableOffset;
3029 +    Descriptor->PinConfig.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
3030 +    Tmp16 = Descriptor->PinConfig.ResSourceOffset;
3031 +    Descriptor->PinConfig.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
3032 +    Tmp16 = Descriptor->PinConfig.VendorOffset;
3033 +    Descriptor->PinConfig.VendorOffset = AcpiUtReadUint16 (&Tmp16);
3034 +    Tmp16 = Descriptor->PinConfig.VendorLength;
3035 +    Descriptor->PinConfig.VendorLength = AcpiUtReadUint16 (&Tmp16);
3036 +
3037      return (Rnode);
3038  }
3039  
3040 @@ -1830,6 +1941,7 @@ RsDoPinGroupDescriptor (
3041      UINT32                  CurrentByteOffset;
3042      UINT32                  PinCount = 0;
3043      UINT32                  i;
3044 +    UINT16                  Tmp16;
3045  
3046      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
3047      CurrentByteOffset = Info->CurrentByteOffset;
3048 @@ -1853,7 +1965,7 @@ RsDoPinGroupDescriptor (
3049          sizeof (AML_RESOURCE_LARGE_HEADER));
3050  
3051      Descriptor = Rnode->Buffer;
3052 -    Descriptor->PinGroup.ResourceLength = DescriptorSize;
3053 +    Descriptor->PinGroup.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
3054      Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP;
3055      Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION;
3056  
3057 @@ -1920,7 +2032,8 @@ RsDoPinGroupDescriptor (
3058               *  (implies resource source must immediately follow the pin list.)
3059               *  Name: _PIN
3060               */
3061 -            *PinList = (UINT16) InitializerOp->Asl.Value.Integer;
3062 +        Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
3063 +            *PinList = AcpiUtReadUint16 (&Tmp16);
3064              PinList++;
3065              PinCount++;
3066  
3067 @@ -1951,6 +2064,16 @@ RsDoPinGroupDescriptor (
3068          InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
3069      }
3070  
3071 +    /* correct enddianness as needed */
3072 +    Tmp16 = Descriptor->PinGroup.PinTableOffset;
3073 +    Descriptor->PinGroup.PinTableOffset = AcpiUtReadUint16 (&Tmp16);
3074 +    Tmp16 = Descriptor->PinGroup.LabelOffset;
3075 +    Descriptor->PinGroup.LabelOffset = AcpiUtReadUint16 (&Tmp16);
3076 +    Tmp16 = Descriptor->PinGroup.VendorOffset;
3077 +    Descriptor->PinGroup.VendorOffset = AcpiUtReadUint16 (&Tmp16);
3078 +    Tmp16 = Descriptor->PinGroup.VendorLength;
3079 +    Descriptor->PinGroup.VendorLength = AcpiUtReadUint16 (&Tmp16);
3080 +
3081      return (Rnode);
3082  }
3083  
3084 @@ -1983,6 +2106,7 @@ RsDoPinGroupFunctionDescriptor (
3085      UINT16                  DescriptorSize;
3086      UINT32                  CurrentByteOffset;
3087      UINT32                  i;
3088 +    UINT16                  Tmp16;
3089  
3090      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
3091      CurrentByteOffset = Info->CurrentByteOffset;
3092 @@ -2006,7 +2130,7 @@ RsDoPinGroupFunctionDescriptor (
3093          sizeof (AML_RESOURCE_LARGE_HEADER));
3094  
3095      Descriptor = Rnode->Buffer;
3096 -    Descriptor->PinGroupFunction.ResourceLength = DescriptorSize;
3097 +    Descriptor->PinGroupFunction.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
3098      Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION;
3099      Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION;
3100  
3101 @@ -2038,7 +2162,8 @@ RsDoPinGroupFunctionDescriptor (
3102  
3103          case 1: /* Function Number [WORD] */
3104  
3105 -            Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer;
3106 +            Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
3107 +            Descriptor->PinGroupFunction.FunctionNumber = AcpiUtReadUint16 (&Tmp16);
3108              RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION,
3109                  CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber));
3110              break;
3111 @@ -2097,6 +2222,16 @@ RsDoPinGroupFunctionDescriptor (
3112          InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
3113      }
3114  
3115 +    /* correct enddianness as needed */
3116 +    Tmp16 = Descriptor->PinGroupFunction.ResSourceOffset;
3117 +    Descriptor->PinGroupFunction.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
3118 +    Tmp16 = Descriptor->PinGroupFunction.ResSourceLabelOffset;
3119 +    Descriptor->PinGroupFunction.ResSourceLabelOffset = AcpiUtReadUint16 (&Tmp16);
3120 +    Tmp16 = Descriptor->PinGroupFunction.VendorOffset;
3121 +    Descriptor->PinGroupFunction.VendorOffset = AcpiUtReadUint16 (&Tmp16);
3122 +    Tmp16 = Descriptor->PinGroupFunction.VendorLength;
3123 +    Descriptor->PinGroupFunction.VendorLength = AcpiUtReadUint16 (&Tmp16);
3124 +
3125      return (Rnode);
3126  }
3127  
3128 @@ -2129,6 +2264,8 @@ RsDoPinGroupConfigDescriptor (
3129      UINT16                  DescriptorSize;
3130      UINT32                  CurrentByteOffset;
3131      UINT32                  i;
3132 +    UINT16                  Tmp16;
3133 +    UINT32                  Tmp32;
3134  
3135      InitializerOp = Info->DescriptorTypeOp->Asl.Child;
3136      CurrentByteOffset = Info->CurrentByteOffset;
3137 @@ -2152,7 +2289,7 @@ RsDoPinGroupConfigDescriptor (
3138          sizeof (AML_RESOURCE_LARGE_HEADER));
3139  
3140      Descriptor = Rnode->Buffer;
3141 -    Descriptor->PinGroupConfig.ResourceLength = DescriptorSize;
3142 +    Descriptor->PinGroupConfig.ResourceLength = AcpiUtReadUint16 (&DescriptorSize);
3143      Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG;
3144      Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION;
3145  
3146 @@ -2205,7 +2342,8 @@ RsDoPinGroupConfigDescriptor (
3147  
3148          case 2: /* Pin Config Value [DWORD] (_VAL) */
3149  
3150 -            Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer;
3151 +            Tmp32 = (UINT32) InitializerOp->Asl.Value.Integer;
3152 +            Descriptor->PinGroupConfig.PinConfigValue = AcpiUtReadUint32 (&Tmp32);
3153              RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE,
3154                  CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue));
3155              break;
3156 @@ -2266,5 +2404,15 @@ RsDoPinGroupConfigDescriptor (
3157          InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
3158      }
3159  
3160 +    /* correct enddianness as needed */
3161 +    Tmp16 = Descriptor->PinGroupConfig.ResSourceOffset;
3162 +    Descriptor->PinGroupConfig.ResSourceOffset = AcpiUtReadUint16 (&Tmp16);
3163 +    Tmp16 = Descriptor->PinGroupConfig.ResSourceLabelOffset;
3164 +    Descriptor->PinGroupConfig.ResSourceLabelOffset = AcpiUtReadUint16 (&Tmp16);
3165 +    Tmp16 = Descriptor->PinGroupConfig.VendorOffset;
3166 +    Descriptor->PinGroupConfig.VendorOffset = AcpiUtReadUint16 (&Tmp16);
3167 +    Tmp16 = Descriptor->PinGroupConfig.VendorLength;
3168 +    Descriptor->PinGroupConfig.VendorLength = AcpiUtReadUint16 (&Tmp16);
3169 +
3170      return (Rnode);
3171  }
This page took 0.238814 seconds and 2 git commands to generate.