• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/acpica/tests/aslts/src/runtime/collections/functional/name/
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 * Miscellaneous named object creation
31 */
32
33Name(z134, 134)
34
35/*
36 * This sub-test is intended to comprehensively verify
37 * the Function declaration syntax implementation.
38 *
39 * Declare the Function Control Method Objects of different,
40 * signature check that properly specified or default arguments
41 * values provide required functionality.
42 *
43 * The overall functionality of the Function Objects is indirectly
44 * verified by other tests as far as "Functions are equivalent to a
45 * Method that specifies NotSerialized".
46 *
47 *    17.5.49    Function (Declare Control Method)
48 *    Syntax
49 * Function (FunctionName, ReturnType, ParameterTypes) {TermList}
50 *
51 *    Validated Assertions:
52 *
53 * - Function declaration creates an Object in the ACPI
54 *   namespace which can be referred by the specified FunctionName
55 *   either to initiate its invocation or to obtain its AML Object
56 *   type. Also FunctionName can be used to save a copy of the Object
57 *   or a reference to it in another AML Object.
58 *
59 * - ASL compiler should allow only a Namestring data type in the
60 *   FunctionName position.
61 *
62 * - ASL compiler should allow only an ObjectTypeKeyword or
63 *   a comma-separated ObjectTypeKeywords enclosed with curly
64 *   brackets (OTK package) in the ReturnType position. ReturnType
65 *   is optional argument. If no ReturnType is specified, ReturnType
66 *   UnknownObj is assumed.
67 *   ObjectTypeKeyword := UnknownObj | IntObj | StrObj | BuffObj |
68 *                        PkgObj | FieldUnitObj | DeviceObj | EventObj |
69 *                        MethodObj | MutexObj | OpRegionObj | PowerResObj |
70 *                        ThermalZoneObj | BuffFieldObj | DDBHandleObj
71 *
72 * - ASL compiler should report an error when an actual Object specified
73 *   to be returned is of inappropriate type.
74 *
75 * - ASL compiler should report an error when there is at least one
76 *   control path in the method that returns no any actual Object.
77 *
78 * - ASL compiler should report an error when some different from
79 *   UnknownObj ObjectType Keyword specified in the ReturnType position
80 *   but no any actual Object specified to be returned.
81 *
82 * - ASL compiler should allow only an OTK package or a package
83 *   containing OTK packages along with ObjectTypeKeywords in the
84 *   ParameterTypes position.
85 *
86 * - ASL compiler should report an error when ParameterTypes is specified
87 *   and the number of members in the ParameterTypes package exceeds 7.
88 *
89 * - If ParameterTypes is not specified, then the number of parameters
90 *   is Zero.
91 *
92 * - ASL compiler should report an error when an actual Object
93 *   specified to be a respective argument of the Method is of
94 *   inappropriate type.
95 *
96 * - System software should execute a Function control method
97 *   by referencing the objects in the Function body in order.
98 *
99 * - Function opens a name scope. All namespace references that occur
100 *   during the method execution are relative to the Function package
101 *   location.
102 *
103 * - All namespace objects created by a Function should be destroyed
104 *   when Function execution exits.
105 *
106 */
107
108Scope(\_SB){
109	Function(m20d){}
110}
111
112Method(m20e,, Serialized)
113{
114	Name(ts, "m20e")
115
116	Method(m316)
117	{
118		Function(mm00) {Return ("\\m20e.m316.mm00")}
119		Method(\_SB.m20d.mm00) {Return ("\\_SB.m20d.mm00")}
120	
121		m205(ts, 1, ObjectType(mm00), 8)
122		m205(ts, 2, mm00(), "\\m20e.m316.mm00")
123
124		m205(ts, 3, ObjectType(\m20e.m316.mm00), 8)
125		m205(ts, 4, \m20e.m316.mm00(), "\\m20e.m316.mm00")
126
127		m205(ts, 5, ObjectType(^m316.mm00), 8)
128		m205(ts, 6, ^m316.mm00(), "\\m20e.m316.mm00")
129
130		m205(ts, 7, ObjectType(\_SB.m20d.mm00), 8)
131		m205(ts, 8, \_SB.m20d.mm00(), "\\_SB.m20d.mm00")
132	}
133
134	Method(m317)
135	{
136		Function(mm10) {Return ("\\m20e.m317.mm10")}
137		Function(mm20, ) {Return ("\\m20e.m317.mm20")}
138		Function(mm30, , ) {Return ("\\m20e.m317.mm30")}
139
140		m205(ts,  9, ObjectType(mm10), 8)
141		m205(ts, 10, mm10(), "\\m20e.m317.mm10")
142
143		m205(ts, 11, ObjectType(mm20), 8)
144		m205(ts, 12, mm20(), "\\m20e.m317.mm20")
145
146		m205(ts, 13, ObjectType(mm30), 8)
147		if (y157) {
148			m205(ts, 14, mm30(), "\\m20e.m317.mm30")
149		}
150	}
151
152	// Integer
153	Name(INT0, 0xfedcba9876543210)
154
155	// String
156	Name(STR0, "source string")
157
158	// Buffer
159	Name(BUF0, Buffer(9){9,8,7,6,5,4,3,2,1})
160
161	// Initializer of Fields
162	Name(BUF2, Buffer(9){0x95,0x85,0x75,0x65,0x55,0x45,0x35,0x25,0x15})
163
164	// Base of Buffer Fields
165	Name(BUFZ, Buffer(48){})
166
167	// Package
168	Name(PAC0, Package(3) {
169		0xfedcba987654321f,
170		"test package",
171		Buffer(9){19,18,17,16,15,14,13,12,11},
172	})
173
174	// Operation Region
175	OperationRegion(OPR0, SystemMemory, 0, 48)
176
177	// Field Unit
178	Field(OPR0, ByteAcc, NoLock, Preserve) {
179		FLU0, 69,
180		FLU2, 64,
181		FLU4, 32,
182	}
183
184	// Device
185	Device(DEV0) {Name(s000, "DEV0")}
186
187	// Event
188	Event(EVE0)
189
190	// Method
191	Function(mmM0) {Return ("ff0X")}
192
193	// Mutex
194	Mutex(MTX0, 0)
195
196	// Power Resource
197	PowerResource(PWR0, 0, 0) {Name(s000, "PWR0")}
198
199	// Processor
200	Processor(CPU0, 0x0, 0xFFFFFFFF, 0x0) {Name(s000, "CPU0")}
201
202	// Thermal Zone
203	ThermalZone(TZN0) {Name(s000, "TZN0")}
204
205	// Buffer Field
206	Createfield(BUFZ,   0, 69, BFL0)
207	Createfield(BUFZ,  80, 64, BFL2)
208	Createfield(BUFZ, 160, 32, BFL4)
209
210	// DDBHandle
211	Name(DDB0, Ones)
212
213	// Reference
214	Name(ORF0, "ORF0")
215	Name(REF0, Package(1){})
216
217	Method(m318)
218	{
219		Function(mm00, UnknownObj, {IntObj}) {Add(Derefof(arg0), 1, arg0)}
220
221		Function(mm01, IntObj) {Return (INT0)}
222		Function(mm11, StrObj) {Return (INT0)}
223		Function(mm02, StrObj) {Return (STR0)}
224		Function(mm03, BuffObj) {Return (BUF0)}
225		Function(mm04, PkgObj) {Return (PAC0)}
226		Function(mm05, FieldUnitObj) {Return (FLU0)}
227		Function(mm06, DeviceObj) {Return (DEV0)}
228		Function(mm07, EventObj) {Return (EVE0)}
229		Function(mm08, MethodObj) {
230			CopyObject(MMM0, Local0)
231			Return (Local0)
232		}
233		Function(mm09, MutexObj) {Return (MTX0)}
234		Function(mm0a, OpRegionObj) {Return (OPR0)}
235		Function(mm0b, PowerResObj) {Return (PWR0)}
236		Function(mm0c, ProcessorObj) {Return (CPU0)}
237		Function(mm0d, ThermalZoneObj) {Return (TZN0)}
238		Function(mm0e, BuffFieldObj) {Return (BFL0)}
239		Function(mm0f, DDBHandleObj) {Return (DDB0)}
240
241// Formal declaration
242//		Function(mm0g, DebugObj) {Return (Debug)}
243
244		Function(mm0h, IntObj) {Return (Refof(ORF0))}
245
246		Store(0xfedcba9876543210, Local0)
247		m205(ts, 15, ObjectType(mm00), 8)
248/*
249// Bug 148
250		mm00(Refof(Local0))
251		m205(ts, 16, Local0, 0xfedcba9876543211)
252*/
253
254		m205(ts, 17, ObjectType(mm01), 8)
255		m205(ts, 18, mm01(), INT0)
256
257		m205(ts, 19, ObjectType(mm02), 8)
258		m205(ts, 20, mm02(), STR0)
259
260		m205(ts, 21, ObjectType(mm03), 8)
261		m205(ts, 22, mm03(), BUF0)
262
263		m205(ts, 23, ObjectType(mm04), 8)
264		m205(ts, 24, mm04(), PAC0)
265
266		m205(ts, 25, ObjectType(mm05), 8)
267		m205(ts, 26, mm05(), FLU0)
268
269		m205(ts, 27, ObjectType(mm06), 8)
270		m205(ts, 28, mm06(), DEV0)
271
272		m205(ts, 29, ObjectType(mm07), 8)
273		m205(ts, 30, mm07(), EVE0)
274
275		m205(ts, 31, ObjectType(mm08), 8)
276		CopyObject(MMM0, Local0)
277		m205(ts, 32, mm08(), Local0)
278
279		m205(ts, 33, ObjectType(mm09), 8)
280		m205(ts, 34, mm09(), MTX0)
281
282		m205(ts, 35, ObjectType(mm0a), 8)
283		m205(ts, 36, mm0a(), OPR0)
284
285		m205(ts, 37, ObjectType(mm0b), 8)
286		m205(ts, 38, mm0b(), PWR0)
287
288		m205(ts, 39, ObjectType(mm0c), 8)
289		m205(ts, 40, mm0c(), CPU0)
290
291		m205(ts, 41, ObjectType(mm0d), 8)
292		if (y350) {
293			m205(ts, 42, mm0d(), TZN0)
294		}
295
296		m205(ts, 43, ObjectType(mm0e), 8)
297		m205(ts, 44, mm0e(), BFL0)
298
299		m205(ts, 45, ObjectType(mm0f), 8)
300		m205(ts, 46, mm0f(), DDB0)
301
302/*
303		m205(ts, 47, ObjectType(mm0g), 8)
304		m205(ts, 48, mm0g(), Debug)
305*/
306
307		m205(ts, 49, ObjectType(mm0h), 8)
308		m205(ts, 50, DeRefof(mm0h()), ORF0)
309	}
310
311	Method(m319)
312	{
313		Function(mm00, {IntObj, StrObj}) {Return (STR0)}
314		Function(mm01, {IntObj, StrObj, BuffObj, PkgObj,
315								FieldUnitObj, DeviceObj, EventObj, MethodObj,
316								MutexObj, OpRegionObj, PowerResObj, ProcessorObj,
317								ThermalZoneObj, BuffFieldObj, DDBHandleObj})
318			{Return (INT0)}
319
320		m205(ts, 51, ObjectType(mm00), 8)
321		m205(ts, 52, mm00(), STR0)
322
323		m205(ts, 53, ObjectType(mm01), 8)
324		m205(ts, 54, mm01(), INT0)
325	}
326
327	Method(m31a,, Serialized)
328	{
329		Name(Flag, Ones)
330
331		// List of types of the parameters contains the same keyword
332		Function(mm00, , IntObj) {Store(0, Flag)}
333		Function(mm01, , {IntObj}) {Store(1, Flag)}
334		Function(mm02, , {IntObj, IntObj}) {Store(2, Flag)}
335
336		Function(mm03, , {IntObj, IntObj, IntObj}) {Store(3, Flag)}
337		Function(mm04, , {IntObj, IntObj, IntObj, IntObj}) {Store(4, Flag)}
338		Function(mm05, , {IntObj, IntObj, IntObj, IntObj,
339				IntObj}) {Store(5, Flag)}
340		Function(mm06, , {IntObj, IntObj, IntObj, IntObj,
341				IntObj, IntObj}) {Store(6, Flag)}
342		Function(mm07, , {IntObj, IntObj, IntObj, IntObj,
343				IntObj, IntObj, IntObj}) {Store(7, Flag)}
344
345		// List of types of the parameters contains the UnknownObj keyword
346		Function(mm08, , UnknownObj) {Store(8, Flag)}
347		Function(mm09, , {UnknownObj}) {Store(9, Flag)}
348		Function(mm0a, , {UnknownObj, UnknownObj, UnknownObj, UnknownObj,
349				UnknownObj, UnknownObj, UnknownObj}) {Store(10, Flag)}
350
351		// List of types of the parameters contains different keywords
352		Function(mm10, , {IntObj, StrObj}) {Store(16, Flag)}
353		Function(mm11, , {IntObj, BuffObj}) {Store(17, Flag)}
354		Function(mm12, , {StrObj, BuffObj}) {Store(18, Flag)}
355		Function(mm13, , {IntObj, StrObj, BuffObj}) {Store(19, Flag)}
356		Function(mm14, , {IntObj, StrObj, BuffObj, PkgObj}) {Store(20, Flag)}
357		Function(mm15, , {IntObj, StrObj, BuffObj, PkgObj,
358				FieldUnitObj}) {Store(21, Flag)}
359		Function(mm16, , {IntObj, StrObj, BuffObj, PkgObj,
360				FieldUnitObj, DeviceObj}) {Store(22, Flag)}
361		Function(mm17, , {IntObj, StrObj, BuffObj, PkgObj,
362				FieldUnitObj, DeviceObj, EventObj}) {Store(23, Flag)}
363		Function(mm18, , {MethodObj, MutexObj, OpRegionObj, PowerResObj,
364				ThermalZoneObj, BuffFieldObj, DDBHandleObj}) {Store(24, Flag)}
365
366		// List of types of the parameters contains keyword packages
367		// along with different keywords
368		Function(mm20, , {{IntObj}}) {Store(32, Flag)}
369		Function(mm21, , {{IntObj, StrObj}}) {Store(33, Flag)}
370/*
371// Bug 148
372		Function(mm22, , {{IntObj, StrObj, BuffObj, PkgObj,
373				FieldUnitObj, DeviceObj, EventObj, MethodObj,
374				MutexObj, OpRegionObj, PowerResObj, ProcessorObj,
375				ThermalZoneObj, BuffFieldObj, DDBHandleObj}}) {Store(34, Flag)}
376*/
377		Function(mm23, , {{IntObj}, IntObj}) {Store(35, Flag)}
378		Function(mm24, , {{IntObj}, StrObj}) {Store(36, Flag)}
379		Function(mm25, , {{IntObj}, BuffObj}) {Store(37, Flag)}
380		Function(mm26, , {{IntObj}, {IntObj}}) {Store(38, Flag)}
381		Function(mm27, , {{IntObj}, {StrObj}}) {Store(39, Flag)}
382		Function(mm28, , {{IntObj}, {BuffObj}}) {Store(40, Flag)}
383		Function(mm29, , {{StrObj}, {BuffObj}}) {Store(41, Flag)}
384
385/*
386// Bug 148
387		Function(mm3a, , {
388			{IntObj, StrObj, BuffObj, PkgObj, FieldUnitObj, DeviceObj, EventObj, MethodObj,
389			 MutexObj, OpRegionObj, PowerResObj, ThermalZoneObj, BuffFieldObj, DDBHandleObj},
390			{IntObj, StrObj, BuffObj, PkgObj, FieldUnitObj, DeviceObj, EventObj, MethodObj,
391			 MutexObj, OpRegionObj, PowerResObj, ThermalZoneObj, BuffFieldObj, DDBHandleObj},
392			{IntObj, StrObj, BuffObj, PkgObj, FieldUnitObj, DeviceObj, EventObj, MethodObj,
393			 MutexObj, OpRegionObj, PowerResObj, ThermalZoneObj, BuffFieldObj, DDBHandleObj},
394			{IntObj, StrObj, BuffObj, PkgObj, FieldUnitObj, DeviceObj, EventObj, MethodObj,
395			 MutexObj, OpRegionObj, PowerResObj, ThermalZoneObj, BuffFieldObj, DDBHandleObj},
396			{IntObj, StrObj, BuffObj, PkgObj, FieldUnitObj, DeviceObj, EventObj, MethodObj,
397			 MutexObj, OpRegionObj, PowerResObj, ThermalZoneObj, BuffFieldObj, DDBHandleObj},
398			{IntObj, StrObj, BuffObj, PkgObj, FieldUnitObj, DeviceObj, EventObj, MethodObj,
399			 MutexObj, OpRegionObj, PowerResObj, ThermalZoneObj, BuffFieldObj, DDBHandleObj},
400			{IntObj, StrObj, BuffObj, PkgObj, FieldUnitObj, DeviceObj, EventObj, MethodObj,
401			 MutexObj, OpRegionObj, PowerResObj, ThermalZoneObj, BuffFieldObj, DDBHandleObj},
402		}) {Store(42, Flag)}
403*/
404
405/*
406// Bug 148
407		// List of types of the parameters contains the same keyword
408
409		m205(ts, 55, ObjectType(mm00), 8)
410		mm00(1)
411		m205(ts, 56, Flag, 0)
412
413		m205(ts, 57, ObjectType(mm01), 8)
414		mm01(1)
415		m205(ts, 58, Flag, 1)
416
417		m205(ts, 59, ObjectType(mm02), 8)
418		mm02(1, 2)
419		m205(ts, 60, Flag, 2)
420
421		m205(ts, 61, ObjectType(mm03), 8)
422		mm03(1, 2, 3)
423		m205(ts, 62, Flag, 3)
424
425		m205(ts, 63, ObjectType(mm04), 8)
426		mm04(1, 2, 3, 4)
427		m205(ts, 64, Flag, 4)
428
429		m205(ts, 65, ObjectType(mm05), 8)
430		mm05(1, 2, 3, 4, 5)
431		m205(ts, 66, Flag, 5)
432
433		m205(ts, 67, ObjectType(mm06), 8)
434		mm06(1, 2, 3, 4, 5, 6)
435		m205(ts, 68, Flag, 6)
436
437		m205(ts, 69, ObjectType(mm07), 8)
438		mm07(1, 2, 3, 4, 5, 6, 7)
439		m205(ts, 70, Flag, 7)
440
441		// List of types of the parameters contains the UnknownObj keyword
442
443		m205(ts, 71, ObjectType(mm08), 8)
444		mm08(1)
445		m205(ts, 72, Flag, 8)
446
447		m205(ts, 73, ObjectType(mm09), 8)
448		mm09(1)
449		m205(ts, 74, Flag, 9)
450
451		m205(ts, 75, ObjectType(mm0a), 8)
452		mm08(1, 2, 3, 4, 5, 6, 7)
453		m205(ts, 76, Flag, 10)
454
455		// List of types of the parameters contains different keywords
456
457		m205(ts, 77, ObjectType(mm10), 8)
458		mm10(1, 2)
459		m205(ts, 78, Flag, 16)
460
461		m205(ts, 79, ObjectType(mm11), 8)
462		mm11(1, 2)
463		m205(ts, 80, Flag, 17)
464
465		m205(ts, 81, ObjectType(mm12), 8)
466		mm12(1, 2)
467		m205(ts, 82, Flag, 18)
468
469		m205(ts, 83, ObjectType(mm13), 8)
470		mm13(1, 2, 3)
471		m205(ts, 84, Flag, 19)
472
473		m205(ts, 85, ObjectType(mm14), 8)
474		mm14(1, 2, 3, 4)
475		m205(ts, 86, Flag, 20)
476
477		m205(ts, 87, ObjectType(mm15), 8)
478		mm15(1, 2, 3, 4, 5)
479		m205(ts, 88, Flag, 21)
480
481		m205(ts, 89, ObjectType(mm16), 8)
482		mm16(1, 2, 3, 4, 5, 6)
483		m205(ts, 90, Flag, 22)
484
485		m205(ts, 91, ObjectType(mm17), 8)
486		mm17(1, 2, 3, 4, 5, 6, 7)
487		m205(ts, 92, Flag, 23)
488
489		m205(ts, 93, ObjectType(mm18), 8)
490		mm18(1, 2, 3, 4, 5, 6, 7)
491		m205(ts, 94, Flag, 24)
492
493		// List of types of the parameters contains keyword packages
494		// along with different keywords
495
496		m205(ts, 95, ObjectType(mm20), 8)
497		mm20(1)
498		m205(ts, 96, Flag, 32)
499
500		m205(ts, 97, ObjectType(mm21), 8)
501		mm21(1)
502		m205(ts, 98, Flag, 33)
503
504		m205(ts, 99, ObjectType(mm22), 8)
505		mm22(1)
506		m205(ts, 100, Flag, 34)
507
508		m205(ts, 101, ObjectType(mm23), 8)
509		mm23(1, 2)
510		m205(ts, 102, Flag, 35)
511
512		m205(ts, 103, ObjectType(mm24), 8)
513		mm24(1, 2)
514		m205(ts, 104, Flag, 36)
515
516		m205(ts, 105, ObjectType(mm25), 8)
517		mm25(1, 2)
518		m205(ts, 106, Flag, 37)
519
520		m205(ts, 107, ObjectType(mm26), 8)
521		mm26(1, 2)
522		m205(ts, 108, Flag, 38)
523
524		m205(ts, 109, ObjectType(mm27), 8)
525		mm27(1, 2)
526		m205(ts, 110, Flag, 39)
527
528		m205(ts, 149, ObjectType(mm28), 8)
529		mm28(1, 2)
530		m205(ts, 111, Flag, 40)
531
532		m205(ts, 112, ObjectType(mm29), 8)
533		mm29(1, 2)
534		m205(ts, 113, Flag, 41)
535
536		m205(ts, 114, ObjectType(mm2a), 8)
537		mm2a(1, 2, 3, 4, 5, 6, 7)
538		m205(ts, 115, Flag, 42)
539*/
540	}
541
542	SRMT("m316")
543	m316()
544	SRMT("m317")
545	m317()
546	SRMT("m318")
547	m318()
548	SRMT("m319")
549	m319()
550	SRMT("m31a")
551	m31a()
552}
553
554// Run-method
555Method(NM02)
556{
557	Store("TEST: NM02, Declare Function Control Method Named Object", Debug)
558
559	m20e()
560
561	CH03("NM02", z134, 116, 0, 0)
562}
563