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     * Check for serialized methods
30     */
31    Name (Z173, 0xAD)
32    /*
33     * Proper sequence of calls to Serialized methods with different levels, 0-15, all Serialized
34     */
35    Method (M3B0, 0, Serialized)
36    {
37        Name (I000, 0x00)
38        Method (M000, 0, Serialized)
39        {
40            I000++
41            M001 ()
42        }
43
44        Method (M001, 0, Serialized, 1)
45        {
46            I000++
47            M002 ()
48        }
49
50        Method (M002, 0, Serialized, 2)
51        {
52            I000++
53            M003 ()
54        }
55
56        Method (M003, 0, Serialized, 3)
57        {
58            I000++
59            M004 ()
60        }
61
62        Method (M004, 0, Serialized, 4)
63        {
64            I000++
65            M005 ()
66        }
67
68        Method (M005, 0, Serialized, 5)
69        {
70            I000++
71            M006 ()
72        }
73
74        Method (M006, 0, Serialized, 6)
75        {
76            I000++
77            M007 ()
78        }
79
80        Method (M007, 0, Serialized, 7)
81        {
82            I000++
83            M008 ()
84        }
85
86        Method (M008, 0, Serialized, 8)
87        {
88            I000++
89            M009 ()
90        }
91
92        Method (M009, 0, Serialized, 9)
93        {
94            I000++
95            M010 ()
96        }
97
98        Method (M010, 0, Serialized, 10)
99        {
100            I000++
101            M011 ()
102        }
103
104        Method (M011, 0, Serialized, 11)
105        {
106            I000++
107            M012 ()
108        }
109
110        Method (M012, 0, Serialized, 12)
111        {
112            I000++
113            M013 ()
114        }
115
116        Method (M013, 0, Serialized, 13)
117        {
118            I000++
119            M014 ()
120        }
121
122        Method (M014, 0, Serialized, 14)
123        {
124            I000++
125            M015 ()
126        }
127
128        Method (M015, 0, Serialized, 15)
129        {
130            I000++
131            M016 ()
132        }
133
134        Method (M016, 0, Serialized, 15)
135        {
136            I000++
137            Debug = "m016"
138            If ((I000 != 0x11))
139            {
140                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I000, 0x11)
141            }
142        }
143
144        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
145        M000 ()
146        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
147    }
148
149    /*
150     * Proper sequence of calls to Serialized methods with different levels, 0-15,
151     * alternating Serialized and not-Serialized
152     */
153    Method (M3B1, 0, Serialized)
154    {
155        Name (I000, 0x00)
156        Method (M000, 0, Serialized)
157        {
158            I000++
159            M001 ()
160        }
161
162        Method (M001, 0, NotSerialized)
163        {
164            I000++
165            M002 ()
166        }
167
168        Method (M002, 0, Serialized, 2)
169        {
170            I000++
171            M003 ()
172        }
173
174        Method (M003, 0, NotSerialized)
175        {
176            I000++
177            M004 ()
178        }
179
180        Method (M004, 0, NotSerialized)
181        {
182            I000++
183            M005 ()
184        }
185
186        Method (M005, 0, Serialized, 5)
187        {
188            I000++
189            M006 ()
190        }
191
192        Method (M006, 0, Serialized, 6)
193        {
194            I000++
195            M007 ()
196        }
197
198        Method (M007, 0, NotSerialized)
199        {
200            I000++
201            M008 ()
202        }
203
204        Method (M008, 0, Serialized, 8)
205        {
206            I000++
207            M009 ()
208        }
209
210        Method (M009, 0, Serialized, 9)
211        {
212            I000++
213            M010 ()
214        }
215
216        Method (M010, 0, NotSerialized)
217        {
218            I000++
219            M011 ()
220        }
221
222        Method (M011, 0, NotSerialized)
223        {
224            I000++
225            M012 ()
226        }
227
228        Method (M012, 0, Serialized, 12)
229        {
230            I000++
231            M013 ()
232        }
233
234        Method (M013, 0, Serialized, 13)
235        {
236            I000++
237            M014 ()
238        }
239
240        Method (M014, 0, Serialized, 14)
241        {
242            I000++
243            M015 ()
244        }
245
246        Method (M015, 0, NotSerialized)
247        {
248            I000++
249            M016 ()
250        }
251
252        Method (M016, 0, Serialized, 15)
253        {
254            I000++
255            Debug = "m016"
256            If ((I000 != 0x11))
257            {
258                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I000, 0x11)
259            }
260        }
261
262        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
263        M000 ()
264        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
265    }
266
267    /*
268     * Proper sequence of calls to Serialized methods with different levels, 0-15, all Serialized,
269     * 1-3 on each level
270     */
271    Method (M3B2, 0, Serialized)
272    {
273        Name (I000, 0x00)
274        Name (I001, 0x00)
275        Method (M000, 0, Serialized)
276        {
277            I000++
278            M100 ()
279        }
280
281        Method (M100, 0, Serialized)
282        {
283            I000++
284            M001 ()
285        }
286
287        Method (M001, 0, Serialized, 1)
288        {
289            I000++
290            M002 ()
291        }
292
293        Method (M002, 0, Serialized, 2)
294        {
295            I000++
296            M102 ()
297        }
298
299        Method (M102, 0, Serialized, 2)
300        {
301            I000++
302            M003 ()
303        }
304
305        Method (M003, 0, Serialized, 3)
306        {
307            I000++
308            M004 ()
309        }
310
311        Method (M004, 0, Serialized, 4)
312        {
313            I000++
314            M104 ()
315        }
316
317        Method (M104, 0, Serialized, 4)
318        {
319            I000++
320            M005 ()
321        }
322
323        Method (M005, 0, Serialized, 5)
324        {
325            I000++
326            M006 ()
327        }
328
329        Method (M006, 0, Serialized, 6)
330        {
331            I000++
332            M106 ()
333        }
334
335        Method (M106, 0, Serialized, 6)
336        {
337            I000++
338            M007 ()
339        }
340
341        Method (M007, 0, Serialized, 7)
342        {
343            I000++
344            M107 ()
345        }
346
347        Method (M107, 0, Serialized, 7)
348        {
349            I000++
350            M008 ()
351        }
352
353        Method (M008, 0, Serialized, 8)
354        {
355            I000++
356            M108 ()
357        }
358
359        Method (M108, 0, Serialized, 8)
360        {
361            I000++
362            M009 ()
363        }
364
365        Method (M009, 0, Serialized, 9)
366        {
367            I000++
368            M109 ()
369        }
370
371        Method (M109, 0, Serialized, 9)
372        {
373            I000++
374            M209 ()
375        }
376
377        Method (M209, 0, Serialized, 9)
378        {
379            I000++
380            M010 ()
381        }
382
383        Method (M010, 0, Serialized, 10)
384        {
385            I000++
386            M110 ()
387        }
388
389        Method (M110, 0, Serialized, 10)
390        {
391            I000++
392            M011 ()
393        }
394
395        Method (M011, 0, Serialized, 11)
396        {
397            I000++
398            M111 ()
399        }
400
401        Method (M111, 0, Serialized, 11)
402        {
403            I000++
404            M012 ()
405        }
406
407        Method (M012, 0, Serialized, 12)
408        {
409            I000++
410            M112 ()
411        }
412
413        Method (M112, 0, Serialized, 12)
414        {
415            I000++
416            M013 ()
417        }
418
419        Method (M013, 0, Serialized, 13)
420        {
421            I000++
422            M014 ()
423        }
424
425        Method (M014, 0, Serialized, 14)
426        {
427            I000++
428            M015 ()
429        }
430
431        Method (M015, 0, Serialized, 15)
432        {
433            I000++
434            M115 ()
435        }
436
437        Method (M115, 0, Serialized, 15)
438        {
439            I000++
440            Debug = "m016"
441            If ((I000 != 0x1C))
442            {
443                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I000, 0x1C)
444            }
445
446            I001 = 0xABCD0000
447        }
448
449        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
450        M000 ()
451        If ((I001 != 0xABCD0000))
452        {
453            ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I001, 0xABCD0000)
454        }
455
456        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
457    }
458
459    /*
460     * Check pairs of calls to Serialized methods,
461     * the second method is invoked from the first method.
462     *
463     * All the 256 combinations are verified (16*16):
464     * - the level of the first  method in pair changes in range from 0 up to 15
465     * - the level of the second method in pair changes in range from 0 up to 15
466     *
467     * So all the checkings are provided:
468     *
469     * -   proper sequence of levels (from i-th level to all possible correct levels)
470     * -   proper sequence of levels (from i-th level to i-th level (in particular))
471     * - improper sequence of levels (from i-th level to all possible incorrect levels)
472     *
473     * arg0 - level of first call
474     * arg1 - level of second call
475     * arg2 - how many calls to do
476     */
477    Method (M3B3, 3, Serialized)
478    {
479        Name (I000, 0x00)
480        Name (I001, 0x00)
481        Name (I002, 0x00)
482        Name (I003, 0xABCD0003)
483        Name (I004, 0xABCD0004)
484        Name (I005, 0x00)
485        Method (M000, 1, Serialized)
486        {
487            If (Arg0)
488            {
489                I004 = 0x00
490            }
491            Else
492            {
493                I003 = 0x00
494            }
495
496            MM00 (0x01, I000, I001)
497        }
498
499        Method (M001, 1, Serialized, 1)
500        {
501            If (Arg0)
502            {
503                I004 = 0x01
504            }
505            Else
506            {
507                I003 = 0x01
508            }
509
510            MM00 (0x01, I000, I001)
511        }
512
513        Method (M002, 1, Serialized, 2)
514        {
515            If (Arg0)
516            {
517                I004 = 0x02
518            }
519            Else
520            {
521                I003 = 0x02
522            }
523
524            MM00 (0x01, I000, I001)
525        }
526
527        Method (M003, 1, Serialized, 3)
528        {
529            If (Arg0)
530            {
531                I004 = 0x03
532            }
533            Else
534            {
535                I003 = 0x03
536            }
537
538            MM00 (0x01, I000, I001)
539        }
540
541        Method (M004, 1, Serialized, 4)
542        {
543            If (Arg0)
544            {
545                I004 = 0x04
546            }
547            Else
548            {
549                I003 = 0x04
550            }
551
552            MM00 (0x01, I000, I001)
553        }
554
555        Method (M005, 1, Serialized, 5)
556        {
557            If (Arg0)
558            {
559                I004 = 0x05
560            }
561            Else
562            {
563                I003 = 0x05
564            }
565
566            MM00 (0x01, I000, I001)
567        }
568
569        Method (M006, 1, Serialized, 6)
570        {
571            If (Arg0)
572            {
573                I004 = 0x06
574            }
575            Else
576            {
577                I003 = 0x06
578            }
579
580            MM00 (0x01, I000, I001)
581        }
582
583        Method (M007, 1, Serialized, 7)
584        {
585            If (Arg0)
586            {
587                I004 = 0x07
588            }
589            Else
590            {
591                I003 = 0x07
592            }
593
594            MM00 (0x01, I000, I001)
595        }
596
597        Method (M008, 1, Serialized, 8)
598        {
599            If (Arg0)
600            {
601                I004 = 0x08
602            }
603            Else
604            {
605                I003 = 0x08
606            }
607
608            MM00 (0x01, I000, I001)
609        }
610
611        Method (M009, 1, Serialized, 9)
612        {
613            If (Arg0)
614            {
615                I004 = 0x09
616            }
617            Else
618            {
619                I003 = 0x09
620            }
621
622            MM00 (0x01, I000, I001)
623        }
624
625        Method (M010, 1, Serialized, 10)
626        {
627            If (Arg0)
628            {
629                I004 = 0x0A
630            }
631            Else
632            {
633                I003 = 0x0A
634            }
635
636            MM00 (0x01, I000, I001)
637        }
638
639        Method (M011, 1, Serialized, 11)
640        {
641            If (Arg0)
642            {
643                I004 = 0x0B
644            }
645            Else
646            {
647                I003 = 0x0B
648            }
649
650            MM00 (0x01, I000, I001)
651        }
652
653        Method (M012, 1, Serialized, 12)
654        {
655            If (Arg0)
656            {
657                I004 = 0x0C
658            }
659            Else
660            {
661                I003 = 0x0C
662            }
663
664            MM00 (0x01, I000, I001)
665        }
666
667        Method (M013, 1, Serialized, 13)
668        {
669            If (Arg0)
670            {
671                I004 = 0x0D
672            }
673            Else
674            {
675                I003 = 0x0D
676            }
677
678            MM00 (0x01, I000, I001)
679        }
680
681        Method (M014, 1, Serialized, 14)
682        {
683            If (Arg0)
684            {
685                I004 = 0x0E
686            }
687            Else
688            {
689                I003 = 0x0E
690            }
691
692            MM00 (0x01, I000, I001)
693        }
694
695        Method (M015, 1, Serialized, 15)
696        {
697            If (Arg0)
698            {
699                I004 = 0x0F
700            }
701            Else
702            {
703                I003 = 0x0F
704            }
705
706            MM00 (0x01, I000, I001)
707        }
708
709        Method (MM00, 3, Serialized)
710        {
711            Name (III0, 0x00)
712            Name (III1, 0x00)
713            Name (III2, 0x00)
714            Name (III3, 0x00)
715            Local0 = I002 /* \M3B3.I002 */
716            I002++
717            If ((I002 > I005))
718            {
719                Return (Zero)
720            }
721
722            If (Arg0)
723            {
724                Local1 = Arg2
725            }
726            Else
727            {
728                Local1 = Arg1
729            }
730
731            Switch (ToInteger (Local1))
732            {
733                Case (0x00)
734                {
735                    M000 (Local0)
736                }
737                Case (0x01)
738                {
739                    M001 (Local0)
740                }
741                Case (0x02)
742                {
743                    M002 (Local0)
744                }
745                Case (0x03)
746                {
747                    M003 (Local0)
748                }
749                Case (0x04)
750                {
751                    M004 (Local0)
752                }
753                Case (0x05)
754                {
755                    M005 (Local0)
756                }
757                Case (0x06)
758                {
759                    M006 (Local0)
760                }
761                Case (0x07)
762                {
763                    M007 (Local0)
764                }
765                Case (0x08)
766                {
767                    M008 (Local0)
768                }
769                Case (0x09)
770                {
771                    M009 (Local0)
772                }
773                Case (0x0A)
774                {
775                    M010 (Local0)
776                }
777                Case (0x0B)
778                {
779                    M011 (Local0)
780                }
781                Case (0x0C)
782                {
783                    M012 (Local0)
784                }
785                Case (0x0D)
786                {
787                    M013 (Local0)
788                }
789                Case (0x0E)
790                {
791                    M014 (Local0)
792                }
793                Case (0x0F)
794                {
795                    M015 (Local0)
796                }
797
798            }
799        }
800
801        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
802        I000 = Arg0
803        I001 = Arg1
804        I005 = Arg2
805        MM00 (0x00, I000, I001)
806        If ((Arg0 > Arg1))
807        {
808            CH04 (__METHOD__, 0x00, 0x40, Z173, __LINE__, 0x00, 0x00) /* AE_AML_MUTEX_ORDER */
809        }
810        Else
811        {
812            If ((I003 != Arg0))
813            {
814                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I003, Arg0)
815            }
816
817            If ((I004 != Arg1))
818            {
819                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I004, Arg1)
820            }
821        }
822
823        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
824    }
825
826    Method (M3B4, 0, Serialized)
827    {
828        Name (LPN0, 0x00)
829        Name (LPC0, 0x00)
830        Name (LPN1, 0x00)
831        Name (LPC1, 0x00)
832        LPN0 = 0x10
833        LPC0 = 0x00
834        While (LPN0)
835        {
836            LPN1 = 0x10
837            LPC1 = 0x00
838            While (LPN1)
839            {
840                M3B3 (LPC0, LPC1, 0x02)
841                LPN1--
842                LPC1++
843            }
844
845            LPN0--
846            LPC0++
847        }
848    }
849
850    /*
851     * The same as m3b3 but without Switch
852     *
853     * arg0 - level of first call
854     * arg1 - level of second call
855     */
856    Method (M3B5, 2, Serialized)
857    {
858        Name (I000, 0x00)
859        Name (I001, 0x00)
860        Name (I002, 0x00)
861        Name (I003, 0xABCD0003)
862        Name (I004, 0xABCD0004)
863        Method (M000, 1, Serialized)
864        {
865            If (Arg0)
866            {
867                I004 = 0x00
868            }
869            Else
870            {
871                I003 = 0x00
872            }
873
874            MM00 (0x01, I000, I001)
875        }
876
877        Method (M001, 1, Serialized, 1)
878        {
879            If (Arg0)
880            {
881                I004 = 0x01
882            }
883            Else
884            {
885                I003 = 0x01
886            }
887
888            MM00 (0x01, I000, I001)
889        }
890
891        Method (M002, 1, Serialized, 2)
892        {
893            If (Arg0)
894            {
895                I004 = 0x02
896            }
897            Else
898            {
899                I003 = 0x02
900            }
901
902            MM00 (0x01, I000, I001)
903        }
904
905        Method (M003, 1, Serialized, 3)
906        {
907            If (Arg0)
908            {
909                I004 = 0x03
910            }
911            Else
912            {
913                I003 = 0x03
914            }
915
916            MM00 (0x01, I000, I001)
917        }
918
919        Method (M004, 1, Serialized, 4)
920        {
921            If (Arg0)
922            {
923                I004 = 0x04
924            }
925            Else
926            {
927                I003 = 0x04
928            }
929
930            MM00 (0x01, I000, I001)
931        }
932
933        Method (M005, 1, Serialized, 5)
934        {
935            If (Arg0)
936            {
937                I004 = 0x05
938            }
939            Else
940            {
941                I003 = 0x05
942            }
943
944            MM00 (0x01, I000, I001)
945        }
946
947        Method (M006, 1, Serialized, 6)
948        {
949            If (Arg0)
950            {
951                I004 = 0x06
952            }
953            Else
954            {
955                I003 = 0x06
956            }
957
958            MM00 (0x01, I000, I001)
959        }
960
961        Method (M007, 1, Serialized, 7)
962        {
963            If (Arg0)
964            {
965                I004 = 0x07
966            }
967            Else
968            {
969                I003 = 0x07
970            }
971
972            MM00 (0x01, I000, I001)
973        }
974
975        Method (M008, 1, Serialized, 8)
976        {
977            If (Arg0)
978            {
979                I004 = 0x08
980            }
981            Else
982            {
983                I003 = 0x08
984            }
985
986            MM00 (0x01, I000, I001)
987        }
988
989        Method (M009, 1, Serialized, 9)
990        {
991            If (Arg0)
992            {
993                I004 = 0x09
994            }
995            Else
996            {
997                I003 = 0x09
998            }
999
1000            MM00 (0x01, I000, I001)
1001        }
1002
1003        Method (M010, 1, Serialized, 10)
1004        {
1005            If (Arg0)
1006            {
1007                I004 = 0x0A
1008            }
1009            Else
1010            {
1011                I003 = 0x0A
1012            }
1013
1014            MM00 (0x01, I000, I001)
1015        }
1016
1017        Method (M011, 1, Serialized, 11)
1018        {
1019            If (Arg0)
1020            {
1021                I004 = 0x0B
1022            }
1023            Else
1024            {
1025                I003 = 0x0B
1026            }
1027
1028            MM00 (0x01, I000, I001)
1029        }
1030
1031        Method (M012, 1, Serialized, 12)
1032        {
1033            If (Arg0)
1034            {
1035                I004 = 0x0C
1036            }
1037            Else
1038            {
1039                I003 = 0x0C
1040            }
1041
1042            MM00 (0x01, I000, I001)
1043        }
1044
1045        Method (M013, 1, Serialized, 13)
1046        {
1047            If (Arg0)
1048            {
1049                I004 = 0x0D
1050            }
1051            Else
1052            {
1053                I003 = 0x0D
1054            }
1055
1056            MM00 (0x01, I000, I001)
1057        }
1058
1059        Method (M014, 1, Serialized, 14)
1060        {
1061            If (Arg0)
1062            {
1063                I004 = 0x0E
1064            }
1065            Else
1066            {
1067                I003 = 0x0E
1068            }
1069
1070            MM00 (0x01, I000, I001)
1071        }
1072
1073        Method (M015, 1, Serialized, 15)
1074        {
1075            If (Arg0)
1076            {
1077                I004 = 0x0F
1078            }
1079            Else
1080            {
1081                I003 = 0x0F
1082            }
1083
1084            MM00 (0x01, I000, I001)
1085        }
1086
1087        Method (MM00, 3, NotSerialized)
1088        {
1089            Local0 = I002 /* \M3B5.I002 */
1090            I002++
1091            If ((I002 > 0x02))
1092            {
1093                Return (Zero)
1094            }
1095
1096            If (Arg0)
1097            {
1098                Local1 = Arg2
1099            }
1100            Else
1101            {
1102                Local1 = Arg1
1103            }
1104
1105            If ((Local1 == 0x00))
1106            {
1107                M000 (Local0)
1108            }
1109            ElseIf ((Local1 == 0x01))
1110            {
1111                M001 (Local0)
1112            }
1113            ElseIf ((Local1 == 0x02))
1114            {
1115                M002 (Local0)
1116            }
1117            ElseIf ((Local1 == 0x03))
1118            {
1119                M003 (Local0)
1120            }
1121            ElseIf ((Local1 == 0x04))
1122            {
1123                M004 (Local0)
1124            }
1125            ElseIf ((Local1 == 0x05))
1126            {
1127                M005 (Local0)
1128            }
1129            ElseIf ((Local1 == 0x06))
1130            {
1131                M006 (Local0)
1132            }
1133            ElseIf ((Local1 == 0x07))
1134            {
1135                M007 (Local0)
1136            }
1137            ElseIf ((Local1 == 0x08))
1138            {
1139                M008 (Local0)
1140            }
1141            ElseIf ((Local1 == 0x09))
1142            {
1143                M009 (Local0)
1144            }
1145            ElseIf ((Local1 == 0x0A))
1146            {
1147                M010 (Local0)
1148            }
1149            ElseIf ((Local1 == 0x0B))
1150            {
1151                M011 (Local0)
1152            }
1153            ElseIf ((Local1 == 0x0C))
1154            {
1155                M012 (Local0)
1156            }
1157            ElseIf ((Local1 == 0x0D))
1158            {
1159                M013 (Local0)
1160            }
1161            ElseIf ((Local1 == 0x0E))
1162            {
1163                M014 (Local0)
1164            }
1165            ElseIf ((Local1 == 0x0F))
1166            {
1167                M015 (Local0)
1168            }
1169        }
1170
1171        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
1172        I000 = Arg0
1173        I001 = Arg1
1174        MM00 (0x00, I000, I001)
1175        If ((Arg0 > Arg1))
1176        {
1177            CH04 (__METHOD__, 0x00, 0x40, Z173, __LINE__, 0x00, 0x00) /* AE_AML_MUTEX_ORDER */
1178        }
1179        Else
1180        {
1181            If ((I003 != Arg0))
1182            {
1183                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I003, Arg0)
1184            }
1185
1186            If ((I004 != Arg1))
1187            {
1188                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I004, Arg1)
1189            }
1190        }
1191
1192        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
1193    }
1194
1195    Method (M3B6, 0, Serialized)
1196    {
1197        Name (LPN0, 0x00)
1198        Name (LPC0, 0x00)
1199        Name (LPN1, 0x00)
1200        Name (LPC1, 0x00)
1201        LPN0 = 0x10
1202        LPC0 = 0x00
1203        While (LPN0)
1204        {
1205            LPN1 = 0x10
1206            LPC1 = 0x00
1207            While (LPN1)
1208            {
1209                M3B5 (LPC0, LPC1)
1210                LPN1--
1211                LPC1++
1212            }
1213
1214            LPN0--
1215            LPC0++
1216        }
1217    }
1218
1219    /*
1220     * The same as m3b5 but
1221     * between two Serialized calls non-Serialized calls are performed
1222     *
1223     * arg0 - level of first call
1224     * arg1 - level of second call
1225     * arg2 - how many calls to do
1226     */
1227    Method (M3B7, 3, Serialized)
1228    {
1229        Name (I000, 0x00)
1230        Name (I001, 0x00)
1231        Name (I002, 0x00)
1232        Name (I003, 0xABCD0003)
1233        Name (I004, 0xABCD0004)
1234        Name (I005, 0x00)
1235        Method (M000, 1, Serialized)
1236        {
1237            If (Arg0)
1238            {
1239                I004 = 0x00
1240            }
1241            Else
1242            {
1243                I003 = 0x00
1244            }
1245
1246            MM00 (0x01, I000, I001)
1247        }
1248
1249        Method (M001, 1, Serialized, 1)
1250        {
1251            If (Arg0)
1252            {
1253                I004 = 0x01
1254            }
1255            Else
1256            {
1257                I003 = 0x01
1258            }
1259
1260            MM00 (0x01, I000, I001)
1261        }
1262
1263        Method (M002, 1, Serialized, 2)
1264        {
1265            If (Arg0)
1266            {
1267                I004 = 0x02
1268            }
1269            Else
1270            {
1271                I003 = 0x02
1272            }
1273
1274            MM00 (0x01, I000, I001)
1275        }
1276
1277        Method (M003, 1, Serialized, 3)
1278        {
1279            If (Arg0)
1280            {
1281                I004 = 0x03
1282            }
1283            Else
1284            {
1285                I003 = 0x03
1286            }
1287
1288            MM00 (0x01, I000, I001)
1289        }
1290
1291        Method (M004, 1, Serialized, 4)
1292        {
1293            If (Arg0)
1294            {
1295                I004 = 0x04
1296            }
1297            Else
1298            {
1299                I003 = 0x04
1300            }
1301
1302            MM00 (0x01, I000, I001)
1303        }
1304
1305        Method (M005, 1, Serialized, 5)
1306        {
1307            If (Arg0)
1308            {
1309                I004 = 0x05
1310            }
1311            Else
1312            {
1313                I003 = 0x05
1314            }
1315
1316            MM00 (0x01, I000, I001)
1317        }
1318
1319        Method (M006, 1, Serialized, 6)
1320        {
1321            If (Arg0)
1322            {
1323                I004 = 0x06
1324            }
1325            Else
1326            {
1327                I003 = 0x06
1328            }
1329
1330            MM00 (0x01, I000, I001)
1331        }
1332
1333        Method (M007, 1, Serialized, 7)
1334        {
1335            If (Arg0)
1336            {
1337                I004 = 0x07
1338            }
1339            Else
1340            {
1341                I003 = 0x07
1342            }
1343
1344            MM00 (0x01, I000, I001)
1345        }
1346
1347        Method (M008, 1, Serialized, 8)
1348        {
1349            If (Arg0)
1350            {
1351                I004 = 0x08
1352            }
1353            Else
1354            {
1355                I003 = 0x08
1356            }
1357
1358            MM00 (0x01, I000, I001)
1359        }
1360
1361        Method (M009, 1, Serialized, 9)
1362        {
1363            If (Arg0)
1364            {
1365                I004 = 0x09
1366            }
1367            Else
1368            {
1369                I003 = 0x09
1370            }
1371
1372            MM00 (0x01, I000, I001)
1373        }
1374
1375        Method (M010, 1, Serialized, 10)
1376        {
1377            If (Arg0)
1378            {
1379                I004 = 0x0A
1380            }
1381            Else
1382            {
1383                I003 = 0x0A
1384            }
1385
1386            MM00 (0x01, I000, I001)
1387        }
1388
1389        Method (M011, 1, Serialized, 11)
1390        {
1391            If (Arg0)
1392            {
1393                I004 = 0x0B
1394            }
1395            Else
1396            {
1397                I003 = 0x0B
1398            }
1399
1400            MM00 (0x01, I000, I001)
1401        }
1402
1403        Method (M012, 1, Serialized, 12)
1404        {
1405            If (Arg0)
1406            {
1407                I004 = 0x0C
1408            }
1409            Else
1410            {
1411                I003 = 0x0C
1412            }
1413
1414            MM00 (0x01, I000, I001)
1415        }
1416
1417        Method (M013, 1, Serialized, 13)
1418        {
1419            If (Arg0)
1420            {
1421                I004 = 0x0D
1422            }
1423            Else
1424            {
1425                I003 = 0x0D
1426            }
1427
1428            MM00 (0x01, I000, I001)
1429        }
1430
1431        Method (M014, 1, Serialized, 14)
1432        {
1433            If (Arg0)
1434            {
1435                I004 = 0x0E
1436            }
1437            Else
1438            {
1439                I003 = 0x0E
1440            }
1441
1442            MM00 (0x01, I000, I001)
1443        }
1444
1445        Method (M015, 1, Serialized, 15)
1446        {
1447            If (Arg0)
1448            {
1449                I004 = 0x0F
1450            }
1451            Else
1452            {
1453                I003 = 0x0F
1454            }
1455
1456            MM00 (0x01, I000, I001)
1457        }
1458
1459        Method (MM01, 7, NotSerialized)
1460        {
1461            Local0 = 0x00
1462        }
1463
1464        Method (MM00, 3, NotSerialized)
1465        {
1466            Local0 = I002 /* \M3B7.I002 */
1467            I002++
1468            If ((I002 > I005))
1469            {
1470                Return (Zero)
1471            }
1472
1473            If (Arg0)
1474            {
1475                Local1 = Arg2
1476            }
1477            Else
1478            {
1479                Local1 = Arg1
1480            }
1481
1482            If ((Local1 == 0x00))
1483            {
1484                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1485                M000 (Local0)
1486                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1487            }
1488            ElseIf ((Local1 == 0x01))
1489            {
1490                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1491                M001 (Local0)
1492                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1493            }
1494            ElseIf ((Local1 == 0x02))
1495            {
1496                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1497                M002 (Local0)
1498                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1499            }
1500            ElseIf ((Local1 == 0x03))
1501            {
1502                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1503                M003 (Local0)
1504                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1505            }
1506            ElseIf ((Local1 == 0x04))
1507            {
1508                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1509                M004 (Local0)
1510                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1511            }
1512            ElseIf ((Local1 == 0x05))
1513            {
1514                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1515                M005 (Local0)
1516                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1517            }
1518            ElseIf ((Local1 == 0x06))
1519            {
1520                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1521                M006 (Local0)
1522                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1523            }
1524            ElseIf ((Local1 == 0x07))
1525            {
1526                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1527                M007 (Local0)
1528                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1529            }
1530            ElseIf ((Local1 == 0x08))
1531            {
1532                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1533                M008 (Local0)
1534                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1535            }
1536            ElseIf ((Local1 == 0x09))
1537            {
1538                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1539                M009 (Local0)
1540                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1541            }
1542            ElseIf ((Local1 == 0x0A))
1543            {
1544                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1545                M010 (Local0)
1546                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1547            }
1548            ElseIf ((Local1 == 0x0B))
1549            {
1550                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1551                M011 (Local0)
1552                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1553            }
1554            ElseIf ((Local1 == 0x0C))
1555            {
1556                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1557                M012 (Local0)
1558                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1559            }
1560            ElseIf ((Local1 == 0x0D))
1561            {
1562                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1563                M013 (Local0)
1564                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1565            }
1566            ElseIf ((Local1 == 0x0E))
1567            {
1568                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1569                M014 (Local0)
1570                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1571            }
1572            ElseIf ((Local1 == 0x0F))
1573            {
1574                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1575                M015 (Local0)
1576                MM01 (0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06)
1577            }
1578        }
1579
1580        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
1581        I000 = Arg0
1582        I001 = Arg1
1583        I005 = Arg2
1584        MM00 (0x00, I000, I001)
1585        If ((Arg0 > Arg1))
1586        {
1587            CH04 (__METHOD__, 0x00, 0x40, Z173, __LINE__, 0x00, 0x00) /* AE_AML_MUTEX_ORDER */
1588        }
1589        Else
1590        {
1591            If ((I003 != Arg0))
1592            {
1593                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I003, Arg0)
1594            }
1595
1596            If ((I004 != Arg1))
1597            {
1598                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I004, Arg1)
1599            }
1600        }
1601
1602        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
1603    }
1604
1605    Method (M3B8, 0, Serialized)
1606    {
1607        Name (LPN0, 0x00)
1608        Name (LPC0, 0x00)
1609        Name (LPN1, 0x00)
1610        Name (LPC1, 0x00)
1611        LPN0 = 0x10
1612        LPC0 = 0x00
1613        While (LPN0)
1614        {
1615            LPN1 = 0x10
1616            LPC1 = 0x00
1617            While (LPN1)
1618            {
1619                M3B7 (LPC0, LPC1, 0x02)
1620                LPN1--
1621                LPC1++
1622            }
1623
1624            LPN0--
1625            LPC0++
1626        }
1627    }
1628
1629    /*
1630     * Check that Serialized method can be invoked repeatedly
1631     *
1632     * (Serialized method without internal objects (including Methods) and Switches)
1633     *
1634     * Method is invoked 2 times, then 3 times, then 4 times,...
1635     * Then do it for next Method.
1636     */
1637    Method (M3B9, 0, Serialized)
1638    {
1639        Name (LPN0, 0x00)
1640        Name (LPC0, 0x00)
1641        Name (LPN1, 0x00)
1642        Name (LPC1, 0x00)
1643        LPN0 = 0x10
1644        LPC0 = 0x00
1645        While (LPN0)
1646        {
1647            LPN1 = 0x10
1648            LPC1 = 0x02
1649            While (LPN1)
1650            {
1651                M3B3 (LPC0, LPC0, LPC1)
1652                LPN1--
1653                LPC1++
1654            }
1655
1656            LPN0--
1657            LPC0++
1658        }
1659    }
1660
1661    /*
1662     * Check that Serialized method can be invoked repeatedly
1663     *
1664     * (Serialized method without internal objects (including Methods) and Switches)
1665     *
1666     * between two Serialized calls non-Serialized calls are performed
1667     *
1668     * Method is invoked 2 times, then 3 times, then 4 times,...
1669     * Then do it for next Method.
1670     */
1671    Method (M3BA, 0, Serialized)
1672    {
1673        Name (LPN0, 0x00)
1674        Name (LPC0, 0x00)
1675        Name (LPN1, 0x00)
1676        Name (LPC1, 0x00)
1677        LPN0 = 0x10
1678        LPC0 = 0x00
1679        While (LPN0)
1680        {
1681            LPN1 = 0x10
1682            LPC1 = 0x02
1683            While (LPN1)
1684            {
1685                M3B7 (LPC0, LPC0, LPC1)
1686                LPN1--
1687                LPC1++
1688            }
1689
1690            LPN0--
1691            LPC0++
1692        }
1693    }
1694
1695    /*
1696     * The level is set up by either call to Serialized method or Acquire mutex of that level
1697     *
1698     * Check pairs of calls to methods which provide exclusive access to critical sections
1699     * either by 'Serialized method' technique or AML mutexes (Acquire/Release) framework.
1700     * The second method is invoked from the first method.
1701     *
1702     * All the 1024 combinations are verified (32*32):
1703     *
1704     * The first call to method in pair is call to:
1705     * - Serialized method with level in range from 0 up to 15
1706     * - non-Serialized method Acquiring mutex with level in range from 0 up to 15
1707     *
1708     * Identically, the second call to method in pair is call to:
1709     * - Serialized method with level in range from 0 up to 15
1710     * - non-Serialized method Acquiring mutex with level in range from 0 up to 15
1711     *
1712     * So all the checkings are provided:
1713     *
1714     * -   proper sequence of levels (from i-th level to all possible correct levels)
1715     * -   proper sequence of levels (from i-th level to i-th level (in particular))
1716     * - improper sequence of levels (from i-th level to all possible incorrect levels)
1717     *
1718     * arg0 - level of first call
1719     * arg1 - level of second call
1720     * arg2 - how many calls to do
1721     */
1722    Method (M3BB, 3, Serialized)
1723    {
1724        Name (I000, 0x00)
1725        Name (I001, 0x00)
1726        Name (I002, 0x00)
1727        Name (I003, 0xABCD0003)
1728        Name (I004, 0xABCD0004)
1729        Name (I005, 0x00)
1730        Mutex (MT00, 0x00)
1731        Mutex (MT10, 0x01)
1732        Mutex (MT20, 0x02)
1733        Mutex (MT30, 0x03)
1734        Mutex (MT40, 0x04)
1735        Mutex (MT50, 0x05)
1736        Mutex (MT60, 0x06)
1737        Mutex (MT70, 0x07)
1738        Mutex (MT80, 0x08)
1739        Mutex (MT90, 0x09)
1740        Mutex (MTA0, 0x0A)
1741        Mutex (MTB0, 0x0B)
1742        Mutex (MTC0, 0x0C)
1743        Mutex (MTD0, 0x0D)
1744        Mutex (MTE0, 0x0E)
1745        Mutex (MTF0, 0x0F)
1746        Method (M000, 1, Serialized)
1747        {
1748            If (Arg0)
1749            {
1750                I004 = 0x00
1751            }
1752            Else
1753            {
1754                I003 = 0x00
1755            }
1756
1757            MM00 (0x01, I000, I001)
1758        }
1759
1760        Method (M001, 1, Serialized, 1)
1761        {
1762            If (Arg0)
1763            {
1764                I004 = 0x01
1765            }
1766            Else
1767            {
1768                I003 = 0x01
1769            }
1770
1771            MM00 (0x01, I000, I001)
1772        }
1773
1774        Method (M002, 1, Serialized, 2)
1775        {
1776            If (Arg0)
1777            {
1778                I004 = 0x02
1779            }
1780            Else
1781            {
1782                I003 = 0x02
1783            }
1784
1785            MM00 (0x01, I000, I001)
1786        }
1787
1788        Method (M003, 1, Serialized, 3)
1789        {
1790            If (Arg0)
1791            {
1792                I004 = 0x03
1793            }
1794            Else
1795            {
1796                I003 = 0x03
1797            }
1798
1799            MM00 (0x01, I000, I001)
1800        }
1801
1802        Method (M004, 1, Serialized, 4)
1803        {
1804            If (Arg0)
1805            {
1806                I004 = 0x04
1807            }
1808            Else
1809            {
1810                I003 = 0x04
1811            }
1812
1813            MM00 (0x01, I000, I001)
1814        }
1815
1816        Method (M005, 1, Serialized, 5)
1817        {
1818            If (Arg0)
1819            {
1820                I004 = 0x05
1821            }
1822            Else
1823            {
1824                I003 = 0x05
1825            }
1826
1827            MM00 (0x01, I000, I001)
1828        }
1829
1830        Method (M006, 1, Serialized, 6)
1831        {
1832            If (Arg0)
1833            {
1834                I004 = 0x06
1835            }
1836            Else
1837            {
1838                I003 = 0x06
1839            }
1840
1841            MM00 (0x01, I000, I001)
1842        }
1843
1844        Method (M007, 1, Serialized, 7)
1845        {
1846            If (Arg0)
1847            {
1848                I004 = 0x07
1849            }
1850            Else
1851            {
1852                I003 = 0x07
1853            }
1854
1855            MM00 (0x01, I000, I001)
1856        }
1857
1858        Method (M008, 1, Serialized, 8)
1859        {
1860            If (Arg0)
1861            {
1862                I004 = 0x08
1863            }
1864            Else
1865            {
1866                I003 = 0x08
1867            }
1868
1869            MM00 (0x01, I000, I001)
1870        }
1871
1872        Method (M009, 1, Serialized, 9)
1873        {
1874            If (Arg0)
1875            {
1876                I004 = 0x09
1877            }
1878            Else
1879            {
1880                I003 = 0x09
1881            }
1882
1883            MM00 (0x01, I000, I001)
1884        }
1885
1886        Method (M010, 1, Serialized, 10)
1887        {
1888            If (Arg0)
1889            {
1890                I004 = 0x0A
1891            }
1892            Else
1893            {
1894                I003 = 0x0A
1895            }
1896
1897            MM00 (0x01, I000, I001)
1898        }
1899
1900        Method (M011, 1, Serialized, 11)
1901        {
1902            If (Arg0)
1903            {
1904                I004 = 0x0B
1905            }
1906            Else
1907            {
1908                I003 = 0x0B
1909            }
1910
1911            MM00 (0x01, I000, I001)
1912        }
1913
1914        Method (M012, 1, Serialized, 12)
1915        {
1916            If (Arg0)
1917            {
1918                I004 = 0x0C
1919            }
1920            Else
1921            {
1922                I003 = 0x0C
1923            }
1924
1925            MM00 (0x01, I000, I001)
1926        }
1927
1928        Method (M013, 1, Serialized, 13)
1929        {
1930            If (Arg0)
1931            {
1932                I004 = 0x0D
1933            }
1934            Else
1935            {
1936                I003 = 0x0D
1937            }
1938
1939            MM00 (0x01, I000, I001)
1940        }
1941
1942        Method (M014, 1, Serialized, 14)
1943        {
1944            If (Arg0)
1945            {
1946                I004 = 0x0E
1947            }
1948            Else
1949            {
1950                I003 = 0x0E
1951            }
1952
1953            MM00 (0x01, I000, I001)
1954        }
1955
1956        Method (M015, 1, Serialized, 15)
1957        {
1958            If (Arg0)
1959            {
1960                I004 = 0x0F
1961            }
1962            Else
1963            {
1964                I003 = 0x0F
1965            }
1966
1967            MM00 (0x01, I000, I001)
1968        }
1969
1970        Method (M100, 2, NotSerialized)
1971        {
1972            If (Arg0)
1973            {
1974                I004 = 0x10
1975            }
1976            Else
1977            {
1978                I003 = 0x10
1979            }
1980
1981            Local0 = Acquire (MT00, 0xFFFF)
1982            MM00 (0x01, I000, I001)
1983            If (Arg1)
1984            {
1985                If (Local0)
1986                {
1987                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
1988                }
1989            }
1990
1991            If (!Local0)
1992            {
1993                Release (MT00)
1994            }
1995        }
1996
1997        Method (M101, 2, NotSerialized)
1998        {
1999            If (Arg0)
2000            {
2001                I004 = 0x11
2002            }
2003            Else
2004            {
2005                I003 = 0x11
2006            }
2007
2008            Local0 = Acquire (MT10, 0xFFFF)
2009            MM00 (0x01, I000, I001)
2010            If (Arg1)
2011            {
2012                If (Local0)
2013                {
2014                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2015                }
2016            }
2017
2018            If (!Local0)
2019            {
2020                Release (MT10)
2021            }
2022        }
2023
2024        Method (M102, 2, NotSerialized)
2025        {
2026            If (Arg0)
2027            {
2028                I004 = 0x12
2029            }
2030            Else
2031            {
2032                I003 = 0x12
2033            }
2034
2035            Local0 = Acquire (MT20, 0xFFFF)
2036            MM00 (0x01, I000, I001)
2037            If (Arg1)
2038            {
2039                If (Local0)
2040                {
2041                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2042                }
2043            }
2044
2045            If (!Local0)
2046            {
2047                Release (MT20)
2048            }
2049        }
2050
2051        Method (M103, 2, NotSerialized)
2052        {
2053            If (Arg0)
2054            {
2055                I004 = 0x13
2056            }
2057            Else
2058            {
2059                I003 = 0x13
2060            }
2061
2062            Local0 = Acquire (MT30, 0xFFFF)
2063            MM00 (0x01, I000, I001)
2064            If (Arg1)
2065            {
2066                If (Local0)
2067                {
2068                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2069                }
2070            }
2071
2072            If (!Local0)
2073            {
2074                Release (MT30)
2075            }
2076        }
2077
2078        Method (M104, 2, NotSerialized)
2079        {
2080            If (Arg0)
2081            {
2082                I004 = 0x14
2083            }
2084            Else
2085            {
2086                I003 = 0x14
2087            }
2088
2089            Local0 = Acquire (MT40, 0xFFFF)
2090            MM00 (0x01, I000, I001)
2091            If (Arg1)
2092            {
2093                If (Local0)
2094                {
2095                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2096                }
2097            }
2098
2099            If (!Local0)
2100            {
2101                Release (MT40)
2102            }
2103        }
2104
2105        Method (M105, 2, NotSerialized)
2106        {
2107            If (Arg0)
2108            {
2109                I004 = 0x15
2110            }
2111            Else
2112            {
2113                I003 = 0x15
2114            }
2115
2116            Local0 = Acquire (MT50, 0xFFFF)
2117            MM00 (0x01, I000, I001)
2118            If (Arg1)
2119            {
2120                If (Local0)
2121                {
2122                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2123                }
2124            }
2125
2126            If (!Local0)
2127            {
2128                Release (MT50)
2129            }
2130        }
2131
2132        Method (M106, 2, NotSerialized)
2133        {
2134            If (Arg0)
2135            {
2136                I004 = 0x16
2137            }
2138            Else
2139            {
2140                I003 = 0x16
2141            }
2142
2143            Local0 = Acquire (MT60, 0xFFFF)
2144            MM00 (0x01, I000, I001)
2145            If (Arg1)
2146            {
2147                If (Local0)
2148                {
2149                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2150                }
2151            }
2152
2153            If (!Local0)
2154            {
2155                Release (MT60)
2156            }
2157        }
2158
2159        Method (M107, 2, NotSerialized)
2160        {
2161            If (Arg0)
2162            {
2163                I004 = 0x17
2164            }
2165            Else
2166            {
2167                I003 = 0x17
2168            }
2169
2170            Local0 = Acquire (MT70, 0xFFFF)
2171            MM00 (0x01, I000, I001)
2172            If (Arg1)
2173            {
2174                If (Local0)
2175                {
2176                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2177                }
2178            }
2179
2180            If (!Local0)
2181            {
2182                Release (MT70)
2183            }
2184        }
2185
2186        Method (M108, 2, NotSerialized)
2187        {
2188            If (Arg0)
2189            {
2190                I004 = 0x18
2191            }
2192            Else
2193            {
2194                I003 = 0x18
2195            }
2196
2197            Local0 = Acquire (MT80, 0xFFFF)
2198            MM00 (0x01, I000, I001)
2199            If (Arg1)
2200            {
2201                If (Local0)
2202                {
2203                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2204                }
2205            }
2206
2207            If (!Local0)
2208            {
2209                Release (MT80)
2210            }
2211        }
2212
2213        Method (M109, 2, NotSerialized)
2214        {
2215            If (Arg0)
2216            {
2217                I004 = 0x19
2218            }
2219            Else
2220            {
2221                I003 = 0x19
2222            }
2223
2224            Local0 = Acquire (MT90, 0xFFFF)
2225            MM00 (0x01, I000, I001)
2226            If (Arg1)
2227            {
2228                If (Local0)
2229                {
2230                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2231                }
2232            }
2233
2234            If (!Local0)
2235            {
2236                Release (MT90)
2237            }
2238        }
2239
2240        Method (M110, 2, NotSerialized)
2241        {
2242            If (Arg0)
2243            {
2244                I004 = 0x1A
2245            }
2246            Else
2247            {
2248                I003 = 0x1A
2249            }
2250
2251            Local0 = Acquire (MTA0, 0xFFFF)
2252            MM00 (0x01, I000, I001)
2253            If (Arg1)
2254            {
2255                If (Local0)
2256                {
2257                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2258                }
2259            }
2260
2261            If (!Local0)
2262            {
2263                Release (MTA0)
2264            }
2265        }
2266
2267        Method (M111, 2, NotSerialized)
2268        {
2269            If (Arg0)
2270            {
2271                I004 = 0x1B
2272            }
2273            Else
2274            {
2275                I003 = 0x1B
2276            }
2277
2278            Local0 = Acquire (MTB0, 0xFFFF)
2279            MM00 (0x01, I000, I001)
2280            If (Arg1)
2281            {
2282                If (Local0)
2283                {
2284                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2285                }
2286            }
2287
2288            If (!Local0)
2289            {
2290                Release (MTB0)
2291            }
2292        }
2293
2294        Method (M112, 2, NotSerialized)
2295        {
2296            If (Arg0)
2297            {
2298                I004 = 0x1C
2299            }
2300            Else
2301            {
2302                I003 = 0x1C
2303            }
2304
2305            Local0 = Acquire (MTC0, 0xFFFF)
2306            MM00 (0x01, I000, I001)
2307            If (Arg1)
2308            {
2309                If (Local0)
2310                {
2311                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2312                }
2313            }
2314
2315            If (!Local0)
2316            {
2317                Release (MTC0)
2318            }
2319        }
2320
2321        Method (M113, 2, NotSerialized)
2322        {
2323            If (Arg0)
2324            {
2325                I004 = 0x1D
2326            }
2327            Else
2328            {
2329                I003 = 0x1D
2330            }
2331
2332            Local0 = Acquire (MTD0, 0xFFFF)
2333            MM00 (0x01, I000, I001)
2334            If (Arg1)
2335            {
2336                If (Local0)
2337                {
2338                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2339                }
2340            }
2341
2342            If (!Local0)
2343            {
2344                Release (MTD0)
2345            }
2346        }
2347
2348        Method (M114, 2, NotSerialized)
2349        {
2350            If (Arg0)
2351            {
2352                I004 = 0x1E
2353            }
2354            Else
2355            {
2356                I003 = 0x1E
2357            }
2358
2359            Local0 = Acquire (MTE0, 0xFFFF)
2360            MM00 (0x01, I000, I001)
2361            If (Arg1)
2362            {
2363                If (Local0)
2364                {
2365                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2366                }
2367            }
2368
2369            If (!Local0)
2370            {
2371                Release (MTE0)
2372            }
2373        }
2374
2375        Method (M115, 2, NotSerialized)
2376        {
2377            If (Arg0)
2378            {
2379                I004 = 0x1F
2380            }
2381            Else
2382            {
2383                I003 = 0x1F
2384            }
2385
2386            Local0 = Acquire (MTF0, 0xFFFF)
2387            MM00 (0x01, I000, I001)
2388            If (Arg1)
2389            {
2390                If (Local0)
2391                {
2392                    ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, 0x00, Local0)
2393                }
2394            }
2395
2396            If (!Local0)
2397            {
2398                Release (MTF0)
2399            }
2400        }
2401
2402        /*
2403         * arg0 - 0 - first call, otherwise - non-first call
2404         * arg1 - level of first call
2405         * arg2 - level of second call
2406         */
2407        Method (MM00, 3, Serialized)
2408        {
2409            Local0 = I002 /* \M3BB.I002 */
2410            I002++
2411            If ((I002 > I005))
2412            {
2413                Return (Zero)
2414            }
2415
2416            If (Arg0)
2417            {
2418                Local1 = Arg2
2419            }
2420            Else
2421            {
2422                Local1 = Arg1
2423            }
2424
2425            If (Arg0)
2426            {
2427                /* non-first call */
2428
2429                If ((Arg1 >= 0x10))
2430                {
2431                    Local2 = (Arg1 - 0x10)
2432                }
2433                Else
2434                {
2435                    Local2 = Arg1
2436                }
2437
2438                If ((Arg2 >= 0x10))
2439                {
2440                    Local3 = (Arg2 - 0x10)
2441                }
2442                Else
2443                {
2444                    Local3 = Arg2
2445                }
2446
2447                If ((Local2 > Local3))
2448                {
2449                    Local4 = 0x00
2450                }
2451                Else
2452                {
2453                    Local4 = 0x01 /* Check return of Acquire, success is expected */
2454                }
2455            }
2456            Else
2457            {
2458                /* first call */
2459
2460                Local4 = 0x01 /* Check return of Acquire, success is expected */
2461            }
2462
2463            Switch (ToInteger (Local1))
2464            {
2465                Case (0x00)
2466                {
2467                    M000 (Local0)
2468                }
2469                Case (0x01)
2470                {
2471                    M001 (Local0)
2472                }
2473                Case (0x02)
2474                {
2475                    M002 (Local0)
2476                }
2477                Case (0x03)
2478                {
2479                    M003 (Local0)
2480                }
2481                Case (0x04)
2482                {
2483                    M004 (Local0)
2484                }
2485                Case (0x05)
2486                {
2487                    M005 (Local0)
2488                }
2489                Case (0x06)
2490                {
2491                    M006 (Local0)
2492                }
2493                Case (0x07)
2494                {
2495                    M007 (Local0)
2496                }
2497                Case (0x08)
2498                {
2499                    M008 (Local0)
2500                }
2501                Case (0x09)
2502                {
2503                    M009 (Local0)
2504                }
2505                Case (0x0A)
2506                {
2507                    M010 (Local0)
2508                }
2509                Case (0x0B)
2510                {
2511                    M011 (Local0)
2512                }
2513                Case (0x0C)
2514                {
2515                    M012 (Local0)
2516                }
2517                Case (0x0D)
2518                {
2519                    M013 (Local0)
2520                }
2521                Case (0x0E)
2522                {
2523                    M014 (Local0)
2524                }
2525                Case (0x0F)
2526                {
2527                    M015 (Local0)
2528                }
2529                Case (0x10)
2530                {
2531                    M100 (Local0, Local4)
2532                }
2533                Case (0x11)
2534                {
2535                    M101 (Local0, Local4)
2536                }
2537                Case (0x12)
2538                {
2539                    M102 (Local0, Local4)
2540                }
2541                Case (0x13)
2542                {
2543                    M103 (Local0, Local4)
2544                }
2545                Case (0x14)
2546                {
2547                    M104 (Local0, Local4)
2548                }
2549                Case (0x15)
2550                {
2551                    M105 (Local0, Local4)
2552                }
2553                Case (0x16)
2554                {
2555                    M106 (Local0, Local4)
2556                }
2557                Case (0x17)
2558                {
2559                    M107 (Local0, Local4)
2560                }
2561                Case (0x18)
2562                {
2563                    M108 (Local0, Local4)
2564                }
2565                Case (0x19)
2566                {
2567                    M109 (Local0, Local4)
2568                }
2569                Case (0x1A)
2570                {
2571                    M110 (Local0, Local4)
2572                }
2573                Case (0x1B)
2574                {
2575                    M111 (Local0, Local4)
2576                }
2577                Case (0x1C)
2578                {
2579                    M112 (Local0, Local4)
2580                }
2581                Case (0x1D)
2582                {
2583                    M113 (Local0, Local4)
2584                }
2585                Case (0x1E)
2586                {
2587                    M114 (Local0, Local4)
2588                }
2589                Case (0x1F)
2590                {
2591                    M115 (Local0, Local4)
2592                }
2593
2594            }
2595        }
2596
2597        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
2598        I000 = Arg0
2599        I001 = Arg1
2600        I005 = Arg2
2601        MM00 (0x00, I000, I001)
2602        If ((Arg0 >= 0x10))
2603        {
2604            Local2 = (Arg0 - 0x10)
2605        }
2606        Else
2607        {
2608            Local2 = Arg0
2609        }
2610
2611        If ((Arg1 >= 0x10))
2612        {
2613            Local3 = (Arg1 - 0x10)
2614        }
2615        Else
2616        {
2617            Local3 = Arg1
2618        }
2619
2620        If ((Local2 > Local3))
2621        {
2622            Local4 = 0x00
2623        }
2624        Else
2625        {
2626            Local4 = 0x01 /* Success is expected, no exceptions */
2627        }
2628
2629        If (!Local4)
2630        {
2631            CH04 (__METHOD__, 0x01, 0x40, Z173, __LINE__, 0x00, 0x00) /* AE_AML_MUTEX_ORDER */
2632        }
2633        Else
2634        {
2635            If ((I003 != Arg0))
2636            {
2637                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I003, Arg0)
2638            }
2639
2640            If ((I004 != Arg1))
2641            {
2642                ERR (__METHOD__, Z173, __LINE__, 0x00, 0x00, I004, Arg1)
2643            }
2644        }
2645
2646        CH03 (__METHOD__, Z173, __LINE__, 0x00, 0x00)
2647    }
2648
2649    Method (M3BC, 0, Serialized)
2650    {
2651        Name (LPN0, 0x00)
2652        Name (LPC0, 0x00)
2653        Name (LPN1, 0x00)
2654        Name (LPC1, 0x00)
2655        LPN0 = 0x20
2656        LPC0 = 0x00
2657        While (LPN0)
2658        {
2659            LPN1 = 0x20
2660            LPC1 = 0x00
2661            While (LPN1)
2662            {
2663                M3BB (LPC0, LPC1, 0x02)
2664                LPN1--
2665                LPC1++
2666            }
2667
2668            LPN0--
2669            LPC0++
2670        }
2671    }
2672
2673    Method (M3BD, 0, NotSerialized)
2674    {
2675        SRMT ("m3b0")
2676        M3B0 ()
2677        SRMT ("m3b1")
2678        M3B1 ()
2679        SRMT ("m3b2")
2680        M3B2 ()
2681        SRMT ("m3b4")
2682        If (Y300)
2683        {
2684            M3B4 ()
2685        }
2686        Else
2687        {
2688            BLCK ()
2689        }
2690
2691        SRMT ("m3b6")
2692        M3B6 ()
2693        SRMT ("m3b8")
2694        M3B8 ()
2695        SRMT ("m3b9")
2696        If (Y300)
2697        {
2698            M3B9 ()
2699        }
2700        Else
2701        {
2702            BLCK ()
2703        }
2704
2705        SRMT ("m3ba")
2706        M3BA ()
2707        SRMT ("m3bc")
2708        If (Y300)
2709        {
2710            M3BC ()
2711        }
2712        Else
2713        {
2714            BLCK ()
2715        }
2716    }
2717