3 This is a combined patch that folds all of the past and present changes
4 for big-endian support into a single patch, hopefully eliminating any sort
5 of redundancy but also capturing all such changes in a single location.
7 To date, this has been critical for the s390x architecture only.
9 Signed-off-by: Al Stone <ahs3@redhat.com>
11 Index: acpica-unix-20209326/source/compiler/aslcodegen.c
12 ===================================================================
13 --- acpica-unix-20209326.orig/source/compiler/aslcodegen.c
14 +++ acpica-unix-20209326/source/compiler/aslcodegen.c
15 @@ -237,16 +237,12 @@ CgWriteAmlOpcode (
16 ACPI_PARSE_OBJECT *Op)
18 UINT8 PkgLenFirstByte;
22 - UINT8 OpcodeBytes[2];
36 /* We expect some DEFAULT_ARGs, just ignore them */
38 @@ -279,51 +275,52 @@ CgWriteAmlOpcode (
40 /* Special opcodes for within a field definition */
42 - Aml.Opcode = AML_FIELD_OFFSET_OP;
43 + AmlOpcode = AML_FIELD_OFFSET_OP;
46 case AML_INT_ACCESSFIELD_OP:
48 - Aml.Opcode = AML_FIELD_ACCESS_OP;
49 + AmlOpcode = AML_FIELD_ACCESS_OP;
52 case AML_INT_CONNECTION_OP:
54 - Aml.Opcode = AML_FIELD_CONNECTION_OP;
55 + AmlOpcode = AML_FIELD_CONNECTION_OP;
60 - Aml.Opcode = Op->Asl.AmlOpcode;
61 + AmlOpcode = Op->Asl.AmlOpcode;
69 case AML_PACKAGE_LENGTH:
71 /* Value is the length to be encoded (Used in field definitions) */
73 - PkgLen.Len = (UINT32) Op->Asl.Value.Integer;
74 + PkgLen = (UINT32) Op->Asl.Value.Integer;
79 /* Check for two-byte opcode */
81 - if (Aml.Opcode > 0x00FF)
82 + if (AmlOpcode > 0x00FF)
84 /* Write the high byte first */
86 - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1);
87 + Byte = ACPI_HIBYTE(AmlOpcode);
88 + CgLocalWriteAmlData (Op, &Byte, 1);
91 - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1);
92 + Byte = ACPI_LOBYTE(AmlOpcode);
93 + CgLocalWriteAmlData (Op, &Byte, 1);
95 /* Subtreelength doesn't include length of package length bytes */
97 - PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
98 + PkgLen = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
102 @@ -334,8 +331,8 @@ CgWriteAmlOpcode (
103 if (Op->Asl.AmlPkgLenBytes == 1)
105 /* Simplest case -- no bytes to follow, just write the count */
107 - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
108 + Byte = ACPI_LOBYTE(PkgLen);
109 + CgLocalWriteAmlData (Op, &Byte, 1);
111 else if (Op->Asl.AmlPkgLenBytes != 0)
113 @@ -345,7 +342,7 @@ CgWriteAmlOpcode (
115 PkgLenFirstByte = (UINT8)
116 (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
117 - (PkgLen.LenBytes[0] & 0x0F));
120 CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
122 @@ -353,39 +350,47 @@ CgWriteAmlOpcode (
123 * Shift the length over by the 4 bits we just stuffed
130 * Now we can write the remaining bytes -
131 * either 1, 2, or 3 bytes
133 - for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++)
134 + Byte = ACPI_LOBYTE(PkgLen);
135 + CgLocalWriteAmlData (Op, &Byte, 1);
136 + if (Op->Asl.AmlPkgLenBytes >= 3)
138 + Byte = ACPI_HIBYTE(PkgLen);
139 + CgLocalWriteAmlData (Op, &Byte, 1);
141 + if (Op->Asl.AmlPkgLenBytes >= 4)
143 - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
144 + Byte = ACPI_LOBYTE(ACPI_HIWORD(PkgLen));
145 + CgLocalWriteAmlData (Op, &Byte, 1);
150 - switch (Aml.Opcode)
155 - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1);
156 + Byte = (UINT8) Op->Asl.Value.Integer;
157 + CgLocalWriteAmlData (Op, &Byte, 1);
162 - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2);
163 + ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer);
164 + CgLocalWriteAmlData (Op, &Word, 2);
169 - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4);
170 + ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer);
171 + CgLocalWriteAmlData (Op, &DWord, 4);
176 - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8);
177 + ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
178 + CgLocalWriteAmlData (Op, &QWord, 8);
182 @@ -421,6 +426,7 @@ CgWriteTableHeader (
183 ACPI_PARSE_OBJECT *Op)
185 ACPI_PARSE_OBJECT *Child;
187 UINT32 CommentLength;
188 ACPI_COMMENT_NODE *Current;
190 @@ -478,7 +484,7 @@ CgWriteTableHeader (
193 Child = Child->Asl.Next;
194 - AslGbl_TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
195 + ACPI_MOVE_64_TO_32(&AslGbl_TableHeader.OemRevision, &Child->Asl.Value.Integer);
199 @@ -486,12 +492,13 @@ CgWriteTableHeader (
201 /* Compiler version */
203 - AslGbl_TableHeader.AslCompilerRevision = ACPI_CA_VERSION;
204 + DWord = ACPI_CA_VERSION;
205 + ACPI_MOVE_32_TO_32(&AslGbl_TableHeader.AslCompilerRevision, &DWord);
207 /* Table length. Checksum zero for now, will rewrite later */
209 - AslGbl_TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
210 - Op->Asl.AmlSubtreeLength;
211 + DWord = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
212 + ACPI_MOVE_32_TO_32(&AslGbl_TableHeader.Length, &DWord);
214 /* Calculate the comment lengths for this definition block parseOp */
216 @@ -625,7 +632,10 @@ CgWriteNode (
217 ACPI_PARSE_OBJECT *Op)
219 ASL_RESOURCE_NODE *Rnode;
226 /* Write all comments here. */
228 @@ -649,13 +659,24 @@ CgWriteNode (
229 switch (Op->Asl.AmlOpcode)
231 case AML_RAW_DATA_BYTE:
232 + Byte = (UINT8) Op->Asl.Value.Integer;
233 + CgLocalWriteAmlData (Op, &Byte, 1);
236 case AML_RAW_DATA_WORD:
237 - case AML_RAW_DATA_DWORD:
238 - case AML_RAW_DATA_QWORD:
239 + ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer);
240 + CgLocalWriteAmlData (Op, &Word, 2);
243 - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength);
244 + case AML_RAW_DATA_DWORD:
245 + ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer);
246 + CgLocalWriteAmlData (Op, &DWord, 4);
249 + case AML_RAW_DATA_QWORD:
250 + ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
251 + CgLocalWriteAmlData (Op, &QWord, 8);
254 case AML_RAW_DATA_BUFFER:
256 Index: acpica-unix-20209326/source/compiler/aslopcodes.c
257 ===================================================================
258 --- acpica-unix-20209326.orig/source/compiler/aslopcodes.c
259 +++ acpica-unix-20209326/source/compiler/aslopcodes.c
260 @@ -485,6 +485,7 @@ OpcDoUnicode (
263 UINT16 *UnicodeString;
265 ACPI_PARSE_OBJECT *BufferLengthOp;
268 @@ -511,7 +512,8 @@ OpcDoUnicode (
270 for (i = 0; i < Count; i++)
272 - UnicodeString[i] = (UINT16) AsciiString[i];
273 + UChar = (UINT16) AsciiString[i];
274 + ACPI_MOVE_16_TO_16(&UnicodeString[i], &UChar);
278 Index: acpica-unix-20209326/source/compiler/aslrestype1.c
279 ===================================================================
280 --- acpica-unix-20209326.orig/source/compiler/aslrestype1.c
281 +++ acpica-unix-20209326/source/compiler/aslrestype1.c
282 @@ -142,6 +142,11 @@ RsDoMemory24Descriptor (
283 ACPI_PARSE_OBJECT *LengthOp = NULL;
284 ASL_RESOURCE_NODE *Rnode;
285 UINT32 CurrentByteOffset;
286 + UINT16 Minimum = 0;
287 + UINT16 Maximum = 0;
288 + UINT16 AddressLength = 0;
289 + UINT16 Alignment = 0;
290 + UINT16 ResourceLength;
294 @@ -151,7 +156,8 @@ RsDoMemory24Descriptor (
296 Descriptor = Rnode->Buffer;
297 Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
298 - Descriptor->Memory24.ResourceLength = 9;
299 + ResourceLength = 9;
300 + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.ResourceLength, &ResourceLength);
302 /* Process all child initialization nodes */
304 @@ -168,7 +174,7 @@ RsDoMemory24Descriptor (
306 case 1: /* Min Address */
308 - Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
309 + Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
310 RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
311 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
312 MinOp = InitializerOp;
313 @@ -176,7 +182,7 @@ RsDoMemory24Descriptor (
315 case 2: /* Max Address */
317 - Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
318 + Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
319 RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
320 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
321 MaxOp = InitializerOp;
322 @@ -184,14 +190,14 @@ RsDoMemory24Descriptor (
324 case 3: /* Alignment */
326 - Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
327 + Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
328 RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
329 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
334 - Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
335 + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
336 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
337 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
338 LengthOp = InitializerOp;
339 @@ -214,12 +220,17 @@ RsDoMemory24Descriptor (
340 /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
342 RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
343 - Descriptor->Memory24.Minimum,
344 - Descriptor->Memory24.Maximum,
345 - Descriptor->Memory24.AddressLength,
346 - Descriptor->Memory24.Alignment,
351 MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
353 + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Minimum, &Minimum);
354 + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Maximum, &Maximum);
355 + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.AddressLength, &AddressLength);
356 + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Alignment, &Alignment);
361 @@ -248,6 +259,11 @@ RsDoMemory32Descriptor (
362 ACPI_PARSE_OBJECT *AlignOp = NULL;
363 ASL_RESOURCE_NODE *Rnode;
364 UINT32 CurrentByteOffset;
365 + UINT32 Minimum = 0;
366 + UINT32 Maximum = 0;
367 + UINT32 AddressLength = 0;
368 + UINT32 Alignment = 0;
369 + UINT16 ResourceLength;
373 @@ -257,7 +273,8 @@ RsDoMemory32Descriptor (
375 Descriptor = Rnode->Buffer;
376 Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
377 - Descriptor->Memory32.ResourceLength = 17;
378 + ResourceLength = 17;
379 + ACPI_MOVE_16_TO_16(&Descriptor->Memory32.ResourceLength, &ResourceLength);
381 /* Process all child initialization nodes */
383 @@ -274,7 +291,7 @@ RsDoMemory32Descriptor (
385 case 1: /* Min Address */
387 - Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
388 + Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
389 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
390 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
391 MinOp = InitializerOp;
392 @@ -282,7 +299,7 @@ RsDoMemory32Descriptor (
394 case 2: /* Max Address */
396 - Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
397 + Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
398 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
399 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
400 MaxOp = InitializerOp;
401 @@ -290,7 +307,7 @@ RsDoMemory32Descriptor (
403 case 3: /* Alignment */
405 - Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
406 + Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
407 RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
408 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
409 AlignOp = InitializerOp;
410 @@ -298,7 +315,7 @@ RsDoMemory32Descriptor (
414 - Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
415 + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
416 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
417 CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
418 LengthOp = InitializerOp;
419 @@ -321,12 +338,17 @@ RsDoMemory32Descriptor (
420 /* Validate the Min/Max/Len/Align values */
422 RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
423 - Descriptor->Memory32.Minimum,
424 - Descriptor->Memory32.Maximum,
425 - Descriptor->Memory32.AddressLength,
426 - Descriptor->Memory32.Alignment,
431 MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
433 + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Minimum, &Minimum);
434 + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Maximum, &Maximum);
435 + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.AddressLength, &AddressLength);
436 + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Alignment, &Alignment);
441 @@ -351,6 +373,7 @@ RsDoMemory32FixedDescriptor (
442 ACPI_PARSE_OBJECT *InitializerOp;
443 ASL_RESOURCE_NODE *Rnode;
444 UINT32 CurrentByteOffset;
445 + UINT16 ResourceLength;
449 @@ -360,7 +383,8 @@ RsDoMemory32FixedDescriptor (
451 Descriptor = Rnode->Buffer;
452 Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
453 - Descriptor->FixedMemory32.ResourceLength = 9;
454 + ResourceLength = 9;
455 + ACPI_MOVE_16_TO_16(&Descriptor->FixedMemory32.ResourceLength, &ResourceLength);
457 /* Process all child initialization nodes */
459 @@ -377,14 +401,16 @@ RsDoMemory32FixedDescriptor (
461 case 1: /* Address */
463 - Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
464 + ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.Address,
465 + &InitializerOp->Asl.Value.Integer);
466 RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
467 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
472 - Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
473 + ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.AddressLength,
474 + &InitializerOp->Asl.Value.Integer);
475 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
476 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
478 Index: acpica-unix-20209326/source/compiler/aslrestype1i.c
479 ===================================================================
480 --- acpica-unix-20209326.orig/source/compiler/aslrestype1i.c
481 +++ acpica-unix-20209326/source/compiler/aslrestype1i.c
482 @@ -198,6 +198,8 @@ RsDoFixedDmaDescriptor (
483 ACPI_PARSE_OBJECT *InitializerOp;
484 ASL_RESOURCE_NODE *Rnode;
485 UINT32 CurrentByteOffset;
486 + UINT16 RequestLines = 0;
487 + UINT16 Channels = 0;
491 @@ -217,14 +219,14 @@ RsDoFixedDmaDescriptor (
493 case 0: /* DMA Request Lines [WORD] (_DMA) */
495 - Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
496 + RequestLines = (UINT16) InitializerOp->Asl.Value.Integer;
497 RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA,
498 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines));
501 case 1: /* DMA Channel [WORD] (_TYP) */
503 - Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer;
504 + Channels = (UINT16) InitializerOp->Asl.Value.Integer;
505 RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE,
506 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels));
508 @@ -249,6 +251,9 @@ RsDoFixedDmaDescriptor (
509 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
512 + ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.RequestLines, &RequestLines);
513 + ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.Channels, &Channels);
518 @@ -274,6 +279,7 @@ RsDoFixedIoDescriptor (
519 ACPI_PARSE_OBJECT *AddressOp = NULL;
520 ASL_RESOURCE_NODE *Rnode;
521 UINT32 CurrentByteOffset;
522 + UINT16 Address = 0;
526 @@ -293,8 +299,7 @@ RsDoFixedIoDescriptor (
528 case 0: /* Base Address */
530 - Descriptor->FixedIo.Address =
531 - (UINT16) InitializerOp->Asl.Value.Integer;
532 + Address = (UINT16) InitializerOp->Asl.Value.Integer;
533 RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
534 CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
535 AddressOp = InitializerOp;
536 @@ -324,11 +329,13 @@ RsDoFixedIoDescriptor (
540 - if (Descriptor->FixedIo.Address > 0x03FF)
541 + if (Address > 0x03FF)
543 AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
546 + ACPI_MOVE_16_TO_16(&Descriptor->FixedIo.Address, &Address);
551 @@ -357,6 +364,8 @@ RsDoIoDescriptor (
552 ACPI_PARSE_OBJECT *AlignOp = NULL;
553 ASL_RESOURCE_NODE *Rnode;
554 UINT32 CurrentByteOffset;
555 + UINT16 Minimum = 0;
556 + UINT16 Maximum = 0;
560 @@ -383,8 +392,7 @@ RsDoIoDescriptor (
562 case 1: /* Min Address */
564 - Descriptor->Io.Minimum =
565 - (UINT16) InitializerOp->Asl.Value.Integer;
566 + Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
567 RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
568 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
569 MinOp = InitializerOp;
570 @@ -392,8 +400,7 @@ RsDoIoDescriptor (
572 case 2: /* Max Address */
574 - Descriptor->Io.Maximum =
575 - (UINT16) InitializerOp->Asl.Value.Integer;
576 + Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
577 RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
578 CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
579 MaxOp = InitializerOp;
580 @@ -434,12 +441,15 @@ RsDoIoDescriptor (
581 /* Validate the Min/Max/Len/Align values */
583 RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
584 - Descriptor->Io.Minimum,
585 - Descriptor->Io.Maximum,
588 Descriptor->Io.AddressLength,
589 Descriptor->Io.Alignment,
590 MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
592 + ACPI_MOVE_16_TO_16(&Descriptor->Io.Minimum, &Minimum);
593 + ACPI_MOVE_16_TO_16(&Descriptor->Io.Maximum, &Maximum);
598 @@ -559,9 +569,9 @@ RsDoIrqDescriptor (
599 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
602 - /* Now we can set the channel mask */
603 + /* Now we can set the interrupt mask */
605 - Descriptor->Irq.IrqMask = IrqMask;
606 + ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
610 @@ -660,6 +670,6 @@ RsDoIrqNoFlagsDescriptor (
612 /* Now we can set the interrupt mask */
614 - Descriptor->Irq.IrqMask = IrqMask;
615 + ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
618 Index: acpica-unix-20209326/source/compiler/aslrestype2.c
619 ===================================================================
620 --- acpica-unix-20209326.orig/source/compiler/aslrestype2.c
621 +++ acpica-unix-20209326/source/compiler/aslrestype2.c
622 @@ -76,6 +76,7 @@ RsDoGeneralRegisterDescriptor (
623 ACPI_PARSE_OBJECT *InitializerOp;
624 ASL_RESOURCE_NODE *Rnode;
625 UINT32 CurrentByteOffset;
626 + UINT16 ResourceLength;
630 @@ -85,7 +86,9 @@ RsDoGeneralRegisterDescriptor (
632 Descriptor = Rnode->Buffer;
633 Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
634 - Descriptor->GenericReg.ResourceLength = 12;
635 + ResourceLength = 12;
636 + ACPI_MOVE_16_TO_16(&Descriptor->GenericReg.ResourceLength,
639 /* Process all child initialization nodes */
641 @@ -95,35 +98,52 @@ RsDoGeneralRegisterDescriptor (
643 case 0: /* Address space */
646 Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
648 + ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.AddressSpaceId,
649 + &InitializerOp->Asl.Value.Integer);
650 RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE,
651 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId));
654 case 1: /* Register Bit Width */
657 Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
659 + ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.BitWidth,
660 + &InitializerOp->Asl.Value.Integer);
661 RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH,
662 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth));
665 case 2: /* Register Bit Offset */
668 Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
670 + ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.BitOffset,
671 + &InitializerOp->Asl.Value.Integer);
672 RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET,
673 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset));
676 case 3: /* Register Address */
678 - Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
679 + ACPI_MOVE_64_TO_64(&Descriptor->GenericReg.Address,
680 + &InitializerOp->Asl.Value.Integer);
681 RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS,
682 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
685 case 4: /* Access Size (ACPI 3.0) */
688 Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer;
690 + ACPI_MOVE_64_TO_8(&Descriptor->GenericReg.AccessSize,
691 + &InitializerOp->Asl.Value.Integer);
692 RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE,
693 CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize));
695 @@ -177,6 +197,7 @@ RsDoInterruptDescriptor (
696 AML_RESOURCE *Rover = NULL;
697 ACPI_PARSE_OBJECT *InitializerOp;
698 ASL_RESOURCE_NODE *Rnode;
699 + UINT16 ResourceLength = 0;
700 UINT16 StringLength = 0;
701 UINT32 OptionIndex = 0;
702 UINT32 CurrentByteOffset;
703 @@ -225,7 +246,7 @@ RsDoInterruptDescriptor (
704 * Initial descriptor length -- may be enlarged if there are
705 * optional fields present
707 - Descriptor->ExtendedIrq.ResourceLength = 2; /* Flags and table length byte */
708 + ResourceLength = 2; /* Flags and table length byte */
709 Descriptor->ExtendedIrq.InterruptCount = 0;
711 Rover = ACPI_CAST_PTR (AML_RESOURCE,
712 @@ -333,10 +354,11 @@ RsDoInterruptDescriptor (
714 /* Save the integer and move pointer to the next one */
716 - Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;
717 + ACPI_MOVE_64_TO_32(&Rover->DwordItem,
718 + &InitializerOp->Asl.Value.Integer);
719 Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);
720 Descriptor->ExtendedIrq.InterruptCount++;
721 - Descriptor->ExtendedIrq.ResourceLength += 4;
722 + ResourceLength += 4;
724 /* Case 7: First interrupt number in list */
726 @@ -372,7 +394,7 @@ RsDoInterruptDescriptor (
728 Rover->ByteItem = ResSourceIndex;
729 Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1);
730 - Descriptor->ExtendedIrq.ResourceLength += 1;
731 + ResourceLength += 1;
734 /* Add optional ResSource string if present */
735 @@ -381,14 +403,15 @@ RsDoInterruptDescriptor (
737 strcpy ((char *) Rover, (char *) ResSourceString);
739 - Descriptor->ExtendedIrq.ResourceLength = (UINT16)
740 - (Descriptor->ExtendedIrq.ResourceLength + StringLength);
741 + ResourceLength = (UINT16) (ResourceLength + StringLength);
744 Rnode->BufferLength =
745 (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
746 ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))
747 + OptionIndex + StringLength;
748 + ACPI_MOVE_16_TO_16(&Descriptor->ExtendedIrq.ResourceLength,
753 @@ -436,7 +459,7 @@ RsDoVendorLargeDescriptor (
755 Descriptor = Rnode->Buffer;
756 Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
757 - Descriptor->VendorLarge.ResourceLength = (UINT16) i;
758 + ACPI_MOVE_32_TO_16(&Descriptor->VendorLarge.ResourceLength, &i);
760 /* Point to end-of-descriptor for vendor data */
762 Index: acpica-unix-20209326/source/compiler/aslrestype2d.c
763 ===================================================================
764 --- acpica-unix-20209326.orig/source/compiler/aslrestype2d.c
765 +++ acpica-unix-20209326/source/compiler/aslrestype2d.c
766 @@ -79,7 +79,13 @@ RsDoDwordIoDescriptor (
767 ACPI_PARSE_OBJECT *GranOp = NULL;
768 ASL_RESOURCE_NODE *Rnode;
769 UINT16 StringLength = 0;
770 + UINT16 ResourceLength = 0;
771 UINT32 OptionIndex = 0;
772 + UINT32 Minimum = 0;
773 + UINT32 Maximum = 0;
774 + UINT32 AddressLength = 0;
775 + UINT32 Granularity = 0;
776 + UINT32 TranslationOffset = 0;
777 UINT8 *OptionalFields;
778 UINT32 CurrentByteOffset;
780 @@ -102,8 +108,7 @@ RsDoDwordIoDescriptor (
781 * optional fields present
783 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
784 - Descriptor->Address32.ResourceLength = (UINT16)
785 - (sizeof (AML_RESOURCE_ADDRESS32) -
786 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
787 sizeof (AML_RESOURCE_LARGE_HEADER));
789 /* Process all child initialization nodes */
790 @@ -147,8 +152,7 @@ RsDoDwordIoDescriptor (
792 case 5: /* Address Granularity */
794 - Descriptor->Address32.Granularity =
795 - (UINT32) InitializerOp->Asl.Value.Integer;
796 + Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
797 RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
798 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
799 GranOp = InitializerOp;
800 @@ -156,8 +160,7 @@ RsDoDwordIoDescriptor (
802 case 6: /* Address Min */
804 - Descriptor->Address32.Minimum =
805 - (UINT32) InitializerOp->Asl.Value.Integer;
806 + Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
807 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
808 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
809 MinOp = InitializerOp;
810 @@ -165,8 +168,7 @@ RsDoDwordIoDescriptor (
812 case 7: /* Address Max */
814 - Descriptor->Address32.Maximum =
815 - (UINT32) InitializerOp->Asl.Value.Integer;
816 + Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
817 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
818 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
819 MaxOp = InitializerOp;
820 @@ -174,16 +176,14 @@ RsDoDwordIoDescriptor (
822 case 8: /* Translation Offset */
824 - Descriptor->Address32.TranslationOffset =
825 - (UINT32) InitializerOp->Asl.Value.Integer;
826 + TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
827 RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
828 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
831 case 9: /* Address Length */
833 - Descriptor->Address32.AddressLength =
834 - (UINT32) InitializerOp->Asl.Value.Integer;
835 + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
836 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
837 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
838 LengthOp = InitializerOp;
839 @@ -197,7 +197,7 @@ RsDoDwordIoDescriptor (
841 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
843 - Descriptor->Address32.ResourceLength++;
845 ResSourceIndex = TRUE;
848 @@ -211,8 +211,7 @@ RsDoDwordIoDescriptor (
850 /* Found a valid ResourceSource */
852 - Descriptor->Address32.ResourceLength = (UINT16)
853 - (Descriptor->Address32.ResourceLength + StringLength);
854 + ResourceLength = (UINT16) (ResourceLength + StringLength);
857 &OptionalFields[OptionIndex],
858 @@ -272,13 +271,20 @@ RsDoDwordIoDescriptor (
859 /* Validate the Min/Max/Len/Gran values */
861 RsLargeAddressCheck (
862 - (UINT64) Descriptor->Address32.Minimum,
863 - (UINT64) Descriptor->Address32.Maximum,
864 - (UINT64) Descriptor->Address32.AddressLength,
865 - (UINT64) Descriptor->Address32.Granularity,
870 Descriptor->Address32.Flags,
871 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
873 + ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
874 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
875 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
876 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
877 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
878 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
880 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
881 OptionIndex + StringLength;
883 @@ -310,7 +316,13 @@ RsDoDwordMemoryDescriptor (
884 ASL_RESOURCE_NODE *Rnode;
885 UINT8 *OptionalFields;
886 UINT16 StringLength = 0;
887 + UINT16 ResourceLength = 0;
888 UINT32 OptionIndex = 0;
889 + UINT32 Minimum = 0;
890 + UINT32 Maximum = 0;
891 + UINT32 AddressLength = 0;
892 + UINT32 Granularity = 0;
893 + UINT32 TranslationOffset = 0;
894 UINT32 CurrentByteOffset;
896 BOOLEAN ResSourceIndex = FALSE;
897 @@ -332,11 +344,9 @@ RsDoDwordMemoryDescriptor (
898 * optional fields present
900 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
901 - Descriptor->Address32.ResourceLength = (UINT16)
902 - (sizeof (AML_RESOURCE_ADDRESS32) -
903 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
904 sizeof (AML_RESOURCE_LARGE_HEADER));
907 /* Process all child initialization nodes */
909 for (i = 0; InitializerOp; i++)
910 @@ -385,8 +395,7 @@ RsDoDwordMemoryDescriptor (
912 case 6: /* Address Granularity */
914 - Descriptor->Address32.Granularity =
915 - (UINT32) InitializerOp->Asl.Value.Integer;
916 + Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
917 RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
918 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
919 GranOp = InitializerOp;
920 @@ -394,8 +403,7 @@ RsDoDwordMemoryDescriptor (
922 case 7: /* Min Address */
924 - Descriptor->Address32.Minimum =
925 - (UINT32) InitializerOp->Asl.Value.Integer;
926 + Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
927 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
928 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
929 MinOp = InitializerOp;
930 @@ -403,8 +411,7 @@ RsDoDwordMemoryDescriptor (
932 case 8: /* Max Address */
934 - Descriptor->Address32.Maximum =
935 - (UINT32) InitializerOp->Asl.Value.Integer;
936 + Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
937 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
938 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
939 MaxOp = InitializerOp;
940 @@ -412,16 +419,14 @@ RsDoDwordMemoryDescriptor (
942 case 9: /* Translation Offset */
944 - Descriptor->Address32.TranslationOffset =
945 - (UINT32) InitializerOp->Asl.Value.Integer;
946 + TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
947 RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
948 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
951 case 10: /* Address Length */
953 - Descriptor->Address32.AddressLength =
954 - (UINT32) InitializerOp->Asl.Value.Integer;
955 + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
956 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
957 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
958 LengthOp = InitializerOp;
959 @@ -433,7 +438,7 @@ RsDoDwordMemoryDescriptor (
961 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
963 - Descriptor->Address32.ResourceLength++;
965 ResSourceIndex = TRUE;
968 @@ -445,8 +450,8 @@ RsDoDwordMemoryDescriptor (
972 - Descriptor->Address32.ResourceLength = (UINT16)
973 - (Descriptor->Address32.ResourceLength + StringLength);
975 + ResourceLength = (UINT16) (ResourceLength + StringLength);
978 &OptionalFields[OptionIndex],
979 @@ -507,13 +512,20 @@ RsDoDwordMemoryDescriptor (
980 /* Validate the Min/Max/Len/Gran values */
982 RsLargeAddressCheck (
983 - (UINT64) Descriptor->Address32.Minimum,
984 - (UINT64) Descriptor->Address32.Maximum,
985 - (UINT64) Descriptor->Address32.AddressLength,
986 - (UINT64) Descriptor->Address32.Granularity,
991 Descriptor->Address32.Flags,
992 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
994 + ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
995 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
996 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
997 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
998 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
999 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
1001 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
1002 OptionIndex + StringLength;
1004 @@ -545,7 +557,13 @@ RsDoDwordSpaceDescriptor (
1005 ASL_RESOURCE_NODE *Rnode;
1006 UINT8 *OptionalFields;
1007 UINT16 StringLength = 0;
1008 + UINT16 ResourceLength = 0;
1009 UINT32 OptionIndex = 0;
1010 + UINT32 Minimum = 0;
1011 + UINT32 Maximum = 0;
1012 + UINT32 AddressLength = 0;
1013 + UINT32 Granularity = 0;
1014 + UINT32 TranslationOffset = 0;
1015 UINT32 CurrentByteOffset;
1017 BOOLEAN ResSourceIndex = FALSE;
1018 @@ -566,8 +584,7 @@ RsDoDwordSpaceDescriptor (
1019 * optional fields present
1021 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
1022 - Descriptor->Address32.ResourceLength = (UINT16)
1023 - (sizeof (AML_RESOURCE_ADDRESS32) -
1024 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) -
1025 sizeof (AML_RESOURCE_LARGE_HEADER));
1027 /* Process all child initialization nodes */
1028 @@ -616,8 +633,7 @@ RsDoDwordSpaceDescriptor (
1030 case 6: /* Address Granularity */
1032 - Descriptor->Address32.Granularity =
1033 - (UINT32) InitializerOp->Asl.Value.Integer;
1034 + Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
1035 RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1036 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
1037 GranOp = InitializerOp;
1038 @@ -625,8 +641,7 @@ RsDoDwordSpaceDescriptor (
1040 case 7: /* Min Address */
1042 - Descriptor->Address32.Minimum =
1043 - (UINT32) InitializerOp->Asl.Value.Integer;
1044 + Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
1045 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1046 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
1047 MinOp = InitializerOp;
1048 @@ -634,8 +649,7 @@ RsDoDwordSpaceDescriptor (
1050 case 8: /* Max Address */
1052 - Descriptor->Address32.Maximum =
1053 - (UINT32) InitializerOp->Asl.Value.Integer;
1054 + Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
1055 RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1056 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
1057 MaxOp = InitializerOp;
1058 @@ -643,16 +657,14 @@ RsDoDwordSpaceDescriptor (
1060 case 9: /* Translation Offset */
1062 - Descriptor->Address32.TranslationOffset =
1063 - (UINT32) InitializerOp->Asl.Value.Integer;
1064 + TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
1065 RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1066 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
1069 case 10: /* Address Length */
1071 - Descriptor->Address32.AddressLength =
1072 - (UINT32) InitializerOp->Asl.Value.Integer;
1073 + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
1074 RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1075 CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
1076 LengthOp = InitializerOp;
1077 @@ -664,7 +676,7 @@ RsDoDwordSpaceDescriptor (
1079 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1081 - Descriptor->Address32.ResourceLength++;
1083 ResSourceIndex = TRUE;
1086 @@ -676,8 +688,7 @@ RsDoDwordSpaceDescriptor (
1090 - Descriptor->Address32.ResourceLength = (UINT16)
1091 - (Descriptor->Address32.ResourceLength + StringLength);
1092 + ResourceLength = (UINT16) (ResourceLength + StringLength);
1095 &OptionalFields[OptionIndex],
1096 @@ -724,13 +735,20 @@ RsDoDwordSpaceDescriptor (
1097 /* Validate the Min/Max/Len/Gran values */
1099 RsLargeAddressCheck (
1100 - (UINT64) Descriptor->Address32.Minimum,
1101 - (UINT64) Descriptor->Address32.Maximum,
1102 - (UINT64) Descriptor->Address32.AddressLength,
1103 - (UINT64) Descriptor->Address32.Granularity,
1108 Descriptor->Address32.Flags,
1109 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1111 + ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength);
1112 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum);
1113 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum);
1114 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength);
1115 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity);
1116 + ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset);
1118 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
1119 OptionIndex + StringLength;
1121 Index: acpica-unix-20209326/source/compiler/aslrestype2e.c
1122 ===================================================================
1123 --- acpica-unix-20209326.orig/source/compiler/aslrestype2e.c
1124 +++ acpica-unix-20209326/source/compiler/aslrestype2e.c
1125 @@ -78,6 +78,13 @@ RsDoExtendedIoDescriptor (
1126 ACPI_PARSE_OBJECT *GranOp = NULL;
1127 ASL_RESOURCE_NODE *Rnode;
1128 UINT16 StringLength = 0;
1129 + UINT16 ResourceLength = 0;
1130 + UINT64 Minimum = 0;
1131 + UINT64 Maximum = 0;
1132 + UINT64 AddressLength = 0;
1133 + UINT64 Granularity = 0;
1134 + UINT64 TranslationOffset = 0;
1135 + UINT64 TypeSpecific = 0;
1136 UINT32 CurrentByteOffset;
1139 @@ -94,9 +101,10 @@ RsDoExtendedIoDescriptor (
1140 Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
1141 Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
1143 - Descriptor->ExtAddress64.ResourceLength = (UINT16)
1144 - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
1145 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
1146 sizeof (AML_RESOURCE_LARGE_HEADER));
1147 + ACPI_MOVE_16_TO_16(&Descriptor->ExtAddress64.ResourceLength,
1150 /* Process all child initialization nodes */
1152 @@ -139,7 +147,7 @@ RsDoExtendedIoDescriptor (
1154 case 5: /* Address Granularity */
1156 - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
1157 + Granularity = InitializerOp->Asl.Value.Integer;
1158 RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1159 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
1160 GranOp = InitializerOp;
1161 @@ -147,7 +155,7 @@ RsDoExtendedIoDescriptor (
1163 case 6: /* Address Min */
1165 - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
1166 + Minimum = InitializerOp->Asl.Value.Integer;
1167 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1168 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
1169 MinOp = InitializerOp;
1170 @@ -155,7 +163,7 @@ RsDoExtendedIoDescriptor (
1172 case 7: /* Address Max */
1174 - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
1175 + Maximum = InitializerOp->Asl.Value.Integer;
1176 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1177 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
1178 MaxOp = InitializerOp;
1179 @@ -163,14 +171,14 @@ RsDoExtendedIoDescriptor (
1181 case 8: /* Translation Offset */
1183 - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
1184 + TranslationOffset = InitializerOp->Asl.Value.Integer;
1185 RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1186 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
1189 case 9: /* Address Length */
1191 - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
1192 + AddressLength = InitializerOp->Asl.Value.Integer;
1193 RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1194 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
1195 LengthOp = InitializerOp;
1196 @@ -178,7 +186,7 @@ RsDoExtendedIoDescriptor (
1198 case 10: /* Type-Specific Attributes */
1200 - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
1201 + TypeSpecific = InitializerOp->Asl.Value.Integer;
1202 RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
1203 CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
1205 @@ -214,13 +222,20 @@ RsDoExtendedIoDescriptor (
1206 /* Validate the Min/Max/Len/Gran values */
1208 RsLargeAddressCheck (
1209 - Descriptor->ExtAddress64.Minimum,
1210 - Descriptor->ExtAddress64.Maximum,
1211 - Descriptor->ExtAddress64.AddressLength,
1212 - Descriptor->ExtAddress64.Granularity,
1217 Descriptor->ExtAddress64.Flags,
1218 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1220 + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Minimum, &Minimum);
1221 + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Maximum, &Maximum);
1222 + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.AddressLength, &AddressLength);
1223 + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Granularity, &Granularity);
1224 + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TranslationOffset, &TranslationOffset);
1225 + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TypeSpecific, &TypeSpecific);
1227 Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
1230 Index: acpica-unix-20209326/source/compiler/aslrestype2q.c
1231 ===================================================================
1232 --- acpica-unix-20209326.orig/source/compiler/aslrestype2q.c
1233 +++ acpica-unix-20209326/source/compiler/aslrestype2q.c
1234 @@ -80,7 +80,13 @@ RsDoQwordIoDescriptor (
1235 ASL_RESOURCE_NODE *Rnode;
1236 UINT8 *OptionalFields;
1237 UINT16 StringLength = 0;
1238 + UINT16 ResourceLength = 0;
1239 UINT32 OptionIndex = 0;
1240 + UINT64 Minimum = 0;
1241 + UINT64 Maximum = 0;
1242 + UINT64 AddressLength = 0;
1243 + UINT64 Granularity = 0;
1244 + UINT64 TranslationOffset = 0;
1245 UINT32 CurrentByteOffset;
1247 BOOLEAN ResSourceIndex = FALSE;
1248 @@ -102,8 +108,7 @@ RsDoQwordIoDescriptor (
1249 * optional fields present
1251 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
1252 - Descriptor->Address64.ResourceLength = (UINT16)
1253 - (sizeof (AML_RESOURCE_ADDRESS64) -
1254 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
1255 sizeof (AML_RESOURCE_LARGE_HEADER));
1257 /* Process all child initialization nodes */
1258 @@ -147,7 +152,7 @@ RsDoQwordIoDescriptor (
1260 case 5: /* Address Granularity */
1262 - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
1263 + Granularity = InitializerOp->Asl.Value.Integer;
1264 RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1265 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
1266 GranOp = InitializerOp;
1267 @@ -155,7 +160,7 @@ RsDoQwordIoDescriptor (
1269 case 6: /* Address Min */
1271 - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
1272 + Minimum = InitializerOp->Asl.Value.Integer;
1273 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1274 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
1275 MinOp = InitializerOp;
1276 @@ -163,7 +168,7 @@ RsDoQwordIoDescriptor (
1278 case 7: /* Address Max */
1280 - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
1281 + Maximum = InitializerOp->Asl.Value.Integer;
1282 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1283 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
1284 MaxOp = InitializerOp;
1285 @@ -171,14 +176,14 @@ RsDoQwordIoDescriptor (
1287 case 8: /* Translation Offset */
1289 - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
1290 + TranslationOffset = InitializerOp->Asl.Value.Integer;
1291 RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1292 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
1295 case 9: /* Address Length */
1297 - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
1298 + AddressLength = InitializerOp->Asl.Value.Integer;
1299 RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1300 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
1301 LengthOp = InitializerOp;
1302 @@ -190,7 +195,7 @@ RsDoQwordIoDescriptor (
1304 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1306 - Descriptor->Address64.ResourceLength++;
1308 ResSourceIndex = TRUE;
1311 @@ -202,8 +207,7 @@ RsDoQwordIoDescriptor (
1315 - Descriptor->Address64.ResourceLength = (UINT16)
1316 - (Descriptor->Address64.ResourceLength + StringLength);
1317 + ResourceLength = (UINT16) (ResourceLength + StringLength);
1320 &OptionalFields[OptionIndex],
1321 @@ -263,13 +267,20 @@ RsDoQwordIoDescriptor (
1322 /* Validate the Min/Max/Len/Gran values */
1324 RsLargeAddressCheck (
1325 - Descriptor->Address64.Minimum,
1326 - Descriptor->Address64.Maximum,
1327 - Descriptor->Address64.AddressLength,
1328 - Descriptor->Address64.Granularity,
1333 Descriptor->Address64.Flags,
1334 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1336 + ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
1337 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
1338 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
1339 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
1340 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
1341 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
1343 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
1344 OptionIndex + StringLength;
1346 @@ -301,7 +312,13 @@ RsDoQwordMemoryDescriptor (
1347 ASL_RESOURCE_NODE *Rnode;
1348 UINT8 *OptionalFields;
1349 UINT16 StringLength = 0;
1350 + UINT16 ResourceLength = 0;
1351 UINT32 OptionIndex = 0;
1352 + UINT64 Minimum = 0;
1353 + UINT64 Maximum = 0;
1354 + UINT64 AddressLength = 0;
1355 + UINT64 Granularity = 0;
1356 + UINT64 TranslationOffset = 0;
1357 UINT32 CurrentByteOffset;
1359 BOOLEAN ResSourceIndex = FALSE;
1360 @@ -323,8 +340,7 @@ RsDoQwordMemoryDescriptor (
1361 * optional fields present
1363 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
1364 - Descriptor->Address64.ResourceLength = (UINT16)
1365 - (sizeof (AML_RESOURCE_ADDRESS64) -
1366 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
1367 sizeof (AML_RESOURCE_LARGE_HEADER));
1369 /* Process all child initialization nodes */
1370 @@ -375,7 +391,7 @@ RsDoQwordMemoryDescriptor (
1372 case 6: /* Address Granularity */
1374 - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
1375 + Granularity = InitializerOp->Asl.Value.Integer;
1376 RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1377 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
1378 GranOp = InitializerOp;
1379 @@ -383,7 +399,7 @@ RsDoQwordMemoryDescriptor (
1381 case 7: /* Min Address */
1383 - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
1384 + Minimum = InitializerOp->Asl.Value.Integer;
1385 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1386 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
1387 MinOp = InitializerOp;
1388 @@ -391,7 +407,7 @@ RsDoQwordMemoryDescriptor (
1390 case 8: /* Max Address */
1392 - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
1393 + Maximum = InitializerOp->Asl.Value.Integer;
1394 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1395 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
1396 MaxOp = InitializerOp;
1397 @@ -399,14 +415,14 @@ RsDoQwordMemoryDescriptor (
1399 case 9: /* Translation Offset */
1401 - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
1402 + TranslationOffset = InitializerOp->Asl.Value.Integer;
1403 RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1404 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
1407 case 10: /* Address Length */
1409 - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
1410 + AddressLength = InitializerOp->Asl.Value.Integer;
1411 RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1412 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
1413 LengthOp = InitializerOp;
1414 @@ -418,7 +434,7 @@ RsDoQwordMemoryDescriptor (
1416 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1418 - Descriptor->Address64.ResourceLength++;
1420 ResSourceIndex = TRUE;
1423 @@ -430,8 +446,7 @@ RsDoQwordMemoryDescriptor (
1427 - Descriptor->Address64.ResourceLength = (UINT16)
1428 - (Descriptor->Address64.ResourceLength + StringLength);
1429 + ResourceLength = (UINT16) (ResourceLength + StringLength);
1432 &OptionalFields[OptionIndex],
1433 @@ -492,13 +507,20 @@ RsDoQwordMemoryDescriptor (
1434 /* Validate the Min/Max/Len/Gran values */
1436 RsLargeAddressCheck (
1437 - Descriptor->Address64.Minimum,
1438 - Descriptor->Address64.Maximum,
1439 - Descriptor->Address64.AddressLength,
1440 - Descriptor->Address64.Granularity,
1445 Descriptor->Address64.Flags,
1446 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1448 + ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
1449 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
1450 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
1451 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
1452 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
1453 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
1455 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
1456 OptionIndex + StringLength;
1458 @@ -530,9 +552,15 @@ RsDoQwordSpaceDescriptor (
1459 ASL_RESOURCE_NODE *Rnode;
1460 UINT8 *OptionalFields;
1461 UINT16 StringLength = 0;
1462 + UINT16 ResourceLength = 0;
1463 UINT32 OptionIndex = 0;
1464 UINT32 CurrentByteOffset;
1466 + UINT64 Minimum = 0;
1467 + UINT64 Maximum = 0;
1468 + UINT64 AddressLength = 0;
1469 + UINT64 Granularity = 0;
1470 + UINT64 TranslationOffset = 0;
1471 BOOLEAN ResSourceIndex = FALSE;
1474 @@ -551,8 +579,7 @@ RsDoQwordSpaceDescriptor (
1475 * optional fields present
1477 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
1478 - Descriptor->Address64.ResourceLength = (UINT16)
1479 - (sizeof (AML_RESOURCE_ADDRESS64) -
1480 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) -
1481 sizeof (AML_RESOURCE_LARGE_HEADER));
1483 /* Process all child initialization nodes */
1484 @@ -601,7 +628,7 @@ RsDoQwordSpaceDescriptor (
1486 case 6: /* Address Granularity */
1488 - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
1489 + Granularity = InitializerOp->Asl.Value.Integer;
1490 RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
1491 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
1492 GranOp = InitializerOp;
1493 @@ -609,7 +636,7 @@ RsDoQwordSpaceDescriptor (
1495 case 7: /* Min Address */
1497 - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
1498 + Minimum = InitializerOp->Asl.Value.Integer;
1499 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR,
1500 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
1501 MinOp = InitializerOp;
1502 @@ -617,7 +644,7 @@ RsDoQwordSpaceDescriptor (
1504 case 8: /* Max Address */
1506 - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
1507 + Maximum = InitializerOp->Asl.Value.Integer;
1508 RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR,
1509 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
1510 MaxOp = InitializerOp;
1511 @@ -625,14 +652,14 @@ RsDoQwordSpaceDescriptor (
1513 case 9: /* Translation Offset */
1515 - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
1516 + TranslationOffset = InitializerOp->Asl.Value.Integer;
1517 RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
1518 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
1521 case 10: /* Address Length */
1523 - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
1524 + AddressLength = InitializerOp->Asl.Value.Integer;
1525 RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH,
1526 CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
1527 LengthOp = InitializerOp;
1528 @@ -644,7 +671,7 @@ RsDoQwordSpaceDescriptor (
1530 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1532 - Descriptor->Address64.ResourceLength++;
1534 ResSourceIndex = TRUE;
1537 @@ -656,8 +683,7 @@ RsDoQwordSpaceDescriptor (
1541 - Descriptor->Address64.ResourceLength = (UINT16)
1542 - (Descriptor->Address64.ResourceLength + StringLength);
1543 + ResourceLength = (UINT16) (ResourceLength + StringLength);
1546 &OptionalFields[OptionIndex],
1547 @@ -703,13 +729,20 @@ RsDoQwordSpaceDescriptor (
1548 /* Validate the Min/Max/Len/Gran values */
1550 RsLargeAddressCheck (
1551 - Descriptor->Address64.Minimum,
1552 - Descriptor->Address64.Maximum,
1553 - Descriptor->Address64.AddressLength,
1554 - Descriptor->Address64.Granularity,
1559 Descriptor->Address64.Flags,
1560 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1562 + ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength);
1563 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum);
1564 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum);
1565 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength);
1566 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity);
1567 + ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset);
1569 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
1570 OptionIndex + StringLength;
1572 Index: acpica-unix-20209326/source/compiler/aslrestype2s.c
1573 ===================================================================
1574 --- acpica-unix-20209326.orig/source/compiler/aslrestype2s.c
1575 +++ acpica-unix-20209326/source/compiler/aslrestype2s.c
1576 @@ -340,9 +340,14 @@ RsDoGpioIntDescriptor (
1577 UINT16 VendorLength;
1578 UINT16 InterruptLength;
1579 UINT16 DescriptorSize;
1580 + UINT16 IntFlags = 0;
1581 + UINT16 DebounceTimeout = 0;
1583 UINT32 CurrentByteOffset;
1584 UINT32 PinCount = 0;
1590 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1591 @@ -367,7 +372,7 @@ RsDoGpioIntDescriptor (
1592 sizeof (AML_RESOURCE_LARGE_HEADER));
1594 Descriptor = Rnode->Buffer;
1595 - Descriptor->Gpio.ResourceLength = DescriptorSize;
1596 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResourceLength, &DescriptorSize);
1597 Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
1598 Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
1599 Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_INT;
1600 @@ -382,11 +387,11 @@ RsDoGpioIntDescriptor (
1602 /* Setup offsets within the descriptor */
1604 - Descriptor->Gpio.PinTableOffset = (UINT16)
1605 - ACPI_PTR_DIFF (InterruptList, Descriptor);
1606 + Tmp16 = (UINT16) ACPI_PTR_DIFF (InterruptList, Descriptor);
1607 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.PinTableOffset, &Tmp16);
1609 - Descriptor->Gpio.ResSourceOffset = (UINT16)
1610 - ACPI_PTR_DIFF (ResourceSource, Descriptor);
1611 + Tmp16 = (UINT16) ACPI_PTR_DIFF (ResourceSource, Descriptor);
1612 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResSourceOffset, &Tmp16);
1614 /* Process all child initialization nodes */
1616 @@ -396,21 +401,21 @@ RsDoGpioIntDescriptor (
1618 case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */
1620 - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
1621 + RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0);
1622 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
1623 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0);
1626 case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */
1628 - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 1, 0);
1629 + RsSetFlagBits16 (&IntFlags, InitializerOp, 1, 0);
1630 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_POLARITY,
1631 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 1, 2);
1634 case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */
1636 - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
1637 + RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0);
1638 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1639 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3, 2);
1641 @@ -424,7 +429,7 @@ RsDoGpioIntDescriptor (
1643 case 4: /* Debounce Timeout [WORD] (_DBT) */
1645 - Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
1646 + DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
1647 RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
1648 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
1650 @@ -451,7 +456,7 @@ RsDoGpioIntDescriptor (
1652 case 7: /* Resource Usage (consumer/producer) */
1654 - RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
1655 + RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
1658 case 8: /* Resource Tag (Descriptor Name) */
1659 @@ -466,13 +471,14 @@ RsDoGpioIntDescriptor (
1660 * This field is required in order to calculate the length
1661 * of the ResourceSource at runtime.
1663 - Descriptor->Gpio.VendorOffset = (UINT16)
1664 - ACPI_PTR_DIFF (VendorData, Descriptor);
1665 + Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor);
1666 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorOffset, &Tmp16);
1668 if (RsGetVendorData (InitializerOp, VendorData,
1669 - (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
1670 + (CurrentByteOffset + Tmp16)))
1672 - Descriptor->Gpio.VendorLength = VendorLength;
1673 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorLength,
1678 @@ -485,7 +491,9 @@ RsDoGpioIntDescriptor (
1679 * (implies resource source must immediately follow the pin list.)
1682 - *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
1683 + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1684 + ACPI_MOVE_16_TO_16(&Val16, &Tmp16);
1685 + *InterruptList = Val16;
1689 @@ -507,8 +515,10 @@ RsDoGpioIntDescriptor (
1691 /* Create a named field at the start of the list */
1693 - RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN,
1694 - CurrentByteOffset + Descriptor->Gpio.PinTableOffset);
1695 + ACPI_MOVE_16_TO_16(&Tmp16, &Descriptor->Gpio.PinTableOffset);
1696 + Tmp16 += CurrentByteOffset;
1697 + ACPI_MOVE_16_TO_16(&Val16, &Tmp16);
1698 + RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, Val16);
1702 @@ -516,6 +526,10 @@ RsDoGpioIntDescriptor (
1703 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1706 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags);
1707 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout);
1708 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags);
1710 MpSaveGpioInfo (Info->MappingOp, Descriptor,
1711 PinCount, PinList, ResourceSource);
1713 @@ -549,9 +563,15 @@ RsDoGpioIoDescriptor (
1714 UINT16 VendorLength;
1715 UINT16 InterruptLength;
1716 UINT16 DescriptorSize;
1717 + UINT16 IntFlags = 0;
1718 + UINT16 DebounceTimeout = 0;
1719 + UINT16 DriveStrength = 0;
1721 UINT32 CurrentByteOffset;
1722 UINT32 PinCount = 0;
1728 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1729 @@ -576,7 +596,7 @@ RsDoGpioIoDescriptor (
1730 sizeof (AML_RESOURCE_LARGE_HEADER));
1732 Descriptor = Rnode->Buffer;
1733 - Descriptor->Gpio.ResourceLength = DescriptorSize;
1734 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResourceLength, &DescriptorSize);
1735 Descriptor->Gpio.DescriptorType = ACPI_RESOURCE_NAME_GPIO;
1736 Descriptor->Gpio.RevisionId = AML_RESOURCE_GPIO_REVISION;
1737 Descriptor->Gpio.ConnectionType = AML_RESOURCE_GPIO_TYPE_IO;
1738 @@ -590,11 +610,11 @@ RsDoGpioIoDescriptor (
1740 /* Setup offsets within the descriptor */
1742 - Descriptor->Gpio.PinTableOffset = (UINT16)
1743 - ACPI_PTR_DIFF (InterruptList, Descriptor);
1744 + Tmp16 = (UINT16) ACPI_PTR_DIFF (InterruptList, Descriptor);
1745 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.PinTableOffset, &Tmp16);
1747 - Descriptor->Gpio.ResSourceOffset = (UINT16)
1748 - ACPI_PTR_DIFF (ResourceSource, Descriptor);
1749 + Tmp16 = (UINT16) ACPI_PTR_DIFF (ResourceSource, Descriptor);
1750 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.ResSourceOffset, &Tmp16);
1752 /* Process all child initialization nodes */
1754 @@ -604,7 +624,7 @@ RsDoGpioIoDescriptor (
1756 case 0: /* Share Type [Flags] (_SHR) */
1758 - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0);
1759 + RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0);
1760 RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
1761 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3);
1763 @@ -618,21 +638,21 @@ RsDoGpioIoDescriptor (
1765 case 2: /* Debounce Timeout [WORD] (_DBT) */
1767 - Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
1768 + DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer;
1769 RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME,
1770 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout));
1773 case 3: /* Drive Strength [WORD] (_DRS) */
1775 - Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
1776 + DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer;
1777 RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH,
1778 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength));
1781 case 4: /* I/O Restriction [Flag] (_IOR) */
1783 - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0);
1784 + RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0);
1785 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION,
1786 CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2);
1788 @@ -658,7 +678,7 @@ RsDoGpioIoDescriptor (
1790 case 7: /* Resource Usage (consumer/producer) */
1792 - RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
1793 + RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
1796 case 8: /* Resource Tag (Descriptor Name) */
1797 @@ -672,13 +692,14 @@ RsDoGpioIoDescriptor (
1798 * This field is required in order to calculate the length
1799 * of the ResourceSource at runtime.
1801 - Descriptor->Gpio.VendorOffset = (UINT16)
1802 - ACPI_PTR_DIFF (VendorData, Descriptor);
1803 + Tmp16 = (UINT16) ACPI_PTR_DIFF (VendorData, Descriptor);
1804 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorOffset, &Tmp16);
1806 if (RsGetVendorData (InitializerOp, VendorData,
1807 (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
1809 - Descriptor->Gpio.VendorLength = VendorLength;
1810 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorLength,
1815 @@ -691,7 +712,9 @@ RsDoGpioIoDescriptor (
1816 * (implies resource source must immediately follow the pin list.)
1819 - *InterruptList = (UINT16) InitializerOp->Asl.Value.Integer;
1820 + Tmp16 = (UINT16) InitializerOp->Asl.Value.Integer;
1821 + ACPI_MOVE_16_TO_16(&Val16, &Tmp16);
1822 + *InterruptList = Val16;
1826 @@ -722,6 +745,11 @@ RsDoGpioIoDescriptor (
1827 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1830 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags);
1831 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout);
1832 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DriveStrength, &DriveStrength);
1833 + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags);
1835 MpSaveGpioInfo (Info->MappingOp, Descriptor,
1836 PinCount, PinList, ResourceSource);
1838 @@ -752,8 +780,12 @@ RsDoI2cSerialBusDescriptor (
1839 UINT16 ResSourceLength;
1840 UINT16 VendorLength;
1841 UINT16 DescriptorSize;
1842 + UINT16 SlaveAddress = 0;
1843 + UINT32 ConnectionSpeed = 0;
1844 + UINT16 TypeSpecificFlags = 0;
1845 UINT32 CurrentByteOffset;
1850 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1851 @@ -776,12 +808,14 @@ RsDoI2cSerialBusDescriptor (
1852 sizeof (AML_RESOURCE_LARGE_HEADER));
1854 Descriptor = Rnode->Buffer;
1855 - Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
1856 + ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.ResourceLength,
1858 Descriptor->I2cSerialBus.DescriptorType = ACPI_RESOURCE_NAME_SERIAL_BUS;
1859 Descriptor->I2cSerialBus.RevisionId = AML_RESOURCE_I2C_REVISION;
1860 Descriptor->I2cSerialBus.TypeRevisionId = AML_RESOURCE_I2C_TYPE_REVISION;
1861 Descriptor->I2cSerialBus.Type = AML_RESOURCE_I2C_SERIALBUSTYPE;
1862 - Descriptor->I2cSerialBus.TypeDataLength = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
1863 + Tmp16 = AML_RESOURCE_I2C_MIN_DATA_LEN + VendorLength;
1864 + ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.TypeDataLength, &Tmp16);
1866 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
1868 @@ -801,7 +835,7 @@ RsDoI2cSerialBusDescriptor (
1870 case 0: /* Slave Address [WORD] (_ADR) */
1872 - Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
1873 + SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer;
1874 RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
1875 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress));
1877 @@ -815,14 +849,14 @@ RsDoI2cSerialBusDescriptor (
1879 case 2: /* Connection Speed [DWORD] (_SPE) */
1881 - Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
1882 + ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
1883 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1884 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed));
1887 case 3: /* Addressing Mode [Flag] (_MOD) */
1889 - RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1890 + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
1891 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
1892 CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0);
1894 @@ -882,6 +916,9 @@ RsDoI2cSerialBusDescriptor (
1895 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1898 + ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.SlaveAddress, &SlaveAddress);
1899 + ACPI_MOVE_32_TO_32(&Descriptor->I2cSerialBus.ConnectionSpeed, &ConnectionSpeed);
1900 + ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
1901 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1904 @@ -911,6 +948,9 @@ RsDoSpiSerialBusDescriptor (
1905 UINT16 ResSourceLength;
1906 UINT16 VendorLength;
1907 UINT16 DescriptorSize;
1908 + UINT16 DeviceSelection = 0;
1909 + UINT32 ConnectionSpeed = 0;
1910 + UINT16 TypeSpecificFlags = 0;
1911 UINT32 CurrentByteOffset;
1914 @@ -961,21 +1001,21 @@ RsDoSpiSerialBusDescriptor (
1916 case 0: /* Device Selection [WORD] (_ADR) */
1918 - Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
1919 + DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer;
1920 RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS,
1921 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection));
1924 case 1: /* Device Polarity [Flag] (_DPL) */
1926 - RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0);
1927 + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 1, 0);
1928 RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY,
1929 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1);
1932 case 2: /* Wire Mode [Flag] (_MOD) */
1934 - RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
1935 + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
1936 RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE,
1937 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0);
1939 @@ -996,7 +1036,7 @@ RsDoSpiSerialBusDescriptor (
1941 case 5: /* Connection Speed [DWORD] (_SPE) */
1943 - Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
1944 + ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer;
1945 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1946 CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed));
1948 @@ -1070,6 +1110,10 @@ RsDoSpiSerialBusDescriptor (
1949 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1952 + ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.DeviceSelection, &DeviceSelection);
1953 + ACPI_MOVE_32_TO_32(&Descriptor->SpiSerialBus.ConnectionSpeed, &ConnectionSpeed);
1954 + ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
1956 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1959 @@ -1099,6 +1143,10 @@ RsDoUartSerialBusDescriptor (
1960 UINT16 ResSourceLength;
1961 UINT16 VendorLength;
1962 UINT16 DescriptorSize;
1963 + UINT32 DefaultBaudRate = 0;
1964 + UINT16 TypeSpecificFlags = 0;
1965 + UINT16 RxFifoSize = 0;
1966 + UINT16 TxFifoSize = 0;
1967 UINT32 CurrentByteOffset;
1970 @@ -1148,21 +1196,21 @@ RsDoUartSerialBusDescriptor (
1972 case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
1974 - Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
1975 + DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer;
1976 RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED,
1977 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate));
1980 case 1: /* Bits Per Byte [Flags] (_LEN) */
1982 - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3);
1983 + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 4, 3);
1984 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH,
1985 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3);
1988 case 2: /* Stop Bits [Flags] (_STB) */
1990 - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1);
1991 + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 2, 1);
1992 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS,
1993 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2);
1995 @@ -1176,7 +1224,7 @@ RsDoUartSerialBusDescriptor (
1997 case 4: /* Endianness [Flag] (_END) */
1999 - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0);
2000 + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 7, 0);
2001 RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS,
2002 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7);
2004 @@ -1190,21 +1238,21 @@ RsDoUartSerialBusDescriptor (
2006 case 6: /* Flow Control [Flags] (_FLC) */
2008 - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0);
2009 + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0);
2010 RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL,
2011 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2);
2014 case 7: /* Rx Buffer Size [WORD] (_RXL) */
2016 - Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
2017 + RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
2018 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX,
2019 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize));
2022 case 8: /* Tx Buffer Size [WORD] (_TXL) */
2024 - Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
2025 + TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer;
2026 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX,
2027 CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize));
2029 @@ -1274,6 +1322,11 @@ RsDoUartSerialBusDescriptor (
2030 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
2033 + ACPI_MOVE_32_TO_32(&Descriptor->UartSerialBus.DefaultBaudRate, &DefaultBaudRate);
2034 + ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TypeSpecificFlags, &TypeSpecificFlags);
2035 + ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.RxFifoSize, &RxFifoSize);
2036 + ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TxFifoSize, &TxFifoSize);
2038 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
2041 Index: acpica-unix-20209326/source/compiler/aslrestype2w.c
2042 ===================================================================
2043 --- acpica-unix-20209326.orig/source/compiler/aslrestype2w.c
2044 +++ acpica-unix-20209326/source/compiler/aslrestype2w.c
2045 @@ -81,6 +81,12 @@ RsDoWordIoDescriptor (
2046 UINT8 *OptionalFields;
2047 UINT16 StringLength = 0;
2048 UINT32 OptionIndex = 0;
2049 + UINT16 ResourceLength = 0;
2050 + UINT16 Minimum = 0;
2051 + UINT16 Maximum = 0;
2052 + UINT16 AddressLength = 0;
2053 + UINT16 Granularity = 0;
2054 + UINT16 TranslationOffset = 0;
2055 UINT32 CurrentByteOffset;
2057 BOOLEAN ResSourceIndex = FALSE;
2058 @@ -102,8 +108,7 @@ RsDoWordIoDescriptor (
2059 * optional fields present
2061 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
2062 - Descriptor->Address16.ResourceLength = (UINT16)
2063 - (sizeof (AML_RESOURCE_ADDRESS16) -
2064 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
2065 sizeof (AML_RESOURCE_LARGE_HEADER));
2067 /* Process all child initialization nodes */
2068 @@ -147,7 +152,7 @@ RsDoWordIoDescriptor (
2070 case 5: /* Address Granularity */
2072 - Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
2073 + Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
2074 RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
2075 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
2076 GranOp = InitializerOp;
2077 @@ -155,7 +160,7 @@ RsDoWordIoDescriptor (
2079 case 6: /* Address Min */
2081 - Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
2082 + Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
2083 RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
2084 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
2085 MinOp = InitializerOp;
2086 @@ -163,7 +168,7 @@ RsDoWordIoDescriptor (
2088 case 7: /* Address Max */
2090 - Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
2091 + Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
2092 RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
2093 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
2094 MaxOp = InitializerOp;
2095 @@ -171,14 +176,14 @@ RsDoWordIoDescriptor (
2097 case 8: /* Translation Offset */
2099 - Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
2100 + TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
2101 RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
2102 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
2105 case 9: /* Address Length */
2107 - Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
2108 + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
2109 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
2110 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
2111 LengthOp = InitializerOp;
2112 @@ -190,7 +195,7 @@ RsDoWordIoDescriptor (
2114 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
2116 - Descriptor->Address16.ResourceLength++;
2118 ResSourceIndex = TRUE;
2121 @@ -202,8 +207,7 @@ RsDoWordIoDescriptor (
2125 - Descriptor->Address16.ResourceLength = (UINT16)
2126 - (Descriptor->Address16.ResourceLength + StringLength);
2127 + ResourceLength = (UINT16) (ResourceLength + StringLength);
2130 &OptionalFields[OptionIndex],
2131 @@ -263,13 +267,20 @@ RsDoWordIoDescriptor (
2132 /* Validate the Min/Max/Len/Gran values */
2134 RsLargeAddressCheck (
2135 - (UINT64) Descriptor->Address16.Minimum,
2136 - (UINT64) Descriptor->Address16.Maximum,
2137 - (UINT64) Descriptor->Address16.AddressLength,
2138 - (UINT64) Descriptor->Address16.Granularity,
2143 Descriptor->Address16.Flags,
2144 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2146 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
2147 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
2148 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
2149 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
2150 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
2151 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
2153 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
2154 OptionIndex + StringLength;
2156 @@ -302,6 +313,12 @@ RsDoWordBusNumberDescriptor (
2157 UINT8 *OptionalFields;
2158 UINT16 StringLength = 0;
2159 UINT32 OptionIndex = 0;
2160 + UINT16 ResourceLength = 0;
2161 + UINT16 Minimum = 0;
2162 + UINT16 Maximum = 0;
2163 + UINT16 AddressLength = 0;
2164 + UINT16 Granularity = 0;
2165 + UINT16 TranslationOffset = 0;
2166 UINT32 CurrentByteOffset;
2168 BOOLEAN ResSourceIndex = FALSE;
2169 @@ -323,8 +340,7 @@ RsDoWordBusNumberDescriptor (
2170 * optional fields present
2172 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
2173 - Descriptor->Address16.ResourceLength = (UINT16)
2174 - (sizeof (AML_RESOURCE_ADDRESS16) -
2175 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
2176 sizeof (AML_RESOURCE_LARGE_HEADER));
2178 /* Process all child initialization nodes */
2179 @@ -361,8 +377,7 @@ RsDoWordBusNumberDescriptor (
2181 case 4: /* Address Granularity */
2183 - Descriptor->Address16.Granularity =
2184 - (UINT16) InitializerOp->Asl.Value.Integer;
2185 + Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
2186 RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
2187 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
2188 GranOp = InitializerOp;
2189 @@ -370,8 +385,7 @@ RsDoWordBusNumberDescriptor (
2191 case 5: /* Min Address */
2193 - Descriptor->Address16.Minimum =
2194 - (UINT16) InitializerOp->Asl.Value.Integer;
2195 + Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
2196 RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
2197 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
2198 MinOp = InitializerOp;
2199 @@ -379,8 +393,7 @@ RsDoWordBusNumberDescriptor (
2201 case 6: /* Max Address */
2203 - Descriptor->Address16.Maximum =
2204 - (UINT16) InitializerOp->Asl.Value.Integer;
2205 + Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
2206 RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
2207 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
2208 MaxOp = InitializerOp;
2209 @@ -388,16 +401,14 @@ RsDoWordBusNumberDescriptor (
2211 case 7: /* Translation Offset */
2213 - Descriptor->Address16.TranslationOffset =
2214 - (UINT16) InitializerOp->Asl.Value.Integer;
2215 + TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
2216 RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
2217 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
2220 case 8: /* Address Length */
2222 - Descriptor->Address16.AddressLength =
2223 - (UINT16) InitializerOp->Asl.Value.Integer;
2224 + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
2225 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
2226 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
2227 LengthOp = InitializerOp;
2228 @@ -409,7 +420,7 @@ RsDoWordBusNumberDescriptor (
2230 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
2232 - Descriptor->Address16.ResourceLength++;
2234 ResSourceIndex = TRUE;
2237 @@ -421,8 +432,7 @@ RsDoWordBusNumberDescriptor (
2241 - Descriptor->Address16.ResourceLength = (UINT16)
2242 - (Descriptor->Address16.ResourceLength + StringLength);
2243 + ResourceLength = (UINT16) (ResourceLength + StringLength);
2246 &OptionalFields[OptionIndex],
2247 @@ -468,13 +478,20 @@ RsDoWordBusNumberDescriptor (
2248 /* Validate the Min/Max/Len/Gran values */
2250 RsLargeAddressCheck (
2251 - (UINT64) Descriptor->Address16.Minimum,
2252 - (UINT64) Descriptor->Address16.Maximum,
2253 - (UINT64) Descriptor->Address16.AddressLength,
2254 - (UINT64) Descriptor->Address16.Granularity,
2259 Descriptor->Address16.Flags,
2260 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2262 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
2263 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
2264 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
2265 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
2266 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
2267 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
2269 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
2270 OptionIndex + StringLength;
2272 @@ -507,6 +524,12 @@ RsDoWordSpaceDescriptor (
2273 UINT8 *OptionalFields;
2274 UINT16 StringLength = 0;
2275 UINT32 OptionIndex = 0;
2276 + UINT16 Minimum = 0;
2277 + UINT16 Maximum = 0;
2278 + UINT16 AddressLength = 0;
2279 + UINT16 Granularity = 0;
2280 + UINT16 TranslationOffset = 0;
2281 + UINT16 ResourceLength = 0;
2282 UINT32 CurrentByteOffset;
2284 BOOLEAN ResSourceIndex = FALSE;
2285 @@ -527,8 +550,7 @@ RsDoWordSpaceDescriptor (
2286 * optional fields present
2288 OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
2289 - Descriptor->Address16.ResourceLength = (UINT16)
2290 - (sizeof (AML_RESOURCE_ADDRESS16) -
2291 + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) -
2292 sizeof (AML_RESOURCE_LARGE_HEADER));
2294 /* Process all child initialization nodes */
2295 @@ -577,8 +599,7 @@ RsDoWordSpaceDescriptor (
2297 case 6: /* Address Granularity */
2299 - Descriptor->Address16.Granularity =
2300 - (UINT16) InitializerOp->Asl.Value.Integer;
2301 + Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
2302 RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY,
2303 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
2304 GranOp = InitializerOp;
2305 @@ -586,8 +607,7 @@ RsDoWordSpaceDescriptor (
2307 case 7: /* Min Address */
2309 - Descriptor->Address16.Minimum =
2310 - (UINT16) InitializerOp->Asl.Value.Integer;
2311 + Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
2312 RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR,
2313 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
2314 MinOp = InitializerOp;
2315 @@ -595,8 +615,7 @@ RsDoWordSpaceDescriptor (
2317 case 8: /* Max Address */
2319 - Descriptor->Address16.Maximum =
2320 - (UINT16) InitializerOp->Asl.Value.Integer;
2321 + Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
2322 RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR,
2323 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
2324 MaxOp = InitializerOp;
2325 @@ -604,16 +623,14 @@ RsDoWordSpaceDescriptor (
2327 case 9: /* Translation Offset */
2329 - Descriptor->Address16.TranslationOffset =
2330 - (UINT16) InitializerOp->Asl.Value.Integer;
2331 + TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
2332 RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION,
2333 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
2336 case 10: /* Address Length */
2338 - Descriptor->Address16.AddressLength =
2339 - (UINT16) InitializerOp->Asl.Value.Integer;
2340 + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
2341 RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH,
2342 CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
2343 LengthOp = InitializerOp;
2344 @@ -625,7 +642,7 @@ RsDoWordSpaceDescriptor (
2346 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
2348 - Descriptor->Address16.ResourceLength++;
2350 ResSourceIndex = TRUE;
2353 @@ -637,8 +654,7 @@ RsDoWordSpaceDescriptor (
2357 - Descriptor->Address16.ResourceLength = (UINT16)
2358 - (Descriptor->Address16.ResourceLength + StringLength);
2359 + ResourceLength = (UINT16) (ResourceLength + StringLength);
2362 &OptionalFields[OptionIndex],
2363 @@ -684,13 +700,20 @@ RsDoWordSpaceDescriptor (
2364 /* Validate the Min/Max/Len/Gran values */
2366 RsLargeAddressCheck (
2367 - (UINT64) Descriptor->Address16.Minimum,
2368 - (UINT64) Descriptor->Address16.Maximum,
2369 - (UINT64) Descriptor->Address16.AddressLength,
2370 - (UINT64) Descriptor->Address16.Granularity,
2375 Descriptor->Address16.Flags,
2376 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2378 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength);
2379 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum);
2380 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum);
2381 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength);
2382 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity);
2383 + ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset);
2385 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
2386 OptionIndex + StringLength;
2388 Index: acpica-unix-20209326/source/include/acmacros.h
2389 ===================================================================
2390 --- acpica-unix-20209326.orig/source/include/acmacros.h
2391 +++ acpica-unix-20209326/source/include/acmacros.h
2393 ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
2394 ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
2396 -/* 32-bit source, 16/32/64 destination */
2397 +/* 32-bit source, 8/16/32/64 destination */
2399 -#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
2400 +#define ACPI_MOVE_32_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];}
2402 +#define ACPI_MOVE_32_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
2403 + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];}
2405 #define ACPI_MOVE_32_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\
2406 (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\
2407 @@ -113,11 +116,17 @@
2408 ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
2409 ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
2411 -/* 64-bit source, 16/32/64 destination */
2412 +/* 64-bit source, 8/16/32/64 destination */
2414 -#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
2415 +#define ACPI_MOVE_64_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];}
2417 -#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
2418 +#define ACPI_MOVE_64_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
2419 + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];}
2421 +#define ACPI_MOVE_64_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
2422 + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
2423 + (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\
2424 + (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];}
2426 #define ACPI_MOVE_64_TO_64(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\
2427 (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\
2428 @@ -136,20 +145,26 @@
2430 /* The hardware supports unaligned transfers, just do the little-endian move */
2432 -/* 16-bit source, 16/32/64 destination */
2433 +/* 16-bit source, 8/16/32/64 destination */
2435 +#define ACPI_MOVE_16_TO_8(d, s) *(UINT8 *)(void *)(d) = *(UINT16 *)(void *)(s)
2436 #define ACPI_MOVE_16_TO_16(d, s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
2437 #define ACPI_MOVE_16_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
2438 #define ACPI_MOVE_16_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT16 *)(void *)(s)
2440 -/* 32-bit source, 16/32/64 destination */
2441 +/* 32-bit source, 8/16/32/64 destination */
2443 +#define ACPI_MOVE_32_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];}
2445 +#define ACPI_MOVE_32_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\
2446 + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];}
2448 -#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
2449 #define ACPI_MOVE_32_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
2450 #define ACPI_MOVE_32_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s)
2452 -/* 64-bit source, 16/32/64 destination */
2453 +/* 64-bit source, 8/16/32/64 destination */
2455 +#define ACPI_MOVE_64_TO_8(d, s) ACPI_MOVE_16_TO_8(d, s) /* Truncate to 8 */
2456 #define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
2457 #define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
2458 #define ACPI_MOVE_64_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
2460 #define ACPI_MOVE_16_TO_32(d, s) {(*(UINT32 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
2461 #define ACPI_MOVE_16_TO_64(d, s) {(*(UINT64 *)(void *)(d)) = 0; ACPI_MOVE_16_TO_16(d, s);}
2463 -/* 32-bit source, 16/32/64 destination */
2464 +/* 32-bit source, 8/16/32/64 destination */
2466 +#define ACPI_MOVE_32_TO_8(d, s) ACPI_MOVE_16_TO_8(d, s) /* Truncate to 8 */
2468 #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
2470 Index: acpica-unix-20209326/source/include/platform/aclinux.h
2471 ===================================================================
2472 --- acpica-unix-20209326.orig/source/include/platform/aclinux.h
2473 +++ acpica-unix-20209326/source/include/platform/aclinux.h
2476 #ifdef ACPI_USE_STANDARD_HEADERS
2478 +#include <endian.h>
2481 /* Define/disable kernel-specific declarators */
2482 @@ -232,6 +233,10 @@
2486 +#if defined(__PPC64__) || defined(__s390x__)
2487 +#define ACPI_BIG_ENDIAN
2490 #endif /* __KERNEL__ */
2492 #endif /* __ACLINUX_H__ */
2493 Index: acpica-unix-20209326/source/compiler/aslanalyze.c
2494 ===================================================================
2495 --- acpica-unix-20209326.orig/source/compiler/aslanalyze.c
2496 +++ acpica-unix-20209326/source/compiler/aslanalyze.c
2497 @@ -469,7 +469,7 @@ ApCheckForGpeNameConflict (
2499 /* Need a null-terminated string version of NameSeg */
2501 - ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg);
2502 + ACPI_COPY_NAMESEG (Name, Op->Asl.NameSeg);
2503 Name[ACPI_NAMESEG_SIZE] = 0;
2506 @@ -496,7 +496,7 @@ ApCheckForGpeNameConflict (
2507 * We are now sure we have an _Lxx or _Exx.
2508 * Create the target name that would cause collision (Flip E/L)
2510 - ACPI_MOVE_32_TO_32 (Target, Name);
2511 + ACPI_COPY_NAMESEG (Target, Name);
2513 /* Inject opposite letter ("L" versus "E") */
2515 Index: acpica-unix-20209326/source/compiler/asllookup.c
2516 ===================================================================
2517 --- acpica-unix-20209326.orig/source/compiler/asllookup.c
2518 +++ acpica-unix-20209326/source/compiler/asllookup.c
2519 @@ -119,6 +119,7 @@ LkIsObjectUsed (
2521 ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
2522 ACPI_NAMESPACE_NODE *Next;
2523 + ACPI_NAME_UNION tmp, tmp2;
2524 ASL_METHOD_LOCAL *MethodLocals;
2525 ASL_METHOD_LOCAL *MethodArgs;
2527 @@ -175,7 +176,8 @@ LkIsObjectUsed (
2528 * We ignore the predefined methods since often, not
2529 * all arguments are needed or used.
2531 - if ((Node->Name.Ascii[0] != '_') &&
2532 + ACPI_MOVE_32_TO_32(&tmp.Ascii, Node->Name.Ascii);
2533 + if ((tmp.Ascii[0] != '_') &&
2534 (!(MethodArgs[i].Flags & ASL_ARG_REFERENCED)))
2536 sprintf (AslGbl_MsgBuffer, "Arg%u", i);
2537 @@ -228,8 +230,10 @@ LkIsObjectUsed (
2538 * Issue a remark even if it is a reserved name (starts
2539 * with an underscore).
2541 + ACPI_MOVE_32_TO_32(&tmp.Ascii, Node->Name.Ascii);
2542 + ACPI_MOVE_32_TO_32(&tmp2.Ascii, Next->Name.Ascii);
2543 sprintf (AslGbl_MsgBuffer, "Name [%4.4s] is within a method [%4.4s]",
2544 - Node->Name.Ascii, Next->Name.Ascii);
2545 + tmp.Ascii, tmp2.Ascii);
2546 AslError (ASL_REMARK, ASL_MSG_NOT_REFERENCED,
2547 LkGetNameOp (Node->Op), AslGbl_MsgBuffer);
2549 Index: acpica-unix-20209326/source/compiler/aslmain.c
2550 ===================================================================
2551 --- acpica-unix-20209326.orig/source/compiler/aslmain.c
2552 +++ acpica-unix-20209326/source/compiler/aslmain.c
2553 @@ -101,18 +101,6 @@ main (
2555 signal (SIGINT, AslSignalHandler);
2558 - * Big-endian machines are not currently supported. ACPI tables must
2559 - * be little-endian, and support for big-endian machines needs to
2562 - if (UtIsBigEndianMachine ())
2565 - "iASL is not currently supported on big-endian machines.\n");
2569 AcpiOsInitialize ();
2570 ACPI_DEBUG_INITIALIZE (); /* For debug version only */
2572 Index: acpica-unix-20209326/source/common/acfileio.c
2573 ===================================================================
2574 --- acpica-unix-20209326.orig/source/common/acfileio.c
2575 +++ acpica-unix-20209326/source/common/acfileio.c
2576 @@ -280,6 +280,7 @@ AcGetOneTableFromFile (
2577 ACPI_TABLE_HEADER *Table;
2583 *ReturnTable = NULL;
2584 @@ -319,7 +320,8 @@ AcGetOneTableFromFile (
2586 /* Allocate a buffer for the entire table */
2588 - Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
2589 + ACPI_MOVE_32_TO_32(&TableLen, &TableHeader.Length);
2590 + Table = AcpiOsAllocate ((ACPI_SIZE) TableLen);
2593 return (AE_NO_MEMORY);
2594 @@ -329,13 +331,13 @@ AcGetOneTableFromFile (
2596 fseek (File, TableOffset, SEEK_SET);
2598 - Count = fread (Table, 1, TableHeader.Length, File);
2599 + Count = fread (Table, 1, TableLen, File);
2602 * Checks for data table headers happen later in the execution. Only verify
2603 * for Aml tables at this point in the code.
2605 - if (GetOnlyAmlTables && Count != (INT32) TableHeader.Length)
2606 + if (GetOnlyAmlTables && Count != TableLen)
2610 @@ -343,7 +345,7 @@ AcGetOneTableFromFile (
2612 /* Validate the checksum (just issue a warning) */
2614 - Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
2615 + Status = AcpiTbVerifyChecksum (Table, TableLen);
2616 if (ACPI_FAILURE (Status))
2618 Status = AcCheckTextModeCorruption (Table);
2619 @@ -435,6 +437,7 @@ AcValidateTableHeader (
2621 long OriginalOffset;
2623 + UINT32 TableLength;
2627 @@ -464,11 +467,12 @@ AcValidateTableHeader (
2628 /* Validate table length against bytes remaining in the file */
2630 FileSize = CmGetFileSize (File);
2631 - if (TableHeader.Length > (UINT32) (FileSize - TableOffset))
2632 + ACPI_MOVE_32_TO_32(&TableLength, &TableHeader.Length);
2633 + if (TableLength > (UINT32) (FileSize - TableOffset))
2635 fprintf (stderr, "Table [%4.4s] is too long for file - "
2636 "needs: 0x%.2X, remaining in file: 0x%.2X\n",
2637 - TableHeader.Signature, TableHeader.Length,
2638 + TableHeader.Signature, TableLength,
2639 (UINT32) (FileSize - TableOffset));
2640 return (AE_BAD_HEADER);
2642 Index: acpica-unix-20209326/source/common/dmtable.c
2643 ===================================================================
2644 --- acpica-unix-20209326.orig/source/common/dmtable.c
2645 +++ acpica-unix-20209326/source/common/dmtable.c
2646 @@ -551,7 +551,7 @@ AcpiDmDumpDataTable (
2648 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
2650 - Length = Table->Length;
2651 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
2652 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
2653 if (ACPI_FAILURE (Status))
2655 @@ -565,13 +565,14 @@ AcpiDmDumpDataTable (
2656 else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT))
2658 Length = AcpiDmDumpS3pt (Table);
2659 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
2664 * All other tables must use the common ACPI table header, dump it now
2666 - Length = Table->Length;
2667 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
2668 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
2669 if (ACPI_FAILURE (Status))
2671 @@ -782,6 +783,7 @@ AcpiDmDumpTable (
2672 BOOLEAN LastOutputBlankLine = FALSE;
2674 char RepairedName[8];
2679 @@ -1178,8 +1180,9 @@ AcpiDmDumpTable (
2680 /* Checksum, display and validate */
2682 AcpiOsPrintf ("%2.2X", *Target);
2683 - Temp8 = AcpiDmGenerateChecksum (Table,
2684 - ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
2685 + ACPI_MOVE_32_TO_32(&Temp32,
2686 + &ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length);
2687 + Temp8 = AcpiDmGenerateChecksum (Table, Temp32,
2688 ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
2690 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
2691 @@ -1244,14 +1247,14 @@ AcpiDmDumpTable (
2693 /* DMAR subtable types */
2695 - Temp16 = ACPI_GET16 (Target);
2696 + Val16 = ACPI_GET16 (Target);
2697 + ACPI_MOVE_16_TO_16(&Temp16, &Val16);
2698 if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
2700 Temp16 = ACPI_DMAR_TYPE_RESERVED;
2703 - AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2704 - AcpiDmDmarSubnames[Temp16]);
2705 + AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmDmarSubnames[Temp16]);
2708 case ACPI_DMT_DMAR_SCOPE:
2709 @@ -1342,14 +1345,14 @@ AcpiDmDumpTable (
2711 /* HEST subtable types */
2713 - Temp16 = ACPI_GET16 (Target);
2714 + Val16 = ACPI_GET16 (Target);
2715 + ACPI_MOVE_16_TO_16(&Temp16, &Val16);
2716 if (Temp16 > ACPI_HEST_TYPE_RESERVED)
2718 Temp16 = ACPI_HEST_TYPE_RESERVED;
2721 - AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2722 - AcpiDmHestSubnames[Temp16]);
2723 + AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmHestSubnames[Temp16]);
2726 case ACPI_DMT_HESTNTFY:
2727 @@ -1429,13 +1432,14 @@ AcpiDmDumpTable (
2729 /* NFIT subtable types */
2731 - Temp16 = ACPI_GET16 (Target);
2732 + Val16 = ACPI_GET16 (Target);
2733 + ACPI_MOVE_16_TO_16(&Temp16, &Val16);
2734 if (Temp16 > ACPI_NFIT_TYPE_RESERVED)
2736 Temp16 = ACPI_NFIT_TYPE_RESERVED;
2739 - AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2740 + AcpiOsPrintf (UINT16_FORMAT, Temp16,
2741 AcpiDmNfitSubnames[Temp16]);
2744 Index: acpica-unix-20209326/source/common/dmtables.c
2745 ===================================================================
2746 --- acpica-unix-20209326.orig/source/common/dmtables.c
2747 +++ acpica-unix-20209326/source/common/dmtables.c
2748 @@ -142,7 +142,9 @@ AdCreateTableHeader (
2749 ACPI_TABLE_HEADER *Table)
2755 + UINT32 CompilerRev;
2757 /* Reset globals for External statements */
2759 @@ -154,9 +156,10 @@ AdCreateTableHeader (
2761 AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
2763 + ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
2764 AcpiOsPrintf (" * Original Table Header:\n");
2765 AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature);
2766 - AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length);
2767 + AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", TableLen, TableLen);
2769 /* Print and validate the revision */
2771 @@ -188,7 +191,7 @@ AdCreateTableHeader (
2773 AcpiOsPrintf ("\n * Checksum 0x%2.2X", Table->Checksum);
2775 - Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
2776 + Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), TableLen);
2779 AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X",
2780 @@ -198,9 +201,11 @@ AdCreateTableHeader (
2781 AcpiOsPrintf ("\n");
2782 AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId);
2783 AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId);
2784 - AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
2785 + ACPI_MOVE_32_TO_32(&OemRev, &Table->OemRevision);
2786 + AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", OemRev, OemRev);
2787 AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId);
2788 - AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
2789 + ACPI_MOVE_32_TO_32(&CompilerRev, &Table->AslCompilerRevision);
2790 + AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", CompilerRev, CompilerRev);
2791 AcpiOsPrintf (" */\n");
2794 @@ -221,7 +226,7 @@ AdCreateTableHeader (
2796 "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
2797 Table->Signature, Table->Revision,
2798 - Table->OemId, Table->OemTableId, Table->OemRevision);
2799 + Table->OemId, Table->OemTableId, OemRev);
2803 @@ -396,7 +401,8 @@ AdParseTable (
2805 fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
2807 - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
2808 + ACPI_MOVE_32_TO_32(&AmlLength, &Table->Length);
2809 + AmlLength -= sizeof (ACPI_TABLE_HEADER);
2810 AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
2812 AcpiUtSetIntegerWidth (Table->Revision);
2813 Index: acpica-unix-20209326/source/compiler/dtfield.c
2814 ===================================================================
2815 --- acpica-unix-20209326.orig/source/compiler/dtfield.c
2816 +++ acpica-unix-20209326/source/compiler/dtfield.c
2817 @@ -361,7 +361,27 @@ DtCompileInteger (
2818 DtError (ASL_ERROR, ASL_MSG_INTEGER_SIZE, Field, AslGbl_MsgBuffer);
2821 - memcpy (Buffer, &Value, ByteLength);
2822 + switch (ByteLength) {
2824 + ACPI_MOVE_64_TO_8(Buffer, &Value);
2828 + ACPI_MOVE_64_TO_16(Buffer, &Value);
2832 + ACPI_MOVE_64_TO_32(Buffer, &Value);
2836 + ACPI_MOVE_64_TO_64(Buffer, &Value);
2840 + memcpy (Buffer, &Value, ByteLength);
2846 Index: acpica-unix-20209326/source/compiler/dtsubtable.c
2847 ===================================================================
2848 --- acpica-unix-20209326.orig/source/compiler/dtsubtable.c
2849 +++ acpica-unix-20209326/source/compiler/dtsubtable.c
2850 @@ -378,6 +378,21 @@ DtSetSubtableLength (
2854 - memcpy (Subtable->LengthField, &Subtable->TotalLength,
2855 - Subtable->SizeOfLengthField);
2856 + switch(Subtable->SizeOfLengthField) {
2858 + ACPI_MOVE_32_TO_8(Subtable->LengthField, &Subtable->TotalLength);
2862 + ACPI_MOVE_32_TO_16(Subtable->LengthField, &Subtable->TotalLength);
2866 + ACPI_MOVE_32_TO_32(Subtable->LengthField, &Subtable->TotalLength);
2870 + memcpy (Subtable->LengthField, &Subtable->TotalLength,
2871 + Subtable->SizeOfLengthField);
2874 Index: acpica-unix-20209326/source/compiler/dttable1.c
2875 ===================================================================
2876 --- acpica-unix-20209326.orig/source/compiler/dttable1.c
2877 +++ acpica-unix-20209326/source/compiler/dttable1.c
2878 @@ -281,6 +281,8 @@ DtCompileCsrt (
2879 DT_FIELD **PFieldList = (DT_FIELD **) List;
2880 UINT32 DescriptorCount;
2882 + ACPI_CSRT_GROUP *Pgrp;
2886 /* Subtables (Resource Groups) */
2887 @@ -299,12 +301,20 @@ DtCompileCsrt (
2889 /* Compute the number of resource descriptors */
2893 (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
2894 Subtable->Buffer))->Length -
2895 (ACPI_CAST_PTR (ACPI_CSRT_GROUP,
2896 Subtable->Buffer))->SharedInfoLength -
2897 sizeof (ACPI_CSRT_GROUP);
2899 + Pgrp = ACPI_CAST_PTR(ACPI_CSRT_GROUP, Subtable->Buffer);
2900 + ACPI_MOVE_32_TO_32(&Tmp32, &Pgrp->Length);
2901 + GroupLength = Tmp32;
2902 + ACPI_MOVE_32_TO_32(&Tmp32, &Pgrp->SharedInfoLength);
2903 + GroupLength -= Tmp32;
2904 + GroupLength -= sizeof (ACPI_CSRT_GROUP);
2906 DescriptorCount = (GroupLength /
2907 sizeof (ACPI_CSRT_DESCRIPTOR));
2908 @@ -392,6 +402,8 @@ DtCompileDbg2 (
2909 ACPI_DBG2_DEVICE *DeviceInfo;
2910 UINT16 CurrentOffset;
2917 @@ -408,10 +420,11 @@ DtCompileDbg2 (
2918 /* Main table fields */
2920 Dbg2Header = ACPI_CAST_PTR (ACPI_DBG2_HEADER, Subtable->Buffer);
2921 - Dbg2Header->InfoOffset = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
2922 + Tmp32 = sizeof (ACPI_TABLE_HEADER) + ACPI_PTR_DIFF (
2923 ACPI_ADD_PTR (UINT8, Dbg2Header, sizeof (ACPI_DBG2_HEADER)), Dbg2Header);
2924 + ACPI_MOVE_32_TO_32(&Dbg2Header->InfoOffset, &Tmp32);
2926 - SubtableCount = Dbg2Header->InfoCount;
2927 + ACPI_MOVE_32_TO_32(&SubtableCount, &Dbg2Header->InfoCount);
2928 DtPushSubtable (Subtable);
2930 /* Process all Device Information subtables (Count = InfoCount) */
2931 @@ -438,7 +451,7 @@ DtCompileDbg2 (
2933 /* BaseAddressRegister GAS array (Required, size is RegisterCount) */
2935 - DeviceInfo->BaseAddressOffset = CurrentOffset;
2936 + ACPI_MOVE_16_TO_16(&DeviceInfo->BaseAddressOffset, &CurrentOffset);
2937 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
2939 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
2940 @@ -454,7 +467,7 @@ DtCompileDbg2 (
2942 /* AddressSize array (Required, size = RegisterCount) */
2944 - DeviceInfo->AddressSizeOffset = CurrentOffset;
2945 + ACPI_MOVE_16_TO_16(&DeviceInfo->AddressSizeOffset, &CurrentOffset);
2946 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
2948 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
2949 @@ -470,7 +483,7 @@ DtCompileDbg2 (
2951 /* NamespaceString device identifier (Required, size = NamePathLength) */
2953 - DeviceInfo->NamepathOffset = CurrentOffset;
2954 + ACPI_MOVE_16_TO_16(&DeviceInfo->NamepathOffset, &CurrentOffset);
2955 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
2957 if (ACPI_FAILURE (Status))
2958 @@ -480,8 +493,9 @@ DtCompileDbg2 (
2960 /* Update the device info header */
2962 - DeviceInfo->NamepathLength = (UINT16) Subtable->Length;
2963 - CurrentOffset += (UINT16) DeviceInfo->NamepathLength;
2964 + ACPI_MOVE_32_TO_16(&DeviceInfo->NamepathLength, &Subtable->Length);
2965 + ACPI_MOVE_16_TO_16(&Tmp16, &DeviceInfo->NamepathLength);
2966 + CurrentOffset += Tmp16;
2967 DtInsertSubtable (ParentTable, Subtable);
2969 /* OemData - Variable-length data (Optional, size = OemDataLength) */
2970 @@ -508,8 +522,8 @@ DtCompileDbg2 (
2972 if (Subtable && Subtable->Length)
2974 - DeviceInfo->OemDataOffset = CurrentOffset;
2975 - DeviceInfo->OemDataLength = (UINT16) Subtable->Length;
2976 + ACPI_MOVE_16_TO_16(&DeviceInfo->OemDataOffset, &CurrentOffset);
2977 + ACPI_MOVE_32_TO_16(&DeviceInfo->OemDataLength, &Subtable->Length);
2979 DtInsertSubtable (ParentTable, Subtable);
2981 @@ -549,6 +563,8 @@ DtCompileDmar (
2982 ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
2983 UINT32 DeviceScopeLength;
2984 UINT32 PciPathLength;
2989 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
2990 @@ -578,8 +594,11 @@ DtCompileDmar (
2991 DtPushSubtable (Subtable);
2993 DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
2994 + ACPI_MOVE_16_TO_16(&Tmp16, &DmarHeader->Length);
2995 + DmarHeader->Length = Tmp16;
2997 - switch (DmarHeader->Type)
2998 + ACPI_MOVE_16_TO_16(&HdrType, &DmarHeader->Type);
3001 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
3003 @@ -626,8 +645,8 @@ DtCompileDmar (
3005 * Optional Device Scope subtables
3007 - if ((DmarHeader->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
3008 - (DmarHeader->Type == ACPI_DMAR_TYPE_NAMESPACE))
3009 + if ((HdrType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
3010 + (HdrType == ACPI_DMAR_TYPE_NAMESPACE))
3012 /* These types do not support device scopes */
3014 @@ -637,7 +656,7 @@ DtCompileDmar (
3016 DtPushSubtable (Subtable);
3017 DeviceScopeLength = DmarHeader->Length - Subtable->Length -
3018 - ParentTable->Length;
3019 + ParentTable->Length;
3020 while (DeviceScopeLength)
3022 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
3023 @@ -762,7 +781,7 @@ DtCompileDrtm (
3027 - DrtmVtl->ValidatedTableCount = Count;
3028 + ACPI_MOVE_32_TO_32(&DrtmVtl->ValidatedTableCount, &Count);
3030 ParentTable = DtPeekSubtable ();
3032 @@ -800,7 +819,7 @@ DtCompileDrtm (
3036 - DrtmRl->ResourceCount = Count;
3037 + ACPI_MOVE_32_TO_32(&DrtmRl->ResourceCount, &Count);
3039 ParentTable = DtPeekSubtable ();
3041 @@ -895,6 +914,7 @@ DtCompileGtdt (
3042 ACPI_DMTABLE_INFO *InfoTable;
3044 ACPI_TABLE_HEADER *Header;
3045 + ACPI_GTDT_TIMER_BLOCK *TimerBlock;
3048 ParentTable = DtPeekSubtable ();
3049 @@ -982,8 +1002,9 @@ DtCompileGtdt (
3050 DtPushSubtable (Subtable);
3051 ParentTable = DtPeekSubtable ();
3053 - GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
3054 - Subtable->Buffer - sizeof(ACPI_GTDT_HEADER)))->TimerCount;
3055 + TimerBlock = ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
3056 + Subtable->Buffer - sizeof(ACPI_GTDT_HEADER));
3057 + ACPI_MOVE_32_TO_32(&GtCount, &TimerBlock->TimerCount);
3061 @@ -1036,6 +1057,7 @@ DtCompileFpdt (
3062 ACPI_DMTABLE_INFO *InfoTable;
3063 DT_FIELD **PFieldList = (DT_FIELD **) List;
3064 DT_FIELD *SubtableStart;
3069 @@ -1054,7 +1076,8 @@ DtCompileFpdt (
3071 FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
3073 - switch (FpdtHeader->Type)
3074 + ACPI_MOVE_16_TO_16(&HdrType, &FpdtHeader->Type);
3077 case ACPI_FPDT_TYPE_BOOT:
3079 @@ -1112,6 +1135,7 @@ DtCompileHest (
3080 ACPI_DMTABLE_INFO *InfoTable;
3086 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
3087 @@ -1129,8 +1153,9 @@ DtCompileHest (
3088 /* Get subtable type */
3090 SubtableStart = *PFieldList;
3091 - DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
3092 + DtCompileInteger ((UINT8 *) &Tmp16, *PFieldList, 2, 0);
3094 + ACPI_MOVE_16_TO_16(&Type, &Tmp16);
3097 case ACPI_HEST_TYPE_IA32_CHECK:
3098 @@ -1480,11 +1505,13 @@ DtCompileIort (
3099 ACPI_IORT_SMMU *IortSmmu;
3102 + UINT32 NodeOffset;
3103 UINT32 IdMappingNumber;
3105 UINT32 ContextIrptNumber;
3106 UINT32 PmuIrptNumber;
3107 UINT32 PaddingLength;
3108 + UINT32 MappingOffset;
3111 ParentTable = DtPeekSubtable ();
3112 @@ -1510,7 +1537,7 @@ DtCompileIort (
3113 * Optionally allows the generic data types to be used for filling
3116 - Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
3117 + NodeOffset = sizeof (ACPI_TABLE_IORT);
3118 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
3120 if (ACPI_FAILURE (Status))
3121 @@ -1520,7 +1547,7 @@ DtCompileIort (
3124 DtInsertSubtable (ParentTable, Subtable);
3125 - Iort->NodeOffset += Subtable->Length;
3126 + NodeOffset += Subtable->Length;
3130 @@ -1530,8 +1557,9 @@ DtCompileIort (
3134 - Iort->NodeOffset += PaddingLength;
3135 + NodeOffset += PaddingLength;
3137 + ACPI_MOVE_32_TO_32(&Iort->NodeOffset, &NodeOffset);
3141 @@ -1585,7 +1613,7 @@ DtCompileIort (
3145 - IortItsGroup->ItsCount = ItsNumber;
3146 + ACPI_MOVE_32_TO_32(&IortItsGroup->ItsCount, &ItsNumber);
3149 case ACPI_IORT_NODE_NAMED_COMPONENT:
3150 @@ -1619,15 +1647,16 @@ DtCompileIort (
3154 - if (NodeLength > IortNode->MappingOffset)
3155 + ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
3156 + if (NodeLength > MappingOffset)
3158 return (AE_BAD_DATA);
3161 - if (NodeLength < IortNode->MappingOffset)
3162 + if (NodeLength < MappingOffset)
3164 Status = DtCompilePadding (
3165 - IortNode->MappingOffset - NodeLength,
3166 + MappingOffset - NodeLength,
3168 if (ACPI_FAILURE (Status))
3170 @@ -1635,7 +1664,8 @@ DtCompileIort (
3173 DtInsertSubtable (ParentTable, Subtable);
3174 - NodeLength = IortNode->MappingOffset;
3175 + ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
3176 + NodeLength = MappingOffset;
3180 @@ -1668,7 +1698,7 @@ DtCompileIort (
3182 /* Compile global interrupt array */
3184 - IortSmmu->GlobalInterruptOffset = NodeLength;
3185 + ACPI_MOVE_32_TO_32(&IortSmmu->GlobalInterruptOffset, &NodeLength);
3186 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
3188 if (ACPI_FAILURE (Status))
3189 @@ -1682,7 +1712,7 @@ DtCompileIort (
3190 /* Compile context interrupt array */
3192 ContextIrptNumber = 0;
3193 - IortSmmu->ContextInterruptOffset = NodeLength;
3194 + ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptOffset, &NodeLength);
3197 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
3198 @@ -1702,12 +1732,12 @@ DtCompileIort (
3199 ContextIrptNumber++;
3202 - IortSmmu->ContextInterruptCount = ContextIrptNumber;
3203 + ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptCount, &ContextIrptNumber);
3205 /* Compile PMU interrupt array */
3208 - IortSmmu->PmuInterruptOffset = NodeLength;
3209 + ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptOffset, &NodeLength);
3212 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
3213 @@ -1727,7 +1757,7 @@ DtCompileIort (
3217 - IortSmmu->PmuInterruptCount = PmuIrptNumber;
3218 + ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptCount, &PmuIrptNumber);
3221 case ACPI_IORT_NODE_SMMU_V3:
3222 @@ -1764,7 +1794,7 @@ DtCompileIort (
3224 /* Compile Array of ID mappings */
3226 - IortNode->MappingOffset = NodeLength;
3227 + ACPI_MOVE_32_TO_32(&IortNode->MappingOffset, &NodeLength);
3228 IdMappingNumber = 0;
3231 @@ -1785,7 +1815,7 @@ DtCompileIort (
3235 - IortNode->MappingCount = IdMappingNumber;
3236 + ACPI_MOVE_32_TO_32(&IortNode->MappingCount, &IdMappingNumber);
3237 if (!IdMappingNumber)
3239 IortNode->MappingOffset = 0;
3240 @@ -1800,7 +1830,7 @@ DtCompileIort (
3244 - Iort->NodeCount = NodeNumber;
3245 + ACPI_MOVE_32_TO_32(&Iort->NodeCount, &NodeNumber);
3249 Index: acpica-unix-20209326/source/compiler/dttable2.c
3250 ===================================================================
3251 --- acpica-unix-20209326.orig/source/compiler/dttable2.c
3252 +++ acpica-unix-20209326/source/compiler/dttable2.c
3253 @@ -345,7 +345,7 @@ DtCompileMpst (
3254 DtPushSubtable (Subtable);
3256 MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
3257 - SubtableCount = MpstChannelInfo->PowerNodeCount;
3258 + ACPI_MOVE_16_TO_16(&SubtableCount, &MpstChannelInfo->PowerNodeCount);
3260 while (*PFieldList && SubtableCount)
3262 @@ -363,8 +363,8 @@ DtCompileMpst (
3263 DtPushSubtable (Subtable);
3265 MpstPowerNode = ACPI_CAST_PTR (ACPI_MPST_POWER_NODE, Subtable->Buffer);
3266 - PowerStateCount = MpstPowerNode->NumPowerStates;
3267 - ComponentCount = MpstPowerNode->NumPhysicalComponents;
3268 + ACPI_MOVE_32_TO_32(&PowerStateCount, &MpstPowerNode->NumPowerStates);
3269 + ACPI_MOVE_32_TO_32(&ComponentCount, &MpstPowerNode->NumPhysicalComponents);
3271 ParentTable = DtPeekSubtable ();
3273 @@ -517,6 +517,7 @@ DtCompileNfit (
3275 ACPI_NFIT_INTERLEAVE *Interleave = NULL;
3276 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
3281 @@ -550,7 +551,8 @@ DtCompileNfit (
3283 NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
3285 - switch (NfitHeader->Type)
3286 + ACPI_MOVE_16_TO_16(&SubType, &NfitHeader->Type);
3289 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
3291 @@ -610,7 +612,7 @@ DtCompileNfit (
3292 DtInsertSubtable (ParentTable, Subtable);
3295 - switch (NfitHeader->Type)
3298 case ACPI_NFIT_TYPE_INTERLEAVE:
3300 @@ -636,7 +638,7 @@ DtCompileNfit (
3304 - Interleave->LineCount = Count;
3305 + ACPI_MOVE_32_TO_32(&Interleave->LineCount, &Count);
3308 case ACPI_NFIT_TYPE_SMBIOS:
3309 @@ -681,7 +683,7 @@ DtCompileNfit (
3313 - Hint->HintCount = (UINT16) Count;
3314 + ACPI_MOVE_32_TO_16(&Hint->HintCount, &Count);
3318 @@ -957,7 +959,7 @@ DtCompilePmtt (
3320 PmttController = ACPI_CAST_PTR (ACPI_PMTT_CONTROLLER,
3321 (Subtable->Buffer - sizeof (ACPI_PMTT_HEADER)));
3322 - DomainCount = PmttController->DomainCount;
3323 + ACPI_MOVE_16_TO_16(&DomainCount, &PmttController->DomainCount);
3327 @@ -1177,6 +1179,7 @@ DtCompileS3pt (
3328 DT_SUBTABLE *ParentTable;
3329 ACPI_DMTABLE_INFO *InfoTable;
3330 DT_FIELD *SubtableStart;
3334 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
3335 @@ -1204,7 +1207,8 @@ DtCompileS3pt (
3337 S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
3339 - switch (S3ptHeader->Type)
3340 + ACPI_MOVE_16_TO_16(&HdrType, &S3ptHeader->Type);
3343 case ACPI_S3PT_TYPE_RESUME:
3345 @@ -1517,6 +1521,7 @@ DtCompileSlit (
3347 UINT32 LocalityListLength;
3348 UINT8 *LocalityBuffer;
3352 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
3353 @@ -1529,7 +1534,8 @@ DtCompileSlit (
3354 ParentTable = DtPeekSubtable ();
3355 DtInsertSubtable (ParentTable, Subtable);
3357 - Localities = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
3358 + Tmp = *ACPI_CAST_PTR (UINT32, Subtable->Buffer);
3359 + ACPI_MOVE_32_TO_32(&Localities, &Tmp);
3360 LocalityBuffer = UtLocalCalloc (Localities);
3361 LocalityListLength = 0;
3363 @@ -1741,6 +1747,7 @@ DtCompileTcpa (
3364 ACPI_TABLE_TCPA_HDR *TcpaHeader;
3365 DT_SUBTABLE *ParentTable;
3370 /* Compile the main table */
3371 @@ -1761,7 +1768,8 @@ DtCompileTcpa (
3373 TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
3375 - switch (TcpaHeader->PlatformClass)
3376 + ACPI_MOVE_16_TO_16(&PlatClass, &TcpaHeader->PlatformClass);
3377 + switch (PlatClass)
3379 case ACPI_TCPA_CLIENT_TABLE:
3381 @@ -1809,6 +1817,7 @@ DtCompileTpm2Rev3 (
3382 ACPI_TABLE_TPM23 *Tpm23Header;
3383 DT_SUBTABLE *ParentTable;
3384 ACPI_STATUS Status = AE_OK;
3388 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm23,
3389 @@ -1820,7 +1829,8 @@ DtCompileTpm2Rev3 (
3391 /* Subtable type depends on the StartMethod */
3393 - switch (Tpm23Header->StartMethod)
3394 + ACPI_MOVE_32_TO_32(&Tmp32, &Tpm23Header->StartMethod);
3397 case ACPI_TPM23_ACPI_START_METHOD:
3399 @@ -1867,6 +1877,7 @@ DtCompileTpm2 (
3400 DT_SUBTABLE *ParentTable;
3401 ACPI_STATUS Status = AE_OK;
3402 ACPI_TABLE_HEADER *Header;
3406 ParentTable = DtPeekSubtable ();
3407 @@ -1910,7 +1921,8 @@ DtCompileTpm2 (
3409 /* Subtable type depends on the StartMethod */
3411 - switch (Tpm2Header->StartMethod)
3412 + ACPI_MOVE_32_TO_32(&Tmp32, &Tpm2Header->StartMethod);
3415 case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
3417 @@ -2126,6 +2138,9 @@ DtCompileWpbt (
3418 ACPI_TABLE_WPBT *Table;
3426 /* Compile the main table */
3427 @@ -2153,7 +2168,16 @@ DtCompileWpbt (
3429 Length = (UINT16) Subtable->TotalLength;
3430 Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
3431 - Table->ArgumentsLength = Length;
3432 + ACPI_MOVE_16_TO_16(&Table->ArgumentsLength, &Length);
3434 + /* The arguments are in Unicode, so make sure the byte order is correct */
3435 + Ptr16 = (UINT16 *)Subtable->Buffer;
3436 + for (ii = 0; ii < Length; ii++)
3438 + ACPI_MOVE_16_TO_16(&Tmp16, Ptr16);
3443 ParentTable = DtPeekSubtable ();
3444 DtInsertSubtable (ParentTable, Subtable);
3445 Index: acpica-unix-20209326/source/components/disassembler/dmbuffer.c
3446 ===================================================================
3447 --- acpica-unix-20209326.orig/source/components/disassembler/dmbuffer.c
3448 +++ acpica-unix-20209326/source/components/disassembler/dmbuffer.c
3449 @@ -204,7 +204,7 @@ AcpiDmByteList (
3452 ByteData = Op->Named.Data;
3453 - ByteCount = (UINT32) Op->Common.Value.Integer;
3454 + ByteCount = (UINT32) Op->Common.Value.Size;
3457 * The byte list belongs to a buffer, and can be produced by either
3458 @@ -304,7 +304,8 @@ AcpiDmIsUuidBuffer (
3459 /* Extract the byte list info */
3461 ByteData = NextOp->Named.Data;
3462 - ByteCount = (UINT32) NextOp->Common.Value.Integer;
3463 + /* ByteCount = (UINT32) NextOp->Common.Value.Integer; */
3464 + ByteCount = (UINT32) NextOp->Common.Value.Size;
3466 /* Byte count must be exactly 16 */
3468 @@ -424,7 +425,8 @@ AcpiDmIsUnicodeBuffer (
3469 /* Extract the byte list info */
3471 ByteData = NextOp->Named.Data;
3472 - ByteCount = (UINT32) NextOp->Common.Value.Integer;
3473 + /* ByteCount = (UINT32) NextOp->Common.Value.Integer; */
3474 + ByteCount = (UINT32) NextOp->Common.Value.Size;
3475 WordCount = ACPI_DIV_2 (ByteCount);
3478 @@ -852,19 +854,22 @@ AcpiDmUnicode (
3485 /* Extract the buffer info as a WORD buffer */
3487 WordData = ACPI_CAST_PTR (UINT16, Op->Named.Data);
3488 - WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Integer));
3489 + WordCount = ACPI_DIV_2 (((UINT32) Op->Common.Value.Size));
3491 /* Write every other byte as an ASCII character */
3493 AcpiOsPrintf ("\"");
3494 for (i = 0; i < (WordCount - 1); i++)
3496 - OutputValue = (int) WordData[i];
3497 + /* OutputValue = (int) WordData[i]; */
3498 + ACPI_MOVE_16_TO_16(&Tmp16, &WordData[i]);
3499 + OutputValue = (int) Tmp16;
3501 /* Handle values that must be escaped */
3503 @@ -973,16 +978,18 @@ AcpiDmCheckForHardwareId (
3504 ACPI_PARSE_OBJECT *Op)
3508 ACPI_PARSE_OBJECT *NextOp;
3511 /* Get the NameSegment */
3513 - Name = AcpiPsGetName (Op);
3515 + TmpName = AcpiPsGetName (Op);
3520 + ACPI_MOVE_32_TO_32(&Name, &TmpName);
3522 NextOp = AcpiPsGetDepthNext (NULL, Op);
3524 Index: acpica-unix-20209326/source/components/disassembler/dmopcode.c
3525 ===================================================================
3526 --- acpica-unix-20209326.orig/source/components/disassembler/dmopcode.c
3527 +++ acpica-unix-20209326/source/components/disassembler/dmopcode.c
3528 @@ -244,6 +244,7 @@ AcpiDmPredefinedDescription (
3530 int LastCharIsDigit;
3531 int LastCharsAreHex;
3532 + char TmpName[ACPI_NAMESEG_SIZE + 1];
3536 @@ -261,7 +262,9 @@ AcpiDmPredefinedDescription (
3538 /* Predefined name must start with an underscore */
3540 - NameString = ACPI_CAST_PTR (char, &Op->Named.Name);
3541 + memset(TmpName, 0, ACPI_NAMESEG_SIZE + 1);
3542 + ACPI_MOVE_32_TO_32(TmpName, &Op->Named.Name);
3543 + NameString = TmpName;
3544 if (NameString[0] != '_')
3547 @@ -880,25 +883,29 @@ AcpiDmDisassembleOneOp (
3548 AcpiDmNamestring (Op->Common.Value.Name);
3551 - case AML_INT_NAMEDFIELD_OP:
3552 + case AML_INT_NAMEDFIELD_OP: {
3554 - Length = AcpiDmDumpName (Op->Named.Name);
3557 + ACPI_MOVE_32_TO_32(&TmpName, &Op->Named.Name);
3558 + Length = AcpiDmDumpName (TmpName);
3561 ASL_CV_PRINT_ONE_COMMENT (Op, AML_NAMECOMMENT, NULL, 0);
3562 AcpiOsPrintf ("%*.s %u", (unsigned) (5 - Length), " ",
3563 - (UINT32) Op->Common.Value.Integer);
3564 + (UINT32) Op->Common.Value.Size);
3566 AcpiDmCommaIfFieldMember (Op);
3568 - Info->BitOffset += (UINT32) Op->Common.Value.Integer;
3569 + Info->BitOffset += (UINT32) Op->Common.Value.Size;
3573 case AML_INT_RESERVEDFIELD_OP:
3575 /* Offset() -- Must account for previous offsets */
3577 - Offset = (UINT32) Op->Common.Value.Integer;
3578 + Offset = Op->Common.Value.Size;
3579 Info->BitOffset += Offset;
3581 if (Info->BitOffset % 8 == 0)
3582 @@ -942,10 +949,15 @@ AcpiDmDisassembleOneOp (
3584 if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
3586 + /* UINT64 Tmp64; */
3588 AcpiOsPrintf ("\n");
3590 Aml = Child->Named.Data;
3592 Length = (UINT32) Child->Common.Value.Integer;
3594 + Length = (UINT32) Child->Common.Value.Size;
3597 Info->MappingOp = Op;
3598 Index: acpica-unix-20209326/source/components/disassembler/dmresrcl.c
3599 ===================================================================
3600 --- acpica-unix-20209326.orig/source/components/disassembler/dmresrcl.c
3601 +++ acpica-unix-20209326/source/components/disassembler/dmresrcl.c
3602 @@ -141,7 +141,8 @@ AcpiDmMemoryFields (
3610 for (i = 0; i < 4; i++)
3612 @@ -151,14 +152,14 @@ AcpiDmMemoryFields (
3616 - AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
3617 - AcpiDmMemoryNames[i]);
3618 + ACPI_MOVE_16_TO_16(&Tmp16, &(ACPI_CAST_PTR (UINT16, Source)[i]));
3619 + AcpiDmDumpInteger16 (Tmp16, AcpiDmMemoryNames[i]);
3624 - AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
3625 - AcpiDmMemoryNames[i]);
3626 + ACPI_MOVE_32_TO_32(&Tmp32, &(ACPI_CAST_PTR (UINT32, Source)[i]));
3627 + AcpiDmDumpInteger32 (Tmp32, AcpiDmMemoryNames[i]);
3631 @@ -190,7 +191,9 @@ AcpiDmAddressFields (
3640 AcpiOsPrintf ("\n");
3642 @@ -202,20 +205,20 @@ AcpiDmAddressFields (
3646 - AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
3647 - AcpiDmAddressNames[i]);
3648 + ACPI_MOVE_16_TO_16(&Tmp16, &(ACPI_CAST_PTR (UINT16, Source)[i]));
3649 + AcpiDmDumpInteger16 (Tmp16, AcpiDmAddressNames[i]);
3654 - AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
3655 - AcpiDmAddressNames[i]);
3656 + ACPI_MOVE_32_TO_32(&Tmp32, &(ACPI_CAST_PTR (UINT32, Source)[i]));
3657 + AcpiDmDumpInteger32 (Tmp32, AcpiDmAddressNames[i]);
3662 - AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
3663 - AcpiDmAddressNames[i]);
3664 + ACPI_MOVE_64_TO_64(&Tmp64, &(ACPI_CAST_PTR (UINT64, Source)[i]));
3665 + AcpiDmDumpInteger64 (Tmp64, AcpiDmAddressNames[i]);
3669 @@ -868,6 +871,7 @@ AcpiDmFixedMemory32Descriptor (
3675 /* Dump name and read/write flag */
3677 @@ -876,12 +880,12 @@ AcpiDmFixedMemory32Descriptor (
3678 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
3680 AcpiDmIndent (Level + 1);
3681 - AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
3683 + ACPI_MOVE_32_TO_32(&Tmp, &Resource->FixedMemory32.Address);
3684 + AcpiDmDumpInteger32 (Tmp, "Address Base");
3686 AcpiDmIndent (Level + 1);
3687 - AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength,
3688 - "Address Length");
3689 + ACPI_MOVE_32_TO_32(&Tmp, &Resource->FixedMemory32.AddressLength);
3690 + AcpiDmDumpInteger32 (Tmp, "Address Length");
3692 /* Insert a descriptor name */
3694 @@ -913,6 +917,7 @@ AcpiDmGenericRegisterDescriptor (
3700 AcpiDmIndent (Level);
3701 AcpiOsPrintf ("Register (");
3702 @@ -926,7 +931,9 @@ AcpiDmGenericRegisterDescriptor (
3703 AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
3705 AcpiDmIndent (Level + 1);
3706 - AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
3707 + /* AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address"); */
3708 + ACPI_MOVE_64_TO_64(&Tmp64, &Resource->GenericReg.Address);
3709 + AcpiDmDumpInteger64 (Tmp64, "Address");
3711 /* Optional field for ACPI 3.0 */
3713 @@ -972,7 +979,7 @@ AcpiDmInterruptDescriptor (
3720 AcpiDmIndent (Level);
3721 AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
3722 @@ -986,10 +993,11 @@ AcpiDmInterruptDescriptor (
3723 * list. Must compute length based on length of the list. First xrupt
3724 * is included in the struct (reason for -1 below)
3726 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->ExtendedIrq.ResourceLength);
3727 AcpiDmResourceSource (Resource,
3728 sizeof (AML_RESOURCE_EXTENDED_IRQ) +
3729 ((UINT32) Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
3730 - Resource->ExtendedIrq.ResourceLength);
3733 /* Insert a descriptor name */
3735 @@ -1002,9 +1010,12 @@ AcpiDmInterruptDescriptor (
3736 AcpiOsPrintf ("{\n");
3737 for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
3739 + UINT32 Tmp32, Val32;
3741 AcpiDmIndent (Level + 1);
3742 - AcpiOsPrintf ("0x%8.8X,\n",
3743 - (UINT32) Resource->ExtendedIrq.Interrupts[i]);
3744 + Val32 = (UINT32) Resource->ExtendedIrq.Interrupts[i];
3745 + ACPI_MOVE_32_TO_32(&Tmp32, &Val32);
3746 + AcpiOsPrintf ("0x%8.8X,\n", Tmp32);
3749 AcpiDmIndent (Level);
3750 Index: acpica-unix-20209326/source/components/disassembler/dmresrcl2.c
3751 ===================================================================
3752 --- acpica-unix-20209326.orig/source/components/disassembler/dmresrcl2.c
3753 +++ acpica-unix-20209326/source/components/disassembler/dmresrcl2.c
3754 @@ -191,22 +191,24 @@ AcpiDmGpioCommon (
3755 char *DeviceName = NULL;
3761 /* ResourceSource, ResourceSourceIndex, ResourceType */
3763 AcpiDmIndent (Level + 1);
3764 - if (Resource->Gpio.ResSourceOffset)
3765 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.ResSourceOffset);
3768 - DeviceName = ACPI_ADD_PTR (char,
3769 - Resource, Resource->Gpio.ResSourceOffset),
3770 + DeviceName = ACPI_ADD_PTR (char, Resource, Tmp16),
3771 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
3774 AcpiOsPrintf (", ");
3775 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.ResSourceIndex);
3776 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.Flags);
3777 AcpiOsPrintf ("%s, ",
3778 - AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.Flags)]);
3779 + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Tmp16)]);
3781 /* Insert a descriptor name */
3783 @@ -215,15 +217,16 @@ AcpiDmGpioCommon (
3785 /* Dump the vendor data */
3787 - if (Resource->Gpio.VendorOffset)
3788 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorOffset);
3791 AcpiOsPrintf ("\n");
3792 AcpiDmIndent (Level + 1);
3793 - VendorData = ACPI_ADD_PTR (UINT8, Resource,
3794 - Resource->Gpio.VendorOffset);
3795 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorOffset);
3796 + VendorData = ACPI_ADD_PTR (UINT8, Resource, Tmp16);
3798 - AcpiDmDumpRawDataBuffer (VendorData,
3799 - Resource->Gpio.VendorLength, Level);
3800 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorLength);
3801 + AcpiDmDumpRawDataBuffer (VendorData, Tmp16, Level);
3804 AcpiOsPrintf (")\n");
3805 @@ -233,17 +236,25 @@ AcpiDmGpioCommon (
3806 AcpiDmIndent (Level + 1);
3807 AcpiOsPrintf ("{ // Pin list\n");
3810 PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
3811 Resource->Gpio.PinTableOffset)) /
3814 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.ResSourceOffset);
3815 + PinCount = (UINT32) Tmp16;
3816 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.PinTableOffset);
3817 + PinCount -= (UINT32) Tmp16;
3818 + PinCount /= sizeof (UINT16);
3820 - PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource,
3821 - Resource->Gpio.PinTableOffset);
3822 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.PinTableOffset);
3823 + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, Tmp16);
3825 for (i = 0; i < PinCount; i++)
3827 AcpiDmIndent (Level + 2);
3828 - AcpiOsPrintf ("0x%4.4X%s\n", PinList[i],
3829 + ACPI_MOVE_16_TO_16(&Tmp16, &PinList[i]);
3830 + AcpiOsPrintf ("0x%4.4X%s\n", Tmp16,
3831 ((i + 1) < PinCount) ? "," : "");
3834 @@ -277,16 +288,18 @@ AcpiDmGpioIntDescriptor (
3840 /* Dump the GpioInt-specific portion of the descriptor */
3842 /* EdgeLevel, ActiveLevel, Shared */
3844 AcpiDmIndent (Level);
3845 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
3846 AcpiOsPrintf ("GpioInt (%s, %s, %s, ",
3847 - AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Resource->Gpio.IntFlags)],
3848 - AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 1)],
3849 - AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
3850 + AcpiGbl_HeDecode [ACPI_GET_1BIT_FLAG (Tmp16)],
3851 + AcpiGbl_LlDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 1)],
3852 + AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
3854 /* PinConfig, DebounceTimeout */
3856 @@ -299,7 +312,8 @@ AcpiDmGpioIntDescriptor (
3858 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
3860 - AcpiOsPrintf ("0x%4.4X,\n", Resource->Gpio.DebounceTimeout);
3861 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DebounceTimeout);
3862 + AcpiOsPrintf ("0x%4.4X,\n", Tmp16);
3864 /* Dump the GpioInt/GpioIo common portion of the descriptor */
3866 @@ -329,14 +343,16 @@ AcpiDmGpioIoDescriptor (
3872 /* Dump the GpioIo-specific portion of the descriptor */
3874 /* Shared, PinConfig */
3876 AcpiDmIndent (Level);
3877 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
3878 AcpiOsPrintf ("GpioIo (%s, ",
3879 - AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Resource->Gpio.IntFlags, 3)]);
3880 + AcpiGbl_ShrDecode [ACPI_EXTRACT_2BIT_FLAG (Tmp16, 3)]);
3882 if (Resource->Gpio.PinConfig <= 3)
3884 @@ -350,10 +366,13 @@ AcpiDmGpioIoDescriptor (
3886 /* DebounceTimeout, DriveStrength, IoRestriction */
3888 - AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DebounceTimeout);
3889 - AcpiOsPrintf ("0x%4.4X, ", Resource->Gpio.DriveStrength);
3890 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DebounceTimeout);
3891 + AcpiOsPrintf ("0x%4.4X, ", Tmp16);
3892 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.DriveStrength);
3893 + AcpiOsPrintf ("0x%4.4X, ", Tmp16);
3894 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.IntFlags);
3895 AcpiOsPrintf ("%s,\n",
3896 - AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Resource->Gpio.IntFlags)]);
3897 + AcpiGbl_IorDecode [ACPI_GET_2BIT_FLAG (Tmp16)]);
3899 /* Dump the GpioInt/GpioIo common portion of the descriptor */
3901 @@ -533,6 +552,7 @@ AcpiDmDumpSerialBusVendorData (
3904 UINT32 VendorLength;
3908 /* Get the (optional) vendor data and length */
3909 @@ -541,8 +561,8 @@ AcpiDmDumpSerialBusVendorData (
3911 case AML_RESOURCE_I2C_SERIALBUSTYPE:
3913 - VendorLength = Resource->CommonSerialBus.TypeDataLength -
3914 - AML_RESOURCE_I2C_MIN_DATA_LEN;
3915 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
3916 + VendorLength = Tmp16 - AML_RESOURCE_I2C_MIN_DATA_LEN;
3918 VendorData = ACPI_ADD_PTR (UINT8, Resource,
3919 sizeof (AML_RESOURCE_I2C_SERIALBUS));
3920 @@ -550,8 +570,8 @@ AcpiDmDumpSerialBusVendorData (
3922 case AML_RESOURCE_SPI_SERIALBUSTYPE:
3924 - VendorLength = Resource->CommonSerialBus.TypeDataLength -
3925 - AML_RESOURCE_SPI_MIN_DATA_LEN;
3926 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
3927 + VendorLength = Tmp16 - AML_RESOURCE_SPI_MIN_DATA_LEN;
3929 VendorData = ACPI_ADD_PTR (UINT8, Resource,
3930 sizeof (AML_RESOURCE_SPI_SERIALBUS));
3931 @@ -559,8 +579,8 @@ AcpiDmDumpSerialBusVendorData (
3933 case AML_RESOURCE_UART_SERIALBUSTYPE:
3935 - VendorLength = Resource->CommonSerialBus.TypeDataLength -
3936 - AML_RESOURCE_UART_MIN_DATA_LEN;
3937 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
3938 + VendorLength = Tmp16 - AML_RESOURCE_UART_MIN_DATA_LEN;
3940 VendorData = ACPI_ADD_PTR (UINT8, Resource,
3941 sizeof (AML_RESOURCE_UART_SERIALBUS));
3942 @@ -601,24 +621,29 @@ AcpiDmI2cSerialBusDescriptor (
3944 UINT32 ResourceSourceOffset;
3950 /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
3952 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->I2cSerialBus.SlaveAddress);
3953 + ACPI_MOVE_32_TO_32(&Tmp32, &Resource->I2cSerialBus.ConnectionSpeed);
3954 AcpiDmIndent (Level);
3955 AcpiOsPrintf ("I2cSerialBusV2 (0x%4.4X, %s, 0x%8.8X,\n",
3956 - Resource->I2cSerialBus.SlaveAddress,
3958 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
3959 - Resource->I2cSerialBus.ConnectionSpeed);
3962 AcpiDmIndent (Level + 1);
3963 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->I2cSerialBus.TypeSpecificFlags);
3964 AcpiOsPrintf ("%s, ",
3965 - AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.TypeSpecificFlags)]);
3966 + AcpiGbl_AmDecode [ACPI_GET_1BIT_FLAG (Tmp16)]);
3968 /* ResourceSource is a required field */
3970 - ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) +
3971 - Resource->CommonSerialBus.TypeDataLength;
3972 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->CommonSerialBus.TypeDataLength);
3973 + ResourceSourceOffset = sizeof (AML_RESOURCE_COMMON_SERIALBUS) + Tmp16;
3975 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
3976 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
3977 Index: acpica-unix-20209326/source/components/disassembler/dmresrcs.c
3978 ===================================================================
3979 --- acpica-unix-20209326.orig/source/components/disassembler/dmresrcs.c
3980 +++ acpica-unix-20209326/source/components/disassembler/dmresrcs.c
3981 @@ -72,6 +72,7 @@ AcpiDmIrqDescriptor (
3987 AcpiDmIndent (Level);
3988 AcpiOsPrintf ("%s (",
3989 @@ -93,7 +94,8 @@ AcpiDmIrqDescriptor (
3990 AcpiOsPrintf (")\n");
3992 AcpiDmIndent (Level + 1);
3993 - AcpiDmBitList (Resource->Irq.IrqMask);
3994 + ACPI_MOVE_16_TO_16(&Tmp, &Resource->Irq.IrqMask);
3995 + AcpiDmBitList (Tmp);
3999 @@ -204,16 +206,19 @@ AcpiDmIoDescriptor (
4005 AcpiDmIndent (Level);
4006 AcpiOsPrintf ("IO (%s,\n",
4007 AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
4009 AcpiDmIndent (Level + 1);
4010 - AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
4011 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Io.Minimum);
4012 + AcpiDmDumpInteger16 (Tmp16, "Range Minimum");
4014 AcpiDmIndent (Level + 1);
4015 - AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
4016 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Io.Maximum);
4017 + AcpiDmDumpInteger16 (Tmp16, "Range Maximum");
4019 AcpiDmIndent (Level + 1);
4020 AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
4021 @@ -251,12 +256,14 @@ AcpiDmFixedIoDescriptor (
4027 AcpiDmIndent (Level);
4028 AcpiOsPrintf ("FixedIO (\n");
4030 AcpiDmIndent (Level + 1);
4031 - AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
4032 + ACPI_MOVE_16_TO_16(&Tmp16, &Resource->FixedIo.Address);
4033 + AcpiDmDumpInteger16 (Tmp16, "Address");
4035 AcpiDmIndent (Level + 1);
4036 AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
4037 Index: acpica-unix-20209326/source/components/dispatcher/dsfield.c
4038 ===================================================================
4039 --- acpica-unix-20209326.orig/source/components/dispatcher/dsfield.c
4040 +++ acpica-unix-20209326/source/components/dispatcher/dsfield.c
4041 @@ -324,6 +324,7 @@ AcpiDsGetFieldNames (
4044 ACPI_PARSE_OBJECT *Child;
4047 #ifdef ACPI_EXEC_APP
4048 ACPI_OPERAND_OBJECT *ResultDesc;
4049 @@ -437,10 +438,17 @@ AcpiDsGetFieldNames (
4051 /* Lookup the name, it should already exist */
4053 + ACPI_MOVE_32_TO_32(&TmpName, &Arg->Named.Name);
4054 + Status = AcpiNsLookup (WalkState->ScopeInfo,
4055 + (char *) &TmpName, Info->FieldType,
4056 + ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
4057 + WalkState, &Info->FieldNode);
4059 Status = AcpiNsLookup (WalkState->ScopeInfo,
4060 (char *) &Arg->Named.Name, Info->FieldType,
4061 ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
4062 WalkState, &Info->FieldNode);
4064 if (ACPI_FAILURE (Status))
4066 ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
4067 @@ -689,9 +697,17 @@ AcpiDsInitFieldObjects (
4069 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
4073 + ACPI_MOVE_32_TO_32(&TmpName, &Arg->Named.Name);
4074 + Status = AcpiNsLookup (WalkState->ScopeInfo,
4075 + (char *) &TmpName, Type, ACPI_IMODE_LOAD_PASS1,
4076 + Flags, WalkState, &Node);
4078 Status = AcpiNsLookup (WalkState->ScopeInfo,
4079 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
4080 Flags, WalkState, &Node);
4082 if (ACPI_FAILURE (Status))
4084 ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
4085 Index: acpica-unix-20209326/source/components/events/evgpeblk.c
4086 ===================================================================
4087 --- acpica-unix-20209326.orig/source/components/events/evgpeblk.c
4088 +++ acpica-unix-20209326/source/components/events/evgpeblk.c
4089 @@ -380,6 +380,7 @@ AcpiEvCreateGpeBlock (
4091 ACPI_GPE_BLOCK_INFO *GpeBlock;
4092 ACPI_GPE_WALK_INFO WalkInfo;
4093 + char Name[ACPI_NAMESEG_SIZE + 1];
4096 ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
4097 @@ -400,7 +401,7 @@ AcpiEvCreateGpeBlock (
4099 /* Initialize the new GPE block */
4101 - GpeBlock->Address = Address;
4102 + ACPI_MOVE_64_TO_64(&GpeBlock->Address, &Address);
4103 GpeBlock->SpaceId = SpaceId;
4104 GpeBlock->Node = GpeDevice;
4105 GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH);
4106 @@ -449,11 +450,13 @@ AcpiEvCreateGpeBlock (
4107 (*ReturnGpeBlock) = GpeBlock;
4110 + memset(&Name, 0, ACPI_NAMESEG_SIZE + 1);
4111 + ACPI_MOVE_32_TO_32(&Name, &GpeDevice->Name.Ascii);
4112 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
4113 " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n",
4114 (UINT32) GpeBlock->BlockBaseNumber,
4115 (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)),
4116 - GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber,
4117 + Name, GpeBlock->RegisterCount, InterruptNumber,
4118 InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : ""));
4120 /* Update global count of currently available GPEs */
4121 Index: acpica-unix-20209326/source/components/hardware/hwregs.c
4122 ===================================================================
4123 --- acpica-unix-20209326.orig/source/components/hardware/hwregs.c
4124 +++ acpica-unix-20209326/source/components/hardware/hwregs.c
4125 @@ -197,7 +197,7 @@ AcpiHwValidateRegister (
4126 * Address must not be null. A null address also indicates an optional
4127 * ACPI register that is not supported, so no error message.
4129 - ACPI_MOVE_64_TO_64 (Address, &Reg->Address);
4130 + *Address = Reg->Address;
4133 return (AE_BAD_ADDRESS);
4134 Index: acpica-unix-20209326/source/components/hardware/hwvalid.c
4135 ===================================================================
4136 --- acpica-unix-20209326.orig/source/components/hardware/hwvalid.c
4137 +++ acpica-unix-20209326/source/components/hardware/hwvalid.c
4138 @@ -135,6 +135,8 @@ AcpiHwValidateIoRequest (
4140 ACPI_IO_ADDRESS LastAddress;
4141 const ACPI_PORT_INFO *PortInfo;
4146 ACPI_FUNCTION_TRACE (HwValidateIoRequest);
4147 @@ -162,7 +164,10 @@ AcpiHwValidateIoRequest (
4149 /* Maximum 16-bit address in I/O space */
4151 - if (LastAddress > ACPI_UINT16_MAX)
4152 + Max16 = (UINT64) ACPI_UINT16_MAX;
4153 + ACPI_MOVE_64_TO_64(&Tmp64, &Max16);
4155 + if ((UINT64)LastAddress > Tmp64)
4157 ACPI_ERROR ((AE_INFO,
4158 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
4159 Index: acpica-unix-20209326/source/components/namespace/nsaccess.c
4160 ===================================================================
4161 --- acpica-unix-20209326.orig/source/components/namespace/nsaccess.c
4162 +++ acpica-unix-20209326/source/components/namespace/nsaccess.c
4163 @@ -349,6 +349,7 @@ AcpiNsLookup (
4164 UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT;
4166 ACPI_INTERPRETER_MODE LocalInterpreterMode;
4170 ACPI_FUNCTION_TRACE (NsLookup);
4171 @@ -758,9 +759,10 @@ AcpiNsLookup (
4173 /* Complain about a type mismatch */
4175 + ACPI_MOVE_32_TO_32(&Tmp32, &SimpleName);
4176 ACPI_WARNING ((AE_INFO,
4177 "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
4178 - ACPI_CAST_PTR (char, &SimpleName),
4179 + ACPI_CAST_PTR (char, &Tmp32),
4180 AcpiUtGetTypeName (ThisNode->Type),
4181 AcpiUtGetTypeName (TypeToCheckFor)));
4183 Index: acpica-unix-20209326/source/components/namespace/nsparse.c
4184 ===================================================================
4185 --- acpica-unix-20209326.orig/source/components/namespace/nsparse.c
4186 +++ acpica-unix-20209326/source/components/namespace/nsparse.c
4187 @@ -216,13 +216,14 @@ AcpiNsOneCompleteParse (
4189 /* Table must consist of at least a complete header */
4191 - if (Table->Length < sizeof (ACPI_TABLE_HEADER))
4192 + ACPI_MOVE_32_TO_32(&AmlLength, &Table->Length);
4193 + if (AmlLength < sizeof (ACPI_TABLE_HEADER))
4195 return_ACPI_STATUS (AE_BAD_HEADER);
4198 AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
4199 - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
4200 + AmlLength -= sizeof (ACPI_TABLE_HEADER);
4202 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
4203 if (ACPI_FAILURE (Status))
4204 Index: acpica-unix-20209326/source/components/tables/tbdata.c
4205 ===================================================================
4206 --- acpica-unix-20209326.orig/source/components/tables/tbdata.c
4207 +++ acpica-unix-20209326/source/components/tables/tbdata.c
4208 @@ -552,6 +552,7 @@ AcpiTbVerifyTempTable (
4211 ACPI_STATUS Status = AE_OK;
4215 ACPI_FUNCTION_TRACE (TbVerifyTempTable);
4216 @@ -581,7 +582,8 @@ AcpiTbVerifyTempTable (
4218 /* Verify the checksum */
4220 - Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
4221 + ACPI_MOVE_32_TO_32(&Length, &TableDesc->Length);
4222 + Status = AcpiTbVerifyChecksum (TableDesc->Pointer, Length);
4223 if (ACPI_FAILURE (Status))
4225 ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
4226 Index: acpica-unix-20209326/source/components/tables/tbfadt.c
4227 ===================================================================
4228 --- acpica-unix-20209326.orig/source/components/tables/tbfadt.c
4229 +++ acpica-unix-20209326/source/components/tables/tbfadt.c
4230 @@ -424,18 +424,20 @@ AcpiTbCreateLocalFadt (
4231 ACPI_TABLE_HEADER *Table,
4237 * Check if the FADT is larger than the largest table that we expect
4238 * (typically the current ACPI specification version). If so, truncate
4239 * the table, and issue a warning.
4241 - if (Length > sizeof (ACPI_TABLE_FADT))
4242 + ACPI_MOVE_32_TO_32(&Tmp32, &Length);
4243 + if (Tmp32 > sizeof (ACPI_TABLE_FADT))
4245 ACPI_BIOS_WARNING ((AE_INFO,
4246 "FADT (revision %u) is longer than %s length, "
4247 "truncating length %u to %u",
4248 - Table->Revision, ACPI_FADT_CONFORMANCE, Length,
4249 + Table->Revision, ACPI_FADT_CONFORMANCE, Tmp32,
4250 (UINT32) sizeof (ACPI_TABLE_FADT)));
4253 @@ -446,7 +448,7 @@ AcpiTbCreateLocalFadt (
4254 /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
4256 memcpy (&AcpiGbl_FADT, Table,
4257 - ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
4258 + ACPI_MIN (Tmp32, sizeof (ACPI_TABLE_FADT)));
4260 /* Take a copy of the Hardware Reduced flag */
4262 @@ -520,6 +522,8 @@ AcpiTbConvertFadt (
4271 @@ -533,7 +537,8 @@ AcpiTbConvertFadt (
4272 * Note: The FADT revision value is unreliable. Only the length can be
4275 - if (AcpiGbl_FADT.Header.Length <= ACPI_FADT_V2_SIZE)
4276 + ACPI_MOVE_32_TO_32(&Tmp32, &AcpiGbl_FADT.Header.Length);
4277 + if (Tmp32 <= ACPI_FADT_V2_SIZE)
4279 AcpiGbl_FADT.PreferredProfile = 0;
4280 AcpiGbl_FADT.PstateControl = 0;
4281 @@ -546,14 +551,15 @@ AcpiTbConvertFadt (
4282 * current FADT version as defined by the ACPI specification.
4283 * Thus, we will have a common FADT internally.
4285 - AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT);
4286 + Tmp32 = sizeof (ACPI_TABLE_FADT);
4287 + ACPI_MOVE_32_TO_32(&AcpiGbl_FADT.Header.Length, &Tmp32);
4290 * Expand the 32-bit DSDT addresses to 64-bit as necessary.
4291 * Later ACPICA code will always use the X 64-bit field.
4293 - AcpiGbl_FADT.XDsdt = AcpiTbSelectAddress ("DSDT",
4294 - AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
4295 + Tmp64 = AcpiTbSelectAddress ("DSDT", AcpiGbl_FADT.Dsdt, AcpiGbl_FADT.XDsdt);
4296 + ACPI_MOVE_64_TO_64(&AcpiGbl_FADT.XDsdt, &Tmp64);
4298 /* If Hardware Reduced flag is set, we are all done */
4300 @@ -614,7 +620,9 @@ AcpiTbConvertFadt (
4302 if (Address64->Address)
4304 - if (Address64->Address != (UINT64) Address32)
4305 + ACPI_MOVE_32_TO_32(&Tmp32, &Address32);
4306 + ACPI_MOVE_64_TO_64(&Tmp64, &Address64->Address);
4307 + if (Tmp64 != (UINT64) Tmp32)
4309 /* Address mismatch */
4311 @@ -655,9 +663,11 @@ AcpiTbConvertFadt (
4313 if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
4315 + ACPI_MOVE_32_TO_32(&Tmp32, &Address32); /* back to host order */
4316 + Tmp64 = (UINT64) Tmp32; /* promote only */
4317 AcpiTbInitGenericAddress (Address64,
4318 ACPI_ADR_SPACE_SYSTEM_IO, Length,
4319 - (UINT64) Address32, Name, Flags);
4320 + Tmp64, Name, Flags);
4324 @@ -780,10 +790,14 @@ AcpiTbSetupFadtRegisters (
4326 if (Source64->Address)
4328 + UINT64 Tmp64, Addr64;
4330 + ACPI_MOVE_64_TO_64(&Tmp64, &Source64->Address);
4331 + Tmp64 += (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth);
4332 + ACPI_MOVE_64_TO_64(&Addr64, &Tmp64);
4333 AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target,
4334 Source64->SpaceId, Pm1RegisterByteWidth,
4335 - Source64->Address +
4336 - (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth),
4341 Index: acpica-unix-20209326/source/components/tables/tbfind.c
4342 ===================================================================
4343 --- acpica-unix-20209326.orig/source/components/tables/tbfind.c
4344 +++ acpica-unix-20209326/source/components/tables/tbfind.c
4345 @@ -108,8 +108,11 @@ AcpiTbFindTable (
4346 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
4347 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
4351 + ACPI_MOVE_32_TO_32(&Tmp32, &Header.Signature);
4352 if (memcmp (&(AcpiGbl_RootTableList.Tables[i].Signature),
4353 - Header.Signature, ACPI_NAMESEG_SIZE))
4354 + &Tmp32, ACPI_NAMESEG_SIZE))
4356 /* Not the requested table */
4358 Index: acpica-unix-20209326/source/components/tables/tbprint.c
4359 ===================================================================
4360 --- acpica-unix-20209326.orig/source/components/tables/tbprint.c
4361 +++ acpica-unix-20209326/source/components/tables/tbprint.c
4362 @@ -143,15 +143,18 @@ AcpiTbPrintTableHeader (
4363 ACPI_TABLE_HEADER *Header)
4365 ACPI_TABLE_HEADER LocalHeader;
4368 + UINT32 CompilerRev;
4371 if (ACPI_COMPARE_NAMESEG (Header->Signature, ACPI_SIG_FACS))
4373 /* FACS only has signature and length fields */
4375 + ACPI_MOVE_32_TO_32(&Len, &Header->Length);
4376 ACPI_INFO (("%-4.4s 0x%8.8X%8.8X %06X",
4377 - Header->Signature, ACPI_FORMAT_UINT64 (Address),
4379 + Header->Signature, ACPI_FORMAT_UINT64 (Address), Len));
4381 else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
4383 @@ -174,13 +177,16 @@ AcpiTbPrintTableHeader (
4385 AcpiTbCleanupTableHeader (&LocalHeader, Header);
4387 + ACPI_MOVE_32_TO_32(&Len, &LocalHeader.Length);
4388 + ACPI_MOVE_32_TO_32(&OemRev, &LocalHeader.OemRevision);
4389 + ACPI_MOVE_32_TO_32(&CompilerRev, &LocalHeader.AslCompilerRevision);
4391 "%-4.4s 0x%8.8X%8.8X"
4392 " %06X (v%.2d %-6.6s %-8.8s %08X %-4.4s %08X)",
4393 LocalHeader.Signature, ACPI_FORMAT_UINT64 (Address),
4394 - LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
4395 - LocalHeader.OemTableId, LocalHeader.OemRevision,
4396 - LocalHeader.AslCompilerId, LocalHeader.AslCompilerRevision));
4397 + Len, LocalHeader.Revision, LocalHeader.OemId,
4398 + LocalHeader.OemTableId, OemRev,
4399 + LocalHeader.AslCompilerId, CompilerRev));
4403 Index: acpica-unix-20209326/source/components/tables/tbutils.c
4404 ===================================================================
4405 --- acpica-unix-20209326.orig/source/components/tables/tbutils.c
4406 +++ acpica-unix-20209326/source/components/tables/tbutils.c
4407 @@ -238,7 +238,7 @@ AcpiTbGetRootTableEntry (
4408 * 64-bit platform, XSDT: Move (unaligned) 64-bit to local,
4411 - ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
4412 + Address64 = (UINT64) TableEntry;
4414 #if ACPI_MACHINE_WIDTH == 32
4415 if (Address64 > ACPI_UINT32_MAX)
4416 @@ -251,7 +251,8 @@ AcpiTbGetRootTableEntry (
4417 ACPI_FORMAT_UINT64 (Address64)));
4420 - return ((ACPI_PHYSICAL_ADDRESS) (Address64));
4421 + return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
4422 + UINT64, Address64)));
4426 @@ -287,6 +288,7 @@ AcpiTbParseRootTable (
4433 ACPI_FUNCTION_TRACE (TbParseRootTable);
4434 @@ -345,7 +347,7 @@ AcpiTbParseRootTable (
4435 * Validate length of the table, and map entire table.
4436 * Minimum length table must contain at least one entry.
4438 - Length = Table->Length;
4439 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
4440 AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
4442 if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize))
4443 @@ -372,7 +374,7 @@ AcpiTbParseRootTable (
4445 /* Get the number of entries and pointer to first entry */
4447 - TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /
4448 + TableCount = (UINT32) ((Length - sizeof (ACPI_TABLE_HEADER)) /
4450 TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER));
4452 @@ -394,10 +396,10 @@ AcpiTbParseRootTable (
4453 Status = AcpiTbInstallStandardTable (Address,
4454 ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex);
4456 + ACPI_MOVE_32_TO_32(&Tmp32,
4457 + &AcpiGbl_RootTableList.Tables[TableIndex].Signature);
4458 if (ACPI_SUCCESS (Status) &&
4459 - ACPI_COMPARE_NAMESEG (
4460 - &AcpiGbl_RootTableList.Tables[TableIndex].Signature,
4462 + ACPI_COMPARE_NAMESEG (&Tmp32, ACPI_SIG_FADT))
4464 AcpiGbl_FadtIndex = TableIndex;
4466 Index: acpica-unix-20209326/source/components/tables/tbxface.c
4467 ===================================================================
4468 --- acpica-unix-20209326.orig/source/components/tables/tbxface.c
4469 +++ acpica-unix-20209326/source/components/tables/tbxface.c
4470 @@ -293,8 +293,11 @@ AcpiGetTableHeader (
4472 for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
4476 + ACPI_MOVE_32_TO_32(&Tmp32, (UINT32 *)Signature);
4477 if (!ACPI_COMPARE_NAMESEG (
4478 - &(AcpiGbl_RootTableList.Tables[i].Signature), Signature))
4479 + &(AcpiGbl_RootTableList.Tables[i].Signature), &Tmp32))
4483 Index: acpica-unix-20209326/source/components/tables/tbxfload.c
4484 ===================================================================
4485 --- acpica-unix-20209326.orig/source/components/tables/tbxfload.c
4486 +++ acpica-unix-20209326/source/components/tables/tbxfload.c
4487 @@ -153,6 +153,7 @@ AcpiTbLoadNamespace (
4488 ACPI_TABLE_DESC *Table;
4489 UINT32 TablesLoaded = 0;
4490 UINT32 TablesFailed = 0;
4494 ACPI_FUNCTION_TRACE (TbLoadNamespace);
4495 @@ -166,8 +167,9 @@ AcpiTbLoadNamespace (
4497 Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex];
4499 + ACPI_MOVE_32_TO_32(&Tmp32, &Table->Signature.Ascii);
4500 if (!AcpiGbl_RootTableList.CurrentTableCount ||
4501 - !ACPI_COMPARE_NAMESEG (Table->Signature.Ascii, ACPI_SIG_DSDT) ||
4502 + !ACPI_COMPARE_NAMESEG (&Tmp32, ACPI_SIG_DSDT) ||
4503 ACPI_FAILURE (AcpiTbValidateTable (Table)))
4505 Status = AE_NO_ACPI_TABLES;
4506 Index: acpica-unix-20209326/source/tools/acpiexec/aetables.c
4507 ===================================================================
4508 --- acpica-unix-20209326.orig/source/tools/acpiexec/aetables.c
4509 +++ acpica-unix-20209326/source/tools/acpiexec/aetables.c
4510 @@ -146,21 +146,25 @@ AeInitializeTableHeader (
4517 ACPI_COPY_NAMESEG (Header->Signature, Signature);
4518 - Header->Length = Length;
4519 + ACPI_MOVE_32_TO_32(&Header->Length, &Length);
4521 - Header->OemRevision = 0x1001;
4523 + ACPI_MOVE_16_TO_16(&Header->OemRevision, &Tmp16);
4524 memcpy (Header->OemId, "Intel ", ACPI_OEM_ID_SIZE);
4525 memcpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
4526 ACPI_COPY_NAMESEG (Header->AslCompilerId, "INTL");
4527 - Header->AslCompilerRevision = ACPI_CA_VERSION;
4528 + Tmp32 = ACPI_CA_VERSION;
4529 + ACPI_MOVE_32_TO_32(&Header->AslCompilerRevision, &Tmp32);
4531 /* Set the checksum, must set to zero first */
4533 Header->Checksum = 0;
4534 Header->Checksum = (UINT8) -AcpiTbChecksum (
4535 - (void *) Header, Header->Length);
4536 + (void *) Header, Length);
4540 @@ -188,6 +192,7 @@ AeBuildLocalTables (
4541 ACPI_NEW_TABLE_DESC *NextTable;
4543 ACPI_TABLE_FADT *ExternalFadt = NULL;
4548 @@ -374,6 +379,8 @@ AeBuildLocalTables (
4555 * Build a local FADT so we can test the hardware/event init
4557 @@ -385,34 +392,44 @@ AeBuildLocalTables (
4560 LocalFADT.XDsdt = DsdtAddress;
4561 - LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
4562 + Tmp64 = ACPI_PTR_TO_PHYSADDR (&LocalFACS);
4563 + ACPI_MOVE_64_TO_64(&LocalFADT.XFacs, &Tmp64);
4565 /* Miscellaneous FADT fields */
4567 LocalFADT.Gpe0BlockLength = 0x20;
4568 - LocalFADT.Gpe0Block = 0x00003210;
4569 + Tmp32 = 0x00003210;
4570 + ACPI_MOVE_32_TO_32(&LocalFADT.Gpe0Block, &Tmp32);
4572 LocalFADT.Gpe1BlockLength = 0x20;
4573 - LocalFADT.Gpe1Block = 0x0000BA98;
4574 + Tmp32 = 0x0000BA98;
4575 + ACPI_MOVE_32_TO_32(&LocalFADT.Gpe1Block, &Tmp32);
4576 LocalFADT.Gpe1Base = 0x80;
4578 LocalFADT.Pm1EventLength = 4;
4579 - LocalFADT.Pm1aEventBlock = 0x00001aaa;
4580 - LocalFADT.Pm1bEventBlock = 0x00001bbb;
4581 + Tmp32 = 0x00001aaa;
4582 + ACPI_MOVE_32_TO_32(&LocalFADT.Pm1aEventBlock, &Tmp32);
4583 + Tmp32 = 0x00001bbb;
4584 + ACPI_MOVE_32_TO_32(&LocalFADT.Pm1bEventBlock, &Tmp32);
4586 LocalFADT.Pm1ControlLength = 2;
4587 - LocalFADT.Pm1aControlBlock = 0xB0;
4589 + ACPI_MOVE_32_TO_32(&LocalFADT.Pm1aControlBlock, &Tmp32);
4591 LocalFADT.PmTimerLength = 4;
4592 - LocalFADT.PmTimerBlock = 0xA0;
4594 + ACPI_MOVE_32_TO_32(&LocalFADT.PmTimerBlock, &Tmp32);
4596 - LocalFADT.Pm2ControlBlock = 0xC0;
4598 + ACPI_MOVE_32_TO_32(&LocalFADT.Pm2ControlBlock, &Tmp32);
4599 LocalFADT.Pm2ControlLength = 1;
4601 /* Setup one example X-64 GAS field */
4603 LocalFADT.XPm1bEventBlock.SpaceId = ACPI_ADR_SPACE_SYSTEM_IO;
4604 - LocalFADT.XPm1bEventBlock.Address = LocalFADT.Pm1bEventBlock;
4605 + ACPI_MOVE_32_TO_32(&Tmp32, &LocalFADT.Pm1bEventBlock);
4606 + Tmp64 = (UINT64)Tmp32;
4607 + ACPI_MOVE_64_TO_64(&LocalFADT.XPm1bEventBlock.Address, &Tmp64);
4608 LocalFADT.XPm1bEventBlock.BitWidth = (UINT8)
4609 ACPI_MUL_8 (LocalFADT.Pm1EventLength);
4611 @@ -425,13 +442,17 @@ AeBuildLocalTables (
4612 memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
4613 ACPI_COPY_NAMESEG (LocalFACS.Signature, ACPI_SIG_FACS);
4615 - LocalFACS.Length = sizeof (ACPI_TABLE_FACS);
4616 - LocalFACS.GlobalLock = 0x11AA0011;
4617 + Tmp32 = sizeof (ACPI_TABLE_FACS);
4618 + ACPI_MOVE_32_TO_32(&LocalFACS.Length, &Tmp32);
4619 + Tmp32 = 0x11AA0011;
4620 + ACPI_MOVE_32_TO_32(&LocalFACS.GlobalLock, &Tmp32);
4622 /* Build the optional local tables */
4624 if (AcpiGbl_LoadTestTables)
4629 * Build a fake table [TEST] so that we make sure that the
4630 * ACPICA core ignores it
4631 @@ -440,11 +461,12 @@ AeBuildLocalTables (
4632 ACPI_COPY_NAMESEG (LocalTEST.Signature, "TEST");
4634 LocalTEST.Revision = 1;
4635 - LocalTEST.Length = sizeof (ACPI_TABLE_HEADER);
4636 + Tmp32 = sizeof (ACPI_TABLE_HEADER);
4637 + ACPI_MOVE_32_TO_32(&LocalTEST.Length, &Tmp32);
4639 LocalTEST.Checksum = 0;
4640 LocalTEST.Checksum = (UINT8) -AcpiTbChecksum (
4641 - (void *) &LocalTEST, LocalTEST.Length);
4642 + (void *) &LocalTEST, Tmp32);
4645 * Build a fake table with a bad signature [BAD!] so that we make
4646 @@ -454,11 +476,12 @@ AeBuildLocalTables (
4647 ACPI_COPY_NAMESEG (LocalBADTABLE.Signature, "BAD!");
4649 LocalBADTABLE.Revision = 1;
4650 - LocalBADTABLE.Length = sizeof (ACPI_TABLE_HEADER);
4651 + Tmp32 = sizeof (ACPI_TABLE_HEADER);
4652 + ACPI_MOVE_32_TO_32(&LocalBADTABLE.Length, &Tmp32);
4654 LocalBADTABLE.Checksum = 0;
4655 LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum (
4656 - (void *) &LocalBADTABLE, LocalBADTABLE.Length);
4657 + (void *) &LocalBADTABLE, Tmp32);
4661 Index: acpica-unix-20209326/source/common/dmswitch.c
4662 ===================================================================
4663 --- acpica-unix-20209326.orig/source/common/dmswitch.c
4664 +++ acpica-unix-20209326/source/common/dmswitch.c
4665 @@ -88,13 +88,15 @@ AcpiDmProcessSwitch (
4666 ACPI_PARSE_OBJECT_LIST *Current;
4667 ACPI_PARSE_OBJECT_LIST *Previous;
4668 BOOLEAN FoundTemp = FALSE;
4672 switch (Op->Common.AmlOpcode)
4676 - Temp = (char *) (&Op->Named.Name);
4677 + ACPI_MOVE_32_TO_32(&Tmp32, &Op->Named.Name);
4678 + Temp = (char *) (&Tmp32);
4680 if (!strncmp(Temp, "_T_", 3))
4682 @@ -138,7 +140,10 @@ AcpiDmProcessSwitch (
4684 /* Note, if we get here Temp is not NULL */
4686 - if (!strncmp(Temp, (char *) (&Current->Op->Named.Name), 4))
4687 + ACPI_MOVE_32_TO_32(&Tmp32, &Current->Op->Named.Name);
4689 + /* if (!strncmp(Temp, (char *) (&Current->Op->Named.Name), 4)) */
4690 + if (!strncmp(Temp, (char *) &Tmp32, 4))
4692 /* Match found. Ignore disassembly */
4694 Index: acpica-unix-20191213/source/common/dmtbdump1.c
4695 ===================================================================
4696 --- acpica-unix-20191213.orig/source/common/dmtbdump1.c
4697 +++ acpica-unix-20191213/source/common/dmtbdump1.c
4698 @@ -79,17 +79,21 @@ AcpiDmDumpAsf (
4699 UINT32 DataOffset = 0;
4706 /* No main table, only subtables */
4708 + ACPI_MOVE_32_TO_32(&Len, &Table->Length);
4709 Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
4710 - while (Offset < Table->Length)
4711 + while (Offset < Len)
4713 /* Common subtable header */
4715 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4716 - Subtable->Header.Length, AcpiDmTableInfoAsfHdr);
4717 + ACPI_MOVE_16_TO_16(&SubLen, &Subtable->Header.Length);
4718 + Status = AcpiDmDumpTable (Len, Offset, Subtable,
4719 + SubLen, AcpiDmTableInfoAsfHdr);
4720 if (ACPI_FAILURE (Status))
4723 @@ -146,8 +150,7 @@ AcpiDmDumpAsf (
4727 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
4728 - Subtable->Header.Length, InfoTable);
4729 + Status = AcpiDmDumpTable (Len, Offset, Subtable, SubLen, InfoTable);
4730 if (ACPI_FAILURE (Status))
4733 @@ -163,7 +166,7 @@ AcpiDmDumpAsf (
4734 for (i = 0; i < DataCount; i++)
4736 AcpiOsPrintf ("\n");
4737 - Status = AcpiDmDumpTable (Table->Length, DataOffset,
4738 + Status = AcpiDmDumpTable (Len, DataOffset,
4739 DataTable, DataLength, DataInfoTable);
4740 if (ACPI_FAILURE (Status))
4742 @@ -209,15 +212,14 @@ AcpiDmDumpAsf (
4744 /* Point to next subtable */
4746 - if (!Subtable->Header.Length)
4749 AcpiOsPrintf ("Invalid zero subtable header length\n");
4753 - Offset += Subtable->Header.Length;
4754 - Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable,
4755 - Subtable->Header.Length);
4757 + Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, SubLen);
4761 @@ -241,12 +243,13 @@ AcpiDmDumpCpep (
4764 ACPI_CPEP_POLLING *Subtable;
4765 - UINT32 Length = Table->Length;
4767 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
4772 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
4773 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
4774 if (ACPI_FAILURE (Status))
4776 @@ -256,7 +259,7 @@ AcpiDmDumpCpep (
4779 Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
4780 - while (Offset < Table->Length)
4781 + while (Offset < Length)
4783 AcpiOsPrintf ("\n");
4784 Status = AcpiDmDumpTable (Length, Offset, Subtable,
4785 @@ -296,7 +299,10 @@ AcpiDmDumpCsrt (
4786 ACPI_CSRT_GROUP *Subtable;
4787 ACPI_CSRT_SHARED_INFO *SharedInfoTable;
4788 ACPI_CSRT_DESCRIPTOR *SubSubtable;
4789 - UINT32 Length = Table->Length;
4792 + UINT32 SubSubLength;
4793 + UINT32 SharedInfoLength;
4794 UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
4796 UINT32 SubSubOffset;
4797 @@ -307,14 +313,16 @@ AcpiDmDumpCsrt (
4799 /* Subtables (Resource Groups) */
4801 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
4802 Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset);
4803 - while (Offset < Table->Length)
4804 + while (Offset < Length)
4806 /* Resource group subtable */
4808 AcpiOsPrintf ("\n");
4809 + ACPI_MOVE_32_TO_32(&SubLength, &Subtable->Length);
4810 Status = AcpiDmDumpTable (Length, Offset, Subtable,
4811 - Subtable->Length, AcpiDmTableInfoCsrt0);
4812 + SubLength, AcpiDmTableInfoCsrt0);
4813 if (ACPI_FAILURE (Status))
4816 @@ -334,19 +342,20 @@ AcpiDmDumpCsrt (
4820 - SubOffset += Subtable->SharedInfoLength;
4821 + ACPI_MOVE_32_TO_32(&SharedInfoLength, &Subtable->SharedInfoLength);
4822 + SubOffset += SharedInfoLength;
4824 /* Sub-Subtables (Resource Descriptors) */
4826 SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
4827 Offset + SubOffset);
4829 - while ((SubOffset < Subtable->Length) &&
4830 - ((Offset + SubOffset) < Table->Length))
4831 + while ((SubOffset < SubLength) && ((Offset + SubOffset) < Length))
4833 AcpiOsPrintf ("\n");
4834 + ACPI_MOVE_32_TO_32(&SubSubLength, &SubSubtable->Length);
4835 Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable,
4836 - SubSubtable->Length, AcpiDmTableInfoCsrt2);
4837 + SubSubLength, AcpiDmTableInfoCsrt2);
4838 if (ACPI_FAILURE (Status))
4841 @@ -356,7 +365,7 @@ AcpiDmDumpCsrt (
4843 /* Resource-specific info buffer */
4845 - InfoLength = SubSubtable->Length - SubSubOffset;
4846 + InfoLength = SubSubLength - SubSubOffset;
4849 Status = AcpiDmDumpTable (Length,
4850 @@ -370,16 +379,15 @@ AcpiDmDumpCsrt (
4852 /* Point to next sub-subtable */
4854 - SubOffset += SubSubtable->Length;
4855 + SubOffset += SubSubLength;
4856 SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable,
4857 - SubSubtable->Length);
4861 /* Point to next subtable */
4863 - Offset += Subtable->Length;
4864 - Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable,
4865 - Subtable->Length);
4866 + Offset += SubLength;
4867 + Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, SubLength);
4871 @@ -403,16 +411,20 @@ AcpiDmDumpDbg2 (
4874 ACPI_DBG2_DEVICE *Subtable;
4875 - UINT32 Length = Table->Length;
4878 UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
4881 UINT32 AbsoluteOffset;
4889 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
4890 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
4891 if (ACPI_FAILURE (Status))
4893 @@ -422,11 +434,12 @@ AcpiDmDumpDbg2 (
4896 Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
4897 - while (Offset < Table->Length)
4898 + while (Offset < Length)
4900 AcpiOsPrintf ("\n");
4901 + ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
4902 Status = AcpiDmDumpTable (Length, Offset, Subtable,
4903 - Subtable->Length, AcpiDmTableInfoDbg2Device);
4904 + SubLength, AcpiDmTableInfoDbg2Device);
4905 if (ACPI_FAILURE (Status))
4908 @@ -436,13 +449,13 @@ AcpiDmDumpDbg2 (
4910 for (i = 0; i < Subtable->RegisterCount; i++)
4912 - ArrayOffset = Subtable->BaseAddressOffset +
4913 - (sizeof (ACPI_GENERIC_ADDRESS) * i);
4914 + ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->BaseAddressOffset);
4915 + ArrayOffset = Tmp16 + (sizeof (ACPI_GENERIC_ADDRESS) * i);
4916 AbsoluteOffset = Offset + ArrayOffset;
4917 Array = (UINT8 *) Subtable + ArrayOffset;
4919 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
4920 - Subtable->Length, AcpiDmTableInfoDbg2Addr);
4921 + SubLength, AcpiDmTableInfoDbg2Addr);
4922 if (ACPI_FAILURE (Status))
4925 @@ -453,13 +466,13 @@ AcpiDmDumpDbg2 (
4927 for (i = 0; i < Subtable->RegisterCount; i++)
4929 - ArrayOffset = Subtable->AddressSizeOffset +
4930 - (sizeof (UINT32) * i);
4931 + ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->AddressSizeOffset);
4932 + ArrayOffset = Tmp16 + (sizeof (UINT32) * i);
4933 AbsoluteOffset = Offset + ArrayOffset;
4934 Array = (UINT8 *) Subtable + ArrayOffset;
4936 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
4937 - Subtable->Length, AcpiDmTableInfoDbg2Size);
4938 + SubLength, AcpiDmTableInfoDbg2Size);
4939 if (ACPI_FAILURE (Status))
4942 @@ -469,12 +482,13 @@ AcpiDmDumpDbg2 (
4943 /* Dump the Namestring (required) */
4945 AcpiOsPrintf ("\n");
4946 - ArrayOffset = Subtable->NamepathOffset;
4947 + ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->NamepathOffset);
4948 + ArrayOffset = Tmp16;
4949 AbsoluteOffset = Offset + ArrayOffset;
4950 Array = (UINT8 *) Subtable + ArrayOffset;
4952 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
4953 - Subtable->Length, AcpiDmTableInfoDbg2Name);
4954 + SubLength, AcpiDmTableInfoDbg2Name);
4955 if (ACPI_FAILURE (Status))
4958 @@ -484,9 +498,10 @@ AcpiDmDumpDbg2 (
4960 if (Subtable->OemDataOffset)
4962 - Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset,
4963 - Table, Subtable->OemDataLength,
4964 - AcpiDmTableInfoDbg2OemData);
4965 + ACPI_MOVE_16_TO_16(&Tmp16, &Subtable->OemDataOffset);
4966 + ACPI_MOVE_16_TO_16(&AlsoTmp16, &Subtable->OemDataLength);
4967 + Status = AcpiDmDumpTable (Length, Offset + Tmp16,
4968 + Table, AlsoTmp16, AcpiDmTableInfoDbg2OemData);
4969 if (ACPI_FAILURE (Status))
4972 @@ -495,9 +510,9 @@ AcpiDmDumpDbg2 (
4974 /* Point to next subtable */
4976 - Offset += Subtable->Length;
4977 + Offset += SubLength;
4978 Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
4979 - Subtable->Length);
4984 @@ -521,17 +536,20 @@ AcpiDmDumpDmar (
4987 ACPI_DMAR_HEADER *Subtable;
4988 - UINT32 Length = Table->Length;
4991 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
4992 ACPI_DMTABLE_INFO *InfoTable;
4993 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
5002 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5003 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
5004 if (ACPI_FAILURE (Status))
5006 @@ -541,13 +559,14 @@ AcpiDmDumpDmar (
5009 Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
5010 - while (Offset < Table->Length)
5011 + while (Offset < Length)
5013 /* Common subtable header */
5015 AcpiOsPrintf ("\n");
5016 + ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
5017 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5018 - Subtable->Length, AcpiDmTableInfoDmarHdr);
5019 + SubLength, AcpiDmTableInfoDmarHdr);
5020 if (ACPI_FAILURE (Status))
5023 @@ -555,7 +574,8 @@ AcpiDmDumpDmar (
5025 AcpiOsPrintf ("\n");
5027 - switch (Subtable->Type)
5028 + ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
5031 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
5033 @@ -590,12 +610,12 @@ AcpiDmDumpDmar (
5036 AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
5042 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5043 - Subtable->Length, InfoTable);
5044 + SubLength, InfoTable);
5045 if (ACPI_FAILURE (Status))
5048 @@ -604,8 +624,8 @@ AcpiDmDumpDmar (
5050 * Dump the optional device scope entries
5052 - if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
5053 - (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE))
5054 + if ((SubType == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) ||
5055 + (SubType == ACPI_DMAR_TYPE_NAMESPACE))
5057 /* These types do not support device scopes */
5059 @@ -613,7 +633,7 @@ AcpiDmDumpDmar (
5062 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
5063 - while (ScopeOffset < Subtable->Length)
5064 + while (ScopeOffset < SubLength)
5066 AcpiOsPrintf ("\n");
5067 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
5068 @@ -654,9 +674,8 @@ AcpiDmDumpDmar (
5070 /* Point to next subtable */
5072 - Offset += Subtable->Length;
5073 - Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable,
5074 - Subtable->Length);
5075 + Offset += SubLength;
5076 + Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable, SubLength);
5080 @@ -683,12 +702,15 @@ AcpiDmDumpDrtm (
5081 ACPI_DRTM_RESOURCE_LIST *DrtmRl;
5082 ACPI_DRTM_DPS_ID *DrtmDps;
5084 + UINT32 ValidatedCount;
5085 + UINT32 ResourceCount;
5091 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
5092 - AcpiDmTableInfoDrtm);
5093 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5094 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDrtm);
5095 if (ACPI_FAILURE (Status))
5098 @@ -702,7 +724,7 @@ AcpiDmDumpDrtm (
5100 DrtmVtl = ACPI_ADD_PTR (ACPI_DRTM_VTABLE_LIST, Table, Offset);
5101 AcpiOsPrintf ("\n");
5102 - Status = AcpiDmDumpTable (Table->Length, Offset,
5103 + Status = AcpiDmDumpTable (Length, Offset,
5104 DrtmVtl, ACPI_OFFSET (ACPI_DRTM_VTABLE_LIST, ValidatedTables),
5105 AcpiDmTableInfoDrtm0);
5106 if (ACPI_FAILURE (Status))
5107 @@ -715,10 +737,11 @@ AcpiDmDumpDrtm (
5108 /* Dump Validated table addresses */
5111 - while ((Offset < Table->Length) &&
5112 - (DrtmVtl->ValidatedTableCount > Count))
5113 + ACPI_MOVE_32_TO_32(&ValidatedCount, &DrtmVtl->ValidatedTableCount);
5114 + while ((Offset < Length) &&
5115 + (ValidatedCount > Count))
5117 - Status = AcpiDmDumpTable (Table->Length, Offset,
5118 + Status = AcpiDmDumpTable (Length, Offset,
5119 ACPI_ADD_PTR (void, Table, Offset), sizeof (UINT64),
5120 AcpiDmTableInfoDrtm0a);
5121 if (ACPI_FAILURE (Status))
5122 @@ -734,7 +757,7 @@ AcpiDmDumpDrtm (
5124 DrtmRl = ACPI_ADD_PTR (ACPI_DRTM_RESOURCE_LIST, Table, Offset);
5125 AcpiOsPrintf ("\n");
5126 - Status = AcpiDmDumpTable (Table->Length, Offset,
5127 + Status = AcpiDmDumpTable (Length, Offset,
5128 DrtmRl, ACPI_OFFSET (ACPI_DRTM_RESOURCE_LIST, Resources),
5129 AcpiDmTableInfoDrtm1);
5130 if (ACPI_FAILURE (Status))
5131 @@ -747,10 +770,11 @@ AcpiDmDumpDrtm (
5132 /* Dump the Resource List */
5135 - while ((Offset < Table->Length) &&
5136 - (DrtmRl->ResourceCount > Count))
5137 + ACPI_MOVE_32_TO_32(&ResourceCount, &DrtmRl->ResourceCount);
5138 + while ((Offset < Length) &&
5139 + (ResourceCount > Count))
5141 - Status = AcpiDmDumpTable (Table->Length, Offset,
5142 + Status = AcpiDmDumpTable (Length, Offset,
5143 ACPI_ADD_PTR (void, Table, Offset),
5144 sizeof (ACPI_DRTM_RESOURCE), AcpiDmTableInfoDrtm1a);
5145 if (ACPI_FAILURE (Status))
5146 @@ -766,7 +790,7 @@ AcpiDmDumpDrtm (
5148 DrtmDps = ACPI_ADD_PTR (ACPI_DRTM_DPS_ID, Table, Offset);
5149 AcpiOsPrintf ("\n");
5150 - (void) AcpiDmDumpTable (Table->Length, Offset,
5151 + (void) AcpiDmDumpTable (Length, Offset,
5152 DrtmDps, sizeof (ACPI_DRTM_DPS_ID), AcpiDmTableInfoDrtm2);
5155 @@ -790,12 +814,13 @@ AcpiDmDumpEinj (
5158 ACPI_WHEA_HEADER *Subtable;
5159 - UINT32 Length = Table->Length;
5161 UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
5166 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5167 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
5168 if (ACPI_FAILURE (Status))
5170 @@ -805,7 +830,7 @@ AcpiDmDumpEinj (
5173 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
5174 - while (Offset < Table->Length)
5175 + while (Offset < Length)
5177 AcpiOsPrintf ("\n");
5178 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5179 @@ -843,12 +868,13 @@ AcpiDmDumpErst (
5182 ACPI_WHEA_HEADER *Subtable;
5183 - UINT32 Length = Table->Length;
5185 UINT32 Offset = sizeof (ACPI_TABLE_ERST);
5190 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5191 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
5192 if (ACPI_FAILURE (Status))
5194 @@ -858,7 +884,7 @@ AcpiDmDumpErst (
5197 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
5198 - while (Offset < Table->Length)
5199 + while (Offset < Length)
5201 AcpiOsPrintf ("\n");
5202 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5203 @@ -896,17 +922,19 @@ AcpiDmDumpFpdt (
5206 ACPI_FPDT_HEADER *Subtable;
5207 - UINT32 Length = Table->Length;
5209 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
5210 ACPI_DMTABLE_INFO *InfoTable;
5214 /* There is no main table (other than the standard ACPI header) */
5218 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5219 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset);
5220 - while (Offset < Table->Length)
5221 + while (Offset < Length)
5223 /* Common subtable header */
5225 @@ -918,7 +946,8 @@ AcpiDmDumpFpdt (
5229 - switch (Subtable->Type)
5230 + ACPI_MOVE_16_TO_16(&Type, &Subtable->Type);
5233 case ACPI_FPDT_TYPE_BOOT:
5235 @@ -932,8 +961,7 @@ AcpiDmDumpFpdt (
5239 - AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
5241 + AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", Type);
5243 /* Attempt to continue */
5245 @@ -981,16 +1009,19 @@ AcpiDmDumpGtdt (
5248 ACPI_GTDT_HEADER *Subtable;
5249 - UINT32 Length = Table->Length;
5252 UINT32 Offset = sizeof (ACPI_TABLE_GTDT);
5253 ACPI_DMTABLE_INFO *InfoTable;
5254 UINT32 SubtableLength;
5257 ACPI_GTDT_TIMER_ENTRY *GtxTable;
5262 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5263 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
5264 if (ACPI_FAILURE (Status))
5266 @@ -1017,7 +1048,7 @@ AcpiDmDumpGtdt (
5270 - while (Offset < Table->Length)
5271 + while (Offset < Length)
5273 /* Common subtable header */
5275 @@ -1035,8 +1066,9 @@ AcpiDmDumpGtdt (
5276 case ACPI_GTDT_TYPE_TIMER_BLOCK:
5278 SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK);
5279 - GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
5280 + Tmp32 = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK,
5281 Subtable))->TimerCount;
5282 + ACPI_MOVE_32_TO_32(&GtCount, &Tmp32);
5284 InfoTable = AcpiDmTableInfoGtdt0;
5286 @@ -1057,8 +1089,9 @@ AcpiDmDumpGtdt (
5290 + ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
5291 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5292 - Subtable->Length, InfoTable);
5293 + SubLength, InfoTable);
5294 if (ACPI_FAILURE (Status))
5297 @@ -1117,16 +1150,18 @@ AcpiDmDumpHest (
5300 ACPI_HEST_HEADER *Subtable;
5301 - UINT32 Length = Table->Length;
5303 UINT32 Offset = sizeof (ACPI_TABLE_HEST);
5304 ACPI_DMTABLE_INFO *InfoTable;
5305 UINT32 SubtableLength;
5307 ACPI_HEST_IA_ERROR_BANK *BankTable;
5313 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5314 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
5315 if (ACPI_FAILURE (Status))
5317 @@ -1136,10 +1171,11 @@ AcpiDmDumpHest (
5320 Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
5321 - while (Offset < Table->Length)
5322 + while (Offset < Length)
5325 - switch (Subtable->Type)
5326 + ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
5329 case ACPI_HEST_TYPE_IA32_CHECK:
5331 Index: acpica-unix-20209326/source/common/dmtbdump2.c
5332 ===================================================================
5333 --- acpica-unix-20209326.orig/source/common/dmtbdump2.c
5334 +++ acpica-unix-20209326/source/common/dmtbdump2.c
5335 @@ -75,16 +75,23 @@ AcpiDmDumpIort (
5336 ACPI_IORT_SMMU *IortSmmu = NULL;
5339 + UINT16 NodeLength;
5341 ACPI_DMTABLE_INFO *InfoTable;
5344 UINT32 MappingByteLength;
5347 + UINT32 MappingCount;
5348 + UINT32 CtxIntCount;
5349 + UINT32 PmuIntCount;
5354 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIort);
5355 + ACPI_MOVE_32_TO_32(&TableLen, &Table->Length);
5356 + Status = AcpiDmDumpTable (TableLen, 0, Table, 0, AcpiDmTableInfoIort);
5357 if (ACPI_FAILURE (Status))
5360 @@ -95,18 +102,19 @@ AcpiDmDumpIort (
5362 /* Dump the OptionalPadding (optional) */
5364 - if (Iort->NodeOffset > Offset)
5365 + ACPI_MOVE_32_TO_32(&NodeOffset, &Iort->NodeOffset);
5366 + if (NodeOffset > Offset)
5368 - Status = AcpiDmDumpTable (Table->Length, Offset, Table,
5369 - Iort->NodeOffset - Offset, AcpiDmTableInfoIortPad);
5370 + Status = AcpiDmDumpTable (TableLen, Offset, Table,
5371 + NodeOffset - Offset, AcpiDmTableInfoIortPad);
5372 if (ACPI_FAILURE (Status))
5378 - Offset = Iort->NodeOffset;
5379 - while (Offset < Table->Length)
5380 + ACPI_MOVE_32_TO_32(&Offset, &Iort->NodeOffset);
5381 + while (Offset < TableLen)
5383 /* Common subtable header */
5385 @@ -142,7 +150,8 @@ AcpiDmDumpIort (
5386 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
5388 InfoTable = AcpiDmTableInfoIort2;
5389 - Length = IortNode->Length - NodeOffset;
5390 + ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5391 + Length = NodeLength - NodeOffset;
5394 case ACPI_IORT_NODE_SMMU:
5395 @@ -155,7 +164,8 @@ AcpiDmDumpIort (
5396 case ACPI_IORT_NODE_SMMU_V3:
5398 InfoTable = AcpiDmTableInfoIort4;
5399 - Length = IortNode->Length - NodeOffset;
5400 + ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5401 + Length = NodeLength - NodeOffset;
5404 case ACPI_IORT_NODE_PMCG:
5405 @@ -171,7 +181,8 @@ AcpiDmDumpIort (
5407 /* Attempt to continue */
5409 - if (!IortNode->Length)
5410 + ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5413 AcpiOsPrintf ("Invalid zero length IORT node\n");
5415 @@ -182,7 +193,7 @@ AcpiDmDumpIort (
5416 /* Dump the node subtable header */
5418 AcpiOsPrintf ("\n");
5419 - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
5420 + Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
5421 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
5423 if (ACPI_FAILURE (Status))
5424 @@ -202,9 +213,10 @@ AcpiDmDumpIort (
5428 - for (i = 0; i < IortItsGroup->ItsCount; i++)
5429 + ACPI_MOVE_32_TO_32(&ItsCount, &IortItsGroup->ItsCount);
5430 + for (i = 0; i < ItsCount; i++)
5432 - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
5433 + Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
5434 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
5435 4, AcpiDmTableInfoIort0a);
5436 if (ACPI_FAILURE (Status))
5437 @@ -221,12 +233,13 @@ AcpiDmDumpIort (
5439 /* Dump the Padding (optional) */
5441 - if (IortNode->Length > NodeOffset)
5442 + ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5443 + if (NodeLength > NodeOffset)
5446 IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING);
5447 - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
5448 - Table, IortNode->Length - NodeOffset - MappingByteLength,
5449 + Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
5450 + Table, NodeLength - NodeOffset - MappingByteLength,
5451 AcpiDmTableInfoIort1a);
5452 if (ACPI_FAILURE (Status))
5454 @@ -244,8 +257,8 @@ AcpiDmDumpIort (
5457 Length = 2 * sizeof (UINT64);
5458 - NodeOffset = IortSmmu->GlobalInterruptOffset;
5459 - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
5460 + ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->GlobalInterruptOffset);
5461 + Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
5462 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
5463 Length, AcpiDmTableInfoIort3a);
5464 if (ACPI_FAILURE (Status))
5465 @@ -253,10 +266,11 @@ AcpiDmDumpIort (
5469 - NodeOffset = IortSmmu->ContextInterruptOffset;
5470 - for (i = 0; i < IortSmmu->ContextInterruptCount; i++)
5471 + ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->ContextInterruptOffset);
5472 + ACPI_MOVE_32_TO_32(&CtxIntCount, &IortSmmu->ContextInterruptCount);
5473 + for (i = 0; i < CtxIntCount; i++)
5475 - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
5476 + Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
5477 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
5478 8, AcpiDmTableInfoIort3b);
5479 if (ACPI_FAILURE (Status))
5480 @@ -267,10 +281,11 @@ AcpiDmDumpIort (
5484 - NodeOffset = IortSmmu->PmuInterruptOffset;
5485 - for (i = 0; i < IortSmmu->PmuInterruptCount; i++)
5486 + ACPI_MOVE_32_TO_32(&NodeOffset, &IortSmmu->PmuInterruptOffset);
5487 + ACPI_MOVE_32_TO_32(&PmuIntCount, &IortSmmu->PmuInterruptCount);
5488 + for (i = 0; i < PmuIntCount; i++)
5490 - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
5491 + Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
5492 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
5493 8, AcpiDmTableInfoIort3c);
5494 if (ACPI_FAILURE (Status))
5495 @@ -290,12 +305,13 @@ AcpiDmDumpIort (
5497 /* Dump the ID mappings */
5499 - NodeOffset = IortNode->MappingOffset;
5500 - for (i = 0; i < IortNode->MappingCount; i++)
5501 + ACPI_MOVE_32_TO_32(&NodeOffset, &IortNode->MappingOffset);
5502 + ACPI_MOVE_32_TO_32(&MappingCount, &IortNode->MappingCount);
5503 + for (i = 0; i < MappingCount; i++)
5505 AcpiOsPrintf ("\n");
5506 Length = sizeof (ACPI_IORT_ID_MAPPING);
5507 - Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset,
5508 + Status = AcpiDmDumpTable (TableLen, Offset + NodeOffset,
5509 ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset),
5510 Length, AcpiDmTableInfoIortMap);
5511 if (ACPI_FAILURE (Status))
5512 @@ -309,7 +325,8 @@ AcpiDmDumpIort (
5514 /* Point to next node subtable */
5516 - Offset += IortNode->Length;
5517 + ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5518 + Offset += NodeLength;
5522 @@ -340,11 +357,14 @@ AcpiDmDumpIvrs (
5523 ACPI_IVRS_DE_HEADER *DeviceEntry;
5524 ACPI_IVRS_HEADER *Subtable;
5525 ACPI_DMTABLE_INFO *InfoTable;
5532 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoIvrs);
5533 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5534 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoIvrs);
5535 if (ACPI_FAILURE (Status))
5538 @@ -353,13 +373,14 @@ AcpiDmDumpIvrs (
5541 Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
5542 - while (Offset < Table->Length)
5543 + while (Offset < Length)
5545 /* Common subtable header */
5547 AcpiOsPrintf ("\n");
5548 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
5549 - Subtable->Length, AcpiDmTableInfoIvrsHdr);
5550 + ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
5551 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
5552 + SubLength, AcpiDmTableInfoIvrsHdr);
5553 if (ACPI_FAILURE (Status))
5556 @@ -391,7 +412,7 @@ AcpiDmDumpIvrs (
5558 /* Attempt to continue */
5560 - if (!Subtable->Length)
5563 AcpiOsPrintf ("Invalid zero length subtable\n");
5565 @@ -402,8 +423,8 @@ AcpiDmDumpIvrs (
5566 /* Dump the subtable */
5568 AcpiOsPrintf ("\n");
5569 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
5570 - Subtable->Length, InfoTable);
5571 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
5572 + SubLength, InfoTable);
5573 if (ACPI_FAILURE (Status))
5576 @@ -427,7 +448,7 @@ AcpiDmDumpIvrs (
5577 sizeof (ACPI_IVRS_HARDWARE2));
5580 - while (EntryOffset < (Offset + Subtable->Length))
5581 + while (EntryOffset < (Offset + SubLength))
5583 AcpiOsPrintf ("\n");
5585 @@ -489,7 +510,7 @@ AcpiDmDumpIvrs (
5587 /* Dump the Device Entry */
5589 - Status = AcpiDmDumpTable (Table->Length, EntryOffset,
5590 + Status = AcpiDmDumpTable (Length, EntryOffset,
5591 DeviceEntry, EntryLength, InfoTable);
5592 if (ACPI_FAILURE (Status))
5594 @@ -505,8 +526,8 @@ AcpiDmDumpIvrs (
5596 /* Point to next subtable */
5598 - Offset += Subtable->Length;
5599 - Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length);
5600 + Offset += SubLength;
5601 + Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, SubLength);
5605 @@ -532,7 +553,7 @@ AcpiDmDumpLpit (
5608 ACPI_LPIT_HEADER *Subtable;
5609 - UINT32 Length = Table->Length;
5611 UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
5612 ACPI_DMTABLE_INFO *InfoTable;
5613 UINT32 SubtableLength;
5614 @@ -540,8 +561,9 @@ AcpiDmDumpLpit (
5618 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5619 Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset);
5620 - while (Offset < Table->Length)
5621 + while (Offset < Length)
5623 /* Common subtable header */
5625 @@ -605,13 +627,14 @@ AcpiDmDumpMadt (
5628 ACPI_SUBTABLE_HEADER *Subtable;
5629 - UINT32 Length = Table->Length;
5631 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
5632 ACPI_DMTABLE_INFO *InfoTable;
5637 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5638 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
5639 if (ACPI_FAILURE (Status))
5641 @@ -621,7 +644,7 @@ AcpiDmDumpMadt (
5644 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
5645 - while (Offset < Table->Length)
5646 + while (Offset < Length)
5648 /* Common subtable header */
5650 @@ -767,11 +790,13 @@ AcpiDmDumpMcfg (
5652 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
5653 ACPI_MCFG_ALLOCATION *Subtable;
5659 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
5660 + ACPI_MOVE_32_TO_32(&Len, &Table->Length);
5661 + Status = AcpiDmDumpTable (Len, 0, Table, 0, AcpiDmTableInfoMcfg);
5662 if (ACPI_FAILURE (Status))
5665 @@ -780,17 +805,17 @@ AcpiDmDumpMcfg (
5668 Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
5669 - while (Offset < Table->Length)
5670 + while (Offset < Len)
5672 - if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
5673 + if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Len)
5675 AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n",
5676 - (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
5677 + (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Len));
5681 AcpiOsPrintf ("\n");
5682 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
5683 + Status = AcpiDmDumpTable (Len, Offset, Subtable,
5684 sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0);
5685 if (ACPI_FAILURE (Status))
5687 @@ -824,6 +849,7 @@ AcpiDmDumpMpst (
5690 UINT32 Offset = sizeof (ACPI_TABLE_MPST);
5691 + ACPI_TABLE_MPST *Mpst;
5692 ACPI_MPST_POWER_NODE *Subtable0;
5693 ACPI_MPST_POWER_STATE *Subtable0A;
5694 ACPI_MPST_COMPONENT *Subtable0B;
5695 @@ -832,11 +858,13 @@ AcpiDmDumpMpst (
5696 UINT16 SubtableCount;
5697 UINT32 PowerStateCount;
5698 UINT32 ComponentCount;
5704 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMpst);
5705 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5706 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMpst);
5707 if (ACPI_FAILURE (Status))
5710 @@ -844,13 +872,14 @@ AcpiDmDumpMpst (
5712 /* Subtable: Memory Power Node(s) */
5714 - SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount;
5715 + Mpst = ACPI_CAST_PTR (ACPI_TABLE_MPST, Table);
5716 + ACPI_MOVE_16_TO_16(&SubtableCount, &Mpst->PowerNodeCount);
5717 Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset);
5719 - while ((Offset < Table->Length) && SubtableCount)
5720 + while ((Offset < Length) && SubtableCount)
5722 AcpiOsPrintf ("\n");
5723 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0,
5724 + Status = AcpiDmDumpTable (Length, Offset, Subtable0,
5725 sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0);
5726 if (ACPI_FAILURE (Status))
5728 @@ -859,8 +888,8 @@ AcpiDmDumpMpst (
5730 /* Extract the sub-subtable counts */
5732 - PowerStateCount = Subtable0->NumPowerStates;
5733 - ComponentCount = Subtable0->NumPhysicalComponents;
5734 + ACPI_MOVE_32_TO_32(&PowerStateCount, &Subtable0->NumPowerStates);
5735 + ACPI_MOVE_32_TO_32(&ComponentCount, &Subtable0->NumPhysicalComponents);
5736 Offset += sizeof (ACPI_MPST_POWER_NODE);
5738 /* Sub-subtables - Memory Power State Structure(s) */
5739 @@ -871,7 +900,7 @@ AcpiDmDumpMpst (
5740 while (PowerStateCount)
5742 AcpiOsPrintf ("\n");
5743 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A,
5744 + Status = AcpiDmDumpTable (Length, Offset, Subtable0A,
5745 sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A);
5746 if (ACPI_FAILURE (Status))
5748 @@ -881,7 +910,7 @@ AcpiDmDumpMpst (
5751 Offset += sizeof (ACPI_MPST_POWER_STATE);
5755 /* Sub-subtables - Physical Component ID Structure(s) */
5757 @@ -894,7 +923,7 @@ AcpiDmDumpMpst (
5759 while (ComponentCount)
5761 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
5762 + Status = AcpiDmDumpTable (Length, Offset, Subtable0B,
5763 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
5764 if (ACPI_FAILURE (Status))
5766 @@ -909,17 +938,19 @@ AcpiDmDumpMpst (
5767 /* Point to next Memory Power Node subtable */
5770 + ACPI_MOVE_32_TO_32(&PowerStateCount, &Subtable0->NumPowerStates);
5771 + ACPI_MOVE_32_TO_32(&ComponentCount, &Subtable0->NumPhysicalComponents);
5772 Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0,
5773 sizeof (ACPI_MPST_POWER_NODE) +
5774 - (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) +
5775 - (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents));
5776 + (sizeof (ACPI_MPST_POWER_STATE) * PowerStateCount) +
5777 + (sizeof (ACPI_MPST_COMPONENT) * ComponentCount));
5780 /* Subtable: Count of Memory Power State Characteristic structures */
5782 AcpiOsPrintf ("\n");
5783 Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0);
5784 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1,
5785 + Status = AcpiDmDumpTable (Length, Offset, Subtable1,
5786 sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1);
5787 if (ACPI_FAILURE (Status))
5789 @@ -934,10 +965,10 @@ AcpiDmDumpMpst (
5790 Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
5791 sizeof (ACPI_MPST_DATA_HDR));
5793 - while ((Offset < Table->Length) && SubtableCount)
5794 + while ((Offset < Length) && SubtableCount)
5796 AcpiOsPrintf ("\n");
5797 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2,
5798 + Status = AcpiDmDumpTable (Length, Offset, Subtable2,
5799 sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2);
5800 if (ACPI_FAILURE (Status))
5802 @@ -970,11 +1001,13 @@ AcpiDmDumpMsct (
5804 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
5805 ACPI_MSCT_PROXIMITY *Subtable;
5811 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMsct);
5812 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5813 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMsct);
5814 if (ACPI_FAILURE (Status))
5817 @@ -983,12 +1016,12 @@ AcpiDmDumpMsct (
5820 Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
5821 - while (Offset < Table->Length)
5822 + while (Offset < Length)
5824 /* Common subtable header */
5826 AcpiOsPrintf ("\n");
5827 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
5828 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
5829 sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0);
5830 if (ACPI_FAILURE (Status))
5832 @@ -1023,11 +1056,13 @@ AcpiDmDumpMtmr (
5834 UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
5835 ACPI_MTMR_ENTRY *Subtable;
5841 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMtmr);
5842 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5843 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMtmr);
5844 if (ACPI_FAILURE (Status))
5847 @@ -1036,12 +1071,12 @@ AcpiDmDumpMtmr (
5850 Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
5851 - while (Offset < Table->Length)
5852 + while (Offset < Length)
5854 /* Common subtable header */
5856 AcpiOsPrintf ("\n");
5857 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
5858 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
5859 sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0);
5860 if (ACPI_FAILURE (Status))
5862 @@ -1083,11 +1118,17 @@ AcpiDmDumpNfit (
5863 ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
5864 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
5866 + UINT32 TableLength;
5875 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoNfit);
5876 + ACPI_MOVE_32_TO_32(&TableLength, &Table->Length);
5877 + Status = AcpiDmDumpTable (TableLength, 0, Table, 0, AcpiDmTableInfoNfit);
5878 if (ACPI_FAILURE (Status))
5881 @@ -1096,19 +1137,21 @@ AcpiDmDumpNfit (
5884 Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
5885 - while (Offset < Table->Length)
5886 + while (Offset < TableLength)
5888 /* NFIT subtable header */
5890 AcpiOsPrintf ("\n");
5891 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
5892 - Subtable->Length, AcpiDmTableInfoNfitHdr);
5893 + ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
5894 + Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
5895 + SubLength, AcpiDmTableInfoNfitHdr);
5896 if (ACPI_FAILURE (Status))
5901 - switch (Subtable->Type)
5902 + ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
5905 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
5907 @@ -1163,7 +1206,7 @@ AcpiDmDumpNfit (
5909 /* Attempt to continue */
5911 - if (!Subtable->Length)
5914 AcpiOsPrintf ("Invalid zero length subtable\n");
5916 @@ -1172,8 +1215,8 @@ AcpiDmDumpNfit (
5919 AcpiOsPrintf ("\n");
5920 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
5921 - Subtable->Length, InfoTable);
5922 + Status = AcpiDmDumpTable (TableLength, Offset, Subtable,
5923 + SubLength, InfoTable);
5924 if (ACPI_FAILURE (Status))
5927 @@ -1181,14 +1224,15 @@ AcpiDmDumpNfit (
5929 /* Per-subtable variable-length fields */
5931 - switch (Subtable->Type)
5934 case ACPI_NFIT_TYPE_INTERLEAVE:
5936 Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable);
5937 - for (i = 0; i < Interleave->LineCount; i++)
5938 + ACPI_MOVE_32_TO_32(&Count, &Interleave->LineCount);
5939 + for (i = 0; i < Count; i++)
5941 - Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
5942 + Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
5943 &Interleave->LineOffset[i],
5944 sizeof (UINT32), AcpiDmTableInfoNfit2a);
5945 if (ACPI_FAILURE (Status))
5946 @@ -1202,12 +1246,11 @@ AcpiDmDumpNfit (
5948 case ACPI_NFIT_TYPE_SMBIOS:
5950 - Length = Subtable->Length -
5951 - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
5952 + Length = SubLength - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
5956 - Status = AcpiDmDumpTable (Table->Length,
5957 + Status = AcpiDmDumpTable (TableLength,
5958 sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
5960 Length, AcpiDmTableInfoNfit3a);
5961 @@ -1222,9 +1265,10 @@ AcpiDmDumpNfit (
5962 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
5964 Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable);
5965 - for (i = 0; i < Hint->HintCount; i++)
5966 + ACPI_MOVE_16_TO_16(&Count16, &Hint->HintCount);
5967 + for (i = 0; i < Count16; i++)
5969 - Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset,
5970 + Status = AcpiDmDumpTable (TableLength, Offset + FieldOffset,
5971 &Hint->HintAddress[i],
5972 sizeof (UINT64), AcpiDmTableInfoNfit6a);
5973 if (ACPI_FAILURE (Status))
5974 @@ -1243,8 +1287,8 @@ AcpiDmDumpNfit (
5976 /* Point to next subtable */
5978 - Offset += Subtable->Length;
5979 - Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length);
5980 + Offset += SubLength;
5981 + Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, SubLength);
5985 @@ -1269,12 +1313,13 @@ AcpiDmDumpPcct (
5987 ACPI_PCCT_SUBSPACE *Subtable;
5988 ACPI_DMTABLE_INFO *InfoTable;
5989 - UINT32 Length = Table->Length;
5991 UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
5996 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5997 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
5998 if (ACPI_FAILURE (Status))
6000 @@ -1284,7 +1329,7 @@ AcpiDmDumpPcct (
6003 Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
6004 - while (Offset < Table->Length)
6005 + while (Offset < Length)
6007 /* Common subtable header */
6009 @@ -1424,16 +1469,21 @@ AcpiDmDumpPmtt (
6010 ACPI_PMTT_HEADER *MemSubtable;
6011 ACPI_PMTT_HEADER *DimmSubtable;
6012 ACPI_PMTT_DOMAIN *DomainArray;
6013 - UINT32 Length = Table->Length;
6015 UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
6018 UINT32 DomainOffset;
6019 - UINT32 DomainCount;
6020 + UINT16 DomainCount;
6024 + UINT16 DimmLength;
6029 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6030 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
6031 if (ACPI_FAILURE (Status))
6033 @@ -1443,13 +1493,14 @@ AcpiDmDumpPmtt (
6036 Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
6037 - while (Offset < Table->Length)
6038 + while (Offset < Length)
6040 /* Common subtable header */
6042 AcpiOsPrintf ("\n");
6043 + ACPI_MOVE_16_TO_16(&SubLength, &Subtable->Length);
6044 Status = AcpiDmDumpTable (Length, Offset, Subtable,
6045 - Subtable->Length, AcpiDmTableInfoPmttHdr);
6046 + SubLength, AcpiDmTableInfoPmttHdr);
6047 if (ACPI_FAILURE (Status))
6050 @@ -1468,7 +1519,7 @@ AcpiDmDumpPmtt (
6051 /* Dump the fixed-length portion of the subtable */
6053 Status = AcpiDmDumpTable (Length, Offset, Subtable,
6054 - Subtable->Length, AcpiDmTableInfoPmtt0);
6055 + SubLength, AcpiDmTableInfoPmtt0);
6056 if (ACPI_FAILURE (Status))
6059 @@ -1480,15 +1531,16 @@ AcpiDmDumpPmtt (
6060 MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
6061 sizeof (ACPI_PMTT_SOCKET));
6063 - while (((Offset + MemOffset) < Table->Length) &&
6064 - (MemOffset < Subtable->Length))
6065 + while (((Offset + MemOffset) < Length) &&
6066 + (MemOffset < SubLength))
6068 /* Common subtable header */
6070 AcpiOsPrintf ("\n");
6071 + ACPI_MOVE_16_TO_16(&MemLength, &MemSubtable->Length);
6072 Status = AcpiDmDumpTable (Length,
6073 Offset + MemOffset, MemSubtable,
6074 - MemSubtable->Length, AcpiDmTableInfoPmttHdr);
6075 + MemLength, AcpiDmTableInfoPmttHdr);
6076 if (ACPI_FAILURE (Status))
6079 @@ -1508,7 +1560,7 @@ AcpiDmDumpPmtt (
6081 Status = AcpiDmDumpTable (Length,
6082 Offset + MemOffset, MemSubtable,
6083 - MemSubtable->Length, AcpiDmTableInfoPmtt1);
6084 + MemLength, AcpiDmTableInfoPmtt1);
6085 if (ACPI_FAILURE (Status))
6088 @@ -1516,13 +1568,14 @@ AcpiDmDumpPmtt (
6090 /* Walk the variable count of proximity domains */
6092 - DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
6093 + Tmp16 = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount;
6094 + ACPI_MOVE_16_TO_16(&DomainCount, &Tmp16);
6095 DomainOffset = sizeof (ACPI_PMTT_CONTROLLER);
6096 DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable,
6097 sizeof (ACPI_PMTT_CONTROLLER));
6099 - while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
6100 - ((MemOffset + DomainOffset) < Subtable->Length) &&
6101 + while (((Offset + MemOffset + DomainOffset) < Length) &&
6102 + ((MemOffset + DomainOffset) < SubLength) &&
6105 Status = AcpiDmDumpTable (Length,
6106 @@ -1550,15 +1603,16 @@ AcpiDmDumpPmtt (
6107 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
6110 - while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
6111 - (DimmOffset < MemSubtable->Length))
6112 + while (((Offset + MemOffset + DimmOffset) < Length) &&
6113 + (DimmOffset < MemLength))
6115 /* Common subtable header */
6117 AcpiOsPrintf ("\n");
6118 + ACPI_MOVE_16_TO_16(&DimmLength, &DimmSubtable->Length);
6119 Status = AcpiDmDumpTable (Length,
6120 Offset + MemOffset + DimmOffset, DimmSubtable,
6121 - DimmSubtable->Length, AcpiDmTableInfoPmttHdr);
6122 + DimmLength, AcpiDmTableInfoPmttHdr);
6123 if (ACPI_FAILURE (Status))
6126 @@ -1578,7 +1632,7 @@ AcpiDmDumpPmtt (
6128 Status = AcpiDmDumpTable (Length,
6129 Offset + MemOffset + DimmOffset, DimmSubtable,
6130 - DimmSubtable->Length, AcpiDmTableInfoPmtt2);
6131 + DimmLength, AcpiDmTableInfoPmtt2);
6132 if (ACPI_FAILURE (Status))
6135 @@ -1586,23 +1640,22 @@ AcpiDmDumpPmtt (
6137 /* Point to next DIMM subtable */
6139 - DimmOffset += DimmSubtable->Length;
6140 + DimmOffset += DimmLength;
6141 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
6142 - DimmSubtable, DimmSubtable->Length);
6143 + DimmSubtable, DimmLength);
6146 /* Point to next Controller subtable */
6148 - MemOffset += MemSubtable->Length;
6149 + MemOffset += MemLength;
6150 MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
6151 - MemSubtable, MemSubtable->Length);
6152 + MemSubtable, MemLength);
6155 /* Point to next Socket subtable */
6157 - Offset += Subtable->Length;
6158 - Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
6159 - Subtable, Subtable->Length);
6160 + Offset += SubLength;
6161 + Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, SubLength);
6165 @@ -1763,6 +1816,8 @@ AcpiDmDumpS3pt (
6166 ACPI_FPDT_HEADER *Subtable;
6167 ACPI_DMTABLE_INFO *InfoTable;
6168 ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables);
6174 @@ -1773,20 +1828,22 @@ AcpiDmDumpS3pt (
6178 + ACPI_MOVE_32_TO_32(&Length, &S3ptTable->Length);
6179 Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset);
6180 - while (Offset < S3ptTable->Length)
6181 + while (Offset < Length)
6183 /* Common subtable header */
6185 AcpiOsPrintf ("\n");
6186 - Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
6187 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6188 Subtable->Length, AcpiDmTableInfoS3ptHdr);
6189 if (ACPI_FAILURE (Status))
6194 - switch (Subtable->Type)
6195 + ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
6198 case ACPI_S3PT_TYPE_RESUME:
6200 @@ -1801,7 +1858,7 @@ AcpiDmDumpS3pt (
6203 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
6207 /* Attempt to continue */
6209 @@ -1814,7 +1871,7 @@ AcpiDmDumpS3pt (
6212 AcpiOsPrintf ("\n");
6213 - Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
6214 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6215 Subtable->Length, InfoTable);
6216 if (ACPI_FAILURE (Status))
6218 Index: acpica-unix-20191213/source/common/dmtbdump3.c
6219 ===================================================================
6220 --- acpica-unix-20191213.orig/source/common/dmtbdump3.c
6221 +++ acpica-unix-20191213/source/common/dmtbdump3.c
6222 @@ -68,9 +68,11 @@ void
6224 ACPI_TABLE_HEADER *Table)
6228 - (void) AcpiDmDumpTable (Table->Length, sizeof (ACPI_TABLE_HEADER), Table,
6229 - Table->Length - sizeof (*Table), AcpiDmTableInfoSlic);
6230 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6231 + (void) AcpiDmDumpTable (Length, sizeof (ACPI_TABLE_HEADER), Table,
6232 + Length - sizeof (*Table), AcpiDmTableInfoSlic);
6236 @@ -93,14 +95,17 @@ AcpiDmDumpSlit (
6240 - UINT32 Localities;
6241 + UINT64 Localities;
6250 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
6251 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6252 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSlit);
6253 if (ACPI_FAILURE (Status))
6256 @@ -108,7 +113,8 @@ AcpiDmDumpSlit (
6258 /* Display the Locality NxN Matrix */
6260 - Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
6261 + Tmp64 = (UINT64) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
6262 + ACPI_MOVE_64_TO_64(&Localities, &Tmp64);
6263 Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
6264 Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
6266 @@ -121,7 +127,7 @@ AcpiDmDumpSlit (
6268 /* Check for beyond EOT */
6270 - if (Offset >= Table->Length)
6271 + if (Offset >= Length)
6274 "\n**** Not enough room in table for all localities\n");
6275 @@ -173,11 +179,13 @@ AcpiDmDumpSrat (
6276 UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
6277 ACPI_SUBTABLE_HEADER *Subtable;
6278 ACPI_DMTABLE_INFO *InfoTable;
6284 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
6285 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6286 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSrat);
6287 if (ACPI_FAILURE (Status))
6290 @@ -186,12 +194,12 @@ AcpiDmDumpSrat (
6293 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
6294 - while (Offset < Table->Length)
6295 + while (Offset < Length)
6297 /* Common subtable header */
6299 AcpiOsPrintf ("\n");
6300 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6301 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6302 Subtable->Length, AcpiDmTableInfoSratHdr);
6303 if (ACPI_FAILURE (Status))
6305 @@ -245,7 +253,7 @@ AcpiDmDumpSrat (
6308 AcpiOsPrintf ("\n");
6309 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6310 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6311 Subtable->Length, InfoTable);
6312 if (ACPI_FAILURE (Status))
6314 @@ -282,13 +290,14 @@ AcpiDmDumpStao (
6318 - UINT32 Length = Table->Length;
6320 UINT32 StringLength;
6321 UINT32 Offset = sizeof (ACPI_TABLE_STAO);
6326 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6327 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
6328 if (ACPI_FAILURE (Status))
6330 @@ -297,7 +306,7 @@ AcpiDmDumpStao (
6332 /* The rest of the table consists of Namepath strings */
6334 - while (Offset < Table->Length)
6335 + while (Offset < Length)
6337 Namepath = ACPI_ADD_PTR (char, Table, Offset);
6338 StringLength = strlen (Namepath) + 1;
6339 @@ -339,11 +348,14 @@ AcpiDmDumpTcpa (
6340 ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR (
6341 ACPI_TABLE_TCPA_HDR, Table, Offset);
6344 + UINT16 PlatformClass;
6349 - Status = AcpiDmDumpTable (Table->Length, 0, Table,
6350 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6351 + Status = AcpiDmDumpTable (Length, 0, Table,
6352 0, AcpiDmTableInfoTcpaHdr);
6353 if (ACPI_FAILURE (Status))
6355 @@ -354,18 +366,19 @@ AcpiDmDumpTcpa (
6356 * Examine the PlatformClass field to determine the table type.
6357 * Either a client or server table. Only one.
6359 - switch (CommonHeader->PlatformClass)
6360 + ACPI_MOVE_16_TO_16(&PlatformClass, &CommonHeader->PlatformClass);
6361 + switch (PlatformClass)
6363 case ACPI_TCPA_CLIENT_TABLE:
6365 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6366 - Table->Length - Offset, AcpiDmTableInfoTcpaClient);
6367 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6368 + Length - Offset, AcpiDmTableInfoTcpaClient);
6371 case ACPI_TCPA_SERVER_TABLE:
6373 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6374 - Table->Length - Offset, AcpiDmTableInfoTcpaServer);
6375 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6376 + Length - Offset, AcpiDmTableInfoTcpaServer);
6380 @@ -512,11 +525,13 @@ AcpiDmDumpVrtc (
6382 UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
6383 ACPI_VRTC_ENTRY *Subtable;
6389 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoVrtc);
6390 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6391 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoVrtc);
6392 if (ACPI_FAILURE (Status))
6395 @@ -525,12 +540,12 @@ AcpiDmDumpVrtc (
6398 Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
6399 - while (Offset < Table->Length)
6400 + while (Offset < Length)
6402 /* Common subtable header */
6404 AcpiOsPrintf ("\n");
6405 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6406 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6407 sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0);
6408 if (ACPI_FAILURE (Status))
6410 @@ -565,11 +580,13 @@ AcpiDmDumpWdat (
6412 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
6413 ACPI_WDAT_ENTRY *Subtable;
6419 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoWdat);
6420 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6421 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWdat);
6422 if (ACPI_FAILURE (Status))
6425 @@ -578,12 +595,12 @@ AcpiDmDumpWdat (
6428 Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
6429 - while (Offset < Table->Length)
6430 + while (Offset < Length)
6432 /* Common subtable header */
6434 AcpiOsPrintf ("\n");
6435 - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6436 + Status = AcpiDmDumpTable (Length, Offset, Subtable,
6437 sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0);
6438 if (ACPI_FAILURE (Status))
6440 @@ -618,12 +635,13 @@ AcpiDmDumpWpbt (
6443 ACPI_TABLE_WPBT *Subtable;
6444 - UINT32 Length = Table->Length;
6446 UINT16 ArgumentsLength;
6449 /* Dump the main table */
6451 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6452 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
6453 if (ACPI_FAILURE (Status))
6455 @@ -633,10 +651,10 @@ AcpiDmDumpWpbt (
6456 /* Extract the arguments buffer length from the main table */
6458 Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
6459 - ArgumentsLength = Subtable->ArgumentsLength;
6460 + ACPI_MOVE_16_TO_16(&ArgumentsLength, &Subtable->ArgumentsLength);
6462 /* Dump the arguments buffer */
6464 - (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
6465 + (void) AcpiDmDumpTable (Length, 0, Table, ArgumentsLength,
6466 AcpiDmTableInfoWpbt0);
6468 Index: acpica-unix-20191213/source/common/dmtbdump.c
6469 ===================================================================
6470 --- acpica-unix-20191213.orig/source/common/dmtbdump.c
6471 +++ acpica-unix-20191213/source/common/dmtbdump.c
6472 @@ -277,6 +277,8 @@ AcpiDmDumpRsdt (
6480 /* Point to start of table pointer array */
6481 @@ -286,12 +288,14 @@ AcpiDmDumpRsdt (
6483 /* RSDT uses 32-bit pointers */
6485 - Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
6486 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6487 + Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
6489 for (i = 0; i < Entries; i++)
6491 AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
6492 - AcpiOsPrintf ("%8.8X\n", Array[i]);
6493 + ACPI_MOVE_32_TO_32(&Address, &Array[i]);
6494 + AcpiOsPrintf ("%8.8X\n", Address);
6495 Offset += sizeof (UINT32);
6498 @@ -317,6 +321,8 @@ AcpiDmDumpXsdt (
6506 /* Point to start of table pointer array */
6507 @@ -326,12 +332,14 @@ AcpiDmDumpXsdt (
6509 /* XSDT uses 64-bit pointers */
6511 - Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
6512 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6513 + Entries = (Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
6515 for (i = 0; i < Entries; i++)
6517 AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
6518 - AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
6519 + ACPI_MOVE_64_TO_64(&Address, &Array[i]);
6520 + AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Address));
6521 Offset += sizeof (UINT64);
6524 @@ -358,12 +366,12 @@ AcpiDmDumpFadt (
6525 ACPI_TABLE_HEADER *Table)
6531 /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
6533 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6534 - AcpiDmTableInfoFadt1);
6535 + ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6536 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt1);
6537 if (ACPI_FAILURE (Status))
6540 @@ -371,11 +379,9 @@ AcpiDmDumpFadt (
6542 /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
6544 - if ((Table->Length > ACPI_FADT_V1_SIZE) &&
6545 - (Table->Length <= ACPI_FADT_V2_SIZE))
6546 + if ((Length > ACPI_FADT_V1_SIZE) && (Length <= ACPI_FADT_V2_SIZE))
6548 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6549 - AcpiDmTableInfoFadt2);
6550 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt2);
6551 if (ACPI_FAILURE (Status))
6554 @@ -384,10 +390,9 @@ AcpiDmDumpFadt (
6556 /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
6558 - else if (Table->Length > ACPI_FADT_V2_SIZE)
6559 + else if (Length > ACPI_FADT_V2_SIZE)
6561 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6562 - AcpiDmTableInfoFadt3);
6563 + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt3);
6564 if (ACPI_FAILURE (Status))
6567 @@ -395,9 +400,9 @@ AcpiDmDumpFadt (
6569 /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
6571 - if (Table->Length > ACPI_FADT_V3_SIZE)
6572 + if (Length > ACPI_FADT_V3_SIZE)
6574 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6575 + Status = AcpiDmDumpTable (Length, 0, Table, 0,
6576 AcpiDmTableInfoFadt5);
6577 if (ACPI_FAILURE (Status))
6579 @@ -407,9 +412,9 @@ AcpiDmDumpFadt (
6581 /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
6583 - if (Table->Length > ACPI_FADT_V3_SIZE)
6584 + if (Length > ACPI_FADT_V3_SIZE)
6586 - Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6587 + Status = AcpiDmDumpTable (Length, 0, Table, 0,
6588 AcpiDmTableInfoFadt6);
6589 if (ACPI_FAILURE (Status))
6591 @@ -420,11 +425,11 @@ AcpiDmDumpFadt (
6593 /* Validate various fields in the FADT, including length */
6595 - AcpiTbCreateLocalFadt (Table, Table->Length);
6596 + AcpiTbCreateLocalFadt (Table, Length);
6598 /* Validate FADT length against the revision */
6600 - AcpiDmValidateFadtLength (Table->Revision, Table->Length);
6601 + AcpiDmValidateFadtLength (Table->Revision, Length);
6605 @@ -450,6 +455,7 @@ AcpiDmValidateFadtLength (
6608 UINT32 ExpectedLength;
6613 @@ -485,7 +491,8 @@ AcpiDmValidateFadtLength (
6617 - if (Length == ExpectedLength)
6618 + ACPI_MOVE_32_TO_32(&Tmp32, &Length);
6619 + if (Tmp32 == ExpectedLength)
6623 @@ -493,5 +500,5 @@ AcpiDmValidateFadtLength (
6625 "\n// ACPI Warning: FADT revision %X does not match length: "
6626 "found %X expected %X\n",
6627 - Revision, Length, ExpectedLength);
6628 + Revision, Tmp32, ExpectedLength);