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/ns1
31 */
32
33/*
34 * Package/Buffer/String/Field/IndexField/BankField/BufferField
35 *
36 * Tests below are here
37 * as specific type arguments passing -
38 * arguments though passed directly to method, not as references,
39 * nevertheless allow access to the elements of original objects.
40 */
41
42Name(z164, 164)
43
44/*
45 *
46 * Read/write access to elements of Package passed to method.
47 *
48 */
49
50/*
51 *
52 * Elements of Package are constant Integer (0xabcd0000)
53 *
54 */
55
56/*
57 * Package is passed by ArgX to method:
58 * - directly
59 */
60Method(in10,, Serialized)
61{
62	Name(ts, "in10")
63	Name(p000, Package() {0xabcd0000, 0xabcd0001, 0xabcd0002})
64	Method(m001, 2)
65	{
66		Store(DerefOf(Index(arg0, 0)), Local0)
67		if (LNotEqual(Local0, 0xabcd0000)) {
68			err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0000)
69		}
70
71		Store(0x11112222, Index(arg0, 0))
72
73		Store(DerefOf(Index(arg0, 0)), Local0)
74		if (LNotEqual(Local0, 0x11112222)) {
75			err(ts, z164, __LINE__, 0, 0, Local0, 0x11112222)
76		}
77	}
78
79	m001(p000, RefOf(p000))
80
81	Store(DerefOf(Index(p000, 0)), Local0)
82	if (LNotEqual(Local0, 0x11112222)) {
83		err(ts, z164, __LINE__, 0, 0, Local0, 0x11112222)
84	}
85
86	Store(DerefOf(Index(p000, 1)), Local0)
87	if (LNotEqual(Local0, 0xabcd0001)) {
88		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
89	}
90}
91
92/*
93 * Package is passed by ArgX to method:
94 * - by ORef
95 */
96Method(in11,, Serialized)
97{
98	Name(ts, "in11")
99	Name(p000, Package() {0xabcd0000, 0xabcd0001, 0xabcd0002})
100	Method(m001, 2)
101	{
102		Store(DerefOf(arg1), Local7)
103
104		Store(DerefOf(Index(Local7, 1)), Local0)
105		if (LNotEqual(Local0, 0xabcd0001)) {
106			err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
107		}
108
109		Store(0x33334444, Index(Local7, 1))
110
111		Store(DerefOf(Index(Local7, 1)), Local0)
112		if (LNotEqual(Local0, 0x33334444)) {
113			err(ts, z164, __LINE__, 0, 0, Local0, 0x33334444)
114		}
115	}
116
117	m001(p000, RefOf(p000))
118
119	Store(DerefOf(Index(p000, 0)), Local0)
120	if (LNotEqual(Local0, 0xabcd0000)) {
121		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0000)
122	}
123
124	Store(DerefOf(Index(p000, 1)), Local0)
125	if (LNotEqual(Local0, 0xabcd0001)) {
126		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
127	}
128}
129
130/*
131 * Package is passed by ArgX to method:
132 * - directly
133 * - by ORef
134 */
135Method(in12,, Serialized)
136{
137	Name(ts, "in12")
138	Name(p000, Package() {0xabcd0000, 0xabcd0001, 0xabcd0002})
139	Method(m001, 2)
140	{
141		Store(0x11112222, Index(arg0, 0))
142
143		Store(DerefOf(Index(arg0, 0)), Local0)
144		if (LNotEqual(Local0, 0x11112222)) {
145			err(ts, z164, __LINE__, 0, 0, Local0, 0x11112222)
146		}
147
148		Store(DerefOf(arg1), Local7)
149		Store(0x33334444, Index(Local7, 1))
150
151		Store(DerefOf(Index(Local7, 1)), Local0)
152		if (LNotEqual(Local0, 0x33334444)) {
153			err(ts, z164, __LINE__, 0, 0, Local0, 0x33334444)
154		}
155	}
156
157	m001(p000, RefOf(p000))
158
159	Store(DerefOf(Index(p000, 0)), Local0)
160	if (LNotEqual(Local0, 0x11112222)) {
161		err(ts, z164, __LINE__, 0, 0, Local0, 0x11112222)
162	}
163
164	Store(DerefOf(Index(p000, 1)), Local0)
165	if (LNotEqual(Local0, 0xabcd0001)) {
166		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
167	}
168}
169
170/*
171 * Package is given directly by name:
172 * - do ORef and pass to LocalX
173 * - do DerefOf and pass to LocalX
174 */
175Method(in13,, Serialized)
176{
177	Name(ts, "in13")
178	Name(p000, Package() {0xabcd0000, 0xabcd0001, 0xabcd0002})
179	Method(m001, 2)
180	{
181		Store(RefOf(p000), Local6)
182		Store(DerefOf(Local6), Local7)
183
184		Store(DerefOf(Index(Local7, 1)), Local0)
185		if (LNotEqual(Local0, 0xabcd0001)) {
186			err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
187		}
188
189		Store(0x33334444, Index(Local7, 1))
190
191		Store(DerefOf(Index(Local7, 1)), Local0)
192		if (LNotEqual(Local0, 0x33334444)) {
193			err(ts, z164, __LINE__, 0, 0, Local0, 0x33334444)
194		}
195	}
196
197	m001(p000, RefOf(p000))
198
199	Store(DerefOf(Index(p000, 0)), Local0)
200	if (LNotEqual(Local0, 0xabcd0000)) {
201		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0000)
202	}
203	Store(DerefOf(Index(p000, 1)), Local0)
204	if (LNotEqual(Local0, 0xabcd0001)) {
205		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
206	}
207	Store(DerefOf(Index(p000, 2)), Local0)
208	if (LNotEqual(Local0, 0xabcd0002)) {
209		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0002)
210	}
211}
212
213/*
214 *
215 * Elements of Package are Named Integer (i000)
216 *
217 */
218
219/*
220 * Package is passed by ArgX to method
221 *
222 * fail
223 *
224 * Note:
225 *   Named element of Package is simply not implemented by MS,
226 *   i000 in Package(){i000} is, on MS, the same as Package(){"i000"}.
227 */
228Method(in14,, Serialized)
229{
230	Name(ts, "in14")
231	Name(i000, 0xabcd0000)
232	Name(i001, 0xabcd0001)
233	Name(i002, 0xabcd0002)
234
235	Name(ii00, 0x11112222)
236
237	Name(p000, Package() {i000, i001, i002, "i000"})
238	Method(m001, 2)
239	{
240		Store(DerefOf(Index(arg0, 0)), Local0)
241		if (LNotEqual(Local0, 0xabcd0000)) {
242			err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0000)
243		}
244		Store(DerefOf(Index(arg0, 1)), Local0)
245		if (LNotEqual(Local0, 0xabcd0001)) {
246			err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
247		}
248		Store(DerefOf(Index(arg0, 2)), Local0)
249		if (LNotEqual(Local0, 0xabcd0002)) {
250			err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0002)
251		}
252		Store(DerefOf(Index(arg0, 3)), Local0)
253		if (LNotEqual(Local0, "i000")) {
254			err(ts, z164, __LINE__, 0, 0, Local0, "i000")
255		}
256
257		Store(ii00, Index(arg0, 0))
258
259		Store(DerefOf(Index(arg0, 0)), Local0)
260		if (LNotEqual(Local0, 0x11112222)) {
261			err(ts, z164, __LINE__, 0, 0, Local0, 0x11112222)
262		}
263	}
264
265	m001(p000, RefOf(p000))
266
267	Store(DerefOf(Index(p000, 0)), Local0)
268	if (LNotEqual(Local0, 0x11112222)) {
269		err(ts, z164, __LINE__, 0, 0, Local0, 0x11112222)
270	}
271
272	Store(DerefOf(Index(p000, 1)), Local0)
273	if (LNotEqual(Local0, 0xabcd0001)) {
274		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0001)
275	}
276
277	Store(DerefOf(Index(p000, 2)), Local0)
278	if (LNotEqual(Local0, 0xabcd0002)) {
279		err(ts, z164, __LINE__, 0, 0, Local0, 0xabcd0002)
280	}
281
282	Store(DerefOf(Index(p000, 3)), Local0)
283	if (LNotEqual(Local0, "i000")) {
284		err(ts, z164, __LINE__, 0, 0, Local0, "i000")
285	}
286}
287
288/*
289 * Package is used directly by Name
290 *
291 * Example to show behaviour of MS for Package(){i000}
292 *
293 * Note:
294 *   Named element of Package is simply not implemented by MS,
295 *   i000 in Package(){i000} is, on MS, the same as Package(){"i000"}.
296 */
297Method(in15,, Serialized)
298{
299	Name(ts, "in15")
300	Name(i000, 0xabcd0000)
301	Name(i001, 0xabcd0001)
302	Name(i002, 0xabcd0002)
303
304	Name(ii00, 0x11112222)
305
306	Name(p000, Package() {i000, i001, i002, "i000"})
307
308	Store(DerefOf(Index(p000, 0)), Local0)
309	OUTP(Local0)
310	Store(DerefOf(Index(p000, 1)), Local0)
311	OUTP(Local0)
312	Store(DerefOf(Index(p000, 2)), Local0)
313	OUTP(Local0)
314	Store(DerefOf(Index(p000, 3)), Local0)
315	OUTP(Local0)
316
317	Store(ii00, Index(p000, 1))
318
319	OUTP("After re-write 1-th element:")
320
321	Store(DerefOf(Index(p000, 0)), Local0)
322	OUTP(Local0)
323	Store(DerefOf(Index(p000, 1)), Local0)
324	OUTP(Local0)
325	Store(DerefOf(Index(p000, 2)), Local0)
326	OUTP(Local0)
327	Store(DerefOf(Index(p000, 3)), Local0)
328	OUTP(Local0)
329}
330
331/*
332 * Buffer
333 */
334
335Method(in16,, Serialized)
336{
337	Name(ts, "in16")
338	Name(b000, Buffer() {0x10, 0x11, 0x12})
339	Method(m001, 2)
340	{
341		// arg0 - b000
342		Store(DerefOf(Index(arg0, 0)), Local0)
343		if (LNotEqual(Local0, 0x10)) {
344			err(ts, z164, __LINE__, 0, 0, Local0, 0x10)
345		}
346
347		Store(0x67, Index(arg0, 0))
348
349		Store(DerefOf(Index(arg0, 0)), Local0)
350		if (LNotEqual(Local0, 0x67)) {
351			err(ts, z164, __LINE__, 0, 0, Local0, 0x67)
352		}
353
354		// arg1 - RefOf(b000)
355
356		Store(DerefOf(arg1), Local7)
357		Store(0x55, Index(Local7, 1))
358
359		Store(DerefOf(Index(Local7, 1)), Local0)
360		if (LNotEqual(Local0, 0x55)) {
361			err(ts, z164, __LINE__, 0, 0, Local0, 0x55)
362		}
363	}
364
365	m001(b000, RefOf(b000))
366
367	Store(DerefOf(Index(b000, 0)), Local0)
368	if (LNotEqual(Local0, 0x67)) {
369		err(ts, z164, __LINE__, 0, 0, Local0, 0x67)
370	}
371
372	Store(DerefOf(Index(b000, 1)), Local0)
373	if (LNotEqual(Local0, 0x11)) {
374		err(ts, z164, __LINE__, 0, 0, Local0, 0x11)
375	}
376
377	Store(DerefOf(Index(b000, 2)), Local0)
378	if (LNotEqual(Local0, 0x12)) {
379		err(ts, z164, __LINE__, 0, 0, Local0, 0x12)
380	}
381}
382
383/*
384 * Element of Package instead of i000 (in in02)
385 *
386 * Recursive call to m001
387 */
388Method(in17,, Serialized)
389{
390	Name(ts, "in17")
391	Name(i001, 0)
392	Name(pp00, Package() {0x11111111, 0x00100000, 0x22223333})
393
394	Method(m001)
395	{
396		/*
397		 * Because of the stack overflow issues on MS the number
398		 * of repetitions was changed from 100 to 11 here.
399		 */
400		if (LLess(i001, 11)) {
401
402			Store(DerefOf(Index(pp00, 1)), Local0)
403			Increment(Local0)
404			Store(Local0, Index(pp00, 1))
405			Increment(i001)
406			Add(DerefOf(Index(pp00, 1)), m001(), Local0)
407			Return (Local0)
408		}
409		Return (0)
410	}
411	Store(Add(DerefOf(Index(pp00, 1)), m001()), Local0)
412
413	if (LNotEqual(Local0, 0x00c00042)) {
414		err(ts, z164, __LINE__, 0, 0, Local0, 0x00c00042)
415	}
416
417	Store(DerefOf(Index(pp00, 1)), Local0)
418
419	if (LNotEqual(Local0, 0x0010000b)) {
420		err(ts, z164, __LINE__, 0, 0, Local0, 0x0010000b)
421	}
422
423	CH03(ts, z164, 0x00c, __LINE__, 0)
424}
425
426/*
427 * Buffer Field instead of i000 (in in01)
428 *
429 * fail
430 *
431 * Note: Buffer Field in expressions is not supported by MS,
432 *       see msfail.asl
433 */
434
435/*
436 * Field instead of i000 (in in01)
437 */
438Method(in18, 1, Serialized)
439{
440	Name(ts, "in18")
441	Name(i001, 0)
442	OperationRegion(r000, SystemMemory, 0x100, 0x100)
443	Field(r000, ByteAcc, NoLock, Preserve) { f000,32, f001,32 }
444
445	CH03(ts, z164, 0x011, __LINE__, 0)
446
447	Store(arg0, i001)
448
449	Method(m001)
450	{
451		Method(m002)
452		{
453			Method(m003)
454			{
455				Method(m004)
456				{
457					Method(m005)
458					{
459						Method(m006)
460						{
461							Method(m007)
462							{
463								Method(m008)
464								{
465									if (i001)
466									{
467										Store(0x11223344, f001)
468									}
469									Return (0)
470								}
471								Store(0x80000000, f001)
472								Return (Add(f001, m008()))
473							}
474							Store(0x07000000, f001)
475							Return (Add(f001, m007()))
476						}
477						Store(0x00600000, f001)
478						Return (Add(f001, m006()))
479					}
480					Store(0x00050000, f001)
481					Return (Add(f001, m005()))
482				}
483				Store(0x00004000, f001)
484				Return (Add(f001, m004()))
485			}
486			Store(0x00000300, f001)
487			Return (Add(f001, m003()))
488		}
489		Store(0x00000020, f001)
490		Return (Add(f001, m002()))
491	}
492
493	Store(0x00000001, f001)
494
495	Store(Add(f001, m001()), Local0)
496
497	if (LNotEqual(Local0, 0x87654321)) {
498		err(ts, z164, __LINE__, 0, 0, Local0, 0x87654321)
499	}
500
501	if (arg0) {
502		Store(0x11223344, Local1)
503	} else {
504		Store(0x80000000, Local1)
505	}
506
507	if (LNotEqual(f001, Local1)) {
508		err(ts, z164, __LINE__, 0, 0, f001, Local1)
509	}
510
511	CH03(ts, z164, 0x014, __LINE__, 0)
512}
513
514/*
515 * Bank Field instead of i000 (in in01)
516 *
517 * (is this test correct?)
518 */
519Method(in19, 1, Serialized)
520{
521	Name(ts, "in19")
522	Name(i001, 0)
523	OperationRegion(r000, SystemMemory, 0x100, 0x100)
524	Field(r000, ByteAcc, NoLock, Preserve) { f000,32, f001,32 }
525	BankField(r000, f001, 0, ByteAcc, NoLock, Preserve) { bnk0, 32 }
526
527	CH03(ts, z164, 0x015, __LINE__, 0)
528
529	Store(arg0, i001)
530
531	Method(m001)
532	{
533		Method(m002)
534		{
535			Method(m003)
536			{
537				Method(m004)
538				{
539					Method(m005)
540					{
541						Method(m006)
542						{
543							Method(m007)
544							{
545								Method(m008)
546								{
547									if (i001)
548									{
549										Store(0x11223344, bnk0)
550									}
551									Return (0)
552								}
553								Store(0x80000000, bnk0)
554								Return (Add(bnk0, m008()))
555							}
556							Store(0x07000000, bnk0)
557							Return (Add(bnk0, m007()))
558						}
559						Store(0x00600000, bnk0)
560						Return (Add(bnk0, m006()))
561					}
562					Store(0x00050000, bnk0)
563					Return (Add(bnk0, m005()))
564				}
565				Store(0x00004000, bnk0)
566				Return (Add(bnk0, m004()))
567			}
568			Store(0x00000300, bnk0)
569			Return (Add(bnk0, m003()))
570		}
571		Store(0x00000020, bnk0)
572		Return (Add(bnk0, m002()))
573	}
574
575	Store(0x00000001, bnk0)
576
577	Store(Add(bnk0, m001()), Local0)
578
579	if (LNotEqual(Local0, 0x87654321)) {
580		err(ts, z164, __LINE__, 0, 0, Local0, 0x87654321)
581	}
582
583	if (arg0) {
584		Store(0x11223344, Local1)
585	} else {
586		Store(0x80000000, Local1)
587	}
588
589	if (LNotEqual(bnk0, Local1)) {
590		err(ts, z164, __LINE__, 0, 0, bnk0, Local1)
591	}
592
593	CH03(ts, z164, 0x018, __LINE__, 0)
594}
595
596/*
597 * Index Field instead of i000 (in in01)
598 *
599 * (is this test correct?)
600 */
601Method(in1a, 1, Serialized)
602{
603	Name(ts, "in1a")
604	Name(i001, 0)
605	OperationRegion(r000, SystemMemory, 0x100, 0x100)
606	Field(r000, ByteAcc, NoLock, Preserve) { f000,32, f001,32 }
607	IndexField(f000, f001, ByteAcc, NoLock, Preserve) { if00, 32 }
608
609	CH03(ts, z164, 0x019, __LINE__, 0)
610
611	Store(arg0, i001)
612
613	Method(m001)
614	{
615		Method(m002)
616		{
617			Method(m003)
618			{
619				Method(m004)
620				{
621					Method(m005)
622					{
623						Method(m006)
624						{
625							Method(m007)
626							{
627								Method(m008)
628								{
629									if (i001)
630									{
631										Store(0x11223344, if00)
632									}
633									Return (0)
634								}
635								Store(0x80000000, if00)
636								Return (Add(if00, m008()))
637							}
638							Store(0x07000000, if00)
639							Return (Add(if00, m007()))
640						}
641						Store(0x00600000, if00)
642						Return (Add(if00, m006()))
643					}
644					Store(0x00050000, if00)
645					Return (Add(if00, m005()))
646				}
647				Store(0x00004000, if00)
648				Return (Add(if00, m004()))
649			}
650			Store(0x00000300, if00)
651			Return (Add(if00, m003()))
652		}
653		Store(0x00000020, if00)
654		Return (Add(if00, m002()))
655	}
656
657	Store(0x00000001, if00)
658
659	Store(Add(if00, m001()), Local0)
660
661	/*
662	 * The benchmark values for arg0==0 below
663	 * are how MS actually works.
664	 */
665
666	if (LNotEqual(Local0, 0x87878787)) {
667		err(ts, z164, __LINE__, 0, 0, Local0, 0x87878787)
668	}
669
670	if (arg0) {
671		Store(0x11223344, Local1)
672	} else {
673		Store(0x80808080, Local1)
674	}
675
676	if (LNotEqual(if00, Local1)) {
677		err(ts, z164, __LINE__, 0, 0, if00, Local1)
678	}
679
680	CH03(ts, z164, 0x01c, __LINE__, 0)
681}
682
683/*
684 * Element of Buffer instead of i000 (in in01)
685 */
686Method(in1b, 1, Serialized)
687{
688	Name(ts, "in1b")
689	Name(i001, 0)
690	Name(b000, Buffer() {0x11, 0x01, 0x22})
691
692	CH03(ts, z164, 0x01d, __LINE__, 0)
693
694	Store(arg0, i001)
695
696	Method(m001)
697	{
698		Method(m002)
699		{
700			Method(m003)
701			{
702				Method(m004)
703				{
704					Method(m005)
705					{
706						Method(m006)
707						{
708							Method(m007)
709							{
710								Return (0)
711							}
712							Store(0x07, Index(b000, 1))
713							Return (Add(DerefOf(Index(b000, 1)), m007()))
714						}
715						Store(0x06, Index(b000, 1))
716						Return (Add(DerefOf(Index(b000, 1)), m006()))
717					}
718					Store(0x05, Index(b000, 1))
719					Return (Add(DerefOf(Index(b000, 1)), m005()))
720				}
721				Store(0x04, Index(b000, 1))
722				Return (Add(DerefOf(Index(b000, 1)), m004()))
723			}
724			Store(0x03, Index(b000, 1))
725			Return (Add(DerefOf(Index(b000, 1)), m003()))
726		}
727		Store(0x02, Index(b000, 1))
728		Return (Add(DerefOf(Index(b000, 1)), m002()))
729	}
730	Store(Add(DerefOf(Index(b000, 1)), m001()), Local0)
731
732	if (LNotEqual(Local0, 0x1c)) {
733		err(ts, z164, __LINE__, 0, 0, Local0, 0x1c)
734	}
735
736	Store(DerefOf(Index(b000, 1)), Local0)
737
738	if (arg0) {
739		Store(0xff, Local1)
740	} else {
741		Store(0x07, Local1)
742	}
743
744	if (LNotEqual(Local0, Local1)) {
745		err(ts, z164, __LINE__, 0, 0, Local0, Local1)
746	}
747
748	CH03(ts, z164, 0x020, __LINE__, 0)
749}
750
751/*
752 * Element of Buffer instead of i000 (in in01)
753 *
754 * in1b+:
755 *   added argument to methods and b000 passed without any use of that
756 *   parameter inside the methods
757 */
758Method(in1c, 1, Serialized)
759{
760	Name(ts, "in1c")
761	Name(i001, 0)
762	Name(b000, Buffer() {0x11, 0x01, 0x22})
763
764	CH03(ts, z164, 0x01d, __LINE__, 0)
765
766	Store(arg0, i001)
767
768	Method(m000, 1)
769	{
770
771	Method(m001, 1)
772	{
773		Method(m002, 1)
774		{
775			Method(m003, 1)
776			{
777				Method(m004, 1)
778				{
779					Method(m005, 1)
780					{
781						Method(m006, 1)
782						{
783							Method(m007, 1)
784							{
785								Return (0)
786							}
787							Store(0x07, Index(b000, 1))
788							Return (Add(DerefOf(Index(b000, 1)), m007(b000)))
789						}
790						Store(0x06, Index(b000, 1))
791						Return (Add(DerefOf(Index(b000, 1)), m006(b000)))
792					}
793					Store(0x05, Index(b000, 1))
794					Return (Add(DerefOf(Index(b000, 1)), m005(b000)))
795				}
796				Store(0x04, Index(b000, 1))
797				Return (Add(DerefOf(Index(b000, 1)), m004(b000)))
798			}
799			Store(0x03, Index(b000, 1))
800			Return (Add(DerefOf(Index(b000, 1)), m003(b000)))
801		}
802		Store(0x02, Index(b000, 1))
803		Return (Add(DerefOf(Index(b000, 1)), m002(b000)))
804	}
805	Store(Add(DerefOf(Index(b000, 1)), m001(b000)), Local0)
806	Return (Local0)
807	}
808
809	CH03(ts, z164, 0x000, __LINE__, 0)
810
811	Store(m000(b000), Local0)
812
813	if (LNotEqual(Local0, 0x1c)) {
814		err(ts, z164, __LINE__, 0, 0, Local0, 0x1c)
815	}
816
817	Store(DerefOf(Index(b000, 1)), Local0)
818
819	if (arg0) {
820		Store(0xff, Local1)
821	} else {
822		Store(0x07, Local1)
823	}
824
825	if (LNotEqual(Local0, Local1)) {
826		err(ts, z164, __LINE__, 0, 0, Local0, Local1)
827	}
828
829	CH03(ts, z164, 0x020, __LINE__, 0)
830}
831
832
833/*
834 * Element of Package instead of i000 (in in01)
835 */
836Method(in1d,, Serialized)
837{
838	Name(ts, "in1d")
839	Name(i001, 0)
840	Name(p000, Package() {1,2,3,4})
841	Name(pp00, Package() {0x11111111, 0x00000001, 0x22223333})
842
843	CH03(ts, z164, 0x006, __LINE__, 0)
844
845	Method(m001)
846	{
847		Method(m002)
848		{
849			Method(m003)
850			{
851				Method(m004)
852				{
853					Method(m005)
854					{
855						Method(m006)
856						{
857							Method(m007)
858							{
859								Return (0)
860							}
861							Store(0x07000000, Index(pp00, 1))
862							Return (Add(DerefOf(Index(pp00, 1)), m007()))
863						}
864						Store(0x00600000, Index(pp00, 1))
865						Return (Add(DerefOf(Index(pp00, 1)), m006()))
866					}
867					Store(0x00050000, Index(pp00, 1))
868					Return (Add(DerefOf(Index(pp00, 1)), m005()))
869				}
870				Store(0x00004000, Index(pp00, 1))
871				Return (Add(DerefOf(Index(pp00, 1)), m004()))
872			}
873			Store(0x00000300, Index(pp00, 1))
874			Return (Add(DerefOf(Index(pp00, 1)), m003()))
875		}
876		Store(0x00000020, Index(pp00, 1))
877		Return (Add(DerefOf(Index(pp00, 1)), m002()))
878	}
879	Store(Add(DerefOf(Index(pp00, 1)), m001()), Local0)
880
881	if (LNotEqual(Local0, 0x07654321)) {
882		err(ts, z164, __LINE__, 0, 0, Local0, 0x07654321)
883	}
884
885	Store(DerefOf(Index(pp00, 1)), Local0)
886
887	if (LNotEqual(Local0, 0x07000000)) {
888		err(ts, z164, __LINE__, 0, 0, Local0, 0x07000000)
889	}
890
891	CH03(ts, z164, 0x009, __LINE__, 0)
892}
893
894/*
895 * Element of Package instead of i000 (in in01)
896 *
897 * in1d+:
898 *   added argument to methods and b000 passed without any use of that
899 *   parameter inside the methods
900 */
901Method(in1e,, Serialized)
902{
903	Name(ts, "in1e")
904	Name(i001, 0)
905	Name(p000, Package() {1,2,3,4})
906	Name(pp00, Package() {0x11111111, 0x00000001, 0x22223333})
907
908	CH03(ts, z164, 0x006, __LINE__, 0)
909
910	Method(m000, 1)
911	{
912
913	Method(m001, 1)
914	{
915		Method(m002, 1)
916		{
917			Method(m003, 1)
918			{
919				Method(m004, 1)
920				{
921					Method(m005, 1)
922					{
923						Method(m006, 1)
924						{
925							Method(m007, 1)
926							{
927								Return (0)
928							}
929							Store(0x07000000, Index(pp00, 1))
930							Return (Add(DerefOf(Index(pp00, 1)), m007(pp00)))
931						}
932						Store(0x00600000, Index(pp00, 1))
933						Return (Add(DerefOf(Index(pp00, 1)), m006(pp00)))
934					}
935					Store(0x00050000, Index(pp00, 1))
936					Return (Add(DerefOf(Index(pp00, 1)), m005(pp00)))
937				}
938				Store(0x00004000, Index(pp00, 1))
939				Return (Add(DerefOf(Index(pp00, 1)), m004(pp00)))
940			}
941			Store(0x00000300, Index(pp00, 1))
942			Return (Add(DerefOf(Index(pp00, 1)), m003(pp00)))
943		}
944		Store(0x00000020, Index(pp00, 1))
945		Return (Add(DerefOf(Index(pp00, 1)), m002(pp00)))
946	}
947	Store(Add(DerefOf(Index(pp00, 1)), m001(pp00)), Local0)
948	Return (Local0)
949	}
950
951	CH03(ts, z164, 0x000, __LINE__, 0)
952
953	Store(m000(pp00), Local0)
954
955	if (LNotEqual(Local0, 0x07654321)) {
956		err(ts, z164, __LINE__, 0, 0, Local0, 0x07654321)
957	}
958
959	Store(DerefOf(Index(pp00, 1)), Local0)
960
961	if (LNotEqual(Local0, 0x07000000)) {
962		err(ts, z164, __LINE__, 0, 0, Local0, 0x07000000)
963	}
964
965	CH03(ts, z164, 0x009, __LINE__, 0)
966}
967
968Method(ini1)
969{
970	SRMT("in10")
971	in10()
972	SRMT("in11")
973	in11()
974	SRMT("in12")
975	in12()
976	SRMT("in13")
977	in13()
978	SRMT("in14")
979	if (chk0) {
980		in14()
981	} else {
982		BLCK()
983	}
984	SRMT("in15")
985	if (chk0) {
986		in15()
987	} else {
988		BLCK()
989	}
990	SRMT("in16")
991	in16()
992	SRMT("in17")
993	in17()
994	SRMT("in18-0")
995	in18(0)
996	SRMT("in19-0")
997	in19(0)
998	SRMT("in1a-0")
999	in1a(0)
1000	SRMT("in1b-0")
1001	in1b(0)
1002	SRMT("in1c-0")
1003	if (y275) {
1004		in1c(0)
1005	} else {
1006		BLCK()
1007	}
1008	SRMT("in1d")
1009	in1d()
1010	SRMT("in1e")
1011	if (LAnd(fix0, y275)) {
1012		in1e()
1013	} else {
1014		BLCK()
1015	}
1016
1017	CH03("ini1", z164, 0x000, __LINE__, 0)
1018}
1019