1/*
2 * Some or all of this work - Copyright (c) 2006 - 2016, 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 * The tests which require utilyzing of
31 * the -f option on the ASL compilation
32 * stage.
33 *
34 * (ASL-incorrect tests compiled with -f option of ASL)
35 *
36 * ASL Compiler:
37 *
38 *   -f  -  Ignore errors, force creation of AML output file(s)
39 */
40
41Name(z146, 146)
42
43/*
44 *         Name(n000, 0)
45 * Error 1034 - ^ Name already exists in scope (N000)
46 */
47Method(m101,, Serialized)
48{
49	Name(ts, "m101")
50
51	Name (VV, 0x1234)
52	Store (32, Local0)
53
54	CH03(ts, z146, 0, 0, 0)
55
56	Name (VV, 0xBBBBAAAA)
57	Store (12, Local2)
58
59	CH04(ts, 0, 0xff, z146, 1, 0, 0)
60}
61
62/*
63 * The test is intended to check that interpreter issue an
64 * exception when detects that the actual number of elements
65 * in Package is greater than the value of NumElements. But,
66 * ACPICA ASL Compiler run with -f option replaces the specified
67 * value of NumElements by the actual number of elements in
68 * PackageList. So - no exceptions. We cant specify the ASL
69 * test - because we cant obtain AML code of Package with the
70 * actual number of elements in it greater than the value of
71 * NumElements.
72 *
73 * So, the test is inefficient.
74 *
75 * Name (p000, Package(3) {0xabcd0000, 0xabcd0001, 0xabcd0002, 0xabcd0003})
76 * Error 4046 - Initializer list too long ^
77 */
78Method(m102,, Serialized)
79{
80	Name(ts, "m102")
81
82	Name (p000, Package(3) {0xabcd0000, 0xabcd0001, 0xabcd0002, 0xabcd0003})
83
84	CH03(ts, z146, 2, 0, 0)
85	Store(DerefOf(Index(p000, 3)), Local0)
86	CH03(ts, z146, 2, 0, 0)
87}
88
89/*
90 * Exception on Acquire.
91 * Access to inappropriate type data.
92 */
93Method(m103,, Serialized)
94{
95	Name(ts, "m103")
96	Name(i900, 0xfe7cb391d65a0000)
97	Name(s900, "12340002")
98	Name(b900, Buffer() {0xb0,0xb1,0xb2,0xb3,0xb4})
99	Name(b9Z0, Buffer() {0xb0,0xb1,0xb2,0xb3,0xb4})
100	Name(p900, Package(1) {})
101
102	Event(e900)
103	Mutex(mx90, 0)
104	Device(d900) { Name(i900, 0xabcd0017) }
105	ThermalZone(tz90) {}
106	Processor(pr90, 0, 0xFFFFFFFF, 0) {}
107	PowerResource(pw90, 1, 0) {Method(mmmm){return (0)}}
108	OperationRegion(r900, SystemMemory, 0x100, 0x100)
109	OperationRegion(r9Z0, SystemMemory, 0x100, 0x100)
110
111	CreateField(b9Z0, 0, 8, bf90)
112	Field(r9Z0, ByteAcc, NoLock, Preserve) {f900,8,f901,8,f902,8,f903,8}
113	BankField(r9Z0, f901, 0, ByteAcc, NoLock, Preserve) {bn90,4}
114	IndexField(f902, f903, ByteAcc, NoLock, Preserve) {if90,8,if91,8}
115
116	/* Acquire */
117
118	CH03(ts, z146, 0, 0, 0)
119	Acquire(i900, 0xffff)
120	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
121
122	CH03(ts, z146, 0, 0, 0)
123	Acquire(s900, 0xffff)
124	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
125
126	CH03(ts, z146, 0, 0, 0)
127	Acquire(b900, 0xffff)
128	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
129
130	CH03(ts, z146, 0, 0, 0)
131	Acquire(p900, 0xffff)
132	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
133
134	CH03(ts, z146, 0, 0, 0)
135	Acquire(e900, 0xffff)
136	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
137
138	CH03(ts, z146, 0, 0, 0)
139	Acquire(d900, 0xffff)
140	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
141
142	CH03(ts, z146, 0, 0, 0)
143	Acquire(tz90, 0xffff)
144	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
145
146	CH03(ts, z146, 0, 0, 0)
147	Acquire(pr90, 0xffff)
148	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
149
150	CH03(ts, z146, 0, 0, 0)
151	Acquire(pw90, 0xffff)
152	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
153
154	CH03(ts, z146, 0, 0, 0)
155	Acquire(r900, 0xffff)
156	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
157
158	CH03(ts, z146, 0, 0, 0)
159	Acquire(bf90, 0xffff)
160	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
161
162	CH03(ts, z146, 0, 0, 0)
163	Acquire(f900, 0xffff)
164	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
165
166	CH03(ts, z146, 0, 0, 0)
167	Acquire(bn90, 0xffff)
168	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
169
170	CH03(ts, z146, 0, 0, 0)
171	Acquire(if90, 0xffff)
172	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
173
174
175	/* Release */
176
177	CH03(ts, z146, 0, 0, 0)
178	Release(i900)
179	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
180
181	CH03(ts, z146, 0, 0, 0)
182	Release(s900)
183	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
184
185	CH03(ts, z146, 0, 0, 0)
186	Release(b900)
187	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
188
189	CH03(ts, z146, 0, 0, 0)
190	Release(p900)
191	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
192
193	CH03(ts, z146, 0, 0, 0)
194	Release(e900)
195	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
196
197	CH03(ts, z146, 0, 0, 0)
198	Release(d900)
199	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
200
201	CH03(ts, z146, 0, 0, 0)
202	Release(tz90)
203	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
204
205	CH03(ts, z146, 0, 0, 0)
206	Release(pr90)
207	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
208
209	CH03(ts, z146, 0, 0, 0)
210	Release(pw90)
211	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
212
213	CH03(ts, z146, 0, 0, 0)
214	Release(r900)
215	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
216
217	CH03(ts, z146, 0, 0, 0)
218	Release(bf90)
219	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
220
221	CH03(ts, z146, 0, 0, 0)
222	Release(f900)
223	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
224
225	CH03(ts, z146, 0, 0, 0)
226	Release(bn90)
227	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
228
229	CH03(ts, z146, 0, 0, 0)
230	Release(if90)
231	CH04(ts, 0, 0xff, z146, 0x025, 0, 0)
232}
233
234// Run-method
235Method(m100)
236{
237	SRMT("m101")
238	m101()
239
240	SRMT("m102")
241	m102()
242
243	SRMT("m103")
244	m103()
245}
246
247