1/*
2 * Some or all of this work - Copyright (c) 2006 - 2021, 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 * Hierarchy of Packages
31 *
32 * It is a 4-level (not including the root Package-node) hierarchy
33 * of Packages. Each package (pkg-node), including the root Package,
34 * has 4 Packages which (not including Package-nodes of the last
35 * 3-th level) in turn has 4 children.
36 * Generate and put into each pkg-node references to all other
37 * pkg-nodes. Then go round all the pkg-nodes and verify read-access
38 * through all the references packed into each of those nodes.
39 *
40 * 0x22 Outstanding allocations because of
41 * AcpiExec doesn't run the unload of the table have been processed.
42 * All they are caused by call to SRMT Method.
43 *
44 * Outstanding: 0x22 allocations after execution.
45 *
46 * chn0 - set it to either 1 or 2:
47 * Name(chn0, 1)	// number of children of pkg-node to be actually processed (1,2,3,4)
48 */
49
50/*
51 * Bit-maps of operations
52 */
53Name(OP00, 0x01)		// read and verify Integer-IDs
54Name(OP01, 0x02)		// re-write Integer-IDs
55Name(OP02, 0x04)		// re-write the whole pkg-nodes
56Name(OP03, 0x08)		// re-write references
57Name(OPFF, 0x0F)		// mask of opcode of operation
58Name(OP10, 0x0f0000)	// type of current (read) Integer-IDs
59Name(OP11, 0x0f00000)	// type of new (re-write) Integer-IDs
60
61/*
62 * Generate references to arg2-number elements of all pkg-nodes
63 * of arg0 and pack up them per-level into arg1.
64 *
65 * arg0 - reference to (Package,pHR0), IRefs to arg2 elements of Pkg-nodes of pHR0
66 * arg1 - (Package,pIRx), are to be stored into elements of pIRx (from 0).
67 * arg2 - number of children of pkg-node to be actually processed
68 * arg3 - index of elements of pkg-nodes of arg0 to be pointed to by ref
69 */
70Method(mfdd, 4, Serialized)
71{
72	Name(ind0, 0)	// cur index of element of arg1-Package where to store ref
73	Name(ind1, 0)
74	Name(ind2, 0)
75	Name(ind3, 0)
76
77	Name(lpN0, 0)
78	Name(lpC0, 0)
79	Name(lpN1, 0)
80	Name(lpC1, 0)
81	Name(lpN2, 0)
82	Name(lpC2, 0)
83	Name(lpN3, 0)
84	Name(lpC3, 0)
85
86	Store(arg2, lpN0)
87	Store(0, lpC0)
88	While (lpN0) {
89
90        Store(Index(DerefOf(arg0), lpC0), Index(DerefOf(Index(arg1, 0)), ind0))
91
92        Store(arg2, lpN1)
93        Store(0, lpC1)
94        While (lpN1) {
95
96          Store(Index(DerefOf(Index(DerefOf(arg0), lpC0)), lpC1), Index(DerefOf(Index(arg1, 1)), ind1))
97
98          Store(arg2, lpN2)
99          Store(0, lpC2)
100          While (lpN2) {
101
102            Store(Index(DerefOf(Index(DerefOf(Index(DerefOf(arg0), lpC0)), lpC1)), lpC2), Index(DerefOf(Index(arg1, 2)), ind2))
103
104            Store(arg2, lpN3)
105            Store(0, lpC3)
106            While (lpN3) {
107
108              Store(Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(arg0), lpC0)), lpC1)), lpC2)), lpC3), Index(DerefOf(Index(arg1, 3)), ind3))
109
110              Increment(ind3)
111              Decrement(lpN3)
112              Increment(lpC3)
113            }
114            Increment(ind2)
115            Decrement(lpN2)
116            Increment(lpC2)
117          }
118          Increment(ind1)
119          Decrement(lpN1)
120          Increment(lpC1)
121        }
122        Increment(ind0)
123        Decrement(lpN0)
124        Increment(lpC0)
125	}
126}
127
128/*
129 * Put reference arg3 into arg2-th elements of all Pkg-nodes of pHR0 Package
130 *
131 * arg0 - reference to Package,pHR0
132 * arg1 - number of children of pkg-node to be actually processed
133 * arg2 - index in arg0-pkg-nodes where to store reference
134 * arg3 - reference
135 */
136Method(mfde, 4, Serialized)
137{
138	Name(lpN0, 0)
139	Name(lpC0, 0)
140	Name(lpN1, 0)
141	Name(lpC1, 0)
142	Name(lpN2, 0)
143	Name(lpC2, 0)
144	Name(lpN3, 0)
145	Name(lpC3, 0)
146
147
148	Store(arg1, lpN0)
149	Store(0, lpC0)
150	While (lpN0) {
151
152        Index(DerefOf(arg0), lpC0, Local0)
153        Store(arg3, Index(DerefOf(Local0), arg2))
154
155        Store(arg1, lpN1)
156        Store(0, lpC1)
157        While (lpN1) {
158
159          Index(DerefOf(arg0), lpC0, Local0)
160          Store(arg3, Index(DerefOf(Index(DerefOf(Local0), lpC1)), arg2))
161
162          Store(arg1, lpN2)
163          Store(0, lpC2)
164          While (lpN2) {
165
166            Index(DerefOf(arg0), lpC0, Local0)
167            Store(arg3, Index(DerefOf(Index(DerefOf(Index(DerefOf(Local0), lpC1)), lpC2)), arg2))
168
169            Store(arg1, lpN3)
170            Store(0, lpC3)
171            While (lpN3) {
172
173              Index(DerefOf(arg0), lpC0, Local0)
174              Store(arg3, Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(Local0), lpC1)), lpC2)), lpC3)), arg2))
175
176              Decrement(lpN3)
177              Increment(lpC3)
178            }
179            Decrement(lpN2)
180            Increment(lpC2)
181          }
182          Decrement(lpN1)
183          Increment(lpC1)
184        }
185        Decrement(lpN0)
186        Increment(lpC0)
187	}
188}
189
190/*
191 * Put elements of package arg0 (references) into elements of arg1
192 *
193 * arg0 - pIRx-Package (references)
194 * arg1 - reference to pHRx-Package (hierarchy) - where to put references
195 * arg2 - number of children of pkg-node to be actually processed
196 * arg3 - start index in arg1 where to store references
197 */
198Method(mfdf, 4, Serialized)
199{
200	Name(ind0, 0)
201	Name(num, 0)
202
203	Name(lpN0, 0)
204	Name(lpC0, 0)
205
206	Name(pp00, Package(1) {})
207	Name(pp01, Package(1) {})
208
209
210	Store(arg2, num)
211
212	/* Level 0 */
213
214	Store(Index(arg0, 0), Local0)
215	Store(DerefOf(Local0), pp00)
216
217	Store(arg3, ind0)
218
219	Store(num, lpN0)
220	Store(0, lpC0)
221	While (lpN0) {
222
223		Index(pp00, lpC0, Local0)
224		Store(DerefOf(Local0), Local1)
225
226		mfde(arg1, arg2, ind0, Local1)
227
228		Increment(ind0)
229		Decrement(lpN0)
230		Increment(lpC0)
231	}
232
233	/* Level 1 */
234
235	Store(Index(arg0, 1), Local0)
236	Store(DerefOf(Local0), pp00)
237
238	Multiply(num, arg2, num)
239
240	Store(num, lpN0)
241	Store(0, lpC0)
242	While (lpN0) {
243
244		Index(pp00, lpC0, Local0)
245		Store(DerefOf(Local0), Local1)
246
247		mfde(arg1, arg2, ind0, Local1)
248
249		Increment(ind0)
250		Decrement(lpN0)
251		Increment(lpC0)
252	}
253
254	/* Level 2 */
255
256	Store(Index(arg0, 2), Local0)
257	Store(DerefOf(Local0), pp00)
258
259	Multiply(num, arg2, num)
260
261	Store(num, lpN0)
262	Store(0, lpC0)
263	While (lpN0) {
264
265		Index(pp00, lpC0, Local0)
266		Store(DerefOf(Local0), Local1)
267
268		mfde(arg1, arg2, ind0, Local1)
269
270		Increment(ind0)
271		Decrement(lpN0)
272		Increment(lpC0)
273	}
274
275	/* Level 3 */
276
277	Store(Index(arg0, 3), Local0)
278	Store(DerefOf(Local0), pp00)
279
280	Multiply(num, arg2, num)
281
282	Store(num, lpN0)
283	Store(0, lpC0)
284	While (lpN0) {
285
286		Index(pp00, lpC0, Local0)
287		Store(DerefOf(Local0), Local1)
288
289		mfde(arg1, arg2, ind0, Local1)
290
291		Increment(ind0)
292		Decrement(lpN0)
293		Increment(lpC0)
294	}
295}
296
297/*
298 * Generate the benchmark value of Integer-ID and
299 * verify by it the actual value of Integer-ID.
300 *
301 * arg0 - coefficient of maximal hierarchy of Packages
302 * arg1 - number of children of pkg-node to be actually processed
303 * arg2 - level + index inside level of source pkg-node
304 * arg3 - level + index inside level of target pkg-node
305 * arg4 - the value of Integer-ID
306 * arg5 - bit-map of operations
307 */
308Method(mfe2, 6, Serialized)
309{
310	/* Index */
311
312	Name(lpN0, 0)
313	Name(lpC0, 0)
314
315	Name(lls0, 0)	// level of source pkg-node
316	Name(ins0, 0)	// index inside level of source pkg-node
317	Name(llt0, 0)	// level of target pkg-node
318	Name(int0, 0)	// index inside level of target pkg-node
319
320	Store(0, Local7)
321
322	And(arg2, 0x0ffff, ins0)
323	ShiftRight(arg2, 16, Local0)
324	And(Local0, 0x0ffff, lls0)
325
326	And(arg3, 0x0ffff, int0)
327	ShiftRight(arg3, 16, Local0)
328	And(Local0, 0x0ffff, llt0)
329
330	And(int0, 0x0ffff, Local2)
331
332	if (llt0) {
333
334		/*
335		 * ASSUMPTION: 256 on 3-th level is maximum
336		 * for this model of packages
337		 */
338		Divide(Local2, 8, Local0, Local1)
339		Multiply(Local1, 64, Local5)
340
341		Divide(Local0, 4, Local0, Local1)
342		Multiply(Local1, 16, Local6)
343		Add(Local5, Local6, Local5)
344
345		Divide(Local0, 2, Local0, Local1)
346		Multiply(Local1, 4, Local6)
347		Add(Local5, Local6, Local5)
348
349		Add(Local5, Local0, Local5)
350	} else {
351		Store(Local2, Local5)
352	}
353
354	Or(0xab000000, Local5, Local3)
355
356	/* Level */
357
358	And(llt0, 0x0f, Local0)
359	ShiftLeft(Local0, 16, Local1)
360	Or(Local1, Local3, Local0)
361
362	Store(mfe3(Local0, arg5, 0), Local1)
363
364	if (LNotEqual(arg4, Local1)) {
365		Store(1, Local7)
366		err("", zFFF, __LINE__, 0, 0, arg4, Local1)
367		Store("================= Params:", debug)
368		Store(arg0, Debug)
369		Store(arg1, Debug)
370		Store(arg2, Debug)
371		Store(arg3, Debug)
372		Store(arg4, Debug)
373		Store(arg5, Debug)
374		Store(lls0, Debug)
375		Store(ins0, Debug)
376		Store(llt0, Debug)
377		Store(int0, Debug)
378		Store("=================.", debug)
379	}
380
381	return (Local7)
382}
383
384/*
385 * Modify Integer-ID
386 *
387 * arg0 - the value of Integer-ID
388 * arg1 - bit-map of operations
389 * arg2 - 0 - for read, 1 - for re-write
390 */
391Method(mfe3, 3)
392{
393	And(arg0, 0xff0fffff, Local0)
394	if (arg2) {
395		And(arg1, OP11, Local1)
396	} else {
397		And(arg1, OP10, Local2)
398		ShiftLeft(Local2, 4, Local1)
399	}
400	Or(Local0, Local1, Local7)
401
402	return (Local7)
403}
404
405/*
406 * Verify the value of Integer-ID of pkg-node
407 *
408 * arg0 - pkg-node Package of pHRx-Package
409 * arg1 - coefficient of maximal hierarchy of Packages
410 * arg2 - number of children of pkg-node to be actually processed
411 * arg3 - start index of location of references in pkg-nodes
412 * arg4 - level of arg0 + index inside level of arg0
413 * arg5 - bit-map of operations
414 * arg6 - index of Integer-ID in pkg-nodes
415 */
416Method(mfe0, 7, Serialized)
417{
418	Name(ind0, 0)
419	Name(num, 0)
420
421	Name(lpN0, 0)
422	Name(lpC0, 0)
423
424	Store(arg2, num)
425
426	/* Level 0 */
427
428	Store(arg3, ind0)
429
430	Store(num, lpN0)
431	Store(0, lpC0)
432	While (lpN0) {
433
434		Index(arg0, ind0, Local0)		// IRef to some ref of pkg-node
435		Store(DerefOf(Local0), Local1)	// reference
436		Store(DerefOf(Local1), Local2)	// another pkg-node referred to
437		Store(DerefOf(Index(Local2, arg6)), Local3)	// Integer-ID
438
439		mfe2(arg1, arg2, arg4, lpC0, Local3, arg5)
440
441		Increment(ind0)
442		Decrement(lpN0)
443		Increment(lpC0)
444	}
445
446	/* Level 1 */
447
448	Multiply(num, arg2, num)
449
450	Store(num, lpN0)
451	Store(0, lpC0)
452	While (lpN0) {
453
454		Index(arg0, ind0, Local0)
455		Store(DerefOf(Local0), Local1)
456		Store(DerefOf(Local1), Local2)
457		Store(DerefOf(Index(Local2, arg6)), Local3)
458
459		Or(0x10000, lpC0, Local7)
460
461		mfe2(arg1, arg2, arg4, Local7, Local3, arg5)
462
463		Increment(ind0)
464		Decrement(lpN0)
465		Increment(lpC0)
466	}
467
468	/* Level 2 */
469
470	Multiply(num, arg2, num)
471
472	Store(num, lpN0)
473	Store(0, lpC0)
474	While (lpN0) {
475
476		Index(arg0, ind0, Local0)
477		Store(DerefOf(Local0), Local1)
478		Store(DerefOf(Local1), Local2)
479		Store(DerefOf(Index(Local2, arg6)), Local3)
480
481		Or(0x20000, lpC0, Local7)
482
483		mfe2(arg1, arg2, arg4, Local7, Local3, arg5)
484
485		Increment(ind0)
486		Decrement(lpN0)
487		Increment(lpC0)
488	}
489
490	/* Level 3 */
491
492	Multiply(num, arg2, num)
493
494	Store(num, lpN0)
495	Store(0, lpC0)
496	While (lpN0) {
497
498		Index(arg0, ind0, Local0)
499		Store(DerefOf(Local0), Local1)
500		Store(DerefOf(Local1), Local2)
501		Store(DerefOf(Index(Local2, arg6)), Local3)
502
503		Or(0x30000, lpC0, Local7)
504
505		mfe2(arg1, arg2, arg4, Local7, Local3, arg5)
506
507		Increment(ind0)
508		Decrement(lpN0)
509		Increment(lpC0)
510	}
511}
512
513/*
514 * Verify the contents of pHRx-Package (Integer-IDs) by read access
515 * through References packed into all pkg-nodes.
516 *
517 * arg0 - pHRx-Package (hierarchy), fully initialized
518 * arg1 - number of children of pkg-node to be actually processed
519 * arg2 - start index of location of references in arg0-pkg-nodes
520 * arg3 - coefficient of maximal hierarchy of Packages
521 * arg4 - bit-map of operations
522 * arg5 - index of Integer-ID in pkg-nodes
523 */
524Method(mfe1, 6, Serialized)
525{
526	Name(lpN0, 0)
527	Name(lpC0, 0)
528	Name(lpN1, 0)
529	Name(lpC1, 0)
530	Name(lpN2, 0)
531	Name(lpC2, 0)
532	Name(lpN3, 0)
533	Name(lpC3, 0)
534
535	Name(pkg0, Package(1) {})
536	Name(pkg1, Package(1) {})
537	Name(pkg2, Package(1) {})
538	Name(pkg3, Package(1) {})
539
540	Store(arg1, lpN0)
541	Store(0, lpC0)
542	While (lpN0) {
543
544        Index(arg0, lpC0, Local0)
545        CopyObject(DerefOf(Local0), pkg0)
546
547        mfe0(pkg0, arg3, arg1, arg2, lpC0, arg4, arg5)
548        Store(arg1, lpN1)
549        Store(0, lpC1)
550        While (lpN1) {
551
552          Index(pkg0, lpC1, Local1)
553          CopyObject(DerefOf(Local1), pkg1)
554          Or(0x10000, lpC1, Local7)
555          mfe0(pkg1, arg3, arg1, arg2, Local7, arg4, arg5)
556
557          Store(arg1, lpN2)
558          Store(0, lpC2)
559          While (lpN2) {
560
561            Index(pkg1, lpC2, Local2)
562            CopyObject(DerefOf(Local2), pkg2)
563            Or(0x20000, lpC2, Local7)
564            mfe0(pkg2, arg3, arg1, arg2, Local7, arg4, arg5)
565            Store(arg1, lpN3)
566            Store(0, lpC3)
567            While (lpN3) {
568
569              Index(pkg2, lpC3, Local3)
570              CopyObject(DerefOf(Local3), pkg3)
571              Or(0x30000, lpC3, Local7)
572              mfe0(pkg3, arg3, arg1, arg2, Local7, arg4, arg5)
573
574              Decrement(lpN3)
575              Increment(lpC3)
576            }
577            Decrement(lpN2)
578            Increment(lpC2)
579          }
580          Decrement(lpN1)
581          Increment(lpC1)
582        }
583        Decrement(lpN0)
584        Increment(lpC0)
585	}
586}
587
588/*
589 * Rewrite Integer-IDs for all pkg-nodes of hierarchy -
590 * read previous value generate new and write back to pkg-node.
591 *
592 * arg0 - reference to Package,pHR0
593 * arg1 - number of children of pkg-node to be actually processed
594 * arg2 - index of Integer-ID in pkg-nodes
595 * arg3 - start index of location of references in pkg-nodes
596 * arg4 - bit-map of operations
597 */
598Method(mfe4, 5, Serialized)
599{
600	Name(lpN0, 0)
601	Name(lpC0, 0)
602	Name(lpN1, 0)
603	Name(lpC1, 0)
604	Name(lpN2, 0)
605	Name(lpC2, 0)
606	Name(lpN3, 0)
607	Name(lpC3, 0)
608
609	Name(lpN4, 0)
610	Name(lpC4, 0)
611
612	Name(nds0, 0) // number of pkg-nodes actually processed
613	Name(iRF0, 0) // current index of element with reference
614
615	Name(op00, 0)
616	Name(wrID, 0)
617	Name(wrPK, 0)
618	Name(wrRF, 0)
619
620	Name(pkg0, Package(1) {})
621	Name(pkg, Package(1) {})
622
623	And(arg4, OPFF, op00)
624
625	Switch (ToInteger (op00)) {
626	Case (0x02) {
627		/* re-write Integer-IDs */
628		Store(1, wrID)
629	}
630	Case (0x04) {
631		/* re-write pkg-nodes */
632		Store(1, wrPK)
633	}
634	Case (0x08) {
635		/* re-write references */
636		Store(mfe5(arg1), nds0)
637		Store(1, wrRF)
638	}
639	Default {
640		return
641	}}
642
643      Store(arg1, lpN0)
644      Store(0, lpC0)
645      While (lpN0) {
646
647        Index(DerefOf(arg0), lpC0, pkg0)	// lpC0-th pkg-node of 0 level
648
649        if (wrID) {
650          Store(DerefOf(Index(DerefOf(pkg0), arg2)), Local7) // Integer-ID
651          Store(mfe3(Local7, arg4, 1), Local6)
652          Store(Local6, Index(DerefOf(pkg0), arg2))
653        } elseif (wrRF) {
654          Store(nds0, lpN4)
655          Store(0, lpC4)
656          Store(arg3, iRF0)
657          While (lpN4) {
658            Store(DerefOf(Index(DerefOf(pkg0), iRF0)), Local7) // reference
659            Store(Local7, Index(DerefOf(pkg0), iRF0))
660            Increment(iRF0)
661            Decrement(lpN4)
662            Increment(lpC4)
663          }
664        }
665
666        Store(arg1, lpN1)
667        Store(0, lpC1)
668        While (lpN1) {
669
670          if (wrID) {
671            Store(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), arg2)), Local7)
672            Store(mfe3(Local7, arg4, 1), Local6)
673            Store(Local6, Index(DerefOf(Index(DerefOf(pkg0), lpC1)), arg2))
674          } elseif (wrRF) {
675            Store(nds0, lpN4)
676            Store(0, lpC4)
677            Store(arg3, iRF0)
678            While (lpN4) {
679              Store(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), iRF0)), Local7)
680              Store(Local7, Index(DerefOf(Index(DerefOf(pkg0), lpC1)), iRF0))
681              Store(Local7, Index(DerefOf(Index(DerefOf(pkg0), lpC1)), iRF0))
682              Increment(iRF0)
683              Decrement(lpN4)
684              Increment(lpC4)
685            }
686          }
687
688          Store(arg1, lpN2)
689          Store(0, lpC2)
690          While (lpN2) {
691
692            if (wrID) {
693              Store(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), arg2)), Local7)
694              Store(mfe3(Local7, arg4, 1), Local6)
695              Store(Local6, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), arg2))
696            } elseif (wrRF) {
697              Store(nds0, lpN4)
698              Store(0, lpC4)
699              Store(arg3, iRF0)
700              While (lpN4) {
701                Store(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), iRF0)), Local7)
702                Store(Local7, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), iRF0))
703                Store(Local7, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), iRF0))
704                Store(Local7, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), iRF0))
705                Increment(iRF0)
706                Decrement(lpN4)
707                Increment(lpC4)
708              }
709            }
710
711            Store(arg1, lpN3)
712            Store(0, lpC3)
713            While (lpN3) {
714
715              if (wrID) {
716                Store(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), arg2)), Local7)
717                Store(mfe3(Local7, arg4, 1), Local6)
718                Store(Local6, Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), arg2))
719              } elseif (wrPK) {
720                Store(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), pkg)
721                if (LEqual(lpC3, 1)) {
722                  Store(pkg, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3))
723                  Store(pkg, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3))
724                  Store(pkg, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3))
725                } else {
726                  Store(pkg, Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3))
727                }
728              } elseif (wrRF) {
729                Store(nds0, lpN4)
730                Store(0, lpC4)
731                Store(arg3, iRF0)
732                While (lpN4) {
733                  Store(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), iRF0)), Local7)
734                  Store(Local7, Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), iRF0))
735                  Store(Local7, Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), iRF0))
736                  Store(Local7, Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), iRF0))
737                  Store(Local7, Index(DerefOf(Index(DerefOf(Index(DerefOf(Index(DerefOf(pkg0), lpC1)), lpC2)), lpC3)), iRF0))
738                  Increment(iRF0)
739                  Decrement(lpN4)
740                  Increment(lpC4)
741                }
742              }
743
744              Decrement(lpN3)
745              Increment(lpC3)
746            }
747            Decrement(lpN2)
748            Increment(lpC2)
749          }
750          Decrement(lpN1)
751          Increment(lpC1)
752        }
753        Decrement(lpN0)
754        Increment(lpC0)
755	}
756}
757
758/*
759 * Return number of pkg-nodes actually processed.
760 *
761 * arg0 - number of children of pkg-node to be actually processed
762 */
763Method(mfe5, 1)
764{
765	Store(arg0, Local0)
766	Multiply(Local0, arg0, Local1)
767	Multiply(Local1, arg0, Local2)
768	Multiply(Local2, arg0, Local3)
769
770	Add(Local0, Local1, Local4)
771	Add(Local2, Local3, Local5)
772
773	Add(Local4, Local5, Local7)
774
775	return (Local7)
776}
777
778/*
779 * Static hierarchy of Packages (maximal):
780 *
781 * 1. Levels: root + 4
782 * 2. Pkg-node: 4 children-Packages
783 * 3. Integer-ID: reflects level (0-3) and index inside level of pkg-node
784 * 4. References: (4+16+64+256) == 340 maximum
785 * 5  Total ==   4 (Pkg-nodes)
786 *           +   1 (Integer-ID)
787 *           + 340 (References to inner nodes)
788 *           + 340 (References to nodes of another hierarchy)
789 *             ===
790 *             685
791 */
792Method(mfdc,, Serialized)
793{
794	Name(pr00, 0)
795
796	/*
797	 * Coefficient of maximal hierarchy of Packages
798	 * represented by this model.
799	 */
800	Name(HR00, 4)
801
802	Name(iint, 4)	// index of Integer-ID in pkg-nodes
803	Name(iirf, 0)	// start index of location of INTERNAL-references in pkg-nodes
804	Name(icrf, 345)	// start index of location of CROSS-references in pkg-nodes
805	Name(sz, 685)	// full size of Package
806	Name(chn0, 1)	// number of children of pkg-node to be actually processed (1,2,3,4)
807
808	/* Package of hierarchy */
809
810	Name(pHR0, Package(sz) {
811        Package(sz) {
812          Package(sz) {
813            Package(sz) {
814              Package(sz) {0,1,2,3, 0xab030000,
815              },
816              Package(sz) {0,1,2,3, 0xab030001,
817              },
818              Package(sz) {0,1,2,3, 0xab030002,
819              },
820              Package(sz) {0,1,2,3, 0xab030003,
821              },
822              0xab020000
823            },
824            Package(sz) {
825              Package(sz) {0,1,2,3, 0xab030004,
826              },
827              Package(sz) {0,1,2,3, 0xab030005,
828              },
829              Package(sz) {0,1,2,3, 0xab030006,
830              },
831              Package(sz) {0,1,2,3, 0xab030007,
832              },
833              0xab020001
834            },
835            Package(sz) {
836              Package(sz) {0,1,2,3, 0xab030008,
837              },
838              Package(sz) {0,1,2,3, 0xab030009,
839              },
840              Package(sz) {0,1,2,3, 0xab03000a,
841              },
842              Package(sz) {0,1,2,3, 0xab03000b,
843              },
844              0xab020002
845            },
846            Package(sz) {
847              Package(sz) {0,1,2,3, 0xab03000c,
848              },
849              Package(sz) {0,1,2,3, 0xab03000d,
850              },
851              Package(sz) {0,1,2,3, 0xab03000e,
852              },
853              Package(sz) {0,1,2,3, 0xab03000f,
854              },
855              0xab020003
856            },
857            0xab010000
858          },
859          Package(sz) {
860            Package(sz) {
861              Package(sz) {0,1,2,3, 0xab030010,
862              },
863              Package(sz) {0,1,2,3, 0xab030011,
864              },
865              Package(sz) {0,1,2,3, 0xab030012,
866              },
867              Package(sz) {0,1,2,3, 0xab030013,
868              },
869              0xab020004
870            },
871            Package(sz) {
872              Package(sz) {0,1,2,3, 0xab030014,
873              },
874              Package(sz) {0,1,2,3, 0xab030015,
875              },
876              Package(sz) {0,1,2,3, 0xab030016,
877              },
878              Package(sz) {0,1,2,3, 0xab030017,
879              },
880              0xab020005
881            },
882            Package(sz) {
883              Package(sz) {0,1,2,3, 0xab030018,
884              },
885              Package(sz) {0,1,2,3, 0xab030019,
886              },
887              Package(sz) {0,1,2,3, 0xab03001a,
888              },
889              Package(sz) {0,1,2,3, 0xab03001b,
890              },
891              0xab020006
892            },
893            Package(sz) {
894              Package(sz) {0,1,2,3, 0xab03001c,
895              },
896              Package(sz) {0,1,2,3, 0xab03001d,
897              },
898              Package(sz) {0,1,2,3, 0xab03001e,
899              },
900              Package(sz) {0,1,2,3, 0xab03001f,
901              },
902              0xab020007
903            },
904            0xab010001
905          },
906          Package(sz) {
907            Package(sz) {
908              Package(sz) {0,1,2,3, 0xab030020,
909              },
910              Package(sz) {0,1,2,3, 0xab030021,
911              },
912              Package(sz) {0,1,2,3, 0xab030022,
913              },
914              Package(sz) {0,1,2,3, 0xab030023,
915              },
916              0xab020008
917            },
918            Package(sz) {
919              Package(sz) {0,1,2,3, 0xab030024,
920              },
921              Package(sz) {0,1,2,3, 0xab030025,
922              },
923              Package(sz) {0,1,2,3, 0xab030026,
924              },
925              Package(sz) {0,1,2,3, 0xab030027,
926              },
927              0xab020009
928            },
929            Package(sz) {
930              Package(sz) {0,1,2,3, 0xab030028,
931              },
932              Package(sz) {0,1,2,3, 0xab030029,
933              },
934              Package(sz) {0,1,2,3, 0xab03002a,
935              },
936              Package(sz) {0,1,2,3, 0xab03002b,
937              },
938              0xab02000a
939            },
940            Package(sz) {
941              Package(sz) {0,1,2,3, 0xab03002c,
942              },
943              Package(sz) {0,1,2,3, 0xab03002d,
944              },
945              Package(sz) {0,1,2,3, 0xab03002e,
946              },
947              Package(sz) {0,1,2,3, 0xab03002f,
948              },
949              0xab02000b
950            },
951            0xab010002
952          },
953          Package(sz) {
954            Package(sz) {
955              Package(sz) {0,1,2,3, 0xab030030,
956              },
957              Package(sz) {0,1,2,3, 0xab030031,
958              },
959              Package(sz) {0,1,2,3, 0xab030032,
960              },
961              Package(sz) {0,1,2,3, 0xab030033,
962              },
963              0xab02000c
964            },
965            Package(sz) {
966              Package(sz) {0,1,2,3, 0xab030034,
967              },
968              Package(sz) {0,1,2,3, 0xab030035,
969              },
970              Package(sz) {0,1,2,3, 0xab030036,
971              },
972              Package(sz) {0,1,2,3, 0xab030037,
973              },
974              0xab02000d
975            },
976            Package(sz) {
977              Package(sz) {0,1,2,3, 0xab030038,
978              },
979              Package(sz) {0,1,2,3, 0xab030039,
980              },
981              Package(sz) {0,1,2,3, 0xab03003a,
982              },
983              Package(sz) {0,1,2,3, 0xab03003b,
984              },
985              0xab02000e
986            },
987            Package(sz) {
988              Package(sz) {0,1,2,3, 0xab03003c,
989              },
990              Package(sz) {0,1,2,3, 0xab03003d,
991              },
992              Package(sz) {0,1,2,3, 0xab03003e,
993              },
994              Package(sz) {0,1,2,3, 0xab03003f,
995              },
996              0xab02000f
997            },
998            0xab010003
999          },
1000          0xab000000
1001        },
1002        Package(sz) {
1003          Package(sz) {
1004            Package(sz) {
1005              Package(sz) {0,1,2,3, 0xab030040,
1006              },
1007              Package(sz) {0,1,2,3, 0xab030041,
1008              },
1009              Package(sz) {0,1,2,3, 0xab030042,
1010              },
1011              Package(sz) {0,1,2,3, 0xab030043,
1012              },
1013              0xab020010
1014            },
1015            Package(sz) {
1016              Package(sz) {0,1,2,3, 0xab030044,
1017              },
1018              Package(sz) {0,1,2,3, 0xab030045,
1019              },
1020              Package(sz) {0,1,2,3, 0xab030046,
1021              },
1022              Package(sz) {0,1,2,3, 0xab030047,
1023              },
1024              0xab020011
1025            },
1026            Package(sz) {
1027              Package(sz) {0,1,2,3, 0xab030048,
1028              },
1029              Package(sz) {0,1,2,3, 0xab030049,
1030              },
1031              Package(sz) {0,1,2,3, 0xab03004a,
1032              },
1033              Package(sz) {0,1,2,3, 0xab03004b,
1034              },
1035              0xab020012
1036            },
1037            Package(sz) {
1038              Package(sz) {0,1,2,3, 0xab03004c,
1039              },
1040              Package(sz) {0,1,2,3, 0xab03004d,
1041              },
1042              Package(sz) {0,1,2,3, 0xab03004e,
1043              },
1044              Package(sz) {0,1,2,3, 0xab03004f,
1045              },
1046              0xab020013
1047            },
1048            0xab010004
1049          },
1050          Package(sz) {
1051            Package(sz) {
1052              Package(sz) {0,1,2,3, 0xab030050,
1053              },
1054              Package(sz) {0,1,2,3, 0xab030051,
1055              },
1056              Package(sz) {0,1,2,3, 0xab030052,
1057              },
1058              Package(sz) {0,1,2,3, 0xab030053,
1059              },
1060              0xab020014
1061            },
1062            Package(sz) {
1063              Package(sz) {0,1,2,3, 0xab030054,
1064              },
1065              Package(sz) {0,1,2,3, 0xab030055,
1066              },
1067              Package(sz) {0,1,2,3, 0xab030056,
1068              },
1069              Package(sz) {0,1,2,3, 0xab030057,
1070              },
1071              0xab020015
1072            },
1073            Package(sz) {
1074              Package(sz) {0,1,2,3, 0xab030058,
1075              },
1076              Package(sz) {0,1,2,3, 0xab030059,
1077              },
1078              Package(sz) {0,1,2,3, 0xab03005a,
1079              },
1080              Package(sz) {0,1,2,3, 0xab03005b,
1081              },
1082              0xab020016
1083            },
1084            Package(sz) {
1085              Package(sz) {0,1,2,3, 0xab03005c,
1086              },
1087              Package(sz) {0,1,2,3, 0xab03005d,
1088              },
1089              Package(sz) {0,1,2,3, 0xab03005e,
1090              },
1091              Package(sz) {0,1,2,3, 0xab03005f,
1092              },
1093              0xab020017
1094            },
1095            0xab010005
1096          },
1097          Package(sz) {
1098            Package(sz) {
1099              Package(sz) {0,1,2,3, 0xab030060,
1100              },
1101              Package(sz) {0,1,2,3, 0xab030061,
1102              },
1103              Package(sz) {0,1,2,3, 0xab030062,
1104              },
1105              Package(sz) {0,1,2,3, 0xab030063,
1106              },
1107              0xab020018
1108            },
1109            Package(sz) {
1110              Package(sz) {0,1,2,3, 0xab030064,
1111              },
1112              Package(sz) {0,1,2,3, 0xab030065,
1113              },
1114              Package(sz) {0,1,2,3, 0xab030066,
1115              },
1116              Package(sz) {0,1,2,3, 0xab030067,
1117              },
1118              0xab020019
1119            },
1120            Package(sz) {
1121              Package(sz) {0,1,2,3, 0xab030068,
1122              },
1123              Package(sz) {0,1,2,3, 0xab030069,
1124              },
1125              Package(sz) {0,1,2,3, 0xab03006a,
1126              },
1127              Package(sz) {0,1,2,3, 0xab03006b,
1128              },
1129              0xab02001a
1130            },
1131            Package(sz) {
1132              Package(sz) {0,1,2,3, 0xab03006c,
1133              },
1134              Package(sz) {0,1,2,3, 0xab03006d,
1135              },
1136              Package(sz) {0,1,2,3, 0xab03006e,
1137              },
1138              Package(sz) {0,1,2,3, 0xab03006f,
1139              },
1140              0xab02001b
1141            },
1142            0xab010006
1143          },
1144          Package(sz) {
1145            Package(sz) {
1146              Package(sz) {0,1,2,3, 0xab030070,
1147              },
1148              Package(sz) {0,1,2,3, 0xab030071,
1149              },
1150              Package(sz) {0,1,2,3, 0xab030072,
1151              },
1152              Package(sz) {0,1,2,3, 0xab030073,
1153              },
1154              0xab02001c
1155            },
1156            Package(sz) {
1157              Package(sz) {0,1,2,3, 0xab030074,
1158              },
1159              Package(sz) {0,1,2,3, 0xab030075,
1160              },
1161              Package(sz) {0,1,2,3, 0xab030076,
1162              },
1163              Package(sz) {0,1,2,3, 0xab030077,
1164              },
1165              0xab02001d
1166            },
1167            Package(sz) {
1168              Package(sz) {0,1,2,3, 0xab030078,
1169              },
1170              Package(sz) {0,1,2,3, 0xab030079,
1171              },
1172              Package(sz) {0,1,2,3, 0xab03007a,
1173              },
1174              Package(sz) {0,1,2,3, 0xab03007b,
1175              },
1176              0xab02001e
1177            },
1178            Package(sz) {
1179              Package(sz) {0,1,2,3, 0xab03007c,
1180              },
1181              Package(sz) {0,1,2,3, 0xab03007d,
1182              },
1183              Package(sz) {0,1,2,3, 0xab03007e,
1184              },
1185              Package(sz) {0,1,2,3, 0xab03007f,
1186              },
1187              0xab02001f
1188            },
1189            0xab010007
1190          },
1191          0xab000001
1192        },
1193        Package(sz) {
1194          Package(sz) {
1195            Package(sz) {
1196              Package(sz) {0,1,2,3, 0xab030080,
1197              },
1198              Package(sz) {0,1,2,3, 0xab030081,
1199              },
1200              Package(sz) {0,1,2,3, 0xab030082,
1201              },
1202              Package(sz) {0,1,2,3, 0xab030083,
1203              },
1204              0xab020020
1205            },
1206            Package(sz) {
1207              Package(sz) {0,1,2,3, 0xab030084,
1208              },
1209              Package(sz) {0,1,2,3, 0xab030085,
1210              },
1211              Package(sz) {0,1,2,3, 0xab030086,
1212              },
1213              Package(sz) {0,1,2,3, 0xab030087,
1214              },
1215              0xab020021
1216            },
1217            Package(sz) {
1218              Package(sz) {0,1,2,3, 0xab030088,
1219              },
1220              Package(sz) {0,1,2,3, 0xab030089,
1221              },
1222              Package(sz) {0,1,2,3, 0xab03008a,
1223              },
1224              Package(sz) {0,1,2,3, 0xab03008b,
1225              },
1226              0xab020022
1227            },
1228            Package(sz) {
1229              Package(sz) {0,1,2,3, 0xab03008c,
1230              },
1231              Package(sz) {0,1,2,3, 0xab03008d,
1232              },
1233              Package(sz) {0,1,2,3, 0xab03008e,
1234              },
1235              Package(sz) {0,1,2,3, 0xab03008f,
1236              },
1237              0xab020023
1238            },
1239            0xab010008
1240          },
1241          Package(sz) {
1242            Package(sz) {
1243              Package(sz) {0,1,2,3, 0xab030090,
1244              },
1245              Package(sz) {0,1,2,3, 0xab030091,
1246              },
1247              Package(sz) {0,1,2,3, 0xab030092,
1248              },
1249              Package(sz) {0,1,2,3, 0xab030093,
1250              },
1251              0xab020024
1252            },
1253            Package(sz) {
1254              Package(sz) {0,1,2,3, 0xab030094,
1255              },
1256              Package(sz) {0,1,2,3, 0xab030095,
1257              },
1258              Package(sz) {0,1,2,3, 0xab030096,
1259              },
1260              Package(sz) {0,1,2,3, 0xab030097,
1261              },
1262              0xab020025
1263            },
1264            Package(sz) {
1265              Package(sz) {0,1,2,3, 0xab030098,
1266              },
1267              Package(sz) {0,1,2,3, 0xab030099,
1268              },
1269              Package(sz) {0,1,2,3, 0xab03009a,
1270              },
1271              Package(sz) {0,1,2,3, 0xab03009b,
1272              },
1273              0xab020026
1274            },
1275            Package(sz) {
1276              Package(sz) {0,1,2,3, 0xab03009c,
1277              },
1278              Package(sz) {0,1,2,3, 0xab03009d,
1279              },
1280              Package(sz) {0,1,2,3, 0xab03009e,
1281              },
1282              Package(sz) {0,1,2,3, 0xab03009f,
1283              },
1284              0xab020027
1285            },
1286            0xab010009
1287          },
1288          Package(sz) {
1289            Package(sz) {
1290              Package(sz) {0,1,2,3, 0xab0300a0,
1291              },
1292              Package(sz) {0,1,2,3, 0xab0300a1,
1293              },
1294              Package(sz) {0,1,2,3, 0xab0300a2,
1295              },
1296              Package(sz) {0,1,2,3, 0xab0300a3,
1297              },
1298              0xab020028
1299            },
1300            Package(sz) {
1301              Package(sz) {0,1,2,3, 0xab0300a4,
1302              },
1303              Package(sz) {0,1,2,3, 0xab0300a5,
1304              },
1305              Package(sz) {0,1,2,3, 0xab0300a6,
1306              },
1307              Package(sz) {0,1,2,3, 0xab0300a7,
1308              },
1309              0xab020029
1310            },
1311            Package(sz) {
1312              Package(sz) {0,1,2,3, 0xab0300a8,
1313              },
1314              Package(sz) {0,1,2,3, 0xab0300a9,
1315              },
1316              Package(sz) {0,1,2,3, 0xab0300aa,
1317              },
1318              Package(sz) {0,1,2,3, 0xab0300ab,
1319              },
1320              0xab02002a
1321            },
1322            Package(sz) {
1323              Package(sz) {0,1,2,3, 0xab0300ac,
1324              },
1325              Package(sz) {0,1,2,3, 0xab0300ad,
1326              },
1327              Package(sz) {0,1,2,3, 0xab0300ae,
1328              },
1329              Package(sz) {0,1,2,3, 0xab0300af,
1330              },
1331              0xab02002b
1332            },
1333            0xab01000a
1334          },
1335          Package(sz) {
1336            Package(sz) {
1337              Package(sz) {0,1,2,3, 0xab0300b0,
1338              },
1339              Package(sz) {0,1,2,3, 0xab0300b1,
1340              },
1341              Package(sz) {0,1,2,3, 0xab0300b2,
1342              },
1343              Package(sz) {0,1,2,3, 0xab0300b3,
1344              },
1345              0xab02002c
1346            },
1347            Package(sz) {
1348              Package(sz) {0,1,2,3, 0xab0300b4,
1349              },
1350              Package(sz) {0,1,2,3, 0xab0300b5,
1351              },
1352              Package(sz) {0,1,2,3, 0xab0300b6,
1353              },
1354              Package(sz) {0,1,2,3, 0xab0300b7,
1355              },
1356              0xab02002d
1357            },
1358            Package(sz) {
1359              Package(sz) {0,1,2,3, 0xab0300b8,
1360              },
1361              Package(sz) {0,1,2,3, 0xab0300b9,
1362              },
1363              Package(sz) {0,1,2,3, 0xab0300ba0,
1364              },
1365              Package(sz) {0,1,2,3, 0xab0300bb,
1366              },
1367              0xab02002e
1368            },
1369            Package(sz) {
1370              Package(sz) {0,1,2,3, 0xab0300bc,
1371              },
1372              Package(sz) {0,1,2,3, 0xab0300bd,
1373              },
1374              Package(sz) {0,1,2,3, 0xab0300be,
1375              },
1376              Package(sz) {0,1,2,3, 0xab0300bf,
1377              },
1378              0xab02002f
1379            },
1380            0xab01000b
1381          },
1382          0xab000002
1383        },
1384        Package(sz) {
1385          Package(sz) {
1386            Package(sz) {
1387              Package(sz) {0,1,2,3, 0xab0300c0,
1388              },
1389              Package(sz) {0,1,2,3, 0xab0300c1,
1390              },
1391              Package(sz) {0,1,2,3, 0xab0300c2,
1392              },
1393              Package(sz) {0,1,2,3, 0xab0300c3,
1394              },
1395              0xab020030
1396            },
1397            Package(sz) {
1398              Package(sz) {0,1,2,3, 0xab0300c4,
1399              },
1400              Package(sz) {0,1,2,3, 0xab0300c5,
1401              },
1402              Package(sz) {0,1,2,3, 0xab0300c6,
1403              },
1404              Package(sz) {0,1,2,3, 0xab0300c7,
1405              },
1406              0xab020031
1407            },
1408            Package(sz) {
1409              Package(sz) {0,1,2,3, 0xab0300c8,
1410              },
1411              Package(sz) {0,1,2,3, 0xab0300c9,
1412              },
1413              Package(sz) {0,1,2,3, 0xab0300ca,
1414              },
1415              Package(sz) {0,1,2,3, 0xab0300cb,
1416              },
1417              0xab020032
1418            },
1419            Package(sz) {
1420              Package(sz) {0,1,2,3, 0xab0300cc,
1421              },
1422              Package(sz) {0,1,2,3, 0xab0300cd,
1423              },
1424              Package(sz) {0,1,2,3, 0xab0300ce,
1425              },
1426              Package(sz) {0,1,2,3, 0xab0300cf,
1427              },
1428              0xab020033
1429            },
1430            0xab01000c
1431          },
1432          Package(sz) {
1433            Package(sz) {
1434              Package(sz) {0,1,2,3, 0xab0300d0,
1435              },
1436              Package(sz) {0,1,2,3, 0xab0300d1,
1437              },
1438              Package(sz) {0,1,2,3, 0xab0300d2,
1439              },
1440              Package(sz) {0,1,2,3, 0xab0300d3,
1441              },
1442              0xab020034
1443            },
1444            Package(sz) {
1445              Package(sz) {0,1,2,3, 0xab0300d4,
1446              },
1447              Package(sz) {0,1,2,3, 0xab0300d5,
1448              },
1449              Package(sz) {0,1,2,3, 0xab0300d6,
1450              },
1451              Package(sz) {0,1,2,3, 0xab0300d7,
1452              },
1453              0xab020035
1454            },
1455            Package(sz) {
1456              Package(sz) {0,1,2,3, 0xab0300d8,
1457              },
1458              Package(sz) {0,1,2,3, 0xab0300d9,
1459              },
1460              Package(sz) {0,1,2,3, 0xab0300da,
1461              },
1462              Package(sz) {0,1,2,3, 0xab0300db,
1463              },
1464              0xab020036
1465            },
1466            Package(sz) {
1467              Package(sz) {0,1,2,3, 0xab0300dc,
1468              },
1469              Package(sz) {0,1,2,3, 0xab0300dd,
1470              },
1471              Package(sz) {0,1,2,3, 0xab0300de,
1472              },
1473              Package(sz) {0,1,2,3, 0xab0300df,
1474              },
1475              0xab020037
1476            },
1477            0xab01000d
1478          },
1479          Package(sz) {
1480            Package(sz) {
1481              Package(sz) {0,1,2,3, 0xab0300e0,
1482              },
1483              Package(sz) {0,1,2,3, 0xab0300e1,
1484              },
1485              Package(sz) {0,1,2,3, 0xab0300e2,
1486              },
1487              Package(sz) {0,1,2,3, 0xab0300e3,
1488              },
1489              0xab020038
1490            },
1491            Package(sz) {
1492              Package(sz) {0,1,2,3, 0xab0300e4,
1493              },
1494              Package(sz) {0,1,2,3, 0xab0300e5,
1495              },
1496              Package(sz) {0,1,2,3, 0xab0300e6,
1497              },
1498              Package(sz) {0,1,2,3, 0xab0300e7,
1499              },
1500              0xab020039
1501            },
1502            Package(sz) {
1503              Package(sz) {0,1,2,3, 0xab0300e8,
1504              },
1505              Package(sz) {0,1,2,3, 0xab0300e9,
1506              },
1507              Package(sz) {0,1,2,3, 0xab0300ea,
1508              },
1509              Package(sz) {0,1,2,3, 0xab0300eb,
1510              },
1511              0xab02003a
1512            },
1513            Package(sz) {
1514              Package(sz) {0,1,2,3, 0xab0300ec,
1515              },
1516              Package(sz) {0,1,2,3, 0xab0300ed,
1517              },
1518              Package(sz) {0,1,2,3, 0xab0300ee,
1519              },
1520              Package(sz) {0,1,2,3, 0xab0300ef,
1521              },
1522              0xab02003b
1523            },
1524            0xab01000e
1525          },
1526          Package(sz) {
1527            Package(sz) {
1528              Package(sz) {0,1,2,3, 0xab0300f0,
1529              },
1530              Package(sz) {0,1,2,3, 0xab0300f1,
1531              },
1532              Package(sz) {0,1,2,3, 0xab0300f2,
1533              },
1534              Package(sz) {0,1,2,3, 0xab0300f3,
1535              },
1536              0xab02003c
1537            },
1538            Package(sz) {
1539              Package(sz) {0,1,2,3, 0xab0300f4,
1540              },
1541              Package(sz) {0,1,2,3, 0xab0300f5,
1542              },
1543              Package(sz) {0,1,2,3, 0xab0300f6,
1544              },
1545              Package(sz) {0,1,2,3, 0xab0300f7,
1546              },
1547              0xab02003d
1548            },
1549            Package(sz) {
1550              Package(sz) {0,1,2,3, 0xab0300f8,
1551              },
1552              Package(sz) {0,1,2,3, 0xab0300f9,
1553              },
1554              Package(sz) {0,1,2,3, 0xab0300fa,
1555              },
1556              Package(sz) {0,1,2,3, 0xab0300fb,
1557              },
1558              0xab02003e
1559            },
1560            Package(sz) {
1561              Package(sz) {0,1,2,3, 0xab0300fc,
1562              },
1563              Package(sz) {0,1,2,3, 0xab0300fd,
1564              },
1565              Package(sz) {0,1,2,3, 0xab0300fe,
1566              },
1567              Package(sz) {0,1,2,3, 0xab0300ff,
1568              },
1569              0xab02003f
1570            },
1571            0xab01000f
1572          },
1573          0xab000003
1574        },
1575        0xabababab
1576      })
1577
1578	Name(pIR0, Package(4) {
1579		Package(4) {},
1580		Package(16) {},
1581		Package(64) {},
1582		Package(256) {}
1583		})
1584	Name(pIR1, Package(4) {
1585		Package(4) {},
1586		Package(16) {},
1587		Package(64) {},
1588		Package(256) {}
1589		})
1590
1591	Name(pHR1, Package(1) {})
1592	Name(pHR2, Package(1) {})
1593
1594	Add(iint, 1, iirf)
1595
1596	Concatenate("chn0 of model is equal to ", chn0, Debug)
1597
1598	/*
1599	 * ########## References to pkg-nodes inside one hierarchy ##########
1600	 */
1601
1602SRMT("gen-inner-refs-to-pkg-nodes-of-pHR0")
1603
1604	/*
1605	 * Generate references to chn0-number elements of all pkg-nodes of pHR0
1606	 * and pack up them per-level into pIR0.
1607	 */
1608	mfdd(RefOf(pHR0), pIR0, chn0, iint)
1609
1610	/*
1611	 * Put elements of package pIR0 (references) into relevant elements
1612	 * of pkg-nodes of pHR0.
1613	 */
1614	mfdf(pIR0, RefOf(pHR0), chn0, iirf)
1615
1616SRMT("verify-0-of-pHR0-by-inner-refs")
1617
1618	/*
1619	 * Verify the contents of pHR0 (Integer-IDs of pkg-nodes)
1620	 * by read access through References packed into all its pkg-nodes.
1621	 *
1622	 * mfe1() does reading unconditionally:
1623	 *  read:  0 - type of current (read) Integer-IDs
1624	 */
1625	mfe1(pHR0, chn0, iirf, HR00, 0, iint)
1626
1627SRMT("rewrite-1-Integer-IDs-of-pHR0")
1628
1629	/*
1630	 * Rewrite Integer-IDs for all pkg-nodes of hierarchy (pHR0) -
1631	 * read previous value, generate new and write back to pkg-node.
1632	 *
1633	 *  re-write I-ID: 1 - type of new (re-write) Integer-IDs
1634	 */
1635	Or(OP01, 0x100000, Local0)	// re-write I-ID + type of new (re-write) Integer-IDs
1636	mfe4(RefOf(pHR0), chn0, iint, iirf, Local0)
1637
1638SRMT("verify-1-of-pHR0-by-inner-refs")
1639
1640	/*
1641	 * Verify the new Integer-IDs of hierarchy.
1642	 *
1643	 * mfe1() does reading unconditionally:
1644	 *  read:  1 - type of current (read) Integer-IDs
1645	 */
1646	Or(0, 0x10000, Local0)	// type of current (read) Integer-IDs
1647	mfe1(pHR0, chn0, iirf, HR00, Local0, iint)
1648
1649SRMT("rewrite-pkg-nodes-of-pHR0")
1650
1651	/*
1652	 * Rewrite the whole pkg-nodes of hierarchy -
1653	 * take each pkg-node and re-write it back to the same location.
1654	 *
1655	 *  re-write pkg-nodes
1656	 */
1657	mfe4(RefOf(pHR0), chn0, iint, iirf, OP02)
1658
1659SRMT("verify-1-of-pHR0-by-inner-refs")
1660
1661	/*
1662	 * Verify Integer-IDs of hierarchy: nothing should change.
1663	 *
1664	 * mfe1() does reading unconditionally:
1665	 *  read:  1 - type of current (read) Integer-IDs
1666	 */
1667	Or(0, 0x10000, Local0)	// type of current (read) Integer-IDs
1668	mfe1(pHR0, chn0, iirf, HR00, Local0, iint)
1669
1670	/*
1671	 * ############# Duplicate of hierarchy #############
1672	 */
1673
1674SRMT("Duplicate-pHR0-to-pHR1")
1675
1676	/*
1677	 * Copy hierarchy to another object
1678	 */
1679	Store(pHR0, pHR1)
1680
1681	/*
1682	 * Verify Integer-IDs of both instances of hierarchy:
1683	 * nothing should change. References of both hierarchies
1684	 * point to the same pkg-nodes, so, Integer-IDs should
1685	 * be the same.
1686	 *
1687	 * mfe1() does reading unconditionally:
1688	 *  read:  1 - type of current (read) Integer-IDs
1689	 */
1690	Or(0, 0x10000, Local0)	// type of current (read) Integer-IDs
1691SRMT("verify-1-of-pHR0-by-inner-refs")
1692	mfe1(pHR0, chn0, iirf, HR00, Local0, iint)
1693SRMT("verify-1-of-pHR0-by-inner-refs-duplicated-to-pHR1")
1694	mfe1(pHR1, chn0, iirf, HR00, Local0, iint)
1695
1696
1697SRMT("rewrite-2-Integer-IDs-of-pHR0")
1698
1699	/*
1700	 * Rewrite Integer-IDs for all pkg-nodes of source hierarchy.
1701	 *
1702	 *  re-write I-ID: 2 - type of new (re-write) Integer-IDs
1703	 */
1704	Or(OP01, 0x200000, Local0)	// re-write I-ID + type of new (re-write) Integer-IDs
1705	mfe4(RefOf(pHR0), chn0, iint, iirf, Local0)
1706
1707	/*
1708	 * Verify new Integer-IDs through the References of both hierarchies
1709	 * (both point to the same pkg-nodes).
1710	 *
1711	 * mfe1() does reading unconditionally:
1712	 *  read:  2 - type of current (read) Integer-IDs
1713	 */
1714	Or(0, 0x20000, Local0)	// type of current (read) Integer-IDs
1715SRMT("verify-2-of-pHR0-by-inner-refs")
1716	mfe1(pHR0, chn0, iirf, HR00, Local0, iint)
1717SRMT("verify-2-of-pHR0-by-inner-refs-duplicated-to-pHR1")
1718	mfe1(pHR1, chn0, iirf, HR00, Local0, iint)
1719
1720SRMT("rewrite-inner-references-of-pHR0")
1721
1722	/*
1723	 * Rewrite all references present in pkg-nodes of hierarchy pHR0 -
1724	 * take each reference and re-write it back to the same location.
1725	 *
1726	 *  re-write references
1727	 */
1728	mfe4(RefOf(pHR0), chn0, iint, iirf, OP03)
1729
1730	/*
1731	 * Verify Integer-IDs of both instances of hierarchy: nothing should change.
1732	 *
1733	 * mfe1() does reading unconditionally:
1734	 *  read:  2 - type of current (read) Integer-IDs
1735	 */
1736	Or(0, 0x20000, Local0)	// type of current (read) Integer-IDs
1737SRMT("verify-2-of-pHR0-by-inner-refs")
1738	mfe1(pHR0, chn0, iirf, HR00, Local0, iint)
1739SRMT("verify-2-of-pHR0-by-inner-refs-duplicated-to-pHR1")
1740	mfe1(pHR1, chn0, iirf, HR00, Local0, iint)
1741
1742	/*
1743	 * #######                    Cross references                    #######
1744	 * #######                                                        #######
1745	 * ####### References to pkg-nodes inside each of two hierarchies #######
1746	 * #######  added with references between those two hierarchies. #######
1747	 */
1748
1749SRMT("Duplicate-pHR0-to-pHR2")
1750
1751	/*
1752	 * Copy hierarchy to another object
1753	 */
1754	Store(pHR0, pHR2)
1755
1756SRMT("gen-inner-refs-to-pkg-nodes-of-pHR2")
1757
1758	/*
1759	 * Generate references to chn0-number elements of all pkg-nodes of pHR2
1760	 * and pack up them per-level into pIR1.
1761	 */
1762	mfdd(RefOf(pHR2), pIR1, chn0, iint)
1763
1764	/*
1765	 * Put elements of package pIR1 (references) into relevant elements
1766	 * of pkg-nodes of pHR2.
1767	 */
1768	mfdf(pIR1, RefOf(pHR2), chn0, iirf)
1769
1770	/* ===== Add cross references between two hierarchies, (pHR0 & pHR2) ===== */
1771
1772SRMT("add-inner-refs-to-pkg-nodes-of-pHR2-into-pHR0")
1773
1774	/*
1775	 * Put references to pkg-nodes of pHR2 into nodes of pHR0.
1776	 */
1777	mfdf(pIR1, RefOf(pHR0), chn0, icrf)
1778
1779SRMT("add-inner-refs-to-pkg-nodes-of-pHR0-into-pHR2")
1780
1781	/*
1782	 * Put references to pkg-nodes of pHR0 into nodes of pHR2.
1783	 */
1784	mfdf(pIR0, RefOf(pHR2), chn0, icrf)
1785
1786	/* Re-write + Verify Integer-IDs */
1787
1788SRMT("rewrite-3-Integer-IDs-of-pHR2")
1789	Or(OP01, 0x300000, Local0)
1790	mfe4(RefOf(pHR2), chn0, iint, iirf, Local0)
1791SRMT("verify-3-of-pHR2-by-cross-refs-of-pHR0")
1792	Or(0, 0x30000, Local0)
1793	mfe1(pHR0, chn0, icrf, HR00, Local0, iint)
1794SRMT("verify-2-of-pHR0-by-cross-refs-of-pHR2")
1795	Or(0, 0x20000, Local0)
1796	mfe1(pHR2, chn0, icrf, HR00, Local0, iint)
1797SRMT("rewrite-4-Integer-IDs-of-pHR0")
1798	Or(OP01, 0x400000, Local0)
1799	mfe4(RefOf(pHR0), chn0, iint, iirf, Local0)
1800SRMT("verify-4-of-pHR0-by-cross-refs-of-pHR2")
1801	Or(0, 0x40000, Local0)
1802	mfe1(pHR2, chn0, icrf, HR00, Local0, iint)
1803
1804	/* Re-write pkg-nodes + Verify */
1805
1806SRMT("rewrite-pkg-nodes-of-pHR0")
1807	mfe4(RefOf(pHR0), chn0, iint, icrf, OP02)
1808SRMT("rewrite-pkg-nodes-of-pHR2")
1809	mfe4(RefOf(pHR2), chn0, iint, icrf, OP02)
1810SRMT("verify-3-of-pHR2-by-cross-refs-of-pHR0")
1811	Or(0, 0x30000, Local0)
1812	mfe1(pHR0, chn0, icrf, HR00, Local0, iint)
1813SRMT("verify-4-of-pHR0-by-cross-refs-of-pHR2")
1814	Or(0, 0x40000, Local0)
1815	mfe1(pHR2, chn0, icrf, HR00, Local0, iint)
1816
1817	/* Re-write inner references + Verify */
1818	/* Re-write cross references + Verify */
1819
1820SRMT("rewrite-inner-references-of-pHR0")
1821	mfe4(RefOf(pHR0), chn0, iint, iirf, OP03)
1822SRMT("rewrite-inner-references-of-pHR2")
1823	mfe4(RefOf(pHR2), chn0, iint, iirf, OP03)
1824SRMT("rewrite-cross-references-of-pHR0")
1825	mfe4(RefOf(pHR0), chn0, iint, icrf, OP03)
1826SRMT("rewrite-cross-references-of-pHR2")
1827	mfe4(RefOf(pHR2), chn0, iint, icrf, OP03)
1828
1829SRMT("verify-3-of-pHR2-by-cross-refs-of-pHR0")
1830	Or(0, 0x30000, Local0)
1831	mfe1(pHR0, chn0, icrf, HR00, Local0, iint)
1832SRMT("verify-4-of-pHR0-by-cross-refs-of-pHR2")
1833	Or(0, 0x40000, Local0)
1834	mfe1(pHR2, chn0, icrf, HR00, Local0, iint)
1835}
1836
1837Method(mfdb)
1838{
1839	CH03("", 0, 0x200, __LINE__, 0)
1840	mfdc()
1841	CH03("", 0, 0x202, __LINE__, 0)
1842}
1843