Debian Codegraph @

tests/aslts/src/runtime/collections/Identity2MS/abbu/initial/ns_in00.asl

raw
1 /*
2 * Some or all of this work - Copyright (c) 2006 - 2021, Intel Corp.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
26 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /*
30 * Tests originated from namespace/ns0
31 */
32
33 /*
34 * Trying to get the chain of calls of methods such that
35 * sections of operative stack corresponding to different
36 * methods contain the internal object (itself, not a RefOf
37 * reference to it) of the same Name Space node.
38 *
39 * Then force (by Store/CopyObject):
40 * 1) changing the value of that internal object
41 * 2) replacing the internal object itself by some another one
42 *
43 * Check that the changing/replacing has no effect on the
44 * values evaluated on the lowest stages of calculation.
45 *
46 * Accessing objects by argX and directly by name too.
47 */
48
49 Name(z163, 163)
50
51 /*
52 * Named Integer i000
53 */
54
55 /*
56 * Simple, 3-level
57 */
58 Method(in00, 1, Serialized)
59 {
60 Name(ts, "in00")
61 Name(i000, 0x00000001)
62 Name(p000, Package() {1,2,3,4})
63
64 Name(i001, 0)
65
66 Store(arg0, i001)
67
68 Method(m001)
69 {
70 Method(m002)
71 {
72 Method(m003)
73 {
74 if (i001) {
75 CopyObject(p000, i000)
76 }
77 Return (0xabcd0000)
78 }
79 Return (Add(i000, m003()))
80 }
81 Return (Add(i000, m002()))
82 }
83 Store(Add(i000, m001()), Local0)
84 if (LNotEqual(Local0, 0xabcd0003)) {
85 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0003)
86 }
87 }
88
89 /*
90 * 8-level
91 * added writing into i000:
92 * Store(0x00040000, i000)
93 */
94 Method(in01, 1, Serialized)
95 {
96 Name(ts, "in01")
97 Name(i000, 0x00000001)
98 Name(i001, 0)
99 Name(p000, Package() {1,2,3,4})
100
101 Store(arg0, i001)
102
103 Method(m001)
104 {
105 Method(m002)
106 {
107 Method(m003)
108 {
109 Method(m004)
110 {
111 Method(m005)
112 {
113 Method(m006)
114 {
115 Method(m007)
116 {
117 Method(m008)
118 {
119 if (i001)
120 {
121 CopyObject(p000, i000)
122 }
123 Return (0)
124 }
125 Store(0x80000000, i000)
126 Return (Add(i000, m008()))
127 }
128 Store(0x07000000, i000)
129 Return (Add(i000, m007()))
130 }
131 Store(0x00600000, i000)
132 Return (Add(i000, m006()))
133 }
134 Store(0x00050000, i000)
135 Return (Add(i000, m005()))
136 }
137 Store(0x00004000, i000)
138 Return (Add(i000, m004()))
139 }
140 Store(0x00000300, i000)
141 Return (Add(i000, m003()))
142 }
143 Store(0x00000020, i000)
144 Return (Add(i000, m002()))
145 }
146 Store(Add(i000, m001()), Local0)
147
148 if (LNotEqual(Local0, 0x87654321)) {
149 err(ts, z163, __LINE__, 0, 0, Local0, 0x87654321)
150 }
151
152 if (LNotEqual(i000, 0x80000000)) {
153 err(ts, z163, __LINE__, 0, 0, i000, 0x80000000)
154 }
155 }
156
157 /*
158 * Recurcive execution of m001:
159 * Add(i000, m001(), Local0)
160 */
161 Method(in02,, Serialized)
162 {
163 Name(ts, "in02")
164 Name(i000, 0x00100000)
165 Name(i001, 0)
166
167 Method(m001)
168 {
169 /*
170 * Because of the stack overflow issues on MS the number
171 * of repetitions was changed from 100 to 11 here.
172 */
173 if (LLess(i001, 11)) {
174 Increment(i000)
175 Increment(i001)
176 Add(i000, m001(), Local0)
177 Return (Local0)
178 }
179 Return (0)
180 }
181 Store(Add(i000, m001()), Local0)
182
183 if (LNotEqual(Local0, 0x00c00042)) {
184 err(ts, z163, __LINE__, 0, 0, Local0, 0x00c00042)
185 }
186
187 if (LNotEqual(i000, 0x0010000b)) {
188 err(ts, z163, __LINE__, 0, 0, i000, 0x0010000b)
189 }
190 }
191
192 /*
193 * Local instead of i000 (in in01)
194 */
195 Method(in03, 1, Serialized)
196 {
197 Name(ts, "in03")
198 Name(i001, 0)
199 Name(p000, Package() {1,2,3,4})
200
201 Store(arg0, i001)
202
203 Store(0x00000001, Local7)
204
205 Method(m001)
206 {
207 Method(m002)
208 {
209 Method(m003)
210 {
211 Method(m004)
212 {
213 Method(m005)
214 {
215 Method(m006)
216 {
217 Method(m007)
218 {
219 Method(m008)
220 {
221 if (i001)
222 {
223 CopyObject(p000, Local7)
224 }
225 Return (0)
226 }
227 Store(0x80000000, Local7)
228 Return (Add(Local7, m008()))
229 }
230 Store(0x07000000, Local7)
231 Return (Add(Local7, m007()))
232 }
233 Store(0x00600000, Local7)
234 Return (Add(Local7, m006()))
235 }
236 Store(0x00050000, Local7)
237 Return (Add(Local7, m005()))
238 }
239 Store(0x00004000, Local7)
240 Return (Add(Local7, m004()))
241 }
242 Store(0x00000300, Local7)
243 Return (Add(Local7, m003()))
244 }
245 Store(0x00000020, Local7)
246 Return (Add(Local7, m002()))
247 }
248 Store(Add(Local7, m001()), Local0)
249
250 if (LNotEqual(Local0, 0x87654321)) {
251 err(ts, z163, __LINE__, 0, 0, Local0, 0x87654321)
252 }
253
254 if (LNotEqual(Local7, 1)) {
255 err(ts, z163, __LINE__, 0, 0, Local7, 1)
256 }
257 }
258
259 /*
260 * Arg instead of i000 (in in01)
261 *
262 * see ns_0100.asl
263 */
264
265 /*
266 * 8-level
267 * added writing into i000:
268 * Store(0x00040000, i000)
269 *
270 * in01 +:
271 * m00X are passed with i000
272 * argX inside m00X is rewritten
273 */
274 Method(in04,, Serialized)
275 {
276 Name(ts, "in04")
277 Name(i000, 0x00000001)
278 Name(i001, 0)
279 Name(p000, Package() {1,2,3,4})
280
281 Method(m001, 2)
282 {
283 Method(m002, 2)
284 {
285 Method(m003, 2)
286 {
287 Method(m004, 2)
288 {
289 Method(m005, 2)
290 {
291 Method(m006, 2)
292 {
293 Method(m007, 2)
294 {
295 /*
296 * ====================== >>>>>>>>
297 * Sometimes, after I added a big group of
298 * 'If' operators, this fragment of code causes
299 * break of execution on MS. But, namely --
300 * sometimes! To investigate the reason I
301 * commented part by part of it to find
302 * workable code, then un-commented it
303 * part by part too.
304 * It entire initial code
305 * started working on MS again!
306 */
307 /*
308 Method(m008, 2)
309 {
310 if (i001)
311 {
312 CopyObject(p000, i000)
313 }
314 Store(0x10000008, arg0)
315 Return (0)
316 }
317 Store(0x80000000, i000)
318 Store(0x10000007, arg0)
319 Return (Add(i000, m008(i000, arg0)))
320 */
321 /*
322 * ====================== <<<<<<<<
323 */
324
325 Store(0x80000000, i000)
326 Store(0x10000007, arg0)
327 Add(i000, 0, Local0)
328
329 Return (Local0)
330 }
331 Store(0x07000000, i000)
332 Store(0x10000006, arg0)
333 Return (Add(i000, m007(i000, arg0)))
334 }
335 Store(0x00600000, i000)
336 Store(0x10000005, arg0)
337 Return (Add(i000, m006(i000, arg0)))
338 }
339 Store(0x00050000, i000)
340 Store(0x10000004, arg0)
341 Return (Add(i000, m005(i000, arg0)))
342 }
343 if (LNotEqual(arg0, 0x00000300)) {
344 err(ts, z163, __LINE__, 0, 0, arg0, 0x00000300)
345 }
346 if (LNotEqual(arg1, 0x10000001)) {
347 err(ts, z163, __LINE__, 0, 0, arg1, 0x10000001)
348 }
349 Store(0x00004000, i000)
350 Store(0x10000003, arg0)
351 Return (Add(i000, m004(i000, arg0)))
352 }
353 if (LNotEqual(arg0, 0x00000020)) {
354 err(ts, z163, __LINE__, 0, 0, arg0, 0x00000020)
355 }
356 if (LNotEqual(i000, 0x00000020)) {
357 err(ts, z163, __LINE__, 0, 0, i000, 0x00000020)
358 }
359 Store(0x10000002, arg0)
360 if (LNotEqual(i000, 0x00000020)) {
361 err(ts, z163, __LINE__, 0, 0, i000, 0x00000020)
362 }
363 if (LNotEqual(arg0, 0x10000002)) {
364 err(ts, z163, __LINE__, 0, 0, arg0, 0x10000002)
365 }
366 Store(0x00000300, i000)
367 if (LNotEqual(i000, 0x00000300)) {
368 err(ts, z163, __LINE__, 0, 0, i000, 0x00000300)
369 }
370 if (LNotEqual(arg0, 0x10000002)) {
371 err(ts, z163, __LINE__, 0, 0, arg0, 0x10000002)
372 }
373 if (LNotEqual(arg1, 0x10000001)) {
374 err(ts, z163, __LINE__, 0, 0, arg1, 0x10000001)
375 }
376 Store(0x10000002, arg0)
377 Store(0x00000300, i000)
378 Return (Add(i000, m003(i000, arg1)))
379 }
380 if (LNotEqual(arg0, 0x00000001)) {
381 err(ts, z163, __LINE__, 0, 0, arg0, 0x00000001)
382 }
383 if (LNotEqual(i000, 0x00000001)) {
384 err(ts, z163, __LINE__, 0, 0, i000, 0x00000001)
385 }
386 Store(0x10000001, arg0)
387 if (LNotEqual(i000, 0x00000001)) {
388 err(ts, z163, __LINE__, 0, 0, i000, 0x00000001)
389 }
390 if (LNotEqual(arg0, 0x10000001)) {
391 err(ts, z163, __LINE__, 0, 0, arg0, 0x10000001)
392 }
393 Store(0x00000020, i000)
394 if (LNotEqual(i000, 0x00000020)) {
395 err(ts, z163, __LINE__, 0, 0, i000, 0x00000020)
396 }
397 if (LNotEqual(arg0, 0x10000001)) {
398 err(ts, z163, __LINE__, 0, 0, arg0, 0x10000001)
399 }
400 if (LNotEqual(arg1, 0x10000000)) {
401 err(ts, z163, __LINE__, 0, 0, arg1, 0x10000000)
402 }
403 Store(0x10000001, arg0)
404 Store(0x00000020, i000)
405 Return (Add(i000, m002(i000, arg0)))
406 }
407 Store(Add(i000, m001(i000, 0x10000000)), Local0)
408
409 if (LNotEqual(Local0, 0x87654321)) {
410 err(ts, z163, __LINE__, 0, 0, Local0, 0x87654321)
411 }
412
413 if (LNotEqual(i000, 0x80000000)) {
414 err(ts, z163, __LINE__, 0, 0, i000, 0x80000000)
415 }
416 }
417
418 /*
419 * Note: now the checkings are so that in05 succeeds on MS.
420 */
421 Method(in05,, Serialized)
422 {
423 Name(ts, "in05")
424
425 Name(i000, 0xabcd0000)
426 Name(s000, "qwrtyu0003")
427 Name(b000, Buffer() {0xb0,0xb1,0xb2,0xb3,0xb4})
428 Name(p000, Package() {0xabcd0001, 0xabcd0002, 0xabcd0003})
429 Event(e000)
430 Mutex(mx00, 0)
431 Method(mmm0,, Serialized) {
432 Name(im00, 0xabcd0004)
433 Name(sm00, "qwertyui")
434 // Return ( "qwertyui" )
435 }
436 Method(mmm1,, Serialized) {
437 Name(im00, 0xabcd0004)
438 Name(sm00, "qwertyui")
439 // Return ( 0xabcd0004 )
440 Return ( "qwertyui" )
441 }
442 Device(d000) { Name(id00, 0xabcd0005) }
443 ThermalZone(tz00) { Name(itz0, 0xabcd0006) }
444 Processor(pr00, 0, 0xFFFFFFFF, 0) { Name(ipr0, 0xabcd0007) }
445 PowerResource(pw00, 1, 0) { Name(ipw0, 0xabcd0008) }
446 OperationRegion(r000, SystemMemory, 0x100, 0x100)
447
448 Name(b001, Buffer() {0xa0,0xa1,0xa2,0xa3,0xa4})
449 CreateField(b001, 0, 8, bf00)
450
451 OperationRegion(r001, SystemMemory, 0x100, 0x100)
452 Field(r001, ByteAcc, NoLock, Preserve) {f000,32, f001,32, f002,32, f003,32}
453 BankField(r001, f001, 0, ByteAcc, NoLock, Preserve) {bnk0,32}
454 IndexField(f002, f003, ByteAcc, NoLock, Preserve) {if00,32, if01,32}
455
456 Method(m001, 2)
457 {
458 Store(ObjectType(arg0), Local0)
459 if (LNotEqual(Local0, arg1)) {
460 err(ts, z163, __LINE__, 0, 0, Local0, arg1)
461 }
462 Return (5)
463 }
464
465 CH03(ts, z163, 0x000, __LINE__, 0)
466
467 Store(Add(DerefOf(Index(p000, 0)), m001(i000, c009)), Local0)
468 if (LNotEqual(Local0, 0xabcd0006)) {
469 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
470 }
471 Store(Add(DerefOf(Index(p000, 0)), m001(s000, c00a)), Local0)
472 if (LNotEqual(Local0, 0xabcd0006)) {
473 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
474 }
475 Store(Add(DerefOf(Index(p000, 0)), m001(b000, c00b)), Local0)
476 if (LNotEqual(Local0, 0xabcd0006)) {
477 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
478 }
479 Store(Add(DerefOf(Index(p000, 0)), m001(p000, c00c)), Local0)
480 if (LNotEqual(Local0, 0xabcd0006)) {
481 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
482 }
483 Store(Add(DerefOf(Index(p000, 0)), m001(e000, c00f)), Local0)
484 if (LNotEqual(Local0, 0xabcd0006)) {
485 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
486 }
487 Store(Add(DerefOf(Index(p000, 0)), m001(mx00, c011)), Local0)
488 if (LNotEqual(Local0, 0xabcd0006)) {
489 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
490 }
491 Store(Add(DerefOf(Index(p000, 0)), m001(mmm0, c008)), Local0)
492 if (LNotEqual(Local0, 0xabcd0006)) {
493 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
494 }
495 Store(Add(DerefOf(Index(p000, 0)), m001(mmm1, c00a)), Local0)
496 if (LNotEqual(Local0, 0xabcd0006)) {
497 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
498 }
499 Store(Add(DerefOf(Index(p000, 0)), m001(d000, c00e)), Local0)
500 if (LNotEqual(Local0, 0xabcd0006)) {
501 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
502 }
503 Store(Add(DerefOf(Index(p000, 0)), m001(tz00, c015)), Local0)
504 if (LNotEqual(Local0, 0xabcd0006)) {
505 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
506 }
507 Store(Add(DerefOf(Index(p000, 0)), m001(pr00, c014)), Local0)
508 if (LNotEqual(Local0, 0xabcd0006)) {
509 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
510 }
511 Store(Add(DerefOf(Index(p000, 0)), m001(pw00, c013)), Local0)
512 if (LNotEqual(Local0, 0xabcd0006)) {
513 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
514 }
515 Store(Add(DerefOf(Index(p000, 0)), m001(r000, c012)), Local0)
516 if (LNotEqual(Local0, 0xabcd0006)) {
517 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
518 }
519 Store(Add(DerefOf(Index(p000, 0)), m001(bf00, c00b)), Local0)
520 if (LNotEqual(Local0, 0xabcd0006)) {
521 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
522 }
523 Store(Add(DerefOf(Index(p000, 0)), m001(f000, c009)), Local0)
524 if (LNotEqual(Local0, 0xabcd0006)) {
525 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
526 }
527 Store(Add(DerefOf(Index(p000, 0)), m001(bnk0, c009)), Local0)
528 if (LNotEqual(Local0, 0xabcd0006)) {
529 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
530 }
531 Store(Add(DerefOf(Index(p000, 0)), m001(if00, c009)), Local0)
532 if (LNotEqual(Local0, 0xabcd0006)) {
533 err(ts, z163, __LINE__, 0, 0, Local0, 0xabcd0006)
534 }
535
536
537 Store(ObjectType(f000), Local0)
538 if (LNotEqual(Local0, c00d)) {
539 err(ts, z163, __LINE__, 0, 0, Local0, c00d)
540 }
541 Store(ObjectType(if00), Local0)
542 if (LNotEqual(Local0, c00d)) {
543 err(ts, z163, __LINE__, 0, 0, Local0, c00d)
544 }
545 Store(ObjectType(bnk0), Local0)
546 if (LNotEqual(Local0, c00d)) {
547 err(ts, z163, __LINE__, 0, 0, Local0, c00d)
548 }
549 Store(ObjectType(bf00), Local0)
550 if (LNotEqual(Local0, c016)) {
551 err(ts, z163, __LINE__, 0, 0, Local0, c016)
552 }
553
554 CH03(ts, z163, 0x000, __LINE__, 0)
555 }
556
557 Method(in06,, Serialized)
558 {
559 Name(ts, "in06")
560 Name(i000, 0xabcd0000)
561
562 Store(ObjectType(i000), Local0)
563 if (LNotEqual(Local0, c009)) {
564 err(ts, z163, __LINE__, 0, 0, Local0, c009)
565 }
566 }
567
568 Method(ini0)
569 {
570 SRMT("in00-0")
571 in00(0)
572 SRMT("in01-0")
573 in01(0)
574 SRMT("in02")
575 in02()
576 SRMT("in03-0")
577 in03(0)
578 SRMT("in04")
579 in04()
580 SRMT("in05")
581 if (LAnd(fix1, chk2)) {
582 /*
583 * It breaks MS while re-booting,
584 * for ACPICA it causes exception
585 * and breaks path.
586 */
587 in05()
588 } else {
589 BLCK()
590 }
591 SRMT("in06")
592 in06()
593
594 CH03("ini0", z163, 0x000, __LINE__, 0)
595 }