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// Miscellaneous named object creation
30
31
32// Packages
33
34// Effective AML package length is zero
35Method(m900)
36{
37	Name(p000, Package() {})
38}
39
40// Effective AML package length is zero
41Method(m901)
42{
43	Name(p000, Package(0) {})
44}
45
46// Effective AML package length is zero
47Method(m902)
48{
49	Name(p000, Package(0) {0,1,2,3})
50}
51
52// Size exceeds 255 (It is an error for NumElements to exceed 255)
53Method(m903)
54{
55	Name(p000, Package(256) {0,1,2,3,4,5,6,7,8,9})
56}
57
58// It is an error for NumElements to be less than the number
59// of elements in the PackageList.
60//
61// Apparently, it will be updated:
62//
63// From: Moore, Robert
64// Sent: Saturday, February 12, 2005 3:44 AM
65// To: Therien, Guy; Hanumant Yadav; Tim Lewis
66// Cc: Podrezov, Valery A; Suietov, Fiodor F
67// Subject: ACPI errata for Package (2)
68//
69// "The Moscow validation team asked about this discrepancy"
70// "Why is there a difference in behavior between BuffSize
71// and NumElements? Aren�t they essentially the same thing?
72// I would propose that we update Package to behave the same
73// as Buffer. Bob"
74Method(m904)
75{
76	Name(p000, Package(3) {0,1,2,3,4,5,6,7,8,9})
77}
78
79// NumElements > 255
80Method(m905)
81{
82	Name(p000, Package() {
83			// 0
84			0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
85			10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
86			20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
87			30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
88			40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
89			50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
90			60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
91			70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
92			80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
93			90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
94
95			// 100
96			100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
97			110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
98			120, 121, 122, 123, 124, 125, 126, 127, 128, 129,
99			130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
100			140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
101			150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
102			160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
103			170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
104			180, 181, 182, 183, 184, 185, 186, 187, 188, 189,
105			190, 191, 192, 193, 194, 195, 196, 197, 198, 199,
106
107			// 200
108			200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
109			210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
110			220, 221, 222, 223, 224, 225, 226, 227, 228, 229,
111			230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
112			240, 241, 242, 243, 244, 245, 246, 247, 248, 249,
113			250, 251, 252, 253, 254,
114
115			// 255
116			255
117			})
118}
119
120// ArgX
121
122Method(m906)
123{
124	return (0)
125}
126
127Method(m907, 1)
128{
129	return (0)
130}
131
132Method(m908, 2)
133{
134	return (0)
135}
136
137Method(m909, 3)
138{
139	return (0)
140}
141
142Method(m90a, 4)
143{
144	return (0)
145}
146
147Method(m90b, 5)
148{
149	return (0)
150}
151
152Method(m90c, 6)
153{
154	return (0)
155}
156
157Method(m90d, 7)
158{
159	return (0)
160}
161
162// Extra param
163Method(m90e, 8)
164{
165	return (0)
166}
167
168Method(m90f, 7)
169{
170	m906(0)
171	m907(0,0)
172	m908(0,0,0)
173	m909(0,0,0,0)
174	m90a(0,0,0,0,0)
175	m90b(0,0,0,0,0,0)
176	m90c(0,0,0,0,0,0,0)
177	m90d(0,0,0,0,0,0,0,0)
178	m90e(0,0,0,0,0,0,0,0)
179
180	return (0)
181}
182
183Method(m910)
184{
185	Store(Arg0, Debug)
186	Store(Arg1, Debug)
187	Store(Arg2, Debug)
188	Store(Arg3, Debug)
189	Store(Arg4, Debug)
190	Store(Arg5, Debug)
191	Store(Arg6, Debug)
192	// Extra
193	Store(Arg7, Debug)
194
195	return (0)
196}
197
198Method(m911, 1)
199{
200	return (Arg1)
201}
202
203Method(m912, 2)
204{
205	return (Arg2)
206}
207
208Method(m913, 3)
209{
210	return (Arg3)
211}
212
213Method(m914, 4)
214{
215	return (Arg4)
216}
217
218Method(m915, 5)
219{
220	return (Arg5)
221}
222
223Method(m916, 6)
224{
225	return (Arg6)
226}
227
228Method(m917, 7)
229{
230	return (Arg7)
231}
232
233Method(m918)
234{
235	Name(db00, Debug)
236}
237
238
239// Data of not Namestring type in the MethodName position
240Method("m919") {Return ("m919")}
241
242// Too many arguments in Method declaration
243Method(m91a, , , , , , ) {Return ("m91a")}
244
245// NumArgs is outside of valid range 0x0-0x7
246Method(m91b, 8) {Return ("m91b")}
247
248// NumArgs as other than Type3Opcode (integer) expression
249Method(m91c, Arg0) {Return ("m91c")}
250Method(m91d, i000) {Return ("m91d")}
251Method(m91e, Derefof(Index(Package(1){2}, 0))) {Return ("m91e")}
252Method(m91f, Local0) {Return ("m91f")}
253
254// NumArgs as Type3Opcode (integer) non-constant expression
255Name(i920, 1)
256Method(m920, Add(i920, 1)) {Return ("m920")}
257Method(m921, Increment(i920)) {Return ("m921")}
258
259// SerializeRule is not the keywords 'NotSerialized' and 'Serialized'
260Method(m922, 7, 1, 0) {Return ("m922")}
261
262//  SyncLevel specified when SerializeRule is not specified
263Method(m923, , , 0) {Return ("m923")}
264	
265//  SyncLevel specified when SerializeRule is set up to NotSerialized
266Method(m924, , NotSerialized, 0) {Return ("m924")}
267
268// SyncLevel is outside of valid range 0x0-0xf
269Method(m925, , Serialized, 16) {Return ("m925")}
270
271// Both NumArgs and SyncLevel are outside of valid ranges
272Method(m926, 8, Serialized, 16) {Return ("m926")}
273
274// SyncLevel as other than Type3Opcode (integer) expression
275Method(m927, , Serialized, Arg0, StrObj) {Return ("m927")}
276Method(m928, , Serialized, i000, StrObj) {Return ("m928")}
277Method(m929, , Serialized, Derefof(Index(Package(1){2}, 0)), StrObj) {Return ("m929")}
278Method(m92a, , Serialized, Local0, StrObj) {Return ("m92a")}
279
280// SyncLevel as Type3Opcode (integer) non-constant expression
281Method(m92b, , Serialized, Add(i000, 1), StrObj) {Return ("m92b")}
282Method(m92c, , Serialized, Increment(i000), StrObj) {Return ("m92c")}
283
284// ReturnType is not an ObjectTypeKeywords package
285Method(m92d, , , , 2) {Return ("m92d")}
286Method(m92e, , , , {1, 2}) {Return ("m92e")}
287
288// Actual Object specified to be returned is not of ReturnType type
289Method(m92f, , , , PkgObj) {Return ("m92f")}
290
291// At least one control path in the method returns no any actual Object
292Method(m930, 1, , , StrObj) {if (Arg0) Return ("m930")}
293
294// ParameterTypes is not an ObjectTypeKeywords package
295Method(m931, 1, , , , 2) {Return ("m931")}
296Method(m932, 2, , , , {1, StrObj}) {Return ("m932")}
297Method(m933, 2, , , , {{StrObj, 1}, StrObj}) {Return ("m933")}
298
299// Some different from UnknownObj ObjectType Keyword specified in the
300// ReturnType position but no any actual Object specified to be returned.
301Method(m934, , , , IntObj) {Store(1, Debug)}
302
303// The same specific keyword in the ReturnType list twice
304Method(m935, , , , {IntObj, IntObj}) {Store(1, Debug)}
305Method(m936, , , , {UnknownObj, UnknownObj}) {Store(1, Debug)}
306
307// Simulteneously UnknownObj and a specific keyword in the ReturnType list
308Method(m937, , , , {UnknownObj, IntObj}) {Store(1, Debug)}
309
310// NumArgs 0 but non-empty list of parameters
311Method(m938, 0, , , , IntObj) {Return ("m938")}
312Method(m939, 0, , , , {IntObj}) {Return ("m939")}
313Method(m93a, , , , , {IntObj}) {Return ("m93a")}
314
315// NumArgs 1 but 2-element list of parameters
316Method(m93b, 1, , , , {IntObj, IntObj}) {Return ("m93b")}
317
318// NumArgs 2 but 1-element list of parameters
319Method(m93c, 2, , , , {IntObj}) {Return ("m93c")}
320
321// NumArgs 6 but 5-element list of parameters
322Method(m93d, 6, , , , {IntObj, IntObj, IntObj, IntObj,
323	IntObj}) {Return ("m93d")}
324
325// NumArgs 6 but 7-element list of parameters
326Method(m93e, 7, , , , {IntObj, IntObj, IntObj, IntObj,
327	IntObj, IntObj, IntObj}) {Return ("m93e")}
328
329// NumArgs 7 but 8-element list of parameters
330Method(m93f, 7, , , , {IntObj, IntObj, IntObj, IntObj,
331	IntObj, IntObj, IntObj, IntObj}) {Return ("m93f")}
332
333// The same specific keyword in the ParameterType list twice
334Method(m940, , , , , {{IntObj, IntObj}}) {Store(1, Debug)}
335Method(m941, , , , , {{UnknownObj, UnknownObj}}) {Store(1, Debug)}
336
337// Simulteneously UnknownObj and a specific keyword in the ParameterType list
338Method(m942, , , , , {{UnknownObj, IntObj}}) {Store(1, Debug)}
339
340// An actual Object specified to be a respective argument
341// of the Method is of inappropriate type
342Method(m943, 1, , , , IntObj) {Store(Arg0, Debug)}
343Method(m944) {m943(Package(2){255, 257})}
344
345
346// Too many arguments in Function declaration
347Function(m945, , , ) {Return ("m945")}
348
349// There is at least one control path in the Function
350// that returns no any actual Object:
351Function(m946, IntObj) {
352	Store(2, Local0)
353	if (Local0) {
354		Return ("m946")
355	} else {
356		Store(1, Debug)
357	}
358}
359
360// Some different from UnknownObj ObjectType Keyword specified in the
361// ReturnType position but no any actual Object specified to be returned.
362Function(m947, IntObj) {Store(1, Debug)}
363
364// The same specific keyword in the ReturnType list twice
365Function(m948, {IntObj, IntObj}) {Store(1, Debug)}
366Function(m949, {UnknownObj, UnknownObj}) {Store(1, Debug)}
367
368// Simulteneously UnknownObj and a specific keyword in the ReturnType list
369Function(m94a, {UnknownObj, IntObj}) {Store(1, Debug)}
370
371// 8-element list of parameters
372Function(m94b, 7, {IntObj, IntObj, IntObj, IntObj,
373		IntObj, IntObj, IntObj, IntObj}) {Return ("m94b")}
374