• 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 * Load ASL operator functionality
31 */
32
33/*
34 * This sub-test is intended to comprehensively verify
35 * the Load ASL operator functionality.
36 *
37 * Performs a run-time load of a Definition Block.
38 *
39 *    17.5.67   Load (Load Definition Block)
40 *    Syntax
41 * Load (Object, DDBHandle)
42 *
43 * On testing the following issues should be covered:
44 *
45 * - loading SSDT from a SystemMemory OpRegion,
46 *
47 * - loading SSDT from a Region Field in a OpRegion of any type,
48 *
49 * - "namespace location to load the Definition Block is relative
50 *   to the current namespace" scope,
51 *
52 * - loading a number of different SSDTs,
53 *
54 * - global and dynamic declarations of OpRegions and the appropriate
55 *   _REG Methods invocation for the loaded SSDT,
56 *
57 * - global and dynamic declarations of OpRegions and Region Fields,
58 *   containing the loaded SSDT,
59 *
60 * - an Object of any type can be used as the DDBHandle argument,
61 *
62 * - the DDBHandle argument of the Load operator becames an Object
63 *   of the DDBHandle type,
64 *
65 * - the DDBHandle Object returned from the Load operator can be used
66 *   to unload the SSDT,
67 *
68 * - exceptional conditions caused by inappropriate data:
69 *   = the Object argument does not refer to an operation region field
70 *     or an operation region,
71 *   = an OpRegion passed as the Object argument is not of SystemMemory type,
72 *   = the table contained in an OpRegion (Field) is not an SSDT,
73 *   = the length of the supplied SSDT is greater than the length of the
74 *     respective OpRegion or Region Field,
75 *   = the length of the supplied SSDT is less than the length the Header
76 *   = the checksum of the supplied SSDT is invalid,
77 *   = AE_OWNER_ID_LIMIT exception when too many Tables loaded,
78 *   = the specified SSDT is already loaded,
79 *   = there already is an previously loaded Object referred by the path
80 *     in the Namespace.
81 *
82 * Can not be tested following issues:
83 * - providing of the table referenced by Load to be "in memory marked by
84 *   AddressRangeReserved or AddressRangeNVS",
85 * - overriding the supplied SSDT with "a newer revision Definition Block
86 *   of the same OEM Table ID" by the OS,
87 * - loading a SSDT to be a synchronous operation ("the control methods
88 *   defined in the Definition Block are not executed during load time")
89 */
90
91		// Integer
92		External(\AUXD.INT0)
93		// String
94		External(\AUXD.STR0)
95		// Buffer
96		External(\AUXD.BUF0)
97		// Package
98		External(\AUXD.PAC0)
99		// Device
100		External(\AUXD.DEV0)
101		// Event
102		External(\AUXD.EVE0)
103		// Method
104		External(\AUXD.MMM0)
105		// Mutex
106		External(\AUXD.MTX0)
107		// Power Resource
108		External(\AUXD.PWR0)
109		// Processor
110		External(\AUXD.CPU0)
111		// Thermal Zone
112		External(\AUXD.TZN0)
113		// Buffer Field
114		External(\AUXD.BFL0)
115		// Field Unit
116		External(\AUXD.FLU0)
117		// OpRegion
118		External(\AUXD.OPR0)
119		
120Name(z174, 174)
121
122Device(DTM0) {
123
124	// Originated from ssdt0.asl: iasl -tc ssdt0.asl
125	Name(BUF0, Buffer() {
126		0x53,0x53,0x44,0x54,0x34,0x00,0x00,0x00,  /* 00000000    "SSDT4..." */
127		0x02,0x98,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    "..Intel." */
128		0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
129		0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
130		0x15,0x12,0x06,0x20,0x14,0x0F,0x5C,0x53,  /* 00000020    "... ..\S" */
131		0x53,0x53,0x30,0x00,0xA4,0x0D,0x5C,0x53,  /* 00000028    "SS0...\S" */
132		0x53,0x53,0x30,0x00,
133	})
134
135	Name (SNML, "0123456789ABCDEF")
136	Name (NNML, 16) // <= sizeof (SNML)
137
138	// Take into account AE_OWNER_ID_LIMIT
139	Name (HI0M, 256) // <= (NNML * NNML)
140
141	Name (HI0P, Package(HI0M){})
142	Name (HI0N, 0)
143	Name (INIF, 0x00)
144
145	OperationRegion (IST0, SystemMemory, 0, 0x34)
146
147	Field(IST0, ByteAcc, NoLock, Preserve) {
148		RFU0, 0x1a0,
149	}
150
151	Field(IST0, ByteAcc, NoLock, Preserve) {
152		SIG, 32,
153		LENG, 32,
154		REV, 8,
155		SUM, 8,
156		OID, 48,
157		OTID, 64,
158		OREV, 32,
159		CID, 32,
160		CREV, 32,
161		Offset(39),
162		SSNM, 32
163	}
164
165	// components/utilities/utmisc.c AcpiUtGenerateChecksum() analog
166	Method(CHSM, 2, Serialized)	// buf, len
167	{
168		Name(lpN0, 0)
169		Name(lpC0, 0)
170
171		Store(0, Local0) // sum
172
173		Store(arg1, lpN0)
174		Store(0, lpC0)
175
176		While(lpN0) {
177			Store(DeRefOf(Index(arg0, lpC0)), Local1)
178			Add(Local0, Local1, Local0)
179			Mod(Local0, 0x100, Local0)
180			Decrement(lpN0)
181			Increment(lpC0)
182		}
183
184		Subtract(0, Local0, Local0)
185		Mod(Local0, 0x100, Local0)
186
187		Store("checksum", Debug)
188		Store(Local0, Debug)
189
190		return (Local0)
191	}
192
193	// Initializes multiple Tables Load test
194	Method(INIT)
195	{
196		Store(Sizeof(SNML), Local0)
197		if (LGreater(NNML, Local0)) {
198			Store(Concatenate("INIT: test error, check NNML <= Sizeof(SNML):",
199				ToDecimalString(Local0)), Debug)
200			Return (1)
201		}
202		Multiply(Local0, Local0, Local0)
203		if (LGreater(HI0M, Local0)) {
204			Store(Concatenate("INIT: test error, check HI0M <= 0x",
205				Local0), Debug)
206			Return (1)
207		}
208
209		if (INIF) {
210			Store("INIT: OpRegion has been initialized previously", Debug)
211			Return (1)
212		}
213
214		Store(BUF0, RFU0)
215		Store(1, INIF)
216		Store("INIT: OpRegion initialized with SSDT", Debug)
217
218		Return (0)
219	}
220
221	// Prepares and Loads the next Table of multiple Tables Load test
222	Method(LD,, Serialized)
223	{
224		if (LNot(LLess(HI0N, HI0M))) {
225			Store("LD: too many tables loaded", Debug)
226			Return (1)
227		}
228		
229		Multiply(HI0N, 0x30, Local2)
230		
231		OperationRegion (IST0, SystemMemory, Local2, 0x34)
232
233		Field(IST0, ByteAcc, NoLock, Preserve) {
234			RFU0, 0x1a0,
235		}
236
237		Field(IST0, ByteAcc, NoLock, Preserve) {
238			SIG, 32,
239			LENG, 32,
240			REV, 8,
241			SUM, 8,
242			OID, 48,
243			OTID, 64,
244			OREV, 32,
245			CID, 32,
246			CREV, 32,
247			Offset(39),
248			SSNM, 32,
249			Offset(47),
250			SSRT, 32
251		}
252
253		Store(BUF0, RFU0)
254
255		// Modify Revision field of SSDT
256		Store(Add(CREV, 1), CREV)
257
258		// Modify SSNM Object Name
259		Divide(HI0N, NNML, Local0, Local1)
260		Store(Derefof(Index(SNML, Local1)), Local1)
261		ShiftLeft(Local1, 16, Local1)
262		Store(Derefof(Index(SNML, Local0)), Local0)
263		ShiftLeft(Local0, 24, Local0)
264		Add(Local0, Local1, Local0)
265		Add(Local0, 0x5353, Local0)
266		Store(Local0, SSNM)
267		Store(SSNM, Debug)
268
269		// Modify SSNM Method Return String
270		Store(Local0, SSRT)
271
272		// Recalculate and save CheckSum
273		Store(RFU0, Local0)
274		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
275
276		Load(RFU0, Index(HI0P, HI0N))
277		Increment(HI0N)
278		Store("LD: SSDT Loaded", Debug)
279
280		Return (0)
281	}
282
283	// UnLoads the last Table of multiple Tables Load test
284	Method(UNLD)
285	{
286		if (LEqual(HI0N, 0)) {
287			Store("UNLD: there are no SSDT loaded", Debug)
288			Return (1)
289		}
290		Decrement(HI0N)
291
292		UnLoad(DerefOf(Index(HI0P, HI0N)))
293		Store("UNLD: SSDT UnLoaded", Debug)
294
295		Return (0)
296	}
297
298	External(\SSS0, MethodObj)
299
300	Name(HI0, 0)
301
302	// Simple Load test auxiliary method
303	// Arg1: DDBH, 0 - Local Named, 1 - Global Named,
304	//             2 - LocalX, 3 - element of Package
305	Method(m000, 2, Serialized)
306	{
307		Name(HI0, 0)
308		Name(PHI0, Package(1){})
309
310		Concatenate(arg0, "-m000", arg0)
311
312		Store(BUF0, RFU0)
313
314		if (CondRefof(\SSS0, Local0)) {
315			err(arg0, z174, 0x000, 0, 0, "\\SSS0", 1)
316			return
317		}
318
319		// Modify Revision field of SSDT
320		Store(Add(CREV, 1), CREV)
321
322		// Recalculate and save CheckSum
323		Store(RFU0, Local0)
324		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
325
326		if (CH03(arg0, z174, 0x001, 0, 0)) {
327			return
328		}
329
330		// Load operator execution
331		switch (ToInteger (arg1)) {
332			case (0) {Load(RFU0, HI0)}
333			case (1) {Load(RFU0, \DTM0.HI0)}
334			case (2) {Load(RFU0, Local2)}
335			case (3) {Load(RFU0, Index(PHI0, 0))}
336			default {
337				Store("Unexpected parameter of the test", Debug)
338				err(arg0, z174, 0x002, 0, 0, "\\SSS0", 1)
339				return
340			}
341		}
342
343		if (CH03(arg0, z174, 0x003, 0, 0)) {
344			return
345		}
346
347		Store("Table Loaded", Debug)
348
349		// Check DDBHandle ObjectType
350		if (y260) {
351			switch (ToInteger (arg1)) {
352				case (0) {Store(ObjectType(HI0), Local1)}
353				case (1) {Store(ObjectType(\DTM0.HI0), Local1)}
354				case (2) {Store(ObjectType(Local2), Local1)}
355				case (3) {Store(ObjectType(Index(PHI0, 0)), Local1)}
356			}
357			if (LNotEqual(Local1, c017)) { // DDB Handle
358				err(arg0, z174, 0x004, 0, 0, Local1, c017)
359			}
360		}
361
362		// Check the new Object appears
363
364		if (CondRefof(\SSS0, Local0)) {
365		} else {
366			err(arg0, z174, 0x005, 0, 0, "\\SSS0", 0)
367		}
368
369		Store(ObjectType(Local0), Local1)
370		if (LNotEqual(Local1, c010)) { // Method
371			err(arg0, z174, 0x006, 0, 0, Local1, c010)
372		} else {
373			Store(\SSS0(), Local0)
374			if (CH03(arg0, z174, 0x007, "\\SSS0", 1)) {
375				return
376			}
377			if (LNotEqual("\\SSS0", Local0)) {
378				err(arg0, z174, 0x008, 0, 0, Local0, "\\SSS0")
379			}
380		}
381
382		// UnLoad operator execution
383		switch (ToInteger (arg1)) {
384			case (0) {UnLoad(HI0)}
385			case (1) {UnLoad(\DTM0.HI0)}
386			case (2) {UnLoad(Local2)}
387			case (3) {UnLoad(DeRefof(Index(PHI0, 0)))}
388		}
389
390		if (CH03(arg0, z174, 0x009, 0, 0)) {
391			return
392		}
393
394		Store("Table Unloaded", Debug)
395
396		if (CondRefof(\SSS0, Local0)) {
397			err(arg0, z174, 0x00a, 0, 0, "\\SSS0", 1)
398		}
399
400		return
401	}
402
403	// Simple Load test auxiliary method for ArgX, part1
404	// Arg1 - reference to store the DDBHandle
405	Method(m001, 2)
406	{
407		Concatenate(arg0, "-m001", arg0)
408
409		Store(BUF0, RFU0)
410
411		if (CondRefof(\SSS0, Local0)) {
412			err(arg0, z174, 0x00b, 0, 0, "\\SSS0", 1)
413			return (1)
414		}
415
416		// Modify Revision field of SSDT
417		Store(Add(CREV, 1), CREV)
418
419		// Recalculate and save CheckSum
420		Store(RFU0, Local0)
421		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
422
423		if (CH03(arg0, z174, 0x00c, 0, 0)) {
424			return (1)
425		}
426
427		// Load operator execution
428		Load(RFU0, Arg1)
429
430		if (CH03(arg0, z174, 0x00d, 0, 0)) {
431			return (1)
432		}
433
434		Store("SSDT Loaded", Debug)
435
436		return (0)
437	}
438
439	// Simple Load test auxiliary method for ArgX, part2
440	// Arg1 - DDBHandle
441	Method(m002, 2)
442	{
443		Concatenate(arg0, "-m002", arg0)
444
445		// Check DDBHandle ObjectType
446		if (y260) {
447			Store(ObjectType(Arg1), Local1)
448			if (LNotEqual(Local1, c017)) { // DDB Handle
449				err(arg0, z174, 0x00e, 0, 0, Local1, c017)
450			}
451		}
452
453		// Check the new Object appears
454
455		if (CondRefof(\SSS0, Local0)) {
456		} else {
457			err(arg0, z174, 0x00f, 0, 0, "\\SSS0", 0)
458		}
459
460		Store(ObjectType(Local0), Local1)
461		if (LNotEqual(Local1, c010)) { // Method
462			err(arg0, z174, 0x010, 0, 0, Local1, c010)
463		} else {
464			Store(\SSS0(), Local0)
465			if (CH03(arg0, z174, 0x011, "\\SSS0", 1)) {
466				return
467			}
468			if (LNotEqual("\\SSS0", Local0)) {
469				err(arg0, z174, 0x012, 0, 0, Local0, "\\SSS0")
470			}
471		}
472
473		UnLoad(Arg1)
474
475		if (CH03(arg0, z174, 0x013, 0, 0)) {
476			return
477		}
478
479		Store("SSDT Unloaded", Debug)
480
481		if (CondRefof(\SSS0, Local0)) {
482			err(arg0, z174, 0x014, 0, 0, "\\SSS0", 1)
483		}
484
485		return
486	}
487
488	// Loading SSDT from a SystemMemory OpRegion,
489	// different targets for DDBHandle.
490	// Check DDBHandle storing into different Object locations:
491
492	// DDBHandle storing into Named Integer
493	Method(tst0, 1)
494	{
495		Concatenate(arg0, "-tst0", arg0)
496
497		// Local Named Integer
498		m000(arg0, 0)
499
500		// Global Named Integer
501		m000(arg0, 1)
502	}
503
504	// DDBHandle storing into LocalX
505	Method(tst1, 1)
506	{
507		Concatenate(arg0, "-tst1", arg0)
508
509		// LocalX
510		m000(arg0, 2)
511	}
512
513	// DDBHandle storing into Package element
514	Method(tst2, 1)
515	{
516		Concatenate(arg0, "-tst2", arg0)
517
518		// Package element
519		// Crash on copying the specific reference Object
520		if (y261) {
521			m000(arg0, 3)
522		}
523	}
524
525	// DDBHandle storing into an Object by Reference in Argx
526	Method(tst3, 1, Serialized)
527	{
528		Name(HI0, 0)
529
530		Concatenate(arg0, "-tst3", arg0)
531
532		// Named by Reference in ArgX
533		if (m001(arg0, Refof(HI0))) {
534			return
535		}
536		m002(arg0, HI0)
537
538		// LocalX by Reference in ArgX
539		if (m001(arg0, Refof(Local2))) {
540			return
541		}
542		m002(arg0, Local2)
543
544		// Package element by Reference in ArgX
545		if (y133) {
546			Name(PHI0, Package(1){0})
547			Store(Index(PHI0, 0), Local0)
548			if (m001(arg0, Local0)) {
549				return
550			}
551			m002(arg0, DeRefof(Local0))
552		}
553		return
554	}
555
556	// Combination of the OperationRegion operator arguments
557
558	OperationRegion(RGN0, SystemMemory, 0x00, 0x201)
559	OperationRegion(RGN1, SystemIO, 0x200, 0x203)
560	OperationRegion(RGN2, PCI_Config, 0x400, 0x205)
561	OperationRegion(RGN3, EmbeddedControl, 0x600, 0x207)
562	OperationRegion(RGN4, SMBus, 0x800, 0x209)
563	OperationRegion(RGN5, SystemCMOS, 0xa00, 0x20b)
564	OperationRegion(RGN6, PciBarTarget, 0xc00, 0x20d)
565
566	// UserDefRegionSpace
567	OperationRegion(RGN7, 0x80, 0xd00, 0x217)
568	OperationRegion(RGN8, 0xcf, 0xe00, 0x218)
569	OperationRegion(RGN9, 0xff, 0xf00, 0x219)
570
571	// Loading SSDT from a Field of an OpRegion of any type,
572	// different targets for DDBHandle.
573
574	// Check DDBHandle storing into different Object locations:
575	// Named Integer, LocalX, by Reference in Argx, etc.
576	// m003(CallChain, Index, Region)
577	Method(m003, 3)
578	{
579		Concatenate(arg0, "-m003", arg0)
580
581		// Auxiliary method:
582		// Arg1 - choice of a target
583		// Arg2 - OpRegion Object of a specified type
584		Method(m000, 3, Serialized)
585		{
586			Name(HI0, 0)
587			Name(PHI0, Package(1){})
588
589			OperationRegion(OPRm, 0xff, 0, 0x1000)
590
591			Concatenate(arg0, "-m000", arg0)
592
593			CopyObject(arg2, OPRm)
594
595			Field(OPRm, ByteAcc, NoLock, Preserve) {
596				RFU0, 0x1a0,
597			}
598
599			Field(OPRm, ByteAcc, NoLock, Preserve) {
600				SIG, 32,
601				LENG, 32,
602				REV, 8,
603				SUM, 8,
604				OID, 48,
605				OTID, 64,
606				OREV, 32,
607				CID, 32,
608				CREV, 32,
609				Offset(39),
610				SSNM, 32
611			}
612
613			Store(BUF0, RFU0)
614
615			if (CondRefof(\SSS0, Local0)) {
616				err(arg0, z174, 0x015, 0, 0, "\\SSS0", 1)
617				return
618			}
619
620			// Modify Revision field of SSDT
621			Store(Add(CREV, 1), CREV)
622
623			// Recalculate and save CheckSum
624			Store(RFU0, Local0)
625			Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
626
627			if (CH03(arg0, z174, 0x016, 0, 0)) {
628				return
629			}
630
631			// Load operator execution
632			switch (ToInteger (arg1)) {
633				case (0) {Load(RFU0, HI0)}
634				case (1) {Load(RFU0, \DTM0.HI0)}
635				case (2) {Load(RFU0, Local2)}
636				case (3) {Load(RFU0, Index(PHI0, 0))}
637				default {
638					Store("Unexpected parameter of the test", Debug)
639					err(arg0, z174, 0x017, 0, 0, "\\SSS0", 1)
640					return
641				}
642			}
643
644			if (CH03(arg0, z174, 0x018, 0, 0)) {
645				return
646			}
647
648			Store("SSDT Loaded", Debug)
649
650			// Check DDBHandle ObjectType
651			if (y260) {
652				switch (ToInteger (arg1)) {
653					case (0) {Store(ObjectType(HI0), Local1)}
654					case (1) {Store(ObjectType(\DTM0.HI0), Local1)}
655					case (2) {Store(ObjectType(Local2), Local1)}
656					case (3) {Store(ObjectType(Index(PHI0, 0)), Local1)}
657				}
658				if (LNotEqual(Local1, c017)) { // DDB Handle
659					err(arg0, z174, 0x019, 0, 0, Local1, c017)
660				}
661			}
662
663			// Check the new Object appears
664
665			if (CondRefof(\SSS0, Local0)) {
666			} else {
667				err(arg0, z174, 0x01a, 0, 0, "\\SSS0", 0)
668			}
669
670			Store(ObjectType(Local0), Local1)
671			if (LNotEqual(Local1, c010)) { // Method
672				err(arg0, z174, 0x01b, 0, 0, Local1, c010)
673			} else {
674				Store(\SSS0(), Local0)
675				if (CH03(arg0, z174, 0x01c, "\\SSS0", 1)) {
676					return
677				}
678				if (LNotEqual("\\SSS0", Local0)) {
679					err(arg0, z174, 0x01d, 0, 0, Local0, "\\SSS0")
680				}
681			}
682
683			// UnLoad operator execution
684			switch (ToInteger (arg1)) {
685				case (0) {UnLoad(HI0)}
686				case (1) {UnLoad(\DTM0.HI0)}
687				case (2) {UnLoad(Local2)}
688				case (3) {UnLoad(DeRefof(Index(PHI0, 0)))}
689			}
690
691			if (CH03(arg0, z174, 0x01e, 0, 0)) {
692				return
693			}
694
695			Store("SSDT Unloaded", Debug)
696
697			if (CondRefof(\SSS0, Local0)) {
698				err(arg0, z174, 0x01f, 0, 0, "\\SSS0", 1)
699			}
700
701			return
702		}
703
704		// Auxiliary method for ArgX, part1
705		// Arg1 - reference to store the DDBHandle
706		// Arg2 - OpRegion Object of a specified type
707		Method(m001, 3, Serialized)
708		{
709			OperationRegion(OPRm, 0xff, 0, 0x1000)
710
711			Concatenate(arg0, "-m001", arg0)
712
713			CopyObject(arg2, OPRm)
714
715			Field(OPRm, ByteAcc, NoLock, Preserve) {
716				RFU0, 0x1a0,
717			}
718
719			Field(OPRm, ByteAcc, NoLock, Preserve) {
720				SIG, 32,
721				LENG, 32,
722				REV, 8,
723				SUM, 8,
724				OID, 48,
725				OTID, 64,
726				OREV, 32,
727				CID, 32,
728				CREV, 32,
729				Offset(39),
730				SSNM, 32
731			}
732
733			Store(BUF0, RFU0)
734
735			if (CondRefof(\SSS0, Local0)) {
736				err(arg0, z174, 0x020, 0, 0, "\\SSS0", 1)
737				return (1)
738			}
739
740			// Modify Revision field of SSDT
741			Store(Add(CREV, 1), CREV)
742
743			// Recalculate and save CheckSum
744			Store(RFU0, Local0)
745			Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
746
747			if (CH03(arg0, z174, 0x021, 0, 0)) {
748				return (1)
749			}
750
751			// Load operator execution
752			Load(RFU0, Arg1)
753
754			if (CH03(arg0, z174, 0x022, 0, 0)) {
755				return (1)
756			}
757
758			Store("SSDT Loaded", Debug)
759
760			return (0)
761		}
762
763		// Arg1 - OpRegion Object of a specified type
764		Method(m003, 2, Serialized)
765		{
766			Concatenate(arg0, "-m003", arg0)
767
768			// Local Named Integer
769			m000(arg0, 0, arg1)
770
771			// Global Named Integer
772			m000(arg0, 1, arg1)
773
774			// LocalX
775			m000(arg0, 2, arg1)
776
777			// Package element
778			// Crash on copying the specific reference Object
779			if (y261) {
780				m000(arg0, 3, arg1)
781			}
782
783			// ArgX
784			if (m001(arg0, Refof(Local2), arg1)) {
785				return
786			}
787			m002(arg0, Local2)
788
789			// Package element as ArgX
790			if (y133) {
791				Name(PHI0, Package(1){0})
792				Store(Index(PHI0, 0), Local0)
793				if (m001(arg0, Local0, arg1)) {
794					return
795				}
796				m002(arg0, DeRefof(Local0))
797			}
798			return
799		}
800
801		// Region type's Address Space Handler installed flags,
802		// only those types' OpRegion can be tested.
803		Store(
804			Buffer(10){
805				1,
806				1,
807				0, /* 0x02 - PCI_Config */
808				1,
809				0, /* 0x04 - SMBus */
810				0, /* 0x05 - SystemCMOS */
811				0, /* 0x06 - PciBarTarget */
812				1,
813				0, /* 0xcf - UserDefRegionSpace */
814				0},/* 0xff - UserDefRegionSpace */
815			Local2)
816
817		Store(Derefof(Index(Local2, Arg1)), Local3)
818		if (Local3) {
819			Concatenate(arg0, "-0x", Local4)
820			Concatenate(Local4,
821				Mid(ToHexString(Arg1), Add(6, Multiply(F64, 8)), 2),
822				Local4)
823			Store(Local4, Debug)
824			m003(Local4, Arg2)
825		} else {
826			Store("This Region type's AddrSpace Handler not installed", Debug)
827			err(arg0, z174, 0x023, 0, 0, Local2, Arg1)
828		}
829	}
830
831	// SystemMemory Region
832	Method(tst4, 1)
833	{
834		Concatenate(arg0, "-tst4", arg0)
835
836		m003(Arg0, 0, RGN0)
837	}
838
839	// SystemIO Region
840	Method(tst5, 1)
841	{
842		Concatenate(arg0, "-tst5", arg0)
843
844		m003(Arg0, 1, RGN1)
845	}
846
847	// EmbeddedControl Region
848	Method(tst6, 1)
849	{
850		Concatenate(arg0, "-tst6", arg0)
851
852		m003(Arg0, 3, RGN3)
853	}
854
855	// User defined Region
856	Method(tst7, 1)
857	{
858		Concatenate(arg0, "-tst7", arg0)
859
860		m003(Arg0, 7, RGN7)
861	}
862
863	// Note: We load the table objects relative to the root of the namespace.
864	// This appears to go against the ACPI specification, but we do it for
865	// compatibility with other ACPI implementations.
866
867	// Originated from ssdt1.asl: iasl -tc ssdt1.asl
868	Name(BUF1, Buffer(){
869		0x53,0x53,0x44,0x54,0x5F,0x00,0x00,0x00,  /* 00000000    "SSDT_..." */
870		0x02,0x33,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    ".3Intel." */
871		0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
872		0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
873		0x15,0x12,0x06,0x20,0x10,0x1F,0x5C,0x00,  /* 00000020    "... ..\." */
874		0x08,0x4E,0x41,0x42,0x53,0x0D,0x61,0x62,  /* 00000028    ".NABS.ab" */
875		0x73,0x6F,0x6C,0x75,0x74,0x65,0x20,0x6C,  /* 00000030    "solute l" */
876		0x6F,0x63,0x61,0x74,0x69,0x6F,0x6E,0x20,  /* 00000038    "ocation " */
877		0x6F,0x62,0x6A,0x00,0x08,0x4E,0x43,0x52,  /* 00000040    "obj..NCR" */
878		0x52,0x0D,0x63,0x75,0x72,0x72,0x65,0x6E,  /* 00000048    "R.curren" */
879		0x74,0x20,0x6C,0x6F,0x63,0x61,0x74,0x69,  /* 00000050    "t locati" */
880		0x6F,0x6E,0x20,0x6F,0x62,0x6A,0x00,
881	})
882
883	OperationRegion (IST1, SystemMemory, 0x100, 0x5f)
884
885	Field(IST1, ByteAcc, NoLock, Preserve) {
886		RFU1, 0x2f8,
887	}
888
889	Method(tst8, 1, Serialized)
890	{
891		Name(DDBH, 0)
892
893		Concatenate(arg0, "-tst8", arg0)
894
895		// Check absence
896		if (CondRefof(NABS, Local0)) {
897			err(arg0, z174, 0x024, 0, 0, "NABS", 1)
898		}
899		if (CondRefof(NCRR, Local0)) {
900			err(arg0, z174, 0x025, 0, 0, "NCRR", 1)
901		}
902
903		Store(BUF1, RFU1)
904		Load(RFU1, DDBH)
905		Store("SSDT loaded", Debug)
906
907		// Check existence
908		if (CondRefof(NABS, Local0)) {
909			if (LNotEqual("absolute location obj", Derefof(Local0))) {
910				err(arg0, z174, 0x026, 0, 0, Derefof(Local0),
911					"absolute location obj")
912			}
913		} else {
914			err(arg0, z174, 0x027, 0, 0, "NABS", 0)
915		}
916		if (CondRefof(NCRR, Local0)) {
917			if (LNotEqual("current location obj", Derefof(Local0))) {
918				err(arg0, z174, 0x028, 0, 0, Derefof(Local0),
919					"current location obj")
920			}
921		} else {
922			err(arg0, z174, 0x029, 0, 0, "NCRR", 0)
923		}
924
925		// Check location
926		if (CondRefof(\NABS, Local0)) {
927		} else {
928			err(arg0, z174, 0x02a, 0, 0, "NABS", 0)
929		}
930		//Note: We load the table objects relative to the root of the namespace.
931		if (CondRefof(\NCRR, Local0)) {
932		} else {
933			err(arg0, z174, 0x02b, 0, 0, "\\NCRR", 1)
934		}
935		if (CondRefof(\DTM0.NCRR, Local0)) {
936			err(arg0, z174, 0x02c, 0, 0, "\\DTM0.NCRR", 1)
937		}
938		if (CondRefof(\DTM0.TST8.NCRR, Local0)) {
939			err(arg0, z174, 0x02d, 0, 0, "\\DTM0.TST8.NCRR", 0)
940		}
941
942		UnLoad(DDBH)
943		Store("SSDT unloaded", Debug)
944
945		// Check absence
946		if (CondRefof(NABS, Local0)) {
947			err(arg0, z174, 0x02e, 0, 0, "NABS", 1)
948		}
949		if (CondRefof(NCRR, Local0)) {
950			err(arg0, z174, 0x02f, 0, 0, "NCRR", 1)
951		}
952	}
953
954	// Check global and dynamic declarations of OpRegions
955	// and the appropriate _REG Methods invocation for the
956	// loaded SSDT
957
958	// Originated from ssdt2.asl: iasl -tc ssdt2.asl
959	Name(BUF2, Buffer(){
960		0x53,0x53,0x44,0x54,0x17,0x01,0x00,0x00,  /* 00000000    "SSDT...." */
961		0x02,0x7B,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    ".{Intel." */
962		0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
963		0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
964		0x15,0x12,0x06,0x20,0x5B,0x82,0x41,0x0F,  /* 00000020    "... [.A." */
965		0x41,0x55,0x58,0x44,0x5B,0x80,0x4F,0x50,  /* 00000028    "AUXD[.OP" */
966		0x52,0x30,0x80,0x0C,0x00,0x00,0x00,0x01,  /* 00000030    "R0......" */
967		0x0A,0x04,0x5B,0x81,0x0B,0x4F,0x50,0x52,  /* 00000038    "..[..OPR" */
968		0x30,0x03,0x52,0x46,0x30,0x30,0x20,0x08,  /* 00000040    "0.RF00 ." */
969		0x52,0x45,0x47,0x43,0x0C,0xFF,0xFF,0xFF,  /* 00000048    "REGC...." */
970		0xFF,0x08,0x52,0x45,0x47,0x50,0x0A,0x00,  /* 00000050    "..REGP.." */
971		0x08,0x52,0x45,0x47,0x44,0x0C,0xFF,0xFF,  /* 00000058    ".REGD..." */
972		0xFF,0xFF,0x08,0x52,0x45,0x47,0x52,0x0A,  /* 00000060    "...REGR." */
973		0x00,0x14,0x33,0x5F,0x52,0x45,0x47,0x02,  /* 00000068    "..3_REG." */
974		0x70,0x0D,0x5C,0x41,0x55,0x58,0x44,0x2E,  /* 00000070    "p.\AUXD." */
975		0x5F,0x52,0x45,0x47,0x3A,0x00,0x5B,0x31,  /* 00000078    "_REG:.[1" */
976		0x70,0x68,0x5B,0x31,0x70,0x69,0x5B,0x31,  /* 00000080    "ph[1pi[1" */
977		0xA0,0x14,0x93,0x68,0x0A,0x80,0x70,0x52,  /* 00000088    "...h..pR" */
978		0x45,0x47,0x43,0x52,0x45,0x47,0x50,0x70,  /* 00000090    "EGCREGPp" */
979		0x69,0x52,0x45,0x47,0x43,0x14,0x49,0x07,  /* 00000098    "iREGC.I." */
980		0x4D,0x30,0x30,0x30,0x00,0x14,0x38,0x5F,  /* 000000A0    "M000..8_" */
981		0x52,0x45,0x47,0x02,0x70,0x0D,0x5C,0x41,  /* 000000A8    "REG.p.\A" */
982		0x55,0x58,0x44,0x2E,0x4D,0x30,0x30,0x30,  /* 000000B0    "UXD.M000" */
983		0x2E,0x5F,0x52,0x45,0x47,0x3A,0x00,0x5B,  /* 000000B8    "._REG:.[" */
984		0x31,0x70,0x68,0x5B,0x31,0x70,0x69,0x5B,  /* 000000C0    "1ph[1pi[" */
985		0x31,0xA0,0x14,0x93,0x68,0x0A,0x80,0x70,  /* 000000C8    "1...h..p" */
986		0x52,0x45,0x47,0x44,0x52,0x45,0x47,0x52,  /* 000000D0    "REGDREGR" */
987		0x70,0x69,0x52,0x45,0x47,0x44,0x5B,0x80,  /* 000000D8    "piREGD[." */
988		0x4F,0x50,0x52,0x31,0x80,0x0C,0x10,0x00,  /* 000000E0    "OPR1...." */
989		0x00,0x01,0x0A,0x04,0x5B,0x81,0x0B,0x4F,  /* 000000E8    "....[..O" */
990		0x50,0x52,0x31,0x03,0x52,0x46,0x30,0x31,  /* 000000F0    "PR1.RF01" */
991		0x20,0x70,0x0D,0x5C,0x41,0x55,0x58,0x44,  /* 000000F8    " p.\AUXD" */
992		0x2E,0x4D,0x30,0x30,0x30,0x3A,0x00,0x5B,  /* 00000100    ".M000:.[" */
993		0x31,0x70,0x52,0x46,0x30,0x31,0x5B,0x31,  /* 00000108    "1pRF01[1" */
994		0x70,0x52,0x45,0x47,0x52,0x5B,0x31,
995	})
996
997	OperationRegion (IST2, SystemMemory, 0x200, 0x117)
998
999	Field(IST2, ByteAcc, NoLock, Preserve) {
1000		RFU2, 0x8b8,
1001	}
1002
1003	External(\AUXD.M000, MethodObj)
1004
1005	Method(tst9, 1, Serialized)
1006	{
1007		Name(DDBH, 0)
1008
1009		Concatenate(arg0, "-tst9", arg0)
1010
1011		Store(BUF2, RFU2)
1012
1013		if (CondRefof(\AUXD, Local0)) {
1014			err(arg0, z174, 0x030, 0, 0, "\\AUXD", 1)
1015			return
1016		}
1017
1018		if (CH03(arg0, 0, 0x031, 0, 0)) {
1019			return
1020		}
1021
1022		Load(RFU2, DDBH)
1023
1024		if (CH03(arg0, 0, 0x032, 0, 0)) {
1025			return
1026		}
1027
1028		if (CondRefof(\AUXD, Local0)) {
1029		} else {
1030			err(arg0, z174, 0x033, 0, 0, "\\AUXD", 0)
1031			return
1032		}
1033
1034		Store (ObjectType(Local0), Local1)
1035
1036		if (LNotEqual(Local1, 6)) {
1037			err(arg0, z174, 0x034, 0, 0, Local1, 6)
1038			return
1039		}
1040
1041		if (CondRefof(\AUXD.REGC, Local0)) {
1042		} else {
1043			err(arg0, z174, 0x035, 0, 0, "\\AUXD.REGC", 0)
1044			return
1045		}
1046
1047		Store(Derefof(Local0), Local1)
1048
1049		if (LNotEqual(1, Local1)) {
1050			err(arg0, z174, 0x036, 0, 0, Local1, 1)
1051		}
1052
1053		if (CondRefof(\AUXD.REGD, Local0)) {
1054		} else {
1055			err(arg0, z174, 0x037, 0, 0, "\\AUXD.REGD", 0)
1056			return
1057		}
1058
1059		Store(Derefof(Local0), Local1)
1060
1061		if (LNotEqual(0xFFFFFFFF, Local1)) {
1062			err(arg0, z174, 0x038, 0, 0, Local1, 0xFFFFFFFF)
1063		} elseif (CondRefof(\AUXD.M000, Local2)) {
1064
1065			\AUXD.M000()
1066
1067			Store(Derefof(Local0), Local1)
1068
1069			if (LNotEqual(1, Local1)) {
1070				err(arg0, z174, 0x039, 0, 0, Local1, 1)
1071			}
1072		} else {
1073			err(arg0, z174, 0x03a, 0, 0, "\\AUXD.M000", 0)
1074		}
1075
1076		UnLoad(DDBH)
1077
1078		if (CondRefof(\AUXD, Local0)) {
1079			err(arg0, z174, 0x03b, 0, 0, "\\AUXD", 1)
1080		}
1081		return
1082	}
1083
1084	// Checks that only specified Tables objects present in the NS
1085	Method(LDCH, 1)
1086	{
1087		Method(MAUX) {Return ("MAUX")}
1088
1089		Concatenate(arg0, "-LDCH", arg0)
1090
1091		if (CH03(arg0, z174, 0x040, 0, 0)) {
1092			return (1)
1093		}
1094
1095		// Specify to check up to 3 successive \SSxx names
1096		Store(1, Local0)
1097		if (HI0N) {
1098			Subtract(HI0N, 1, Local1)
1099			if (Local1) {
1100				Decrement(Local1)
1101			}
1102		} else {
1103			Store(0, Local1)
1104		}
1105		if (LLess(Add(Local1, 1), HI0M)) {
1106			Increment(Local0)
1107			if (LLess(Add(Local1, 2), HI0M)) {
1108				Increment(Local0)
1109			}
1110		}
1111
1112		while (Local0) {
1113			Divide(Local1, NNML, Local3, Local4)
1114			Store("\\SSS0", Local5)
1115			Store(Derefof(Index(SNML, Local4)), Index(Local5, 3))
1116			Store(Derefof(Index(SNML, Local3)), Index(Local5, 4))
1117
1118			Store(Local5, Debug)
1119
1120			// Access the next \SSxx Object
1121			CopyObject(Derefof(Local5), MAUX)
1122
1123			if (LLess(Local1, HI0N)) {
1124				if (CH03(arg0, z174, 0x041, 0, 0)) {
1125					return (2)
1126				}
1127				Store(MAUX(), Local2)
1128				if (CH03(arg0, z174, 0x042, 0, 0)) {
1129					return (3)
1130				}
1131				if (LNotEqual(Local5, Local2)) {
1132					err(arg0, z174, 0x043, 0, 0, Local2, Local5)
1133				}
1134			} else {
1135				if (CH04(arg0, 0, 0xff, z174, 0x044, 0, 0)) {	// AE_NOT_FOUND
1136					return (4)
1137				}
1138			}
1139			Increment(Local1)
1140			Decrement(Local0)
1141		}
1142
1143		Return (0)
1144	}
1145
1146	// Loading a number of different SSDTs
1147	// Arg1: the number of SSDT to load
1148	Method(tsta, 2)
1149	{
1150		Concatenate(arg0, "-tsta", arg0)
1151
1152		if (INIT()) {
1153			err(arg0, z174, 0x045, 0, 0, "INIT", 1)
1154			return (1)
1155		}
1156		if (CH03(arg0, z174, 0x046, 0, 0)) {
1157			return (1)
1158		}
1159
1160		Store(arg1, Local0)
1161		while (Local0) {
1162			if (LD()) {
1163				err(arg0, z174, 0x047, 0, 0, "HI0N", HI0N)
1164				return (1)
1165			}
1166			if (CH03(arg0, z174, 0x048, 0, 0)) {
1167				return (1)
1168			}
1169			Decrement(Local0)
1170
1171			if (LDCH(arg0)) {
1172				err(arg0, z174, 0x049, 0, 0, "HI0N", HI0N)
1173				return (1)
1174			}
1175		}
1176
1177		Store(arg1, Local0)
1178		while (Local0) {
1179			if (UNLD()) {
1180				err(arg0, z174, 0x040a, 0, 0, "HI0N", HI0N)
1181				return (1)
1182			}
1183			if (CH03(arg0, z174, 0x04b, 0, 0)) {
1184				return (1)
1185			}
1186			Decrement(Local0)
1187
1188			if (LDCH(arg0)) {
1189				err(arg0, z174, 0x04c, 0, 0, "HI0N", HI0N)
1190				return (1)
1191			}
1192		}
1193
1194		return (0)
1195	}
1196
1197	// Exceptions when the Object argument does not refer to
1198	// an operation region field or an operation region
1199
1200	// Originated from ssdt3.asl: iasl -tc ssdt3.asl
1201	Name(BUF3, Buffer(){
1202		0x53,0x53,0x44,0x54,0x1F,0x01,0x00,0x00,  /* 00000000    "SSDT...." */
1203		0x02,0x58,0x49,0x6E,0x74,0x65,0x6C,0x00,  /* 00000008    ".XIntel." */
1204		0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00,  /* 00000010    "Many...." */
1205		0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
1206		0x15,0x12,0x06,0x20,0x5B,0x82,0x49,0x0F,  /* 00000020    "... [.I." */
1207		0x41,0x55,0x58,0x44,0x08,0x49,0x4E,0x54,  /* 00000028    "AUXD.INT" */
1208		0x30,0x0E,0x10,0x32,0x54,0x76,0x98,0xBA,  /* 00000030    "0..2Tv.." */
1209		0xDC,0xFE,0x08,0x53,0x54,0x52,0x30,0x0D,  /* 00000038    "...STR0." */
1210		0x73,0x6F,0x75,0x72,0x63,0x65,0x20,0x73,  /* 00000040    "source s" */
1211		0x74,0x72,0x69,0x6E,0x67,0x30,0x00,0x08,  /* 00000048    "tring0.." */
1212		0x42,0x55,0x46,0x30,0x11,0x0C,0x0A,0x09,  /* 00000050    "BUF0...." */
1213		0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,  /* 00000058    "........" */
1214		0x01,0x08,0x50,0x41,0x43,0x30,0x12,0x27,  /* 00000060    "..PAC0.'" */
1215		0x03,0x0E,0x1F,0x32,0x54,0x76,0x98,0xBA,  /* 00000068    "...2Tv.." */
1216		0xDC,0xFE,0x0D,0x74,0x65,0x73,0x74,0x20,  /* 00000070    "...test " */
1217		0x70,0x61,0x63,0x6B,0x61,0x67,0x65,0x30,  /* 00000078    "package0" */
1218		0x00,0x11,0x0C,0x0A,0x09,0x13,0x12,0x11,  /* 00000080    "........" */
1219		0x10,0x0F,0x0E,0x0D,0x0C,0x0B,0x5B,0x81,  /* 00000088    "......[." */
1220		0x0B,0x4F,0x50,0x52,0x30,0x01,0x46,0x4C,  /* 00000090    ".OPR0.FL" */
1221		0x55,0x30,0x20,0x5B,0x82,0x10,0x44,0x45,  /* 00000098    "U0 [..DE" */
1222		0x56,0x30,0x08,0x53,0x30,0x30,0x30,0x0D,  /* 000000A0    "V0.S000." */
1223		0x44,0x45,0x56,0x30,0x00,0x5B,0x02,0x45,  /* 000000A8    "DEV0.[.E" */
1224		0x56,0x45,0x30,0x14,0x09,0x4D,0x4D,0x4D,  /* 000000B0    "VE0..MMM" */
1225		0x30,0x00,0xA4,0x0A,0x00,0x5B,0x01,0x4D,  /* 000000B8    "0....[.M" */
1226		0x54,0x58,0x30,0x00,0x5B,0x80,0x4F,0x50,  /* 000000C0    "TX0.[.OP" */
1227		0x52,0x30,0x00,0x0C,0x21,0x43,0x65,0x07,  /* 000000C8    "R0..!Ce." */
1228		0x0A,0x98,0x5B,0x84,0x13,0x50,0x57,0x52,  /* 000000D0    "..[..PWR" */
1229		0x30,0x00,0x00,0x00,0x08,0x53,0x30,0x30,  /* 000000D8    "0....S00" */
1230		0x30,0x0D,0x50,0x57,0x52,0x30,0x00,0x5B,  /* 000000E0    "0.PWR0.[" */
1231		0x83,0x16,0x43,0x50,0x55,0x30,0x00,0xFF,  /* 000000E8    "..CPU0.." */
1232		0xFF,0xFF,0xFF,0x00,0x08,0x53,0x30,0x30,  /* 000000F0    ".....S00" */
1233		0x30,0x0D,0x43,0x50,0x55,0x30,0x00,0x5B,  /* 000000F8    "0.CPU0.[" */
1234		0x85,0x10,0x54,0x5A,0x4E,0x30,0x08,0x53,  /* 00000100    "..TZN0.S" */
1235		0x30,0x30,0x30,0x0D,0x54,0x5A,0x4E,0x30,  /* 00000108    "000.TZN0" */
1236		0x00,0x5B,0x13,0x42,0x55,0x46,0x30,0x0A,  /* 00000110    ".[.BUF0." */
1237		0x00,0x0A,0x45,0x42,0x46,0x4C,0x30,
1238	})
1239
1240	OperationRegion (IST3, SystemMemory, 0x400, 0x11f)
1241
1242	Field(IST3, ByteAcc, NoLock, Preserve) {
1243		RFU3, 0x8f8,
1244	}
1245
1246	Method(tstb, 1, Serialized)
1247	{
1248		Name(DDB0, 0)
1249		Name(DDBH, 0)
1250
1251		Concatenate(arg0, "-tstb", arg0)
1252
1253		Store(BUF3, RFU3)
1254		Load(RFU3, DDB0)
1255
1256		if (CH03(arg0, z174, 0x050, 0, 0)) {
1257			return (1)
1258		}
1259
1260		// Uninitialized: it can not be aplied to Load which
1261		// allows NameString only to be used as Object parameter
1262
1263		// Integer
1264		Load(\AUXD.INT0, DDBH)
1265		CH04(arg0, 0, 47, z174, 0x051, 0, 0)	// AE_AML_OPERAND_TYPE
1266		Store(ObjectType(\AUXD.INT0), Local0)
1267		if (LNotEqual(c009, Local0)) {
1268			err(arg0, z174, 0x052, 0, 0, Local0, c009)
1269		}
1270
1271		// String
1272		Load(\AUXD.STR0, DDBH)
1273		CH04(arg0, 0, 47, z174, 0x053, 0, 0)	// AE_AML_OPERAND_TYPE
1274		Store(ObjectType(\AUXD.STR0), Local0)
1275		if (LNotEqual(c00a, Local0)) {
1276			err(arg0, z174, 0x054, 0, 0, Local0, c00a)
1277		}
1278
1279		// Buffer
1280		if (y282) {
1281			// TBD: LBZ480 update allows Buffer to be Source of Load
1282			Load(\AUXD.BUF0, DDBH)
1283			CH04(arg0, 0, 47, z174, 0x055, 0, 0)	// AE_AML_OPERAND_TYPE
1284			Store(ObjectType(\AUXD.BUF0), Local0)
1285			if (LNotEqual(c00b, Local0)) {
1286				err(arg0, z174, 0x056, 0, 0, Local0, c00b)
1287			}
1288		}
1289
1290		// Package
1291		Load(\AUXD.PAC0, DDBH)
1292		CH04(arg0, 0, 47, z174, 0x057, 0, 0)	// AE_AML_OPERAND_TYPE
1293		Store(ObjectType(\AUXD.PAC0), Local0)
1294		if (LNotEqual(c00c, Local0)) {
1295			err(arg0, z174, 0x058, 0, 0, Local0, c00c)
1296		}
1297
1298		// Field Unit
1299
1300		// Device
1301		Load(\AUXD.DEV0, DDBH)
1302		CH04(arg0, 0, 47, z174, 0x059, 0, 0)	// AE_AML_OPERAND_TYPE
1303		Store(ObjectType(\AUXD.DEV0), Local0)
1304		if (LNotEqual(c00e, Local0)) {
1305			err(arg0, z174, 0x05a, 0, 0, Local0, c00e)
1306		}
1307
1308		// Event
1309		Load(\AUXD.EVE0, DDBH)
1310		CH04(arg0, 0, 47, z174, 0x05b, 0, 0)	// AE_AML_OPERAND_TYPE
1311		Store(ObjectType(\AUXD.EVE0), Local0)
1312		if (LNotEqual(c00f, Local0)) {
1313			err(arg0, z174, 0x05c, 0, 0, Local0, c00f)
1314		}
1315
1316		// Method
1317		Load(\AUXD.MMM0, DDBH)
1318		CH04(arg0, 0, 47, z174, 0x05d, 0, 0)	// AE_AML_OPERAND_TYPE
1319		Store(ObjectType(\AUXD.MMM0), Local0)
1320		if (LNotEqual(c010, Local0)) {
1321			err(arg0, z174, 0x05e, 0, 0, Local0, c010)
1322		}
1323
1324		// Mutex
1325		Load(\AUXD.MTX0, DDBH)
1326		CH04(arg0, 0, 47, z174, 0x05f, 0, 0)	// AE_AML_OPERAND_TYPE
1327		Store(ObjectType(\AUXD.MTX0), Local0)
1328		if (LNotEqual(c011, Local0)) {
1329			err(arg0, z174, 0x060, 0, 0, Local0, c011)
1330		}
1331
1332		// OpRegion
1333
1334		// Power Resource
1335		Load(\AUXD.PWR0, DDBH)
1336		CH04(arg0, 0, 47, z174, 0x061, 0, 0)	// AE_AML_OPERAND_TYPE
1337		Store(ObjectType(\AUXD.PWR0), Local0)
1338		if (LNotEqual(c013, Local0)) {
1339			err(arg0, z174, 0x062, 0, 0, Local0, c013)
1340		}
1341
1342		// Processor
1343		Load(\AUXD.CPU0, DDBH)
1344		CH04(arg0, 0, 47, z174, 0x063, 0, 0)	// AE_AML_OPERAND_TYPE
1345		Store(ObjectType(\AUXD.CPU0), Local0)
1346		if (LNotEqual(c014, Local0)) {
1347			err(arg0, z174, 0x064, 0, 0, Local0, c014)
1348		}
1349
1350		// Thermal Zone
1351		Load(\AUXD.TZN0, DDBH)
1352		CH04(arg0, 0, 47, z174, 0x065, 0, 0)	// AE_AML_OPERAND_TYPE
1353		Store(ObjectType(\AUXD.TZN0), Local0)
1354		if (LNotEqual(c015, Local0)) {
1355			err(arg0, z174, 0x066, 0, 0, Local0, c015)
1356		}
1357
1358		// Buffer Field
1359		if (y282) {
1360			// TBD: LBZ480 update allows Buffer Field to be Source of Load
1361			Load(\AUXD.BFL0, DDBH)
1362			CH04(arg0, 0, 47, z174, 0x067, 0, 0)	// AE_AML_OPERAND_TYPE
1363			Store(ObjectType(\AUXD.BFL0), Local0)
1364			if (LNotEqual(c016, Local0)) {
1365				err(arg0, z174, 0x068, 0, 0, Local0, c016)
1366			}
1367		}
1368
1369		// DDB Handle
1370		Load(DDB0, DDBH)
1371		CH04(arg0, 0, 47, z174, 0x069, 0, 0)	// AE_AML_OPERAND_TYPE
1372		if (y260) {
1373			Store(ObjectType(DDB0), Local0)
1374			if (LNotEqual(c017, Local0)) {
1375				err(arg0, z174, 0x06a, 0, 0, Local0, c017)
1376			}
1377		}
1378		
1379		UnLoad(DDB0)
1380
1381		return (0)
1382	}
1383
1384	// Exceptions when an OpRegion passed as the Object
1385	// parameter of Load is not of SystemMemory type
1386	Method(tstc, 1, Serialized)
1387	{
1388		Name(DDBH, 0)
1389
1390		Concatenate(arg0, "-tstc", arg0)
1391
1392		OperationRegion(RGN1, SystemIO, 0x280, 0x123)
1393		OperationRegion(RGN2, PCI_Config, 0x480, 0x125)
1394		OperationRegion(RGN3, EmbeddedControl, 0x680, 0x127)
1395		OperationRegion(RGN4, SMBus, 0x880, 0x109)
1396		OperationRegion(RGN5, SystemCMOS, 0xa80, 0x12b)
1397		OperationRegion(RGN6, PciBarTarget, 0xc80, 0x12d)
1398
1399		// UserDefRegionSpace
1400		OperationRegion(RGN7, 0x80, 0xd80, 0x137)
1401		OperationRegion(RGN8, 0xcf, 0xe80, 0x138)
1402		OperationRegion(RGN9, 0xff, 0xf80, 0x139)
1403
1404		if (CH03(arg0, z174, 0x06f, 0, 0)) {
1405			return (1)
1406		}
1407
1408		// SystemIO
1409		Load(RGN1, DDBH)
1410		CH04(arg0, 0, 47, z174, 0x220, 0, 0)	// AE_AML_OPERAND_TYPE
1411		Store(ObjectType(RGN1), Local0)
1412		if (LNotEqual(c012, Local0)) {
1413			err(arg0, z174, 0x071, 0, 0, Local0, c012)
1414		}
1415
1416		// PCI_Config
1417		Load(RGN2, DDBH)
1418		CH04(arg0, 0, 47, z174, 0x072, 0, 0)	// AE_AML_OPERAND_TYPE
1419		Store(ObjectType(RGN2), Local0)
1420		if (LNotEqual(c012, Local0)) {
1421			err(arg0, z174, 0x073, 0, 0, Local0, c012)
1422		}
1423
1424		// EmbeddedControl
1425		Load(RGN3, DDBH)
1426		CH04(arg0, 0, 47, z174, 0x074, 0, 0)	// AE_AML_OPERAND_TYPE
1427		Store(ObjectType(RGN3), Local0)
1428		if (LNotEqual(c012, Local0)) {
1429			err(arg0, z174, 0x075, 0, 0, Local0, c012)
1430		}
1431
1432		// SMBus
1433		Load(RGN4, DDBH)
1434		CH04(arg0, 0, 47, z174, 0x076, 0, 0)	// AE_AML_OPERAND_TYPE
1435		Store(ObjectType(RGN4), Local0)
1436		if (LNotEqual(c012, Local0)) {
1437			err(arg0, z174, 0x077, 0, 0, Local0, c012)
1438		}
1439
1440		// SystemCMOS
1441		Load(RGN5, DDBH)
1442		CH04(arg0, 0, 47, z174, 0x078, 0, 0)	// AE_AML_OPERAND_TYPE
1443		Store(ObjectType(RGN5), Local0)
1444		if (LNotEqual(c012, Local0)) {
1445			err(arg0, z174, 0x079, 0, 0, Local0, c012)
1446		}
1447
1448		// PciBarTarget
1449		Load(RGN6, DDBH)
1450		CH04(arg0, 0, 47, z174, 0x07a, 0, 0)	// AE_AML_OPERAND_TYPE
1451		Store(ObjectType(RGN6), Local0)
1452		if (LNotEqual(c012, Local0)) {
1453			err(arg0, z174, 0x07b, 0, 0, Local0, c012)
1454		}
1455
1456		// UserDefRegionSpace 0x80
1457		Load(RGN7, DDBH)
1458		CH04(arg0, 0, 47, z174, 0x07c, 0, 0)	// AE_AML_OPERAND_TYPE
1459		Store(ObjectType(RGN7), Local0)
1460		if (LNotEqual(c012, Local0)) {
1461			err(arg0, z174, 0x07d, 0, 0, Local0, c012)
1462		}
1463
1464		// UserDefRegionSpace 0xcf
1465		Load(RGN8, DDBH)
1466		CH04(arg0, 0, 47, z174, 0x07e, 0, 0)	// AE_AML_OPERAND_TYPE
1467		Store(ObjectType(RGN8), Local0)
1468		if (LNotEqual(c012, Local0)) {
1469			err(arg0, z174, 0x07f, 0, 0, Local0, c012)
1470		}
1471
1472		// UserDefRegionSpace 0xff
1473		Load(RGN9, DDBH)
1474		CH04(arg0, 0, 47, z174, 0x080, 0, 0)	// AE_AML_OPERAND_TYPE
1475		Store(ObjectType(RGN9), Local0)
1476		if (LNotEqual(c012, Local0)) {
1477			err(arg0, z174, 0x081, 0, 0, Local0, c012)
1478		}
1479
1480		return (0)
1481	}
1482
1483	// Exceptions when the table contained in an OpRegion
1484	// (Field) is not an SSDT
1485	Method(tstd, 1, Serialized)
1486	{
1487		Name(HI0, 0)
1488
1489		Concatenate(arg0, "-tstd", arg0)
1490
1491		if (CondRefof(\SSS0, Local0)) {
1492			err(arg0, z174, 0x082, 0, 0, "\\SSS0", 1)
1493			return (1)
1494		}
1495
1496		Store(BUF0, RFU0)
1497
1498		// Modify the Signature field of the Table Header
1499		Store(SIG, Local0)
1500		Increment(Local0)
1501		Store(Local0, SIG)
1502
1503		// Recalculate and save CheckSum
1504		Store(RFU0, Local0)
1505		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
1506
1507		if (CH03(arg0, z174, 0x083, 0, 0)) {
1508			return (1)
1509		}
1510
1511		// Load operator execution, OpRegion case
1512		if (y290) {
1513			Load(IST0, HI0)
1514			CH04(arg0, 0, 37, z174, 0x084, 0, 0)	// AE_BAD_SIGNATURE
1515
1516			if (CondRefof(\SSS0, Local0)) {
1517				err(arg0, z174, 0x085, 0, 0, "\\SSS0", 1)
1518				return (1)
1519			}
1520		}
1521
1522		// Load operator execution, OpRegion Field case
1523		Load(RFU0, HI0)
1524		CH04(arg0, 0, 37, z174, 0x086, 0, 0)	// AE_BAD_SIGNATURE
1525
1526		if (CondRefof(\SSS0, Local0)) {
1527			err(arg0, z174, 0x087, 0, 0, "\\SSS0", 1)
1528		}
1529
1530		return (0)
1531	}
1532
1533	// Exceptions when the length of the supplied SSDT is greater
1534	// than the length of the respective OpRegion or Region Field,
1535	// or less than the length of the Table Header
1536	// Arg1: 0 - the 'greater' case, 1 - the 'less' case
1537	Method(tste, 2, Serialized)
1538	{
1539		Name(HI0, 0)
1540
1541		Concatenate(arg0, "-tste", arg0)
1542
1543		if (Arg1) {
1544			Concatenate(arg0, ".less", arg0)
1545		}
1546
1547		if (CondRefof(\SSS0, Local0)) {
1548			err(arg0, z174, 0x090, 0, 0, "\\SSS0", 1)
1549			return (1)
1550		}
1551
1552		Store(BUF0, RFU0)
1553
1554		// Modify the Length field of the Table Header
1555		if (Arg1) {
1556			Store(35, Local0)
1557		} else {
1558			Store(Sizeof(BUF0), Local0)
1559			Increment(Local0)
1560		}
1561		Store(Local0, LENG)
1562
1563		// Recalculate and save CheckSum
1564		Store(RFU0, Local0)
1565		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
1566
1567		if (CH03(arg0, z174, 0x091, 0, 0)) {
1568			return (1)
1569		}
1570
1571		// Load operator execution, OpRegion case
1572		if (y290) {
1573			Load(IST0, HI0)
1574			CH04(arg0, 0, 42, z174, 0x092, 0, 0)	// AE_INVALID_TABLE_LENGTH
1575
1576			if (CondRefof(\SSS0, Local0)) {
1577				err(arg0, z174, 0x093, 0, 0, "\\SSS0", 1)
1578
1579				// CleanUp
1580				UnLoad(HI0)
1581				if (CH03(arg0, z174, 0x094, 0, 0)) {
1582					return (1)
1583				}
1584				if (CondRefof(\SSS0, Local0)) {
1585					err(arg0, z174, 0x095, 0, 0, "\\SSS0", 1)
1586					return (1)
1587				}
1588			}
1589		}
1590
1591		// Load operator execution, OpRegion Field case
1592		Load(RFU0, HI0)
1593		if(LNot(arg1)){
1594			// If the table length in the header is larger than the buffer.
1595			CH04(arg0, 0, 54, z174, 0x096, 0, 0)	// AE_AML_BUFFER_LIMIT
1596		} else {
1597			// If the table length is smaller than an ACPI table header.
1598			CH04(arg0, 0, 42, z174, 0x096, 0, 0)    // AE_INVALID_TABLE_LENGTH
1599		}
1600
1601		if (CondRefof(\SSS0, Local0)) {
1602			err(arg0, z174, 0x097, 0, 0, "\\SSS0", 1)
1603			UnLoad(HI0)
1604			if (CH03(arg0, z174, 0x098, 0, 0)) {
1605				return (1)
1606			}
1607			if (CondRefof(\SSS0, Local0)) {
1608				err(arg0, z174, 0x099, 0, 0, "\\SSS0", 1)
1609				return (1)
1610			}
1611		}
1612
1613		return (0)
1614	}
1615
1616	// Exceptions when the checksum of the supplied SSDT is invalid
1617	Method(tstf, 1, Serialized)
1618	{
1619		Name(HI0, 0)
1620
1621		Concatenate(arg0, "-tstf", arg0)
1622
1623		if (CondRefof(\SSS0, Local0)) {
1624			err(arg0, z174, 0x0a0, 0, 0, "\\SSS0", 1)
1625			return (1)
1626		}
1627
1628		Store(BUF0, RFU0)
1629
1630		// Recalculate and save CheckSum
1631		Store(RFU0, Local0)
1632		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
1633
1634		// Spoil the CheckSum
1635		Store(Add(SUM, 1), SUM)
1636
1637		if (CH03(arg0, z174, 0x0a1, 0, 0)) {
1638			return (1)
1639		}
1640
1641		// Load operator execution, OpRegion case
1642		if (y290) {
1643			Load(IST0, HI0)
1644			CH04(arg0, 0, 39, z174, 0x0a2, 0, 0)	// AE_BAD_CHECKSUM
1645
1646			if (CondRefof(\SSS0, Local0)) {
1647				err(arg0, z174, 0x0a3, 0, 0, "\\SSS0", 1)
1648				
1649				//Cleanup
1650				UnLoad(HI0)
1651				if (CH03(arg0, z174, 0x0a4, 0, 0)) {
1652					return (1)
1653				}
1654				Store(Add(SUM, 1), SUM)
1655			}
1656		}
1657
1658		// Load operator execution, OpRegion Field case
1659		Load(RFU0, HI0)
1660		CH04(arg0, 0, 39, z174, 0x0a5, 0, 0)	// AE_BAD_CHECKSUM
1661
1662		if (CondRefof(\SSS0, Local0)) {
1663			err(arg0, z174, 0x0a6, 0, 0, "\\SSS0", 1)
1664
1665			//Cleanup
1666			UnLoad(HI0)
1667			if (CH03(arg0, z174, 0x0a7, 0, 0)) {
1668				return (1)
1669			}
1670			if (CH03(arg0, z174, 0x0a8, 0, 0)) {
1671				return (1)
1672			}
1673		}
1674
1675		return (0)
1676	}
1677
1678	// Object of any type (expect Field Units and Buffer Fields)
1679	// can be used as the DDBHandle argument
1680	Method(tstg, 1, Serialized)
1681	{
1682		Name(DDB0, 0)
1683		Name(DDB1, 0)
1684		Name(DDBH, 0)
1685
1686		Method(m000, 4)
1687		{
1688			Concatenate(arg0, "-m000.", arg0)
1689			Concatenate(arg0, arg1, arg0)
1690
1691			Store(ObjectType(arg2), Local0)
1692			if (LNotEqual(arg3, Local0)) {
1693				err(arg0, z174, 0x0b0, 0, 0, Local0, arg3)
1694				return (1)
1695			}
1696
1697			if (CondRefof(\SSS0, Local0)) {
1698				err(arg0, z174, 0x0b1, 0, 0, "\\SSS0", 1)
1699				return (1)
1700			}
1701
1702			Load(RFU0, arg2)
1703			if (LOr(LEqual(arg3, c00d),	// Field Unit
1704				LEqual(arg3, c016))) {	// Buffer Field
1705
1706				// AE_AML_OPERAND_TYPE
1707				if (CH04(arg0, 2, 47, z174, 0x0e9, 0, 0)) {
1708					return (1)
1709				} else {
1710					return (0)
1711				}
1712			} else {
1713				if (CH03(arg0, z174, 0x0b2, 0, 0)) {
1714					return (1)
1715				}
1716			}
1717			if (y260) {
1718				Store(ObjectType(arg2), Local0)
1719				if (LNotEqual(c017, Local0)) {
1720					err(arg0, z174, 0x0b3, 0, 0, Local0, c017)
1721				}
1722			}
1723			if (CondRefof(\SSS0, Local0)) {
1724			} else {
1725				err(arg0, z174, 0x0b4, 0, 0, "\\SSS0", 0)
1726				return (1)
1727			}
1728
1729			UnLoad(Derefof(arg2))
1730			if (CH03(arg0, z174, 0x0b5, 0, 0)) {
1731				return (1)
1732			}
1733			if (CondRefof(\SSS0, Local0)) {
1734				err(arg0, z174, 0x0b6, 0, 0, "\\SSS0", 1)
1735				return (1)
1736			}
1737
1738			return (0)
1739		}
1740
1741		Concatenate(arg0, "-tstg", arg0)
1742
1743		// Load Auxiliry table
1744		Store(BUF3, RFU3)
1745		Load(RFU3, DDB0)
1746
1747		Store(BUF0, RFU0)
1748
1749		// Recalculate and save CheckSum
1750		Store(RFU0, Local0)
1751		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
1752		if (CH03(arg0, z174, 0x0b7, 0, 0)) {
1753			return (1)
1754		}
1755
1756		// Uninitialized
1757		m000(arg0, "uni", Refof(Local1), c008)
1758
1759		// Integer
1760		m000(arg0, "int", Refof(\AUXD.INT0), c009)
1761
1762		// String
1763		m000(arg0, "str", Refof(\AUXD.STR0), c00a)
1764
1765		// Buffer
1766		m000(arg0, "buf", Refof(\AUXD.BUF0), c00b)
1767
1768		// Package
1769		m000(arg0, "pac", Refof(\AUXD.PAC0), c00c)
1770
1771		// Field Unit
1772		m000(arg0, "flu", Refof(\AUXD.FLU0), c00d)
1773
1774		// Device
1775		m000(arg0, "dev", Refof(\AUXD.DEV0), c00e)
1776
1777		// Event
1778		m000(arg0, "evt", Refof(\AUXD.EVE0), c00f)
1779
1780		// Method
1781		m000(arg0, "met", Refof(\AUXD.MMM0), c010)
1782
1783		// Mutex
1784		m000(arg0, "mtx", Refof(\AUXD.MTX0), c011)
1785
1786		// OpRegion
1787		m000(arg0, "opr", Refof(\AUXD.OPR0), c012)
1788
1789		// Power Resource
1790		m000(arg0, "pwr", Refof(\AUXD.PWR0), c013)
1791
1792		// Processor
1793		m000(arg0, "cpu", Refof(\AUXD.CPU0), c014)
1794
1795		// Thermal Zone
1796		m000(arg0, "tzn", Refof(\AUXD.TZN0), c015)
1797
1798		// Buffer Field
1799		m000(arg0, "bfl", Refof(\AUXD.BFL0), c016)
1800
1801		// DDB Handle
1802		if (y260) {
1803			CopyObject(DDB0, DDB1)
1804			m000(arg0, "ddb", Refof(DDB1), c017)
1805		}
1806		
1807		UnLoad(DDB0)
1808
1809		CH03(arg0, z174, 0x0b8, 0, 0)
1810
1811		return (0)
1812	}
1813
1814	// AE_OWNER_ID_LIMIT exception when too many Tables loaded,
1815	// Arg1: 0 - Load case, 1 - LoadTable case
1816	Method(tsth, 2, Serialized)
1817	{
1818		Name(MAXT, 0xf6)
1819		Name(DDB1, 0)
1820		Name(DDB3, 0)
1821
1822		Concatenate(arg0, "-tsth", arg0)
1823
1824		if (INIT()) {
1825			err(arg0, z174, 0x0c0, 0, 0, "INIT", 1)
1826			return (1)
1827		}
1828		if (CH03(arg0, z174, 0x0c1, 0, 0)) {
1829			return (1)
1830		}
1831		Store(BUF1, RFU1)
1832		Store(BUF3, RFU3)
1833
1834		Store(MAXT, Local0)
1835		while (Local0) {
1836			Store(HI0N, Debug)
1837			if (LD()) {
1838				err(arg0, z174, 0x0c2, 0, 0, "HI0N", HI0N)
1839				return (1)
1840			}
1841			if (CH03(arg0, z174, 0x0c3, 0, 0)) {
1842				return (1)
1843			}
1844			Decrement(Local0)
1845		}
1846
1847		// Methods can not be called after the following Load
1848		// (OWNER_ID is exhausted)
1849		Load(RFU1, DDB1)
1850
1851		// The following Load should cause AE_OWNER_ID_LIMIT
1852		if (Arg1) {
1853			LoadTable("OEM1", "", "",  ,  , )
1854		} else {
1855			Load(RFU3, DDB3)
1856		}
1857
1858		// Futher 1 Method can be called
1859		UnLoad(DDB1)
1860
1861		CH04(arg0, 0, 86, z174, 0x0c4, 0, 0)	// AE_OWNER_ID_LIMIT
1862
1863		Store(MAXT, Local0)
1864		while (Local0) {
1865			if (UNLD()) {
1866				err(arg0, z174, 0x0c5, 0, 0, "HI0N", HI0N)
1867				return (1)
1868			}
1869			if (CH03(arg0, z174, 0x0c6, 0, 0)) {
1870				return (1)
1871			}
1872			Decrement(Local0)
1873		}
1874
1875		if (LDCH(0)) {
1876			err(arg0, z174, 0x0c7, 0, 0, "HI0N", HI0N)
1877			return (1)
1878		}
1879
1880		return (0)
1881	}
1882
1883	// Exception when SSDT specified as the Object parameter
1884	// of the Load operator is already loaded
1885	Method(tsti, 1, Serialized)
1886	{
1887		Name(HI0, 0)
1888		Name(HI1, 0)
1889
1890		Concatenate(arg0, "-tsti", arg0)
1891
1892		if (CondRefof(\SSS0, Local0)) {
1893			err(arg0, z174, 0x0d0, 0, 0, "\\SSS0", 1)
1894			return (1)
1895		}
1896
1897		Store(BUF0, RFU0)
1898
1899		// Recalculate and save CheckSum
1900		Store(RFU0, Local0)
1901		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
1902
1903		if (CH03(arg0, z174, 0x0d1, 0, 0)) {
1904			return (1)
1905		}
1906
1907		// Load operator execution
1908		Load(RFU0, HI0)
1909		if (CH03(arg0, z174, 0x0d2, 0, 0)) {
1910			return (1)
1911		}
1912
1913		if (y260) {
1914			Store(ObjectType(HI0), Local0)
1915			if (LNotEqual(c017, Local0)) {
1916				err(arg0, z174, 0x0d3, 0, 0, Local0, c017)
1917			}
1918		}
1919
1920		if (CondRefof(\SSS0, Local0)) {
1921		} else {
1922			err(arg0, z174, 0x0d4, 0, 0, "\\SSS0", 0)
1923			return (1)
1924		}
1925
1926		Store(5, Local1)
1927
1928		while (Local1) {
1929			// Repeated Load operator execution
1930			Load(RFU0, HI1)
1931			CH04(arg0, 0, 7, z174, 0x0d5, 5, Local1) // AE_ALREADY_EXISTS
1932
1933			Store(ObjectType(HI1), Local0)
1934			if (LNotEqual(c009, Local0)) {
1935				err(arg0, z174, 0x0d6, 0, 0, Local0, c009)
1936			}
1937
1938			Decrement(Local1)
1939		}
1940
1941		UnLoad(HI0)
1942
1943		if (CH03(arg0, z174, 0x0d7, 0, 0)) {
1944			return (1)
1945		}
1946
1947		if (CondRefof(\SSS0, Local0)) {
1948			err(arg0, z174, 0x0d8, 0, 0, "\\SSS0", 1)
1949		}
1950
1951		return (0)
1952	}
1953
1954	// Exception when there already is an previously created Object
1955	// referred by the namepath of the new Object in the Table loaded
1956	Method(tstj, 1, Serialized)
1957	{
1958		Name(HI0, 0)
1959		Name(HI1, 0)
1960
1961		Concatenate(arg0, "-tstj", arg0)
1962
1963		if (CondRefof(\SSS0, Local0)) {
1964			err(arg0, z174, 0x0e0, 0, 0, "\\SSS0", 1)
1965			return (1)
1966		}
1967
1968		Store(BUF0, ^RFU0)
1969
1970		// Recalculate and save CheckSum
1971		Store(^RFU0, Local0)
1972		Store(Add(^SUM, CHSM(Local0, SizeOf (Local0))), ^SUM)
1973
1974		if (CH03(arg0, z174, 0x0e1, 0, 0)) {
1975			return (1)
1976		}
1977
1978		// Load operator execution
1979		Load(^RFU0, HI0)
1980		if (CH03(arg0, z174, 0x0e2, 0, 0)) {
1981			return (1)
1982		}
1983
1984		if (y260) {
1985			Store(ObjectType(HI0), Local0)
1986			if (LNotEqual(c017, Local0)) {
1987				err(arg0, z174, 0x0e3, 0, 0, Local0, c017)
1988			}
1989		}
1990
1991		if (CondRefof(\SSS0, Local0)) {
1992		} else {
1993			err(arg0, z174, 0x0e4, 0, 0, "\\SSS0", 0)
1994			return (1)
1995		}
1996
1997		// Load another table, containing declaration of \SSS0
1998
1999		OperationRegion (IST0, SystemMemory, 0x80000000, 0x34)
2000
2001		Field(IST0, ByteAcc, NoLock, Preserve) {
2002			RFU0, 0x1a0,
2003		}
2004
2005		Field(IST0, ByteAcc, NoLock, Preserve) {
2006			SIG, 32,
2007			LENG, 32,
2008			REV, 8,
2009			SUM, 8,
2010			OID, 48,
2011			OTID, 64,
2012			OREV, 32,
2013			CID, 32,
2014			CREV, 32,
2015			Offset(39),
2016			SSNM, 32,
2017			Offset(47),
2018			SSRT, 32
2019		}
2020
2021		Store(BUF0, RFU0)
2022
2023		// Modify Revision field of SSDT
2024		Store(Add(CREV, 1), CREV)
2025
2026		// Recalculate and save CheckSum
2027		Store(RFU0, Local0)
2028		Store(Add(SUM, CHSM(Local0, SizeOf (Local0))), SUM)
2029
2030		Store(5, Local1)
2031
2032		while (Local1) {
2033			// Any next Load
2034			Load(RFU0, HI1)
2035			CH04(arg0, 0, 7, z174, 0x0e5, 5, Local1) // AE_ALREADY_EXISTS
2036
2037			Store(ObjectType(HI1), Local0)
2038			if (LNotEqual(c009, Local0)) {
2039				err(arg0, z174, 0x0e6, 0, 0, Local0, c009)
2040			}
2041
2042			Decrement(Local1)
2043		}
2044
2045		UnLoad(HI0)
2046
2047		if (CH03(arg0, z174, 0x0e7, 0, 0)) {
2048			return (1)
2049		}
2050
2051		if (CondRefof(\SSS0, Local0)) {
2052			err(arg0, z174, 0x0e8, 0, 0, "\\SSS0", 1)
2053		}
2054
2055		return (0)
2056	}
2057}
2058
2059Method(TLD0,, Serialized)
2060{
2061	Name(ts, "TLD0")
2062
2063	// Loading SSDT from a SystemMemory OpRegion,
2064	// different targets for DDBHandle
2065
2066	CH03(ts, z174, 0x200, 0, 0)
2067
2068	// Named Objects
2069	SRMT("TLD0.tst0")
2070	\DTM0.tst0(ts)
2071
2072	CH03(ts, z174, 0x201, 0, 0)
2073
2074	// LocalX Object
2075	SRMT("TLD0.tst1")
2076	\DTM0.tst1(ts)
2077
2078	CH03(ts, z174, 0x202, 0, 0)
2079
2080	// Package element
2081	SRMT("TLD0.tst2")
2082	\DTM0.tst2(ts)
2083
2084	CH03(ts, z174, 0x203, 0, 0)
2085
2086	// By Reference in ArgX
2087	SRMT("TLD0.tst3")
2088	\DTM0.tst3(ts)
2089
2090	// Loading SSDT from a Field of an OpRegion of any type,
2091	// different targets for DDBHandle
2092
2093	CH03(ts, z174, 0x204, 0, 0)
2094
2095	// SystemMemory Region
2096	SRMT("TLD0.tst4")
2097	\DTM0.tst4(ts)
2098
2099	CH03(ts, z174, 0x205, 0, 0)
2100
2101	// SystemIO Region
2102	SRMT("TLD0.tst5")
2103	\DTM0.tst5(ts)
2104
2105	CH03(ts, z174, 0x206, 0, 0)
2106
2107	// EmbeddedControl Region
2108	SRMT("TLD0.tst6")
2109	\DTM0.tst6(ts)
2110
2111	CH03(ts, z174, 0x207, 0, 0)
2112
2113	// User defined Region
2114	SRMT("TLD0.tst7")
2115	\DTM0.tst7(ts)
2116
2117	CH03(ts, z174, 0x208, 0, 0)
2118
2119	// Check that "namespace location to load the Definition Block
2120	// is relative to the current namespace" scope,
2121	SRMT("TLD0.tst8")
2122	\DTM0.tst8(ts)
2123
2124	CH03(ts, z174, 0x209, 0, 0)
2125
2126	// Check global and dynamic declarations of OpRegions
2127	// and the appropriate _REG Methods invocation for the
2128	// loaded SSDT
2129	SRMT("TLD0.tst9")
2130	\DTM0.tst9(ts)
2131
2132	CH03(ts, z174, 0x20a, 0, 0)
2133
2134	// Object of any type can be used as the DDBHandle argument
2135	SRMT("TLD0.tstg")
2136	\DTM0.tstg(ts)
2137
2138	CH03(ts, z174, 0x20b, 0, 0)
2139
2140	// Loading a number of different SSDTs
2141	SRMT("TLD0.tsta")
2142	if (y261) {
2143		\DTM0.tsta(ts, 240)
2144	} else {
2145		BLCK()
2146	}
2147
2148	CH03(ts, z174, 0x20c, 0, 0)
2149}
2150
2151// Exceptional conditions
2152Method(TLD1,, Serialized)
2153{
2154	Name(ts, "TLD1")
2155
2156	// Exceptions when the Object argument does not refer to
2157	// an operation region field or an operation region
2158	SRMT("TLD1.tstb")
2159	\DTM0.tstb(ts)
2160
2161	// Exceptions when the an OpRegion passed as the Object
2162	// parameter of Load is not of SystemMemory type
2163	SRMT("TLD1.tstc")
2164	\DTM0.tstc(ts)
2165
2166	// Exceptions when the table contained in an OpRegion
2167	// (Field) is not an SSDT
2168	SRMT("TLD1.tstd")
2169	\DTM0.tstd(ts)
2170
2171	// Exceptions when the length of the supplied SSDT is greater
2172	// than the length of the respective OpRegion or Region Field,
2173	SRMT("TLD1.tste.0")
2174	if (y284) {
2175		\DTM0.tste(ts, 0)
2176	} else {
2177		BLCK()
2178	}
2179
2180	// Exceptions when the length of the supplied SSDT is
2181	// less than the length of the Table Header
2182	SRMT("TLD1.tste.1")
2183	\DTM0.tste(ts, 1)
2184
2185	// Exceptions when the checksum of the supplied SSDT is invalid
2186	SRMT("TLD1.tstf")
2187	\DTM0.tstf(ts)
2188
2189	// AE_OWNER_ID_LIMIT exception when too many Tables loaded
2190	SRMT("TLD1.tsth")
2191	if (y294) {
2192		\DTM0.tsth(ts, 0)
2193	} else {
2194		BLCK()
2195	}
2196
2197	// Exception when SSDT specified as the Object parameter
2198	// of the Load operator is already loaded
2199	SRMT("TLD1.tsti")
2200	\DTM0.tsti(ts)
2201
2202	// Exception when there already is an previously created Object
2203	// referred by the namepath of the new Object in the Table loaded
2204	SRMT("TLD1.tstj")
2205	\DTM0.tstj(ts)
2206}
2207