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     * Auxiliary routines to access mutexes
30     */
31    Name (Z151, 0x97)
32    /*
33     * For debugging:
34     *
35     * FL02 - print out Acquire/Release
36     * im00 - imitation of Acquire/Release (don't really run Acquire/Release)
37     */
38    Name (FL02, 0x00)
39    Name (IM00, 0x00)
40    /*
41     * Acquire interval of mutexes
42     *
43     * arg0 - number of mutexes to Acquire (use not less than 1)
44     */
45    Method (M36D, 1, Serialized)
46    {
47        If ((Arg0 == 0x00))
48        {
49            Return (Zero)
50        }
51
52        Local0 = Acquire (T000, 0xFFFF)
53        If (Local0)
54        {
55            ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
56        }
57        Else
58        {
59            If ((Arg0 == 0x01))
60            {
61                Return (Zero)
62            }
63
64            Local0 = Acquire (\_GL, 0xFFFF)
65            If (Local0)
66            {
67                ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
68            }
69            Else
70            {
71                If ((Arg0 == 0x02))
72                {
73                    Return (Zero)
74                }
75
76                Local0 = Acquire (T100, 0xFFFF)
77                If (Local0)
78                {
79                    ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
80                }
81                Else
82                {
83                    If ((Arg0 == 0x03))
84                    {
85                        Return (Zero)
86                    }
87
88                    Local0 = Acquire (T200, 0xFFFF)
89                    If (Local0)
90                    {
91                        ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
92                    }
93                    Else
94                    {
95                        If ((Arg0 == 0x04))
96                        {
97                            Return (Zero)
98                        }
99
100                        Local0 = Acquire (T300, 0xFFFF)
101                        If (Local0)
102                        {
103                            ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
104                        }
105                        Else
106                        {
107                            If ((Arg0 == 0x05))
108                            {
109                                Return (Zero)
110                            }
111
112                            Local0 = Acquire (T400, 0xFFFF)
113                            If (Local0)
114                            {
115                                ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
116                            }
117                            Else
118                            {
119                                If ((Arg0 == 0x06))
120                                {
121                                    Return (Zero)
122                                }
123
124                                Local0 = Acquire (T500, 0xFFFF)
125                                If (Local0)
126                                {
127                                    ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
128                                }
129                                Else
130                                {
131                                    If ((Arg0 == 0x07))
132                                    {
133                                        Return (Zero)
134                                    }
135
136                                    Local0 = Acquire (T600, 0xFFFF)
137                                    If (Local0)
138                                    {
139                                        ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
140                                    }
141                                    Else
142                                    {
143                                        If ((Arg0 == 0x08))
144                                        {
145                                            Return (Zero)
146                                        }
147
148                                        Local0 = Acquire (T700, 0xFFFF)
149                                        If (Local0)
150                                        {
151                                            ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
152                                        }
153                                        Else
154                                        {
155                                            If ((Arg0 == 0x09))
156                                            {
157                                                Return (Zero)
158                                            }
159
160                                            Local0 = Acquire (T800, 0xFFFF)
161                                            If (Local0)
162                                            {
163                                                ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
164                                            }
165                                            Else
166                                            {
167                                                If ((Arg0 == 0x0A))
168                                                {
169                                                    Return (Zero)
170                                                }
171
172                                                Local0 = Acquire (T900, 0xFFFF)
173                                                If (Local0)
174                                                {
175                                                    ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
176                                                }
177                                                Else
178                                                {
179                                                    If ((Arg0 == 0x0B))
180                                                    {
181                                                        Return (Zero)
182                                                    }
183
184                                                    Local0 = Acquire (TA00, 0xFFFF)
185                                                    If (Local0)
186                                                    {
187                                                        ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
188                                                    }
189                                                    Else
190                                                    {
191                                                        If ((Arg0 == 0x0C))
192                                                        {
193                                                            Return (Zero)
194                                                        }
195
196                                                        Local0 = Acquire (TB00, 0xFFFF)
197                                                        If (Local0)
198                                                        {
199                                                            ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
200                                                        }
201                                                        Else
202                                                        {
203                                                            If ((Arg0 == 0x0D))
204                                                            {
205                                                                Return (Zero)
206                                                            }
207
208                                                            Local0 = Acquire (TC00, 0xFFFF)
209                                                            If (Local0)
210                                                            {
211                                                                ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
212                                                            }
213                                                            Else
214                                                            {
215                                                                If ((Arg0 == 0x0E))
216                                                                {
217                                                                    Return (Zero)
218                                                                }
219
220                                                                Local0 = Acquire (TD00, 0xFFFF)
221                                                                If (Local0)
222                                                                {
223                                                                    ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
224                                                                }
225                                                                Else
226                                                                {
227                                                                    If ((Arg0 == 0x0F))
228                                                                    {
229                                                                        Return (Zero)
230                                                                    }
231
232                                                                    Local0 = Acquire (TE00, 0xFFFF)
233                                                                    If (Local0)
234                                                                    {
235                                                                        ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
236                                                                    }
237                                                                    Else
238                                                                    {
239                                                                        If ((Arg0 == 0x10))
240                                                                        {
241                                                                            Return (Zero)
242                                                                        }
243
244                                                                        Local0 = Acquire (TF00, 0xFFFF)
245                                                                        If (Local0)
246                                                                        {
247                                                                            ERR (__METHOD__, Z151, __LINE__, 0x00, 0x00, 0x00, Local0)
248                                                                        }
249                                                                        ElseIf ((Arg0 == 0x11))
250                                                                        {
251                                                                            Return (Zero)
252                                                                        }
253                                                                    }
254                                                                }
255                                                            }
256                                                        }
257                                                    }
258                                                }
259                                            }
260                                        }
261                                    }
262                                }
263                            }
264                        }
265                    }
266                }
267            }
268        }
269    }
270
271    /*
272     * Release interval of mutexes
273     *
274     * arg0 - number of mutexes to Release (use not less than 1)
275     */
276    Method (M36E, 1, NotSerialized)
277    {
278        If ((Arg0 >= 0x11))
279        {
280            Release (TF00)
281        }
282
283        If ((Arg0 >= 0x10))
284        {
285            Release (TE00)
286        }
287
288        If ((Arg0 >= 0x0F))
289        {
290            Release (TD00)
291        }
292
293        If ((Arg0 >= 0x0E))
294        {
295            Release (TC00)
296        }
297
298        If ((Arg0 >= 0x0D))
299        {
300            Release (TB00)
301        }
302
303        If ((Arg0 >= 0x0C))
304        {
305            Release (TA00)
306        }
307
308        If ((Arg0 >= 0x0B))
309        {
310            Release (T900)
311        }
312
313        If ((Arg0 >= 0x0A))
314        {
315            Release (T800)
316        }
317
318        If ((Arg0 >= 0x09))
319        {
320            Release (T700)
321        }
322
323        If ((Arg0 >= 0x08))
324        {
325            Release (T600)
326        }
327
328        If ((Arg0 >= 0x07))
329        {
330            Release (T500)
331        }
332
333        If ((Arg0 >= 0x06))
334        {
335            Release (T400)
336        }
337
338        If ((Arg0 >= 0x05))
339        {
340            Release (T300)
341        }
342
343        If ((Arg0 >= 0x04))
344        {
345            Release (T200)
346        }
347
348        If ((Arg0 >= 0x03))
349        {
350            Release (T100)
351        }
352
353        If ((Arg0 >= 0x02))
354        {
355            Release (\_GL)
356        }
357
358        If ((Arg0 >= 0x01))
359        {
360            Release (T000)
361        }
362    }
363
364    /*
365     * Acquire mutex
366     *
367     * arg0 - Level of mutex
368     * arg1 - Index of mutex
369     * arg2 - opcode of exception to be generated or zero
370     * arg3 - opcode of TimeOutValue (see comment to ma00)
371     */
372    Method (M36F, 4, Serialized)
373    {
374        Local0 = 0x01 /* Init with FAIL */
375        If (FL02)
376        {
377            Local1 = M21E ("Acquire mutex, ", Arg0, Arg1)
378            If (IM00)
379            {
380                Concatenate ("IMITATION: ", Local1, Local1)
381            }
382
383            If (Arg2)
384            {
385                Concatenate (Local1, ", Exception expected", Local1)
386            }
387            Else
388            {
389                Switch (ToInteger (Arg3))
390                {
391                    Case (0x05)
392                    {
393                        /* TOV0 */
394
395                        Concatenate (Local1, ", tout 0", Local1)
396                    }
397                    Case (0x06)
398                    {
399                        /* TOV1 */
400
401                        Concatenate (Local1, ", tout 1", Local1)
402                    }
403                    Default
404                    {
405                        Concatenate (Local1, ", tout 0xffff", Local1)
406                    }
407
408                }
409            }
410
411            Debug = Local1
412        }
413
414        If (IM00)
415        {
416            /* Just imitation */
417
418            Return (0x00)
419        }
420
421        Switch (ToInteger (Arg0))
422        {
423            Case (0x00)
424            {
425                Local0 = MA00 (Arg1, Arg2, Arg3)
426            }
427            Case (0x01)
428            {
429                Local0 = MA01 (Arg1, Arg2, Arg3)
430            }
431            Case (0x02)
432            {
433                Local0 = MA02 (Arg1, Arg2, Arg3)
434            }
435            Case (0x03)
436            {
437                Local0 = MA03 (Arg1, Arg2, Arg3)
438            }
439            Case (0x04)
440            {
441                Local0 = MA04 (Arg1, Arg2, Arg3)
442            }
443            Case (0x05)
444            {
445                Local0 = MA05 (Arg1, Arg2, Arg3)
446            }
447            Case (0x06)
448            {
449                Local0 = MA06 (Arg1, Arg2, Arg3)
450            }
451            Case (0x07)
452            {
453                Local0 = MA07 (Arg1, Arg2, Arg3)
454            }
455            Case (0x08)
456            {
457                Local0 = MA08 (Arg1, Arg2, Arg3)
458            }
459            Case (0x09)
460            {
461                Local0 = MA09 (Arg1, Arg2, Arg3)
462            }
463            Case (0x0A)
464            {
465                Local0 = MA0A (Arg1, Arg2, Arg3)
466            }
467            Case (0x0B)
468            {
469                Local0 = MA0B (Arg1, Arg2, Arg3)
470            }
471            Case (0x0C)
472            {
473                Local0 = MA0C (Arg1, Arg2, Arg3)
474            }
475            Case (0x0D)
476            {
477                Local0 = MA0D (Arg1, Arg2, Arg3)
478            }
479            Case (0x0E)
480            {
481                Local0 = MA0E (Arg1, Arg2, Arg3)
482            }
483            Case (0x0F)
484            {
485                Local0 = MA0F (Arg1, Arg2, Arg3)
486            }
487
488        }
489
490        If (!Arg2)
491        {
492            If (Local0)
493            {
494                ERR ("m36f", Z151, __LINE__, 0x00, 0x00, Local0, 0x00)
495            }
496        }
497
498        Return (Local0)
499    }
500
501    /*
502     * Release mutex
503     *
504     * arg0 - Level of mutex
505     * arg1 - Index of mutex
506     * arg2 - opcode of exception to be generated or zero
507     */
508    Method (M388, 3, Serialized)
509    {
510        If (FL02)
511        {
512            Local1 = M21E ("Release mutex, ", Arg0, Arg1)
513            If (IM00)
514            {
515                Concatenate ("IMITATION: ", Local1, Local1)
516            }
517
518            If (Arg2)
519            {
520                Concatenate (Local1, ", Exception expected", Local1)
521            }
522
523            Debug = Local1
524        }
525
526        If (IM00)
527        {
528            Return (            /* Just imitation */
529
530Zero)
531        }
532
533        Switch (ToInteger (Arg0))
534        {
535            Case (0x00)
536            {
537                MA10 (Arg1)
538            }
539            Case (0x01)
540            {
541                MA11 (Arg1)
542            }
543            Case (0x02)
544            {
545                MA12 (Arg1)
546            }
547            Case (0x03)
548            {
549                MA13 (Arg1)
550            }
551            Case (0x04)
552            {
553                MA14 (Arg1)
554            }
555            Case (0x05)
556            {
557                MA15 (Arg1)
558            }
559            Case (0x06)
560            {
561                MA16 (Arg1)
562            }
563            Case (0x07)
564            {
565                MA17 (Arg1)
566            }
567            Case (0x08)
568            {
569                MA18 (Arg1)
570            }
571            Case (0x09)
572            {
573                MA19 (Arg1)
574            }
575            Case (0x0A)
576            {
577                MA1A (Arg1)
578            }
579            Case (0x0B)
580            {
581                MA1B (Arg1)
582            }
583            Case (0x0C)
584            {
585                MA1C (Arg1)
586            }
587            Case (0x0D)
588            {
589                MA1D (Arg1)
590            }
591            Case (0x0E)
592            {
593                MA1E (Arg1)
594            }
595            Case (0x0F)
596            {
597                MA1F (Arg1)
598            }
599
600        }
601    }
602
603    /*
604     * Acquire the range of mutexes from lower to upper levels (index 0)
605     * arg0 - start level of mutex
606     * arg1 - number of levels
607     * arg2 - if non-zero - Axquire GL too
608     * arg3 - non-zero means that we generate exceptional
609     *        condition on each Acquire. The non-zero value
610     *        means the opcode of exception.
611     */
612    Method (M38B, 4, Serialized)
613    {
614        Name (LPN0, 0x00)
615        Name (LPC0, 0x00)
616        If (Arg2)
617        {
618            If (Arg3)
619            {
620                CH03 ("m38b", Z151, __LINE__, 0x00, 0x00)
621            }
622
623            M36F (GLLL, GLIX, Arg3, 0x00) /* Acquire GL */
624            If (Arg3)
625            {
626                CH04 ("m38b", 0x00, Arg3, Z151, __LINE__, 0x00, 0x00)
627            }
628        }
629
630        LPN0 = Arg1
631        LPC0 = Arg0
632        While (LPN0)
633        {
634            If (Arg3)
635            {
636                CH03 ("m38b", Z151, __LINE__, 0x00, 0x00)
637            }
638
639            M36F (LPC0, 0x00, Arg3, 0x00) /* Acquire */
640            If (Arg3)
641            {
642                CH04 ("m38b", 0x00, Arg3, Z151, __LINE__, 0x00, 0x00)
643            }
644
645            LPN0--
646            LPC0++
647        }
648    }
649
650    /*
651     * Release the range of mutexes from upper to lower levels (index 0)
652     * arg0 - start level of mutex
653     * arg1 - number of levels
654     * arg2 - if non-zero - Release GL too
655     * arg3 - non-zero means that we generate exceptional
656     *        condition on each Acquire. The non-zero value
657     *        means the opcode of exception.
658     */
659    Method (M38C, 4, Serialized)
660    {
661        Name (LPN0, 0x00)
662        Name (LPC0, 0x00)
663        Local7 = 0x00
664        LPN0 = Arg1
665        LPC0 = Arg0
666        While (LPN0)
667        {
668            If (Arg3)
669            {
670                Local7 = (CH03 ("m38b", Z151, __LINE__, 0x00, 0x00) || Local7)
671            }
672
673            M388 (LPC0, 0x00, 0x00) /* Release */
674            If (Arg3)
675            {
676                Local7 = (CH04 ("m38b", 0x00, Arg3, Z151, __LINE__, 0x00, 0x00) || Local7)
677            }
678
679            LPN0--
680            LPC0--
681        }
682
683        If (Arg2)
684        {
685            If (Arg3)
686            {
687                Local7 = (CH03 ("m38b", Z151, __LINE__, 0x00, 0x00) || Local7)
688            }
689
690            M388 (GLLL, GLIX, 0x00) /* Release GL */
691            If (Arg3)
692            {
693                Local7 = (CH04 ("m38b", 0x00, Arg3, Z151, __LINE__, 0x00, 0x00) || Local7)
694            }
695        }
696
697        Return (Local7)
698    }
699
700    /*
701     * Acquire the range of mutexes
702     *
703     * arg0 - start level of mutex
704     * arg1 - number of levels
705     * arg2 - start index of mutex on level
706     * arg3 - number of mutexes on the same level
707     * arg4 - opcode of exception to be generated or zero
708     * arg5 - repetition number
709     * arg6 - opcode of TimeOutValue (see comment to ma00)
710     */
711    Method (M088, 7, Serialized)
712    {
713        Name (LPN0, 0x00) /* level */
714        Name (LPC0, 0x00)
715        Name (LPN1, 0x00) /* index */
716        Name (LPC1, 0x00)
717        Name (LPN2, 0x00) /* repetition */
718        Name (LPC2, 0x00)
719        Name (RPT0, 0x01)
720        Name (EXC0, 0x00) /* exception is expected - opcode to pass to (m36f & CH04) */
721        Name (EXC1, 0x00) /* exception is expected - run (CH03 & CH04) */
722        EXC0 = Arg4
723        If (IM00)
724        {
725            EXC1 = 0x00
726        }
727        ElseIf (Arg4)
728        {
729            EXC1 = Arg4
730        }
731
732        If (Arg5)
733        {
734            RPT0 = Arg5
735        }
736
737        LPN0 = Arg1
738        LPC0 = Arg0
739        While (LPN0)
740        {
741            LPN1 = Arg3
742            LPC1 = Arg2
743            While (LPN1)
744            {
745                LPN2 = RPT0 /* \M088.RPT0 */
746                LPC2 = 0x00
747                While (LPN2)
748                {
749                    If (EXC1)
750                    {
751                        CH03 ("m088", Z151, __LINE__, 0x00, 0x00)
752                    }
753
754                    M36F (LPC0, LPC1, EXC0, Arg6) /* Acquire */
755                    If (EXC1)
756                    {
757                        CH04 ("m088", 0x00, EXC0, Z151, __LINE__, 0x00, 0x00)
758                    }
759
760                    LPN2--
761                    LPC2++
762                }
763
764                LPN1--
765                LPC1++
766            }
767
768            LPN0--
769            LPC0++
770        }
771    }
772
773    /*
774     * Release the range of mutexes
775     *
776     * arg0 - start level of mutex
777     * arg1 - number of levels
778     * arg2 - start index of mutex on level
779     * arg3 - number of mutexes on the same level
780     * arg4 - opcode of exception to be generated or zero
781     * arg5 - repetition number
782     *
783     * arg6 - order of Releasing bitmap,
784     *        determinates the order of Releasing mutexes of the same level:
785     *           [0] - 0 - derect order
786     *                 1 - inverse order
787     *           [1] - 0 - don't replace the last index
788     *                 1 - replace the last index
789     *        [15:8] - the index of mutex to be the last in case of non-zero [1]
790     *
791     * Note: the bit [1] technique was added while investigating the anomaly
792     *       reflected by bug 242 "Releasing the mutex the first Acquired on
793     *       the non-zero level makes Releasing the residuary mutexes of that
794     *       level impossible".
795     *
796     * Examples:
797     *
798     * Acquired on the same level are mutexes of 0,1,2,3 indexes
799     * Releasing for arg6 equal to:
800     * 0x00 - 0123 (direct - the same order the mutexes were Acquired)
801     *   01 - 3210 (inverse to Acquiring)
802     *   22 - 0132 (direct + replace the last index, it becomes index 2)
803     *   23 - 3102 (inverse + replace the last index, it becomes index 2)
804     */
805    Method (M089, 7, Serialized)
806    {
807        Name (LPN0, 0x00) /* level */
808        Name (LPC0, 0x00)
809        Name (LPN1, 0x00) /* index */
810        Name (LPC1, 0x00)
811        Name (LPN2, 0x00) /* repetition */
812        Name (LPC2, 0x00)
813        Name (RPT0, 0x01)
814        Name (BG00, 0x00)
815        Name (EN00, 0x00)
816        Name (INV0, 0x00) /* sign of the inverse order */
817        Name (RPL0, 0x00) /* to do replacing */
818        Name (LIX0, 0x00) /* value to be the last index */
819        Name (EXC0, 0x00) /* exception is expected - opcode to pass to (m36f & CH04) */
820        Name (EXC1, 0x00) /* exception is expected - run (CH03 & CH04) */
821        EXC0 = Arg4
822        If (IM00)
823        {
824            EXC1 = 0x00
825        }
826        ElseIf (Arg4)
827        {
828            EXC1 = Arg4
829        }
830
831        If (Arg5)
832        {
833            RPT0 = Arg5
834        }
835
836        INV0 = (Arg6 & 0x01)
837        RPL0 = (Arg6 & 0x02)
838        LIX0 = (Arg6 & 0xFF00)
839        LIX0 >>= 0x08
840        BG00 = Arg2
841        EN00 = (Arg2 + Arg3)
842        EN00--
843        /* Inverse order of levels */
844
845        LPN0 = Arg1
846        LPC0 = (Arg0 + Arg1)
847        LPC0--
848        While (LPN0)
849        {
850            If (INV0)
851            {
852                /* inverse order */
853
854                LPN1 = Arg3
855                LPC1 = (Arg2 + Arg3)
856                LPC1--
857                While (LPN1)
858                {
859                    Local0 = LPC1 /* \M089.LPC1 */
860                    If (RPL0)
861                    {
862                        If ((LPN1 == 0x01))
863                        {
864                            Local0 = LIX0 /* \M089.LIX0 */
865                        }
866                        ElseIf ((LPC1 <= LIX0))
867                        {
868                            Local0 = (LPC1 - 0x01)
869                        }
870                    }
871
872                    LPN2 = RPT0 /* \M089.RPT0 */
873                    LPC2 = 0x00
874                    While (LPN2)
875                    {
876                        If (EXC1)
877                        {
878                            CH03 ("m088", Z151, __LINE__, 0x00, 0x00)
879                        }
880
881                        M388 (LPC0, Local0, EXC0) /* Release */
882                        If (EXC1)
883                        {
884                            CH04 ("m088", 0x00, EXC0, Z151, __LINE__, 0x00, 0x00)
885                        }
886
887                        LPN2--
888                        LPC2++
889                    }
890
891                    LPN1--
892                    LPC1--
893                }
894            }
895            Else
896            {
897                /* direct order */
898
899                LPN1 = Arg3
900                LPC1 = Arg2
901                While (LPN1)
902                {
903                    Local0 = LPC1 /* \M089.LPC1 */
904                    If (RPL0)
905                    {
906                        If ((LPN1 == 0x01))
907                        {
908                            Local0 = LIX0 /* \M089.LIX0 */
909                        }
910                        ElseIf ((LPC1 >= LIX0))
911                        {
912                            Local0 = (LPC1 + 0x01)
913                        }
914                    }
915
916                    LPN2 = RPT0 /* \M089.RPT0 */
917                    LPC2 = 0x00
918                    While (LPN2)
919                    {
920                        If (EXC1)
921                        {
922                            CH03 ("m088", Z151, __LINE__, 0x00, 0x00)
923                        }
924
925                        M388 (LPC0, Local0, EXC0) /* Release */
926                        If (EXC1)
927                        {
928                            CH04 ("m088", 0x00, EXC0, Z151, __LINE__, 0x00, 0x00)
929                        }
930
931                        LPN2--
932                        LPC2++
933                    }
934
935                    LPN1--
936                    LPC1++
937                }
938            }
939
940            LPN0--
941            LPC0--
942        }
943    }
944
945    /*
946     * Check that all mutexes are Released (don't check T804..)
947     */
948    Method (M08A, 0, NotSerialized)
949    {
950        M089 (0x00, MAX0, 0x00, MIN0, 0x41, 0x00, 0x00) /* AE_AML_MUTEX_NOT_ACQUIRED */
951    }
952