]> git.pld-linux.org Git - packages/acpica.git/blame - debian-big_endian.patch
- updated to 20200430
[packages/acpica.git] / debian-big_endian.patch
CommitLineData
25d7dd99 1Big-endian support
77760c90 2
25d7dd99
JB
3This is a combined patch that folds all of the past and present changes
4for big-endian support into a single patch, hopefully eliminating any sort
5of redundancy but also capturing all such changes in a single location.
6
7To date, this has been critical for the s390x architecture only.
8
9Signed-off-by: Al Stone <ahs3@redhat.com>
77760c90 10
70586bb3 11Index: acpica-unix-20209326/source/compiler/aslcodegen.c
77760c90 12===================================================================
70586bb3
JB
13--- acpica-unix-20209326.orig/source/compiler/aslcodegen.c
14+++ acpica-unix-20209326/source/compiler/aslcodegen.c
15@@ -237,16 +237,12 @@ CgWriteAmlOpcode (
f3dfbd7c
ER
16 ACPI_PARSE_OBJECT *Op)
17 {
18 UINT8 PkgLenFirstByte;
19- UINT32 i;
20- union {
21- UINT16 Opcode;
22- UINT8 OpcodeBytes[2];
23- } Aml;
24- union {
25- UINT32 Len;
26- UINT8 LenBytes[4];
27- } PkgLen;
28-
29+ UINT8 Byte;
30+ UINT16 Word;
31+ UINT32 DWord;
32+ UINT64 QWord;
33+ UINT16 AmlOpcode;
34+ UINT32 PkgLen;
35
36 /* We expect some DEFAULT_ARGs, just ignore them */
37
70586bb3 38@@ -279,51 +275,52 @@ CgWriteAmlOpcode (
f3dfbd7c
ER
39
40 /* Special opcodes for within a field definition */
41
42- Aml.Opcode = AML_FIELD_OFFSET_OP;
43+ AmlOpcode = AML_FIELD_OFFSET_OP;
44 break;
45
46 case AML_INT_ACCESSFIELD_OP:
47
48- Aml.Opcode = AML_FIELD_ACCESS_OP;
49+ AmlOpcode = AML_FIELD_ACCESS_OP;
50 break;
51
52 case AML_INT_CONNECTION_OP:
53
54- Aml.Opcode = AML_FIELD_CONNECTION_OP;
55+ AmlOpcode = AML_FIELD_CONNECTION_OP;
56 break;
57
58 default:
59
60- Aml.Opcode = Op->Asl.AmlOpcode;
61+ AmlOpcode = Op->Asl.AmlOpcode;
62 break;
63 }
64
65
66- switch (Aml.Opcode)
67+ switch (AmlOpcode)
68 {
69 case AML_PACKAGE_LENGTH:
70
71 /* Value is the length to be encoded (Used in field definitions) */
72
73- PkgLen.Len = (UINT32) Op->Asl.Value.Integer;
74+ PkgLen = (UINT32) Op->Asl.Value.Integer;
75 break;
76
77 default:
78
79 /* Check for two-byte opcode */
80
81- if (Aml.Opcode > 0x00FF)
82+ if (AmlOpcode > 0x00FF)
83 {
84 /* Write the high byte first */
85-
86- CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1);
87+ Byte = ACPI_HIBYTE(AmlOpcode);
88+ CgLocalWriteAmlData (Op, &Byte, 1);
89 }
90
91- CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1);
92+ Byte = ACPI_LOBYTE(AmlOpcode);
93+ CgLocalWriteAmlData (Op, &Byte, 1);
94
95 /* Subtreelength doesn't include length of package length bytes */
96
97- PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
98+ PkgLen = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes;
99 break;
100 }
101
70586bb3 102@@ -334,8 +331,8 @@ CgWriteAmlOpcode (
f3dfbd7c
ER
103 if (Op->Asl.AmlPkgLenBytes == 1)
104 {
105 /* Simplest case -- no bytes to follow, just write the count */
106-
107- CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
108+ Byte = ACPI_LOBYTE(PkgLen);
109+ CgLocalWriteAmlData (Op, &Byte, 1);
110 }
111 else if (Op->Asl.AmlPkgLenBytes != 0)
112 {
70586bb3 113@@ -345,7 +342,7 @@ CgWriteAmlOpcode (
f3dfbd7c
ER
114 */
115 PkgLenFirstByte = (UINT8)
116 (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
117- (PkgLen.LenBytes[0] & 0x0F));
118+ (PkgLen & 0x0F));
119
120 CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
121
70586bb3 122@@ -353,39 +350,47 @@ CgWriteAmlOpcode (
f3dfbd7c
ER
123 * Shift the length over by the 4 bits we just stuffed
124 * in the first byte
125 */
126- PkgLen.Len >>= 4;
127+ PkgLen >>= 4;
128
77760c90
JB
129 /*
130 * Now we can write the remaining bytes -
131 * either 1, 2, or 3 bytes
132 */
f3dfbd7c
ER
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)
137+ {
138+ Byte = ACPI_HIBYTE(PkgLen);
139+ CgLocalWriteAmlData (Op, &Byte, 1);
140+ }
141+ if (Op->Asl.AmlPkgLenBytes >= 4)
142 {
143- CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1);
144+ Byte = ACPI_LOBYTE(ACPI_HIWORD(PkgLen));
145+ CgLocalWriteAmlData (Op, &Byte, 1);
146 }
147 }
148 }
149
150- switch (Aml.Opcode)
151+ switch (AmlOpcode)
152 {
153 case AML_BYTE_OP:
154-
155- CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1);
156+ Byte = (UINT8) Op->Asl.Value.Integer;
157+ CgLocalWriteAmlData (Op, &Byte, 1);
158 break;
159
160 case AML_WORD_OP:
161-
162- CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2);
163+ ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer);
164+ CgLocalWriteAmlData (Op, &Word, 2);
165 break;
166
167 case AML_DWORD_OP:
168-
169- CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4);
170+ ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer);
171+ CgLocalWriteAmlData (Op, &DWord, 4);
172 break;
173
174 case AML_QWORD_OP:
175-
176- CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8);
177+ ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
178+ CgLocalWriteAmlData (Op, &QWord, 8);
179 break;
180
181 case AML_STRING_OP:
70586bb3 182@@ -421,6 +426,7 @@ CgWriteTableHeader (
f3dfbd7c
ER
183 ACPI_PARSE_OBJECT *Op)
184 {
185 ACPI_PARSE_OBJECT *Child;
77760c90
JB
186+ UINT32 DWord;
187 UINT32 CommentLength;
188 ACPI_COMMENT_NODE *Current;
f3dfbd7c 189
70586bb3 190@@ -478,7 +484,7 @@ CgWriteTableHeader (
f3dfbd7c
ER
191 /* OEM Revision */
192
193 Child = Child->Asl.Next;
25d7dd99
JB
194- AslGbl_TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer;
195+ ACPI_MOVE_64_TO_32(&AslGbl_TableHeader.OemRevision, &Child->Asl.Value.Integer);
f3dfbd7c
ER
196
197 /* Compiler ID */
198
70586bb3 199@@ -486,12 +492,13 @@ CgWriteTableHeader (
f3dfbd7c
ER
200
201 /* Compiler version */
202
25d7dd99 203- AslGbl_TableHeader.AslCompilerRevision = ACPI_CA_VERSION;
77760c90 204+ DWord = ACPI_CA_VERSION;
25d7dd99 205+ ACPI_MOVE_32_TO_32(&AslGbl_TableHeader.AslCompilerRevision, &DWord);
f3dfbd7c
ER
206
207 /* Table length. Checksum zero for now, will rewrite later */
208
25d7dd99 209- AslGbl_TableHeader.Length = sizeof (ACPI_TABLE_HEADER) +
77760c90
JB
210- Op->Asl.AmlSubtreeLength;
211+ DWord = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
25d7dd99 212+ ACPI_MOVE_32_TO_32(&AslGbl_TableHeader.Length, &DWord);
f3dfbd7c 213
77760c90
JB
214 /* Calculate the comment lengths for this definition block parseOp */
215
70586bb3 216@@ -625,7 +632,10 @@ CgWriteNode (
f3dfbd7c
ER
217 ACPI_PARSE_OBJECT *Op)
218 {
219 ASL_RESOURCE_NODE *Rnode;
220-
221+ UINT8 Byte;
222+ UINT16 Word;
223+ UINT32 DWord;
224+ UINT64 QWord;
225
77760c90 226 /* Write all comments here. */
25d7dd99 227
70586bb3 228@@ -649,13 +659,24 @@ CgWriteNode (
f3dfbd7c
ER
229 switch (Op->Asl.AmlOpcode)
230 {
231 case AML_RAW_DATA_BYTE:
232+ Byte = (UINT8) Op->Asl.Value.Integer;
233+ CgLocalWriteAmlData (Op, &Byte, 1);
234+ return;
235+
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);
241+ return;
242
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);
247 return;
248
249+ case AML_RAW_DATA_QWORD:
250+ ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer);
251+ CgLocalWriteAmlData (Op, &QWord, 8);
252+ return;
253
254 case AML_RAW_DATA_BUFFER:
255
70586bb3 256Index: acpica-unix-20209326/source/compiler/aslopcodes.c
77760c90 257===================================================================
70586bb3
JB
258--- acpica-unix-20209326.orig/source/compiler/aslopcodes.c
259+++ acpica-unix-20209326/source/compiler/aslopcodes.c
77760c90 260@@ -485,6 +485,7 @@ OpcDoUnicode (
f3dfbd7c
ER
261 UINT32 i;
262 UINT8 *AsciiString;
263 UINT16 *UnicodeString;
264+ UINT16 UChar;
265 ACPI_PARSE_OBJECT *BufferLengthOp;
266
267
77760c90 268@@ -511,7 +512,8 @@ OpcDoUnicode (
f3dfbd7c
ER
269
270 for (i = 0; i < Count; i++)
271 {
272- UnicodeString[i] = (UINT16) AsciiString[i];
273+ UChar = (UINT16) AsciiString[i];
274+ ACPI_MOVE_16_TO_16(&UnicodeString[i], &UChar);
275 }
276
277 /*
70586bb3 278Index: acpica-unix-20209326/source/compiler/aslrestype1.c
77760c90 279===================================================================
70586bb3
JB
280--- acpica-unix-20209326.orig/source/compiler/aslrestype1.c
281+++ acpica-unix-20209326/source/compiler/aslrestype1.c
77760c90 282@@ -142,6 +142,11 @@ RsDoMemory24Descriptor (
f3dfbd7c
ER
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;
291 UINT32 i;
292
293
77760c90 294@@ -151,7 +156,8 @@ RsDoMemory24Descriptor (
f3dfbd7c
ER
295
296 Descriptor = Rnode->Buffer;
77760c90 297 Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
f3dfbd7c
ER
298- Descriptor->Memory24.ResourceLength = 9;
299+ ResourceLength = 9;
300+ ACPI_MOVE_16_TO_16(&Descriptor->Memory24.ResourceLength, &ResourceLength);
301
302 /* Process all child initialization nodes */
303
77760c90 304@@ -168,7 +174,7 @@ RsDoMemory24Descriptor (
f3dfbd7c
ER
305
306 case 1: /* Min Address */
307
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;
77760c90 313@@ -176,7 +182,7 @@ RsDoMemory24Descriptor (
f3dfbd7c
ER
314
315 case 2: /* Max Address */
316
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;
77760c90 322@@ -184,14 +190,14 @@ RsDoMemory24Descriptor (
f3dfbd7c
ER
323
324 case 3: /* Alignment */
325
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));
330 break;
331
332 case 4: /* Length */
333
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;
77760c90 339@@ -214,12 +220,17 @@ RsDoMemory24Descriptor (
f3dfbd7c
ER
340 /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
341
342 RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
343- Descriptor->Memory24.Minimum,
344- Descriptor->Memory24.Maximum,
345- Descriptor->Memory24.AddressLength,
346- Descriptor->Memory24.Alignment,
347+ Minimum,
348+ Maximum,
349+ AddressLength,
350+ Alignment,
351 MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp);
352
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);
357+
358 return (Rnode);
359 }
360
77760c90 361@@ -248,6 +259,11 @@ RsDoMemory32Descriptor (
f3dfbd7c
ER
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;
370 UINT32 i;
371
372
77760c90 373@@ -257,7 +273,8 @@ RsDoMemory32Descriptor (
f3dfbd7c
ER
374
375 Descriptor = Rnode->Buffer;
77760c90 376 Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
f3dfbd7c
ER
377- Descriptor->Memory32.ResourceLength = 17;
378+ ResourceLength = 17;
379+ ACPI_MOVE_16_TO_16(&Descriptor->Memory32.ResourceLength, &ResourceLength);
380
381 /* Process all child initialization nodes */
382
77760c90 383@@ -274,7 +291,7 @@ RsDoMemory32Descriptor (
f3dfbd7c
ER
384
385 case 1: /* Min Address */
386
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;
77760c90 392@@ -282,7 +299,7 @@ RsDoMemory32Descriptor (
f3dfbd7c
ER
393
394 case 2: /* Max Address */
395
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;
77760c90 401@@ -290,7 +307,7 @@ RsDoMemory32Descriptor (
f3dfbd7c
ER
402
403 case 3: /* Alignment */
404
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;
77760c90 410@@ -298,7 +315,7 @@ RsDoMemory32Descriptor (
f3dfbd7c
ER
411
412 case 4: /* Length */
413
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;
77760c90 419@@ -321,12 +338,17 @@ RsDoMemory32Descriptor (
f3dfbd7c
ER
420 /* Validate the Min/Max/Len/Align values */
421
422 RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
423- Descriptor->Memory32.Minimum,
424- Descriptor->Memory32.Maximum,
425- Descriptor->Memory32.AddressLength,
426- Descriptor->Memory32.Alignment,
427+ Minimum,
428+ Maximum,
429+ AddressLength,
430+ Alignment,
431 MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
432
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);
437+
438 return (Rnode);
439 }
440
77760c90 441@@ -351,6 +373,7 @@ RsDoMemory32FixedDescriptor (
f3dfbd7c
ER
442 ACPI_PARSE_OBJECT *InitializerOp;
443 ASL_RESOURCE_NODE *Rnode;
444 UINT32 CurrentByteOffset;
445+ UINT16 ResourceLength;
446 UINT32 i;
447
448
77760c90 449@@ -360,7 +383,8 @@ RsDoMemory32FixedDescriptor (
f3dfbd7c
ER
450
451 Descriptor = Rnode->Buffer;
77760c90 452 Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
f3dfbd7c
ER
453- Descriptor->FixedMemory32.ResourceLength = 9;
454+ ResourceLength = 9;
455+ ACPI_MOVE_16_TO_16(&Descriptor->FixedMemory32.ResourceLength, &ResourceLength);
456
457 /* Process all child initialization nodes */
458
77760c90 459@@ -377,14 +401,16 @@ RsDoMemory32FixedDescriptor (
f3dfbd7c
ER
460
461 case 1: /* Address */
462
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));
468 break;
469
470 case 2: /* Length */
471
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));
477 break;
70586bb3 478Index: acpica-unix-20209326/source/compiler/aslrestype1i.c
77760c90 479===================================================================
70586bb3
JB
480--- acpica-unix-20209326.orig/source/compiler/aslrestype1i.c
481+++ acpica-unix-20209326/source/compiler/aslrestype1i.c
77760c90 482@@ -198,6 +198,8 @@ RsDoFixedDmaDescriptor (
f3dfbd7c
ER
483 ACPI_PARSE_OBJECT *InitializerOp;
484 ASL_RESOURCE_NODE *Rnode;
485 UINT32 CurrentByteOffset;
486+ UINT16 RequestLines = 0;
487+ UINT16 Channels = 0;
488 UINT32 i;
489
490
77760c90 491@@ -217,14 +219,14 @@ RsDoFixedDmaDescriptor (
f3dfbd7c
ER
492 {
493 case 0: /* DMA Request Lines [WORD] (_DMA) */
494
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));
499 break;
500
501 case 1: /* DMA Channel [WORD] (_TYP) */
502
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));
507 break;
77760c90 508@@ -249,6 +251,9 @@ RsDoFixedDmaDescriptor (
f3dfbd7c
ER
509 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
510 }
511
512+ ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.RequestLines, &RequestLines);
513+ ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.Channels, &Channels);
514+
515 return (Rnode);
516 }
517
77760c90 518@@ -274,6 +279,7 @@ RsDoFixedIoDescriptor (
f3dfbd7c
ER
519 ACPI_PARSE_OBJECT *AddressOp = NULL;
520 ASL_RESOURCE_NODE *Rnode;
521 UINT32 CurrentByteOffset;
522+ UINT16 Address = 0;
523 UINT32 i;
524
525
77760c90 526@@ -293,8 +299,7 @@ RsDoFixedIoDescriptor (
f3dfbd7c
ER
527 {
528 case 0: /* Base Address */
529
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;
77760c90 536@@ -324,11 +329,13 @@ RsDoFixedIoDescriptor (
f3dfbd7c
ER
537
538 /* Error checks */
539
540- if (Descriptor->FixedIo.Address > 0x03FF)
541+ if (Address > 0x03FF)
542 {
543 AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
544 }
545
546+ ACPI_MOVE_16_TO_16(&Descriptor->FixedIo.Address, &Address);
547+
548 return (Rnode);
549 }
550
77760c90 551@@ -357,6 +364,8 @@ RsDoIoDescriptor (
f3dfbd7c
ER
552 ACPI_PARSE_OBJECT *AlignOp = NULL;
553 ASL_RESOURCE_NODE *Rnode;
554 UINT32 CurrentByteOffset;
555+ UINT16 Minimum = 0;
556+ UINT16 Maximum = 0;
557 UINT32 i;
558
559
77760c90 560@@ -383,8 +392,7 @@ RsDoIoDescriptor (
f3dfbd7c
ER
561
562 case 1: /* Min Address */
563
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;
77760c90 570@@ -392,8 +400,7 @@ RsDoIoDescriptor (
f3dfbd7c
ER
571
572 case 2: /* Max Address */
573
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;
77760c90 580@@ -434,12 +441,15 @@ RsDoIoDescriptor (
f3dfbd7c
ER
581 /* Validate the Min/Max/Len/Align values */
582
583 RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
584- Descriptor->Io.Minimum,
585- Descriptor->Io.Maximum,
586+ Minimum,
587+ Maximum,
588 Descriptor->Io.AddressLength,
589 Descriptor->Io.Alignment,
590 MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp);
591
592+ ACPI_MOVE_16_TO_16(&Descriptor->Io.Minimum, &Minimum);
593+ ACPI_MOVE_16_TO_16(&Descriptor->Io.Maximum, &Maximum);
594+
595 return (Rnode);
596 }
597
77760c90 598@@ -559,9 +569,9 @@ RsDoIrqDescriptor (
f3dfbd7c
ER
599 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
600 }
601
602- /* Now we can set the channel mask */
603+ /* Now we can set the interrupt mask */
604
605- Descriptor->Irq.IrqMask = IrqMask;
606+ ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
607 return (Rnode);
608 }
609
77760c90 610@@ -660,6 +670,6 @@ RsDoIrqNoFlagsDescriptor (
f3dfbd7c
ER
611
612 /* Now we can set the interrupt mask */
613
614- Descriptor->Irq.IrqMask = IrqMask;
615+ ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask);
616 return (Rnode);
617 }
70586bb3 618Index: acpica-unix-20209326/source/compiler/aslrestype2.c
77760c90 619===================================================================
70586bb3
JB
620--- acpica-unix-20209326.orig/source/compiler/aslrestype2.c
621+++ acpica-unix-20209326/source/compiler/aslrestype2.c
77760c90 622@@ -76,6 +76,7 @@ RsDoGeneralRegisterDescriptor (
f3dfbd7c
ER
623 ACPI_PARSE_OBJECT *InitializerOp;
624 ASL_RESOURCE_NODE *Rnode;
625 UINT32 CurrentByteOffset;
626+ UINT16 ResourceLength;
627 UINT32 i;
628
629
77760c90 630@@ -85,7 +86,9 @@ RsDoGeneralRegisterDescriptor (
f3dfbd7c
ER
631
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,
637+ &ResourceLength);
638
639 /* Process all child initialization nodes */
640
25d7dd99
JB
641@@ -95,35 +98,52 @@ RsDoGeneralRegisterDescriptor (
642 {
643 case 0: /* Address space */
644
645+ /*
646 Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
647+ */
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));
652 break;
653
654 case 1: /* Register Bit Width */
655
656+ /*
657 Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
658+ */
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));
663 break;
664
665 case 2: /* Register Bit Offset */
666
667+ /*
668 Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
669+ */
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));
674 break;
f3dfbd7c
ER
675
676 case 3: /* Register Address */
677
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));
683 break;
25d7dd99
JB
684
685 case 4: /* Access Size (ACPI 3.0) */
686
687+ /*
688 Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer;
689+ */
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));
694
695@@ -177,6 +197,7 @@ RsDoInterruptDescriptor (
f3dfbd7c
ER
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;
25d7dd99 703@@ -225,7 +246,7 @@ RsDoInterruptDescriptor (
f3dfbd7c
ER
704 * Initial descriptor length -- may be enlarged if there are
705 * optional fields present
706 */
707- Descriptor->ExtendedIrq.ResourceLength = 2; /* Flags and table length byte */
708+ ResourceLength = 2; /* Flags and table length byte */
709 Descriptor->ExtendedIrq.InterruptCount = 0;
710
711 Rover = ACPI_CAST_PTR (AML_RESOURCE,
25d7dd99 712@@ -333,10 +354,11 @@ RsDoInterruptDescriptor (
f3dfbd7c
ER
713
714 /* Save the integer and move pointer to the next one */
715
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;
723
724 /* Case 7: First interrupt number in list */
725
25d7dd99 726@@ -372,7 +394,7 @@ RsDoInterruptDescriptor (
f3dfbd7c
ER
727 {
728 Rover->ByteItem = ResSourceIndex;
729 Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1);
730- Descriptor->ExtendedIrq.ResourceLength += 1;
731+ ResourceLength += 1;
732 }
733
734 /* Add optional ResSource string if present */
70586bb3
JB
735@@ -381,14 +403,15 @@ RsDoInterruptDescriptor (
736 {
737 strcpy ((char *) Rover, (char *) ResSourceString);
f3dfbd7c
ER
738
739- Descriptor->ExtendedIrq.ResourceLength = (UINT16)
740- (Descriptor->ExtendedIrq.ResourceLength + StringLength);
741+ ResourceLength = (UINT16) (ResourceLength + StringLength);
742 }
743
77760c90
JB
744 Rnode->BufferLength =
745 (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
746 ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))
747 + OptionIndex + StringLength;
f3dfbd7c
ER
748+ ACPI_MOVE_16_TO_16(&Descriptor->ExtendedIrq.ResourceLength,
749+ &ResourceLength);
750 return (Rnode);
751 }
752
70586bb3 753@@ -436,7 +459,7 @@ RsDoVendorLargeDescriptor (
f3dfbd7c
ER
754
755 Descriptor = Rnode->Buffer;
77760c90 756 Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
f3dfbd7c
ER
757- Descriptor->VendorLarge.ResourceLength = (UINT16) i;
758+ ACPI_MOVE_32_TO_16(&Descriptor->VendorLarge.ResourceLength, &i);
759
760 /* Point to end-of-descriptor for vendor data */
761
70586bb3 762Index: acpica-unix-20209326/source/compiler/aslrestype2d.c
77760c90 763===================================================================
70586bb3
JB
764--- acpica-unix-20209326.orig/source/compiler/aslrestype2d.c
765+++ acpica-unix-20209326/source/compiler/aslrestype2d.c
77760c90 766@@ -79,7 +79,13 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
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;
779 UINT32 i;
77760c90 780@@ -102,8 +108,7 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
781 * optional fields present
782 */
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));
788
789 /* Process all child initialization nodes */
77760c90 790@@ -147,8 +152,7 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
791
792 case 5: /* Address Granularity */
793
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;
77760c90 800@@ -156,8 +160,7 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
801
802 case 6: /* Address Min */
803
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;
77760c90 810@@ -165,8 +168,7 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
811
812 case 7: /* Address Max */
813
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;
77760c90 820@@ -174,16 +176,14 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
821
822 case 8: /* Translation Offset */
823
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));
829 break;
830
831 case 9: /* Address Length */
832
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 (
840
841 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
842 OptionIndex++;
843- Descriptor->Address32.ResourceLength++;
844+ ResourceLength++;
845 ResSourceIndex = TRUE;
846 }
847 break;
77760c90 848@@ -211,8 +211,7 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
849 {
850 /* Found a valid ResourceSource */
851
852- Descriptor->Address32.ResourceLength = (UINT16)
853- (Descriptor->Address32.ResourceLength + StringLength);
854+ ResourceLength = (UINT16) (ResourceLength + StringLength);
855
856 strcpy ((char *)
857 &OptionalFields[OptionIndex],
77760c90 858@@ -272,13 +271,20 @@ RsDoDwordIoDescriptor (
f3dfbd7c
ER
859 /* Validate the Min/Max/Len/Gran values */
860
861 RsLargeAddressCheck (
862- (UINT64) Descriptor->Address32.Minimum,
863- (UINT64) Descriptor->Address32.Maximum,
864- (UINT64) Descriptor->Address32.AddressLength,
865- (UINT64) Descriptor->Address32.Granularity,
866+ Minimum,
867+ Maximum,
868+ AddressLength,
869+ Granularity,
870 Descriptor->Address32.Flags,
871 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
872
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);
879+
880 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
881 OptionIndex + StringLength;
882 return (Rnode);
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;
895 UINT32 i;
896 BOOLEAN ResSourceIndex = FALSE;
77760c90 897@@ -332,11 +344,9 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
898 * optional fields present
899 */
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));
905
906-
907 /* Process all child initialization nodes */
908
909 for (i = 0; InitializerOp; i++)
77760c90 910@@ -385,8 +395,7 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
911
912 case 6: /* Address Granularity */
913
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;
77760c90 920@@ -394,8 +403,7 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
921
922 case 7: /* Min Address */
923
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;
77760c90 930@@ -403,8 +411,7 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
931
932 case 8: /* Max Address */
933
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;
77760c90 940@@ -412,16 +419,14 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
941
942 case 9: /* Translation Offset */
943
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));
949 break;
950
951 case 10: /* Address Length */
952
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;
77760c90 959@@ -433,7 +438,7 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
960 {
961 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
962 OptionIndex++;
963- Descriptor->Address32.ResourceLength++;
964+ ResourceLength++;
965 ResSourceIndex = TRUE;
966 }
967 break;
77760c90 968@@ -445,8 +450,8 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
969 {
970 if (StringLength)
971 {
972- Descriptor->Address32.ResourceLength = (UINT16)
973- (Descriptor->Address32.ResourceLength + StringLength);
974+
975+ ResourceLength = (UINT16) (ResourceLength + StringLength);
976
977 strcpy ((char *)
978 &OptionalFields[OptionIndex],
77760c90 979@@ -507,13 +512,20 @@ RsDoDwordMemoryDescriptor (
f3dfbd7c
ER
980 /* Validate the Min/Max/Len/Gran values */
981
982 RsLargeAddressCheck (
983- (UINT64) Descriptor->Address32.Minimum,
984- (UINT64) Descriptor->Address32.Maximum,
985- (UINT64) Descriptor->Address32.AddressLength,
986- (UINT64) Descriptor->Address32.Granularity,
987+ Minimum,
988+ Maximum,
989+ AddressLength,
990+ Granularity,
991 Descriptor->Address32.Flags,
992 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
993
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);
1000+
1001 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
1002 OptionIndex + StringLength;
1003 return (Rnode);
77760c90 1004@@ -545,7 +557,13 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
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;
1016 UINT32 i;
1017 BOOLEAN ResSourceIndex = FALSE;
77760c90 1018@@ -566,8 +584,7 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1019 * optional fields present
1020 */
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));
1026
1027 /* Process all child initialization nodes */
77760c90 1028@@ -616,8 +633,7 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1029
1030 case 6: /* Address Granularity */
1031
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;
77760c90 1038@@ -625,8 +641,7 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1039
1040 case 7: /* Min Address */
1041
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;
77760c90 1048@@ -634,8 +649,7 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1049
1050 case 8: /* Max Address */
1051
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;
77760c90 1058@@ -643,16 +657,14 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1059
1060 case 9: /* Translation Offset */
1061
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));
1067 break;
1068
1069 case 10: /* Address Length */
1070
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;
77760c90 1077@@ -664,7 +676,7 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1078 {
1079 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1080 OptionIndex++;
1081- Descriptor->Address32.ResourceLength++;
1082+ ResourceLength++;
1083 ResSourceIndex = TRUE;
1084 }
1085 break;
77760c90 1086@@ -676,8 +688,7 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1087 {
1088 if (StringLength)
1089 {
1090- Descriptor->Address32.ResourceLength = (UINT16)
1091- (Descriptor->Address32.ResourceLength + StringLength);
1092+ ResourceLength = (UINT16) (ResourceLength + StringLength);
1093
1094 strcpy ((char *)
1095 &OptionalFields[OptionIndex],
77760c90 1096@@ -724,13 +735,20 @@ RsDoDwordSpaceDescriptor (
f3dfbd7c
ER
1097 /* Validate the Min/Max/Len/Gran values */
1098
1099 RsLargeAddressCheck (
1100- (UINT64) Descriptor->Address32.Minimum,
1101- (UINT64) Descriptor->Address32.Maximum,
1102- (UINT64) Descriptor->Address32.AddressLength,
1103- (UINT64) Descriptor->Address32.Granularity,
1104+ Minimum,
1105+ Maximum,
1106+ AddressLength,
1107+ Granularity,
1108 Descriptor->Address32.Flags,
1109 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1110
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);
1117+
1118 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
1119 OptionIndex + StringLength;
1120 return (Rnode);
70586bb3 1121Index: acpica-unix-20209326/source/compiler/aslrestype2e.c
77760c90 1122===================================================================
70586bb3
JB
1123--- acpica-unix-20209326.orig/source/compiler/aslrestype2e.c
1124+++ acpica-unix-20209326/source/compiler/aslrestype2e.c
77760c90 1125@@ -78,6 +78,13 @@ RsDoExtendedIoDescriptor (
f3dfbd7c
ER
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;
1137 UINT32 i;
1138
77760c90
JB
1139@@ -94,9 +101,10 @@ RsDoExtendedIoDescriptor (
1140 Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
1141 Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
f3dfbd7c 1142
77760c90 1143- Descriptor->ExtAddress64.ResourceLength = (UINT16)
f3dfbd7c
ER
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,
1148+ &ResourceLength);
1149
1150 /* Process all child initialization nodes */
1151
77760c90 1152@@ -139,7 +147,7 @@ RsDoExtendedIoDescriptor (
f3dfbd7c
ER
1153
1154 case 5: /* Address Granularity */
1155
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;
77760c90 1161@@ -147,7 +155,7 @@ RsDoExtendedIoDescriptor (
f3dfbd7c
ER
1162
1163 case 6: /* Address Min */
1164
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;
77760c90 1170@@ -155,7 +163,7 @@ RsDoExtendedIoDescriptor (
f3dfbd7c
ER
1171
1172 case 7: /* Address Max */
1173
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;
77760c90 1179@@ -163,14 +171,14 @@ RsDoExtendedIoDescriptor (
f3dfbd7c
ER
1180
1181 case 8: /* Translation Offset */
1182
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));
1187 break;
1188
1189 case 9: /* Address Length */
1190
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;
77760c90 1196@@ -178,7 +186,7 @@ RsDoExtendedIoDescriptor (
f3dfbd7c
ER
1197
1198 case 10: /* Type-Specific Attributes */
1199
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));
1204 break;
77760c90 1205@@ -214,13 +222,20 @@ RsDoExtendedIoDescriptor (
f3dfbd7c
ER
1206 /* Validate the Min/Max/Len/Gran values */
1207
1208 RsLargeAddressCheck (
1209- Descriptor->ExtAddress64.Minimum,
1210- Descriptor->ExtAddress64.Maximum,
1211- Descriptor->ExtAddress64.AddressLength,
1212- Descriptor->ExtAddress64.Granularity,
1213+ Minimum,
1214+ Maximum,
1215+ AddressLength,
1216+ Granularity,
1217 Descriptor->ExtAddress64.Flags,
1218 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1219
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);
1226+
1227 Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) +
1228 StringLength;
1229 return (Rnode);
70586bb3 1230Index: acpica-unix-20209326/source/compiler/aslrestype2q.c
77760c90 1231===================================================================
70586bb3
JB
1232--- acpica-unix-20209326.orig/source/compiler/aslrestype2q.c
1233+++ acpica-unix-20209326/source/compiler/aslrestype2q.c
77760c90 1234@@ -80,7 +80,13 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
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;
1246 UINT32 i;
1247 BOOLEAN ResSourceIndex = FALSE;
77760c90 1248@@ -102,8 +108,7 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1249 * optional fields present
1250 */
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));
1256
1257 /* Process all child initialization nodes */
77760c90 1258@@ -147,7 +152,7 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1259
1260 case 5: /* Address Granularity */
1261
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;
77760c90 1267@@ -155,7 +160,7 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1268
1269 case 6: /* Address Min */
1270
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;
77760c90 1276@@ -163,7 +168,7 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1277
1278 case 7: /* Address Max */
1279
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;
77760c90 1285@@ -171,14 +176,14 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1286
1287 case 8: /* Translation Offset */
1288
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));
1293 break;
1294
1295 case 9: /* Address Length */
1296
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;
77760c90 1302@@ -190,7 +195,7 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1303 {
1304 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1305 OptionIndex++;
1306- Descriptor->Address64.ResourceLength++;
1307+ ResourceLength++;
1308 ResSourceIndex = TRUE;
1309 }
1310 break;
77760c90 1311@@ -202,8 +207,7 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1312 {
1313 if (StringLength)
1314 {
1315- Descriptor->Address64.ResourceLength = (UINT16)
1316- (Descriptor->Address64.ResourceLength + StringLength);
1317+ ResourceLength = (UINT16) (ResourceLength + StringLength);
1318
1319 strcpy ((char *)
1320 &OptionalFields[OptionIndex],
77760c90 1321@@ -263,13 +267,20 @@ RsDoQwordIoDescriptor (
f3dfbd7c
ER
1322 /* Validate the Min/Max/Len/Gran values */
1323
1324 RsLargeAddressCheck (
1325- Descriptor->Address64.Minimum,
1326- Descriptor->Address64.Maximum,
1327- Descriptor->Address64.AddressLength,
1328- Descriptor->Address64.Granularity,
1329+ Minimum,
1330+ Maximum,
1331+ AddressLength,
1332+ Granularity,
1333 Descriptor->Address64.Flags,
1334 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1335
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);
1342+
1343 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
1344 OptionIndex + StringLength;
1345 return (Rnode);
77760c90 1346@@ -301,7 +312,13 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
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;
1358 UINT32 i;
1359 BOOLEAN ResSourceIndex = FALSE;
77760c90 1360@@ -323,8 +340,7 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1361 * optional fields present
1362 */
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));
1368
1369 /* Process all child initialization nodes */
77760c90 1370@@ -375,7 +391,7 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1371
1372 case 6: /* Address Granularity */
1373
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;
77760c90 1379@@ -383,7 +399,7 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1380
1381 case 7: /* Min Address */
1382
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;
77760c90 1388@@ -391,7 +407,7 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1389
1390 case 8: /* Max Address */
1391
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;
77760c90 1397@@ -399,14 +415,14 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1398
1399 case 9: /* Translation Offset */
1400
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));
1405 break;
1406
1407 case 10: /* Address Length */
1408
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;
77760c90 1414@@ -418,7 +434,7 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1415 {
1416 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1417 OptionIndex++;
1418- Descriptor->Address64.ResourceLength++;
1419+ ResourceLength++;
1420 ResSourceIndex = TRUE;
1421 }
1422 break;
77760c90 1423@@ -430,8 +446,7 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1424 {
1425 if (StringLength)
1426 {
1427- Descriptor->Address64.ResourceLength = (UINT16)
1428- (Descriptor->Address64.ResourceLength + StringLength);
1429+ ResourceLength = (UINT16) (ResourceLength + StringLength);
1430
1431 strcpy ((char *)
1432 &OptionalFields[OptionIndex],
77760c90 1433@@ -492,13 +507,20 @@ RsDoQwordMemoryDescriptor (
f3dfbd7c
ER
1434 /* Validate the Min/Max/Len/Gran values */
1435
1436 RsLargeAddressCheck (
1437- Descriptor->Address64.Minimum,
1438- Descriptor->Address64.Maximum,
1439- Descriptor->Address64.AddressLength,
1440- Descriptor->Address64.Granularity,
1441+ Minimum,
1442+ Maximum,
1443+ AddressLength,
1444+ Granularity,
1445 Descriptor->Address64.Flags,
1446 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1447
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);
1454+
1455 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
1456 OptionIndex + StringLength;
1457 return (Rnode);
77760c90 1458@@ -530,9 +552,15 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1459 ASL_RESOURCE_NODE *Rnode;
1460 UINT8 *OptionalFields;
1461 UINT16 StringLength = 0;
1462+ UINT16 ResourceLength = 0;
1463 UINT32 OptionIndex = 0;
1464 UINT32 CurrentByteOffset;
1465 UINT32 i;
1466+ UINT64 Minimum = 0;
1467+ UINT64 Maximum = 0;
1468+ UINT64 AddressLength = 0;
1469+ UINT64 Granularity = 0;
1470+ UINT64 TranslationOffset = 0;
1471 BOOLEAN ResSourceIndex = FALSE;
1472
1473
77760c90 1474@@ -551,8 +579,7 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1475 * optional fields present
1476 */
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));
1482
1483 /* Process all child initialization nodes */
77760c90 1484@@ -601,7 +628,7 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1485
1486 case 6: /* Address Granularity */
1487
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;
77760c90 1493@@ -609,7 +636,7 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1494
1495 case 7: /* Min Address */
1496
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;
77760c90 1502@@ -617,7 +644,7 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1503
1504 case 8: /* Max Address */
1505
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;
77760c90 1511@@ -625,14 +652,14 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1512
1513 case 9: /* Translation Offset */
1514
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));
1519 break;
1520
1521 case 10: /* Address Length */
1522
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;
77760c90 1528@@ -644,7 +671,7 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1529 {
1530 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
1531 OptionIndex++;
1532- Descriptor->Address64.ResourceLength++;
1533+ ResourceLength++;
1534 ResSourceIndex = TRUE;
1535 }
1536 break;
77760c90 1537@@ -656,8 +683,7 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1538 {
1539 if (StringLength)
1540 {
1541- Descriptor->Address64.ResourceLength = (UINT16)
1542- (Descriptor->Address64.ResourceLength + StringLength);
1543+ ResourceLength = (UINT16) (ResourceLength + StringLength);
1544
1545 strcpy ((char *)
1546 &OptionalFields[OptionIndex],
77760c90 1547@@ -703,13 +729,20 @@ RsDoQwordSpaceDescriptor (
f3dfbd7c
ER
1548 /* Validate the Min/Max/Len/Gran values */
1549
1550 RsLargeAddressCheck (
1551- Descriptor->Address64.Minimum,
1552- Descriptor->Address64.Maximum,
1553- Descriptor->Address64.AddressLength,
1554- Descriptor->Address64.Granularity,
1555+ Minimum,
1556+ Maximum,
1557+ AddressLength,
1558+ Granularity,
1559 Descriptor->Address64.Flags,
1560 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
1561
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);
1568+
1569 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
1570 OptionIndex + StringLength;
1571 return (Rnode);
70586bb3 1572Index: acpica-unix-20209326/source/compiler/aslrestype2s.c
77760c90 1573===================================================================
70586bb3
JB
1574--- acpica-unix-20209326.orig/source/compiler/aslrestype2s.c
1575+++ acpica-unix-20209326/source/compiler/aslrestype2s.c
25d7dd99 1576@@ -340,9 +340,14 @@ RsDoGpioIntDescriptor (
f3dfbd7c
ER
1577 UINT16 VendorLength;
1578 UINT16 InterruptLength;
1579 UINT16 DescriptorSize;
1580+ UINT16 IntFlags = 0;
1581+ UINT16 DebounceTimeout = 0;
1582+ UINT16 Flags = 0;
1583 UINT32 CurrentByteOffset;
1584 UINT32 PinCount = 0;
1585 UINT32 i;
25d7dd99
JB
1586+ UINT16 Tmp16;
1587+ UINT16 Val16;
1588
1589
1590 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
1591@@ -367,7 +372,7 @@ RsDoGpioIntDescriptor (
1592 sizeof (AML_RESOURCE_LARGE_HEADER));
1593
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 (
1601
1602 /* Setup offsets within the descriptor */
1603
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);
1608
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);
1613
1614 /* Process all child initialization nodes */
1615
1616@@ -396,21 +401,21 @@ RsDoGpioIntDescriptor (
f3dfbd7c
ER
1617 {
1618 case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */
1619
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);
1624 break;
1625
1626 case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */
1627
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);
1632 break;
1633
1634 case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */
1635
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);
1640 break;
25d7dd99 1641@@ -424,7 +429,7 @@ RsDoGpioIntDescriptor (
f3dfbd7c
ER
1642
1643 case 4: /* Debounce Timeout [WORD] (_DBT) */
1644
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));
1649 break;
25d7dd99 1650@@ -451,7 +456,7 @@ RsDoGpioIntDescriptor (
f3dfbd7c
ER
1651
1652 case 7: /* Resource Usage (consumer/producer) */
1653
1654- RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
1655+ RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
1656 break;
1657
1658 case 8: /* Resource Tag (Descriptor Name) */
25d7dd99
JB
1659@@ -466,13 +471,14 @@ RsDoGpioIntDescriptor (
1660 * This field is required in order to calculate the length
1661 * of the ResourceSource at runtime.
1662 */
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);
1667
1668 if (RsGetVendorData (InitializerOp, VendorData,
1669- (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
1670+ (CurrentByteOffset + Tmp16)))
1671 {
1672- Descriptor->Gpio.VendorLength = VendorLength;
1673+ ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorLength,
1674+ &VendorLength);
1675 }
1676 break;
1677
1678@@ -485,7 +491,9 @@ RsDoGpioIntDescriptor (
1679 * (implies resource source must immediately follow the pin list.)
1680 * Name: _PIN
1681 */
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;
1686 InterruptList++;
1687 PinCount++;
1688
1689@@ -507,8 +515,10 @@ RsDoGpioIntDescriptor (
1690
1691 /* Create a named field at the start of the list */
1692
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);
1699 }
1700 break;
1701 }
1702@@ -516,6 +526,10 @@ RsDoGpioIntDescriptor (
f3dfbd7c
ER
1703 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1704 }
1705
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);
1709+
77760c90
JB
1710 MpSaveGpioInfo (Info->MappingOp, Descriptor,
1711 PinCount, PinList, ResourceSource);
f3dfbd7c 1712 return (Rnode);
25d7dd99 1713@@ -549,9 +563,15 @@ RsDoGpioIoDescriptor (
f3dfbd7c
ER
1714 UINT16 VendorLength;
1715 UINT16 InterruptLength;
1716 UINT16 DescriptorSize;
1717+ UINT16 IntFlags = 0;
1718+ UINT16 DebounceTimeout = 0;
1719+ UINT16 DriveStrength = 0;
1720+ UINT16 Flags = 0;
1721 UINT32 CurrentByteOffset;
1722 UINT32 PinCount = 0;
1723 UINT32 i;
25d7dd99
JB
1724+ UINT16 Tmp16;
1725+ UINT16 Val16;
1726
1727
1728 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
70586bb3 1729@@ -576,7 +596,7 @@ RsDoGpioIoDescriptor (
25d7dd99
JB
1730 sizeof (AML_RESOURCE_LARGE_HEADER));
1731
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;
70586bb3 1738@@ -590,11 +610,11 @@ RsDoGpioIoDescriptor (
25d7dd99
JB
1739
1740 /* Setup offsets within the descriptor */
1741
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);
1746
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);
1751
1752 /* Process all child initialization nodes */
1753
70586bb3 1754@@ -604,7 +624,7 @@ RsDoGpioIoDescriptor (
f3dfbd7c
ER
1755 {
1756 case 0: /* Share Type [Flags] (_SHR) */
1757
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);
1762 break;
70586bb3 1763@@ -618,21 +638,21 @@ RsDoGpioIoDescriptor (
f3dfbd7c
ER
1764
1765 case 2: /* Debounce Timeout [WORD] (_DBT) */
1766
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));
1771 break;
1772
1773 case 3: /* Drive Strength [WORD] (_DRS) */
1774
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));
1779 break;
1780
1781 case 4: /* I/O Restriction [Flag] (_IOR) */
1782
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);
1787 break;
70586bb3 1788@@ -658,7 +678,7 @@ RsDoGpioIoDescriptor (
f3dfbd7c
ER
1789
1790 case 7: /* Resource Usage (consumer/producer) */
1791
1792- RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1);
1793+ RsSetFlagBits16 (&Flags, InitializerOp, 0, 1);
1794 break;
1795
1796 case 8: /* Resource Tag (Descriptor Name) */
70586bb3 1797@@ -672,13 +692,14 @@ RsDoGpioIoDescriptor (
25d7dd99
JB
1798 * This field is required in order to calculate the length
1799 * of the ResourceSource at runtime.
1800 */
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);
1805
1806 if (RsGetVendorData (InitializerOp, VendorData,
1807 (CurrentByteOffset + Descriptor->Gpio.VendorOffset)))
1808 {
1809- Descriptor->Gpio.VendorLength = VendorLength;
1810+ ACPI_MOVE_16_TO_16(&Descriptor->Gpio.VendorLength,
1811+ &VendorLength);
1812 }
1813 break;
1814
70586bb3 1815@@ -691,7 +712,9 @@ RsDoGpioIoDescriptor (
25d7dd99
JB
1816 * (implies resource source must immediately follow the pin list.)
1817 * Name: _PIN
1818 */
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;
1823 InterruptList++;
1824 PinCount++;
1825
70586bb3 1826@@ -722,6 +745,11 @@ RsDoGpioIoDescriptor (
f3dfbd7c
ER
1827 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1828 }
1829
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);
1834+
77760c90
JB
1835 MpSaveGpioInfo (Info->MappingOp, Descriptor,
1836 PinCount, PinList, ResourceSource);
f3dfbd7c 1837 return (Rnode);
70586bb3 1838@@ -752,8 +780,12 @@ RsDoI2cSerialBusDescriptor (
f3dfbd7c
ER
1839 UINT16 ResSourceLength;
1840 UINT16 VendorLength;
1841 UINT16 DescriptorSize;
1842+ UINT16 SlaveAddress = 0;
1843+ UINT32 ConnectionSpeed = 0;
1844+ UINT16 TypeSpecificFlags = 0;
1845 UINT32 CurrentByteOffset;
1846 UINT32 i;
25d7dd99
JB
1847+ UINT16 Tmp16;
1848
f3dfbd7c 1849
25d7dd99 1850 InitializerOp = Info->DescriptorTypeOp->Asl.Child;
70586bb3 1851@@ -776,12 +808,14 @@ RsDoI2cSerialBusDescriptor (
25d7dd99
JB
1852 sizeof (AML_RESOURCE_LARGE_HEADER));
1853
1854 Descriptor = Rnode->Buffer;
1855- Descriptor->I2cSerialBus.ResourceLength = DescriptorSize;
1856+ ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.ResourceLength,
1857+ &DescriptorSize);
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);
1865
1866 if (Info->DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_I2C_SERIALBUS_V2)
1867 {
70586bb3 1868@@ -801,7 +835,7 @@ RsDoI2cSerialBusDescriptor (
f3dfbd7c
ER
1869 {
1870 case 0: /* Slave Address [WORD] (_ADR) */
1871
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));
1876 break;
70586bb3 1877@@ -815,14 +849,14 @@ RsDoI2cSerialBusDescriptor (
f3dfbd7c
ER
1878
1879 case 2: /* Connection Speed [DWORD] (_SPE) */
1880
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));
1885 break;
1886
1887 case 3: /* Addressing Mode [Flag] (_MOD) */
1888
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);
1893 break;
70586bb3 1894@@ -882,6 +916,9 @@ RsDoI2cSerialBusDescriptor (
f3dfbd7c
ER
1895 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1896 }
1897
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);
1902 return (Rnode);
1903 }
70586bb3 1904@@ -911,6 +948,9 @@ RsDoSpiSerialBusDescriptor (
f3dfbd7c
ER
1905 UINT16 ResSourceLength;
1906 UINT16 VendorLength;
1907 UINT16 DescriptorSize;
1908+ UINT16 DeviceSelection = 0;
1909+ UINT32 ConnectionSpeed = 0;
1910+ UINT16 TypeSpecificFlags = 0;
1911 UINT32 CurrentByteOffset;
1912 UINT32 i;
1913
70586bb3 1914@@ -961,21 +1001,21 @@ RsDoSpiSerialBusDescriptor (
f3dfbd7c
ER
1915 {
1916 case 0: /* Device Selection [WORD] (_ADR) */
1917
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));
1922 break;
1923
1924 case 1: /* Device Polarity [Flag] (_DPL) */
1925
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);
1930 break;
1931
1932 case 2: /* Wire Mode [Flag] (_MOD) */
1933
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);
1938 break;
70586bb3 1939@@ -996,7 +1036,7 @@ RsDoSpiSerialBusDescriptor (
f3dfbd7c
ER
1940
1941 case 5: /* Connection Speed [DWORD] (_SPE) */
1942
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));
1947 break;
70586bb3 1948@@ -1070,6 +1110,10 @@ RsDoSpiSerialBusDescriptor (
f3dfbd7c
ER
1949 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
1950 }
1951
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);
1955+
1956 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
1957 return (Rnode);
1958 }
70586bb3 1959@@ -1099,6 +1143,10 @@ RsDoUartSerialBusDescriptor (
f3dfbd7c
ER
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;
1968 UINT32 i;
1969
70586bb3 1970@@ -1148,21 +1196,21 @@ RsDoUartSerialBusDescriptor (
f3dfbd7c
ER
1971 {
1972 case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */
1973
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));
1978 break;
1979
1980 case 1: /* Bits Per Byte [Flags] (_LEN) */
1981
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);
1986 break;
1987
1988 case 2: /* Stop Bits [Flags] (_STB) */
1989
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);
1994 break;
70586bb3 1995@@ -1176,7 +1224,7 @@ RsDoUartSerialBusDescriptor (
f3dfbd7c
ER
1996
1997 case 4: /* Endianness [Flag] (_END) */
1998
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);
2003 break;
70586bb3 2004@@ -1190,21 +1238,21 @@ RsDoUartSerialBusDescriptor (
f3dfbd7c
ER
2005
2006 case 6: /* Flow Control [Flags] (_FLC) */
2007
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);
2012 break;
2013
2014 case 7: /* Rx Buffer Size [WORD] (_RXL) */
2015
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));
2020 break;
2021
2022 case 8: /* Tx Buffer Size [WORD] (_TXL) */
2023
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));
2028 break;
70586bb3 2029@@ -1274,6 +1322,11 @@ RsDoUartSerialBusDescriptor (
f3dfbd7c
ER
2030 InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
2031 }
2032
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);
2037+
2038 MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource);
2039 return (Rnode);
2040 }
70586bb3 2041Index: acpica-unix-20209326/source/compiler/aslrestype2w.c
77760c90 2042===================================================================
70586bb3
JB
2043--- acpica-unix-20209326.orig/source/compiler/aslrestype2w.c
2044+++ acpica-unix-20209326/source/compiler/aslrestype2w.c
77760c90 2045@@ -81,6 +81,12 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
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;
2056 UINT32 i;
2057 BOOLEAN ResSourceIndex = FALSE;
77760c90 2058@@ -102,8 +108,7 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2059 * optional fields present
2060 */
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));
2066
2067 /* Process all child initialization nodes */
77760c90 2068@@ -147,7 +152,7 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2069
2070 case 5: /* Address Granularity */
2071
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;
77760c90 2077@@ -155,7 +160,7 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2078
2079 case 6: /* Address Min */
2080
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;
77760c90 2086@@ -163,7 +168,7 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2087
2088 case 7: /* Address Max */
2089
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;
77760c90 2095@@ -171,14 +176,14 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2096
2097 case 8: /* Translation Offset */
2098
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));
2103 break;
2104
2105 case 9: /* Address Length */
2106
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;
77760c90 2112@@ -190,7 +195,7 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2113 {
2114 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
2115 OptionIndex++;
2116- Descriptor->Address16.ResourceLength++;
2117+ ResourceLength++;
2118 ResSourceIndex = TRUE;
2119 }
2120 break;
77760c90 2121@@ -202,8 +207,7 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2122 {
2123 if (StringLength)
2124 {
2125- Descriptor->Address16.ResourceLength = (UINT16)
2126- (Descriptor->Address16.ResourceLength + StringLength);
2127+ ResourceLength = (UINT16) (ResourceLength + StringLength);
2128
2129 strcpy ((char *)
2130 &OptionalFields[OptionIndex],
77760c90 2131@@ -263,13 +267,20 @@ RsDoWordIoDescriptor (
f3dfbd7c
ER
2132 /* Validate the Min/Max/Len/Gran values */
2133
2134 RsLargeAddressCheck (
2135- (UINT64) Descriptor->Address16.Minimum,
2136- (UINT64) Descriptor->Address16.Maximum,
2137- (UINT64) Descriptor->Address16.AddressLength,
2138- (UINT64) Descriptor->Address16.Granularity,
2139+ Minimum,
2140+ Maximum,
2141+ AddressLength,
2142+ Granularity,
2143 Descriptor->Address16.Flags,
2144 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2145
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);
2152+
2153 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
2154 OptionIndex + StringLength;
2155 return (Rnode);
77760c90 2156@@ -302,6 +313,12 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
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;
2167 UINT32 i;
2168 BOOLEAN ResSourceIndex = FALSE;
77760c90 2169@@ -323,8 +340,7 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2170 * optional fields present
2171 */
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));
2177
2178 /* Process all child initialization nodes */
77760c90 2179@@ -361,8 +377,7 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2180
2181 case 4: /* Address Granularity */
2182
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;
77760c90 2189@@ -370,8 +385,7 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2190
2191 case 5: /* Min Address */
2192
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;
77760c90 2199@@ -379,8 +393,7 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2200
2201 case 6: /* Max Address */
2202
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;
77760c90 2209@@ -388,16 +401,14 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2210
2211 case 7: /* Translation Offset */
2212
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));
2218 break;
2219
2220 case 8: /* Address Length */
2221
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;
77760c90 2228@@ -409,7 +420,7 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2229 {
2230 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
2231 OptionIndex++;
2232- Descriptor->Address16.ResourceLength++;
2233+ ResourceLength++;
2234 ResSourceIndex = TRUE;
2235 }
2236 break;
77760c90 2237@@ -421,8 +432,7 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2238 {
2239 if (StringLength)
2240 {
2241- Descriptor->Address16.ResourceLength = (UINT16)
2242- (Descriptor->Address16.ResourceLength + StringLength);
2243+ ResourceLength = (UINT16) (ResourceLength + StringLength);
2244
2245 strcpy ((char *)
2246 &OptionalFields[OptionIndex],
77760c90 2247@@ -468,13 +478,20 @@ RsDoWordBusNumberDescriptor (
f3dfbd7c
ER
2248 /* Validate the Min/Max/Len/Gran values */
2249
2250 RsLargeAddressCheck (
2251- (UINT64) Descriptor->Address16.Minimum,
2252- (UINT64) Descriptor->Address16.Maximum,
2253- (UINT64) Descriptor->Address16.AddressLength,
2254- (UINT64) Descriptor->Address16.Granularity,
2255+ Minimum,
2256+ Maximum,
2257+ AddressLength,
2258+ Granularity,
2259 Descriptor->Address16.Flags,
2260 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2261
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);
2268+
2269 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
2270 OptionIndex + StringLength;
2271 return (Rnode);
77760c90 2272@@ -507,6 +524,12 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
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;
2283 UINT32 i;
2284 BOOLEAN ResSourceIndex = FALSE;
77760c90 2285@@ -527,8 +550,7 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2286 * optional fields present
2287 */
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));
2293
2294 /* Process all child initialization nodes */
77760c90 2295@@ -577,8 +599,7 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2296
2297 case 6: /* Address Granularity */
2298
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;
77760c90 2305@@ -586,8 +607,7 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2306
2307 case 7: /* Min Address */
2308
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;
77760c90 2315@@ -595,8 +615,7 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2316
2317 case 8: /* Max Address */
2318
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;
77760c90 2325@@ -604,16 +623,14 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2326
2327 case 9: /* Translation Offset */
2328
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));
2334 break;
2335
2336 case 10: /* Address Length */
2337
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;
77760c90 2344@@ -625,7 +642,7 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2345 {
2346 OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
2347 OptionIndex++;
2348- Descriptor->Address16.ResourceLength++;
2349+ ResourceLength++;
2350 ResSourceIndex = TRUE;
2351 }
2352 break;
77760c90 2353@@ -637,8 +654,7 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2354 {
2355 if (StringLength)
2356 {
2357- Descriptor->Address16.ResourceLength = (UINT16)
2358- (Descriptor->Address16.ResourceLength + StringLength);
2359+ ResourceLength = (UINT16) (ResourceLength + StringLength);
2360
2361 strcpy ((char *)
2362 &OptionalFields[OptionIndex],
77760c90 2363@@ -684,13 +700,20 @@ RsDoWordSpaceDescriptor (
f3dfbd7c
ER
2364 /* Validate the Min/Max/Len/Gran values */
2365
2366 RsLargeAddressCheck (
2367- (UINT64) Descriptor->Address16.Minimum,
2368- (UINT64) Descriptor->Address16.Maximum,
2369- (UINT64) Descriptor->Address16.AddressLength,
2370- (UINT64) Descriptor->Address16.Granularity,
2371+ Minimum,
2372+ Maximum,
2373+ AddressLength,
2374+ Granularity,
2375 Descriptor->Address16.Flags,
2376 MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp);
2377
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);
2384+
2385 Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
2386 OptionIndex + StringLength;
2387 return (Rnode);
70586bb3 2388Index: acpica-unix-20209326/source/include/acmacros.h
77760c90 2389===================================================================
70586bb3
JB
2390--- acpica-unix-20209326.orig/source/include/acmacros.h
2391+++ acpica-unix-20209326/source/include/acmacros.h
25d7dd99
JB
2392@@ -98,9 +98,12 @@
2393 ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
2394 ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
f3dfbd7c 2395
25d7dd99
JB
2396-/* 32-bit source, 16/32/64 destination */
2397+/* 32-bit source, 8/16/32/64 destination */
f3dfbd7c
ER
2398
2399-#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
25d7dd99
JB
2400+#define ACPI_MOVE_32_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];}
2401+
f3dfbd7c
ER
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];}
2404
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];\
25d7dd99
JB
2407@@ -113,11 +116,17 @@
2408 ((UINT8 *)(void *)(d))[6] = ((UINT8 *)(void *)(s))[1];\
2409 ((UINT8 *)(void *)(d))[7] = ((UINT8 *)(void *)(s))[0];}
f3dfbd7c 2410
25d7dd99
JB
2411-/* 64-bit source, 16/32/64 destination */
2412+/* 64-bit source, 8/16/32/64 destination */
f3dfbd7c
ER
2413
2414-#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
25d7dd99 2415+#define ACPI_MOVE_64_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];}
f3dfbd7c
ER
2416
2417-#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */
25d7dd99
JB
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];}
2420+
f3dfbd7c
ER
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];}
2425
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];\
25d7dd99 2428@@ -136,20 +145,26 @@
f3dfbd7c 2429
25d7dd99 2430 /* The hardware supports unaligned transfers, just do the little-endian move */
f3dfbd7c 2431
25d7dd99
JB
2432-/* 16-bit source, 16/32/64 destination */
2433+/* 16-bit source, 8/16/32/64 destination */
2434
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)
2439
2440-/* 32-bit source, 16/32/64 destination */
2441+/* 32-bit source, 8/16/32/64 destination */
2442+
2443+#define ACPI_MOVE_32_TO_8(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];}
2444+
f3dfbd7c
ER
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];}
25d7dd99
JB
2447
2448-#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
f3dfbd7c
ER
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)
2451
25d7dd99
JB
2452-/* 64-bit source, 16/32/64 destination */
2453+/* 64-bit source, 8/16/32/64 destination */
2454
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)
2459@@ -169,7 +184,9 @@
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);}
2462
2463-/* 32-bit source, 16/32/64 destination */
2464+/* 32-bit source, 8/16/32/64 destination */
2465+
2466+#define ACPI_MOVE_32_TO_8(d, s) ACPI_MOVE_16_TO_8(d, s) /* Truncate to 8 */
2467
2468 #define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */
2469
70586bb3 2470Index: acpica-unix-20209326/source/include/platform/aclinux.h
77760c90 2471===================================================================
70586bb3
JB
2472--- acpica-unix-20209326.orig/source/include/platform/aclinux.h
2473+++ acpica-unix-20209326/source/include/platform/aclinux.h
2474@@ -198,6 +198,7 @@
77760c90
JB
2475
2476 #ifdef ACPI_USE_STANDARD_HEADERS
f3dfbd7c
ER
2477 #include <unistd.h>
2478+#include <endian.h>
f3dfbd7c
ER
2479 #endif
2480
77760c90 2481 /* Define/disable kernel-specific declarators */
70586bb3 2482@@ -232,6 +233,10 @@
25d7dd99
JB
2483 #define __cdecl
2484 #endif
2485
2486+#if defined(__PPC64__) || defined(__s390x__)
2487+#define ACPI_BIG_ENDIAN
2488+#endif
2489+
2490 #endif /* __KERNEL__ */
2491
2492 #endif /* __ACLINUX_H__ */
70586bb3 2493Index: acpica-unix-20209326/source/compiler/aslanalyze.c
25d7dd99 2494===================================================================
70586bb3
JB
2495--- acpica-unix-20209326.orig/source/compiler/aslanalyze.c
2496+++ acpica-unix-20209326/source/compiler/aslanalyze.c
2497@@ -469,7 +469,7 @@ ApCheckForGpeNameConflict (
25d7dd99
JB
2498
2499 /* Need a null-terminated string version of NameSeg */
2500
70586bb3
JB
2501- ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg);
2502+ ACPI_COPY_NAMESEG (Name, Op->Asl.NameSeg);
2503 Name[ACPI_NAMESEG_SIZE] = 0;
25d7dd99
JB
2504
2505 /*
70586bb3 2506@@ -496,7 +496,7 @@ ApCheckForGpeNameConflict (
25d7dd99
JB
2507 * We are now sure we have an _Lxx or _Exx.
2508 * Create the target name that would cause collision (Flip E/L)
2509 */
2510- ACPI_MOVE_32_TO_32 (Target, Name);
70586bb3 2511+ ACPI_COPY_NAMESEG (Target, Name);
25d7dd99
JB
2512
2513 /* Inject opposite letter ("L" versus "E") */
2514
70586bb3 2515Index: acpica-unix-20209326/source/compiler/asllookup.c
25d7dd99 2516===================================================================
70586bb3
JB
2517--- acpica-unix-20209326.orig/source/compiler/asllookup.c
2518+++ acpica-unix-20209326/source/compiler/asllookup.c
25d7dd99
JB
2519@@ -119,6 +119,7 @@ LkIsObjectUsed (
2520 {
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;
2526 UINT32 i;
2527@@ -175,7 +176,8 @@ LkIsObjectUsed (
2528 * We ignore the predefined methods since often, not
2529 * all arguments are needed or used.
2530 */
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)))
2535 {
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).
2540 */
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);
2548 return (AE_OK);
70586bb3 2549Index: acpica-unix-20209326/source/compiler/aslmain.c
25d7dd99 2550===================================================================
70586bb3
JB
2551--- acpica-unix-20209326.orig/source/compiler/aslmain.c
2552+++ acpica-unix-20209326/source/compiler/aslmain.c
25d7dd99
JB
2553@@ -101,18 +101,6 @@ main (
2554
2555 signal (SIGINT, AslSignalHandler);
2556
2557- /*
2558- * Big-endian machines are not currently supported. ACPI tables must
2559- * be little-endian, and support for big-endian machines needs to
2560- * be implemented.
2561- */
2562- if (UtIsBigEndianMachine ())
2563- {
2564- fprintf (stderr,
2565- "iASL is not currently supported on big-endian machines.\n");
2566- return (-1);
2567- }
2568-
2569 AcpiOsInitialize ();
2570 ACPI_DEBUG_INITIALIZE (); /* For debug version only */
2571
70586bb3 2572Index: acpica-unix-20209326/source/common/acfileio.c
25d7dd99 2573===================================================================
70586bb3
JB
2574--- acpica-unix-20209326.orig/source/common/acfileio.c
2575+++ acpica-unix-20209326/source/common/acfileio.c
25d7dd99
JB
2576@@ -280,6 +280,7 @@ AcGetOneTableFromFile (
2577 ACPI_TABLE_HEADER *Table;
2578 INT32 Count;
2579 long TableOffset;
2580+ UINT32 TableLen;
2581
2582
2583 *ReturnTable = NULL;
2584@@ -319,7 +320,8 @@ AcGetOneTableFromFile (
2585
2586 /* Allocate a buffer for the entire table */
2587
2588- Table = AcpiOsAllocate ((ACPI_SIZE) TableHeader.Length);
2589+ ACPI_MOVE_32_TO_32(&TableLen, &TableHeader.Length);
2590+ Table = AcpiOsAllocate ((ACPI_SIZE) TableLen);
2591 if (!Table)
2592 {
2593 return (AE_NO_MEMORY);
2594@@ -329,13 +331,13 @@ AcGetOneTableFromFile (
2595
2596 fseek (File, TableOffset, SEEK_SET);
2597
2598- Count = fread (Table, 1, TableHeader.Length, File);
2599+ Count = fread (Table, 1, TableLen, File);
2600
2601 /*
2602 * Checks for data table headers happen later in the execution. Only verify
2603 * for Aml tables at this point in the code.
2604 */
2605- if (GetOnlyAmlTables && Count != (INT32) TableHeader.Length)
2606+ if (GetOnlyAmlTables && Count != TableLen)
2607 {
2608 Status = AE_ERROR;
2609 goto ErrorExit;
2610@@ -343,7 +345,7 @@ AcGetOneTableFromFile (
2611
2612 /* Validate the checksum (just issue a warning) */
2613
2614- Status = AcpiTbVerifyChecksum (Table, TableHeader.Length);
2615+ Status = AcpiTbVerifyChecksum (Table, TableLen);
2616 if (ACPI_FAILURE (Status))
2617 {
2618 Status = AcCheckTextModeCorruption (Table);
2619@@ -435,6 +437,7 @@ AcValidateTableHeader (
2620 ACPI_SIZE Actual;
2621 long OriginalOffset;
2622 UINT32 FileSize;
2623+ UINT32 TableLength;
2624 UINT32 i;
2625
2626
2627@@ -464,11 +467,12 @@ AcValidateTableHeader (
2628 /* Validate table length against bytes remaining in the file */
2629
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))
2634 {
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);
2641 }
70586bb3 2642Index: acpica-unix-20209326/source/common/dmtable.c
25d7dd99 2643===================================================================
70586bb3
JB
2644--- acpica-unix-20209326.orig/source/common/dmtable.c
2645+++ acpica-unix-20209326/source/common/dmtable.c
2646@@ -551,7 +551,7 @@ AcpiDmDumpDataTable (
25d7dd99 2647 */
70586bb3 2648 if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_FACS))
25d7dd99
JB
2649 {
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))
2654 {
70586bb3
JB
2655@@ -565,13 +565,14 @@ AcpiDmDumpDataTable (
2656 else if (ACPI_COMPARE_NAMESEG (Table->Signature, ACPI_SIG_S3PT))
25d7dd99
JB
2657 {
2658 Length = AcpiDmDumpS3pt (Table);
2659+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
2660 }
2661 else
2662 {
2663 /*
2664 * All other tables must use the common ACPI table header, dump it now
2665 */
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))
2670 {
70586bb3 2671@@ -782,6 +783,7 @@ AcpiDmDumpTable (
25d7dd99
JB
2672 BOOLEAN LastOutputBlankLine = FALSE;
2673 ACPI_STATUS Status;
2674 char RepairedName[8];
2675+ UINT16 Val16;
2676
2677
2678 if (!Info)
70586bb3 2679@@ -1178,8 +1180,9 @@ AcpiDmDumpTable (
25d7dd99
JB
2680 /* Checksum, display and validate */
2681
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);
2689
2690 if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
70586bb3 2691@@ -1244,14 +1247,14 @@ AcpiDmDumpTable (
25d7dd99
JB
2692
2693 /* DMAR subtable types */
2694
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)
2699 {
2700 Temp16 = ACPI_DMAR_TYPE_RESERVED;
2701 }
2702
2703- AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2704- AcpiDmDmarSubnames[Temp16]);
2705+ AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmDmarSubnames[Temp16]);
2706 break;
2707
2708 case ACPI_DMT_DMAR_SCOPE:
70586bb3 2709@@ -1342,14 +1345,14 @@ AcpiDmDumpTable (
25d7dd99
JB
2710
2711 /* HEST subtable types */
2712
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)
2717 {
2718 Temp16 = ACPI_HEST_TYPE_RESERVED;
2719 }
2720
2721- AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2722- AcpiDmHestSubnames[Temp16]);
2723+ AcpiOsPrintf (UINT16_FORMAT, Temp16, AcpiDmHestSubnames[Temp16]);
2724 break;
2725
2726 case ACPI_DMT_HESTNTFY:
70586bb3 2727@@ -1429,13 +1432,14 @@ AcpiDmDumpTable (
25d7dd99
JB
2728
2729 /* NFIT subtable types */
2730
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)
2735 {
2736 Temp16 = ACPI_NFIT_TYPE_RESERVED;
2737 }
2738
2739- AcpiOsPrintf (UINT16_FORMAT, ACPI_GET16 (Target),
2740+ AcpiOsPrintf (UINT16_FORMAT, Temp16,
2741 AcpiDmNfitSubnames[Temp16]);
2742 break;
2743
70586bb3 2744Index: acpica-unix-20209326/source/common/dmtables.c
25d7dd99 2745===================================================================
70586bb3
JB
2746--- acpica-unix-20209326.orig/source/common/dmtables.c
2747+++ acpica-unix-20209326/source/common/dmtables.c
25d7dd99
JB
2748@@ -142,7 +142,9 @@ AdCreateTableHeader (
2749 ACPI_TABLE_HEADER *Table)
2750 {
2751 UINT8 Checksum;
2752-
2753+ UINT32 TableLen;
2754+ UINT32 OemRev;
2755+ UINT32 CompilerRev;
2756
2757 /* Reset globals for External statements */
2758
2759@@ -154,9 +156,10 @@ AdCreateTableHeader (
2760 */
2761 AdDisassemblerHeader (Filename, ACPI_IS_AML_TABLE);
2762
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);
2768
2769 /* Print and validate the revision */
2770
2771@@ -188,7 +191,7 @@ AdCreateTableHeader (
2772
2773 AcpiOsPrintf ("\n * Checksum 0x%2.2X", Table->Checksum);
2774
2775- Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length);
2776+ Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), TableLen);
2777 if (Checksum)
2778 {
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");
2792
2793 /*
2794@@ -221,7 +226,7 @@ AdCreateTableHeader (
2795 AcpiOsPrintf (
70586bb3 2796 "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
25d7dd99
JB
2797 Table->Signature, Table->Revision,
2798- Table->OemId, Table->OemTableId, Table->OemRevision);
2799+ Table->OemId, Table->OemTableId, OemRev);
2800 }
2801
2802
2803@@ -396,7 +401,8 @@ AdParseTable (
2804
2805 fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
2806
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));
25d7dd99 2811
70586bb3
JB
2812 AcpiUtSetIntegerWidth (Table->Revision);
2813Index: acpica-unix-20209326/source/compiler/dtfield.c
25d7dd99 2814===================================================================
70586bb3
JB
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);
2819 }
25d7dd99 2820
70586bb3
JB
2821- memcpy (Buffer, &Value, ByteLength);
2822+ switch (ByteLength) {
2823+ case 1:
2824+ ACPI_MOVE_64_TO_8(Buffer, &Value);
2825+ break;
2826+
2827+ case 2:
2828+ ACPI_MOVE_64_TO_16(Buffer, &Value);
2829+ break;
2830+
2831+ case 4:
2832+ ACPI_MOVE_64_TO_32(Buffer, &Value);
2833+ break;
2834+
2835+ case 8:
2836+ ACPI_MOVE_64_TO_64(Buffer, &Value);
2837+ break;
2838+
2839+ default:
2840+ memcpy (Buffer, &Value, ByteLength);
2841+ break;
2842+ }
2843 return;
2844 }
25d7dd99 2845
70586bb3
JB
2846Index: 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 (
2851 return;
2852 }
25d7dd99 2853
70586bb3
JB
2854- memcpy (Subtable->LengthField, &Subtable->TotalLength,
2855- Subtable->SizeOfLengthField);
2856+ switch(Subtable->SizeOfLengthField) {
2857+ case 1:
2858+ ACPI_MOVE_32_TO_8(Subtable->LengthField, &Subtable->TotalLength);
2859+ break;
2860+
2861+ case 2:
2862+ ACPI_MOVE_32_TO_16(Subtable->LengthField, &Subtable->TotalLength);
2863+ break;
2864+
2865+ case 4:
2866+ ACPI_MOVE_32_TO_32(Subtable->LengthField, &Subtable->TotalLength);
2867+ break;
2868+
2869+ default:
2870+ memcpy (Subtable->LengthField, &Subtable->TotalLength,
2871+ Subtable->SizeOfLengthField);
2872+ }
2873 }
2874Index: 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;
2881 UINT32 GroupLength;
2882+ ACPI_CSRT_GROUP *Pgrp;
2883+ UINT32 Tmp32;
25d7dd99 2884
25d7dd99 2885
70586bb3
JB
2886 /* Subtables (Resource Groups) */
2887@@ -299,12 +301,20 @@ DtCompileCsrt (
2888
2889 /* Compute the number of resource descriptors */
2890
2891+ /*
2892 GroupLength =
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);
2898+ */
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);
2905
2906 DescriptorCount = (GroupLength /
2907 sizeof (ACPI_CSRT_DESCRIPTOR));
2908@@ -392,6 +402,8 @@ DtCompileDbg2 (
2909 ACPI_DBG2_DEVICE *DeviceInfo;
2910 UINT16 CurrentOffset;
25d7dd99 2911 UINT32 i;
70586bb3
JB
2912+ UINT16 Tmp16;
2913+ UINT32 Tmp32;
25d7dd99
JB
2914
2915
70586bb3
JB
2916 /* Main table */
2917@@ -408,10 +420,11 @@ DtCompileDbg2 (
2918 /* Main table fields */
25d7dd99 2919
70586bb3
JB
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);
25d7dd99 2925
70586bb3
JB
2926- SubtableCount = Dbg2Header->InfoCount;
2927+ ACPI_MOVE_32_TO_32(&SubtableCount, &Dbg2Header->InfoCount);
2928 DtPushSubtable (Subtable);
25d7dd99 2929
70586bb3
JB
2930 /* Process all Device Information subtables (Count = InfoCount) */
2931@@ -438,7 +451,7 @@ DtCompileDbg2 (
25d7dd99 2932
70586bb3 2933 /* BaseAddressRegister GAS array (Required, size is RegisterCount) */
25d7dd99 2934
70586bb3
JB
2935- DeviceInfo->BaseAddressOffset = CurrentOffset;
2936+ ACPI_MOVE_16_TO_16(&DeviceInfo->BaseAddressOffset, &CurrentOffset);
2937 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
2938 {
2939 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Addr,
2940@@ -454,7 +467,7 @@ DtCompileDbg2 (
25d7dd99 2941
70586bb3 2942 /* AddressSize array (Required, size = RegisterCount) */
25d7dd99 2943
70586bb3
JB
2944- DeviceInfo->AddressSizeOffset = CurrentOffset;
2945+ ACPI_MOVE_16_TO_16(&DeviceInfo->AddressSizeOffset, &CurrentOffset);
2946 for (i = 0; *PFieldList && (i < DeviceInfo->RegisterCount); i++)
25d7dd99 2947 {
70586bb3
JB
2948 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Size,
2949@@ -470,7 +483,7 @@ DtCompileDbg2 (
25d7dd99 2950
70586bb3 2951 /* NamespaceString device identifier (Required, size = NamePathLength) */
25d7dd99 2952
70586bb3
JB
2953- DeviceInfo->NamepathOffset = CurrentOffset;
2954+ ACPI_MOVE_16_TO_16(&DeviceInfo->NamepathOffset, &CurrentOffset);
2955 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2Name,
2956 &Subtable);
25d7dd99 2957 if (ACPI_FAILURE (Status))
70586bb3 2958@@ -480,8 +493,9 @@ DtCompileDbg2 (
25d7dd99 2959
70586bb3 2960 /* Update the device info header */
25d7dd99 2961
70586bb3
JB
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);
25d7dd99 2968
70586bb3
JB
2969 /* OemData - Variable-length data (Optional, size = OemDataLength) */
2970@@ -508,8 +522,8 @@ DtCompileDbg2 (
25d7dd99 2971
70586bb3 2972 if (Subtable && Subtable->Length)
25d7dd99 2973 {
70586bb3
JB
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);
25d7dd99 2978
70586bb3
JB
2979 DtInsertSubtable (ParentTable, Subtable);
2980 }
2981@@ -549,6 +563,8 @@ DtCompileDmar (
2982 ACPI_DMAR_DEVICE_SCOPE *DmarDeviceScope;
2983 UINT32 DeviceScopeLength;
2984 UINT32 PciPathLength;
2985+ UINT16 Tmp16;
2986+ UINT16 HdrType;
25d7dd99 2987
25d7dd99 2988
70586bb3
JB
2989 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmar, &Subtable);
2990@@ -578,8 +594,11 @@ DtCompileDmar (
2991 DtPushSubtable (Subtable);
25d7dd99 2992
70586bb3
JB
2993 DmarHeader = ACPI_CAST_PTR (ACPI_DMAR_HEADER, Subtable->Buffer);
2994+ ACPI_MOVE_16_TO_16(&Tmp16, &DmarHeader->Length);
2995+ DmarHeader->Length = Tmp16;
25d7dd99 2996
70586bb3
JB
2997- switch (DmarHeader->Type)
2998+ ACPI_MOVE_16_TO_16(&HdrType, &DmarHeader->Type);
2999+ switch (HdrType)
3000 {
3001 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
25d7dd99 3002
70586bb3
JB
3003@@ -626,8 +645,8 @@ DtCompileDmar (
3004 /*
3005 * Optional Device Scope subtables
3006 */
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))
3011 {
3012 /* These types do not support device scopes */
25d7dd99 3013
70586bb3 3014@@ -637,7 +656,7 @@ DtCompileDmar (
25d7dd99 3015
70586bb3
JB
3016 DtPushSubtable (Subtable);
3017 DeviceScopeLength = DmarHeader->Length - Subtable->Length -
3018- ParentTable->Length;
3019+ ParentTable->Length;
3020 while (DeviceScopeLength)
3021 {
3022 Status = DtCompileTable (PFieldList, AcpiDmTableInfoDmarScope,
3023@@ -762,7 +781,7 @@ DtCompileDrtm (
3024 Count++;
25d7dd99
JB
3025 }
3026
70586bb3
JB
3027- DrtmVtl->ValidatedTableCount = Count;
3028+ ACPI_MOVE_32_TO_32(&DrtmVtl->ValidatedTableCount, &Count);
3029 DtPopSubtable ();
3030 ParentTable = DtPeekSubtable ();
3031
3032@@ -800,7 +819,7 @@ DtCompileDrtm (
3033 Count++;
25d7dd99 3034 }
25d7dd99 3035
70586bb3
JB
3036- DrtmRl->ResourceCount = Count;
3037+ ACPI_MOVE_32_TO_32(&DrtmRl->ResourceCount, &Count);
3038 DtPopSubtable ();
3039 ParentTable = DtPeekSubtable ();
25d7dd99 3040
70586bb3
JB
3041@@ -895,6 +914,7 @@ DtCompileGtdt (
3042 ACPI_DMTABLE_INFO *InfoTable;
3043 UINT32 GtCount;
3044 ACPI_TABLE_HEADER *Header;
3045+ ACPI_GTDT_TIMER_BLOCK *TimerBlock;
25d7dd99 3046
25d7dd99 3047
70586bb3
JB
3048 ParentTable = DtPeekSubtable ();
3049@@ -982,8 +1002,9 @@ DtCompileGtdt (
3050 DtPushSubtable (Subtable);
3051 ParentTable = DtPeekSubtable ();
25d7dd99 3052
70586bb3
JB
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);
3058
3059 while (GtCount)
25d7dd99 3060 {
70586bb3
JB
3061@@ -1036,6 +1057,7 @@ DtCompileFpdt (
3062 ACPI_DMTABLE_INFO *InfoTable;
3063 DT_FIELD **PFieldList = (DT_FIELD **) List;
3064 DT_FIELD *SubtableStart;
3065+ UINT16 HdrType;
25d7dd99 3066
25d7dd99 3067
70586bb3
JB
3068 while (*PFieldList)
3069@@ -1054,7 +1076,8 @@ DtCompileFpdt (
25d7dd99 3070
70586bb3 3071 FpdtHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
25d7dd99 3072
70586bb3
JB
3073- switch (FpdtHeader->Type)
3074+ ACPI_MOVE_16_TO_16(&HdrType, &FpdtHeader->Type);
3075+ switch (HdrType)
3076 {
3077 case ACPI_FPDT_TYPE_BOOT:
25d7dd99 3078
70586bb3
JB
3079@@ -1112,6 +1135,7 @@ DtCompileHest (
3080 ACPI_DMTABLE_INFO *InfoTable;
3081 UINT16 Type;
3082 UINT32 BankCount;
3083+ UINT16 Tmp16;
25d7dd99 3084
25d7dd99 3085
70586bb3
JB
3086 Status = DtCompileTable (PFieldList, AcpiDmTableInfoHest,
3087@@ -1129,8 +1153,9 @@ DtCompileHest (
3088 /* Get subtable type */
25d7dd99 3089
70586bb3
JB
3090 SubtableStart = *PFieldList;
3091- DtCompileInteger ((UINT8 *) &Type, *PFieldList, 2, 0);
3092+ DtCompileInteger ((UINT8 *) &Tmp16, *PFieldList, 2, 0);
25d7dd99 3093
70586bb3
JB
3094+ ACPI_MOVE_16_TO_16(&Type, &Tmp16);
3095 switch (Type)
3096 {
3097 case ACPI_HEST_TYPE_IA32_CHECK:
3098@@ -1480,11 +1505,13 @@ DtCompileIort (
3099 ACPI_IORT_SMMU *IortSmmu;
3100 UINT32 NodeNumber;
3101 UINT32 NodeLength;
3102+ UINT32 NodeOffset;
3103 UINT32 IdMappingNumber;
3104 UINT32 ItsNumber;
3105 UINT32 ContextIrptNumber;
3106 UINT32 PmuIrptNumber;
3107 UINT32 PaddingLength;
3108+ UINT32 MappingOffset;
25d7dd99 3109
25d7dd99 3110
70586bb3
JB
3111 ParentTable = DtPeekSubtable ();
3112@@ -1510,7 +1537,7 @@ DtCompileIort (
3113 * Optionally allows the generic data types to be used for filling
3114 * this field.
3115 */
3116- Iort->NodeOffset = sizeof (ACPI_TABLE_IORT);
3117+ NodeOffset = sizeof (ACPI_TABLE_IORT);
3118 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIortPad,
3119 &Subtable);
3120 if (ACPI_FAILURE (Status))
3121@@ -1520,7 +1547,7 @@ DtCompileIort (
3122 if (Subtable)
3123 {
3124 DtInsertSubtable (ParentTable, Subtable);
3125- Iort->NodeOffset += Subtable->Length;
3126+ NodeOffset += Subtable->Length;
3127 }
3128 else
3129 {
3130@@ -1530,8 +1557,9 @@ DtCompileIort (
25d7dd99 3131 {
70586bb3 3132 return (Status);
25d7dd99 3133 }
70586bb3
JB
3134- Iort->NodeOffset += PaddingLength;
3135+ NodeOffset += PaddingLength;
3136 }
3137+ ACPI_MOVE_32_TO_32(&Iort->NodeOffset, &NodeOffset);
25d7dd99 3138
70586bb3
JB
3139 NodeNumber = 0;
3140 while (*PFieldList)
3141@@ -1585,7 +1613,7 @@ DtCompileIort (
3142 ItsNumber++;
3143 }
25d7dd99 3144
70586bb3
JB
3145- IortItsGroup->ItsCount = ItsNumber;
3146+ ACPI_MOVE_32_TO_32(&IortItsGroup->ItsCount, &ItsNumber);
3147 break;
25d7dd99 3148
70586bb3
JB
3149 case ACPI_IORT_NODE_NAMED_COMPONENT:
3150@@ -1619,15 +1647,16 @@ DtCompileIort (
3151 }
3152 else
25d7dd99 3153 {
70586bb3
JB
3154- if (NodeLength > IortNode->MappingOffset)
3155+ ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
3156+ if (NodeLength > MappingOffset)
3157 {
3158 return (AE_BAD_DATA);
3159 }
25d7dd99 3160
70586bb3
JB
3161- if (NodeLength < IortNode->MappingOffset)
3162+ if (NodeLength < MappingOffset)
3163 {
3164 Status = DtCompilePadding (
3165- IortNode->MappingOffset - NodeLength,
3166+ MappingOffset - NodeLength,
3167 &Subtable);
3168 if (ACPI_FAILURE (Status))
3169 {
3170@@ -1635,7 +1664,8 @@ DtCompileIort (
3171 }
25d7dd99 3172
70586bb3
JB
3173 DtInsertSubtable (ParentTable, Subtable);
3174- NodeLength = IortNode->MappingOffset;
3175+ ACPI_MOVE_32_TO_32(&MappingOffset, &IortNode->MappingOffset);
3176+ NodeLength = MappingOffset;
3177 }
3178 }
3179 break;
3180@@ -1668,7 +1698,7 @@ DtCompileIort (
25d7dd99 3181
70586bb3 3182 /* Compile global interrupt array */
25d7dd99 3183
70586bb3
JB
3184- IortSmmu->GlobalInterruptOffset = NodeLength;
3185+ ACPI_MOVE_32_TO_32(&IortSmmu->GlobalInterruptOffset, &NodeLength);
3186 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3a,
3187 &Subtable);
3188 if (ACPI_FAILURE (Status))
3189@@ -1682,7 +1712,7 @@ DtCompileIort (
3190 /* Compile context interrupt array */
25d7dd99 3191
70586bb3
JB
3192 ContextIrptNumber = 0;
3193- IortSmmu->ContextInterruptOffset = NodeLength;
3194+ ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptOffset, &NodeLength);
3195 while (*PFieldList)
3196 {
3197 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3b,
3198@@ -1702,12 +1732,12 @@ DtCompileIort (
3199 ContextIrptNumber++;
3200 }
25d7dd99 3201
70586bb3
JB
3202- IortSmmu->ContextInterruptCount = ContextIrptNumber;
3203+ ACPI_MOVE_32_TO_32(&IortSmmu->ContextInterruptCount, &ContextIrptNumber);
25d7dd99 3204
70586bb3 3205 /* Compile PMU interrupt array */
25d7dd99 3206
70586bb3
JB
3207 PmuIrptNumber = 0;
3208- IortSmmu->PmuInterruptOffset = NodeLength;
3209+ ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptOffset, &NodeLength);
3210 while (*PFieldList)
3211 {
3212 Status = DtCompileTable (PFieldList, AcpiDmTableInfoIort3c,
3213@@ -1727,7 +1757,7 @@ DtCompileIort (
3214 PmuIrptNumber++;
3215 }
25d7dd99 3216
70586bb3
JB
3217- IortSmmu->PmuInterruptCount = PmuIrptNumber;
3218+ ACPI_MOVE_32_TO_32(&IortSmmu->PmuInterruptCount, &PmuIrptNumber);
3219 break;
25d7dd99 3220
70586bb3
JB
3221 case ACPI_IORT_NODE_SMMU_V3:
3222@@ -1764,7 +1794,7 @@ DtCompileIort (
25d7dd99 3223
70586bb3 3224 /* Compile Array of ID mappings */
25d7dd99 3225
70586bb3
JB
3226- IortNode->MappingOffset = NodeLength;
3227+ ACPI_MOVE_32_TO_32(&IortNode->MappingOffset, &NodeLength);
3228 IdMappingNumber = 0;
3229 while (*PFieldList)
25d7dd99 3230 {
70586bb3
JB
3231@@ -1785,7 +1815,7 @@ DtCompileIort (
3232 IdMappingNumber++;
3233 }
25d7dd99 3234
70586bb3
JB
3235- IortNode->MappingCount = IdMappingNumber;
3236+ ACPI_MOVE_32_TO_32(&IortNode->MappingCount, &IdMappingNumber);
3237 if (!IdMappingNumber)
25d7dd99 3238 {
70586bb3
JB
3239 IortNode->MappingOffset = 0;
3240@@ -1800,7 +1830,7 @@ DtCompileIort (
3241 NodeNumber++;
3242 }
25d7dd99 3243
70586bb3
JB
3244- Iort->NodeCount = NodeNumber;
3245+ ACPI_MOVE_32_TO_32(&Iort->NodeCount, &NodeNumber);
3246 return (AE_OK);
3247 }
25d7dd99 3248
70586bb3
JB
3249Index: 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);
25d7dd99 3255
70586bb3
JB
3256 MpstChannelInfo = ACPI_CAST_PTR (ACPI_MPST_CHANNEL, Subtable->Buffer);
3257- SubtableCount = MpstChannelInfo->PowerNodeCount;
3258+ ACPI_MOVE_16_TO_16(&SubtableCount, &MpstChannelInfo->PowerNodeCount);
25d7dd99 3259
70586bb3
JB
3260 while (*PFieldList && SubtableCount)
3261 {
3262@@ -363,8 +363,8 @@ DtCompileMpst (
3263 DtPushSubtable (Subtable);
25d7dd99 3264
70586bb3
JB
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);
25d7dd99 3270
70586bb3 3271 ParentTable = DtPeekSubtable ();
25d7dd99 3272
70586bb3
JB
3273@@ -517,6 +517,7 @@ DtCompileNfit (
3274 UINT32 Count;
3275 ACPI_NFIT_INTERLEAVE *Interleave = NULL;
3276 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
25d7dd99
JB
3277+ UINT16 SubType;
3278
3279
3280 /* Main table */
70586bb3 3281@@ -550,7 +551,8 @@ DtCompileNfit (
25d7dd99 3282
70586bb3 3283 NfitHeader = ACPI_CAST_PTR (ACPI_NFIT_HEADER, Subtable->Buffer);
25d7dd99 3284
70586bb3
JB
3285- switch (NfitHeader->Type)
3286+ ACPI_MOVE_16_TO_16(&SubType, &NfitHeader->Type);
3287+ switch (SubType)
25d7dd99 3288 {
70586bb3 3289 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
25d7dd99 3290
70586bb3
JB
3291@@ -610,7 +612,7 @@ DtCompileNfit (
3292 DtInsertSubtable (ParentTable, Subtable);
3293 DtPopSubtable ();
25d7dd99 3294
70586bb3 3295- switch (NfitHeader->Type)
25d7dd99
JB
3296+ switch (SubType)
3297 {
70586bb3 3298 case ACPI_NFIT_TYPE_INTERLEAVE:
25d7dd99 3299
70586bb3
JB
3300@@ -636,7 +638,7 @@ DtCompileNfit (
3301 Count++;
3302 }
25d7dd99 3303
70586bb3
JB
3304- Interleave->LineCount = Count;
3305+ ACPI_MOVE_32_TO_32(&Interleave->LineCount, &Count);
3306 break;
25d7dd99 3307
70586bb3
JB
3308 case ACPI_NFIT_TYPE_SMBIOS:
3309@@ -681,7 +683,7 @@ DtCompileNfit (
3310 Count++;
3311 }
25d7dd99 3312
70586bb3
JB
3313- Hint->HintCount = (UINT16) Count;
3314+ ACPI_MOVE_32_TO_16(&Hint->HintCount, &Count);
3315 break;
25d7dd99 3316
70586bb3
JB
3317 default:
3318@@ -957,7 +959,7 @@ DtCompilePmtt (
25d7dd99 3319
70586bb3
JB
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);
25d7dd99 3324
70586bb3
JB
3325 while (DomainCount)
3326 {
3327@@ -1177,6 +1179,7 @@ DtCompileS3pt (
3328 DT_SUBTABLE *ParentTable;
3329 ACPI_DMTABLE_INFO *InfoTable;
3330 DT_FIELD *SubtableStart;
3331+ UINT16 HdrType;
25d7dd99
JB
3332
3333
70586bb3
JB
3334 Status = DtCompileTable (PFieldList, AcpiDmTableInfoS3pt,
3335@@ -1204,7 +1207,8 @@ DtCompileS3pt (
25d7dd99 3336
70586bb3 3337 S3ptHeader = ACPI_CAST_PTR (ACPI_FPDT_HEADER, Subtable->Buffer);
25d7dd99 3338
70586bb3
JB
3339- switch (S3ptHeader->Type)
3340+ ACPI_MOVE_16_TO_16(&HdrType, &S3ptHeader->Type);
3341+ switch (HdrType)
3342 {
3343 case ACPI_S3PT_TYPE_RESUME:
25d7dd99 3344
70586bb3
JB
3345@@ -1517,6 +1521,7 @@ DtCompileSlit (
3346 UINT32 Localities;
3347 UINT32 LocalityListLength;
3348 UINT8 *LocalityBuffer;
3349+ UINT32 Tmp;
25d7dd99 3350
25d7dd99 3351
70586bb3
JB
3352 Status = DtCompileTable (PFieldList, AcpiDmTableInfoSlit,
3353@@ -1529,7 +1534,8 @@ DtCompileSlit (
3354 ParentTable = DtPeekSubtable ();
3355 DtInsertSubtable (ParentTable, Subtable);
25d7dd99 3356
70586bb3
JB
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;
25d7dd99 3362
70586bb3
JB
3363@@ -1741,6 +1747,7 @@ DtCompileTcpa (
3364 ACPI_TABLE_TCPA_HDR *TcpaHeader;
3365 DT_SUBTABLE *ParentTable;
25d7dd99 3366 ACPI_STATUS Status;
70586bb3 3367+ UINT16 PlatClass;
25d7dd99
JB
3368
3369
70586bb3
JB
3370 /* Compile the main table */
3371@@ -1761,7 +1768,8 @@ DtCompileTcpa (
3372 */
3373 TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);
25d7dd99 3374
70586bb3
JB
3375- switch (TcpaHeader->PlatformClass)
3376+ ACPI_MOVE_16_TO_16(&PlatClass, &TcpaHeader->PlatformClass);
3377+ switch (PlatClass)
25d7dd99 3378 {
70586bb3 3379 case ACPI_TCPA_CLIENT_TABLE:
25d7dd99 3380
70586bb3
JB
3381@@ -1809,6 +1817,7 @@ DtCompileTpm2Rev3 (
3382 ACPI_TABLE_TPM23 *Tpm23Header;
3383 DT_SUBTABLE *ParentTable;
3384 ACPI_STATUS Status = AE_OK;
3385+ UINT32 Tmp32;
25d7dd99
JB
3386
3387
70586bb3
JB
3388 Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm23,
3389@@ -1820,7 +1829,8 @@ DtCompileTpm2Rev3 (
25d7dd99 3390
70586bb3 3391 /* Subtable type depends on the StartMethod */
25d7dd99 3392
70586bb3
JB
3393- switch (Tpm23Header->StartMethod)
3394+ ACPI_MOVE_32_TO_32(&Tmp32, &Tpm23Header->StartMethod);
3395+ switch (Tmp32)
25d7dd99 3396 {
70586bb3 3397 case ACPI_TPM23_ACPI_START_METHOD:
25d7dd99 3398
70586bb3
JB
3399@@ -1867,6 +1877,7 @@ DtCompileTpm2 (
3400 DT_SUBTABLE *ParentTable;
3401 ACPI_STATUS Status = AE_OK;
3402 ACPI_TABLE_HEADER *Header;
3403+ UINT32 Tmp32;
25d7dd99 3404
25d7dd99 3405
70586bb3
JB
3406 ParentTable = DtPeekSubtable ();
3407@@ -1910,7 +1921,8 @@ DtCompileTpm2 (
25d7dd99 3408
70586bb3
JB
3409 /* Subtable type depends on the StartMethod */
3410
3411- switch (Tpm2Header->StartMethod)
3412+ ACPI_MOVE_32_TO_32(&Tmp32, &Tpm2Header->StartMethod);
3413+ switch (Tmp32)
25d7dd99 3414 {
70586bb3 3415 case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC:
25d7dd99 3416
70586bb3
JB
3417@@ -2126,6 +2138,9 @@ DtCompileWpbt (
3418 ACPI_TABLE_WPBT *Table;
3419 ACPI_STATUS Status;
3420 UINT16 Length;
3421+ UINT16 Tmp16;
3422+ UINT16 *Ptr16;
3423+ UINT32 ii;
25d7dd99 3424
25d7dd99 3425
70586bb3
JB
3426 /* Compile the main table */
3427@@ -2153,7 +2168,16 @@ DtCompileWpbt (
25d7dd99 3428
70586bb3
JB
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);
3433+
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++)
3437+ {
3438+ ACPI_MOVE_16_TO_16(&Tmp16, Ptr16);
3439+ *Ptr16 = Tmp16;
3440+ Ptr16++;
3441+ }
25d7dd99 3442
70586bb3
JB
3443 ParentTable = DtPeekSubtable ();
3444 DtInsertSubtable (ParentTable, Subtable);
3445Index: 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 (
25d7dd99 3450
25d7dd99 3451
70586bb3
JB
3452 ByteData = Op->Named.Data;
3453- ByteCount = (UINT32) Op->Common.Value.Integer;
3454+ ByteCount = (UINT32) Op->Common.Value.Size;
25d7dd99 3455
70586bb3
JB
3456 /*
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 */
25d7dd99 3460
70586bb3
JB
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;
25d7dd99 3465
70586bb3 3466 /* Byte count must be exactly 16 */
25d7dd99 3467
70586bb3
JB
3468@@ -424,7 +425,8 @@ AcpiDmIsUnicodeBuffer (
3469 /* Extract the byte list info */
25d7dd99 3470
70586bb3
JB
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);
25d7dd99 3476
70586bb3
JB
3477 /*
3478@@ -852,19 +854,22 @@ AcpiDmUnicode (
3479 UINT32 WordCount;
3480 UINT32 i;
3481 int OutputValue;
3482+ UINT16 Tmp16;
25d7dd99 3483
25d7dd99 3484
70586bb3 3485 /* Extract the buffer info as a WORD buffer */
25d7dd99 3486
70586bb3
JB
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));
25d7dd99 3490
70586bb3 3491 /* Write every other byte as an ASCII character */
25d7dd99 3492
70586bb3
JB
3493 AcpiOsPrintf ("\"");
3494 for (i = 0; i < (WordCount - 1); i++)
25d7dd99 3495 {
70586bb3
JB
3496- OutputValue = (int) WordData[i];
3497+ /* OutputValue = (int) WordData[i]; */
3498+ ACPI_MOVE_16_TO_16(&Tmp16, &WordData[i]);
3499+ OutputValue = (int) Tmp16;
25d7dd99 3500
70586bb3 3501 /* Handle values that must be escaped */
25d7dd99 3502
70586bb3
JB
3503@@ -973,16 +978,18 @@ AcpiDmCheckForHardwareId (
3504 ACPI_PARSE_OBJECT *Op)
3505 {
3506 UINT32 Name;
3507+ UINT32 TmpName;
3508 ACPI_PARSE_OBJECT *NextOp;
25d7dd99 3509
25d7dd99 3510
70586bb3 3511 /* Get the NameSegment */
25d7dd99 3512
70586bb3
JB
3513- Name = AcpiPsGetName (Op);
3514- if (!Name)
3515+ TmpName = AcpiPsGetName (Op);
3516+ if (!TmpName)
25d7dd99 3517 {
70586bb3 3518 return;
25d7dd99 3519 }
70586bb3 3520+ ACPI_MOVE_32_TO_32(&Name, &TmpName);
25d7dd99 3521
70586bb3
JB
3522 NextOp = AcpiPsGetDepthNext (NULL, Op);
3523 if (!NextOp)
3524Index: 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 (
3529 char *NameString;
3530 int LastCharIsDigit;
3531 int LastCharsAreHex;
3532+ char TmpName[ACPI_NAMESEG_SIZE + 1];
25d7dd99 3533
25d7dd99 3534
70586bb3
JB
3535 if (!Op)
3536@@ -261,7 +262,9 @@ AcpiDmPredefinedDescription (
25d7dd99 3537
70586bb3 3538 /* Predefined name must start with an underscore */
25d7dd99 3539
70586bb3
JB
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] != '_')
3545 {
3546 return;
3547@@ -880,25 +883,29 @@ AcpiDmDisassembleOneOp (
3548 AcpiDmNamestring (Op->Common.Value.Name);
3549 break;
25d7dd99 3550
70586bb3
JB
3551- case AML_INT_NAMEDFIELD_OP:
3552+ case AML_INT_NAMEDFIELD_OP: {
25d7dd99 3553
70586bb3
JB
3554- Length = AcpiDmDumpName (Op->Named.Name);
3555+ UINT32 TmpName;
3556+
3557+ ACPI_MOVE_32_TO_32(&TmpName, &Op->Named.Name);
3558+ Length = AcpiDmDumpName (TmpName);
25d7dd99 3559
70586bb3
JB
3560 AcpiOsPrintf (",");
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);
25d7dd99 3565
70586bb3 3566 AcpiDmCommaIfFieldMember (Op);
25d7dd99 3567
70586bb3
JB
3568- Info->BitOffset += (UINT32) Op->Common.Value.Integer;
3569+ Info->BitOffset += (UINT32) Op->Common.Value.Size;
3570 break;
3571+ }
25d7dd99 3572
70586bb3 3573 case AML_INT_RESERVEDFIELD_OP:
25d7dd99 3574
70586bb3 3575 /* Offset() -- Must account for previous offsets */
25d7dd99 3576
70586bb3
JB
3577- Offset = (UINT32) Op->Common.Value.Integer;
3578+ Offset = Op->Common.Value.Size;
3579 Info->BitOffset += Offset;
25d7dd99 3580
70586bb3
JB
3581 if (Info->BitOffset % 8 == 0)
3582@@ -942,10 +949,15 @@ AcpiDmDisassembleOneOp (
25d7dd99 3583
70586bb3
JB
3584 if (Child->Common.AmlOpcode == AML_INT_BYTELIST_OP)
3585 {
3586+ /* UINT64 Tmp64; */
3587+
3588 AcpiOsPrintf ("\n");
25d7dd99 3589
70586bb3
JB
3590 Aml = Child->Named.Data;
3591+ /*
3592 Length = (UINT32) Child->Common.Value.Integer;
3593+ */
3594+ Length = (UINT32) Child->Common.Value.Size;
25d7dd99 3595
70586bb3
JB
3596 Info->Level += 1;
3597 Info->MappingOp = Op;
3598Index: 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 (
3603 UINT32 Level)
3604 {
3605 UINT32 i;
3606-
3607+ UINT16 Tmp16;
3608+ UINT32 Tmp32;
25d7dd99 3609
70586bb3
JB
3610 for (i = 0; i < 4; i++)
3611 {
3612@@ -151,14 +152,14 @@ AcpiDmMemoryFields (
3613 {
3614 case 16:
25d7dd99 3615
70586bb3
JB
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]);
3620 break;
25d7dd99 3621
70586bb3 3622 case 32:
25d7dd99 3623
70586bb3
JB
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]);
3628 break;
25d7dd99 3629
70586bb3
JB
3630 default:
3631@@ -190,7 +191,9 @@ AcpiDmAddressFields (
3632 UINT32 Level)
3633 {
3634 UINT32 i;
3635-
3636+ UINT16 Tmp16;
3637+ UINT32 Tmp32;
3638+ UINT64 Tmp64;
25d7dd99 3639
70586bb3
JB
3640 AcpiOsPrintf ("\n");
3641
3642@@ -202,20 +205,20 @@ AcpiDmAddressFields (
25d7dd99 3643 {
70586bb3 3644 case 16:
25d7dd99 3645
70586bb3
JB
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]);
3650 break;
25d7dd99 3651
70586bb3 3652 case 32:
25d7dd99 3653
70586bb3
JB
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]);
3658 break;
25d7dd99 3659
70586bb3 3660 case 64:
25d7dd99 3661
70586bb3
JB
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]);
3666 break;
25d7dd99 3667
70586bb3
JB
3668 default:
3669@@ -868,6 +871,7 @@ AcpiDmFixedMemory32Descriptor (
3670 UINT32 Length,
3671 UINT32 Level)
3672 {
3673+ UINT32 Tmp;
25d7dd99 3674
70586bb3 3675 /* Dump name and read/write flag */
25d7dd99 3676
70586bb3
JB
3677@@ -876,12 +880,12 @@ AcpiDmFixedMemory32Descriptor (
3678 AcpiGbl_RwDecode [ACPI_GET_1BIT_FLAG (Resource->FixedMemory32.Flags)]);
25d7dd99 3679
70586bb3
JB
3680 AcpiDmIndent (Level + 1);
3681- AcpiDmDumpInteger32 (Resource->FixedMemory32.Address,
3682- "Address Base");
3683+ ACPI_MOVE_32_TO_32(&Tmp, &Resource->FixedMemory32.Address);
3684+ AcpiDmDumpInteger32 (Tmp, "Address Base");
25d7dd99 3685
70586bb3
JB
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");
25d7dd99 3691
70586bb3 3692 /* Insert a descriptor name */
25d7dd99 3693
70586bb3
JB
3694@@ -913,6 +917,7 @@ AcpiDmGenericRegisterDescriptor (
3695 UINT32 Length,
3696 UINT32 Level)
3697 {
3698+ UINT64 Tmp64;
25d7dd99 3699
70586bb3
JB
3700 AcpiDmIndent (Level);
3701 AcpiOsPrintf ("Register (");
3702@@ -926,7 +931,9 @@ AcpiDmGenericRegisterDescriptor (
3703 AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
25d7dd99 3704
70586bb3
JB
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");
25d7dd99 3710
70586bb3 3711 /* Optional field for ACPI 3.0 */
25d7dd99 3712
70586bb3
JB
3713@@ -972,7 +979,7 @@ AcpiDmInterruptDescriptor (
3714 UINT32 Level)
3715 {
3716 UINT32 i;
3717-
3718+ UINT16 Tmp16;
25d7dd99 3719
70586bb3
JB
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)
3725 */
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);
3731+ Tmp16);
25d7dd99 3732
70586bb3 3733 /* Insert a descriptor name */
25d7dd99 3734
70586bb3
JB
3735@@ -1002,9 +1010,12 @@ AcpiDmInterruptDescriptor (
3736 AcpiOsPrintf ("{\n");
3737 for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
25d7dd99 3738 {
70586bb3
JB
3739+ UINT32 Tmp32, Val32;
3740+
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);
3747 }
25d7dd99 3748
70586bb3
JB
3749 AcpiDmIndent (Level);
3750Index: 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;
3756 UINT32 PinCount;
3757 UINT32 i;
3758+ UINT16 Tmp16;
25d7dd99
JB
3759
3760
70586bb3 3761 /* ResourceSource, ResourceSourceIndex, ResourceType */
25d7dd99 3762
70586bb3
JB
3763 AcpiDmIndent (Level + 1);
3764- if (Resource->Gpio.ResSourceOffset)
3765+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.ResSourceOffset);
3766+ if (Tmp16)
25d7dd99 3767 {
70586bb3
JB
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);
3772 }
25d7dd99 3773
70586bb3
JB
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)]);
25d7dd99 3780
70586bb3 3781 /* Insert a descriptor name */
25d7dd99 3782
70586bb3 3783@@ -215,15 +217,16 @@ AcpiDmGpioCommon (
25d7dd99 3784
70586bb3 3785 /* Dump the vendor data */
25d7dd99 3786
70586bb3
JB
3787- if (Resource->Gpio.VendorOffset)
3788+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorOffset);
3789+ if (Tmp16)
3790 {
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);
25d7dd99 3797
70586bb3
JB
3798- AcpiDmDumpRawDataBuffer (VendorData,
3799- Resource->Gpio.VendorLength, Level);
3800+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->Gpio.VendorLength);
3801+ AcpiDmDumpRawDataBuffer (VendorData, Tmp16, Level);
3802 }
25d7dd99 3803
70586bb3
JB
3804 AcpiOsPrintf (")\n");
3805@@ -233,17 +236,25 @@ AcpiDmGpioCommon (
3806 AcpiDmIndent (Level + 1);
3807 AcpiOsPrintf ("{ // Pin list\n");
25d7dd99 3808
70586bb3
JB
3809+ /*
3810 PinCount = ((UINT32) (Resource->Gpio.ResSourceOffset -
3811 Resource->Gpio.PinTableOffset)) /
3812 sizeof (UINT16);
3813+ */
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);
25d7dd99 3819
70586bb3
JB
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);
25d7dd99 3824
70586bb3
JB
3825 for (i = 0; i < PinCount; i++)
3826 {
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) ? "," : "");
25d7dd99
JB
3832 }
3833
70586bb3
JB
3834@@ -277,16 +288,18 @@ AcpiDmGpioIntDescriptor (
3835 UINT32 Length,
3836 UINT32 Level)
3837 {
3838+ UINT16 Tmp16;
25d7dd99 3839
70586bb3 3840 /* Dump the GpioInt-specific portion of the descriptor */
25d7dd99 3841
70586bb3 3842 /* EdgeLevel, ActiveLevel, Shared */
25d7dd99 3843
70586bb3
JB
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)]);
25d7dd99 3853
70586bb3 3854 /* PinConfig, DebounceTimeout */
25d7dd99 3855
70586bb3 3856@@ -299,7 +312,8 @@ AcpiDmGpioIntDescriptor (
25d7dd99 3857 {
70586bb3
JB
3858 AcpiOsPrintf ("0x%2.2X, ", Resource->Gpio.PinConfig);
3859 }
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);
25d7dd99 3863
70586bb3 3864 /* Dump the GpioInt/GpioIo common portion of the descriptor */
25d7dd99 3865
70586bb3
JB
3866@@ -329,14 +343,16 @@ AcpiDmGpioIoDescriptor (
3867 UINT32 Length,
3868 UINT32 Level)
3869 {
3870+ UINT16 Tmp16;
25d7dd99 3871
70586bb3 3872 /* Dump the GpioIo-specific portion of the descriptor */
25d7dd99 3873
70586bb3 3874 /* Shared, PinConfig */
25d7dd99 3875
70586bb3
JB
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)]);
25d7dd99 3881
70586bb3 3882 if (Resource->Gpio.PinConfig <= 3)
25d7dd99 3883 {
70586bb3 3884@@ -350,10 +366,13 @@ AcpiDmGpioIoDescriptor (
25d7dd99 3885
70586bb3 3886 /* DebounceTimeout, DriveStrength, IoRestriction */
25d7dd99 3887
70586bb3
JB
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)]);
25d7dd99 3898
70586bb3 3899 /* Dump the GpioInt/GpioIo common portion of the descriptor */
25d7dd99 3900
70586bb3
JB
3901@@ -533,6 +552,7 @@ AcpiDmDumpSerialBusVendorData (
3902 {
3903 UINT8 *VendorData;
3904 UINT32 VendorLength;
3905+ UINT16 Tmp16;
25d7dd99 3906
70586bb3
JB
3907
3908 /* Get the (optional) vendor data and length */
3909@@ -541,8 +561,8 @@ AcpiDmDumpSerialBusVendorData (
25d7dd99 3910 {
70586bb3 3911 case AML_RESOURCE_I2C_SERIALBUSTYPE:
25d7dd99 3912
70586bb3
JB
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;
25d7dd99 3917
70586bb3
JB
3918 VendorData = ACPI_ADD_PTR (UINT8, Resource,
3919 sizeof (AML_RESOURCE_I2C_SERIALBUS));
3920@@ -550,8 +570,8 @@ AcpiDmDumpSerialBusVendorData (
25d7dd99 3921
70586bb3 3922 case AML_RESOURCE_SPI_SERIALBUSTYPE:
25d7dd99 3923
70586bb3
JB
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;
25d7dd99 3928
70586bb3
JB
3929 VendorData = ACPI_ADD_PTR (UINT8, Resource,
3930 sizeof (AML_RESOURCE_SPI_SERIALBUS));
3931@@ -559,8 +579,8 @@ AcpiDmDumpSerialBusVendorData (
25d7dd99 3932
70586bb3 3933 case AML_RESOURCE_UART_SERIALBUSTYPE:
25d7dd99 3934
70586bb3
JB
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;
25d7dd99 3939
70586bb3
JB
3940 VendorData = ACPI_ADD_PTR (UINT8, Resource,
3941 sizeof (AML_RESOURCE_UART_SERIALBUS));
3942@@ -601,24 +621,29 @@ AcpiDmI2cSerialBusDescriptor (
3943 {
3944 UINT32 ResourceSourceOffset;
3945 char *DeviceName;
3946+ UINT16 Tmp16;
3947+ UINT32 Tmp32;
25d7dd99 3948
25d7dd99 3949
70586bb3 3950 /* SlaveAddress, SlaveMode, ConnectionSpeed, AddressingMode */
25d7dd99 3951
70586bb3
JB
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,
3957+ Tmp16,
3958 AcpiGbl_SmDecode [ACPI_GET_1BIT_FLAG (Resource->I2cSerialBus.Flags)],
3959- Resource->I2cSerialBus.ConnectionSpeed);
3960+ Tmp32);
25d7dd99 3961
70586bb3
JB
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)]);
25d7dd99 3967
70586bb3 3968 /* ResourceSource is a required field */
25d7dd99 3969
70586bb3
JB
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;
25d7dd99 3974
70586bb3
JB
3975 DeviceName = ACPI_ADD_PTR (char, Resource, ResourceSourceOffset);
3976 AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX);
3977Index: 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 (
3982 UINT32 Length,
3983 UINT32 Level)
3984 {
3985+ UINT16 Tmp;
3986
3987 AcpiDmIndent (Level);
3988 AcpiOsPrintf ("%s (",
3989@@ -93,7 +94,8 @@ AcpiDmIrqDescriptor (
3990 AcpiOsPrintf (")\n");
3991
3992 AcpiDmIndent (Level + 1);
3993- AcpiDmBitList (Resource->Irq.IrqMask);
3994+ ACPI_MOVE_16_TO_16(&Tmp, &Resource->Irq.IrqMask);
3995+ AcpiDmBitList (Tmp);
25d7dd99
JB
3996 }
3997
25d7dd99 3998
70586bb3
JB
3999@@ -204,16 +206,19 @@ AcpiDmIoDescriptor (
4000 UINT32 Length,
4001 UINT32 Level)
4002 {
4003+ UINT16 Tmp16;
25d7dd99 4004
70586bb3
JB
4005 AcpiDmIndent (Level);
4006 AcpiOsPrintf ("IO (%s,\n",
4007 AcpiGbl_IoDecode [ACPI_GET_1BIT_FLAG (Resource->Io.Flags)]);
25d7dd99 4008
70586bb3
JB
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");
25d7dd99 4013
70586bb3
JB
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");
25d7dd99 4018
70586bb3
JB
4019 AcpiDmIndent (Level + 1);
4020 AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
4021@@ -251,12 +256,14 @@ AcpiDmFixedIoDescriptor (
4022 UINT32 Length,
4023 UINT32 Level)
4024 {
4025+ UINT16 Tmp16;
25d7dd99 4026
70586bb3
JB
4027 AcpiDmIndent (Level);
4028 AcpiOsPrintf ("FixedIO (\n");
25d7dd99 4029
70586bb3
JB
4030 AcpiDmIndent (Level + 1);
4031- AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
4032+ ACPI_MOVE_16_TO_16(&Tmp16, &Resource->FixedIo.Address);
4033+ AcpiDmDumpInteger16 (Tmp16, "Address");
25d7dd99 4034
70586bb3
JB
4035 AcpiDmIndent (Level + 1);
4036 AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
4037Index: 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 (
4042 ACPI_STATUS Status;
4043 UINT64 Position;
4044 ACPI_PARSE_OBJECT *Child;
4045+ UINT32 TmpName;
25d7dd99 4046
70586bb3
JB
4047 #ifdef ACPI_EXEC_APP
4048 ACPI_OPERAND_OBJECT *ResultDesc;
4049@@ -437,10 +438,17 @@ AcpiDsGetFieldNames (
25d7dd99 4050
70586bb3 4051 /* Lookup the name, it should already exist */
25d7dd99 4052
70586bb3
JB
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);
4058+ /*
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);
4063+ */
25d7dd99
JB
4064 if (ACPI_FAILURE (Status))
4065 {
70586bb3
JB
4066 ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
4067@@ -689,9 +697,17 @@ AcpiDsInitFieldObjects (
4068 */
4069 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP)
4070 {
4071+ UINT32 TmpName;
4072+
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);
4077+ /*
4078 Status = AcpiNsLookup (WalkState->ScopeInfo,
4079 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1,
4080 Flags, WalkState, &Node);
4081+ */
25d7dd99
JB
4082 if (ACPI_FAILURE (Status))
4083 {
70586bb3
JB
4084 ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
4085Index: 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 (
4090 ACPI_STATUS Status;
4091 ACPI_GPE_BLOCK_INFO *GpeBlock;
4092 ACPI_GPE_WALK_INFO WalkInfo;
4093+ char Name[ACPI_NAMESEG_SIZE + 1];
25d7dd99 4094
25d7dd99 4095
70586bb3
JB
4096 ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
4097@@ -400,7 +401,7 @@ AcpiEvCreateGpeBlock (
25d7dd99 4098
70586bb3 4099 /* Initialize the new GPE block */
25d7dd99 4100
70586bb3
JB
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;
4108 }
25d7dd99 4109
70586bb3
JB
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)" : ""));
25d7dd99 4119
70586bb3
JB
4120 /* Update global count of currently available GPEs */
4121Index: 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.
4128 */
4129- ACPI_MOVE_64_TO_64 (Address, &Reg->Address);
4130+ *Address = Reg->Address;
4131 if (!(*Address))
4132 {
4133 return (AE_BAD_ADDRESS);
4134Index: 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 (
4139 UINT32 ByteWidth;
4140 ACPI_IO_ADDRESS LastAddress;
4141 const ACPI_PORT_INFO *PortInfo;
4142+ UINT64 Max16;
4143+ UINT64 Tmp64;
25d7dd99 4144
25d7dd99 4145
70586bb3
JB
4146 ACPI_FUNCTION_TRACE (HwValidateIoRequest);
4147@@ -162,7 +164,10 @@ AcpiHwValidateIoRequest (
25d7dd99 4148
70586bb3 4149 /* Maximum 16-bit address in I/O space */
25d7dd99 4150
70586bb3
JB
4151- if (LastAddress > ACPI_UINT16_MAX)
4152+ Max16 = (UINT64) ACPI_UINT16_MAX;
4153+ ACPI_MOVE_64_TO_64(&Tmp64, &Max16);
4154+
4155+ if ((UINT64)LastAddress > Tmp64)
4156 {
4157 ACPI_ERROR ((AE_INFO,
4158 "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X",
4159Index: 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;
4165 UINT32 LocalFlags;
4166 ACPI_INTERPRETER_MODE LocalInterpreterMode;
4167+ UINT32 Tmp32;
25d7dd99 4168
25d7dd99 4169
70586bb3
JB
4170 ACPI_FUNCTION_TRACE (NsLookup);
4171@@ -758,9 +759,10 @@ AcpiNsLookup (
4172 {
4173 /* Complain about a type mismatch */
25d7dd99 4174
70586bb3
JB
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)));
4182 }
4183Index: 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 (
25d7dd99 4188
70586bb3 4189 /* Table must consist of at least a complete header */
25d7dd99 4190
70586bb3
JB
4191- if (Table->Length < sizeof (ACPI_TABLE_HEADER))
4192+ ACPI_MOVE_32_TO_32(&AmlLength, &Table->Length);
4193+ if (AmlLength < sizeof (ACPI_TABLE_HEADER))
25d7dd99 4194 {
70586bb3
JB
4195 return_ACPI_STATUS (AE_BAD_HEADER);
4196 }
25d7dd99 4197
70586bb3
JB
4198 AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
4199- AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
4200+ AmlLength -= sizeof (ACPI_TABLE_HEADER);
25d7dd99 4201
70586bb3
JB
4202 Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
4203 if (ACPI_FAILURE (Status))
4204Index: 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 (
4209 UINT32 *TableIndex)
4210 {
4211 ACPI_STATUS Status = AE_OK;
4212+ UINT32 Length;
25d7dd99 4213
25d7dd99 4214
70586bb3
JB
4215 ACPI_FUNCTION_TRACE (TbVerifyTempTable);
4216@@ -581,7 +582,8 @@ AcpiTbVerifyTempTable (
4217 {
4218 /* Verify the checksum */
25d7dd99 4219
70586bb3
JB
4220- Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
4221+ ACPI_MOVE_32_TO_32(&Length, &TableDesc->Length);
4222+ Status = AcpiTbVerifyChecksum (TableDesc->Pointer, Length);
25d7dd99
JB
4223 if (ACPI_FAILURE (Status))
4224 {
70586bb3
JB
4225 ACPI_EXCEPTION ((AE_INFO, AE_NO_MEMORY,
4226Index: acpica-unix-20209326/source/components/tables/tbfadt.c
25d7dd99 4227===================================================================
70586bb3
JB
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,
4232 UINT32 Length)
4233 {
4234+ UINT32 Tmp32;
25d7dd99 4235
70586bb3
JB
4236 /*
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.
4240 */
4241- if (Length > sizeof (ACPI_TABLE_FADT))
4242+ ACPI_MOVE_32_TO_32(&Tmp32, &Length);
4243+ if (Tmp32 > sizeof (ACPI_TABLE_FADT))
4244 {
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)));
4251 }
25d7dd99 4252
70586bb3
JB
4253@@ -446,7 +448,7 @@ AcpiTbCreateLocalFadt (
4254 /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */
25d7dd99 4255
70586bb3
JB
4256 memcpy (&AcpiGbl_FADT, Table,
4257- ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT)));
4258+ ACPI_MIN (Tmp32, sizeof (ACPI_TABLE_FADT)));
25d7dd99 4259
70586bb3 4260 /* Take a copy of the Hardware Reduced flag */
25d7dd99 4261
70586bb3
JB
4262@@ -520,6 +522,8 @@ AcpiTbConvertFadt (
4263 UINT8 Length;
4264 UINT8 Flags;
4265 UINT32 i;
4266+ UINT32 Tmp32;
4267+ UINT64 Tmp64;
25d7dd99 4268
70586bb3
JB
4269
4270 /*
4271@@ -533,7 +537,8 @@ AcpiTbConvertFadt (
4272 * Note: The FADT revision value is unreliable. Only the length can be
4273 * trusted.
4274 */
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)
25d7dd99 4278 {
70586bb3
JB
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.
4284 */
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);
25d7dd99 4288
70586bb3
JB
4289 /*
4290 * Expand the 32-bit DSDT addresses to 64-bit as necessary.
4291 * Later ACPICA code will always use the X 64-bit field.
4292 */
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);
25d7dd99 4297
70586bb3 4298 /* If Hardware Reduced flag is set, we are all done */
25d7dd99 4299
70586bb3 4300@@ -614,7 +620,9 @@ AcpiTbConvertFadt (
25d7dd99 4301 {
70586bb3 4302 if (Address64->Address)
25d7dd99 4303 {
70586bb3
JB
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)
4308 {
4309 /* Address mismatch */
25d7dd99 4310
70586bb3
JB
4311@@ -655,9 +663,11 @@ AcpiTbConvertFadt (
4312 */
4313 if (!Address64->Address || AcpiGbl_Use32BitFadtAddresses)
4314 {
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);
4321 }
4322 }
25d7dd99 4323
70586bb3 4324@@ -780,10 +790,14 @@ AcpiTbSetupFadtRegisters (
25d7dd99 4325
70586bb3 4326 if (Source64->Address)
25d7dd99 4327 {
70586bb3
JB
4328+ UINT64 Tmp64, Addr64;
4329+
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),
4337+ Addr64,
4338 "PmRegisters", 0);
25d7dd99 4339 }
70586bb3
JB
4340 }
4341Index: 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)
4348 {
4349+ UINT32 Tmp32;
4350+
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))
25d7dd99 4355 {
70586bb3 4356 /* Not the requested table */
25d7dd99 4357
70586bb3
JB
4358Index: 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)
4364 {
4365 ACPI_TABLE_HEADER LocalHeader;
4366+ UINT32 Len;
4367+ UINT32 OemRev;
4368+ UINT32 CompilerRev;
25d7dd99 4369
25d7dd99 4370
70586bb3 4371 if (ACPI_COMPARE_NAMESEG (Header->Signature, ACPI_SIG_FACS))
25d7dd99 4372 {
70586bb3 4373 /* FACS only has signature and length fields */
25d7dd99 4374
70586bb3
JB
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),
4378- Header->Length));
4379+ Header->Signature, ACPI_FORMAT_UINT64 (Address), Len));
4380 }
4381 else if (ACPI_VALIDATE_RSDP_SIG (Header->Signature))
25d7dd99 4382 {
70586bb3 4383@@ -174,13 +177,16 @@ AcpiTbPrintTableHeader (
25d7dd99 4384
70586bb3 4385 AcpiTbCleanupTableHeader (&LocalHeader, Header);
25d7dd99 4386
70586bb3
JB
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);
4390 ACPI_INFO ((
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));
4400 }
4401 }
25d7dd99 4402
70586bb3
JB
4403Index: 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,
4409 * return 64-bit
4410 */
4411- ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
4412+ Address64 = (UINT64) TableEntry;
25d7dd99 4413
70586bb3
JB
4414 #if ACPI_MACHINE_WIDTH == 32
4415 if (Address64 > ACPI_UINT32_MAX)
4416@@ -251,7 +251,8 @@ AcpiTbGetRootTableEntry (
4417 ACPI_FORMAT_UINT64 (Address64)));
4418 }
4419 #endif
4420- return ((ACPI_PHYSICAL_ADDRESS) (Address64));
4421+ return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (
4422+ UINT64, Address64)));
4423 }
4424 }
25d7dd99 4425
70586bb3
JB
4426@@ -287,6 +288,7 @@ AcpiTbParseRootTable (
4427 UINT8 *TableEntry;
25d7dd99 4428 ACPI_STATUS Status;
70586bb3
JB
4429 UINT32 TableIndex;
4430+ UINT32 Tmp32;
25d7dd99 4431
25d7dd99 4432
70586bb3
JB
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.
4437 */
4438- Length = Table->Length;
25d7dd99 4439+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
70586bb3 4440 AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
25d7dd99 4441
70586bb3
JB
4442 if (Length < (sizeof (ACPI_TABLE_HEADER) + TableEntrySize))
4443@@ -372,7 +374,7 @@ AcpiTbParseRootTable (
25d7dd99 4444
70586bb3 4445 /* Get the number of entries and pointer to first entry */
25d7dd99 4446
70586bb3
JB
4447- TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) /
4448+ TableCount = (UINT32) ((Length - sizeof (ACPI_TABLE_HEADER)) /
4449 TableEntrySize);
4450 TableEntry = ACPI_ADD_PTR (UINT8, Table, sizeof (ACPI_TABLE_HEADER));
25d7dd99 4451
70586bb3
JB
4452@@ -394,10 +396,10 @@ AcpiTbParseRootTable (
4453 Status = AcpiTbInstallStandardTable (Address,
4454 ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL, FALSE, TRUE, &TableIndex);
25d7dd99 4455
70586bb3
JB
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,
4461- ACPI_SIG_FADT))
4462+ ACPI_COMPARE_NAMESEG (&Tmp32, ACPI_SIG_FADT))
4463 {
4464 AcpiGbl_FadtIndex = TableIndex;
4465 AcpiTbParseFadt ();
4466Index: 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 (
25d7dd99 4471
70586bb3 4472 for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
25d7dd99 4473 {
70586bb3
JB
4474+ UINT32 Tmp32;
4475+
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))
25d7dd99 4480 {
70586bb3
JB
4481 continue;
4482 }
4483Index: 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;
4491+ UINT32 Tmp32;
25d7dd99
JB
4492
4493
70586bb3
JB
4494 ACPI_FUNCTION_TRACE (TbLoadNamespace);
4495@@ -166,8 +167,9 @@ AcpiTbLoadNamespace (
4496 */
4497 Table = &AcpiGbl_RootTableList.Tables[AcpiGbl_DsdtIndex];
25d7dd99 4498
70586bb3
JB
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)))
25d7dd99 4504 {
70586bb3
JB
4505 Status = AE_NO_ACPI_TABLES;
4506Index: 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 (
4511 char *Signature,
4512 UINT32 Length)
4513 {
4514+ UINT16 Tmp16;
4515+ UINT32 Tmp32;
25d7dd99 4516
70586bb3
JB
4517 ACPI_COPY_NAMESEG (Header->Signature, Signature);
4518- Header->Length = Length;
4519+ ACPI_MOVE_32_TO_32(&Header->Length, &Length);
25d7dd99 4520
70586bb3
JB
4521- Header->OemRevision = 0x1001;
4522+ Tmp16 = 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);
25d7dd99 4530
70586bb3 4531 /* Set the checksum, must set to zero first */
25d7dd99 4532
70586bb3
JB
4533 Header->Checksum = 0;
4534 Header->Checksum = (UINT8) -AcpiTbChecksum (
4535- (void *) Header, Header->Length);
4536+ (void *) Header, Length);
25d7dd99
JB
4537 }
4538
25d7dd99 4539
70586bb3
JB
4540@@ -188,6 +192,7 @@ AeBuildLocalTables (
4541 ACPI_NEW_TABLE_DESC *NextTable;
4542 UINT32 NextIndex;
4543 ACPI_TABLE_FADT *ExternalFadt = NULL;
25d7dd99
JB
4544+ UINT32 Tmp32;
4545
4546
70586bb3
JB
4547 /*
4548@@ -374,6 +379,8 @@ AeBuildLocalTables (
4549 }
4550 else
4551 {
4552+ UINT64 Tmp64;
4553+
4554 /*
4555 * Build a local FADT so we can test the hardware/event init
4556 */
4557@@ -385,34 +392,44 @@ AeBuildLocalTables (
4558 LocalFADT.Facs = 0;
25d7dd99 4559
70586bb3
JB
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);
25d7dd99 4564
70586bb3 4565 /* Miscellaneous FADT fields */
25d7dd99 4566
70586bb3
JB
4567 LocalFADT.Gpe0BlockLength = 0x20;
4568- LocalFADT.Gpe0Block = 0x00003210;
4569+ Tmp32 = 0x00003210;
4570+ ACPI_MOVE_32_TO_32(&LocalFADT.Gpe0Block, &Tmp32);
25d7dd99 4571
70586bb3
JB
4572 LocalFADT.Gpe1BlockLength = 0x20;
4573- LocalFADT.Gpe1Block = 0x0000BA98;
4574+ Tmp32 = 0x0000BA98;
4575+ ACPI_MOVE_32_TO_32(&LocalFADT.Gpe1Block, &Tmp32);
4576 LocalFADT.Gpe1Base = 0x80;
25d7dd99 4577
70586bb3
JB
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);
25d7dd99 4585
70586bb3
JB
4586 LocalFADT.Pm1ControlLength = 2;
4587- LocalFADT.Pm1aControlBlock = 0xB0;
4588+ Tmp32 = 0xB0;
4589+ ACPI_MOVE_32_TO_32(&LocalFADT.Pm1aControlBlock, &Tmp32);
25d7dd99 4590
70586bb3
JB
4591 LocalFADT.PmTimerLength = 4;
4592- LocalFADT.PmTimerBlock = 0xA0;
4593+ Tmp32 = 0xA0;
4594+ ACPI_MOVE_32_TO_32(&LocalFADT.PmTimerBlock, &Tmp32);
25d7dd99 4595
70586bb3
JB
4596- LocalFADT.Pm2ControlBlock = 0xC0;
4597+ Tmp32 = 0xC0;
4598+ ACPI_MOVE_32_TO_32(&LocalFADT.Pm2ControlBlock, &Tmp32);
4599 LocalFADT.Pm2ControlLength = 1;
25d7dd99 4600
70586bb3 4601 /* Setup one example X-64 GAS field */
25d7dd99 4602
70586bb3
JB
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);
4610 }
4611@@ -425,13 +442,17 @@ AeBuildLocalTables (
4612 memset (&LocalFACS, 0, sizeof (ACPI_TABLE_FACS));
4613 ACPI_COPY_NAMESEG (LocalFACS.Signature, ACPI_SIG_FACS);
25d7dd99 4614
70586bb3
JB
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);
25d7dd99 4621
70586bb3 4622 /* Build the optional local tables */
25d7dd99 4623
70586bb3
JB
4624 if (AcpiGbl_LoadTestTables)
4625 {
4626+ UINT32 Tmp32;
4627+
4628 /*
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");
25d7dd99 4633
70586bb3
JB
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);
25d7dd99 4638
70586bb3
JB
4639 LocalTEST.Checksum = 0;
4640 LocalTEST.Checksum = (UINT8) -AcpiTbChecksum (
4641- (void *) &LocalTEST, LocalTEST.Length);
4642+ (void *) &LocalTEST, Tmp32);
25d7dd99 4643
70586bb3
JB
4644 /*
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!");
25d7dd99 4648
70586bb3
JB
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);
25d7dd99 4653
70586bb3
JB
4654 LocalBADTABLE.Checksum = 0;
4655 LocalBADTABLE.Checksum = (UINT8) -AcpiTbChecksum (
4656- (void *) &LocalBADTABLE, LocalBADTABLE.Length);
4657+ (void *) &LocalBADTABLE, Tmp32);
4658 }
25d7dd99 4659
70586bb3
JB
4660 return (AE_OK);
4661Index: 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;
4669+ UINT32 Tmp32;
25d7dd99 4670
25d7dd99 4671
70586bb3
JB
4672 switch (Op->Common.AmlOpcode)
4673 {
4674 case AML_NAME_OP:
25d7dd99 4675
70586bb3
JB
4676- Temp = (char *) (&Op->Named.Name);
4677+ ACPI_MOVE_32_TO_32(&Tmp32, &Op->Named.Name);
4678+ Temp = (char *) (&Tmp32);
25d7dd99 4679
70586bb3 4680 if (!strncmp(Temp, "_T_", 3))
25d7dd99 4681 {
70586bb3 4682@@ -138,7 +140,10 @@ AcpiDmProcessSwitch (
25d7dd99 4683 {
70586bb3 4684 /* Note, if we get here Temp is not NULL */
25d7dd99 4685
70586bb3
JB
4686- if (!strncmp(Temp, (char *) (&Current->Op->Named.Name), 4))
4687+ ACPI_MOVE_32_TO_32(&Tmp32, &Current->Op->Named.Name);
4688+
4689+ /* if (!strncmp(Temp, (char *) (&Current->Op->Named.Name), 4)) */
4690+ if (!strncmp(Temp, (char *) &Tmp32, 4))
4691 {
4692 /* Match found. Ignore disassembly */
25d7dd99 4693
70586bb3
JB
4694Index: 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;
4700 UINT32 i;
4701 UINT8 Type;
4702+ UINT32 Len;
4703+ UINT16 SubLen;
25d7dd99 4704
25d7dd99 4705
70586bb3 4706 /* No main table, only subtables */
25d7dd99 4707
70586bb3
JB
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)
4712 {
4713 /* Common subtable header */
25d7dd99 4714
70586bb3
JB
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))
4721 {
4722 return;
4723@@ -146,8 +150,7 @@ AcpiDmDumpAsf (
4724 return;
4725 }
25d7dd99 4726
70586bb3
JB
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))
4731 {
4732 return;
4733@@ -163,7 +166,7 @@ AcpiDmDumpAsf (
4734 for (i = 0; i < DataCount; i++)
25d7dd99 4735 {
70586bb3
JB
4736 AcpiOsPrintf ("\n");
4737- Status = AcpiDmDumpTable (Table->Length, DataOffset,
4738+ Status = AcpiDmDumpTable (Len, DataOffset,
4739 DataTable, DataLength, DataInfoTable);
4740 if (ACPI_FAILURE (Status))
4741 {
4742@@ -209,15 +212,14 @@ AcpiDmDumpAsf (
25d7dd99 4743
70586bb3 4744 /* Point to next subtable */
25d7dd99 4745
70586bb3
JB
4746- if (!Subtable->Header.Length)
4747+ if (!SubLen)
25d7dd99 4748 {
70586bb3
JB
4749 AcpiOsPrintf ("Invalid zero subtable header length\n");
4750 return;
4751 }
25d7dd99 4752
70586bb3
JB
4753- Offset += Subtable->Header.Length;
4754- Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable,
4755- Subtable->Header.Length);
4756+ Offset += SubLen;
4757+ Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, SubLen);
4758 }
4759 }
25d7dd99 4760
70586bb3
JB
4761@@ -241,12 +243,13 @@ AcpiDmDumpCpep (
4762 {
4763 ACPI_STATUS Status;
4764 ACPI_CPEP_POLLING *Subtable;
4765- UINT32 Length = Table->Length;
4766+ UINT32 Length;
4767 UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
25d7dd99 4768
25d7dd99 4769
70586bb3 4770 /* Main table */
25d7dd99 4771
70586bb3
JB
4772+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
4773 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
25d7dd99 4774 if (ACPI_FAILURE (Status))
25d7dd99 4775 {
70586bb3
JB
4776@@ -256,7 +259,7 @@ AcpiDmDumpCpep (
4777 /* Subtables */
4778
4779 Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
4780- while (Offset < Table->Length)
4781+ while (Offset < Length)
25d7dd99 4782 {
70586bb3
JB
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;
4790+ UINT32 Length;
4791+ UINT32 SubLength;
4792+ UINT32 SubSubLength;
4793+ UINT32 SharedInfoLength;
4794 UINT32 Offset = sizeof (ACPI_TABLE_CSRT);
4795 UINT32 SubOffset;
4796 UINT32 SubSubOffset;
4797@@ -307,14 +313,16 @@ AcpiDmDumpCsrt (
25d7dd99 4798
70586bb3 4799 /* Subtables (Resource Groups) */
25d7dd99 4800
70586bb3
JB
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)
4805 {
4806 /* Resource group subtable */
25d7dd99 4807
70586bb3
JB
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))
4814 {
4815 return;
4816@@ -334,19 +342,20 @@ AcpiDmDumpCsrt (
4817 return;
4818 }
25d7dd99 4819
70586bb3
JB
4820- SubOffset += Subtable->SharedInfoLength;
4821+ ACPI_MOVE_32_TO_32(&SharedInfoLength, &Subtable->SharedInfoLength);
4822+ SubOffset += SharedInfoLength;
25d7dd99 4823
70586bb3 4824 /* Sub-Subtables (Resource Descriptors) */
25d7dd99 4825
70586bb3
JB
4826 SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table,
4827 Offset + SubOffset);
25d7dd99 4828
70586bb3
JB
4829- while ((SubOffset < Subtable->Length) &&
4830- ((Offset + SubOffset) < Table->Length))
4831+ while ((SubOffset < SubLength) && ((Offset + SubOffset) < Length))
4832 {
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);
25d7dd99 4838 if (ACPI_FAILURE (Status))
25d7dd99 4839 {
70586bb3
JB
4840 return;
4841@@ -356,7 +365,7 @@ AcpiDmDumpCsrt (
25d7dd99 4842
70586bb3 4843 /* Resource-specific info buffer */
25d7dd99 4844
70586bb3
JB
4845- InfoLength = SubSubtable->Length - SubSubOffset;
4846+ InfoLength = SubSubLength - SubSubOffset;
4847 if (InfoLength)
25d7dd99 4848 {
70586bb3
JB
4849 Status = AcpiDmDumpTable (Length,
4850@@ -370,16 +379,15 @@ AcpiDmDumpCsrt (
25d7dd99 4851
70586bb3 4852 /* Point to next sub-subtable */
25d7dd99 4853
70586bb3
JB
4854- SubOffset += SubSubtable->Length;
4855+ SubOffset += SubSubLength;
4856 SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable,
4857- SubSubtable->Length);
4858+ SubSubLength);
25d7dd99
JB
4859 }
4860
70586bb3 4861 /* Point to next subtable */
25d7dd99 4862
70586bb3
JB
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);
4868 }
25d7dd99
JB
4869 }
4870
70586bb3
JB
4871@@ -403,16 +411,20 @@ AcpiDmDumpDbg2 (
4872 {
4873 ACPI_STATUS Status;
4874 ACPI_DBG2_DEVICE *Subtable;
4875- UINT32 Length = Table->Length;
4876+ UINT32 Length;
4877+ UINT16 SubLength;
4878 UINT32 Offset = sizeof (ACPI_TABLE_DBG2);
4879 UINT32 i;
4880 UINT32 ArrayOffset;
4881 UINT32 AbsoluteOffset;
4882 UINT8 *Array;
4883+ UINT16 Tmp16;
4884+ UINT16 AlsoTmp16;
25d7dd99 4885
25d7dd99 4886
70586bb3 4887 /* Main table */
25d7dd99 4888
70586bb3
JB
4889+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
4890 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDbg2);
4891 if (ACPI_FAILURE (Status))
4892 {
4893@@ -422,11 +434,12 @@ AcpiDmDumpDbg2 (
4894 /* Subtables */
25d7dd99 4895
70586bb3
JB
4896 Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset);
4897- while (Offset < Table->Length)
4898+ while (Offset < Length)
4899 {
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))
4906 {
4907 return;
4908@@ -436,13 +449,13 @@ AcpiDmDumpDbg2 (
25d7dd99 4909
70586bb3 4910 for (i = 0; i < Subtable->RegisterCount; i++)
25d7dd99 4911 {
70586bb3
JB
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;
25d7dd99 4918
70586bb3
JB
4919 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
4920- Subtable->Length, AcpiDmTableInfoDbg2Addr);
4921+ SubLength, AcpiDmTableInfoDbg2Addr);
4922 if (ACPI_FAILURE (Status))
4923 {
4924 return;
4925@@ -453,13 +466,13 @@ AcpiDmDumpDbg2 (
25d7dd99 4926
70586bb3 4927 for (i = 0; i < Subtable->RegisterCount; i++)
25d7dd99 4928 {
70586bb3
JB
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;
25d7dd99 4935
70586bb3
JB
4936 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
4937- Subtable->Length, AcpiDmTableInfoDbg2Size);
4938+ SubLength, AcpiDmTableInfoDbg2Size);
4939 if (ACPI_FAILURE (Status))
4940 {
4941 return;
4942@@ -469,12 +482,13 @@ AcpiDmDumpDbg2 (
4943 /* Dump the Namestring (required) */
25d7dd99 4944
70586bb3
JB
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;
25d7dd99 4951
70586bb3
JB
4952 Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array,
4953- Subtable->Length, AcpiDmTableInfoDbg2Name);
4954+ SubLength, AcpiDmTableInfoDbg2Name);
4955 if (ACPI_FAILURE (Status))
4956 {
4957 return;
4958@@ -484,9 +498,10 @@ AcpiDmDumpDbg2 (
25d7dd99 4959
70586bb3
JB
4960 if (Subtable->OemDataOffset)
4961 {
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))
4970 {
4971 return;
4972@@ -495,9 +510,9 @@ AcpiDmDumpDbg2 (
25d7dd99 4973
70586bb3 4974 /* Point to next subtable */
25d7dd99 4975
70586bb3
JB
4976- Offset += Subtable->Length;
4977+ Offset += SubLength;
4978 Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable,
4979- Subtable->Length);
4980+ SubLength);
4981 }
4982 }
25d7dd99 4983
70586bb3
JB
4984@@ -521,17 +536,20 @@ AcpiDmDumpDmar (
4985 {
4986 ACPI_STATUS Status;
4987 ACPI_DMAR_HEADER *Subtable;
4988- UINT32 Length = Table->Length;
4989+ UINT32 Length;
4990+ UINT16 SubLength;
4991 UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
25d7dd99 4992 ACPI_DMTABLE_INFO *InfoTable;
70586bb3
JB
4993 ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
4994 UINT32 ScopeOffset;
4995 UINT8 *PciPath;
4996 UINT32 PathOffset;
4997+ UINT16 SubType;
25d7dd99
JB
4998
4999
70586bb3 5000 /* Main table */
25d7dd99 5001
70586bb3
JB
5002+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5003 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
5004 if (ACPI_FAILURE (Status))
5005 {
5006@@ -541,13 +559,14 @@ AcpiDmDumpDmar (
5007 /* Subtables */
25d7dd99 5008
70586bb3
JB
5009 Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
5010- while (Offset < Table->Length)
5011+ while (Offset < Length)
5012 {
5013 /* Common subtable header */
5014
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))
25d7dd99 5021 {
70586bb3
JB
5022 return;
5023@@ -555,7 +574,8 @@ AcpiDmDumpDmar (
25d7dd99 5024
70586bb3 5025 AcpiOsPrintf ("\n");
25d7dd99 5026
70586bb3
JB
5027- switch (Subtable->Type)
5028+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
5029+ switch (SubType)
5030 {
5031 case ACPI_DMAR_TYPE_HARDWARE_UNIT:
25d7dd99 5032
70586bb3
JB
5033@@ -590,12 +610,12 @@ AcpiDmDumpDmar (
5034 default:
25d7dd99 5035
70586bb3
JB
5036 AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n",
5037- Subtable->Type);
5038+ SubType);
5039 return;
5040 }
25d7dd99 5041
70586bb3
JB
5042 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5043- Subtable->Length, InfoTable);
5044+ SubLength, InfoTable);
5045 if (ACPI_FAILURE (Status))
5046 {
5047 return;
5048@@ -604,8 +624,8 @@ AcpiDmDumpDmar (
5049 /*
5050 * Dump the optional device scope entries
5051 */
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))
5056 {
5057 /* These types do not support device scopes */
25d7dd99 5058
70586bb3
JB
5059@@ -613,7 +633,7 @@ AcpiDmDumpDmar (
5060 }
25d7dd99 5061
70586bb3
JB
5062 ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset);
5063- while (ScopeOffset < Subtable->Length)
5064+ while (ScopeOffset < SubLength)
5065 {
5066 AcpiOsPrintf ("\n");
5067 Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
5068@@ -654,9 +674,8 @@ AcpiDmDumpDmar (
5069 NextSubtable:
5070 /* Point to next subtable */
25d7dd99 5071
70586bb3
JB
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);
5077 }
5078 }
25d7dd99 5079
70586bb3
JB
5080@@ -683,12 +702,15 @@ AcpiDmDumpDrtm (
5081 ACPI_DRTM_RESOURCE_LIST *DrtmRl;
5082 ACPI_DRTM_DPS_ID *DrtmDps;
5083 UINT32 Count;
5084+ UINT32 ValidatedCount;
5085+ UINT32 ResourceCount;
5086+ UINT32 Length;
25d7dd99
JB
5087
5088
70586bb3 5089 /* Main table */
25d7dd99 5090
70586bb3
JB
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))
5096 {
5097 return;
5098@@ -702,7 +724,7 @@ AcpiDmDumpDrtm (
25d7dd99 5099
70586bb3
JB
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 */
25d7dd99 5109
70586bb3
JB
5110 Count = 0;
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))
5116 {
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 (
25d7dd99 5123
70586bb3
JB
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 */
25d7dd99 5133
70586bb3
JB
5134 Count = 0;
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))
5140 {
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 (
25d7dd99 5147
70586bb3
JB
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);
5153 }
25d7dd99 5154
70586bb3
JB
5155@@ -790,12 +814,13 @@ AcpiDmDumpEinj (
5156 {
5157 ACPI_STATUS Status;
5158 ACPI_WHEA_HEADER *Subtable;
5159- UINT32 Length = Table->Length;
5160+ UINT32 Length;
5161 UINT32 Offset = sizeof (ACPI_TABLE_EINJ);
25d7dd99 5162
25d7dd99 5163
70586bb3 5164 /* Main table */
25d7dd99 5165
70586bb3
JB
5166+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5167 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj);
5168 if (ACPI_FAILURE (Status))
5169 {
5170@@ -805,7 +830,7 @@ AcpiDmDumpEinj (
5171 /* Subtables */
25d7dd99 5172
70586bb3
JB
5173 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
5174- while (Offset < Table->Length)
5175+ while (Offset < Length)
5176 {
5177 AcpiOsPrintf ("\n");
5178 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5179@@ -843,12 +868,13 @@ AcpiDmDumpErst (
5180 {
5181 ACPI_STATUS Status;
5182 ACPI_WHEA_HEADER *Subtable;
5183- UINT32 Length = Table->Length;
5184+ UINT32 Length;
5185 UINT32 Offset = sizeof (ACPI_TABLE_ERST);
25d7dd99 5186
25d7dd99 5187
70586bb3 5188 /* Main table */
25d7dd99 5189
70586bb3
JB
5190+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5191 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst);
5192 if (ACPI_FAILURE (Status))
25d7dd99 5193 {
70586bb3
JB
5194@@ -858,7 +884,7 @@ AcpiDmDumpErst (
5195 /* Subtables */
25d7dd99 5196
70586bb3
JB
5197 Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset);
5198- while (Offset < Table->Length)
5199+ while (Offset < Length)
5200 {
5201 AcpiOsPrintf ("\n");
5202 Status = AcpiDmDumpTable (Length, Offset, Subtable,
5203@@ -896,17 +922,19 @@ AcpiDmDumpFpdt (
25d7dd99 5204 {
70586bb3
JB
5205 ACPI_STATUS Status;
5206 ACPI_FPDT_HEADER *Subtable;
5207- UINT32 Length = Table->Length;
5208+ UINT32 Length;
5209 UINT32 Offset = sizeof (ACPI_TABLE_FPDT);
5210 ACPI_DMTABLE_INFO *InfoTable;
5211+ UINT16 Type;
25d7dd99
JB
5212
5213
70586bb3 5214 /* There is no main table (other than the standard ACPI header) */
25d7dd99 5215
70586bb3
JB
5216 /* Subtables */
5217
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)
25d7dd99 5222 {
70586bb3 5223 /* Common subtable header */
25d7dd99 5224
70586bb3
JB
5225@@ -918,7 +946,8 @@ AcpiDmDumpFpdt (
5226 return;
5227 }
25d7dd99 5228
70586bb3
JB
5229- switch (Subtable->Type)
5230+ ACPI_MOVE_16_TO_16(&Type, &Subtable->Type);
5231+ switch (Type)
5232 {
5233 case ACPI_FPDT_TYPE_BOOT:
25d7dd99 5234
70586bb3 5235@@ -932,8 +961,7 @@ AcpiDmDumpFpdt (
25d7dd99 5236
70586bb3 5237 default:
25d7dd99 5238
70586bb3
JB
5239- AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n",
5240- Subtable->Type);
5241+ AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", Type);
25d7dd99 5242
70586bb3 5243 /* Attempt to continue */
25d7dd99 5244
70586bb3
JB
5245@@ -981,16 +1009,19 @@ AcpiDmDumpGtdt (
5246 {
5247 ACPI_STATUS Status;
5248 ACPI_GTDT_HEADER *Subtable;
5249- UINT32 Length = Table->Length;
5250+ UINT32 Length;
5251+ UINT16 SubLength;
5252 UINT32 Offset = sizeof (ACPI_TABLE_GTDT);
5253 ACPI_DMTABLE_INFO *InfoTable;
5254 UINT32 SubtableLength;
5255 UINT32 GtCount;
5256+ UINT32 Tmp32;
5257 ACPI_GTDT_TIMER_ENTRY *GtxTable;
25d7dd99 5258
25d7dd99 5259
70586bb3 5260 /* Main table */
25d7dd99 5261
70586bb3
JB
5262+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5263 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoGtdt);
5264 if (ACPI_FAILURE (Status))
5265 {
5266@@ -1017,7 +1048,7 @@ AcpiDmDumpGtdt (
25d7dd99 5267
70586bb3 5268 /* Subtables */
25d7dd99 5269
70586bb3
JB
5270- while (Offset < Table->Length)
5271+ while (Offset < Length)
5272 {
5273 /* Common subtable header */
25d7dd99 5274
70586bb3
JB
5275@@ -1035,8 +1066,9 @@ AcpiDmDumpGtdt (
5276 case ACPI_GTDT_TYPE_TIMER_BLOCK:
25d7dd99 5277
70586bb3
JB
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);
25d7dd99 5283
70586bb3
JB
5284 InfoTable = AcpiDmTableInfoGtdt0;
5285 break;
5286@@ -1057,8 +1089,9 @@ AcpiDmDumpGtdt (
5287 return;
5288 }
25d7dd99 5289
70586bb3
JB
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))
5295 {
5296 return;
5297@@ -1117,16 +1150,18 @@ AcpiDmDumpHest (
25d7dd99 5298 {
70586bb3
JB
5299 ACPI_STATUS Status;
5300 ACPI_HEST_HEADER *Subtable;
5301- UINT32 Length = Table->Length;
5302+ UINT32 Length;
5303 UINT32 Offset = sizeof (ACPI_TABLE_HEST);
5304 ACPI_DMTABLE_INFO *InfoTable;
5305 UINT32 SubtableLength;
5306 UINT32 BankCount;
5307 ACPI_HEST_IA_ERROR_BANK *BankTable;
5308+ UINT16 SubType;
25d7dd99 5309
70586bb3
JB
5310
5311 /* Main table */
5312
5313+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5314 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest);
5315 if (ACPI_FAILURE (Status))
25d7dd99 5316 {
70586bb3
JB
5317@@ -1136,10 +1171,11 @@ AcpiDmDumpHest (
5318 /* Subtables */
5319
5320 Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset);
5321- while (Offset < Table->Length)
5322+ while (Offset < Length)
5323 {
5324 BankCount = 0;
5325- switch (Subtable->Type)
5326+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
5327+ switch (SubType)
25d7dd99 5328 {
70586bb3 5329 case ACPI_HEST_TYPE_IA32_CHECK:
25d7dd99 5330
70586bb3
JB
5331Index: 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;
5337 UINT32 Offset;
5338 UINT32 NodeOffset;
5339+ UINT16 NodeLength;
5340 UINT32 Length;
5341 ACPI_DMTABLE_INFO *InfoTable;
5342 char *String;
5343 UINT32 i;
5344 UINT32 MappingByteLength;
5345+ UINT32 TableLen;
5346+ UINT32 ItsCount;
5347+ UINT32 MappingCount;
5348+ UINT32 CtxIntCount;
5349+ UINT32 PmuIntCount;
25d7dd99 5350
25d7dd99 5351
70586bb3 5352 /* Main table */
25d7dd99 5353
70586bb3
JB
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))
5358 {
5359 return;
5360@@ -95,18 +102,19 @@ AcpiDmDumpIort (
25d7dd99 5361
70586bb3 5362 /* Dump the OptionalPadding (optional) */
25d7dd99 5363
70586bb3
JB
5364- if (Iort->NodeOffset > Offset)
5365+ ACPI_MOVE_32_TO_32(&NodeOffset, &Iort->NodeOffset);
5366+ if (NodeOffset > Offset)
5367 {
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))
25d7dd99 5373 {
70586bb3
JB
5374 return;
5375 }
5376 }
25d7dd99 5377
70586bb3
JB
5378- Offset = Iort->NodeOffset;
5379- while (Offset < Table->Length)
5380+ ACPI_MOVE_32_TO_32(&Offset, &Iort->NodeOffset);
5381+ while (Offset < TableLen)
5382 {
5383 /* Common subtable header */
25d7dd99 5384
70586bb3
JB
5385@@ -142,7 +150,8 @@ AcpiDmDumpIort (
5386 case ACPI_IORT_NODE_PCI_ROOT_COMPLEX:
25d7dd99 5387
70586bb3
JB
5388 InfoTable = AcpiDmTableInfoIort2;
5389- Length = IortNode->Length - NodeOffset;
5390+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5391+ Length = NodeLength - NodeOffset;
25d7dd99
JB
5392 break;
5393
70586bb3
JB
5394 case ACPI_IORT_NODE_SMMU:
5395@@ -155,7 +164,8 @@ AcpiDmDumpIort (
5396 case ACPI_IORT_NODE_SMMU_V3:
25d7dd99 5397
70586bb3
JB
5398 InfoTable = AcpiDmTableInfoIort4;
5399- Length = IortNode->Length - NodeOffset;
5400+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5401+ Length = NodeLength - NodeOffset;
25d7dd99
JB
5402 break;
5403
70586bb3
JB
5404 case ACPI_IORT_NODE_PMCG:
5405@@ -171,7 +181,8 @@ AcpiDmDumpIort (
25d7dd99 5406
70586bb3 5407 /* Attempt to continue */
25d7dd99 5408
70586bb3
JB
5409- if (!IortNode->Length)
5410+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5411+ if (!NodeLength)
5412 {
5413 AcpiOsPrintf ("Invalid zero length IORT node\n");
5414 return;
5415@@ -182,7 +193,7 @@ AcpiDmDumpIort (
5416 /* Dump the node subtable header */
25d7dd99 5417
70586bb3
JB
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),
5422 Length, InfoTable);
5423 if (ACPI_FAILURE (Status))
5424@@ -202,9 +213,10 @@ AcpiDmDumpIort (
25d7dd99 5425
70586bb3
JB
5426 if (IortItsGroup)
5427 {
5428- for (i = 0; i < IortItsGroup->ItsCount; i++)
5429+ ACPI_MOVE_32_TO_32(&ItsCount, &IortItsGroup->ItsCount);
5430+ for (i = 0; i < ItsCount; i++)
5431 {
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 (
25d7dd99 5438
70586bb3 5439 /* Dump the Padding (optional) */
25d7dd99 5440
70586bb3
JB
5441- if (IortNode->Length > NodeOffset)
5442+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5443+ if (NodeLength > NodeOffset)
5444 {
5445 MappingByteLength =
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))
5453 {
5454@@ -244,8 +257,8 @@ AcpiDmDumpIort (
5455 if (IortSmmu)
5456 {
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 (
5466 return;
5467 }
25d7dd99 5468
70586bb3
JB
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++)
5474 {
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 (
5481 NodeOffset += 8;
5482 }
25d7dd99 5483
70586bb3
JB
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++)
5489 {
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 (
25d7dd99 5496
70586bb3 5497 /* Dump the ID mappings */
25d7dd99 5498
70586bb3
JB
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++)
5504 {
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 (
5513 NextSubtable:
5514 /* Point to next node subtable */
25d7dd99 5515
70586bb3
JB
5516- Offset += IortNode->Length;
5517+ ACPI_MOVE_16_TO_16(&NodeLength, &IortNode->Length);
5518+ Offset += NodeLength;
25d7dd99 5519 }
70586bb3 5520 }
25d7dd99 5521
70586bb3
JB
5522@@ -340,11 +357,14 @@ AcpiDmDumpIvrs (
5523 ACPI_IVRS_DE_HEADER *DeviceEntry;
5524 ACPI_IVRS_HEADER *Subtable;
5525 ACPI_DMTABLE_INFO *InfoTable;
5526+ UINT32 Length;
5527+ UINT16 SubLength;
25d7dd99
JB
5528
5529
70586bb3 5530 /* Main table */
25d7dd99 5531
70586bb3
JB
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))
25d7dd99 5536 {
70586bb3
JB
5537 return;
5538@@ -353,13 +373,14 @@ AcpiDmDumpIvrs (
5539 /* Subtables */
25d7dd99 5540
70586bb3
JB
5541 Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset);
5542- while (Offset < Table->Length)
5543+ while (Offset < Length)
5544 {
5545 /* Common subtable header */
25d7dd99 5546
70586bb3
JB
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))
5554 {
5555 return;
5556@@ -391,7 +412,7 @@ AcpiDmDumpIvrs (
25d7dd99 5557
70586bb3 5558 /* Attempt to continue */
25d7dd99 5559
70586bb3
JB
5560- if (!Subtable->Length)
5561+ if (!SubLength)
5562 {
5563 AcpiOsPrintf ("Invalid zero length subtable\n");
5564 return;
5565@@ -402,8 +423,8 @@ AcpiDmDumpIvrs (
5566 /* Dump the subtable */
25d7dd99 5567
25d7dd99 5568 AcpiOsPrintf ("\n");
70586bb3
JB
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))
5574 {
5575 return;
5576@@ -427,7 +448,7 @@ AcpiDmDumpIvrs (
5577 sizeof (ACPI_IVRS_HARDWARE2));
5578 }
25d7dd99 5579
70586bb3
JB
5580- while (EntryOffset < (Offset + Subtable->Length))
5581+ while (EntryOffset < (Offset + SubLength))
5582 {
5583 AcpiOsPrintf ("\n");
5584 /*
5585@@ -489,7 +510,7 @@ AcpiDmDumpIvrs (
25d7dd99 5586
70586bb3 5587 /* Dump the Device Entry */
25d7dd99 5588
70586bb3
JB
5589- Status = AcpiDmDumpTable (Table->Length, EntryOffset,
5590+ Status = AcpiDmDumpTable (Length, EntryOffset,
5591 DeviceEntry, EntryLength, InfoTable);
5592 if (ACPI_FAILURE (Status))
5593 {
5594@@ -505,8 +526,8 @@ AcpiDmDumpIvrs (
5595 NextSubtable:
5596 /* Point to next subtable */
25d7dd99 5597
70586bb3
JB
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);
25d7dd99 5602 }
70586bb3 5603 }
25d7dd99 5604
70586bb3 5605@@ -532,7 +553,7 @@ AcpiDmDumpLpit (
25d7dd99 5606 {
70586bb3
JB
5607 ACPI_STATUS Status;
5608 ACPI_LPIT_HEADER *Subtable;
5609- UINT32 Length = Table->Length;
5610+ UINT32 Length;
5611 UINT32 Offset = sizeof (ACPI_TABLE_LPIT);
5612 ACPI_DMTABLE_INFO *InfoTable;
5613 UINT32 SubtableLength;
5614@@ -540,8 +561,9 @@ AcpiDmDumpLpit (
25d7dd99 5615
70586bb3 5616 /* Subtables */
25d7dd99 5617
70586bb3
JB
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)
25d7dd99 5622 {
70586bb3 5623 /* Common subtable header */
25d7dd99 5624
70586bb3 5625@@ -605,13 +627,14 @@ AcpiDmDumpMadt (
25d7dd99 5626 {
70586bb3
JB
5627 ACPI_STATUS Status;
5628 ACPI_SUBTABLE_HEADER *Subtable;
5629- UINT32 Length = Table->Length;
5630+ UINT32 Length;
5631 UINT32 Offset = sizeof (ACPI_TABLE_MADT);
5632 ACPI_DMTABLE_INFO *InfoTable;
25d7dd99 5633
25d7dd99 5634
70586bb3 5635 /* Main table */
25d7dd99 5636
70586bb3
JB
5637+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5638 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
5639 if (ACPI_FAILURE (Status))
25d7dd99 5640 {
70586bb3
JB
5641@@ -621,7 +644,7 @@ AcpiDmDumpMadt (
5642 /* Subtables */
25d7dd99 5643
70586bb3
JB
5644 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
5645- while (Offset < Table->Length)
5646+ while (Offset < Length)
5647 {
5648 /* Common subtable header */
25d7dd99 5649
70586bb3
JB
5650@@ -767,11 +790,13 @@ AcpiDmDumpMcfg (
5651 ACPI_STATUS Status;
5652 UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
5653 ACPI_MCFG_ALLOCATION *Subtable;
5654+ UINT32 Len;
25d7dd99 5655
25d7dd99 5656
70586bb3 5657 /* Main table */
25d7dd99 5658
70586bb3
JB
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))
5663 {
5664 return;
5665@@ -780,17 +805,17 @@ AcpiDmDumpMcfg (
5666 /* Subtables */
25d7dd99 5667
70586bb3
JB
5668 Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
5669- while (Offset < Table->Length)
5670+ while (Offset < Len)
5671 {
5672- if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
5673+ if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Len)
5674 {
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));
5678 return;
5679 }
25d7dd99 5680
70586bb3
JB
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))
5686 {
5687@@ -824,6 +849,7 @@ AcpiDmDumpMpst (
5688 {
5689 ACPI_STATUS Status;
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;
5699+ UINT32 Length;
25d7dd99 5700
25d7dd99 5701
70586bb3 5702 /* Main table */
25d7dd99 5703
70586bb3
JB
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))
5708 {
5709 return;
5710@@ -844,13 +872,14 @@ AcpiDmDumpMpst (
25d7dd99 5711
70586bb3 5712 /* Subtable: Memory Power Node(s) */
25d7dd99 5713
70586bb3
JB
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);
25d7dd99 5718
70586bb3
JB
5719- while ((Offset < Table->Length) && SubtableCount)
5720+ while ((Offset < Length) && SubtableCount)
5721 {
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))
5727 {
5728@@ -859,8 +888,8 @@ AcpiDmDumpMpst (
25d7dd99 5729
70586bb3 5730 /* Extract the sub-subtable counts */
25d7dd99 5731
70586bb3
JB
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);
25d7dd99 5737
70586bb3
JB
5738 /* Sub-subtables - Memory Power State Structure(s) */
5739@@ -871,7 +900,7 @@ AcpiDmDumpMpst (
5740 while (PowerStateCount)
5741 {
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))
5747 {
5748@@ -881,7 +910,7 @@ AcpiDmDumpMpst (
5749 Subtable0A++;
5750 PowerStateCount--;
5751 Offset += sizeof (ACPI_MPST_POWER_STATE);
5752- }
5753+ }
25d7dd99 5754
70586bb3 5755 /* Sub-subtables - Physical Component ID Structure(s) */
25d7dd99 5756
70586bb3 5757@@ -894,7 +923,7 @@ AcpiDmDumpMpst (
25d7dd99 5758
70586bb3
JB
5759 while (ComponentCount)
5760 {
5761- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B,
5762+ Status = AcpiDmDumpTable (Length, Offset, Subtable0B,
5763 sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B);
5764 if (ACPI_FAILURE (Status))
5765 {
5766@@ -909,17 +938,19 @@ AcpiDmDumpMpst (
5767 /* Point to next Memory Power Node subtable */
25d7dd99 5768
70586bb3
JB
5769 SubtableCount--;
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));
5778 }
25d7dd99 5779
70586bb3 5780 /* Subtable: Count of Memory Power State Characteristic structures */
25d7dd99 5781
70586bb3
JB
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))
5788 {
5789@@ -934,10 +965,10 @@ AcpiDmDumpMpst (
5790 Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1,
5791 sizeof (ACPI_MPST_DATA_HDR));
25d7dd99 5792
70586bb3
JB
5793- while ((Offset < Table->Length) && SubtableCount)
5794+ while ((Offset < Length) && SubtableCount)
5795 {
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))
5801 {
5802@@ -970,11 +1001,13 @@ AcpiDmDumpMsct (
5803 ACPI_STATUS Status;
5804 UINT32 Offset = sizeof (ACPI_TABLE_MSCT);
5805 ACPI_MSCT_PROXIMITY *Subtable;
5806+ UINT32 Length;
25d7dd99 5807
25d7dd99 5808
70586bb3 5809 /* Main table */
25d7dd99 5810
70586bb3
JB
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))
5815 {
5816 return;
5817@@ -983,12 +1016,12 @@ AcpiDmDumpMsct (
5818 /* Subtables */
25d7dd99 5819
70586bb3
JB
5820 Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset);
5821- while (Offset < Table->Length)
5822+ while (Offset < Length)
5823 {
5824 /* Common subtable header */
25d7dd99 5825
70586bb3
JB
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))
5831 {
5832@@ -1023,11 +1056,13 @@ AcpiDmDumpMtmr (
5833 ACPI_STATUS Status;
5834 UINT32 Offset = sizeof (ACPI_TABLE_MTMR);
5835 ACPI_MTMR_ENTRY *Subtable;
5836+ UINT32 Length;
25d7dd99 5837
25d7dd99 5838
70586bb3 5839 /* Main table */
25d7dd99 5840
70586bb3
JB
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))
5845 {
5846 return;
5847@@ -1036,12 +1071,12 @@ AcpiDmDumpMtmr (
5848 /* Subtables */
25d7dd99 5849
70586bb3
JB
5850 Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset);
5851- while (Offset < Table->Length)
5852+ while (Offset < Length)
5853 {
5854 /* Common subtable header */
25d7dd99 5855
70586bb3
JB
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))
5861 {
5862@@ -1083,11 +1118,17 @@ AcpiDmDumpNfit (
5863 ACPI_NFIT_SMBIOS *SmbiosInfo = NULL;
5864 ACPI_NFIT_FLUSH_ADDRESS *Hint = NULL;
5865 UINT32 i;
5866+ UINT32 TableLength;
5867+ UINT16 SubLength;
5868+ UINT16 SubType;
5869+ UINT32 Count;
5870+ UINT16 Count16;
25d7dd99 5871
70586bb3
JB
5872
5873 /* Main table */
5874
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))
5879 {
5880 return;
5881@@ -1096,19 +1137,21 @@ AcpiDmDumpNfit (
5882 /* Subtables */
5883
5884 Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset);
5885- while (Offset < Table->Length)
5886+ while (Offset < TableLength)
5887 {
5888 /* NFIT subtable header */
5889
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))
5897 {
5898 return;
5899 }
5900
5901- switch (Subtable->Type)
5902+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
5903+ switch (SubType)
5904 {
5905 case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
5906
5907@@ -1163,7 +1206,7 @@ AcpiDmDumpNfit (
5908
5909 /* Attempt to continue */
5910
5911- if (!Subtable->Length)
5912+ if (!SubLength)
25d7dd99 5913 {
70586bb3
JB
5914 AcpiOsPrintf ("Invalid zero length subtable\n");
5915 return;
5916@@ -1172,8 +1215,8 @@ AcpiDmDumpNfit (
5917 }
5918
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))
25d7dd99 5925 {
70586bb3
JB
5926 return;
5927@@ -1181,14 +1224,15 @@ AcpiDmDumpNfit (
5928
5929 /* Per-subtable variable-length fields */
5930
5931- switch (Subtable->Type)
5932+ switch (SubType)
5933 {
5934 case ACPI_NFIT_TYPE_INTERLEAVE:
5935
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++)
25d7dd99 5940 {
70586bb3
JB
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 (
25d7dd99 5947
70586bb3 5948 case ACPI_NFIT_TYPE_SMBIOS:
25d7dd99 5949
70586bb3
JB
5950- Length = Subtable->Length -
5951- sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
5952+ Length = SubLength - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8);
25d7dd99 5953
70586bb3
JB
5954 if (Length)
5955 {
5956- Status = AcpiDmDumpTable (Table->Length,
5957+ Status = AcpiDmDumpTable (TableLength,
5958 sizeof (ACPI_NFIT_SMBIOS) - sizeof (UINT8),
5959 SmbiosInfo,
5960 Length, AcpiDmTableInfoNfit3a);
5961@@ -1222,9 +1265,10 @@ AcpiDmDumpNfit (
5962 case ACPI_NFIT_TYPE_FLUSH_ADDRESS:
25d7dd99 5963
70586bb3
JB
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++)
5968 {
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 (
5975 NextSubtable:
5976 /* Point to next subtable */
5977
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);
25d7dd99 5982 }
70586bb3 5983 }
25d7dd99 5984
70586bb3
JB
5985@@ -1269,12 +1313,13 @@ AcpiDmDumpPcct (
5986 ACPI_STATUS Status;
5987 ACPI_PCCT_SUBSPACE *Subtable;
5988 ACPI_DMTABLE_INFO *InfoTable;
5989- UINT32 Length = Table->Length;
5990+ UINT32 Length;
5991 UINT32 Offset = sizeof (ACPI_TABLE_PCCT);
25d7dd99 5992
70586bb3
JB
5993
5994 /* Main table */
5995
5996+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
5997 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPcct);
5998 if (ACPI_FAILURE (Status))
25d7dd99 5999 {
70586bb3
JB
6000@@ -1284,7 +1329,7 @@ AcpiDmDumpPcct (
6001 /* Subtables */
25d7dd99 6002
70586bb3
JB
6003 Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset);
6004- while (Offset < Table->Length)
6005+ while (Offset < Length)
6006 {
6007 /* Common subtable header */
25d7dd99 6008
70586bb3
JB
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;
6014+ UINT32 Length;
6015 UINT32 Offset = sizeof (ACPI_TABLE_PMTT);
6016 UINT32 MemOffset;
6017 UINT32 DimmOffset;
6018 UINT32 DomainOffset;
6019- UINT32 DomainCount;
6020+ UINT16 DomainCount;
6021+ UINT16 SubLength;
6022+ UINT16 Tmp16;
6023+ UINT16 MemLength;
6024+ UINT16 DimmLength;
25d7dd99 6025
25d7dd99 6026
70586bb3
JB
6027 /* Main table */
6028
6029+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6030 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPmtt);
6031 if (ACPI_FAILURE (Status))
6032 {
6033@@ -1443,13 +1493,14 @@ AcpiDmDumpPmtt (
6034 /* Subtables */
6035
6036 Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset);
6037- while (Offset < Table->Length)
6038+ while (Offset < Length)
6039 {
6040 /* Common subtable header */
6041
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))
6048 {
6049 return;
6050@@ -1468,7 +1519,7 @@ AcpiDmDumpPmtt (
6051 /* Dump the fixed-length portion of the subtable */
6052
6053 Status = AcpiDmDumpTable (Length, Offset, Subtable,
6054- Subtable->Length, AcpiDmTableInfoPmtt0);
6055+ SubLength, AcpiDmTableInfoPmtt0);
6056 if (ACPI_FAILURE (Status))
6057 {
6058 return;
6059@@ -1480,15 +1531,16 @@ AcpiDmDumpPmtt (
6060 MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable,
6061 sizeof (ACPI_PMTT_SOCKET));
6062
6063- while (((Offset + MemOffset) < Table->Length) &&
6064- (MemOffset < Subtable->Length))
6065+ while (((Offset + MemOffset) < Length) &&
6066+ (MemOffset < SubLength))
6067 {
6068 /* Common subtable header */
6069
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))
6077 {
6078 return;
6079@@ -1508,7 +1560,7 @@ AcpiDmDumpPmtt (
6080
6081 Status = AcpiDmDumpTable (Length,
6082 Offset + MemOffset, MemSubtable,
6083- MemSubtable->Length, AcpiDmTableInfoPmtt1);
6084+ MemLength, AcpiDmTableInfoPmtt1);
6085 if (ACPI_FAILURE (Status))
6086 {
6087 return;
6088@@ -1516,13 +1568,14 @@ AcpiDmDumpPmtt (
6089
6090 /* Walk the variable count of proximity domains */
6091
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));
6098
6099- while (((Offset + MemOffset + DomainOffset) < Table->Length) &&
6100- ((MemOffset + DomainOffset) < Subtable->Length) &&
6101+ while (((Offset + MemOffset + DomainOffset) < Length) &&
6102+ ((MemOffset + DomainOffset) < SubLength) &&
6103 DomainCount)
6104 {
6105 Status = AcpiDmDumpTable (Length,
6106@@ -1550,15 +1603,16 @@ AcpiDmDumpPmtt (
6107 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable,
6108 DomainOffset);
6109
6110- while (((Offset + MemOffset + DimmOffset) < Table->Length) &&
6111- (DimmOffset < MemSubtable->Length))
6112+ while (((Offset + MemOffset + DimmOffset) < Length) &&
6113+ (DimmOffset < MemLength))
6114 {
6115 /* Common subtable header */
6116
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))
6124 {
6125 return;
6126@@ -1578,7 +1632,7 @@ AcpiDmDumpPmtt (
6127
6128 Status = AcpiDmDumpTable (Length,
6129 Offset + MemOffset + DimmOffset, DimmSubtable,
6130- DimmSubtable->Length, AcpiDmTableInfoPmtt2);
6131+ DimmLength, AcpiDmTableInfoPmtt2);
6132 if (ACPI_FAILURE (Status))
6133 {
6134 return;
6135@@ -1586,23 +1640,22 @@ AcpiDmDumpPmtt (
6136
6137 /* Point to next DIMM subtable */
6138
6139- DimmOffset += DimmSubtable->Length;
6140+ DimmOffset += DimmLength;
6141 DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
6142- DimmSubtable, DimmSubtable->Length);
6143+ DimmSubtable, DimmLength);
6144 }
6145
6146 /* Point to next Controller subtable */
6147
6148- MemOffset += MemSubtable->Length;
6149+ MemOffset += MemLength;
6150 MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER,
6151- MemSubtable, MemSubtable->Length);
6152+ MemSubtable, MemLength);
6153 }
6154
6155 /* Point to next Socket subtable */
25d7dd99 6156
70586bb3
JB
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);
6162 }
6163 }
25d7dd99 6164
70586bb3
JB
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);
6169+ UINT32 Length;
6170+ UINT16 SubType;
25d7dd99 6171
25d7dd99 6172
70586bb3
JB
6173 /* Main table */
6174@@ -1773,20 +1828,22 @@ AcpiDmDumpS3pt (
6175 return 0;
6176 }
25d7dd99 6177
70586bb3
JB
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)
25d7dd99 6182 {
70586bb3 6183 /* Common subtable header */
25d7dd99 6184
70586bb3
JB
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))
6190 {
6191 return 0;
6192 }
25d7dd99 6193
70586bb3
JB
6194- switch (Subtable->Type)
6195+ ACPI_MOVE_16_TO_16(&SubType, &Subtable->Type);
6196+ switch (SubType)
6197 {
6198 case ACPI_S3PT_TYPE_RESUME:
25d7dd99 6199
70586bb3
JB
6200@@ -1801,7 +1858,7 @@ AcpiDmDumpS3pt (
6201 default:
25d7dd99 6202
70586bb3
JB
6203 AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n",
6204- Subtable->Type);
6205+ SubType);
25d7dd99 6206
70586bb3
JB
6207 /* Attempt to continue */
6208
6209@@ -1814,7 +1871,7 @@ AcpiDmDumpS3pt (
6210 }
6211
6212 AcpiOsPrintf ("\n");
6213- Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable,
6214+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
6215 Subtable->Length, InfoTable);
25d7dd99
JB
6216 if (ACPI_FAILURE (Status))
6217 {
70586bb3 6218Index: acpica-unix-20191213/source/common/dmtbdump3.c
25d7dd99 6219===================================================================
70586bb3
JB
6220--- acpica-unix-20191213.orig/source/common/dmtbdump3.c
6221+++ acpica-unix-20191213/source/common/dmtbdump3.c
6222@@ -68,9 +68,11 @@ void
6223 AcpiDmDumpSlic (
6224 ACPI_TABLE_HEADER *Table)
25d7dd99 6225 {
70586bb3 6226+ UINT32 Length;
25d7dd99 6227
70586bb3
JB
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);
6233 }
25d7dd99 6234
25d7dd99 6235
70586bb3
JB
6236@@ -93,14 +95,17 @@ AcpiDmDumpSlit (
6237 ACPI_STATUS Status;
6238 UINT32 Offset;
6239 UINT8 *Row;
6240- UINT32 Localities;
6241+ UINT64 Localities;
25d7dd99 6242 UINT32 i;
70586bb3
JB
6243 UINT32 j;
6244+ UINT32 Length;
6245+ UINT64 Tmp64;
25d7dd99
JB
6246
6247
70586bb3
JB
6248 /* Main table */
6249
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))
25d7dd99 6254 {
70586bb3
JB
6255 return;
6256@@ -108,7 +113,8 @@ AcpiDmDumpSlit (
25d7dd99 6257
70586bb3 6258 /* Display the Locality NxN Matrix */
25d7dd99 6259
70586bb3
JB
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;
25d7dd99 6265
70586bb3 6266@@ -121,7 +127,7 @@ AcpiDmDumpSlit (
25d7dd99 6267 {
70586bb3 6268 /* Check for beyond EOT */
25d7dd99 6269
70586bb3
JB
6270- if (Offset >= Table->Length)
6271+ if (Offset >= Length)
25d7dd99 6272 {
70586bb3
JB
6273 AcpiOsPrintf (
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;
6279+ UINT32 Length;
25d7dd99
JB
6280
6281
70586bb3 6282 /* Main table */
25d7dd99 6283
70586bb3
JB
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))
25d7dd99 6288 {
70586bb3
JB
6289 return;
6290@@ -186,12 +194,12 @@ AcpiDmDumpSrat (
6291 /* Subtables */
25d7dd99 6292
70586bb3
JB
6293 Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
6294- while (Offset < Table->Length)
6295+ while (Offset < Length)
6296 {
6297 /* Common subtable header */
25d7dd99 6298
70586bb3
JB
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))
6304 {
6305@@ -245,7 +253,7 @@ AcpiDmDumpSrat (
25d7dd99 6306 }
25d7dd99 6307
70586bb3
JB
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))
6313 {
6314@@ -282,13 +290,14 @@ AcpiDmDumpStao (
6315 {
25d7dd99 6316 ACPI_STATUS Status;
70586bb3
JB
6317 char *Namepath;
6318- UINT32 Length = Table->Length;
6319+ UINT32 Length;
6320 UINT32 StringLength;
6321 UINT32 Offset = sizeof (ACPI_TABLE_STAO);
25d7dd99
JB
6322
6323
70586bb3 6324 /* Main table */
25d7dd99 6325
70586bb3
JB
6326+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6327 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoStao);
6328 if (ACPI_FAILURE (Status))
6329 {
6330@@ -297,7 +306,7 @@ AcpiDmDumpStao (
25d7dd99 6331
70586bb3 6332 /* The rest of the table consists of Namepath strings */
25d7dd99 6333
70586bb3
JB
6334- while (Offset < Table->Length)
6335+ while (Offset < Length)
6336 {
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);
6342 ACPI_STATUS Status;
6343+ UINT32 Length;
6344+ UINT16 PlatformClass;
25d7dd99 6345
25d7dd99 6346
70586bb3 6347 /* Main table */
25d7dd99 6348
70586bb3
JB
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))
25d7dd99 6354 {
70586bb3
JB
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.
6358 */
6359- switch (CommonHeader->PlatformClass)
6360+ ACPI_MOVE_16_TO_16(&PlatformClass, &CommonHeader->PlatformClass);
6361+ switch (PlatformClass)
6362 {
6363 case ACPI_TCPA_CLIENT_TABLE:
25d7dd99 6364
70586bb3
JB
6365- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6366- Table->Length - Offset, AcpiDmTableInfoTcpaClient);
6367+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
6368+ Length - Offset, AcpiDmTableInfoTcpaClient);
6369 break;
25d7dd99 6370
70586bb3 6371 case ACPI_TCPA_SERVER_TABLE:
25d7dd99 6372
70586bb3
JB
6373- Status = AcpiDmDumpTable (Table->Length, Offset, Subtable,
6374- Table->Length - Offset, AcpiDmTableInfoTcpaServer);
6375+ Status = AcpiDmDumpTable (Length, Offset, Subtable,
6376+ Length - Offset, AcpiDmTableInfoTcpaServer);
6377 break;
25d7dd99 6378
70586bb3
JB
6379 default:
6380@@ -512,11 +525,13 @@ AcpiDmDumpVrtc (
6381 ACPI_STATUS Status;
6382 UINT32 Offset = sizeof (ACPI_TABLE_VRTC);
6383 ACPI_VRTC_ENTRY *Subtable;
6384+ UINT32 Length;
25d7dd99 6385
25d7dd99 6386
70586bb3 6387 /* Main table */
25d7dd99 6388
70586bb3
JB
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))
6393 {
6394 return;
6395@@ -525,12 +540,12 @@ AcpiDmDumpVrtc (
6396 /* Subtables */
25d7dd99 6397
70586bb3
JB
6398 Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset);
6399- while (Offset < Table->Length)
6400+ while (Offset < Length)
6401 {
6402 /* Common subtable header */
25d7dd99 6403
70586bb3
JB
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))
6409 {
6410@@ -565,11 +580,13 @@ AcpiDmDumpWdat (
6411 ACPI_STATUS Status;
6412 UINT32 Offset = sizeof (ACPI_TABLE_WDAT);
6413 ACPI_WDAT_ENTRY *Subtable;
6414+ UINT32 Length;
25d7dd99
JB
6415
6416
70586bb3
JB
6417 /* Main table */
6418
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))
25d7dd99 6423 {
70586bb3
JB
6424 return;
6425@@ -578,12 +595,12 @@ AcpiDmDumpWdat (
6426 /* Subtables */
25d7dd99 6427
70586bb3
JB
6428 Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset);
6429- while (Offset < Table->Length)
6430+ while (Offset < Length)
6431 {
6432 /* Common subtable header */
25d7dd99 6433
70586bb3
JB
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))
6439 {
6440@@ -618,12 +635,13 @@ AcpiDmDumpWpbt (
6441 {
6442 ACPI_STATUS Status;
6443 ACPI_TABLE_WPBT *Subtable;
6444- UINT32 Length = Table->Length;
6445+ UINT32 Length;
6446 UINT16 ArgumentsLength;
25d7dd99 6447
25d7dd99 6448
70586bb3 6449 /* Dump the main table */
25d7dd99 6450
70586bb3
JB
6451+ ACPI_MOVE_32_TO_32(&Length, &Table->Length);
6452 Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoWpbt);
6453 if (ACPI_FAILURE (Status))
6454 {
6455@@ -633,10 +651,10 @@ AcpiDmDumpWpbt (
6456 /* Extract the arguments buffer length from the main table */
25d7dd99 6457
70586bb3
JB
6458 Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
6459- ArgumentsLength = Subtable->ArgumentsLength;
6460+ ACPI_MOVE_16_TO_16(&ArgumentsLength, &Subtable->ArgumentsLength);
25d7dd99 6461
70586bb3 6462 /* Dump the arguments buffer */
25d7dd99 6463
70586bb3
JB
6464- (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
6465+ (void) AcpiDmDumpTable (Length, 0, Table, ArgumentsLength,
6466 AcpiDmTableInfoWpbt0);
6467 }
6468Index: 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 (
6473 UINT32 Entries;
6474 UINT32 Offset;
6475 UINT32 i;
6476+ UINT32 Length;
6477+ UINT32 Address;
25d7dd99 6478
25d7dd99 6479
70586bb3
JB
6480 /* Point to start of table pointer array */
6481@@ -286,12 +288,14 @@ AcpiDmDumpRsdt (
25d7dd99 6482
70586bb3 6483 /* RSDT uses 32-bit pointers */
25d7dd99 6484
70586bb3
JB
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);
25d7dd99 6488
70586bb3 6489 for (i = 0; i < Entries; i++)
25d7dd99 6490 {
70586bb3
JB
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);
6496 }
6497 }
6498@@ -317,6 +321,8 @@ AcpiDmDumpXsdt (
6499 UINT32 Entries;
6500 UINT32 Offset;
6501 UINT32 i;
6502+ UINT32 Length;
6503+ UINT64 Address;
25d7dd99 6504
25d7dd99 6505
70586bb3
JB
6506 /* Point to start of table pointer array */
6507@@ -326,12 +332,14 @@ AcpiDmDumpXsdt (
25d7dd99 6508
70586bb3 6509 /* XSDT uses 64-bit pointers */
25d7dd99 6510
70586bb3
JB
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);
25d7dd99 6514
70586bb3
JB
6515 for (i = 0; i < Entries; i++)
6516 {
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);
25d7dd99 6522 }
70586bb3
JB
6523 }
6524@@ -358,12 +366,12 @@ AcpiDmDumpFadt (
6525 ACPI_TABLE_HEADER *Table)
6526 {
6527 ACPI_STATUS Status;
6528-
6529+ UINT32 Length;
25d7dd99 6530
70586bb3
JB
6531 /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
6532
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))
6538 {
6539 return;
6540@@ -371,11 +379,9 @@ AcpiDmDumpFadt (
25d7dd99 6541
70586bb3 6542 /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
25d7dd99 6543
70586bb3
JB
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))
25d7dd99 6547 {
70586bb3
JB
6548- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6549- AcpiDmTableInfoFadt2);
6550+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt2);
6551 if (ACPI_FAILURE (Status))
6552 {
6553 return;
6554@@ -384,10 +390,9 @@ AcpiDmDumpFadt (
25d7dd99 6555
70586bb3 6556 /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
25d7dd99 6557
70586bb3
JB
6558- else if (Table->Length > ACPI_FADT_V2_SIZE)
6559+ else if (Length > ACPI_FADT_V2_SIZE)
6560 {
6561- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6562- AcpiDmTableInfoFadt3);
6563+ Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFadt3);
6564 if (ACPI_FAILURE (Status))
25d7dd99 6565 {
70586bb3
JB
6566 return;
6567@@ -395,9 +400,9 @@ AcpiDmDumpFadt (
6568
6569 /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
6570
6571- if (Table->Length > ACPI_FADT_V3_SIZE)
6572+ if (Length > ACPI_FADT_V3_SIZE)
25d7dd99 6573 {
70586bb3
JB
6574- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6575+ Status = AcpiDmDumpTable (Length, 0, Table, 0,
6576 AcpiDmTableInfoFadt5);
6577 if (ACPI_FAILURE (Status))
6578 {
6579@@ -407,9 +412,9 @@ AcpiDmDumpFadt (
25d7dd99 6580
70586bb3
JB
6581 /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
6582
6583- if (Table->Length > ACPI_FADT_V3_SIZE)
6584+ if (Length > ACPI_FADT_V3_SIZE)
6585 {
6586- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
6587+ Status = AcpiDmDumpTable (Length, 0, Table, 0,
6588 AcpiDmTableInfoFadt6);
6589 if (ACPI_FAILURE (Status))
25d7dd99 6590 {
70586bb3
JB
6591@@ -420,11 +425,11 @@ AcpiDmDumpFadt (
6592
6593 /* Validate various fields in the FADT, including length */
6594
6595- AcpiTbCreateLocalFadt (Table, Table->Length);
6596+ AcpiTbCreateLocalFadt (Table, Length);
25d7dd99 6597
70586bb3
JB
6598 /* Validate FADT length against the revision */
6599
6600- AcpiDmValidateFadtLength (Table->Revision, Table->Length);
6601+ AcpiDmValidateFadtLength (Table->Revision, Length);
6602 }
6603
6604
6605@@ -450,6 +455,7 @@ AcpiDmValidateFadtLength (
6606 UINT32 Length)
6607 {
6608 UINT32 ExpectedLength;
6609+ UINT32 Tmp32;
6610
6611
6612 switch (Revision)
6613@@ -485,7 +491,8 @@ AcpiDmValidateFadtLength (
6614 return;
6615 }
6616
6617- if (Length == ExpectedLength)
6618+ ACPI_MOVE_32_TO_32(&Tmp32, &Length);
6619+ if (Tmp32 == ExpectedLength)
6620 {
6621 return;
6622 }
6623@@ -493,5 +500,5 @@ AcpiDmValidateFadtLength (
6624 AcpiOsPrintf (
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);
6629 }
This page took 1.232819 seconds and 4 git commands to generate.