• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /barrelfish-2018-10-04/lib/acpica/tests/aslts/src/runtime/collections/functional/table/
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 * LoadTable ASL operator functionality
31 */
32
33/*
34 * This sub-test is intended to comprehensively verify
35 * the LoadTable ASL operator functionality.
36 *
37 * Performs a run-time load of a Definition Block from the XSDT.
38 *
39 *    17.5.68   LoadTable (Load Definition Block From XSDT)
40 *    Syntax
41 * LoadTable (SignatureString, OEMIDString, OEMTableIDString,
42 *   RootPathString, ParameterPathString, ParameterData) => DDBHandle
43 *
44 * On testing the following issues should be covered:
45 *
46 * - loading from the XSDT of a Definition Block in which the Signature
47 *   field (should differ from "DSDT" and "SSDT") matches SignatureString,
48 *   the OEM ID field matches OEMIDString, and the OEM Table ID matches
49 *   OEMTableIDString,
50 *
51 * - all comparisons are case sensitive,
52 *
53 * - the result of the LoadTable operator is an Object of the DDBHandle type,
54 *
55 * - if no table matches the specified parameters, then 0 is returned,
56 *
57 * - the DDBHandle Object returned from the LoadTable operator can be used
58 *   to unload the table,
59 *
60 * - any of the optional parameters (RootPathString, ParameterPathString,
61 *   and ParameterData) can be omitted,
62 *
63 * - different sources of the String parameters: literals, Named Objects,
64 *   LocalX, ArgX, elements of Packages, results of functions, any TermArg
65 *
66 * - different sources of the optional parameters: literals, Named Objects,
67 *   LocalX, ArgX, elements of Packages, results of functions, any TermArg
68 *
69 * - implicit operand conversion of the parameters specified to be strings,
70 *
71 * - namespace location to load the Definition Block is determined by the
72 *   RootPathString parameter,
73 *
74 * - the RootPathString is evaluated using normal scoping rules, assuming
75 *   that the scope of the LoadTable operator is the current scope,
76 *
77 * - if RootPathString is not specified, "\" is assumed,
78 *
79 * - if ParameterPathString and ParameterData are specified, the data object
80 *   specified by ParameterData is stored into the object specified by
81 *   ParameterPathString after the table has been added into the namespace,
82 *
83 * - if the first character of ParameterPathString is a backslash or caret
84 *   character, then the path of the object is ParameterPathString. Otherwise,
85 *   it is RootPathString.ParameterPathString,
86 *
87 * - if some SSDT matching the LoadTable parameters is originally not listed
88 *   in XSDT, LoadTable returns 0,
89 *
90 * - exceptional conditions caused by inappropriate data:
91 *   = the SignatureString is greater than four characters,
92 *   = the OEMIDString is greater than six characters,
93 *   = the OEMTableID is greater than eight characters,
94 *   = incorrect types of the parameters,
95 *   = some DSDT or SSDT matching the LoadTable parameters is already loaded
96 *     (actually on initial loading of tables listed in XSDT),
97 *   = the matched table is already loaded,
98 *   = there already is an previously loaded Object referred by the path
99 *     in the Namespace,
100 *   = the object specified by the ParameterPathString does not exist,
101 *   = storing of data of the ParameterData data type is not allowed,
102 *   = AE_OWNER_ID_LIMIT exception when too many Tables loaded.
103 *
104 * Can not be tested following issues:
105 * - providing of the table matched the LoadTable parameters to be "in memory
106 *   marked by AddressRangeReserved or AddressRangeNVS",
107 * - overriding the supplied table with "a newer revision Definition Block
108 *   of the same OEM Table ID" by the OS,
109 * - loading a Definition Block to be a synchronous operation ("the control
110 *   methods defined in the Definition Block are not executed during load
111 *   time").
112 *
113 * Note: the tests is based on the current representation of the auxiliary
114 *       OEM1 table in the artificial set of tables in the RSDT of acpiexec.
115 */
116
117Name(z176, 176)
118
119Device(DTM2) {
120
121	Device(DEVR) {Name(s000, "DEVR")}
122
123	// Contents of the OEM1 signature table addressed by the RSDT in acpiexec
124	Name(OEMT, Buffer(0x30){
125		0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00,  /* 00000000    "OEM18..." */
126		0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    ".KIntel." */
127		0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
128		0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
129		0x18,0x09,0x03,0x20,0x08,0x5F,0x58,0x54,  /* 00000020    "... ._XT" */
130		0x32,0x0A,0x04,0x14,0x0C,0x5F,0x58,0x54,  /* 00000028    "2...._XT" */
131		0x31,0x00,0x70,0x01,0x5F,0x58,0x54,0x32,  /* 00000030    "1.p._XT2" */
132	})
133
134	CreateField (OEMT,   0, 32, FOEM)
135	CreateField (OEMT,  80, 48, FOID)
136	CreateField (OEMT, 128, 64, FTID)
137
138	Name(SOEM, "OEM1")
139	Name(SOID, "Intel")
140	Name(STID, "Many")
141
142	Name(POEM, Package(3) {"OEM1", "Intel", "Many"})
143
144	Name(RPST, "\\DTM2")
145	Name(PLDT, 0)
146	Name(PPST, "\\DTM2.PLDT")
147	Name(DDBH, 0)
148
149	// Check DataTable Region
150	Method(chdr, 1, Serialized)
151	{
152		DataTableRegion (DR00, "OEM1", "", "")
153		Field(DR00, AnyAcc, NoLock, Preserve) {
154			FU00, 0x1C0}
155
156		Concatenate(arg0, "-tst0", arg0)
157
158		if (LNotEqual(OEMT, FU00)) {
159			err(arg0, z176, 0x001, 0, 0, FU00, OEMT)
160			return (1)
161		}
162
163		return (0)
164	}
165
166	// Simple Loadtable test
167	Method(tst0, 1, Serialized)
168	{
169		Name(DDBH, 0)
170
171		Concatenate(arg0, "-tst0", arg0)
172
173		if (chdr(arg0)) {
174			return (1)
175		}
176
177		if (CondRefof(\_XT2, Local0)) {
178			err(arg0, z176, 0x002, 0, 0, "\\_XT2", 1)
179			return (1)
180		}
181
182		Store(0, \DTM2.PLDT)
183
184		Store(LoadTable("OEM1", "", "", "\\", PPST, 1), DDBH)
185
186		if (CH03(arg0, z176, 0x003, 0, 0)) {
187			return (1)
188		}
189
190		if (y260) {
191			Store(ObjectType(DDBH), Local1)
192			if (LNotEqual(Local1, c017)) { // DDB Handle
193				err(arg0, z176, 0x005, 0, 0, Local1, c017)
194				return (1)
195			}
196		}
197
198		if (LNotEqual(1, \DTM2.PLDT)) {
199			err(arg0, z176, 0x006, 0, 0, \DTM2.PLDT, 1)
200		}
201
202		if (CondRefof(\_XT2, Local0)) {
203		} else {
204			err(arg0, z176, 0x007, 0, 0, "\\_XT2", 0)
205		}
206
207		UnLoad(DDBH)
208		Store("OEM1 unloaded", Debug)
209
210		if (CH03(arg0, z176, 0x008, 0, 0)) {
211			return (1)
212		}
213
214		if (CondRefof(\_XT2, Local0)) {
215			err(arg0, z176, 0x009, 0, 0, "\\_XT2", 1)
216		}
217
218		return (0)
219	}
220
221	// All comparisons of Loadtable parameters are case sensitive,
222	// if no table matches the specified parameters, then 0 is returned
223	Method(tst1, 1, Serialized)
224	{
225		Name(DDBH, 0)
226
227		Concatenate(arg0, "-tst1", arg0)
228
229		if (CondRefof(\_XT2, Local0)) {
230			err(arg0, z176, 0x010, 0, 0, "\\_XT2", 1)
231			return (1)
232		}
233
234		// Successful comparison
235
236		Store(0, \DTM2.PLDT)
237
238		if (y281) {
239			Store(LoadTable("OEM1", "Intel", "Many", "\\", PPST, 1), DDBH)
240		} else {
241			Store(LoadTable("OEM1", "", "", "\\", PPST, 1), DDBH)
242		}
243
244		if (CH03(arg0, z176, 0x011, 0, 0)) {
245			return (1)
246		}
247
248		if (y260) {
249			Store(ObjectType(DDBH), Local1)
250			if (LNotEqual(Local1, c017)) { // DDB Handle
251				err(arg0, z176, 0x012, 0, 0, Local1, c017)
252				return (1)
253			}
254		}
255
256		if (LNotEqual(1, \DTM2.PLDT)) {
257			err(arg0, z176, 0x013, 0, 0, \DTM2.PLDT, 1)
258		}
259
260		if (CondRefof(\_XT2, Local0)) {
261		} else {
262			err(arg0, z176, 0x014, 0, 0, "\\_XT2", 0)
263		}
264
265		UnLoad(DDBH)
266		Store("OEM1 unloaded", Debug)
267
268		if (CH03(arg0, z176, 0x015, 0, 0)) {
269			return (1)
270		}
271
272		if (CondRefof(\_XT2, Local0)) {
273			err(arg0, z176, 0x016, 0, 0, "\\_XT2", 1)
274		}
275
276		// Unhappy comparison due to the SignatureString
277
278		Store(0, \DTM2.PLDT)
279
280		Store(ObjectType(Local2), Local1)
281		if (LNotEqual(Local1, c008)) {
282			err(arg0, z176, 0x017, 0, 0, Local1, c008)
283		}
284
285		Store(LoadTable("OeM1", "Intel", "Many", "\\", PPST, 1), Local2)
286
287		if (CH03(arg0, z176, 0x018, 0, 0)) {
288			return (1)
289		}
290
291		Store(ObjectType(Local2), Local1)
292		if (LNotEqual(Local1, c009)) {
293			err(arg0, z176, 0x019, 0, 0, Local1, c009)
294		}
295
296		if (LNotEqual(Local2, 0)) {
297			err(arg0, z176, 0x01a, 0, 0, Local2, 0)
298		}
299
300		if (LNotEqual(0, \DTM2.PLDT)) {
301			err(arg0, z176, 0x01b, 0, 0, \DTM2.PLDT, 0)
302		}
303
304		if (CondRefof(\_XT2, Local0)) {
305			err(arg0, z176, 0x01c, 0, 0, "\\_XT2", 1)
306		}
307
308		// Unhappy comparison due to the OEMIDString
309
310		Store(0, \DTM2.PLDT)
311
312		Store(ObjectType(Local3), Local1)
313		if (LNotEqual(Local1, c008)) {
314			err(arg0, z176, 0x01d, 0, 0, Local1, c008)
315		}
316
317		Store(LoadTable("OEM1", "InteL", "Many", "\\", PPST, 1), Local3)
318
319		if (CH03(arg0, z176, 0x01e, 0, 0)) {
320			return (1)
321		}
322
323		Store(ObjectType(Local3), Local1)
324		if (LNotEqual(Local1, c009)) {
325			err(arg0, z176, 0x01f, 0, 0, Local1, c009)
326		}
327
328		if (LNotEqual(Local3, 0)) {
329			err(arg0, z176, 0x020, 0, 0, Local3, 0)
330		}
331
332		if (LNotEqual(0, \DTM2.PLDT)) {
333			err(arg0, z176, 0x021, 0, 0, \DTM2.PLDT, 0)
334		}
335
336		if (CondRefof(\_XT2, Local0)) {
337			err(arg0, z176, 0x022, 0, 0, "\\_XT2", 1)
338		}
339
340		// Unhappy comparison due to the OEMTableIDString
341
342		Store(0, \DTM2.PLDT)
343
344		Store(ObjectType(Local4), Local1)
345		if (LNotEqual(Local1, c008)) {
346			err(arg0, z176, 0x023, 0, 0, Local1, c008)
347		}
348
349		Store(LoadTable("OEM1", "Intel", "many", "\\", PPST, 1), Local4)
350
351		if (CH03(arg0, z176, 0x024, 0, 0)) {
352			return (1)
353		}
354
355		Store(ObjectType(Local4), Local1)
356		if (LNotEqual(Local1, c009)) {
357			err(arg0, z176, 0x025, 0, 0, Local1, c009)
358		}
359
360		if (LNotEqual(Local4, 0)) {
361			err(arg0, z176, 0x026, 0, 0, Local4, 0)
362		}
363
364		if (LNotEqual(0, \DTM2.PLDT)) {
365			err(arg0, z176, 0x027, 0, 0, \DTM2.PLDT, 0)
366		}
367
368		if (CondRefof(\_XT2, Local0)) {
369			err(arg0, z176, 0x028, 0, 0, "\\_XT2", 1)
370		}
371
372		return (0)
373	}
374
375	// Any of the RootPathString, ParameterPathString, and ParameterData
376	// parameters in LoadTable expression can be omitted
377	Method(tst2, 1, Serialized)
378	{
379		Name(DDB0, 0)
380		Name(DDB1, 0)
381		Name(DDB2, 0)
382		Name(DDB3, 0)
383
384		Concatenate(arg0, "-tst2", arg0)
385
386		if (CondRefof(\_XT2, Local0)) {
387			err(arg0, z176, 0x030, 0, 0, "\\_XT2", 1)
388			return (1)
389		}
390
391		// Check when RootPathString omitted
392
393		Store(0, \DTM2.PLDT)
394
395		Store(LoadTable("OEM1", "", "", , PPST, 1), DDB0)
396
397		if (CH03(arg0, z176, 0x031, 0, 0)) {
398			return (1)
399		}
400
401		if (y260) {
402			Store(ObjectType(DDB0), Local1)
403			if (LNotEqual(Local1, c017)) { // DDB Handle
404				err(arg0, z176, 0x032, 0, 0, Local1, c017)
405				return (1)
406			}
407		}
408
409		if (LNotEqual(1, \DTM2.PLDT)) {
410			err(arg0, z176, 0x033, 0, 0, \DTM2.PLDT, 1)
411		}
412
413		if (CondRefof(\_XT2, Local0)) {
414		} else {
415			err(arg0, z176, 0x034, 0, 0, "\\_XT2", 0)
416		}
417
418		UnLoad(DDB0)
419		Store("OEM1 unloaded", Debug)
420
421		if (CH03(arg0, z176, 0x035, 0, 0)) {
422			return (1)
423		}
424
425		if (CondRefof(\_XT2, Local0)) {
426			err(arg0, z176, 0x036, 0, 0, "\\_XT2", 1)
427		}
428
429		// Check when ParameterPathString omitted
430
431		Store(0, \DTM2.PLDT)
432
433		Store(LoadTable("OEM1", "", "", "\\", , 1), DDB1)
434
435		if (CH03(arg0, z176, 0x037, 0, 0)) {
436			return (1)
437		}
438
439		if (y260) {
440			Store(ObjectType(DDB1), Local1)
441			if (LNotEqual(Local1, c017)) { // DDB Handle
442				err(arg0, z176, 0x038, 0, 0, Local1, c017)
443				return (1)
444			}
445		}
446
447		if (LNotEqual(0, \DTM2.PLDT)) {
448			err(arg0, z176, 0x039, 0, 0, \DTM2.PLDT, 0)
449		}
450
451		if (CondRefof(\_XT2, Local0)) {
452		} else {
453			err(arg0, z176, 0x03a, 0, 0, "\\_XT2", 0)
454		}
455
456		UnLoad(DDB1)
457		Store("OEM1 unloaded", Debug)
458
459		if (CH03(arg0, z176, 0x03b, 0, 0)) {
460			return (1)
461		}
462
463		if (CondRefof(\_XT2, Local0)) {
464			err(arg0, z176, 0x03c, 0, 0, "\\_XT2", 1)
465		}
466
467		// Check when ParameterData omitted
468
469		Store(0, \DTM2.PLDT)
470
471		Store(LoadTable("OEM1", "", "", "\\", PPST, ), DDB2)
472
473		if (CH03(arg0, z176, 0x03d, 0, 0)) {
474			return (1)
475		}
476
477		if (y260) {
478			Store(ObjectType(DDB2), Local1)
479			if (LNotEqual(Local1, c017)) { // DDB Handle
480				err(arg0, z176, 0x03e, 0, 0, Local1, c017)
481				return (1)
482			}
483		}
484
485		if (LNotEqual(0, \DTM2.PLDT)) {
486			err(arg0, z176, 0x03f, 0, 0, \DTM2.PLDT, 0)
487		}
488
489		if (CondRefof(\_XT2, Local0)) {
490		} else {
491			err(arg0, z176, 0x040, 0, 0, "\\_XT2", 0)
492		}
493
494		UnLoad(DDB2)
495		Store("OEM1 unloaded", Debug)
496
497		if (CH03(arg0, z176, 0x041, 0, 0)) {
498			return (1)
499		}
500
501		if (CondRefof(\_XT2, Local0)) {
502			err(arg0, z176, 0x042, 0, 0, "\\_XT2", 1)
503		}
504
505		// Check when all optional parameters omitted
506
507		Store(0, \DTM2.PLDT)
508
509		Store(LoadTable("OEM1", "", "", , , ), DDB3)
510
511		if (CH03(arg0, z176, 0x043, 0, 0)) {
512			return (1)
513		}
514
515		if (y260) {
516			Store(ObjectType(DDB3), Local1)
517			if (LNotEqual(Local1, c017)) { // DDB Handle
518				err(arg0, z176, 0x044, 0, 0, Local1, c017)
519				return (1)
520			}
521		}
522
523		if (LNotEqual(0, \DTM2.PLDT)) {
524			err(arg0, z176, 0x045, 0, 0, \DTM2.PLDT, 0)
525		}
526
527		if (CondRefof(\_XT2, Local0)) {
528		} else {
529			err(arg0, z176, 0x046, 0, 0, "\\_XT2", 0)
530		}
531
532		UnLoad(DDB3)
533		Store("OEM1 unloaded", Debug)
534
535		if (CH03(arg0, z176, 0x047, 0, 0)) {
536			return (1)
537		}
538
539		if (CondRefof(\_XT2, Local0)) {
540			err(arg0, z176, 0x048, 0, 0, "\\_XT2", 1)
541		}
542
543		return (0)
544	}
545
546	// Different sources of the String parameters: Named Objects, LocalX,
547	// ArgX, elements of Packages, results of functions, any TermArg
548	Method(tst3, 1, Serialized)
549	{
550		Name(DDB0, 0)
551		Name(DDB1, 0)
552		Name(DDB2, 0)
553		Name(DDB3, 0)
554		Name(DDB4, 0)
555		Name(DDB5, 0)
556		Name(DDB6, 0)
557
558		Name(SOID, "")
559		Name(STID, "")
560
561		Name(POEM, Package(3) {"OEM1", "", ""})
562
563		Method(m000, 1) {Return (arg0)}
564
565		Method(m001, 3)
566		{
567			Concatenate(arg0, arg2, arg0)
568
569			if (CH03(arg0, z176, 0x051, 0, 0)) {
570				return (1)
571			}
572
573			if (y260) {
574				Store(ObjectType(arg1), Local1)
575				if (LNotEqual(Local1, c017)) { // DDB Handle
576					err(arg0, z176, 0x052, 0, 0, Local1, c017)
577					return (1)
578				}
579			}
580
581			if (LNotEqual(0, \DTM2.PLDT)) {
582				err(arg0, z176, 0x053, 0, 0, \DTM2.PLDT, 0)
583			}
584
585			if (CondRefof(\_XT2, Local0)) {
586			} else {
587				err(arg0, z176, 0x054, 0, 0, "\\DTM2._XT2", 0)
588			}
589
590			UnLoad(arg1)
591			Store("OEM1 unloaded", Debug)
592
593			if (CH03(arg0, z176, 0x055, 0, 0)) {
594				return (1)
595			}
596
597			if (CondRefof(\_XT2, Local0)) {
598				err(arg0, z176, 0x056, 0, 0, "\\DTM2._XT2", 1)
599				return (1)
600			}
601
602			return (0)
603		}
604
605		Method(m002, 3)
606		{
607			return (LoadTable(Arg0, Derefof(Arg1), Derefof(Arg2), , , ))
608		}
609
610		Method(m003, 3)
611		{
612			return (LoadTable(Derefof(Arg0), Arg1, Derefof(Arg2), , , ))
613		}
614
615		Method(m004, 3)
616		{
617			return (LoadTable(Derefof(Arg0), Derefof(Arg1), Arg2, , , ))
618		}
619
620		Concatenate(arg0, "-tst3", arg0)
621
622		if (y281) {
623			Store(^SOID, SOID)
624			Store(^STID, STID)
625			Store(^POEM, POEM)
626		}
627
628		if (CondRefof(\DTM2._XT2, Local0)) {
629			err(arg0, z176, 0x057, 0, 0, "\\_XT2", 1)
630			return (1)
631		}
632
633		// Check LoadTable(Named, LocalX, Method(), , , )
634
635		Store(0, \DTM2.PLDT)
636
637		Store(SOID, Local2)
638
639		Store(LoadTable(SOEM, Local2, m000(STID), , , ), DDB0)
640
641		if (m001(arg0, DDB0, ".NLM")) {
642			return (1)
643		}
644
645		// Check LoadTable(Method(), Named, LocalX, , , )
646
647		Store(0, \DTM2.PLDT)
648
649		Store(STID, Local2)
650
651		Store(LoadTable(m000(SOEM), SOID, Local2, , , ), DDB1)
652
653		if (m001(arg0, DDB1, ".MNL")) {
654			return (1)
655		}
656
657		// Check LoadTable(LocalX, Method(), Named, , , )
658
659		Store(0, \DTM2.PLDT)
660
661		Store(SOEM, Local2)
662
663		Store(LoadTable(Local2, m000(SOID), STID, , , ), DDB2)
664
665		if (m001(arg0, DDB2, ".LMN")) {
666			return (1)
667		}
668
669		// Check LoadTable(ArgX, Derefof(Refof), Derefof(Index), , , )
670
671		Store(0, \DTM2.PLDT)
672
673		Store(Refof(SOID), Local2)
674		Store(Index(POEM, 2), Local3)
675
676		Store(m002(SOEM, Local2, Local3), DDB3)
677
678		if (m001(arg0, DDB3, ".ARI")) {
679			return (1)
680		}
681
682		// Check LoadTable(Derefof(Index), ArgX, Derefof(Refof), , , )
683
684		Store(0, \DTM2.PLDT)
685
686		Store(Refof(STID), Local2)
687		Store(Index(POEM, 0), Local3)
688
689		Store(m003(Local3, SOID, Local2), DDB4)
690
691		if (m001(arg0, DDB4, ".IAR")) {
692			return (1)
693		}
694
695		// Check LoadTable(Derefof(Refof), Derefof(Index), ArgX, , , )
696
697		Store(0, \DTM2.PLDT)
698
699		Store(Refof(SOEM), Local2)
700		Store(Index(POEM, 1), Local3)
701
702		Store(m004(Local2, Local3, STID), DDB5)
703
704		if (m001(arg0, DDB5, ".RIA")) {
705			return (1)
706		}
707
708		// Check LoadTable(TermArg, TermArg, TermArg, , , )
709
710		Store(0, \DTM2.PLDT)
711
712		Store(Concatenate("term", SOEM), Local2)
713		Store(ToBuffer(Local2), Local2)
714
715		Store(ToBuffer(SOID), Local3)
716
717		Store("", Local4)
718
719		Store(LoadTable(
720				Mid(ToString(Local2), 4, 4),
721				ToString(m000(Local3)),
722				Concatenate(m000(STID), Local4), , , ),
723			DDB6)
724
725		if (m001(arg0, DDB6, ".TTT")) {
726			return (1)
727		}
728
729		return (0)
730	}
731
732	// Different sources of the optional parameters (RootPathString,
733	// ParameterPathString, and ParameterData): Named Objects, LocalX,
734	// ArgX, elements of Packages, results of functions, any TermArg
735	Method(tst4, 1, Serialized)
736	{
737		Name(DDB0, 0)
738		Name(DDB1, 0)
739		Name(DDB2, 0)
740		Name(DDB3, 0)
741		Name(DDB4, 0)
742		Name(DDB5, 0)
743		Name(DDB6, 0)
744
745		Name(RPST, "\\DTM2")
746		Name(PPST, "\\DTM2.PLDT")
747		Name(NVAL, 1)
748		Name(POPT, Package(3) {"\\DTM2", "\\DTM2.PLDT", 1})
749
750		Method(m000, 1) {Return (arg0)}
751
752		Method(m001, 3)
753		{
754			Concatenate(arg0, arg2, arg0)
755
756			if (CH03(arg0, z176, 0x061, 0, 0)) {
757				return (1)
758			}
759
760			if (y260) {
761				Store(ObjectType(arg1), Local1)
762				if (LNotEqual(Local1, c017)) { // DDB Handle
763					err(arg0, z176, 0x062, 0, 0, Local1, c017)
764					return (1)
765				}
766			}
767
768			if (LNotEqual(1, \DTM2.PLDT)) {
769				err(arg0, z176, 0x063, 0, 0, \DTM2.PLDT, 1)
770			}
771
772			if (CondRefof(\DTM2._XT2, Local0)) {
773			} else {
774				err(arg0, z176, 0x064, 0, 0, "\\DTM2._XT2", 0)
775			}
776
777			UnLoad(arg1)
778			Store("OEM1 unloaded", Debug)
779
780			if (CH03(arg0, z176, 0x065, 0, 0)) {
781				return (1)
782			}
783
784			if (CondRefof(\DTM2._XT2, Local0)) {
785				err(arg0, z176, 0x066, 0, 0, "\\DTM2._XT2", 1)
786				return (1)
787			}
788
789			return (0)
790		}
791
792		Method(m002, 3)
793		{
794// Bug 288: iASL unexpectedly forbids ParameterData of Loadtable to be LocalX or UserTerm
795//			return (LoadTable("OEM1", "", "", Arg0, Derefof(Arg1), Derefof(Arg2)))
796//	                                        parse error, expecting `')'' ^
797			return (LoadTable("OEM1", "", "", Arg0, Derefof(Arg1), 1))
798		}
799
800		Method(m003, 3)
801		{
802// Bug 288: iASL unexpectedly forbids ParameterData of Loadtable to be LocalX or UserTerm
803//			return (LoadTable("OEM1", "", "", Derefof(Arg0), Arg1, Derefof(Arg2)))
804//	                                        parse error, expecting `')'' ^
805			return (LoadTable("OEM1", "", "", Derefof(Arg0), Arg1, 1))
806		}
807
808		Method(m004, 3)
809		{
810// Bug 288: iASL unexpectedly forbids ParameterData of Loadtable to be LocalX or UserTerm
811//			return (LoadTable("OEM1", "", "", Derefof(Arg0), Derefof(Arg1), Arg2))
812//	                                              parse error, expecting `')'' ^
813			return (LoadTable("OEM1", "", "", Derefof(Arg0), Derefof(Arg1), 1))
814		}
815
816		Concatenate(arg0, "-tst4", arg0)
817
818		if (CondRefof(\DTM2._XT2, Local0)) {
819			err(arg0, z176, 0x067, 0, 0, "\\DTM2._XT2", 1)
820			return (1)
821		}
822
823		// Check LoadTable(..., Named, LocalX, Method())
824
825		Store(0, \DTM2.PLDT)
826
827		Store(PPST, Local2)
828
829// Bug 288: iASL unexpectedly forbids ParameterData of Loadtable to be LocalX or UserTerm
830//		Store(LoadTable("OEM1", "", "", RPST, Local2, m000(1)), DDB0)
831//	                         parse error, expecting `')'' ^
832		Store(LoadTable("OEM1", "", "", RPST, Local2, 1), DDB0)
833
834		if (m001(arg0, DDB0, ".NLM")) {
835			return (1)
836		}
837
838		// Check LoadTable(..., Method(), Named, LocalX)
839
840		Store(0, \DTM2.PLDT)
841
842		Store(1, Local2)
843
844// Bug 288: iASL unexpectedly forbids ParameterData of Loadtable to be LocalX or UserTerm
845//		Store(LoadTable("OEM1", "", "", m000(RPST), PPST, Local2), DDB1)
846//	                              parse error, expecting `')'' ^
847		Store(LoadTable("OEM1", "", "", m000(RPST), PPST, 1), DDB1)
848
849		if (m001(arg0, DDB1, ".MNL")) {
850			return (1)
851		}
852
853		// Check LoadTable(..., LocalX, Method(), Named)
854
855		Store(0, \DTM2.PLDT)
856
857		Store(RPST, Local2)
858
859		Store(LoadTable("OEM1", "", "", Local2, m000(PPST), NVAL), DDB2)
860
861		if (m001(arg0, DDB2, ".LMN")) {
862			return (1)
863		}
864
865		// Check LoadTable(..., ArgX, Derefof(Refof), Derefof(Index))
866
867		Store(0, \DTM2.PLDT)
868
869		Store(Refof(PPST), Local2)
870		Store(Index(POPT, 2), Local3)
871
872		Store(m002(RPST, Local2, Local3), DDB3)
873
874		if (m001(arg0, DDB3, ".ARI")) {
875			return (1)
876		}
877
878		// Check LoadTable(..., Derefof(Index), ArgX, Derefof(Refof))
879
880		Store(0, \DTM2.PLDT)
881
882		Store(Refof(NVAL), Local2)
883		Store(Index(POPT, 0), Local3)
884
885		Store(m003(Local3, PPST, Local2), DDB4)
886
887		if (m001(arg0, DDB4, ".ARI")) {
888			return (1)
889		}
890
891		// Check LoadTable(..., Derefof(Refof), Derefof(Index), ArgX)
892
893		Store(0, \DTM2.PLDT)
894
895		Store(Refof(RPST), Local2)
896		Store(Index(POPT, 1), Local3)
897
898		Store(m004(Local2, Local3, NVAL), DDB5)
899
900		if (m001(arg0, DDB5, ".ARI")) {
901			return (1)
902		}
903
904		// Check LoadTable(..., TermArg, TermArg, TermArg)
905
906		Store(0, \DTM2.PLDT)
907
908		Store(Concatenate("term", RPST), Local2)
909		Store(ToBuffer(Local2), Local2)
910
911		Store(ToBuffer(PPST), Local3)
912
913		Store(3, Local4)
914
915		Store(LoadTable("OEM1", "", "",
916				Mid(ToString(Local2), 4, 1),
917				ToString(m000(Local3)),
918// Bug 288: iASL unexpectedly forbids ParameterData of Loadtable to be LocalX or UserTerm
919//				Subtract(m000(Local4), 2)),
920				Subtract(3, 2)),
921			DDB6)
922
923		if (m001(arg0, DDB6, ".TTT")) {
924			return (1)
925		}
926
927		return (0)
928	}
929
930	// Namespace location to load the Definition Block is determined
931	// by the RootPathString parameter of Loadtable
932	// Arg1: RootPathString
933	Method(tst5, 2, Serialized)
934	{
935		Name(DDBH, 0)
936
937		Concatenate(arg0, "-tst5", arg0)
938
939		if (CondRefof(\_XT2, Local0)) {
940			err(arg0, z176, 0x070, 0, 0, "\\_XT2", 1)
941			return (1)
942		}
943
944		if (CondRefof(\DTM2.DEVR._XT2, Local0)) {
945			err(arg0, z176, 0x071, 0, 0, "\\DTM2.DEVR._XT2", 1)
946			return (1)
947		}
948
949		Store(0, \DTM2.PLDT)
950
951		Store(LoadTable("OEM1", "", "", Arg1, PPST, 1), DDBH)
952
953		if (CH03(arg0, z176, 0x072, 0, 0)) {
954			return (1)
955		}
956
957		if (y260) {
958			Store(ObjectType(DDBH), Local1)
959			if (LNotEqual(Local1, c017)) { // DDB Handle
960				err(arg0, z176, 0x073, 0, 0, Local1, c017)
961				return (1)
962			}
963		}
964
965		if (LNotEqual(1, \DTM2.PLDT)) {
966			err(arg0, z176, 0x074, 0, 0, \DTM2.PLDT, 1)
967		}
968
969		if (CondRefof(\_XT2, Local0)) {
970			err(arg0, z176, 0x075, 0, 0, "\\_XT2", 1)
971		}
972
973		if (CondRefof(\DTM2.DEVR._XT2, Local0)) {
974		} else {
975			err(arg0, z176, 0x076, 0, 0, "\\DTM2.DEVR._XT2", 0)
976		}
977
978		UnLoad(DDBH)
979		Store("OEM1 unloaded", Debug)
980
981		if (CH03(arg0, z176, 0x077, 0, 0)) {
982			return (1)
983		}
984
985		if (CondRefof(\_XT2, Local0)) {
986			err(arg0, z176, 0x078, 0, 0, "\\_XT2", 1)
987		}
988
989		if (CondRefof(\DTM2.DEVR._XT2, Local0)) {
990			err(arg0, z176, 0x079, 0, 0, "\\DTM2.DEVR._XT2", 1)
991		}
992
993		return (0)
994	}
995
996	// "\" is assumed to be Namespace location to load the Definition
997	// Block if RootPathString parameter is not specified
998	Method(tst6, 1, Serialized)
999	{
1000		Name(DDBH, 0)
1001
1002		Concatenate(arg0, "-tst6", arg0)
1003
1004		if (CondRefof(\_XT2, Local0)) {
1005			err(arg0, z176, 0x080, 0, 0, "\\_XT2", 1)
1006			return (1)
1007		}
1008
1009		Store(0, \DTM2.PLDT)
1010
1011		Store(LoadTable("OEM1", "", "", , PPST, 1), DDBH)
1012
1013		if (CH03(arg0, z176, 0x081, 0, 0)) {
1014			return (1)
1015		}
1016
1017		if (y260) {
1018			Store(ObjectType(DDBH), Local1)
1019			if (LNotEqual(Local1, c017)) { // DDB Handle
1020				err(arg0, z176, 0x082, 0, 0, Local1, c017)
1021				return (1)
1022			}
1023		}
1024
1025		if (LNotEqual(1, \DTM2.PLDT)) {
1026			err(arg0, z176, 0x083, 0, 0, \DTM2.PLDT, 1)
1027		}
1028
1029		if (CondRefof(\_XT2, Local0)) {
1030		} else {
1031			err(arg0, z176, 0x084, 0, 0, "\\_XT2", 0)
1032		}
1033
1034		UnLoad(DDBH)
1035		Store("OEM1 unloaded", Debug)
1036
1037		if (CH03(arg0, z176, 0x085, 0, 0)) {
1038			return (1)
1039		}
1040
1041		if (CondRefof(\_XT2, Local0)) {
1042			err(arg0, z176, 0x086, 0, 0, "\\_XT2", 1)
1043		}
1044
1045		return (0)
1046	}
1047
1048	// If the first character of ParameterPathString is a backslash
1049	// or caret character, then the path of the object set up on success
1050	// is ParameterPathString. It is RootPathString.ParameterPathString
1051	// in any case.
1052	Method(tst7, 1, Serialized)
1053	{
1054		Name(DDBH, 0)
1055		Name(PLDT, 0)
1056
1057		Concatenate(arg0, "-tst7", arg0)
1058
1059		Store(LoadTable("OEM1", "", "", RPST, "^TST7.PLDT", 1), DDBH)
1060
1061		if (CH03(arg0, z176, 0x091, 0, 0)) {
1062			return (1)
1063		}
1064
1065		if (y260) {
1066			Store(ObjectType(DDBH), Local1)
1067			if (LNotEqual(Local1, c017)) { // DDB Handle
1068				err(arg0, z176, 0x092, 0, 0, Local1, c017)
1069				return (1)
1070			}
1071		}
1072
1073		if (LNotEqual(1, PLDT)) {
1074			err(arg0, z176, 0x093, 0, 0, PLDT, 1)
1075		}
1076
1077		UnLoad(DDBH)
1078
1079		if (CH03(arg0, z176, 0x094, 0, 0)) {
1080			return (1)
1081		}
1082
1083		Store(0, PLDT)
1084		Store(0, \DTM2.PLDT)
1085
1086		Store(LoadTable("OEM1", "", "", RPST, "PLDT", 1), DDBH)
1087
1088		if (CH03(arg0, z176, 0x095, 0, 0)) {
1089			return (1)
1090		}
1091
1092		if (y260) {
1093			Store(ObjectType(DDBH), Local1)
1094			if (LNotEqual(Local1, c017)) { // DDB Handle
1095				err(arg0, z176, 0x096, 0, 0, Local1, c017)
1096				return (1)
1097			}
1098		}
1099
1100		if (LNotEqual(0, PLDT)) {
1101			err(arg0, z176, 0x097, 0, 0, PLDT, 0)
1102		}
1103
1104		if (LNotEqual(1, \DTM2.PLDT)) {
1105			err(arg0, z176, 0x098, 0, 0, \DTM2.PLDT, 1)
1106		}
1107
1108		UnLoad(DDBH)
1109
1110		if (CH03(arg0, z176, 0x099, 0, 0)) {
1111			return (1)
1112		}
1113
1114		return (0)
1115	}
1116
1117	// Exceptions when the SignatureString is greater than four characters,
1118	// the OEMIDString is greater than six characters, or the OEMTableID is
1119	// greater than eight characters
1120	Method(tst8, 1, Serialized)
1121	{
1122		Name(DDBH, 0)
1123
1124		Concatenate(arg0, "-tst8", arg0)
1125
1126		Store(0, \DTM2.PLDT)
1127
1128		// SignatureString is greater than four characters
1129		if (y287) {
1130			Store(LoadTable("OEM1X", "", "", RPST, PPST, 1), DDBH)
1131		} else {
1132			LoadTable("OEM1X", "", "", RPST, PPST, 1)
1133		}
1134
1135		CH04(arg0, 0, 61, z176, 0x0a0, 0, 0)	// AE_AML_STRING_LIMIT
1136
1137		if (LNotEqual(0, \DTM2.PLDT)) {
1138			err(arg0, z176, 0x0a1, 0, 0, \DTM2.PLDT, 1)
1139
1140			if (y287) {
1141				return (1)
1142			} else {
1143				// Cleanup
1144				UnLoad(DDBH)
1145				Store(0, \DTM2.PLDT)
1146			}
1147		}
1148
1149		// OEMIDString is greater than six characters
1150		LoadTable("OEM1", "IntelXX", "", RPST, PPST, 1)
1151
1152		CH04(arg0, 0, 61, z176, 0x0a2, 0, 0)	// AE_AML_STRING_LIMIT
1153
1154		if (LNotEqual(0, \DTM2.PLDT)) {
1155			err(arg0, z176, 0x0a3, 0, 0, \DTM2.PLDT, 1)
1156			return (1)
1157		}
1158
1159		// OEMTableID is greater than eight characters
1160		LoadTable("OEM1", "", "ManyXXXXX", RPST, PPST, 1)
1161
1162		CH04(arg0, 0, 61, z176, 0x0a4, 0, 0)	// AE_AML_STRING_LIMIT
1163
1164		if (LNotEqual(0, \DTM2.PLDT)) {
1165			err(arg0, z176, 0x0a5, 0, 0, \DTM2.PLDT, 1)
1166			return (1)
1167		}
1168
1169		return (0)
1170	}
1171
1172	// Exceptions when some DSDT or SSDT matching the LoadTable parameters
1173	// is already loaded (actually on initial loading of tables listed in XSDT)
1174	Method(tst9, 1)
1175	{
1176		Concatenate(arg0, "-tst9", arg0)
1177
1178		Store(0, \DTM2.PLDT)
1179
1180		// SignatureString is "DSDT"
1181		LoadTable("DSDT", "", "", RPST, PPST, 1)
1182
1183		CH04(arg0, 0, 7, z176, 0x0a6, 0, 0)	// AE_ALREADY_EXISTS
1184
1185		if (LNotEqual(0, \DTM2.PLDT)) {
1186			err(arg0, z176, 0x0a7, 0, 0, \DTM2.PLDT, 1)
1187		}
1188
1189		// SignatureString is "SSDT"
1190		LoadTable("SSDT", "", "", RPST, PPST, 1)
1191
1192		CH04(arg0, 0, 7, z176, 0x0a8, 0, 0)	// AE_ALREADY_EXISTS
1193
1194		if (LNotEqual(0, \DTM2.PLDT)) {
1195			err(arg0, z176, 0x0a9, 0, 0, \DTM2.PLDT, 1)
1196		}
1197
1198		return (0)
1199	}
1200
1201	// Exceptions when the matched table is already loaded
1202	Method(tsta, 1, Serialized)
1203	{
1204		Name(DDBH, 0)
1205
1206		Concatenate(arg0, "-tsta", arg0)
1207
1208		if (CondRefof(\_XT2, Local0)) {
1209			err(arg0, z176, 0x0b0, 0, 0, "\\_XT2", 1)
1210			return (1)
1211		}
1212
1213		Store(0, \DTM2.PLDT)
1214
1215		Store(LoadTable("OEM1", "", "", "\\", PPST, 1), DDBH)
1216
1217		if (CH03(arg0, z176, 0x0b1, 0, 0)) {
1218			return (1)
1219		}
1220
1221		if (y260) {
1222			Store(ObjectType(DDBH), Local1)
1223			if (LNotEqual(Local1, c017)) { // DDB Handle
1224				err(arg0, z176, 0x0b2, 0, 0, Local1, c017)
1225				return (1)
1226			}
1227		}
1228
1229		if (LNotEqual(1, \DTM2.PLDT)) {
1230			err(arg0, z176, 0x0b3, 0, 0, \DTM2.PLDT, 1)
1231		}
1232
1233		if (CondRefof(\_XT2, Local0)) {
1234		} else {
1235			err(arg0, z176, 0x0b4, 0, 0, "\\_XT2", 0)
1236		}
1237
1238		Store(0, \DTM2.PLDT)
1239
1240		LoadTable("OEM1", "", "", "\\DTM2", PPST, 1)
1241
1242		CH04(arg0, 0, 7, z176, 0x0b5, 0, 0)	// AE_ALREADY_EXISTS
1243
1244		if (LNotEqual(0, \DTM2.PLDT)) {
1245			err(arg0, z176, 0x0b6, 0, 0, \DTM2.PLDT, 0)
1246		}
1247
1248		if (CondRefof(\DTM2._XT2, Local0)) {
1249			err(arg0, z176, 0x0b7, 0, 0, "\\DTM2._XT2", 1)
1250		}
1251
1252		if (CondRefof(\_XT2, Local0)) {
1253		} else {
1254			err(arg0, z176, 0x0b8, 0, 0, "\\_XT2", 0)
1255		}
1256
1257		UnLoad(DDBH)
1258		Store("OEM1 unloaded", Debug)
1259
1260		if (CH03(arg0, z176, 0x0b9, 0, 0)) {
1261			return (1)
1262		}
1263
1264		if (CondRefof(\_XT2, Local0)) {
1265			err(arg0, z176, 0x0ba, 0, 0, "\\_XT2", 1)
1266		}
1267
1268		return (0)
1269	}
1270
1271	// Originated from ssdt4.asl: iasl -tc ssdt4.asl
1272	Name(BUF4, Buffer(){
1273		0x53,0x53,0x44,0x54,0x44,0x00,0x00,0x00,  /* 00000000    "SSDTD..." */
1274		0x02,0x08,0x69,0x41,0x53,0x4C,0x54,0x53,  /* 00000008    "..iASLTS" */
1275		0x4C,0x54,0x42,0x4C,0x30,0x30,0x30,0x31,  /* 00000010    "LTBL0001" */
1276		0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
1277		0x15,0x12,0x06,0x20,0x10,0x1F,0x5C,0x00,  /* 00000020    "... ..\." */
1278		0x08,0x5F,0x58,0x54,0x32,0x0D,0x61,0x62,  /* 00000028    "._XT2.ab" */
1279		0x73,0x6F,0x6C,0x75,0x74,0x65,0x20,0x6C,  /* 00000030    "solute l" */
1280		0x6F,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,  /* 00000038    "ocation " */
1281		0x6F,0x62,0x6A,0x00,
1282	})
1283
1284	OperationRegion (IST4, SystemMemory, 0x600, 0x44)
1285
1286	Field(IST4, ByteAcc, NoLock, Preserve) {
1287		RFU4, 0x220,
1288	}
1289
1290	// Exceptions when there already is an previously loaded Object
1291	// referred by the path in the Namespace
1292	Method(tstb, 1, Serialized)
1293	{
1294		Name(DDBH, 0)
1295
1296		Concatenate(arg0, "-tstb", arg0)
1297
1298		if (CondRefof(\_XT2, Local0)) {
1299			err(arg0, z176, 0x0c0, 0, 0, "\\_XT2", 1)
1300			return (1)
1301		}
1302
1303		Store(BUF4, RFU4)
1304		Load(RFU4, DDBH)
1305
1306		if (CH03(arg0, z176, 0x0c1, 0, 0)) {
1307			return (1)
1308		}
1309
1310		if (y260) {
1311			Store(ObjectType(DDBH), Local1)
1312			if (LNotEqual(Local1, c017)) { // DDB Handle
1313				err(arg0, z176, 0x0c2, 0, 0, Local1, c017)
1314				return (1)
1315			}
1316		}
1317
1318		if (CondRefof(\_XT2, Local0)) {
1319		} else {
1320			err(arg0, z176, 0x0c3, 0, 0, "\\_XT2", 0)
1321		}
1322
1323		Store(0, \DTM2.PLDT)
1324
1325		LoadTable("OEM1", "", "", "\\", PPST, 1)
1326
1327		CH04(arg0, 0, 7, z176, 0x0c4, 0, 0)	// AE_ALREADY_EXISTS
1328
1329		if (LNotEqual(0, \DTM2.PLDT)) {
1330			err(arg0, z176, 0x0c5, 0, 0, \DTM2.PLDT, 0)
1331		}
1332
1333		if (CondRefof(\_XT2, Local0)) {
1334		} else {
1335			err(arg0, z176, 0x0c6, 0, 0, "\\_XT2", 0)
1336		}
1337
1338		UnLoad(DDBH)
1339		Store("SSDT unloaded", Debug)
1340
1341		if (CH03(arg0, z176, 0x0c7, 0, 0)) {
1342			return (1)
1343		}
1344
1345		if (CondRefof(\_XT2, Local0)) {
1346			err(arg0, z176, 0x0c8, 0, 0, "\\_XT2", 1)
1347		}
1348
1349		return (0)
1350	}
1351
1352	// Exceptions when the object specified by the ParameterPathString
1353	// does not exist
1354	Method(tstc, 1)
1355	{
1356		Concatenate(arg0, "-tstc", arg0)
1357
1358		LoadTable("DSDT", "", "", RPST, "\\DTM2.NULL", 1)
1359
1360		CH04(arg0, 0, 5, z176, 0x0c9, 0, 0)	// AE_NOT_FOUND
1361
1362		return (0)
1363	}
1364
1365	// Exceptions when storing of data of the ParameterData data type
1366	// to the specified object is not allowed.
1367	Method(tstd, 1)
1368	{
1369		Concatenate(arg0, "-tstd", arg0)
1370
1371		Store(0, \DTM2.PLDT)
1372
1373		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \DTM2.DEVR)
1374
1375		CH04(arg0, 0, 47, z176, 0x0ca, 0, 0)	// AE_AML_OPERAND_TYPE
1376
1377		if (LNotEqual(0, \DTM2.PLDT)) {
1378			err(arg0, z176, 0x0cb, 0, 0, \DTM2.PLDT, 0)
1379		}
1380
1381		if (CondRefof(\_XT2, Local0)) {
1382			err(arg0, z176, 0x0cc, 0, 0, "\\_XT2", 1)
1383		}
1384
1385		return (0)
1386	}
1387
1388	// Implicit operand conversion of the parameters specified to be strings
1389	Method(tste, 1, Serialized)
1390	{
1391		Name(DDBH, 2)
1392		Name(SOID, "")
1393		Name(STID, "")
1394		Name(RPST, "\\")
1395		Name(PPST, "DTM2.PLDT")
1396		Name(DSTR, "01234")
1397
1398		Method(m000, 3, Serialized)
1399		{
1400			Name(DDBH, 2)
1401
1402			Store(0, \DTM2.PLDT)
1403
1404			Concatenate(arg0, "-m000.", arg0)
1405			Concatenate(arg0, Mid(DSTR, arg2, 1), arg0)
1406
1407			Switch(ToInteger (arg2)) {
1408				Case(0) {
1409					LoadTable(arg1, SOID, STID, RPST, PPST, 1)
1410					return (CH04(arg0, 0, 61, z176, 0x0d0, 0, 0))// AE_AML_STRING_LIMIT
1411				}
1412				Case(1) {
1413					Store(LoadTable(SOEM, arg1, STID, RPST, PPST, 1), DDBH)
1414				}
1415				Case(2) {
1416					Store(LoadTable(SOEM, SOID, arg1, RPST, PPST, 1), DDBH)
1417				}
1418				Case(3) {
1419					LoadTable(SOEM, SOID, STID, arg1, PPST, 1)
1420					return (CH04(arg0, 0, 30, z176, 0x0d0, 0, 0)) // AE_BAD_PATHNAME
1421				}
1422				Case(4) {
1423					LoadTable(SOEM, SOID, STID, RPST, arg1, 1)
1424					return (CH04(arg0, 0, 30, z176, 0x0d1, 0, 0)) // AE_BAD_PATHNAME
1425				}
1426			}
1427
1428			if (CH03(arg0, z176, 0x0d2, 0, 0)) {
1429				return (1)
1430			}
1431
1432			if (LNotEqual(0, \DTM2.PLDT)) {
1433				err(arg0, z176, 0x0d3, 0, 0, \DTM2.PLDT, 0)
1434				return (1)
1435			}
1436
1437			Store(ObjectType(DDBH), Local5)
1438
1439			if (CH03(arg0, z176, 0x0d4, 0, 0)) {
1440				return (1)
1441			}
1442
1443			if (LNotEqual(Local5, c009)) {	// Integer
1444				err(arg0, z176, 0x0d5, 0, 0, Local5, c009)
1445				return (1)
1446			}
1447
1448			if (LNotEqual(0, DDBH)) {
1449				err(arg0, z176, 0x0d6, 0, 0, DDBH, 0)
1450				return (1)
1451			}
1452
1453			return (0)
1454		}
1455
1456		Concatenate(arg0, "-tste", arg0)
1457
1458		if (y281) {
1459			Store(^SOID, SOID)
1460			Store(^STID, STID)
1461		}
1462
1463		// Buffer to String implicit conversion, only check that then
1464		// no exception occurs. Actually due to the conversion rule
1465		// resulting strings will not match the table fields
1466
1467		ToBuffer(SOEM, Local0)
1468		ToBuffer(SOID, Local1)
1469		ToBuffer(STID, Local2)
1470		ToBuffer(RPST, Local3)
1471		ToBuffer(PPST, Local4)
1472
1473		if (m000(arg0, Local0, 0)) {return (1)}
1474		if (m000(arg0, Local1, 1)) {return (1)}
1475		if (m000(arg0, Local2, 2)) {return (1)}
1476		if (m000(arg0, Local3, 3)) {return (1)}
1477		if (m000(arg0, Local4, 4)) {return (1)}
1478
1479		// Check consistency of the parameters
1480
1481		if (LNotEqual(ToBuffer(SOEM), Local0)) {
1482			err(arg0, z176, 0x0d7, 0, 0, Local0, ToBuffer(SOEM))
1483			return (1)
1484		}
1485
1486		if (LNotEqual(ToBuffer(SOID), Local1)) {
1487			err(arg0, z176, 0x0d8, 0, 0, Local1, ToBuffer(SOID))
1488			return (1)
1489		}
1490
1491		if (LNotEqual(ToBuffer(STID), Local2)) {
1492			err(arg0, z176, 0x0d9, 0, 0, Local2, ToBuffer(STID))
1493			return (1)
1494		}
1495
1496		if (LNotEqual(ToBuffer(RPST), Local3)) {
1497			err(arg0, z176, 0x0da, 0, 0, Local3, ToBuffer(RPST))
1498			return (1)
1499		}
1500
1501		if (LNotEqual(ToBuffer(PPST), Local4)) {
1502			err(arg0, z176, 0x0db, 0, 0, Local4, ToBuffer(PPST))
1503			return (1)
1504		}
1505
1506		// Integer to String implicit conversion
1507
1508		ToInteger(Local0, Local0)
1509		ToInteger(Local1, Local1)
1510		ToInteger(Local2, Local2)
1511		ToInteger(Local3, Local3)
1512		ToInteger(Local4, Local4)
1513
1514		if (m000(arg0, Local0, 0)) {return (1)}
1515		//if (m000(arg0, Local1, 1)) {return (1)}
1516		//if (m000(arg0, Local2, 2)) {return (1)}
1517		if (m000(arg0, Local3, 3)) {return (1)}
1518		if (m000(arg0, Local4, 4)) {return (1)}
1519
1520		// Actual trivial Buffer to String implicit conversion
1521
1522		if (y293) {
1523			if (CondRefof(\_XT2, Local0)) {
1524				err(arg0, z176, 0x0e0, 0, 0, "\\_XT2", 1)
1525				return (1)
1526			}
1527
1528			Store(0, Local0)
1529			Store(Buffer(Local0){}, Local1)
1530
1531			Store(0, \DTM2.PLDT)
1532
1533			Store(LoadTable(SOEM, Local1, Local1, RPST, PPST, 1), DDBH)
1534
1535			if (CH03(arg0, z176, 0x0e1, 0, 0)) {
1536				return (1)
1537			}
1538
1539			if (LNotEqual(1, \DTM2.PLDT)) {
1540				err(arg0, z176, 0x0e2, 0, 0, \DTM2.PLDT, 1)
1541				return (1)
1542			}
1543
1544			if (CondRefof(\_XT2, Local0)) {
1545			} else {
1546				err(arg0, z176, 0x0e3, 0, 0, "\\_XT2", 1)
1547				return (1)
1548			}
1549
1550			UnLoad(DDBH)
1551
1552			if (CH03(arg0, z176, 0x0e4, 0, 0)) {
1553				return (1)
1554			}
1555
1556			if (CondRefof(\_XT2, Local0)) {
1557				err(arg0, z176, 0x0e5, 0, 0, "\\_XT2", 1)
1558				return (1)
1559			}
1560		}
1561
1562		return (0)
1563	}
1564
1565	// LoadTable returns 0 if some SSDT matching the LoadTable
1566	// parameters is originally not listed in XSDT
1567	/*
1568	 * This test should never happen in real ASL code. So it is removed.
1569	 *
1570	 * The Load operation will add a table to global table list, which is
1571	 * the master list that can be find in XSDT.
1572	 *
1573	 * The Unload operation will just delete the namespace owned by the table,
1574	 * release OwnerId and reset the table flag, but the table remains in
1575	 * global table list.
1576	 *
1577	 * So, LoadTable after Load and UnLoad operation will cause exception.
1578	 *
1579	 * Nothing like this should happen in real ASL code. The BIOS writer
1580	 * knows whether the table is in the XSDT or not.
1581	 */
1582	/*	
1583	Method(tstf, 1)
1584	{
1585		Name(DDBH, 0)
1586
1587		Concatenate(arg0, "-tstf", arg0)
1588
1589		if (CondRefof(\_XT2, Local0)) {
1590			err(arg0, z176, 0x0f1, 0, 0, "\\_XT2", 1)
1591			return (1)
1592		}
1593
1594		Store(BUF4, RFU4)
1595		Load(RFU4, DDBH)
1596
1597		if (CH03(arg0, z176, 0x0f2, 0, 0)) {
1598			return (1)
1599		}
1600
1601		if (y260) {
1602			Store(ObjectType(DDBH), Local1)
1603			if (LNotEqual(Local1, c017)) { // DDB Handle
1604				err(arg0, z176, 0x0f3, 0, 0, Local1, c017)
1605				return (1)
1606			}
1607		}
1608
1609		if (CondRefof(\_XT2, Local0)) {
1610		} else {
1611			err(arg0, z176, 0x0f4, 0, 0, "\\_XT2", 0)
1612		}
1613
1614		UnLoad(DDBH)
1615		Store("SSDT unloaded", Debug)
1616
1617		if (CH03(arg0, z176, 0x0f5, 0, 0)) {
1618			return (1)
1619		}
1620
1621		if (CondRefof(\_XT2, Local0)) {
1622			err(arg0, z176, 0x0f6, 0, 0, "\\_XT2", 1)
1623			return (1)
1624		}
1625
1626		Store(0, \DTM2.PLDT)
1627
1628		if (y289) {
1629			LoadTable("SSDT", "iASLTS", "LTBL0001", "\\", PPST, 1)
1630		} else {
1631			Store(LoadTable("SSDT", "iASLTS", "LTBL0001", "\\", PPST, 1), DDBH)
1632		}
1633
1634		CH04(arg0, 0, 28, z176, 0x0f7, 0, 0)	// AE_BAD_PARAMETER
1635
1636		if (LNotEqual(0, \DTM2.PLDT)) {
1637			err(arg0, z176, 0x0f8, 0, 0, \DTM2.PLDT, 0)
1638		}
1639
1640		if (CondRefof(\_XT2, Local0)) {
1641			err(arg0, z176, 0x0f9, 0, 0, "\\_XT2", 1)
1642			if (y289) {
1643				// Cleanup
1644				UnLoad(DDBH)
1645			}
1646		}
1647
1648		return (0)
1649	}
1650	*/
1651
1652	// AE_OWNER_ID_LIMIT exception when too many Tables loaded
1653	Method(tstg, 1)
1654	{
1655		Concatenate(arg0, "-tstg-\\DTM0", arg0)
1656
1657		\DTM0.tsth(arg0, 1)
1658	}
1659
1660	// Exceptions when the parameter of the Loadtable operator
1661	// is of incorrect types
1662	Method(tsth, 1, Serialized)
1663	{
1664		Name(DDB0, 0)
1665		Name(DDB1, 0)
1666		Name(BTYP, Buffer(){0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0})
1667
1668		Method(m000, 4)
1669		{
1670			Concatenate(arg0, "-m000.", arg0)
1671			Concatenate(arg0, arg1, arg0)
1672
1673			Store(ObjectType(arg2), Local0)
1674			if (LNotEqual(arg3, Local0)) {
1675				err(arg0, z176, 0x100, 0, 0, Local0, arg3)
1676				return (1)
1677			}
1678
1679			LoadTable(Derefof(arg2), "", "", "\\", "\\DTM2.PLDT", 1)
1680			CH04(arg0, 0, 47, z176, 0x101, 0, 0)	// AE_AML_OPERAND_TYPE
1681
1682			return (0)
1683		}
1684
1685		Method(m001, 4)
1686		{
1687			Concatenate(arg0, "-m001.", arg0)
1688			Concatenate(arg0, arg1, arg0)
1689
1690			Store(ObjectType(arg2), Local0)
1691			if (LNotEqual(arg3, Local0)) {
1692				err(arg0, z176, 0x102, 0, 0, Local0, arg3)
1693				return (1)
1694			}
1695
1696			LoadTable("OEM1", Derefof(arg2), "", "\\", "\\DTM2.PLDT", 1)
1697			CH04(arg0, 0, 47, z176, 0x103, 0, 0)	// AE_AML_OPERAND_TYPE
1698
1699			return (0)
1700		}
1701
1702		Method(m002, 4)
1703		{
1704			Concatenate(arg0, "-m002.", arg0)
1705			Concatenate(arg0, arg1, arg0)
1706
1707			Store(ObjectType(arg2), Local0)
1708			if (LNotEqual(arg3, Local0)) {
1709				err(arg0, z176, 0x104, 0, 0, Local0, arg3)
1710				return (1)
1711			}
1712
1713			LoadTable("OEM1", "", Derefof(arg2), "\\", "\\DTM2.PLDT", 1)
1714			CH04(arg0, 0, 47, z176, 0x105, 0, 0)	// AE_AML_OPERAND_TYPE
1715
1716			return (0)
1717		}
1718
1719		Method(m003, 4)
1720		{
1721			Concatenate(arg0, "-m003.", arg0)
1722			Concatenate(arg0, arg1, arg0)
1723
1724			Store(ObjectType(arg2), Local0)
1725			if (LNotEqual(arg3, Local0)) {
1726				err(arg0, z176, 0x106, 0, 0, Local0, arg3)
1727				return (1)
1728			}
1729
1730			LoadTable("OEM1", "", "", Derefof(arg2), "\\DTM2.PLDT", 1)
1731			if (Derefof(Index(BTYP, arg3))) {
1732				CH04(arg0, 0, 30, z176, 0x107, 0, 0) // AE_BAD_PATHNAME
1733			} else {
1734				CH04(arg0, 0, 47, z176, 0x108, 0, 0) // AE_AML_OPERAND_TYPE
1735			}
1736
1737			return (0)
1738		}
1739
1740		Method(m004, 4)
1741		{
1742			Concatenate(arg0, "-m004.", arg0)
1743			Concatenate(arg0, arg1, arg0)
1744
1745			Store(ObjectType(arg2), Local0)
1746			if (LNotEqual(arg3, Local0)) {
1747				err(arg0, z176, 0x109, 0, 0, Local0, arg3)
1748				return (1)
1749			}
1750
1751			LoadTable("OEM1", "", "", "\\", Derefof(arg2), 1)
1752			if (Derefof(Index(BTYP, arg3))) {
1753				CH04(arg0, 0, 30, z176, 0x10a, 0, 0) // AE_BAD_PATHNAME
1754			} else {
1755				CH04(arg0, 0, 47, z176, 0x10b, 0, 0) // AE_AML_OPERAND_TYPE
1756			}
1757
1758			return (0)
1759		}
1760
1761		Concatenate(arg0, "-tsth", arg0)
1762
1763		// Load Auxiliry table
1764		Store(\DTM0.BUF3, \DTM0.RFU3)
1765		Load(\DTM0.RFU3, DDB0)
1766
1767		if (CH03(arg0, z176, 0x10c, 0, 0)) {
1768			return (1)
1769		}
1770
1771		// Uninitialized
1772		if (0) {
1773			Store(0, Local1)
1774		}
1775		Store(ObjectType(Local1), Local0)
1776		if (LNotEqual(c008, Local0)) {
1777			err(arg0, z176, 0x10d, 0, 0, Local0, c008)
1778		} else {
1779			LoadTable(Local1, "", "", "\\", "\\DTM2.PLDT", 1)
1780			if (SLCK) {
1781				CH04(arg0, 0, 61, z176, 0x10e, 0, 0) // AE_AML_STRING_LIMIT
1782			} else {
1783				CH04(arg0, 0, 49, z176, 0x10e, 0, 0) // AE_AML_UNINITIALIZED_LOCAL
1784			}
1785			LoadTable("OEM1", Local1, "", "\\", "\\DTM2.PLDT", 1)
1786			if (SLCK) {
1787				CH04(arg0, 0, 61, z176, 0x10f, 0, 0) // AE_AML_STRING_LIMIT
1788			} else {
1789				CH04(arg0, 0, 49, z176, 0x10f, 0, 0) // AE_AML_UNINITIALIZED_LOCAL
1790			}
1791			LoadTable("OEM1", "", Local1, "\\", "\\DTM2.PLDT", 1)
1792			if (SLCK) {
1793				// ACPI_OEM_TABLE_ID_SIZE should be less than 8.
1794				// The size of the "Integer" converted from "Any" is ISZ0*2.
1795				if (LLessEqual(ISZ0, 4)) {
1796					CH03(arg0, z176, 0x110, 0, 0) // No exception
1797				} else {
1798					CH04(arg0, 0, 61, z176, 0x110, 0, 0) // AE_AML_STRING_LIMIT
1799				}
1800			} else {
1801				CH04(arg0, 0, 49, z176, 0x110, 0, 0) // AE_AML_UNINITIALIZED_LOCAL
1802			}
1803			LoadTable("OEM1", "", "", Local1, "\\DTM2.PLDT", 1)
1804			if (SLCK) {
1805				CH04(arg0, 0, 30, z176, 0x111, 0, 0) // AE_BAD_PATHNAME
1806			} else {
1807				CH04(arg0, 0, 49, z176, 0x111, 0, 0) // AE_AML_UNINITIALIZED_LOCAL
1808			}
1809			LoadTable("OEM1", "", "", "\\", Local1, 1)
1810			if (SLCK) {
1811				CH04(arg0, 0, 30, z176, 0x112, 0, 0) // AE_BAD_PATHNAME
1812			} else {
1813				CH04(arg0, 0, 49, z176, 0x112, 0, 0) // AE_AML_UNINITIALIZED_LOCAL
1814			}
1815		}
1816
1817		// Integer
1818		m003(arg0, "int", Refof(\AUXD.INT0), c009)
1819		m004(arg0, "int", Refof(\AUXD.INT0), c009)
1820
1821		// String
1822		m003(arg0, "str", Refof(\AUXD.STR0), c00a)
1823		m004(arg0, "str", Refof(\AUXD.STR0), c00a)
1824
1825		// Buffer
1826		m003(arg0, "buf", Refof(\AUXD.BUF0), c00b)
1827		m004(arg0, "buf", Refof(\AUXD.BUF0), c00b)
1828
1829		// Package
1830		if (y286) {
1831			m000(arg0, "pac", Refof(\AUXD.PAC0), c00c)
1832			m001(arg0, "pac", Refof(\AUXD.PAC0), c00c)
1833			m002(arg0, "pac", Refof(\AUXD.PAC0), c00c)
1834			m003(arg0, "pac", Refof(\AUXD.PAC0), c00c)
1835			m004(arg0, "pac", Refof(\AUXD.PAC0), c00c)
1836		}
1837		LoadTable(\AUXD.PAC0, "", "", "\\", "\\DTM2.PLDT", 1)
1838		CH04(arg0, 0, 47, z176, 0x113, 0, 0)	// AE_AML_OPERAND_TYPE
1839		LoadTable("OEM1", \AUXD.PAC0, "", "\\", "\\DTM2.PLDT", 1)
1840		CH04(arg0, 0, 47, z176, 0x114, 0, 0)	// AE_AML_OPERAND_TYPE
1841		LoadTable("OEM1", "", \AUXD.PAC0, "\\", "\\DTM2.PLDT", 1)
1842		CH04(arg0, 0, 47, z176, 0x115, 0, 0)	// AE_AML_OPERAND_TYPE
1843		LoadTable("OEM1", "", "", \AUXD.PAC0, "\\DTM2.PLDT", 1)
1844		CH04(arg0, 0, 47, z176, 0x116, 0, 0) // AE_AML_OPERAND_TYPE
1845		LoadTable("OEM1", "", "", "\\", \AUXD.PAC0, 1)
1846		CH04(arg0, 0, 47, z176, 0x117, 0, 0) // AE_AML_OPERAND_TYPE
1847		Store(ObjectType(\AUXD.PAC0), Local0)
1848		if (LNotEqual(c00c, Local0)) {
1849			err(arg0, z176, 0x118, 0, 0, Local0, c00c)
1850		}
1851
1852		// Field Unit
1853		m003(arg0, "flu", Refof(\AUXD.FLU0), c00d)
1854		m004(arg0, "flu", Refof(\AUXD.FLU0), c00d)
1855
1856		// Device
1857		LoadTable(\AUXD.DEV0, "", "", "\\", "\\DTM2.PLDT", 1)
1858		CH04(arg0, 0, 47, z176, 0x119, 0, 0)	// AE_AML_OPERAND_TYPE
1859		LoadTable("OEM1", \AUXD.DEV0, "", "\\", "\\DTM2.PLDT", 1)
1860		CH04(arg0, 0, 47, z176, 0x11a, 0, 0)	// AE_AML_OPERAND_TYPE
1861		LoadTable("OEM1", "", \AUXD.DEV0, "\\", "\\DTM2.PLDT", 1)
1862		CH04(arg0, 0, 47, z176, 0x11b, 0, 0)	// AE_AML_OPERAND_TYPE
1863		LoadTable("OEM1", "", "", \AUXD.DEV0, "\\DTM2.PLDT", 1)
1864		CH04(arg0, 0, 47, z176, 0x11c, 0, 0) // AE_AML_OPERAND_TYPE
1865		LoadTable("OEM1", "", "", "\\", \AUXD.DEV0, 1)
1866		CH04(arg0, 0, 47, z176, 0x11d, 0, 0) // AE_AML_OPERAND_TYPE
1867		Store(ObjectType(\AUXD.DEV0), Local0)
1868		if (LNotEqual(c00e, Local0)) {
1869			err(arg0, z176, 0x11e, 0, 0, Local0, c00e)
1870		}
1871
1872		// Event
1873		m000(arg0, "evt", Refof(\AUXD.EVE0), c00f)
1874		m001(arg0, "evt", Refof(\AUXD.EVE0), c00f)
1875		m002(arg0, "evt", Refof(\AUXD.EVE0), c00f)
1876		m003(arg0, "evt", Refof(\AUXD.EVE0), c00f)
1877		m004(arg0, "evt", Refof(\AUXD.EVE0), c00f)
1878
1879		// Method
1880		m000(arg0, "met", Refof(\AUXD.MMM0), c010)
1881		m001(arg0, "met", Refof(\AUXD.MMM0), c010)
1882		m002(arg0, "met", Refof(\AUXD.MMM0), c010)
1883		m003(arg0, "met", Refof(\AUXD.MMM0), c010)
1884		m004(arg0, "met", Refof(\AUXD.MMM0), c010)
1885
1886		// Mutex
1887		m000(arg0, "mtx", Refof(\AUXD.MTX0), c011)
1888		m001(arg0, "mtx", Refof(\AUXD.MTX0), c011)
1889		m002(arg0, "mtx", Refof(\AUXD.MTX0), c011)
1890		m003(arg0, "mtx", Refof(\AUXD.MTX0), c011)
1891		m004(arg0, "mtx", Refof(\AUXD.MTX0), c011)
1892
1893		// OpRegion
1894		m000(arg0, "opr", Refof(\AUXD.OPR0), c012)
1895		m001(arg0, "opr", Refof(\AUXD.OPR0), c012)
1896		m002(arg0, "opr", Refof(\AUXD.OPR0), c012)
1897		m003(arg0, "opr", Refof(\AUXD.OPR0), c012)
1898		m004(arg0, "opr", Refof(\AUXD.OPR0), c012)
1899
1900		// Power Resource
1901		m000(arg0, "pwr", Refof(\AUXD.PWR0), c013)
1902		m001(arg0, "pwr", Refof(\AUXD.PWR0), c013)
1903		m002(arg0, "pwr", Refof(\AUXD.PWR0), c013)
1904		m003(arg0, "pwr", Refof(\AUXD.PWR0), c013)
1905		m004(arg0, "pwr", Refof(\AUXD.PWR0), c013)
1906
1907		// Processor
1908		m000(arg0, "cpu", Refof(\AUXD.CPU0), c014)
1909		m001(arg0, "cpu", Refof(\AUXD.CPU0), c014)
1910		m002(arg0, "cpu", Refof(\AUXD.CPU0), c014)
1911		m003(arg0, "cpu", Refof(\AUXD.CPU0), c014)
1912		m004(arg0, "cpu", Refof(\AUXD.CPU0), c014)
1913
1914		// Thermal Zone
1915		LoadTable(\AUXD.TZN0, "", "", "\\", "\\DTM2.PLDT", 1)
1916		CH04(arg0, 0, 47, z176, 0x120, 0, 0)	// AE_AML_OPERAND_TYPE
1917		LoadTable("OEM1", \AUXD.TZN0, "", "\\", "\\DTM2.PLDT", 1)
1918		CH04(arg0, 0, 47, z176, 0x121, 0, 0)	// AE_AML_OPERAND_TYPE
1919		LoadTable("OEM1", "", \AUXD.TZN0, "\\", "\\DTM2.PLDT", 1)
1920		CH04(arg0, 0, 47, z176, 0x122, 0, 0)	// AE_AML_OPERAND_TYPE
1921		LoadTable("OEM1", "", "", \AUXD.TZN0, "\\DTM2.PLDT", 1)
1922		CH04(arg0, 0, 47, z176, 0x123, 0, 0) // AE_AML_OPERAND_TYPE
1923		LoadTable("OEM1", "", "", "\\", \AUXD.TZN0, 1)
1924		CH04(arg0, 0, 47, z176, 0x124, 0, 0) // AE_AML_OPERAND_TYPE
1925		Store(ObjectType(\AUXD.TZN0), Local0)
1926		if (LNotEqual(c015, Local0)) {
1927			err(arg0, z176, 0x125, 0, 0, Local0, c015)
1928		}
1929
1930		// Buffer Field
1931		m003(arg0, "bfl", Refof(\AUXD.BFL0), c016)
1932		m004(arg0, "bfl", Refof(\AUXD.BFL0), c016)
1933
1934		UnLoad(DDB0)
1935
1936		CH03(arg0, z176, 0x126, 0, 0)
1937
1938		return (0)
1939	}
1940
1941	// Exceptions when the ParameterData parameter of the Loadtable operator
1942	// can not be saved into the Object referred by ParameterPathString
1943	Method(tsti, 1, Serialized)
1944	{
1945		Name(DDB0, 0)
1946		Name(DDB1, 0)
1947
1948		Concatenate(arg0, "-tsti", arg0)
1949
1950		// Load Auxiliry table
1951		Store(\DTM0.BUF3, \DTM0.RFU3)
1952		Load(\DTM0.RFU3, DDB0)
1953
1954		if (CH03(arg0, z176, 0x130, 0, 0)) {
1955			return (1)
1956		}
1957
1958		// Uninitialized
1959		if (0) {
1960			Store(0, Local1)
1961		}
1962		Store(ObjectType(Local1), Local0)
1963		if (LNotEqual(c008, Local0)) {
1964			err(arg0, z176, 0x131, 0, 0, Local0, c008)
1965		} else {
1966// Bug 288: iASL unexpectedly forbids ParameterData of Loadtable to be LocalX or UserTerm
1967/*
1968			LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", Local1)
1969			if (SLCK) {
1970				CH04(arg0, 0, 47, z176, 0x132, 0, 0) // AE_AML_OPERAND_TYPE
1971			} else {
1972				CH04(arg0, 0, 49, z176, 0x132, 0, 0) // AE_AML_UNINITIALIZED_LOCAL
1973			}
1974*/
1975		}
1976
1977		// Integer
1978		Store(ObjectType(\DTM2.PLDT), Local0)
1979		if (LNotEqual(c009, Local0)) {
1980			err(arg0, z176, 0x133, 0, 0, Local0, c009)
1981			return (1)
1982		}
1983		Store(LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.INT0), DDB1)
1984		if (CH03(arg0, z176, 0x134, 0, 0)) {
1985			return (1)
1986		}
1987		Store(ObjectType(\DTM2.PLDT), Local0)
1988		if (LNotEqual(c009, Local0)) {
1989			err(arg0, z176, 0x135, 0, 0, Local0, c009)
1990			return (1)
1991		}
1992		if (LNotEqual(\DTM2.PLDT, \AUXD.INT0)) {
1993			err(arg0, z176, 0x136, 0, 0, \DTM2.PLDT, \AUXD.INT0)
1994			return (1)
1995		}
1996		Unload(DDB1)
1997		if (CH03(arg0, z176, 0x137, 0, 0)) {
1998			return (1)
1999		}
2000		Store(ObjectType(\AUXD.INT0), Local0)
2001		if (LNotEqual(c009, Local0)) {
2002			err(arg0, z176, 0x138, 0, 0, Local0, c009)
2003		}
2004
2005		// String
2006	if (y296) {
2007		Store(ObjectType(\DTM2.PLDT), Local0)
2008		if (LNotEqual(c009, Local0)) {
2009			err(arg0, z176, 0x139, 0, 0, Local0, c009)
2010			return (1)
2011		}
2012		Store(LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.STR0), DDB1)
2013		if (CH03(arg0, z176, 0x13a, 0, 0)) {
2014			return (1)
2015		}
2016		Store(ObjectType(\DTM2.PLDT), Local0)
2017		if (LNotEqual(c009, Local0)) {
2018			err(arg0, z176, 0x13b, 0, 0, Local0, c009)
2019			return (1)
2020		}
2021		if (LNotEqual(\DTM2.PLDT, \AUXD.STR0)) {
2022			err(arg0, z176, 0x13c, 0, 0, \DTM2.PLDT, \AUXD.STR0)
2023			return (1)
2024		}
2025		Unload(DDB1)
2026		if (CH03(arg0, z176, 0x13d, 0, 0)) {
2027			return (1)
2028		}
2029		Store(ObjectType(\AUXD.STR0), Local0)
2030		if (LNotEqual(c00a, Local0)) {
2031			err(arg0, z176, 0x13e, 0, 0, Local0, c00a)
2032		}
2033	}
2034
2035		// Buffer
2036	if (y296) {
2037		Store(ObjectType(\DTM2.PLDT), Local0)
2038		if (LNotEqual(c009, Local0)) {
2039			err(arg0, z176, 0x13f, 0, 0, Local0, c009)
2040			return (1)
2041		}
2042		Store(LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.BUF0), DDB1)
2043		if (CH03(arg0, z176, 0x140, 0, 0)) {
2044			return (1)
2045		}
2046		Store(ObjectType(\DTM2.PLDT), Local0)
2047		if (LNotEqual(c009, Local0)) {
2048			err(arg0, z176, 0x141, 0, 0, Local0, c009)
2049			return (1)
2050		}
2051		if (LNotEqual(\DTM2.PLDT, \AUXD.BUF0)) {
2052			err(arg0, z176, 0x142, 0, 0, \DTM2.PLDT, \AUXD.BUF0)
2053			return (1)
2054		}
2055		Unload(DDB1)
2056		if (CH03(arg0, z176, 0x143, 0, 0)) {
2057			return (1)
2058		}
2059		Store(ObjectType(\AUXD.BUF0), Local0)
2060		if (LNotEqual(c00b, Local0)) {
2061			err(arg0, z176, 0x144, 0, 0, Local0, c00b)
2062		}
2063	}
2064
2065		// Package
2066		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.PAC0)
2067		CH04(arg0, 0, 47, z176, 0x145, 0, 0)	// AE_AML_OPERAND_TYPE
2068		Store(ObjectType(\AUXD.PAC0), Local0)
2069		if (LNotEqual(c00c, Local0)) {
2070			err(arg0, z176, 0x146, 0, 0, Local0, c00c)
2071		}
2072
2073		// Field Unit
2074	if (y296) {
2075		Store(ObjectType(\DTM2.PLDT), Local0)
2076		if (LNotEqual(c009, Local0)) {
2077			err(arg0, z176, 0x147, 0, 0, Local0, c009)
2078			return (1)
2079		}
2080		Store(LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.FLU0), DDB1)
2081		if (CH03(arg0, z176, 0x148, 0, 0)) {
2082			return (1)
2083		}
2084		Store(ObjectType(\DTM2.PLDT), Local0)
2085		if (LNotEqual(c009, Local0)) {
2086			err(arg0, z176, 0x149, 0, 0, Local0, c009)
2087			return (1)
2088		}
2089		if (LNotEqual(\DTM2.PLDT, \AUXD.FLU0)) {
2090			err(arg0, z176, 0x14a, 0, 0, \DTM2.PLDT, \AUXD.FLU0)
2091			return (1)
2092		}
2093		Unload(DDB1)
2094		if (CH03(arg0, z176, 0x14b, 0, 0)) {
2095			return (1)
2096		}
2097		Store(ObjectType(\AUXD.FLU0), Local0)
2098		if (LNotEqual(c00d, Local0)) {
2099			err(arg0, z176, 0x14c, 0, 0, Local0, c00d)
2100		}
2101	}
2102
2103		// Device
2104		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.DEV0)
2105		CH04(arg0, 0, 47, z176, 0x14d, 0, 0)	// AE_AML_OPERAND_TYPE
2106		Store(ObjectType(\AUXD.DEV0), Local0)
2107		if (LNotEqual(c00e, Local0)) {
2108			err(arg0, z176, 0x14e, 0, 0, Local0, c00e)
2109		}
2110
2111		// Event
2112		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.EVE0)
2113		CH04(arg0, 0, 47, z176, 0x14f, 0, 0)	// AE_AML_OPERAND_TYPE
2114		Store(ObjectType(\AUXD.EVE0), Local0)
2115		if (LNotEqual(c00f, Local0)) {
2116			err(arg0, z176, 0x150, 0, 0, Local0, c00f)
2117		}
2118
2119		// Method
2120		if (y288) {
2121			LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.MMM0)
2122			CH04(arg0, 0, 47, z176, 0x151, 0, 0)	// AE_AML_OPERAND_TYPE
2123			Store(ObjectType(\AUXD.MMM0), Local0)
2124			if (LNotEqual(c010, Local0)) {
2125				err(arg0, z176, 0x152, 0, 0, Local0, c010)
2126			}
2127		}
2128
2129		// Mutex
2130		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.MTX0)
2131		CH04(arg0, 0, 47, z176, 0x153, 0, 0)	// AE_AML_OPERAND_TYPE
2132		Store(ObjectType(\AUXD.MTX0), Local0)
2133		if (LNotEqual(c011, Local0)) {
2134			err(arg0, z176, 0x154, 0, 0, Local0, c011)
2135		}
2136
2137		// OpRegion
2138		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.OPR0)
2139		CH04(arg0, 0, 47, z176, 0x155, 0, 0)	// AE_AML_OPERAND_TYPE
2140		Store(ObjectType(\AUXD.OPR0), Local0)
2141		if (LNotEqual(c012, Local0)) {
2142			err(arg0, z176, 0x156, 0, 0, Local0, c012)
2143		}
2144
2145		// Power Resource
2146		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.PWR0)
2147		CH04(arg0, 0, 47, z176, 0x157, 0, 0)	// AE_AML_OPERAND_TYPE
2148		Store(ObjectType(\AUXD.PWR0), Local0)
2149		if (LNotEqual(c013, Local0)) {
2150			err(arg0, z176, 0x158, 0, 0, Local0, c013)
2151		}
2152
2153		// Processor
2154		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.CPU0)
2155		CH04(arg0, 0, 47, z176, 0x159, 0, 0)	// AE_AML_OPERAND_TYPE
2156		Store(ObjectType(\AUXD.CPU0), Local0)
2157		if (LNotEqual(c014, Local0)) {
2158			err(arg0, z176, 0x15a, 0, 0, Local0, c014)
2159		}
2160
2161		// Thermal Zone
2162		LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.TZN0)
2163		CH04(arg0, 0, 47, z176, 0x15b, 0, 0)	// AE_AML_OPERAND_TYPE
2164		Store(ObjectType(\AUXD.TZN0), Local0)
2165		if (LNotEqual(c015, Local0)) {
2166			err(arg0, z176, 0x15c, 0, 0, Local0, c015)
2167		}
2168
2169		// Buffer Field
2170	if (y296) {
2171		Store(ObjectType(\DTM2.PLDT), Local0)
2172		if (LNotEqual(c009, Local0)) {
2173			err(arg0, z176, 0x15d, 0, 0, Local0, c009)
2174			return (1)
2175		}
2176		Store(LoadTable("OEM1", "", "", "\\", "\\DTM2.PLDT", \AUXD.BFL0), DDB1)
2177		if (CH03(arg0, z176, 0x15e, 0, 0)) {
2178			return (1)
2179		}
2180		Store(ObjectType(\DTM2.PLDT), Local0)
2181		if (LNotEqual(c009, Local0)) {
2182			err(arg0, z176, 0x15f, 0, 0, Local0, c009)
2183			return (1)
2184		}
2185		if (LNotEqual(\DTM2.PLDT, \AUXD.BFL0)) {
2186			err(arg0, z176, 0x160, 0, 0, \DTM2.PLDT, \AUXD.BFL0)
2187			return (1)
2188		}
2189		Unload(DDB1)
2190		if (CH03(arg0, z176, 0x161, 0, 0)) {
2191			return (1)
2192		}
2193		Store(ObjectType(\AUXD.BFL0), Local0)
2194		if (LNotEqual(c016, Local0)) {
2195			err(arg0, z176, 0x162, 0, 0, Local0, c016)
2196		}
2197	}
2198
2199		UnLoad(DDB0)
2200
2201		CH03(arg0, z176, 0x163, 0, 0)
2202
2203		return (0)
2204	}
2205}
2206
2207Method(TLT0,, Serialized)
2208{
2209	Name(ts, "TLT0")
2210
2211	CH03(ts, z176, 0x200, 0, 0)
2212
2213	// Simple Loadtable test
2214	SRMT("TLT0.tst0")
2215	\DTM2.tst0(ts)
2216
2217	CH03(ts, z176, 0x201, 0, 0)
2218
2219	// All comparisons of Loadtable parameters are case sensitive,
2220	// if no table matches the specified parameters, then 0 is returned
2221	SRMT("TLT0.tst1")
2222	\DTM2.tst1(ts)
2223
2224	CH03(ts, z176, 0x202, 0, 0)
2225
2226	// Any of the RootPathString, ParameterPathString, and ParameterData
2227	// parameters in LoadTable expression can be omitted
2228	SRMT("TLT0.tst2")
2229	\DTM2.tst2(ts)
2230
2231	CH03(ts, z176, 0x203, 0, 0)
2232
2233	// Different sources of the String parameters: Named Objects, LocalX,
2234	// ArgX, elements of Packages, results of functions, any TermArg
2235	SRMT("TLT0.tst3")
2236	\DTM2.tst3(ts)
2237
2238	CH03(ts, z176, 0x204, 0, 0)
2239
2240	// Different sources of the optional parameters (RootPathString,
2241	// ParameterPathString, and ParameterData): Named Objects, LocalX,
2242	// ArgX, elements of Packages, results of functions, any TermArg
2243	SRMT("TLT0.tst4")
2244	\DTM2.tst4(ts)
2245
2246	CH03(ts, z176, 0x205, 0, 0)
2247
2248	// Namespace location to load the Definition Block is determined
2249	// by the RootPathString parameter of Loadtable
2250	SRMT("TLT0.tst5.0")
2251	\DTM2.tst5(ts, "\\DTM2.DEVR")
2252
2253	CH03(ts, z176, 0x206, 0, 0)
2254
2255	// The RootPathString value is evaluated using normal scoping rules,
2256	// assuming that the scope of the LoadTable operator is the current
2257	// scope
2258	SRMT("TLT0.tst5.1")
2259	\DTM2.tst5(ts, "^DEVR")
2260
2261	CH03(ts, z176, 0x207, 0, 0)
2262
2263	// "\" is assumed to be Namespace location to load the Definition
2264	// Block if RootPathString parameter is not specified
2265	SRMT("TLT0.tst6")
2266	\DTM2.tst6(ts)
2267
2268	CH03(ts, z176, 0x208, 0, 0)
2269
2270	// If the first character of ParameterPathString is a backslash
2271	// or caret character, then the path of the object set up on success
2272	// is ParameterPathString. It is RootPathString.ParameterPathString
2273	// in any case.
2274	SRMT("TLT0.tst7")
2275	\DTM2.tst7(ts)
2276
2277	CH03(ts, z176, 0x209, 0, 0)
2278
2279	// Implicit operand conversion of the parameters specified to be strings
2280	SRMT("TLT0.tste")
2281	\DTM2.tste(ts)
2282
2283	CH03(ts, z176, 0x20a, 0, 0)
2284
2285	// LoadTable returns 0 if some SSDT matching the LoadTable
2286	// parameters is originally not listed in XSDT
2287	//SRMT("TLT0.tstf")
2288	//\DTM2.tstf(ts)
2289
2290	CH03(ts, z176, 0x20b, 0, 0)
2291}
2292
2293// Exceptional conditions
2294Method(TLT1,, Serialized)
2295{
2296	Name(ts, "TLT1")
2297
2298	// Exceptions when the SignatureString is greater than four characters,
2299	// the OEMIDString is greater than six characters, or the OEMTableID is
2300	// greater than eight characters
2301	SRMT("TLT1.tst8")
2302	\DTM2.tst8(ts)
2303
2304	// Exceptions when some DSDT or SSDT matching the LoadTable parameters
2305	// is already loaded (actually on initial loading of tables listed in XSDT)
2306	SRMT("TLT1.tst9")
2307	\DTM2.tst9(ts)
2308
2309	// Exceptions when the matched table is already loaded
2310	SRMT("TLT1.tsta")
2311	\DTM2.tsta(ts)
2312
2313	// Exceptions when there already is an previously loaded Object
2314	// referred by the path in the Namespace
2315	SRMT("TLT1.tstb")
2316	\DTM2.tstb(ts)
2317
2318	// Exceptions when the object specified by the ParameterPathString
2319	// does not exist
2320	SRMT("TLT1.tstc")
2321	\DTM2.tstc(ts)
2322
2323	// Exceptions when storing of data of the ParameterData data type
2324	// to the specified object is not allowed.
2325	SRMT("TLT1.tstd")
2326	\DTM2.tstd(ts)
2327
2328	// AE_OWNER_ID_LIMIT exception when too many Tables loaded
2329	SRMT("TLT1.tstg")
2330	if (y294) {
2331		\DTM2.tstg(ts)
2332	} else {
2333		BLCK()
2334	}
2335
2336	// Exceptions when the parameter of the Loadtable operator
2337	// is of incorrect types
2338	SRMT("TLT1.tsth")
2339	\DTM2.tsth(ts)
2340
2341	// Exceptions when the ParameterData parameter of the Loadtable operator
2342	// can not be saved into the Object referred by ParameterPathString
2343	SRMT("TLT1.tsti")
2344	\DTM2.tsti(ts)
2345}
2346