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
29DefinitionBlock(
30	"B251.aml", // Output filename
31	"DSDT",     // Signature
32	0x02,       // DSDT Revision
33	"Intel",    // OEMID
34	"Many",     // TABLE ID
35	0x00000001  // OEM Revision
36	) {
37
38	// All declarations
39	Include("../../../../../runtime/cntl/common.asl")
40	Include("../../../../../runtime/cntl/mt_runpoint.asl")
41	Include("../../../../../runtime/cntl/runmode.asl")
42	Include("../../../../../runtime/cntl/ehandle.asl")
43
44	Name(num, 10) // repetition of While number
45
46	Method(m02b)
47	{
48		Store("================ Test m02b started", Debug)
49		Store(num, Local0)
50		While (Local0) {
51			Concatenate("Iteration ", Local0, Debug)
52			Store(0, Local3)
53			Switch (Local3) {
54				Case (0) {
55					Store("Case (0)", Debug)
56				}
57			}
58			Sleep(100)
59			Decrement(Local0)
60		}
61		Store("================ Test m02b completed", Debug)
62	}
63
64	/* The same as m02b but without While */
65	Method(m02c)
66	{
67		Store("================ Test m02c started", Debug)
68		Store(num, Local0)
69		// While (Local0) {
70			Concatenate("Iteration ", Local0, Debug)
71			Store(0, Local3)
72			Switch (Local3) {
73				Case (0) {
74					Store("Case (0)", Debug)
75				}
76			}
77			Sleep(100)
78			Decrement(Local0)
79		// }
80		Store("================ Test m02c completed", Debug)
81	}
82
83	/*
84	 * Note: advanced for mt-tests -
85	 *	in case of Threads command
86	 *	the arguments passed to method are:
87	 *
88	 * arg0 - total number of threads created by Threads command
89	 * arg1 - ID of the current thread
90	 * arg2 - index of the current thread (0, 1, 2 ... )
91	 */
92	Method(MAIN, 3) {
93
94		// Initialization
95		STRT(0)
96
97		// Run verification methods
98
99		CH03("", 0, 0x000, __LINE__, 0)
100
101		if (LEqual(arg1, "AML Debugger")) {
102			Store("========== args of Execute command of AcpiExec:", Debug)
103			Store(arg0, Debug)
104			Store(arg1, Debug)
105			Store("==========.", Debug)
106		} else {
107			Store("========== args of Threads command of AcpiExec:", Debug)
108			Store(arg0, Debug)
109			Store(arg1, Debug)
110			Store(arg2, Debug)
111			Store("==========.", Debug)
112
113			if (1) {
114				m02b()
115			} else {
116				m02c()
117			}
118		}
119
120		CH03("", 0, 0x001, __LINE__, 0)
121
122		// Final actions
123		Store(FNSH(), Local7)
124
125		return (Local7)
126	}
127}
128