]>
Commit | Line | Data |
---|---|---|
77760c90 JB |
1 | Re-use a patch originally created for Debian to enable big-endian |
2 | ||
3 | From: Al Stone <ahs3@redhat.com> | |
4 | ||
5 | support | |
6 | --- | |
7 | source/compiler/aslcodegen.c | 109 ++++++++++++++++++------------ | |
8 | source/compiler/aslopcodes.c | 4 + | |
9 | source/compiler/aslrestype1.c | 68 +++++++++++++------ | |
10 | source/compiler/aslrestype1i.c | 38 +++++++--- | |
11 | source/compiler/aslrestype2.c | 25 ++++--- | |
12 | source/compiler/aslrestype2d.c | 134 +++++++++++++++++++++---------------- | |
13 | source/compiler/aslrestype2e.c | 39 +++++++---- | |
14 | source/compiler/aslrestype2q.c | 117 +++++++++++++++++++++----------- | |
15 | source/compiler/aslrestype2s.c | 86 +++++++++++++++++------- | |
16 | source/compiler/aslrestype2w.c | 127 +++++++++++++++++++++-------------- | |
17 | source/include/acmacros.h | 15 +++- | |
18 | source/include/platform/aclinux.h | 8 ++ | |
19 | 12 files changed, 487 insertions(+), 283 deletions(-) | |
20 | ||
21 | Index: acpica-unix2-20170224/source/compiler/aslcodegen.c | |
22 | =================================================================== | |
23 | --- acpica-unix2-20170224.orig/source/compiler/aslcodegen.c | |
24 | +++ acpica-unix2-20170224/source/compiler/aslcodegen.c | |
25 | @@ -238,16 +238,12 @@ CgWriteAmlOpcode ( | |
f3dfbd7c ER |
26 | ACPI_PARSE_OBJECT *Op) |
27 | { | |
28 | UINT8 PkgLenFirstByte; | |
29 | - UINT32 i; | |
30 | - union { | |
31 | - UINT16 Opcode; | |
32 | - UINT8 OpcodeBytes[2]; | |
33 | - } Aml; | |
34 | - union { | |
35 | - UINT32 Len; | |
36 | - UINT8 LenBytes[4]; | |
37 | - } PkgLen; | |
38 | - | |
39 | + UINT8 Byte; | |
40 | + UINT16 Word; | |
41 | + UINT32 DWord; | |
42 | + UINT64 QWord; | |
43 | + UINT16 AmlOpcode; | |
44 | + UINT32 PkgLen; | |
45 | ||
46 | /* We expect some DEFAULT_ARGs, just ignore them */ | |
47 | ||
77760c90 | 48 | @@ -280,51 +276,52 @@ CgWriteAmlOpcode ( |
f3dfbd7c ER |
49 | |
50 | /* Special opcodes for within a field definition */ | |
51 | ||
52 | - Aml.Opcode = AML_FIELD_OFFSET_OP; | |
53 | + AmlOpcode = AML_FIELD_OFFSET_OP; | |
54 | break; | |
55 | ||
56 | case AML_INT_ACCESSFIELD_OP: | |
57 | ||
58 | - Aml.Opcode = AML_FIELD_ACCESS_OP; | |
59 | + AmlOpcode = AML_FIELD_ACCESS_OP; | |
60 | break; | |
61 | ||
62 | case AML_INT_CONNECTION_OP: | |
63 | ||
64 | - Aml.Opcode = AML_FIELD_CONNECTION_OP; | |
65 | + AmlOpcode = AML_FIELD_CONNECTION_OP; | |
66 | break; | |
67 | ||
68 | default: | |
69 | ||
70 | - Aml.Opcode = Op->Asl.AmlOpcode; | |
71 | + AmlOpcode = Op->Asl.AmlOpcode; | |
72 | break; | |
73 | } | |
74 | ||
75 | ||
76 | - switch (Aml.Opcode) | |
77 | + switch (AmlOpcode) | |
78 | { | |
79 | case AML_PACKAGE_LENGTH: | |
80 | ||
81 | /* Value is the length to be encoded (Used in field definitions) */ | |
82 | ||
83 | - PkgLen.Len = (UINT32) Op->Asl.Value.Integer; | |
84 | + PkgLen = (UINT32) Op->Asl.Value.Integer; | |
85 | break; | |
86 | ||
87 | default: | |
88 | ||
89 | /* Check for two-byte opcode */ | |
90 | ||
91 | - if (Aml.Opcode > 0x00FF) | |
92 | + if (AmlOpcode > 0x00FF) | |
93 | { | |
94 | /* Write the high byte first */ | |
95 | - | |
96 | - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1); | |
97 | + Byte = ACPI_HIBYTE(AmlOpcode); | |
98 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
99 | } | |
100 | ||
101 | - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1); | |
102 | + Byte = ACPI_LOBYTE(AmlOpcode); | |
103 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
104 | ||
105 | /* Subtreelength doesn't include length of package length bytes */ | |
106 | ||
107 | - PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes; | |
108 | + PkgLen = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes; | |
109 | break; | |
110 | } | |
111 | ||
77760c90 | 112 | @@ -335,8 +332,8 @@ CgWriteAmlOpcode ( |
f3dfbd7c ER |
113 | if (Op->Asl.AmlPkgLenBytes == 1) |
114 | { | |
115 | /* Simplest case -- no bytes to follow, just write the count */ | |
116 | - | |
117 | - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1); | |
118 | + Byte = ACPI_LOBYTE(PkgLen); | |
119 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
120 | } | |
121 | else if (Op->Asl.AmlPkgLenBytes != 0) | |
122 | { | |
77760c90 | 123 | @@ -346,7 +343,7 @@ CgWriteAmlOpcode ( |
f3dfbd7c ER |
124 | */ |
125 | PkgLenFirstByte = (UINT8) | |
126 | (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) | | |
127 | - (PkgLen.LenBytes[0] & 0x0F)); | |
128 | + (PkgLen & 0x0F)); | |
129 | ||
130 | CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1); | |
131 | ||
77760c90 | 132 | @@ -354,39 +351,47 @@ CgWriteAmlOpcode ( |
f3dfbd7c ER |
133 | * Shift the length over by the 4 bits we just stuffed |
134 | * in the first byte | |
135 | */ | |
136 | - PkgLen.Len >>= 4; | |
137 | + PkgLen >>= 4; | |
138 | ||
77760c90 JB |
139 | /* |
140 | * Now we can write the remaining bytes - | |
141 | * either 1, 2, or 3 bytes | |
142 | */ | |
f3dfbd7c ER |
143 | - for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++) |
144 | + Byte = ACPI_LOBYTE(PkgLen); | |
145 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
146 | + if (Op->Asl.AmlPkgLenBytes >= 3) | |
147 | + { | |
148 | + Byte = ACPI_HIBYTE(PkgLen); | |
149 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
150 | + } | |
151 | + if (Op->Asl.AmlPkgLenBytes >= 4) | |
152 | { | |
153 | - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1); | |
154 | + Byte = ACPI_LOBYTE(ACPI_HIWORD(PkgLen)); | |
155 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
156 | } | |
157 | } | |
158 | } | |
159 | ||
160 | - switch (Aml.Opcode) | |
161 | + switch (AmlOpcode) | |
162 | { | |
163 | case AML_BYTE_OP: | |
164 | - | |
165 | - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1); | |
166 | + Byte = (UINT8) Op->Asl.Value.Integer; | |
167 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
168 | break; | |
169 | ||
170 | case AML_WORD_OP: | |
171 | - | |
172 | - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2); | |
173 | + ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer); | |
174 | + CgLocalWriteAmlData (Op, &Word, 2); | |
175 | break; | |
176 | ||
177 | case AML_DWORD_OP: | |
178 | - | |
179 | - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4); | |
180 | + ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer); | |
181 | + CgLocalWriteAmlData (Op, &DWord, 4); | |
182 | break; | |
183 | ||
184 | case AML_QWORD_OP: | |
185 | - | |
186 | - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 8); | |
187 | + ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer); | |
188 | + CgLocalWriteAmlData (Op, &QWord, 8); | |
189 | break; | |
190 | ||
191 | case AML_STRING_OP: | |
77760c90 | 192 | @@ -420,6 +425,7 @@ CgWriteTableHeader ( |
f3dfbd7c ER |
193 | ACPI_PARSE_OBJECT *Op) |
194 | { | |
195 | ACPI_PARSE_OBJECT *Child; | |
77760c90 JB |
196 | + UINT32 DWord; |
197 | UINT32 CommentLength; | |
198 | ACPI_COMMENT_NODE *Current; | |
f3dfbd7c | 199 | |
77760c90 | 200 | @@ -473,7 +479,7 @@ CgWriteTableHeader ( |
f3dfbd7c ER |
201 | /* OEM Revision */ |
202 | ||
203 | Child = Child->Asl.Next; | |
204 | - TableHeader.OemRevision = (UINT32) Child->Asl.Value.Integer; | |
205 | + ACPI_MOVE_64_TO_32(&TableHeader.OemRevision, &Child->Asl.Value.Integer); | |
206 | ||
207 | /* Compiler ID */ | |
208 | ||
77760c90 | 209 | @@ -481,12 +487,13 @@ CgWriteTableHeader ( |
f3dfbd7c ER |
210 | |
211 | /* Compiler version */ | |
212 | ||
77760c90 JB |
213 | - TableHeader.AslCompilerRevision = ACPI_CA_VERSION; |
214 | + DWord = ACPI_CA_VERSION; | |
f3dfbd7c ER |
215 | + ACPI_MOVE_32_TO_32(&TableHeader.AslCompilerRevision, &DWord); |
216 | ||
217 | /* Table length. Checksum zero for now, will rewrite later */ | |
218 | ||
77760c90 JB |
219 | - TableHeader.Length = sizeof (ACPI_TABLE_HEADER) + |
220 | - Op->Asl.AmlSubtreeLength; | |
221 | + DWord = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; | |
222 | + ACPI_MOVE_32_TO_32(&TableHeader.Length, &DWord); | |
f3dfbd7c | 223 | |
77760c90 JB |
224 | /* Calculate the comment lengths for this definition block parseOp */ |
225 | ||
226 | @@ -643,7 +650,10 @@ CgWriteNode ( | |
f3dfbd7c ER |
227 | ACPI_PARSE_OBJECT *Op) |
228 | { | |
229 | ASL_RESOURCE_NODE *Rnode; | |
230 | - | |
231 | + UINT8 Byte; | |
232 | + UINT16 Word; | |
233 | + UINT32 DWord; | |
234 | + UINT64 QWord; | |
235 | ||
77760c90 JB |
236 | /* Write all comments here. */ |
237 | if (Gbl_CaptureComments) | |
238 | @@ -672,13 +682,24 @@ CgWriteNode ( | |
f3dfbd7c ER |
239 | switch (Op->Asl.AmlOpcode) |
240 | { | |
241 | case AML_RAW_DATA_BYTE: | |
242 | + Byte = (UINT8) Op->Asl.Value.Integer; | |
243 | + CgLocalWriteAmlData (Op, &Byte, 1); | |
244 | + return; | |
245 | + | |
246 | case AML_RAW_DATA_WORD: | |
247 | - case AML_RAW_DATA_DWORD: | |
248 | - case AML_RAW_DATA_QWORD: | |
249 | + ACPI_MOVE_64_TO_16(&Word, &Op->Asl.Value.Integer); | |
250 | + CgLocalWriteAmlData (Op, &Word, 2); | |
251 | + return; | |
252 | ||
253 | - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength); | |
254 | + case AML_RAW_DATA_DWORD: | |
255 | + ACPI_MOVE_64_TO_32(&DWord, &Op->Asl.Value.Integer); | |
256 | + CgLocalWriteAmlData (Op, &DWord, 4); | |
257 | return; | |
258 | ||
259 | + case AML_RAW_DATA_QWORD: | |
260 | + ACPI_MOVE_64_TO_64(&QWord, &Op->Asl.Value.Integer); | |
261 | + CgLocalWriteAmlData (Op, &QWord, 8); | |
262 | + return; | |
263 | ||
264 | case AML_RAW_DATA_BUFFER: | |
265 | ||
77760c90 JB |
266 | Index: acpica-unix2-20170224/source/compiler/aslopcodes.c |
267 | =================================================================== | |
268 | --- acpica-unix2-20170224.orig/source/compiler/aslopcodes.c | |
269 | +++ acpica-unix2-20170224/source/compiler/aslopcodes.c | |
270 | @@ -485,6 +485,7 @@ OpcDoUnicode ( | |
f3dfbd7c ER |
271 | UINT32 i; |
272 | UINT8 *AsciiString; | |
273 | UINT16 *UnicodeString; | |
274 | + UINT16 UChar; | |
275 | ACPI_PARSE_OBJECT *BufferLengthOp; | |
276 | ||
277 | ||
77760c90 | 278 | @@ -511,7 +512,8 @@ OpcDoUnicode ( |
f3dfbd7c ER |
279 | |
280 | for (i = 0; i < Count; i++) | |
281 | { | |
282 | - UnicodeString[i] = (UINT16) AsciiString[i]; | |
283 | + UChar = (UINT16) AsciiString[i]; | |
284 | + ACPI_MOVE_16_TO_16(&UnicodeString[i], &UChar); | |
285 | } | |
286 | ||
287 | /* | |
77760c90 JB |
288 | Index: acpica-unix2-20170224/source/compiler/aslrestype1.c |
289 | =================================================================== | |
290 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype1.c | |
291 | +++ acpica-unix2-20170224/source/compiler/aslrestype1.c | |
292 | @@ -142,6 +142,11 @@ RsDoMemory24Descriptor ( | |
f3dfbd7c ER |
293 | ACPI_PARSE_OBJECT *LengthOp = NULL; |
294 | ASL_RESOURCE_NODE *Rnode; | |
295 | UINT32 CurrentByteOffset; | |
296 | + UINT16 Minimum = 0; | |
297 | + UINT16 Maximum = 0; | |
298 | + UINT16 AddressLength = 0; | |
299 | + UINT16 Alignment = 0; | |
300 | + UINT16 ResourceLength; | |
301 | UINT32 i; | |
302 | ||
303 | ||
77760c90 | 304 | @@ -151,7 +156,8 @@ RsDoMemory24Descriptor ( |
f3dfbd7c ER |
305 | |
306 | Descriptor = Rnode->Buffer; | |
77760c90 | 307 | Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24; |
f3dfbd7c ER |
308 | - Descriptor->Memory24.ResourceLength = 9; |
309 | + ResourceLength = 9; | |
310 | + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.ResourceLength, &ResourceLength); | |
311 | ||
312 | /* Process all child initialization nodes */ | |
313 | ||
77760c90 | 314 | @@ -168,7 +174,7 @@ RsDoMemory24Descriptor ( |
f3dfbd7c ER |
315 | |
316 | case 1: /* Min Address */ | |
317 | ||
318 | - Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; | |
319 | + Minimum = (UINT16) InitializerOp->Asl.Value.Integer; | |
320 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
321 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum)); | |
322 | MinOp = InitializerOp; | |
77760c90 | 323 | @@ -176,7 +182,7 @@ RsDoMemory24Descriptor ( |
f3dfbd7c ER |
324 | |
325 | case 2: /* Max Address */ | |
326 | ||
327 | - Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; | |
328 | + Maximum = (UINT16) InitializerOp->Asl.Value.Integer; | |
329 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
330 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum)); | |
331 | MaxOp = InitializerOp; | |
77760c90 | 332 | @@ -184,14 +190,14 @@ RsDoMemory24Descriptor ( |
f3dfbd7c ER |
333 | |
334 | case 3: /* Alignment */ | |
335 | ||
336 | - Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer; | |
337 | + Alignment = (UINT16) InitializerOp->Asl.Value.Integer; | |
338 | RsCreateWordField (InitializerOp, ACPI_RESTAG_ALIGNMENT, | |
339 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment)); | |
340 | break; | |
341 | ||
342 | case 4: /* Length */ | |
343 | ||
344 | - Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; | |
345 | + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; | |
346 | RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
347 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength)); | |
348 | LengthOp = InitializerOp; | |
77760c90 | 349 | @@ -214,12 +220,17 @@ RsDoMemory24Descriptor ( |
f3dfbd7c ER |
350 | /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */ |
351 | ||
352 | RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24, | |
353 | - Descriptor->Memory24.Minimum, | |
354 | - Descriptor->Memory24.Maximum, | |
355 | - Descriptor->Memory24.AddressLength, | |
356 | - Descriptor->Memory24.Alignment, | |
357 | + Minimum, | |
358 | + Maximum, | |
359 | + AddressLength, | |
360 | + Alignment, | |
361 | MinOp, MaxOp, LengthOp, NULL, Info->DescriptorTypeOp); | |
362 | ||
363 | + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Minimum, &Minimum); | |
364 | + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Maximum, &Maximum); | |
365 | + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.AddressLength, &AddressLength); | |
366 | + ACPI_MOVE_16_TO_16(&Descriptor->Memory24.Alignment, &Alignment); | |
367 | + | |
368 | return (Rnode); | |
369 | } | |
370 | ||
77760c90 | 371 | @@ -248,6 +259,11 @@ RsDoMemory32Descriptor ( |
f3dfbd7c ER |
372 | ACPI_PARSE_OBJECT *AlignOp = NULL; |
373 | ASL_RESOURCE_NODE *Rnode; | |
374 | UINT32 CurrentByteOffset; | |
375 | + UINT32 Minimum = 0; | |
376 | + UINT32 Maximum = 0; | |
377 | + UINT32 AddressLength = 0; | |
378 | + UINT32 Alignment = 0; | |
379 | + UINT16 ResourceLength; | |
380 | UINT32 i; | |
381 | ||
382 | ||
77760c90 | 383 | @@ -257,7 +273,8 @@ RsDoMemory32Descriptor ( |
f3dfbd7c ER |
384 | |
385 | Descriptor = Rnode->Buffer; | |
77760c90 | 386 | Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32; |
f3dfbd7c ER |
387 | - Descriptor->Memory32.ResourceLength = 17; |
388 | + ResourceLength = 17; | |
389 | + ACPI_MOVE_16_TO_16(&Descriptor->Memory32.ResourceLength, &ResourceLength); | |
390 | ||
391 | /* Process all child initialization nodes */ | |
392 | ||
77760c90 | 393 | @@ -274,7 +291,7 @@ RsDoMemory32Descriptor ( |
f3dfbd7c ER |
394 | |
395 | case 1: /* Min Address */ | |
396 | ||
397 | - Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer; | |
398 | + Minimum = (UINT32) InitializerOp->Asl.Value.Integer; | |
399 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
400 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum)); | |
401 | MinOp = InitializerOp; | |
77760c90 | 402 | @@ -282,7 +299,7 @@ RsDoMemory32Descriptor ( |
f3dfbd7c ER |
403 | |
404 | case 2: /* Max Address */ | |
405 | ||
406 | - Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer; | |
407 | + Maximum = (UINT32) InitializerOp->Asl.Value.Integer; | |
408 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
409 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum)); | |
410 | MaxOp = InitializerOp; | |
77760c90 | 411 | @@ -290,7 +307,7 @@ RsDoMemory32Descriptor ( |
f3dfbd7c ER |
412 | |
413 | case 3: /* Alignment */ | |
414 | ||
415 | - Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer; | |
416 | + Alignment = (UINT32) InitializerOp->Asl.Value.Integer; | |
417 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_ALIGNMENT, | |
418 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment)); | |
419 | AlignOp = InitializerOp; | |
77760c90 | 420 | @@ -298,7 +315,7 @@ RsDoMemory32Descriptor ( |
f3dfbd7c ER |
421 | |
422 | case 4: /* Length */ | |
423 | ||
424 | - Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; | |
425 | + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; | |
426 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
427 | CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength)); | |
428 | LengthOp = InitializerOp; | |
77760c90 | 429 | @@ -321,12 +338,17 @@ RsDoMemory32Descriptor ( |
f3dfbd7c ER |
430 | /* Validate the Min/Max/Len/Align values */ |
431 | ||
432 | RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32, | |
433 | - Descriptor->Memory32.Minimum, | |
434 | - Descriptor->Memory32.Maximum, | |
435 | - Descriptor->Memory32.AddressLength, | |
436 | - Descriptor->Memory32.Alignment, | |
437 | + Minimum, | |
438 | + Maximum, | |
439 | + AddressLength, | |
440 | + Alignment, | |
441 | MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp); | |
442 | ||
443 | + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Minimum, &Minimum); | |
444 | + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Maximum, &Maximum); | |
445 | + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.AddressLength, &AddressLength); | |
446 | + ACPI_MOVE_32_TO_32(&Descriptor->Memory32.Alignment, &Alignment); | |
447 | + | |
448 | return (Rnode); | |
449 | } | |
450 | ||
77760c90 | 451 | @@ -351,6 +373,7 @@ RsDoMemory32FixedDescriptor ( |
f3dfbd7c ER |
452 | ACPI_PARSE_OBJECT *InitializerOp; |
453 | ASL_RESOURCE_NODE *Rnode; | |
454 | UINT32 CurrentByteOffset; | |
455 | + UINT16 ResourceLength; | |
456 | UINT32 i; | |
457 | ||
458 | ||
77760c90 | 459 | @@ -360,7 +383,8 @@ RsDoMemory32FixedDescriptor ( |
f3dfbd7c ER |
460 | |
461 | Descriptor = Rnode->Buffer; | |
77760c90 | 462 | Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32; |
f3dfbd7c ER |
463 | - Descriptor->FixedMemory32.ResourceLength = 9; |
464 | + ResourceLength = 9; | |
465 | + ACPI_MOVE_16_TO_16(&Descriptor->FixedMemory32.ResourceLength, &ResourceLength); | |
466 | ||
467 | /* Process all child initialization nodes */ | |
468 | ||
77760c90 | 469 | @@ -377,14 +401,16 @@ RsDoMemory32FixedDescriptor ( |
f3dfbd7c ER |
470 | |
471 | case 1: /* Address */ | |
472 | ||
473 | - Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer; | |
474 | + ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.Address, | |
475 | + &InitializerOp->Asl.Value.Integer); | |
476 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_BASEADDRESS, | |
477 | CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address)); | |
478 | break; | |
479 | ||
480 | case 2: /* Length */ | |
481 | ||
482 | - Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; | |
483 | + ACPI_MOVE_64_TO_32(&Descriptor->FixedMemory32.AddressLength, | |
484 | + &InitializerOp->Asl.Value.Integer); | |
485 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
486 | CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength)); | |
487 | break; | |
77760c90 JB |
488 | Index: acpica-unix2-20170224/source/compiler/aslrestype1i.c |
489 | =================================================================== | |
490 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype1i.c | |
491 | +++ acpica-unix2-20170224/source/compiler/aslrestype1i.c | |
492 | @@ -198,6 +198,8 @@ RsDoFixedDmaDescriptor ( | |
f3dfbd7c ER |
493 | ACPI_PARSE_OBJECT *InitializerOp; |
494 | ASL_RESOURCE_NODE *Rnode; | |
495 | UINT32 CurrentByteOffset; | |
496 | + UINT16 RequestLines = 0; | |
497 | + UINT16 Channels = 0; | |
498 | UINT32 i; | |
499 | ||
500 | ||
77760c90 | 501 | @@ -217,14 +219,14 @@ RsDoFixedDmaDescriptor ( |
f3dfbd7c ER |
502 | { |
503 | case 0: /* DMA Request Lines [WORD] (_DMA) */ | |
504 | ||
505 | - Descriptor->FixedDma.RequestLines = (UINT16) InitializerOp->Asl.Value.Integer; | |
506 | + RequestLines = (UINT16) InitializerOp->Asl.Value.Integer; | |
507 | RsCreateWordField (InitializerOp, ACPI_RESTAG_DMA, | |
508 | CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.RequestLines)); | |
509 | break; | |
510 | ||
511 | case 1: /* DMA Channel [WORD] (_TYP) */ | |
512 | ||
513 | - Descriptor->FixedDma.Channels = (UINT16) InitializerOp->Asl.Value.Integer; | |
514 | + Channels = (UINT16) InitializerOp->Asl.Value.Integer; | |
515 | RsCreateWordField (InitializerOp, ACPI_RESTAG_DMATYPE, | |
516 | CurrentByteOffset + ASL_RESDESC_OFFSET (FixedDma.Channels)); | |
517 | break; | |
77760c90 | 518 | @@ -249,6 +251,9 @@ RsDoFixedDmaDescriptor ( |
f3dfbd7c ER |
519 | InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); |
520 | } | |
521 | ||
522 | + ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.RequestLines, &RequestLines); | |
523 | + ACPI_MOVE_16_TO_16(&Descriptor->FixedDma.Channels, &Channels); | |
524 | + | |
525 | return (Rnode); | |
526 | } | |
527 | ||
77760c90 | 528 | @@ -274,6 +279,7 @@ RsDoFixedIoDescriptor ( |
f3dfbd7c ER |
529 | ACPI_PARSE_OBJECT *AddressOp = NULL; |
530 | ASL_RESOURCE_NODE *Rnode; | |
531 | UINT32 CurrentByteOffset; | |
532 | + UINT16 Address = 0; | |
533 | UINT32 i; | |
534 | ||
535 | ||
77760c90 | 536 | @@ -293,8 +299,7 @@ RsDoFixedIoDescriptor ( |
f3dfbd7c ER |
537 | { |
538 | case 0: /* Base Address */ | |
539 | ||
540 | - Descriptor->FixedIo.Address = | |
541 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
542 | + Address = (UINT16) InitializerOp->Asl.Value.Integer; | |
543 | RsCreateWordField (InitializerOp, ACPI_RESTAG_BASEADDRESS, | |
544 | CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address)); | |
545 | AddressOp = InitializerOp; | |
77760c90 | 546 | @@ -324,11 +329,13 @@ RsDoFixedIoDescriptor ( |
f3dfbd7c ER |
547 | |
548 | /* Error checks */ | |
549 | ||
550 | - if (Descriptor->FixedIo.Address > 0x03FF) | |
551 | + if (Address > 0x03FF) | |
552 | { | |
553 | AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL); | |
554 | } | |
555 | ||
556 | + ACPI_MOVE_16_TO_16(&Descriptor->FixedIo.Address, &Address); | |
557 | + | |
558 | return (Rnode); | |
559 | } | |
560 | ||
77760c90 | 561 | @@ -357,6 +364,8 @@ RsDoIoDescriptor ( |
f3dfbd7c ER |
562 | ACPI_PARSE_OBJECT *AlignOp = NULL; |
563 | ASL_RESOURCE_NODE *Rnode; | |
564 | UINT32 CurrentByteOffset; | |
565 | + UINT16 Minimum = 0; | |
566 | + UINT16 Maximum = 0; | |
567 | UINT32 i; | |
568 | ||
569 | ||
77760c90 | 570 | @@ -383,8 +392,7 @@ RsDoIoDescriptor ( |
f3dfbd7c ER |
571 | |
572 | case 1: /* Min Address */ | |
573 | ||
574 | - Descriptor->Io.Minimum = | |
575 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
576 | + Minimum = (UINT16) InitializerOp->Asl.Value.Integer; | |
577 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
578 | CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum)); | |
579 | MinOp = InitializerOp; | |
77760c90 | 580 | @@ -392,8 +400,7 @@ RsDoIoDescriptor ( |
f3dfbd7c ER |
581 | |
582 | case 2: /* Max Address */ | |
583 | ||
584 | - Descriptor->Io.Maximum = | |
585 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
586 | + Maximum = (UINT16) InitializerOp->Asl.Value.Integer; | |
587 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
588 | CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum)); | |
589 | MaxOp = InitializerOp; | |
77760c90 | 590 | @@ -434,12 +441,15 @@ RsDoIoDescriptor ( |
f3dfbd7c ER |
591 | /* Validate the Min/Max/Len/Align values */ |
592 | ||
593 | RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO, | |
594 | - Descriptor->Io.Minimum, | |
595 | - Descriptor->Io.Maximum, | |
596 | + Minimum, | |
597 | + Maximum, | |
598 | Descriptor->Io.AddressLength, | |
599 | Descriptor->Io.Alignment, | |
600 | MinOp, MaxOp, LengthOp, AlignOp, Info->DescriptorTypeOp); | |
601 | ||
602 | + ACPI_MOVE_16_TO_16(&Descriptor->Io.Minimum, &Minimum); | |
603 | + ACPI_MOVE_16_TO_16(&Descriptor->Io.Maximum, &Maximum); | |
604 | + | |
605 | return (Rnode); | |
606 | } | |
607 | ||
77760c90 | 608 | @@ -559,9 +569,9 @@ RsDoIrqDescriptor ( |
f3dfbd7c ER |
609 | InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); |
610 | } | |
611 | ||
612 | - /* Now we can set the channel mask */ | |
613 | + /* Now we can set the interrupt mask */ | |
614 | ||
615 | - Descriptor->Irq.IrqMask = IrqMask; | |
616 | + ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask); | |
617 | return (Rnode); | |
618 | } | |
619 | ||
77760c90 | 620 | @@ -660,6 +670,6 @@ RsDoIrqNoFlagsDescriptor ( |
f3dfbd7c ER |
621 | |
622 | /* Now we can set the interrupt mask */ | |
623 | ||
624 | - Descriptor->Irq.IrqMask = IrqMask; | |
625 | + ACPI_MOVE_16_TO_16(&Descriptor->Irq.IrqMask, &IrqMask); | |
626 | return (Rnode); | |
627 | } | |
77760c90 JB |
628 | Index: acpica-unix2-20170224/source/compiler/aslrestype2.c |
629 | =================================================================== | |
630 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype2.c | |
631 | +++ acpica-unix2-20170224/source/compiler/aslrestype2.c | |
632 | @@ -76,6 +76,7 @@ RsDoGeneralRegisterDescriptor ( | |
f3dfbd7c ER |
633 | ACPI_PARSE_OBJECT *InitializerOp; |
634 | ASL_RESOURCE_NODE *Rnode; | |
635 | UINT32 CurrentByteOffset; | |
636 | + UINT16 ResourceLength; | |
637 | UINT32 i; | |
638 | ||
639 | ||
77760c90 | 640 | @@ -85,7 +86,9 @@ RsDoGeneralRegisterDescriptor ( |
f3dfbd7c ER |
641 | |
642 | Descriptor = Rnode->Buffer; | |
643 | Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER; | |
644 | - Descriptor->GenericReg.ResourceLength = 12; | |
645 | + ResourceLength = 12; | |
646 | + ACPI_MOVE_16_TO_16(&Descriptor->GenericReg.ResourceLength, | |
647 | + &ResourceLength); | |
648 | ||
649 | /* Process all child initialization nodes */ | |
650 | ||
77760c90 | 651 | @@ -116,7 +119,8 @@ RsDoGeneralRegisterDescriptor ( |
f3dfbd7c ER |
652 | |
653 | case 3: /* Register Address */ | |
654 | ||
655 | - Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer; | |
656 | + ACPI_MOVE_64_TO_64(&Descriptor->GenericReg.Address, | |
657 | + &InitializerOp->Asl.Value.Integer); | |
658 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_ADDRESS, | |
659 | CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address)); | |
660 | break; | |
77760c90 | 661 | @@ -177,6 +181,7 @@ RsDoInterruptDescriptor ( |
f3dfbd7c ER |
662 | AML_RESOURCE *Rover = NULL; |
663 | ACPI_PARSE_OBJECT *InitializerOp; | |
664 | ASL_RESOURCE_NODE *Rnode; | |
665 | + UINT16 ResourceLength = 0; | |
666 | UINT16 StringLength = 0; | |
667 | UINT32 OptionIndex = 0; | |
668 | UINT32 CurrentByteOffset; | |
77760c90 | 669 | @@ -225,7 +230,7 @@ RsDoInterruptDescriptor ( |
f3dfbd7c ER |
670 | * Initial descriptor length -- may be enlarged if there are |
671 | * optional fields present | |
672 | */ | |
673 | - Descriptor->ExtendedIrq.ResourceLength = 2; /* Flags and table length byte */ | |
674 | + ResourceLength = 2; /* Flags and table length byte */ | |
675 | Descriptor->ExtendedIrq.InterruptCount = 0; | |
676 | ||
677 | Rover = ACPI_CAST_PTR (AML_RESOURCE, | |
77760c90 | 678 | @@ -333,10 +338,11 @@ RsDoInterruptDescriptor ( |
f3dfbd7c ER |
679 | |
680 | /* Save the integer and move pointer to the next one */ | |
681 | ||
682 | - Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer; | |
683 | + ACPI_MOVE_64_TO_32(&Rover->DwordItem, | |
684 | + &InitializerOp->Asl.Value.Integer); | |
685 | Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4); | |
686 | Descriptor->ExtendedIrq.InterruptCount++; | |
687 | - Descriptor->ExtendedIrq.ResourceLength += 4; | |
688 | + ResourceLength += 4; | |
689 | ||
690 | /* Case 7: First interrupt number in list */ | |
691 | ||
77760c90 | 692 | @@ -372,7 +378,7 @@ RsDoInterruptDescriptor ( |
f3dfbd7c ER |
693 | { |
694 | Rover->ByteItem = ResSourceIndex; | |
695 | Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1); | |
696 | - Descriptor->ExtendedIrq.ResourceLength += 1; | |
697 | + ResourceLength += 1; | |
698 | } | |
699 | ||
700 | /* Add optional ResSource string if present */ | |
77760c90 | 701 | @@ -384,14 +390,15 @@ RsDoInterruptDescriptor ( |
f3dfbd7c ER |
702 | Rover = ACPI_ADD_PTR ( |
703 | AML_RESOURCE, &(Rover->ByteItem), StringLength); | |
704 | ||
705 | - Descriptor->ExtendedIrq.ResourceLength = (UINT16) | |
706 | - (Descriptor->ExtendedIrq.ResourceLength + StringLength); | |
707 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
708 | } | |
709 | ||
77760c90 JB |
710 | Rnode->BufferLength = |
711 | (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) - | |
712 | ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType)) | |
713 | + OptionIndex + StringLength; | |
f3dfbd7c ER |
714 | + ACPI_MOVE_16_TO_16(&Descriptor->ExtendedIrq.ResourceLength, |
715 | + &ResourceLength); | |
716 | return (Rnode); | |
717 | } | |
718 | ||
77760c90 | 719 | @@ -439,7 +446,7 @@ RsDoVendorLargeDescriptor ( |
f3dfbd7c ER |
720 | |
721 | Descriptor = Rnode->Buffer; | |
77760c90 | 722 | Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE; |
f3dfbd7c ER |
723 | - Descriptor->VendorLarge.ResourceLength = (UINT16) i; |
724 | + ACPI_MOVE_32_TO_16(&Descriptor->VendorLarge.ResourceLength, &i); | |
725 | ||
726 | /* Point to end-of-descriptor for vendor data */ | |
727 | ||
77760c90 JB |
728 | Index: acpica-unix2-20170224/source/compiler/aslrestype2d.c |
729 | =================================================================== | |
730 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype2d.c | |
731 | +++ acpica-unix2-20170224/source/compiler/aslrestype2d.c | |
732 | @@ -79,7 +79,13 @@ RsDoDwordIoDescriptor ( | |
f3dfbd7c ER |
733 | ACPI_PARSE_OBJECT *GranOp = NULL; |
734 | ASL_RESOURCE_NODE *Rnode; | |
735 | UINT16 StringLength = 0; | |
736 | + UINT16 ResourceLength = 0; | |
737 | UINT32 OptionIndex = 0; | |
738 | + UINT32 Minimum = 0; | |
739 | + UINT32 Maximum = 0; | |
740 | + UINT32 AddressLength = 0; | |
741 | + UINT32 Granularity = 0; | |
742 | + UINT32 TranslationOffset = 0; | |
743 | UINT8 *OptionalFields; | |
744 | UINT32 CurrentByteOffset; | |
745 | UINT32 i; | |
77760c90 | 746 | @@ -102,8 +108,7 @@ RsDoDwordIoDescriptor ( |
f3dfbd7c ER |
747 | * optional fields present |
748 | */ | |
749 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); | |
750 | - Descriptor->Address32.ResourceLength = (UINT16) | |
751 | - (sizeof (AML_RESOURCE_ADDRESS32) - | |
752 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) - | |
753 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
754 | ||
755 | /* Process all child initialization nodes */ | |
77760c90 | 756 | @@ -147,8 +152,7 @@ RsDoDwordIoDescriptor ( |
f3dfbd7c ER |
757 | |
758 | case 5: /* Address Granularity */ | |
759 | ||
760 | - Descriptor->Address32.Granularity = | |
761 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
762 | + Granularity = (UINT32) InitializerOp->Asl.Value.Integer; | |
763 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
764 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); | |
765 | GranOp = InitializerOp; | |
77760c90 | 766 | @@ -156,8 +160,7 @@ RsDoDwordIoDescriptor ( |
f3dfbd7c ER |
767 | |
768 | case 6: /* Address Min */ | |
769 | ||
770 | - Descriptor->Address32.Minimum = | |
771 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
772 | + Minimum = (UINT32) InitializerOp->Asl.Value.Integer; | |
773 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
774 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); | |
775 | MinOp = InitializerOp; | |
77760c90 | 776 | @@ -165,8 +168,7 @@ RsDoDwordIoDescriptor ( |
f3dfbd7c ER |
777 | |
778 | case 7: /* Address Max */ | |
779 | ||
780 | - Descriptor->Address32.Maximum = | |
781 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
782 | + Maximum = (UINT32) InitializerOp->Asl.Value.Integer; | |
783 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
784 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); | |
785 | MaxOp = InitializerOp; | |
77760c90 | 786 | @@ -174,16 +176,14 @@ RsDoDwordIoDescriptor ( |
f3dfbd7c ER |
787 | |
788 | case 8: /* Translation Offset */ | |
789 | ||
790 | - Descriptor->Address32.TranslationOffset = | |
791 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
792 | + TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer; | |
793 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
794 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); | |
795 | break; | |
796 | ||
797 | case 9: /* Address Length */ | |
798 | ||
799 | - Descriptor->Address32.AddressLength = | |
800 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
801 | + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; | |
802 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
803 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); | |
804 | LengthOp = InitializerOp; | |
805 | @@ -197,7 +197,7 @@ RsDoDwordIoDescriptor ( | |
806 | ||
807 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
808 | OptionIndex++; | |
809 | - Descriptor->Address32.ResourceLength++; | |
810 | + ResourceLength++; | |
811 | ResSourceIndex = TRUE; | |
812 | } | |
813 | break; | |
77760c90 | 814 | @@ -211,8 +211,7 @@ RsDoDwordIoDescriptor ( |
f3dfbd7c ER |
815 | { |
816 | /* Found a valid ResourceSource */ | |
817 | ||
818 | - Descriptor->Address32.ResourceLength = (UINT16) | |
819 | - (Descriptor->Address32.ResourceLength + StringLength); | |
820 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
821 | ||
822 | strcpy ((char *) | |
823 | &OptionalFields[OptionIndex], | |
77760c90 | 824 | @@ -272,13 +271,20 @@ RsDoDwordIoDescriptor ( |
f3dfbd7c ER |
825 | /* Validate the Min/Max/Len/Gran values */ |
826 | ||
827 | RsLargeAddressCheck ( | |
828 | - (UINT64) Descriptor->Address32.Minimum, | |
829 | - (UINT64) Descriptor->Address32.Maximum, | |
830 | - (UINT64) Descriptor->Address32.AddressLength, | |
831 | - (UINT64) Descriptor->Address32.Granularity, | |
832 | + Minimum, | |
833 | + Maximum, | |
834 | + AddressLength, | |
835 | + Granularity, | |
836 | Descriptor->Address32.Flags, | |
837 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
838 | ||
839 | + ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength); | |
840 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum); | |
841 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum); | |
842 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength); | |
843 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity); | |
844 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset); | |
845 | + | |
846 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + | |
847 | OptionIndex + StringLength; | |
848 | return (Rnode); | |
849 | @@ -310,7 +316,13 @@ RsDoDwordMemoryDescriptor ( | |
850 | ASL_RESOURCE_NODE *Rnode; | |
851 | UINT8 *OptionalFields; | |
852 | UINT16 StringLength = 0; | |
853 | + UINT16 ResourceLength = 0; | |
854 | UINT32 OptionIndex = 0; | |
855 | + UINT32 Minimum = 0; | |
856 | + UINT32 Maximum = 0; | |
857 | + UINT32 AddressLength = 0; | |
858 | + UINT32 Granularity = 0; | |
859 | + UINT32 TranslationOffset = 0; | |
860 | UINT32 CurrentByteOffset; | |
861 | UINT32 i; | |
862 | BOOLEAN ResSourceIndex = FALSE; | |
77760c90 | 863 | @@ -332,11 +344,9 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
864 | * optional fields present |
865 | */ | |
866 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); | |
867 | - Descriptor->Address32.ResourceLength = (UINT16) | |
868 | - (sizeof (AML_RESOURCE_ADDRESS32) - | |
869 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) - | |
870 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
871 | ||
872 | - | |
873 | /* Process all child initialization nodes */ | |
874 | ||
875 | for (i = 0; InitializerOp; i++) | |
77760c90 | 876 | @@ -385,8 +395,7 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
877 | |
878 | case 6: /* Address Granularity */ | |
879 | ||
880 | - Descriptor->Address32.Granularity = | |
881 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
882 | + Granularity = (UINT32) InitializerOp->Asl.Value.Integer; | |
883 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
884 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); | |
885 | GranOp = InitializerOp; | |
77760c90 | 886 | @@ -394,8 +403,7 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
887 | |
888 | case 7: /* Min Address */ | |
889 | ||
890 | - Descriptor->Address32.Minimum = | |
891 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
892 | + Minimum = (UINT32) InitializerOp->Asl.Value.Integer; | |
893 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
894 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); | |
895 | MinOp = InitializerOp; | |
77760c90 | 896 | @@ -403,8 +411,7 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
897 | |
898 | case 8: /* Max Address */ | |
899 | ||
900 | - Descriptor->Address32.Maximum = | |
901 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
902 | + Maximum = (UINT32) InitializerOp->Asl.Value.Integer; | |
903 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
904 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); | |
905 | MaxOp = InitializerOp; | |
77760c90 | 906 | @@ -412,16 +419,14 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
907 | |
908 | case 9: /* Translation Offset */ | |
909 | ||
910 | - Descriptor->Address32.TranslationOffset = | |
911 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
912 | + TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer; | |
913 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
914 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); | |
915 | break; | |
916 | ||
917 | case 10: /* Address Length */ | |
918 | ||
919 | - Descriptor->Address32.AddressLength = | |
920 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
921 | + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; | |
922 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
923 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); | |
924 | LengthOp = InitializerOp; | |
77760c90 | 925 | @@ -433,7 +438,7 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
926 | { |
927 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
928 | OptionIndex++; | |
929 | - Descriptor->Address32.ResourceLength++; | |
930 | + ResourceLength++; | |
931 | ResSourceIndex = TRUE; | |
932 | } | |
933 | break; | |
77760c90 | 934 | @@ -445,8 +450,8 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
935 | { |
936 | if (StringLength) | |
937 | { | |
938 | - Descriptor->Address32.ResourceLength = (UINT16) | |
939 | - (Descriptor->Address32.ResourceLength + StringLength); | |
940 | + | |
941 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
942 | ||
943 | strcpy ((char *) | |
944 | &OptionalFields[OptionIndex], | |
77760c90 | 945 | @@ -507,13 +512,20 @@ RsDoDwordMemoryDescriptor ( |
f3dfbd7c ER |
946 | /* Validate the Min/Max/Len/Gran values */ |
947 | ||
948 | RsLargeAddressCheck ( | |
949 | - (UINT64) Descriptor->Address32.Minimum, | |
950 | - (UINT64) Descriptor->Address32.Maximum, | |
951 | - (UINT64) Descriptor->Address32.AddressLength, | |
952 | - (UINT64) Descriptor->Address32.Granularity, | |
953 | + Minimum, | |
954 | + Maximum, | |
955 | + AddressLength, | |
956 | + Granularity, | |
957 | Descriptor->Address32.Flags, | |
958 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
959 | ||
960 | + ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength); | |
961 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum); | |
962 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum); | |
963 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength); | |
964 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity); | |
965 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset); | |
966 | + | |
967 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + | |
968 | OptionIndex + StringLength; | |
969 | return (Rnode); | |
77760c90 | 970 | @@ -545,7 +557,13 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
971 | ASL_RESOURCE_NODE *Rnode; |
972 | UINT8 *OptionalFields; | |
973 | UINT16 StringLength = 0; | |
974 | + UINT16 ResourceLength = 0; | |
975 | UINT32 OptionIndex = 0; | |
976 | + UINT32 Minimum = 0; | |
977 | + UINT32 Maximum = 0; | |
978 | + UINT32 AddressLength = 0; | |
979 | + UINT32 Granularity = 0; | |
980 | + UINT32 TranslationOffset = 0; | |
981 | UINT32 CurrentByteOffset; | |
982 | UINT32 i; | |
983 | BOOLEAN ResSourceIndex = FALSE; | |
77760c90 | 984 | @@ -566,8 +584,7 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
985 | * optional fields present |
986 | */ | |
987 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32); | |
988 | - Descriptor->Address32.ResourceLength = (UINT16) | |
989 | - (sizeof (AML_RESOURCE_ADDRESS32) - | |
990 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS32) - | |
991 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
992 | ||
993 | /* Process all child initialization nodes */ | |
77760c90 | 994 | @@ -616,8 +633,7 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
995 | |
996 | case 6: /* Address Granularity */ | |
997 | ||
998 | - Descriptor->Address32.Granularity = | |
999 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
1000 | + Granularity = (UINT32) InitializerOp->Asl.Value.Integer; | |
1001 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
1002 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity)); | |
1003 | GranOp = InitializerOp; | |
77760c90 | 1004 | @@ -625,8 +641,7 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
1005 | |
1006 | case 7: /* Min Address */ | |
1007 | ||
1008 | - Descriptor->Address32.Minimum = | |
1009 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
1010 | + Minimum = (UINT32) InitializerOp->Asl.Value.Integer; | |
1011 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
1012 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum)); | |
1013 | MinOp = InitializerOp; | |
77760c90 | 1014 | @@ -634,8 +649,7 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
1015 | |
1016 | case 8: /* Max Address */ | |
1017 | ||
1018 | - Descriptor->Address32.Maximum = | |
1019 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
1020 | + Maximum = (UINT32) InitializerOp->Asl.Value.Integer; | |
1021 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
1022 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum)); | |
1023 | MaxOp = InitializerOp; | |
77760c90 | 1024 | @@ -643,16 +657,14 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
1025 | |
1026 | case 9: /* Translation Offset */ | |
1027 | ||
1028 | - Descriptor->Address32.TranslationOffset = | |
1029 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
1030 | + TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer; | |
1031 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
1032 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset)); | |
1033 | break; | |
1034 | ||
1035 | case 10: /* Address Length */ | |
1036 | ||
1037 | - Descriptor->Address32.AddressLength = | |
1038 | - (UINT32) InitializerOp->Asl.Value.Integer; | |
1039 | + AddressLength = (UINT32) InitializerOp->Asl.Value.Integer; | |
1040 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
1041 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength)); | |
1042 | LengthOp = InitializerOp; | |
77760c90 | 1043 | @@ -664,7 +676,7 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
1044 | { |
1045 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
1046 | OptionIndex++; | |
1047 | - Descriptor->Address32.ResourceLength++; | |
1048 | + ResourceLength++; | |
1049 | ResSourceIndex = TRUE; | |
1050 | } | |
1051 | break; | |
77760c90 | 1052 | @@ -676,8 +688,7 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
1053 | { |
1054 | if (StringLength) | |
1055 | { | |
1056 | - Descriptor->Address32.ResourceLength = (UINT16) | |
1057 | - (Descriptor->Address32.ResourceLength + StringLength); | |
1058 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
1059 | ||
1060 | strcpy ((char *) | |
1061 | &OptionalFields[OptionIndex], | |
77760c90 | 1062 | @@ -724,13 +735,20 @@ RsDoDwordSpaceDescriptor ( |
f3dfbd7c ER |
1063 | /* Validate the Min/Max/Len/Gran values */ |
1064 | ||
1065 | RsLargeAddressCheck ( | |
1066 | - (UINT64) Descriptor->Address32.Minimum, | |
1067 | - (UINT64) Descriptor->Address32.Maximum, | |
1068 | - (UINT64) Descriptor->Address32.AddressLength, | |
1069 | - (UINT64) Descriptor->Address32.Granularity, | |
1070 | + Minimum, | |
1071 | + Maximum, | |
1072 | + AddressLength, | |
1073 | + Granularity, | |
1074 | Descriptor->Address32.Flags, | |
1075 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
1076 | ||
1077 | + ACPI_MOVE_16_TO_16(&Descriptor->Address32.ResourceLength, &ResourceLength); | |
1078 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Minimum, &Minimum); | |
1079 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Maximum, &Maximum); | |
1080 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.AddressLength, &AddressLength); | |
1081 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.Granularity, &Granularity); | |
1082 | + ACPI_MOVE_32_TO_32(&Descriptor->Address32.TranslationOffset, &TranslationOffset); | |
1083 | + | |
1084 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + | |
1085 | OptionIndex + StringLength; | |
1086 | return (Rnode); | |
77760c90 JB |
1087 | Index: acpica-unix2-20170224/source/compiler/aslrestype2e.c |
1088 | =================================================================== | |
1089 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype2e.c | |
1090 | +++ acpica-unix2-20170224/source/compiler/aslrestype2e.c | |
1091 | @@ -78,6 +78,13 @@ RsDoExtendedIoDescriptor ( | |
f3dfbd7c ER |
1092 | ACPI_PARSE_OBJECT *GranOp = NULL; |
1093 | ASL_RESOURCE_NODE *Rnode; | |
1094 | UINT16 StringLength = 0; | |
1095 | + UINT16 ResourceLength = 0; | |
1096 | + UINT64 Minimum = 0; | |
1097 | + UINT64 Maximum = 0; | |
1098 | + UINT64 AddressLength = 0; | |
1099 | + UINT64 Granularity = 0; | |
1100 | + UINT64 TranslationOffset = 0; | |
1101 | + UINT64 TypeSpecific = 0; | |
1102 | UINT32 CurrentByteOffset; | |
1103 | UINT32 i; | |
1104 | ||
77760c90 JB |
1105 | @@ -94,9 +101,10 @@ RsDoExtendedIoDescriptor ( |
1106 | Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE; | |
1107 | Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION; | |
f3dfbd7c | 1108 | |
77760c90 | 1109 | - Descriptor->ExtAddress64.ResourceLength = (UINT16) |
f3dfbd7c ER |
1110 | - (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - |
1111 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) - | |
1112 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
1113 | + ACPI_MOVE_16_TO_16(&Descriptor->ExtAddress64.ResourceLength, | |
1114 | + &ResourceLength); | |
1115 | ||
1116 | /* Process all child initialization nodes */ | |
1117 | ||
77760c90 | 1118 | @@ -139,7 +147,7 @@ RsDoExtendedIoDescriptor ( |
f3dfbd7c ER |
1119 | |
1120 | case 5: /* Address Granularity */ | |
1121 | ||
1122 | - Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer; | |
1123 | + Granularity = InitializerOp->Asl.Value.Integer; | |
1124 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
1125 | CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity)); | |
1126 | GranOp = InitializerOp; | |
77760c90 | 1127 | @@ -147,7 +155,7 @@ RsDoExtendedIoDescriptor ( |
f3dfbd7c ER |
1128 | |
1129 | case 6: /* Address Min */ | |
1130 | ||
1131 | - Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer; | |
1132 | + Minimum = InitializerOp->Asl.Value.Integer; | |
1133 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
1134 | CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum)); | |
1135 | MinOp = InitializerOp; | |
77760c90 | 1136 | @@ -155,7 +163,7 @@ RsDoExtendedIoDescriptor ( |
f3dfbd7c ER |
1137 | |
1138 | case 7: /* Address Max */ | |
1139 | ||
1140 | - Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer; | |
1141 | + Maximum = InitializerOp->Asl.Value.Integer; | |
1142 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
1143 | CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum)); | |
1144 | MaxOp = InitializerOp; | |
77760c90 | 1145 | @@ -163,14 +171,14 @@ RsDoExtendedIoDescriptor ( |
f3dfbd7c ER |
1146 | |
1147 | case 8: /* Translation Offset */ | |
1148 | ||
1149 | - Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1150 | + TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1151 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
1152 | CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset)); | |
1153 | break; | |
1154 | ||
1155 | case 9: /* Address Length */ | |
1156 | ||
1157 | - Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer; | |
1158 | + AddressLength = InitializerOp->Asl.Value.Integer; | |
1159 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
1160 | CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength)); | |
1161 | LengthOp = InitializerOp; | |
77760c90 | 1162 | @@ -178,7 +186,7 @@ RsDoExtendedIoDescriptor ( |
f3dfbd7c ER |
1163 | |
1164 | case 10: /* Type-Specific Attributes */ | |
1165 | ||
1166 | - Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer; | |
1167 | + TypeSpecific = InitializerOp->Asl.Value.Integer; | |
1168 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES, | |
1169 | CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific)); | |
1170 | break; | |
77760c90 | 1171 | @@ -214,13 +222,20 @@ RsDoExtendedIoDescriptor ( |
f3dfbd7c ER |
1172 | /* Validate the Min/Max/Len/Gran values */ |
1173 | ||
1174 | RsLargeAddressCheck ( | |
1175 | - Descriptor->ExtAddress64.Minimum, | |
1176 | - Descriptor->ExtAddress64.Maximum, | |
1177 | - Descriptor->ExtAddress64.AddressLength, | |
1178 | - Descriptor->ExtAddress64.Granularity, | |
1179 | + Minimum, | |
1180 | + Maximum, | |
1181 | + AddressLength, | |
1182 | + Granularity, | |
1183 | Descriptor->ExtAddress64.Flags, | |
1184 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
1185 | ||
1186 | + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Minimum, &Minimum); | |
1187 | + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Maximum, &Maximum); | |
1188 | + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.AddressLength, &AddressLength); | |
1189 | + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.Granularity, &Granularity); | |
1190 | + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TranslationOffset, &TranslationOffset); | |
1191 | + ACPI_MOVE_64_TO_64(&Descriptor->ExtAddress64.TypeSpecific, &TypeSpecific); | |
1192 | + | |
1193 | Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + | |
1194 | StringLength; | |
1195 | return (Rnode); | |
77760c90 JB |
1196 | Index: acpica-unix2-20170224/source/compiler/aslrestype2q.c |
1197 | =================================================================== | |
1198 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype2q.c | |
1199 | +++ acpica-unix2-20170224/source/compiler/aslrestype2q.c | |
1200 | @@ -80,7 +80,13 @@ RsDoQwordIoDescriptor ( | |
f3dfbd7c ER |
1201 | ASL_RESOURCE_NODE *Rnode; |
1202 | UINT8 *OptionalFields; | |
1203 | UINT16 StringLength = 0; | |
1204 | + UINT16 ResourceLength = 0; | |
1205 | UINT32 OptionIndex = 0; | |
1206 | + UINT64 Minimum = 0; | |
1207 | + UINT64 Maximum = 0; | |
1208 | + UINT64 AddressLength = 0; | |
1209 | + UINT64 Granularity = 0; | |
1210 | + UINT64 TranslationOffset = 0; | |
1211 | UINT32 CurrentByteOffset; | |
1212 | UINT32 i; | |
1213 | BOOLEAN ResSourceIndex = FALSE; | |
77760c90 | 1214 | @@ -102,8 +108,7 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1215 | * optional fields present |
1216 | */ | |
1217 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); | |
1218 | - Descriptor->Address64.ResourceLength = (UINT16) | |
1219 | - (sizeof (AML_RESOURCE_ADDRESS64) - | |
1220 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) - | |
1221 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
1222 | ||
1223 | /* Process all child initialization nodes */ | |
77760c90 | 1224 | @@ -147,7 +152,7 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1225 | |
1226 | case 5: /* Address Granularity */ | |
1227 | ||
1228 | - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; | |
1229 | + Granularity = InitializerOp->Asl.Value.Integer; | |
1230 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
1231 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); | |
1232 | GranOp = InitializerOp; | |
77760c90 | 1233 | @@ -155,7 +160,7 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1234 | |
1235 | case 6: /* Address Min */ | |
1236 | ||
1237 | - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; | |
1238 | + Minimum = InitializerOp->Asl.Value.Integer; | |
1239 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
1240 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); | |
1241 | MinOp = InitializerOp; | |
77760c90 | 1242 | @@ -163,7 +168,7 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1243 | |
1244 | case 7: /* Address Max */ | |
1245 | ||
1246 | - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; | |
1247 | + Maximum = InitializerOp->Asl.Value.Integer; | |
1248 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
1249 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); | |
1250 | MaxOp = InitializerOp; | |
77760c90 | 1251 | @@ -171,14 +176,14 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1252 | |
1253 | case 8: /* Translation Offset */ | |
1254 | ||
1255 | - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1256 | + TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1257 | RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
1258 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); | |
1259 | break; | |
1260 | ||
1261 | case 9: /* Address Length */ | |
1262 | ||
1263 | - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; | |
1264 | + AddressLength = InitializerOp->Asl.Value.Integer; | |
1265 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
1266 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); | |
1267 | LengthOp = InitializerOp; | |
77760c90 | 1268 | @@ -190,7 +195,7 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1269 | { |
1270 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
1271 | OptionIndex++; | |
1272 | - Descriptor->Address64.ResourceLength++; | |
1273 | + ResourceLength++; | |
1274 | ResSourceIndex = TRUE; | |
1275 | } | |
1276 | break; | |
77760c90 | 1277 | @@ -202,8 +207,7 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1278 | { |
1279 | if (StringLength) | |
1280 | { | |
1281 | - Descriptor->Address64.ResourceLength = (UINT16) | |
1282 | - (Descriptor->Address64.ResourceLength + StringLength); | |
1283 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
1284 | ||
1285 | strcpy ((char *) | |
1286 | &OptionalFields[OptionIndex], | |
77760c90 | 1287 | @@ -263,13 +267,20 @@ RsDoQwordIoDescriptor ( |
f3dfbd7c ER |
1288 | /* Validate the Min/Max/Len/Gran values */ |
1289 | ||
1290 | RsLargeAddressCheck ( | |
1291 | - Descriptor->Address64.Minimum, | |
1292 | - Descriptor->Address64.Maximum, | |
1293 | - Descriptor->Address64.AddressLength, | |
1294 | - Descriptor->Address64.Granularity, | |
1295 | + Minimum, | |
1296 | + Maximum, | |
1297 | + AddressLength, | |
1298 | + Granularity, | |
1299 | Descriptor->Address64.Flags, | |
1300 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
1301 | ||
1302 | + ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength); | |
1303 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum); | |
1304 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum); | |
1305 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength); | |
1306 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity); | |
1307 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset); | |
1308 | + | |
1309 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + | |
1310 | OptionIndex + StringLength; | |
1311 | return (Rnode); | |
77760c90 | 1312 | @@ -301,7 +312,13 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1313 | ASL_RESOURCE_NODE *Rnode; |
1314 | UINT8 *OptionalFields; | |
1315 | UINT16 StringLength = 0; | |
1316 | + UINT16 ResourceLength = 0; | |
1317 | UINT32 OptionIndex = 0; | |
1318 | + UINT64 Minimum = 0; | |
1319 | + UINT64 Maximum = 0; | |
1320 | + UINT64 AddressLength = 0; | |
1321 | + UINT64 Granularity = 0; | |
1322 | + UINT64 TranslationOffset = 0; | |
1323 | UINT32 CurrentByteOffset; | |
1324 | UINT32 i; | |
1325 | BOOLEAN ResSourceIndex = FALSE; | |
77760c90 | 1326 | @@ -323,8 +340,7 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1327 | * optional fields present |
1328 | */ | |
1329 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); | |
1330 | - Descriptor->Address64.ResourceLength = (UINT16) | |
1331 | - (sizeof (AML_RESOURCE_ADDRESS64) - | |
1332 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) - | |
1333 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
1334 | ||
1335 | /* Process all child initialization nodes */ | |
77760c90 | 1336 | @@ -375,7 +391,7 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1337 | |
1338 | case 6: /* Address Granularity */ | |
1339 | ||
1340 | - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; | |
1341 | + Granularity = InitializerOp->Asl.Value.Integer; | |
1342 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
1343 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); | |
1344 | GranOp = InitializerOp; | |
77760c90 | 1345 | @@ -383,7 +399,7 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1346 | |
1347 | case 7: /* Min Address */ | |
1348 | ||
1349 | - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; | |
1350 | + Minimum = InitializerOp->Asl.Value.Integer; | |
1351 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
1352 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); | |
1353 | MinOp = InitializerOp; | |
77760c90 | 1354 | @@ -391,7 +407,7 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1355 | |
1356 | case 8: /* Max Address */ | |
1357 | ||
1358 | - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; | |
1359 | + Maximum = InitializerOp->Asl.Value.Integer; | |
1360 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
1361 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); | |
1362 | MaxOp = InitializerOp; | |
77760c90 | 1363 | @@ -399,14 +415,14 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1364 | |
1365 | case 9: /* Translation Offset */ | |
1366 | ||
1367 | - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1368 | + TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1369 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
1370 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); | |
1371 | break; | |
1372 | ||
1373 | case 10: /* Address Length */ | |
1374 | ||
1375 | - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; | |
1376 | + AddressLength = InitializerOp->Asl.Value.Integer; | |
1377 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
1378 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); | |
1379 | LengthOp = InitializerOp; | |
77760c90 | 1380 | @@ -418,7 +434,7 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1381 | { |
1382 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
1383 | OptionIndex++; | |
1384 | - Descriptor->Address64.ResourceLength++; | |
1385 | + ResourceLength++; | |
1386 | ResSourceIndex = TRUE; | |
1387 | } | |
1388 | break; | |
77760c90 | 1389 | @@ -430,8 +446,7 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1390 | { |
1391 | if (StringLength) | |
1392 | { | |
1393 | - Descriptor->Address64.ResourceLength = (UINT16) | |
1394 | - (Descriptor->Address64.ResourceLength + StringLength); | |
1395 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
1396 | ||
1397 | strcpy ((char *) | |
1398 | &OptionalFields[OptionIndex], | |
77760c90 | 1399 | @@ -492,13 +507,20 @@ RsDoQwordMemoryDescriptor ( |
f3dfbd7c ER |
1400 | /* Validate the Min/Max/Len/Gran values */ |
1401 | ||
1402 | RsLargeAddressCheck ( | |
1403 | - Descriptor->Address64.Minimum, | |
1404 | - Descriptor->Address64.Maximum, | |
1405 | - Descriptor->Address64.AddressLength, | |
1406 | - Descriptor->Address64.Granularity, | |
1407 | + Minimum, | |
1408 | + Maximum, | |
1409 | + AddressLength, | |
1410 | + Granularity, | |
1411 | Descriptor->Address64.Flags, | |
1412 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
1413 | ||
1414 | + ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength); | |
1415 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum); | |
1416 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum); | |
1417 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength); | |
1418 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity); | |
1419 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset); | |
1420 | + | |
1421 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + | |
1422 | OptionIndex + StringLength; | |
1423 | return (Rnode); | |
77760c90 | 1424 | @@ -530,9 +552,15 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1425 | ASL_RESOURCE_NODE *Rnode; |
1426 | UINT8 *OptionalFields; | |
1427 | UINT16 StringLength = 0; | |
1428 | + UINT16 ResourceLength = 0; | |
1429 | UINT32 OptionIndex = 0; | |
1430 | UINT32 CurrentByteOffset; | |
1431 | UINT32 i; | |
1432 | + UINT64 Minimum = 0; | |
1433 | + UINT64 Maximum = 0; | |
1434 | + UINT64 AddressLength = 0; | |
1435 | + UINT64 Granularity = 0; | |
1436 | + UINT64 TranslationOffset = 0; | |
1437 | BOOLEAN ResSourceIndex = FALSE; | |
1438 | ||
1439 | ||
77760c90 | 1440 | @@ -551,8 +579,7 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1441 | * optional fields present |
1442 | */ | |
1443 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64); | |
1444 | - Descriptor->Address64.ResourceLength = (UINT16) | |
1445 | - (sizeof (AML_RESOURCE_ADDRESS64) - | |
1446 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS64) - | |
1447 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
1448 | ||
1449 | /* Process all child initialization nodes */ | |
77760c90 | 1450 | @@ -601,7 +628,7 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1451 | |
1452 | case 6: /* Address Granularity */ | |
1453 | ||
1454 | - Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer; | |
1455 | + Granularity = InitializerOp->Asl.Value.Integer; | |
1456 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
1457 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity)); | |
1458 | GranOp = InitializerOp; | |
77760c90 | 1459 | @@ -609,7 +636,7 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1460 | |
1461 | case 7: /* Min Address */ | |
1462 | ||
1463 | - Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer; | |
1464 | + Minimum = InitializerOp->Asl.Value.Integer; | |
1465 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
1466 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum)); | |
1467 | MinOp = InitializerOp; | |
77760c90 | 1468 | @@ -617,7 +644,7 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1469 | |
1470 | case 8: /* Max Address */ | |
1471 | ||
1472 | - Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer; | |
1473 | + Maximum = InitializerOp->Asl.Value.Integer; | |
1474 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
1475 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum)); | |
1476 | MaxOp = InitializerOp; | |
77760c90 | 1477 | @@ -625,14 +652,14 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1478 | |
1479 | case 9: /* Translation Offset */ | |
1480 | ||
1481 | - Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1482 | + TranslationOffset = InitializerOp->Asl.Value.Integer; | |
1483 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
1484 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset)); | |
1485 | break; | |
1486 | ||
1487 | case 10: /* Address Length */ | |
1488 | ||
1489 | - Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer; | |
1490 | + AddressLength = InitializerOp->Asl.Value.Integer; | |
1491 | RsCreateQwordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
1492 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength)); | |
1493 | LengthOp = InitializerOp; | |
77760c90 | 1494 | @@ -644,7 +671,7 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1495 | { |
1496 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
1497 | OptionIndex++; | |
1498 | - Descriptor->Address64.ResourceLength++; | |
1499 | + ResourceLength++; | |
1500 | ResSourceIndex = TRUE; | |
1501 | } | |
1502 | break; | |
77760c90 | 1503 | @@ -656,8 +683,7 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1504 | { |
1505 | if (StringLength) | |
1506 | { | |
1507 | - Descriptor->Address64.ResourceLength = (UINT16) | |
1508 | - (Descriptor->Address64.ResourceLength + StringLength); | |
1509 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
1510 | ||
1511 | strcpy ((char *) | |
1512 | &OptionalFields[OptionIndex], | |
77760c90 | 1513 | @@ -703,13 +729,20 @@ RsDoQwordSpaceDescriptor ( |
f3dfbd7c ER |
1514 | /* Validate the Min/Max/Len/Gran values */ |
1515 | ||
1516 | RsLargeAddressCheck ( | |
1517 | - Descriptor->Address64.Minimum, | |
1518 | - Descriptor->Address64.Maximum, | |
1519 | - Descriptor->Address64.AddressLength, | |
1520 | - Descriptor->Address64.Granularity, | |
1521 | + Minimum, | |
1522 | + Maximum, | |
1523 | + AddressLength, | |
1524 | + Granularity, | |
1525 | Descriptor->Address64.Flags, | |
1526 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
1527 | ||
1528 | + ACPI_MOVE_16_TO_16(&Descriptor->Address64.ResourceLength, &ResourceLength); | |
1529 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Minimum, &Minimum); | |
1530 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Maximum, &Maximum); | |
1531 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.AddressLength, &AddressLength); | |
1532 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.Granularity, &Granularity); | |
1533 | + ACPI_MOVE_64_TO_64(&Descriptor->Address64.TranslationOffset, &TranslationOffset); | |
1534 | + | |
1535 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + | |
1536 | OptionIndex + StringLength; | |
1537 | return (Rnode); | |
77760c90 JB |
1538 | Index: acpica-unix2-20170224/source/compiler/aslrestype2s.c |
1539 | =================================================================== | |
1540 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype2s.c | |
1541 | +++ acpica-unix2-20170224/source/compiler/aslrestype2s.c | |
1542 | @@ -290,6 +290,9 @@ RsDoGpioIntDescriptor ( | |
f3dfbd7c ER |
1543 | UINT16 VendorLength; |
1544 | UINT16 InterruptLength; | |
1545 | UINT16 DescriptorSize; | |
1546 | + UINT16 IntFlags = 0; | |
1547 | + UINT16 DebounceTimeout = 0; | |
1548 | + UINT16 Flags = 0; | |
1549 | UINT32 CurrentByteOffset; | |
1550 | UINT32 PinCount = 0; | |
1551 | UINT32 i; | |
77760c90 | 1552 | @@ -346,21 +349,21 @@ RsDoGpioIntDescriptor ( |
f3dfbd7c ER |
1553 | { |
1554 | case 0: /* Interrupt Mode - edge/level [Flag] (_MOD) */ | |
1555 | ||
1556 | - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0); | |
1557 | + RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0); | |
1558 | RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, | |
1559 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0); | |
1560 | break; | |
1561 | ||
1562 | case 1: /* Interrupt Polarity - Active high/low [Flags] (_POL) */ | |
1563 | ||
1564 | - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 1, 0); | |
1565 | + RsSetFlagBits16 (&IntFlags, InitializerOp, 1, 0); | |
1566 | RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_POLARITY, | |
1567 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 1, 2); | |
1568 | break; | |
1569 | ||
1570 | case 2: /* Share Type - Default: exclusive (0) [Flags] (_SHR) */ | |
1571 | ||
1572 | - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0); | |
1573 | + RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0); | |
1574 | RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, | |
1575 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3, 2); | |
1576 | break; | |
77760c90 | 1577 | @@ -374,7 +377,7 @@ RsDoGpioIntDescriptor ( |
f3dfbd7c ER |
1578 | |
1579 | case 4: /* Debounce Timeout [WORD] (_DBT) */ | |
1580 | ||
1581 | - Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer; | |
1582 | + DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer; | |
1583 | RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME, | |
1584 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout)); | |
1585 | break; | |
77760c90 | 1586 | @@ -401,7 +404,7 @@ RsDoGpioIntDescriptor ( |
f3dfbd7c ER |
1587 | |
1588 | case 7: /* Resource Usage (consumer/producer) */ | |
1589 | ||
1590 | - RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1); | |
1591 | + RsSetFlagBits16 (&Flags, InitializerOp, 0, 1); | |
1592 | break; | |
1593 | ||
1594 | case 8: /* Resource Tag (Descriptor Name) */ | |
77760c90 | 1595 | @@ -466,6 +469,10 @@ RsDoGpioIntDescriptor ( |
f3dfbd7c ER |
1596 | InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); |
1597 | } | |
1598 | ||
1599 | + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags); | |
1600 | + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout); | |
1601 | + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags); | |
1602 | + | |
77760c90 JB |
1603 | MpSaveGpioInfo (Info->MappingOp, Descriptor, |
1604 | PinCount, PinList, ResourceSource); | |
f3dfbd7c | 1605 | return (Rnode); |
77760c90 | 1606 | @@ -499,6 +506,10 @@ RsDoGpioIoDescriptor ( |
f3dfbd7c ER |
1607 | UINT16 VendorLength; |
1608 | UINT16 InterruptLength; | |
1609 | UINT16 DescriptorSize; | |
1610 | + UINT16 IntFlags = 0; | |
1611 | + UINT16 DebounceTimeout = 0; | |
1612 | + UINT16 DriveStrength = 0; | |
1613 | + UINT16 Flags = 0; | |
1614 | UINT32 CurrentByteOffset; | |
1615 | UINT32 PinCount = 0; | |
1616 | UINT32 i; | |
77760c90 | 1617 | @@ -555,7 +566,7 @@ RsDoGpioIoDescriptor ( |
f3dfbd7c ER |
1618 | { |
1619 | case 0: /* Share Type [Flags] (_SHR) */ | |
1620 | ||
1621 | - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 3, 0); | |
1622 | + RsSetFlagBits16 (&IntFlags, InitializerOp, 3, 0); | |
1623 | RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, | |
1624 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 3); | |
1625 | break; | |
77760c90 | 1626 | @@ -569,21 +580,21 @@ RsDoGpioIoDescriptor ( |
f3dfbd7c ER |
1627 | |
1628 | case 2: /* Debounce Timeout [WORD] (_DBT) */ | |
1629 | ||
1630 | - Descriptor->Gpio.DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer; | |
1631 | + DebounceTimeout = (UINT16) InitializerOp->Asl.Value.Integer; | |
1632 | RsCreateWordField (InitializerOp, ACPI_RESTAG_DEBOUNCETIME, | |
1633 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DebounceTimeout)); | |
1634 | break; | |
1635 | ||
1636 | case 3: /* Drive Strength [WORD] (_DRS) */ | |
1637 | ||
1638 | - Descriptor->Gpio.DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer; | |
1639 | + DriveStrength = (UINT16) InitializerOp->Asl.Value.Integer; | |
1640 | RsCreateWordField (InitializerOp, ACPI_RESTAG_DRIVESTRENGTH, | |
1641 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.DriveStrength)); | |
1642 | break; | |
1643 | ||
1644 | case 4: /* I/O Restriction [Flag] (_IOR) */ | |
1645 | ||
1646 | - RsSetFlagBits16 (&Descriptor->Gpio.IntFlags, InitializerOp, 0, 0); | |
1647 | + RsSetFlagBits16 (&IntFlags, InitializerOp, 0, 0); | |
1648 | RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_IORESTRICTION, | |
1649 | CurrentByteOffset + ASL_RESDESC_OFFSET (Gpio.IntFlags), 0, 2); | |
1650 | break; | |
77760c90 | 1651 | @@ -609,7 +620,7 @@ RsDoGpioIoDescriptor ( |
f3dfbd7c ER |
1652 | |
1653 | case 7: /* Resource Usage (consumer/producer) */ | |
1654 | ||
1655 | - RsSetFlagBits16 (&Descriptor->Gpio.Flags, InitializerOp, 0, 1); | |
1656 | + RsSetFlagBits16 (&Flags, InitializerOp, 0, 1); | |
1657 | break; | |
1658 | ||
1659 | case 8: /* Resource Tag (Descriptor Name) */ | |
77760c90 | 1660 | @@ -673,6 +684,11 @@ RsDoGpioIoDescriptor ( |
f3dfbd7c ER |
1661 | InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); |
1662 | } | |
1663 | ||
1664 | + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.IntFlags, &IntFlags); | |
1665 | + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DebounceTimeout, &DebounceTimeout); | |
1666 | + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.DriveStrength, &DriveStrength); | |
1667 | + ACPI_MOVE_16_TO_16(&Descriptor->Gpio.Flags, &Flags); | |
1668 | + | |
77760c90 JB |
1669 | MpSaveGpioInfo (Info->MappingOp, Descriptor, |
1670 | PinCount, PinList, ResourceSource); | |
f3dfbd7c | 1671 | return (Rnode); |
77760c90 | 1672 | @@ -703,6 +719,9 @@ RsDoI2cSerialBusDescriptor ( |
f3dfbd7c ER |
1673 | UINT16 ResSourceLength; |
1674 | UINT16 VendorLength; | |
1675 | UINT16 DescriptorSize; | |
1676 | + UINT16 SlaveAddress = 0; | |
1677 | + UINT32 ConnectionSpeed = 0; | |
1678 | + UINT16 TypeSpecificFlags = 0; | |
1679 | UINT32 CurrentByteOffset; | |
1680 | UINT32 i; | |
1681 | ||
77760c90 | 1682 | @@ -752,7 +771,7 @@ RsDoI2cSerialBusDescriptor ( |
f3dfbd7c ER |
1683 | { |
1684 | case 0: /* Slave Address [WORD] (_ADR) */ | |
1685 | ||
1686 | - Descriptor->I2cSerialBus.SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer; | |
1687 | + SlaveAddress = (UINT16) InitializerOp->Asl.Value.Integer; | |
1688 | RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, | |
1689 | CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.SlaveAddress)); | |
1690 | break; | |
77760c90 | 1691 | @@ -766,14 +785,14 @@ RsDoI2cSerialBusDescriptor ( |
f3dfbd7c ER |
1692 | |
1693 | case 2: /* Connection Speed [DWORD] (_SPE) */ | |
1694 | ||
1695 | - Descriptor->I2cSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; | |
1696 | + ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; | |
1697 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, | |
1698 | CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.ConnectionSpeed)); | |
1699 | break; | |
1700 | ||
1701 | case 3: /* Addressing Mode [Flag] (_MOD) */ | |
1702 | ||
1703 | - RsSetFlagBits16 (&Descriptor->I2cSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); | |
1704 | + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0); | |
1705 | RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, | |
1706 | CurrentByteOffset + ASL_RESDESC_OFFSET (I2cSerialBus.TypeSpecificFlags), 0); | |
1707 | break; | |
77760c90 | 1708 | @@ -833,6 +852,9 @@ RsDoI2cSerialBusDescriptor ( |
f3dfbd7c ER |
1709 | InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); |
1710 | } | |
1711 | ||
1712 | + ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.SlaveAddress, &SlaveAddress); | |
1713 | + ACPI_MOVE_32_TO_32(&Descriptor->I2cSerialBus.ConnectionSpeed, &ConnectionSpeed); | |
1714 | + ACPI_MOVE_16_TO_16(&Descriptor->I2cSerialBus.TypeSpecificFlags, &TypeSpecificFlags); | |
1715 | MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); | |
1716 | return (Rnode); | |
1717 | } | |
77760c90 | 1718 | @@ -862,6 +884,9 @@ RsDoSpiSerialBusDescriptor ( |
f3dfbd7c ER |
1719 | UINT16 ResSourceLength; |
1720 | UINT16 VendorLength; | |
1721 | UINT16 DescriptorSize; | |
1722 | + UINT16 DeviceSelection = 0; | |
1723 | + UINT32 ConnectionSpeed = 0; | |
1724 | + UINT16 TypeSpecificFlags = 0; | |
1725 | UINT32 CurrentByteOffset; | |
1726 | UINT32 i; | |
1727 | ||
77760c90 | 1728 | @@ -912,21 +937,21 @@ RsDoSpiSerialBusDescriptor ( |
f3dfbd7c ER |
1729 | { |
1730 | case 0: /* Device Selection [WORD] (_ADR) */ | |
1731 | ||
1732 | - Descriptor->SpiSerialBus.DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer; | |
1733 | + DeviceSelection = (UINT16) InitializerOp->Asl.Value.Integer; | |
1734 | RsCreateWordField (InitializerOp, ACPI_RESTAG_ADDRESS, | |
1735 | CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.DeviceSelection)); | |
1736 | break; | |
1737 | ||
1738 | case 1: /* Device Polarity [Flag] (_DPL) */ | |
1739 | ||
1740 | - RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 1, 0); | |
1741 | + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 1, 0); | |
1742 | RsCreateBitField (InitializerOp, ACPI_RESTAG_DEVICEPOLARITY, | |
1743 | CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 1); | |
1744 | break; | |
1745 | ||
1746 | case 2: /* Wire Mode [Flag] (_MOD) */ | |
1747 | ||
1748 | - RsSetFlagBits16 (&Descriptor->SpiSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); | |
1749 | + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0); | |
1750 | RsCreateBitField (InitializerOp, ACPI_RESTAG_MODE, | |
1751 | CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.TypeSpecificFlags), 0); | |
1752 | break; | |
77760c90 | 1753 | @@ -947,7 +972,7 @@ RsDoSpiSerialBusDescriptor ( |
f3dfbd7c ER |
1754 | |
1755 | case 5: /* Connection Speed [DWORD] (_SPE) */ | |
1756 | ||
1757 | - Descriptor->SpiSerialBus.ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; | |
1758 | + ConnectionSpeed = (UINT32) InitializerOp->Asl.Value.Integer; | |
1759 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, | |
1760 | CurrentByteOffset + ASL_RESDESC_OFFSET (SpiSerialBus.ConnectionSpeed)); | |
1761 | break; | |
77760c90 | 1762 | @@ -1021,6 +1046,10 @@ RsDoSpiSerialBusDescriptor ( |
f3dfbd7c ER |
1763 | InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); |
1764 | } | |
1765 | ||
1766 | + ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.DeviceSelection, &DeviceSelection); | |
1767 | + ACPI_MOVE_32_TO_32(&Descriptor->SpiSerialBus.ConnectionSpeed, &ConnectionSpeed); | |
1768 | + ACPI_MOVE_16_TO_16(&Descriptor->SpiSerialBus.TypeSpecificFlags, &TypeSpecificFlags); | |
1769 | + | |
1770 | MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); | |
1771 | return (Rnode); | |
1772 | } | |
77760c90 | 1773 | @@ -1050,6 +1079,10 @@ RsDoUartSerialBusDescriptor ( |
f3dfbd7c ER |
1774 | UINT16 ResSourceLength; |
1775 | UINT16 VendorLength; | |
1776 | UINT16 DescriptorSize; | |
1777 | + UINT32 DefaultBaudRate = 0; | |
1778 | + UINT16 TypeSpecificFlags = 0; | |
1779 | + UINT16 RxFifoSize = 0; | |
1780 | + UINT16 TxFifoSize = 0; | |
1781 | UINT32 CurrentByteOffset; | |
1782 | UINT32 i; | |
1783 | ||
77760c90 | 1784 | @@ -1099,21 +1132,21 @@ RsDoUartSerialBusDescriptor ( |
f3dfbd7c ER |
1785 | { |
1786 | case 0: /* Connection Speed (Baud Rate) [DWORD] (_SPE) */ | |
1787 | ||
1788 | - Descriptor->UartSerialBus.DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer; | |
1789 | + DefaultBaudRate = (UINT32) InitializerOp->Asl.Value.Integer; | |
1790 | RsCreateDwordField (InitializerOp, ACPI_RESTAG_SPEED, | |
1791 | CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.DefaultBaudRate)); | |
1792 | break; | |
1793 | ||
1794 | case 1: /* Bits Per Byte [Flags] (_LEN) */ | |
1795 | ||
1796 | - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 4, 3); | |
1797 | + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 4, 3); | |
1798 | RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_LENGTH, | |
1799 | CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 4, 3); | |
1800 | break; | |
1801 | ||
1802 | case 2: /* Stop Bits [Flags] (_STB) */ | |
1803 | ||
1804 | - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 2, 1); | |
1805 | + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 2, 1); | |
1806 | RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_STOPBITS, | |
1807 | CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 2, 2); | |
1808 | break; | |
77760c90 | 1809 | @@ -1127,7 +1160,7 @@ RsDoUartSerialBusDescriptor ( |
f3dfbd7c ER |
1810 | |
1811 | case 4: /* Endianness [Flag] (_END) */ | |
1812 | ||
1813 | - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 7, 0); | |
1814 | + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 7, 0); | |
1815 | RsCreateBitField (InitializerOp, ACPI_RESTAG_ENDIANNESS, | |
1816 | CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 7); | |
1817 | break; | |
77760c90 | 1818 | @@ -1141,21 +1174,21 @@ RsDoUartSerialBusDescriptor ( |
f3dfbd7c ER |
1819 | |
1820 | case 6: /* Flow Control [Flags] (_FLC) */ | |
1821 | ||
1822 | - RsSetFlagBits16 (&Descriptor->UartSerialBus.TypeSpecificFlags, InitializerOp, 0, 0); | |
1823 | + RsSetFlagBits16 (&TypeSpecificFlags, InitializerOp, 0, 0); | |
1824 | RsCreateMultiBitField (InitializerOp, ACPI_RESTAG_FLOWCONTROL, | |
1825 | CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TypeSpecificFlags), 0, 2); | |
1826 | break; | |
1827 | ||
1828 | case 7: /* Rx Buffer Size [WORD] (_RXL) */ | |
1829 | ||
1830 | - Descriptor->UartSerialBus.RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; | |
1831 | + RxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; | |
1832 | RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_RX, | |
1833 | CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.RxFifoSize)); | |
1834 | break; | |
1835 | ||
1836 | case 8: /* Tx Buffer Size [WORD] (_TXL) */ | |
1837 | ||
1838 | - Descriptor->UartSerialBus.TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; | |
1839 | + TxFifoSize = (UINT16) InitializerOp->Asl.Value.Integer; | |
1840 | RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH_TX, | |
1841 | CurrentByteOffset + ASL_RESDESC_OFFSET (UartSerialBus.TxFifoSize)); | |
1842 | break; | |
77760c90 | 1843 | @@ -1225,6 +1258,11 @@ RsDoUartSerialBusDescriptor ( |
f3dfbd7c ER |
1844 | InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); |
1845 | } | |
1846 | ||
1847 | + ACPI_MOVE_32_TO_32(&Descriptor->UartSerialBus.DefaultBaudRate, &DefaultBaudRate); | |
1848 | + ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TypeSpecificFlags, &TypeSpecificFlags); | |
1849 | + ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.RxFifoSize, &RxFifoSize); | |
1850 | + ACPI_MOVE_16_TO_16(&Descriptor->UartSerialBus.TxFifoSize, &TxFifoSize); | |
1851 | + | |
1852 | MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); | |
1853 | return (Rnode); | |
1854 | } | |
77760c90 JB |
1855 | Index: acpica-unix2-20170224/source/compiler/aslrestype2w.c |
1856 | =================================================================== | |
1857 | --- acpica-unix2-20170224.orig/source/compiler/aslrestype2w.c | |
1858 | +++ acpica-unix2-20170224/source/compiler/aslrestype2w.c | |
1859 | @@ -81,6 +81,12 @@ RsDoWordIoDescriptor ( | |
f3dfbd7c ER |
1860 | UINT8 *OptionalFields; |
1861 | UINT16 StringLength = 0; | |
1862 | UINT32 OptionIndex = 0; | |
1863 | + UINT16 ResourceLength = 0; | |
1864 | + UINT16 Minimum = 0; | |
1865 | + UINT16 Maximum = 0; | |
1866 | + UINT16 AddressLength = 0; | |
1867 | + UINT16 Granularity = 0; | |
1868 | + UINT16 TranslationOffset = 0; | |
1869 | UINT32 CurrentByteOffset; | |
1870 | UINT32 i; | |
1871 | BOOLEAN ResSourceIndex = FALSE; | |
77760c90 | 1872 | @@ -102,8 +108,7 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1873 | * optional fields present |
1874 | */ | |
1875 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); | |
1876 | - Descriptor->Address16.ResourceLength = (UINT16) | |
1877 | - (sizeof (AML_RESOURCE_ADDRESS16) - | |
1878 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) - | |
1879 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
1880 | ||
1881 | /* Process all child initialization nodes */ | |
77760c90 | 1882 | @@ -147,7 +152,7 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1883 | |
1884 | case 5: /* Address Granularity */ | |
1885 | ||
1886 | - Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer; | |
1887 | + Granularity = (UINT16) InitializerOp->Asl.Value.Integer; | |
1888 | RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
1889 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); | |
1890 | GranOp = InitializerOp; | |
77760c90 | 1891 | @@ -155,7 +160,7 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1892 | |
1893 | case 6: /* Address Min */ | |
1894 | ||
1895 | - Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer; | |
1896 | + Minimum = (UINT16) InitializerOp->Asl.Value.Integer; | |
1897 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
1898 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); | |
1899 | MinOp = InitializerOp; | |
77760c90 | 1900 | @@ -163,7 +168,7 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1901 | |
1902 | case 7: /* Address Max */ | |
1903 | ||
1904 | - Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer; | |
1905 | + Maximum = (UINT16) InitializerOp->Asl.Value.Integer; | |
1906 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
1907 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); | |
1908 | MaxOp = InitializerOp; | |
77760c90 | 1909 | @@ -171,14 +176,14 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1910 | |
1911 | case 8: /* Translation Offset */ | |
1912 | ||
1913 | - Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; | |
1914 | + TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; | |
1915 | RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
1916 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); | |
1917 | break; | |
1918 | ||
1919 | case 9: /* Address Length */ | |
1920 | ||
1921 | - Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; | |
1922 | + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; | |
1923 | RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
1924 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); | |
1925 | LengthOp = InitializerOp; | |
77760c90 | 1926 | @@ -190,7 +195,7 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1927 | { |
1928 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
1929 | OptionIndex++; | |
1930 | - Descriptor->Address16.ResourceLength++; | |
1931 | + ResourceLength++; | |
1932 | ResSourceIndex = TRUE; | |
1933 | } | |
1934 | break; | |
77760c90 | 1935 | @@ -202,8 +207,7 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1936 | { |
1937 | if (StringLength) | |
1938 | { | |
1939 | - Descriptor->Address16.ResourceLength = (UINT16) | |
1940 | - (Descriptor->Address16.ResourceLength + StringLength); | |
1941 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
1942 | ||
1943 | strcpy ((char *) | |
1944 | &OptionalFields[OptionIndex], | |
77760c90 | 1945 | @@ -263,13 +267,20 @@ RsDoWordIoDescriptor ( |
f3dfbd7c ER |
1946 | /* Validate the Min/Max/Len/Gran values */ |
1947 | ||
1948 | RsLargeAddressCheck ( | |
1949 | - (UINT64) Descriptor->Address16.Minimum, | |
1950 | - (UINT64) Descriptor->Address16.Maximum, | |
1951 | - (UINT64) Descriptor->Address16.AddressLength, | |
1952 | - (UINT64) Descriptor->Address16.Granularity, | |
1953 | + Minimum, | |
1954 | + Maximum, | |
1955 | + AddressLength, | |
1956 | + Granularity, | |
1957 | Descriptor->Address16.Flags, | |
1958 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
1959 | ||
1960 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength); | |
1961 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum); | |
1962 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum); | |
1963 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength); | |
1964 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity); | |
1965 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset); | |
1966 | + | |
1967 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + | |
1968 | OptionIndex + StringLength; | |
1969 | return (Rnode); | |
77760c90 | 1970 | @@ -302,6 +313,12 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
1971 | UINT8 *OptionalFields; |
1972 | UINT16 StringLength = 0; | |
1973 | UINT32 OptionIndex = 0; | |
1974 | + UINT16 ResourceLength = 0; | |
1975 | + UINT16 Minimum = 0; | |
1976 | + UINT16 Maximum = 0; | |
1977 | + UINT16 AddressLength = 0; | |
1978 | + UINT16 Granularity = 0; | |
1979 | + UINT16 TranslationOffset = 0; | |
1980 | UINT32 CurrentByteOffset; | |
1981 | UINT32 i; | |
1982 | BOOLEAN ResSourceIndex = FALSE; | |
77760c90 | 1983 | @@ -323,8 +340,7 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
1984 | * optional fields present |
1985 | */ | |
1986 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); | |
1987 | - Descriptor->Address16.ResourceLength = (UINT16) | |
1988 | - (sizeof (AML_RESOURCE_ADDRESS16) - | |
1989 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) - | |
1990 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
1991 | ||
1992 | /* Process all child initialization nodes */ | |
77760c90 | 1993 | @@ -361,8 +377,7 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
1994 | |
1995 | case 4: /* Address Granularity */ | |
1996 | ||
1997 | - Descriptor->Address16.Granularity = | |
1998 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
1999 | + Granularity = (UINT16) InitializerOp->Asl.Value.Integer; | |
2000 | RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
2001 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); | |
2002 | GranOp = InitializerOp; | |
77760c90 | 2003 | @@ -370,8 +385,7 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
2004 | |
2005 | case 5: /* Min Address */ | |
2006 | ||
2007 | - Descriptor->Address16.Minimum = | |
2008 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2009 | + Minimum = (UINT16) InitializerOp->Asl.Value.Integer; | |
2010 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
2011 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); | |
2012 | MinOp = InitializerOp; | |
77760c90 | 2013 | @@ -379,8 +393,7 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
2014 | |
2015 | case 6: /* Max Address */ | |
2016 | ||
2017 | - Descriptor->Address16.Maximum = | |
2018 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2019 | + Maximum = (UINT16) InitializerOp->Asl.Value.Integer; | |
2020 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
2021 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); | |
2022 | MaxOp = InitializerOp; | |
77760c90 | 2023 | @@ -388,16 +401,14 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
2024 | |
2025 | case 7: /* Translation Offset */ | |
2026 | ||
2027 | - Descriptor->Address16.TranslationOffset = | |
2028 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2029 | + TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; | |
2030 | RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
2031 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); | |
2032 | break; | |
2033 | ||
2034 | case 8: /* Address Length */ | |
2035 | ||
2036 | - Descriptor->Address16.AddressLength = | |
2037 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2038 | + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; | |
2039 | RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
2040 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); | |
2041 | LengthOp = InitializerOp; | |
77760c90 | 2042 | @@ -409,7 +420,7 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
2043 | { |
2044 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
2045 | OptionIndex++; | |
2046 | - Descriptor->Address16.ResourceLength++; | |
2047 | + ResourceLength++; | |
2048 | ResSourceIndex = TRUE; | |
2049 | } | |
2050 | break; | |
77760c90 | 2051 | @@ -421,8 +432,7 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
2052 | { |
2053 | if (StringLength) | |
2054 | { | |
2055 | - Descriptor->Address16.ResourceLength = (UINT16) | |
2056 | - (Descriptor->Address16.ResourceLength + StringLength); | |
2057 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
2058 | ||
2059 | strcpy ((char *) | |
2060 | &OptionalFields[OptionIndex], | |
77760c90 | 2061 | @@ -468,13 +478,20 @@ RsDoWordBusNumberDescriptor ( |
f3dfbd7c ER |
2062 | /* Validate the Min/Max/Len/Gran values */ |
2063 | ||
2064 | RsLargeAddressCheck ( | |
2065 | - (UINT64) Descriptor->Address16.Minimum, | |
2066 | - (UINT64) Descriptor->Address16.Maximum, | |
2067 | - (UINT64) Descriptor->Address16.AddressLength, | |
2068 | - (UINT64) Descriptor->Address16.Granularity, | |
2069 | + Minimum, | |
2070 | + Maximum, | |
2071 | + AddressLength, | |
2072 | + Granularity, | |
2073 | Descriptor->Address16.Flags, | |
2074 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
2075 | ||
2076 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength); | |
2077 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum); | |
2078 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum); | |
2079 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength); | |
2080 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity); | |
2081 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset); | |
2082 | + | |
2083 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + | |
2084 | OptionIndex + StringLength; | |
2085 | return (Rnode); | |
77760c90 | 2086 | @@ -507,6 +524,12 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2087 | UINT8 *OptionalFields; |
2088 | UINT16 StringLength = 0; | |
2089 | UINT32 OptionIndex = 0; | |
2090 | + UINT16 Minimum = 0; | |
2091 | + UINT16 Maximum = 0; | |
2092 | + UINT16 AddressLength = 0; | |
2093 | + UINT16 Granularity = 0; | |
2094 | + UINT16 TranslationOffset = 0; | |
2095 | + UINT16 ResourceLength = 0; | |
2096 | UINT32 CurrentByteOffset; | |
2097 | UINT32 i; | |
2098 | BOOLEAN ResSourceIndex = FALSE; | |
77760c90 | 2099 | @@ -527,8 +550,7 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2100 | * optional fields present |
2101 | */ | |
2102 | OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16); | |
2103 | - Descriptor->Address16.ResourceLength = (UINT16) | |
2104 | - (sizeof (AML_RESOURCE_ADDRESS16) - | |
2105 | + ResourceLength = (UINT16) (sizeof (AML_RESOURCE_ADDRESS16) - | |
2106 | sizeof (AML_RESOURCE_LARGE_HEADER)); | |
2107 | ||
2108 | /* Process all child initialization nodes */ | |
77760c90 | 2109 | @@ -577,8 +599,7 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2110 | |
2111 | case 6: /* Address Granularity */ | |
2112 | ||
2113 | - Descriptor->Address16.Granularity = | |
2114 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2115 | + Granularity = (UINT16) InitializerOp->Asl.Value.Integer; | |
2116 | RsCreateWordField (InitializerOp, ACPI_RESTAG_GRANULARITY, | |
2117 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity)); | |
2118 | GranOp = InitializerOp; | |
77760c90 | 2119 | @@ -586,8 +607,7 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2120 | |
2121 | case 7: /* Min Address */ | |
2122 | ||
2123 | - Descriptor->Address16.Minimum = | |
2124 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2125 | + Minimum = (UINT16) InitializerOp->Asl.Value.Integer; | |
2126 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MINADDR, | |
2127 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum)); | |
2128 | MinOp = InitializerOp; | |
77760c90 | 2129 | @@ -595,8 +615,7 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2130 | |
2131 | case 8: /* Max Address */ | |
2132 | ||
2133 | - Descriptor->Address16.Maximum = | |
2134 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2135 | + Maximum = (UINT16) InitializerOp->Asl.Value.Integer; | |
2136 | RsCreateWordField (InitializerOp, ACPI_RESTAG_MAXADDR, | |
2137 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum)); | |
2138 | MaxOp = InitializerOp; | |
77760c90 | 2139 | @@ -604,16 +623,14 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2140 | |
2141 | case 9: /* Translation Offset */ | |
2142 | ||
2143 | - Descriptor->Address16.TranslationOffset = | |
2144 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2145 | + TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer; | |
2146 | RsCreateWordField (InitializerOp, ACPI_RESTAG_TRANSLATION, | |
2147 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset)); | |
2148 | break; | |
2149 | ||
2150 | case 10: /* Address Length */ | |
2151 | ||
2152 | - Descriptor->Address16.AddressLength = | |
2153 | - (UINT16) InitializerOp->Asl.Value.Integer; | |
2154 | + AddressLength = (UINT16) InitializerOp->Asl.Value.Integer; | |
2155 | RsCreateWordField (InitializerOp, ACPI_RESTAG_LENGTH, | |
2156 | CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength)); | |
2157 | LengthOp = InitializerOp; | |
77760c90 | 2158 | @@ -625,7 +642,7 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2159 | { |
2160 | OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer; | |
2161 | OptionIndex++; | |
2162 | - Descriptor->Address16.ResourceLength++; | |
2163 | + ResourceLength++; | |
2164 | ResSourceIndex = TRUE; | |
2165 | } | |
2166 | break; | |
77760c90 | 2167 | @@ -637,8 +654,7 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2168 | { |
2169 | if (StringLength) | |
2170 | { | |
2171 | - Descriptor->Address16.ResourceLength = (UINT16) | |
2172 | - (Descriptor->Address16.ResourceLength + StringLength); | |
2173 | + ResourceLength = (UINT16) (ResourceLength + StringLength); | |
2174 | ||
2175 | strcpy ((char *) | |
2176 | &OptionalFields[OptionIndex], | |
77760c90 | 2177 | @@ -684,13 +700,20 @@ RsDoWordSpaceDescriptor ( |
f3dfbd7c ER |
2178 | /* Validate the Min/Max/Len/Gran values */ |
2179 | ||
2180 | RsLargeAddressCheck ( | |
2181 | - (UINT64) Descriptor->Address16.Minimum, | |
2182 | - (UINT64) Descriptor->Address16.Maximum, | |
2183 | - (UINT64) Descriptor->Address16.AddressLength, | |
2184 | - (UINT64) Descriptor->Address16.Granularity, | |
2185 | + Minimum, | |
2186 | + Maximum, | |
2187 | + AddressLength, | |
2188 | + Granularity, | |
2189 | Descriptor->Address16.Flags, | |
2190 | MinOp, MaxOp, LengthOp, GranOp, Info->DescriptorTypeOp); | |
2191 | ||
2192 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.ResourceLength, &ResourceLength); | |
2193 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Minimum, &Minimum); | |
2194 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Maximum, &Maximum); | |
2195 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.AddressLength, &AddressLength); | |
2196 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.Granularity, &Granularity); | |
2197 | + ACPI_MOVE_16_TO_16(&Descriptor->Address16.TranslationOffset, &TranslationOffset); | |
2198 | + | |
2199 | Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + | |
2200 | OptionIndex + StringLength; | |
2201 | return (Rnode); | |
77760c90 JB |
2202 | Index: acpica-unix2-20170224/source/include/acmacros.h |
2203 | =================================================================== | |
2204 | --- acpica-unix2-20170224.orig/source/include/acmacros.h | |
2205 | +++ acpica-unix2-20170224/source/include/acmacros.h | |
2206 | @@ -100,7 +100,8 @@ | |
f3dfbd7c ER |
2207 | |
2208 | /* 32-bit source, 16/32/64 destination */ | |
2209 | ||
2210 | -#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | |
2211 | +#define ACPI_MOVE_32_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ | |
2212 | + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];} | |
2213 | ||
2214 | #define ACPI_MOVE_32_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[3];\ | |
2215 | (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[2];\ | |
77760c90 | 2216 | @@ -115,9 +116,13 @@ |
f3dfbd7c ER |
2217 | |
2218 | /* 64-bit source, 16/32/64 destination */ | |
2219 | ||
2220 | -#define ACPI_MOVE_64_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | |
2221 | +#define ACPI_MOVE_64_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ | |
2222 | + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];} | |
2223 | ||
2224 | -#define ACPI_MOVE_64_TO_32(d, s) ACPI_MOVE_32_TO_32(d, s) /* Truncate to 32 */ | |
2225 | +#define ACPI_MOVE_64_TO_32(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ | |
2226 | + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\ | |
2227 | + (( UINT8 *)(void *)(d))[2] = ((UINT8 *)(void *)(s))[5];\ | |
2228 | + (( UINT8 *)(void *)(d))[3] = ((UINT8 *)(void *)(s))[4];} | |
2229 | ||
2230 | #define ACPI_MOVE_64_TO_64(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[7];\ | |
2231 | (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[6];\ | |
77760c90 | 2232 | @@ -144,7 +149,9 @@ |
f3dfbd7c ER |
2233 | |
2234 | /* 32-bit source, 16/32/64 destination */ | |
2235 | ||
2236 | -#define ACPI_MOVE_32_TO_16(d, s) ACPI_MOVE_16_TO_16(d, s) /* Truncate to 16 */ | |
2237 | +#define ACPI_MOVE_32_TO_16(d, s) {(( UINT8 *)(void *)(d))[0] = ((UINT8 *)(void *)(s))[0];\ | |
2238 | + (( UINT8 *)(void *)(d))[1] = ((UINT8 *)(void *)(s))[1];} | |
2239 | + | |
2240 | #define ACPI_MOVE_32_TO_32(d, s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s) | |
2241 | #define ACPI_MOVE_32_TO_64(d, s) *(UINT64 *)(void *)(d) = *(UINT32 *)(void *)(s) | |
2242 | ||
77760c90 JB |
2243 | Index: acpica-unix2-20170224/source/include/platform/aclinux.h |
2244 | =================================================================== | |
2245 | --- acpica-unix2-20170224.orig/source/include/platform/aclinux.h | |
2246 | +++ acpica-unix2-20170224/source/include/platform/aclinux.h | |
2247 | @@ -185,6 +185,7 @@ | |
2248 | ||
2249 | #ifdef ACPI_USE_STANDARD_HEADERS | |
f3dfbd7c ER |
2250 | #include <unistd.h> |
2251 | +#include <endian.h> | |
f3dfbd7c ER |
2252 | #endif |
2253 | ||
77760c90 | 2254 | /* Define/disable kernel-specific declarators */ |