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 mutex related interfaces in a real multi-threading mode
30     */
31    Name (Z148, 0x94)
32    /*
33     in progress
34     SEE:
35     ??????????????????????????????????????????
36     1) See sleeping mode ... and m209
37     3) remove all mf0X - workers only once go into
38     } else { // Worker Threads
39     m101(arg0, arg1, arg2, 0)
40     }
41     and Ctl Thread do mf00()
42     4) do the same number of mutexes (indexes) for all mutex levels
43     then uni0 will work in cm06/cm07... properly
44     5) actually properly split methods among files and files among directories
45     6) groups of methods - m340-m344 and m20d-m20e in the same group and name
46     6) some methods are not used?
47     7) m33f - does it have "Check up the values of counters of all Mutexes"?
48     8) allow tests to run for 3 and 2 threads (excluding some) without SKIPPED
49     */
50    /*
51     * Test mf01.
52     *
53     * arg0 - number of threads
54     * arg1 - ID of current thread
55     * arg2 - Index of current thread
56     */
57    Method (MF01, 3, Serialized)
58    {
59        /* Initialization of multithreading interconnection */
60
61        If (!M107 (Arg0, Arg1, Arg2, 0x00))
62        {
63            If (!Arg2)
64            {
65                Debug = "Test mf01 skipped!"
66                SKIP ()
67            }
68
69            Return (Zero)
70        }
71
72        /* Report start of test: depending on vb01 can be reported by each thread */
73
74        M204 ("mf01", Arg0, Arg1, Arg2)
75        /*
76         * The Worker Threads loop forever executing strategies
77         * specified and controlled by the Control Thread.
78         */
79        If ((Arg2 == 0x00))
80        {
81            /* Control Thread */
82            /*
83             * These variables are to be actually used
84             * by the Control Thread only
85             */
86            Name (LPN0, 0x00)
87            Name (LPC0, 0x00)
88            /* Open testing */
89
90            M102 (Arg0)
91            /* All workers to sleep */
92
93            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
94            /* Acquire/Sleep/Release for all 0-15 levels and GL */
95
96            LPN0 = MAX0 /* \MAX0 */
97            LPC0 = 0x00
98            While (LPN0)
99            {
100                /*
101                 * Reset all counters (cnt0) and flags (fl00)
102                 * corresponding to all Mutexes.
103                 */
104                M330 ()
105                /*
106                 * Acquire/Sleep/Release
107                 *
108                 * - Number of threads
109                 * - Level of mutex
110                 * - Index of mutex
111                 * - Number of mutexes of the same level
112                 */
113                M801 (Arg0, LPC0, 0x00, MIN0)
114                LPN0--
115                LPC0++
116            }
117
118            /* Close testing */
119
120            M108 ("mf01", Arg0, Arg1, Arg2)
121        }
122        Else
123        {
124            /* Worker Threads */
125
126            M101 (Arg0, Arg1, Arg2, 0x00)
127        }
128    }
129
130    /*
131     * Test mf02.
132     *
133     * arg0 - number of threads
134     * arg1 - ID of current thread
135     * arg2 - Index of current thread
136     */
137    Method (MF02, 3, NotSerialized)
138    {
139        /* Initialization of multithreading interconnection */
140
141        If (!M107 (Arg0, Arg1, Arg2, 0x00))
142        {
143            If (!Arg2)
144            {
145                Debug = "Test mf02 skipped!"
146                SKIP ()
147            }
148
149            Return (Zero)
150        }
151
152        /* Report start of test: depending on vb01 can be reported by each thread */
153
154        M204 ("mf02", Arg0, Arg1, Arg2)
155        /*
156         * The Worker Threads loop forever executing strategies
157         * specified and controlled by the Control Thread.
158         */
159        If ((Arg2 == 0x00))
160        {
161            /* Control Thread */
162            /* Open testing */
163            M102 (Arg0)
164            /* All workers to sleep */
165
166            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
167            /*
168             * <Acquire/Sleep>(0-15 levels) and GL/Release(15-0 levels) and GL
169             * - Number of threads
170             * - Index of mutex
171             * - Number of mutexes of the same level
172             */
173            M802 (Arg0, 0x00, 0x02)
174            /* Close testing */
175
176            M108 ("mf02", Arg0, Arg1, Arg2)
177        }
178        Else
179        {
180            /* Worker Threads */
181
182            M101 (Arg0, Arg1, Arg2, 0x00)
183        }
184    }
185
186    /*
187     * Test mf03.
188     *
189     * arg0 - number of threads
190     * arg1 - ID of current thread
191     * arg2 - Index of current thread
192     */
193    Method (MF03, 3, NotSerialized)
194    {
195        /* Initialization of multithreading interconnection */
196
197        If (!M107 (Arg0, Arg1, Arg2, 0x00))
198        {
199            If (!Arg2)
200            {
201                Debug = "Test mf03 skipped!"
202                SKIP ()
203            }
204
205            Return (Zero)
206        }
207
208        /* Report start of test: depending on vb01 can be reported by each thread */
209
210        M204 ("mf03", Arg0, Arg1, Arg2)
211        /*
212         * The Worker Threads loop forever executing strategies
213         * specified and controlled by the Control Thread.
214         */
215        If ((Arg2 == 0x00))
216        {
217            /* Control Thread */
218            /* Open testing */
219            M102 (Arg0)
220            /* All workers to sleep */
221
222            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
223            /*
224             * Example 0
225             * - Number of threads
226             */
227            M803 (Arg0)
228            /* Close testing */
229
230            M108 ("mf03", Arg0, Arg1, Arg2)
231        }
232        Else
233        {
234            /* Worker Threads */
235
236            M101 (Arg0, Arg1, Arg2, 0x00)
237        }
238    }
239
240    /*
241     * Test mf04.
242     *
243     * arg0 - number of threads
244     * arg1 - ID of current thread
245     * arg2 - Index of current thread
246     */
247    Method (MF04, 3, NotSerialized)
248    {
249        /* Initialization of multithreading interconnection */
250
251        If (!M107 (Arg0, Arg1, Arg2, 0x03))
252        {
253            If (!Arg2)
254            {
255                Debug = "Test mf04 skipped!"
256                SKIP ()
257            }
258
259            Return (Zero)
260        }
261
262        /* Report start of test: depending on vb01 can be reported by each thread */
263
264        M204 ("mf04", Arg0, Arg1, Arg2)
265        /*
266         * The Worker Threads loop forever executing strategies
267         * specified and controlled by the Control Thread.
268         */
269        If ((Arg2 == 0x00))
270        {
271            /* Control Thread */
272            /* Open testing */
273            M102 (Arg0)
274            /* All workers to sleep */
275
276            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
277            /* Test (see SPEC for mf04) */
278
279            M804 (Arg0)
280            /* Close testing */
281
282            M108 ("mf04", Arg0, Arg1, Arg2)
283        }
284        Else
285        {
286            /* Worker Threads */
287
288            M101 (Arg0, Arg1, Arg2, 0x00)
289        }
290    }
291
292    /*
293     * Test mf05.
294     *
295     * arg0 - number of threads
296     * arg1 - ID of current thread
297     * arg2 - Index of current thread
298     */
299    Method (MF05, 3, NotSerialized)
300    {
301        /* Initialization of multithreading interconnection */
302
303        If (!M107 (Arg0, Arg1, Arg2, 0x03))
304        {
305            If (!Arg2)
306            {
307                Debug = "Test mf05 skipped!"
308                SKIP ()
309            }
310
311            Return (Zero)
312        }
313
314        /* Report start of test: depending on vb01 can be reported by each thread */
315
316        M204 ("mf05", Arg0, Arg1, Arg2)
317        /*
318         * The Worker Threads loop forever executing strategies
319         * specified and controlled by the Control Thread.
320         */
321        If ((Arg2 == 0x00))
322        {
323            /* Control Thread */
324            /* Open testing */
325            M102 (Arg0)
326            /* All workers to sleep */
327
328            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
329            /* Test (see SPEC for mf05) */
330
331            M805 (Arg0)
332            /* Close testing */
333
334            M108 ("mf05", Arg0, Arg1, Arg2)
335        }
336        Else
337        {
338            /* Worker Threads */
339
340            M101 (Arg0, Arg1, Arg2, 0x00)
341        }
342    }
343
344    /*
345     * Test mf06.
346     *
347     * arg0 - number of threads
348     * arg1 - ID of current thread
349     * arg2 - Index of current thread
350     */
351    Method (MF06, 3, NotSerialized)
352    {
353        /* Initialization of multithreading interconnection */
354
355        If (!M107 (Arg0, Arg1, Arg2, 0x03))
356        {
357            If (!Arg2)
358            {
359                Debug = "Test mf06 skipped!"
360                SKIP ()
361            }
362
363            Return (Zero)
364        }
365
366        /* Report start of test: depending on vb01 can be reported by each thread */
367
368        M204 ("mf06", Arg0, Arg1, Arg2)
369        /*
370         * The Worker Threads loop forever executing strategies
371         * specified and controlled by the Control Thread.
372         */
373        If ((Arg2 == 0x00))
374        {
375            /* Control Thread */
376            /* Open testing */
377            M102 (Arg0)
378            /* All workers to sleep */
379
380            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
381            /* Test (see SPEC for mf06) */
382
383            M806 (Arg0)
384            /* Close testing */
385
386            M108 ("mf06", Arg0, Arg1, Arg2)
387        }
388        Else
389        {
390            /* Worker Threads */
391
392            M101 (Arg0, Arg1, Arg2, 0x00)
393        }
394    }
395
396    /*
397     * Test mf07.
398     *
399     * arg0 - number of threads
400     * arg1 - ID of current thread
401     * arg2 - Index of current thread
402     */
403    Method (MF07, 3, NotSerialized)
404    {
405        /* Initialization of multithreading interconnection */
406
407        If (!M107 (Arg0, Arg1, Arg2, 0x00))
408        {
409            If (!Arg2)
410            {
411                Debug = "Test mf07 skipped!"
412                SKIP ()
413            }
414
415            Return (Zero)
416        }
417
418        /* Report start of test: depending on vb01 can be reported by each thread */
419
420        M204 ("mf07", Arg0, Arg1, Arg2)
421        /*
422         * The Worker Threads loop forever executing strategies
423         * specified and controlled by the Control Thread.
424         */
425        If ((Arg2 == 0x00))
426        {
427            /* Control Thread */
428            /* Open testing */
429            M102 (Arg0)
430            /* All workers to sleep */
431
432            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
433            /* Test (see SPEC for mf07) */
434
435            M807 (Arg0)
436            /* Close testing */
437
438            M108 ("mf07", Arg0, Arg1, Arg2)
439        }
440        Else
441        {
442            /* Worker Threads */
443
444            M101 (Arg0, Arg1, Arg2, 0x00)
445        }
446    }
447
448    /*
449     * Test mf08.
450     *
451     * arg0 - number of threads
452     * arg1 - ID of current thread
453     * arg2 - Index of current thread
454     */
455    Method (MF08, 3, NotSerialized)
456    {
457        /* Initialization of multithreading interconnection */
458
459        If (!M107 (Arg0, Arg1, Arg2, MIN1))
460        {
461            If (!Arg2)
462            {
463                Debug = "Test mf08 skipped!"
464                SKIP ()
465            }
466
467            Return (Zero)
468        }
469
470        /* Report start of test: depending on vb01 can be reported by each thread */
471
472        M204 ("mf08", Arg0, Arg1, Arg2)
473        /*
474         * The Worker Threads loop forever executing strategies
475         * specified and controlled by the Control Thread.
476         */
477        If ((Arg2 == 0x00))
478        {
479            /* Control Thread */
480            /* Open testing */
481            M102 (Arg0)
482            /* All workers to sleep */
483
484            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
485            /* Test (see SPEC for mf08) */
486
487            M808 (Arg0)
488            /* Close testing */
489
490            M108 ("mf08", Arg0, Arg1, Arg2)
491        }
492        Else
493        {
494            /* Worker Threads */
495
496            M101 (Arg0, Arg1, Arg2, 0x00)
497        }
498    }
499
500    /*
501     * Test mf09.
502     *
503     * arg0 - number of threads
504     * arg1 - ID of current thread
505     * arg2 - Index of current thread
506     */
507    Method (MF09, 3, NotSerialized)
508    {
509        /* Initialization of multithreading interconnection */
510
511        If (!M107 (Arg0, Arg1, Arg2, MIN1))
512        {
513            If (!Arg2)
514            {
515                Debug = "Test mf09 skipped!"
516                SKIP ()
517            }
518
519            Return (Zero)
520        }
521
522        /* Report start of test: depending on vb01 can be reported by each thread */
523
524        M204 ("mf09", Arg0, Arg1, Arg2)
525        /*
526         * The Worker Threads loop forever executing strategies
527         * specified and controlled by the Control Thread.
528         */
529        If ((Arg2 == 0x00))
530        {
531            /* Control Thread */
532            /* Open testing */
533            M102 (Arg0)
534            /* All workers to sleep */
535
536            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
537            /* Test (see SPEC for mf09) */
538
539            M809 (Arg0)
540            /* Close testing */
541
542            M108 ("mf09", Arg0, Arg1, Arg2)
543        }
544        Else
545        {
546            /* Worker Threads */
547
548            M101 (Arg0, Arg1, Arg2, 0x00)
549        }
550    }
551
552    /*
553     * Test mf10.
554     *
555     * arg0 - number of threads
556     * arg1 - ID of current thread
557     * arg2 - Index of current thread
558     */
559    Method (MF10, 3, NotSerialized)
560    {
561        /* Initialization of multithreading interconnection */
562
563        If (!M107 (Arg0, Arg1, Arg2, MIN1))
564        {
565            If (!Arg2)
566            {
567                Debug = "Test mf10 skipped!"
568                SKIP ()
569            }
570
571            Return (Zero)
572        }
573
574        /* Report start of test: depending on vb01 can be reported by each thread */
575
576        M204 ("mf10", Arg0, Arg1, Arg2)
577        /*
578         * The Worker Threads loop forever executing strategies
579         * specified and controlled by the Control Thread.
580         */
581        If ((Arg2 == 0x00))
582        {
583            /* Control Thread */
584            /* Open testing */
585            M102 (Arg0)
586            /* All workers to sleep */
587
588            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
589            /* Test (see SPEC for mf10) */
590
591            M810 (Arg0)
592            /* Close testing */
593
594            M108 ("mf10", Arg0, Arg1, Arg2)
595        }
596        Else
597        {
598            /* Worker Threads */
599
600            M101 (Arg0, Arg1, Arg2, 0x00)
601        }
602    }
603
604    /*
605     * Test mf11.
606     *
607     * arg0 - number of threads
608     * arg1 - ID of current thread
609     * arg2 - Index of current thread
610     */
611    Method (MF11, 3, NotSerialized)
612    {
613        /* Initialization of multithreading interconnection */
614
615        If (!M107 (Arg0, Arg1, Arg2, 0x00))
616        {
617            If (!Arg2)
618            {
619                Debug = "Test mf11 skipped!"
620                SKIP ()
621            }
622
623            Return (Zero)
624        }
625
626        /* Report start of test: depending on vb01 can be reported by each thread */
627
628        M204 ("mf11", Arg0, Arg1, Arg2)
629        /*
630         * The Worker Threads loop forever executing strategies
631         * specified and controlled by the Control Thread.
632         */
633        If ((Arg2 == 0x00))
634        {
635            /* Control Thread */
636            /* Open testing */
637            M102 (Arg0)
638            /* All workers to sleep */
639
640            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
641            /* Test (see SPEC for mf11) */
642
643            M811 (Arg0)
644            /* Close testing */
645
646            M108 ("mf11", Arg0, Arg1, Arg2)
647        }
648        Else
649        {
650            /* Worker Threads */
651
652            M101 (Arg0, Arg1, Arg2, 0x00)
653        }
654    }
655
656    /*
657     * Test mf12.
658     *
659     * arg0 - number of threads
660     * arg1 - ID of current thread
661     * arg2 - Index of current thread
662     */
663    Method (MF12, 3, NotSerialized)
664    {
665        /* Initialization of multithreading interconnection */
666
667        If (!M107 (Arg0, Arg1, Arg2, 0x03))
668        {
669            If (!Arg2)
670            {
671                Debug = "Test mf12 skipped!"
672                SKIP ()
673            }
674
675            Return (Zero)
676        }
677
678        /* Report start of test: depending on vb01 can be reported by each thread */
679
680        M204 ("mf12", Arg0, Arg1, Arg2)
681        /*
682         * The Worker Threads loop forever executing strategies
683         * specified and controlled by the Control Thread.
684         */
685        If ((Arg2 == 0x00))
686        {
687            /* Control Thread */
688            /* Open testing */
689            M102 (Arg0)
690            /* All workers to sleep */
691
692            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
693            /* Test (see SPEC for mf12) */
694
695            M812 (Arg0)
696            /* Close testing */
697
698            M108 ("mf12", Arg0, Arg1, Arg2)
699        }
700        Else
701        {
702            /* Worker Threads */
703
704            M101 (Arg0, Arg1, Arg2, 0x00)
705        }
706    }
707
708    /*
709     * Test mf13.
710     *
711     * arg0 - number of threads
712     * arg1 - ID of current thread
713     * arg2 - Index of current thread
714     */
715    Method (MF13, 3, NotSerialized)
716    {
717        /* Initialization of multithreading interconnection */
718
719        If (!M107 (Arg0, Arg1, Arg2, 0x00))
720        {
721            If (!Arg2)
722            {
723                Debug = "Test mf13 skipped!"
724                SKIP ()
725            }
726
727            Return (Zero)
728        }
729
730        /* Report start of test: depending on vb01 can be reported by each thread */
731
732        M204 ("mf13", Arg0, Arg1, Arg2)
733        /*
734         * The Worker Threads loop forever executing strategies
735         * specified and controlled by the Control Thread.
736         */
737        If ((Arg2 == 0x00))
738        {
739            /* Control Thread */
740            /* Open testing */
741            M102 (Arg0)
742            /* All workers to sleep */
743
744            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
745            /* Test (see SPEC for mf13) */
746
747            M813 (Arg0)
748            /* Close testing */
749
750            M108 ("mf13", Arg0, Arg1, Arg2)
751        }
752        Else
753        {
754            /* Worker Threads */
755
756            M101 (Arg0, Arg1, Arg2, 0x00)
757        }
758    }
759
760    /*
761     * Test mf14.
762     *
763     * arg0 - number of threads
764     * arg1 - ID of current thread
765     * arg2 - Index of current thread
766     */
767    Method (MF14, 3, NotSerialized)
768    {
769        /* Initialization of multithreading interconnection */
770
771        If (!M107 (Arg0, Arg1, Arg2, 0x00))
772        {
773            If (!Arg2)
774            {
775                Debug = "Test mf14 skipped!"
776                SKIP ()
777            }
778
779            Return (Zero)
780        }
781
782        /* Report start of test: depending on vb01 can be reported by each thread */
783
784        M204 ("mf14", Arg0, Arg1, Arg2)
785        /*
786         * The Worker Threads loop forever executing strategies
787         * specified and controlled by the Control Thread.
788         */
789        If ((Arg2 == 0x00))
790        {
791            /* Control Thread */
792            /* Open testing */
793            M102 (Arg0)
794            /* All workers to sleep */
795
796            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
797            /* Test (see SPEC for mf14) */
798
799            M814 (Arg0)
800            /* Close testing */
801
802            M108 ("mf14", Arg0, Arg1, Arg2)
803        }
804        Else
805        {
806            /* Worker Threads */
807
808            M101 (Arg0, Arg1, Arg2, 0x00)
809        }
810    }
811
812    /*
813     * Test mf15.
814     *
815     * arg0 - number of threads
816     * arg1 - ID of current thread
817     * arg2 - Index of current thread
818     */
819    Method (MF15, 3, NotSerialized)
820    {
821        /* Initialization of multithreading interconnection */
822
823        If (!M107 (Arg0, Arg1, Arg2, 0x00))
824        {
825            If (!Arg2)
826            {
827                Debug = "Test mf15 skipped!"
828                SKIP ()
829            }
830
831            Return (Zero)
832        }
833
834        /* Report start of test: depending on vb01 can be reported by each thread */
835
836        M204 ("mf15", Arg0, Arg1, Arg2)
837        /*
838         * The Worker Threads loop forever executing strategies
839         * specified and controlled by the Control Thread.
840         */
841        If ((Arg2 == 0x00))
842        {
843            /* Control Thread */
844            /* Open testing */
845            M102 (Arg0)
846            /* All workers to sleep */
847
848            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
849            /* Test (see SPEC for mf15) */
850
851            M815 (Arg0)
852            /* Close testing */
853
854            M108 ("mf15", Arg0, Arg1, Arg2)
855        }
856        Else
857        {
858            /* Worker Threads */
859
860            M101 (Arg0, Arg1, Arg2, 0x00)
861        }
862    }
863
864    /*
865     * Test mf16.
866     *
867     * arg0 - number of threads
868     * arg1 - ID of current thread
869     * arg2 - Index of current thread
870     */
871    Method (MF16, 3, NotSerialized)
872    {
873        /* Initialization of multithreading interconnection */
874
875        If (!M107 (Arg0, Arg1, Arg2, 0x00))
876        {
877            If (!Arg2)
878            {
879                Debug = "Test mf16 skipped!"
880                SKIP ()
881            }
882
883            Return (Zero)
884        }
885
886        /* Report start of test: depending on vb01 can be reported by each thread */
887
888        M204 ("mf16", Arg0, Arg1, Arg2)
889        /*
890         * The Worker Threads loop forever executing strategies
891         * specified and controlled by the Control Thread.
892         */
893        If ((Arg2 == 0x00))
894        {
895            /* Control Thread */
896            /* Open testing */
897            M102 (Arg0)
898            /* All workers to sleep */
899
900            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
901            /* Test (see SPEC for mf16) */
902
903            M816 (Arg0)
904            /* Close testing */
905
906            M108 ("mf16", Arg0, Arg1, Arg2)
907        }
908        Else
909        {
910            /* Worker Threads */
911
912            M101 (Arg0, Arg1, Arg2, 0x00)
913        }
914    }
915
916    /*
917     * Test mf17.
918     *
919     * arg0 - number of threads
920     * arg1 - ID of current thread
921     * arg2 - Index of current thread
922     */
923    Method (MF17, 3, NotSerialized)
924    {
925        /* Initialization of multithreading interconnection */
926
927        If (!M107 (Arg0, Arg1, Arg2, 0x00))
928        {
929            If (!Arg2)
930            {
931                Debug = "Test mf17 skipped!"
932                SKIP ()
933            }
934
935            Return (Zero)
936        }
937
938        /* Report start of test: depending on vb01 can be reported by each thread */
939
940        M204 ("mf17", Arg0, Arg1, Arg2)
941        /*
942         * The Worker Threads loop forever executing strategies
943         * specified and controlled by the Control Thread.
944         */
945        If ((Arg2 == 0x00))
946        {
947            /* Control Thread */
948            /* Open testing */
949            M102 (Arg0)
950            /* All workers to sleep */
951
952            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
953            /* Test (see SPEC for mf17) */
954
955            M817 (Arg0)
956            /* Close testing */
957
958            M108 ("mf17", Arg0, Arg1, Arg2)
959        }
960        Else
961        {
962            /* Worker Threads */
963
964            M101 (Arg0, Arg1, Arg2, 0x00)
965        }
966    }
967
968    /*
969     * Test mf18.
970     *
971     * arg0 - number of threads
972     * arg1 - ID of current thread
973     * arg2 - Index of current thread
974     */
975    Method (MF18, 3, NotSerialized)
976    {
977        /* Initialization of multithreading interconnection */
978
979        If (!M107 (Arg0, Arg1, Arg2, 0x00))
980        {
981            If (!Arg2)
982            {
983                Debug = "Test mf18 skipped!"
984                SKIP ()
985            }
986
987            Return (Zero)
988        }
989
990        /* Report start of test: depending on vb01 can be reported by each thread */
991
992        M204 ("mf18", Arg0, Arg1, Arg2)
993        /*
994         * The Worker Threads loop forever executing strategies
995         * specified and controlled by the Control Thread.
996         */
997        If ((Arg2 == 0x00))
998        {
999            /* Control Thread */
1000            /* Open testing */
1001            M102 (Arg0)
1002            /* All workers to sleep */
1003
1004            M100 (Arg0, Arg1, Arg2, CM02, 0x00, 0x00, 0x00)
1005            /* Test (see SPEC for mf18) */
1006
1007            M818 (Arg0)
1008            /* Close testing */
1009
1010            M108 ("mf18", Arg0, Arg1, Arg2)
1011        }
1012        Else
1013        {
1014            /* Worker Threads */
1015
1016            M101 (Arg0, Arg1, Arg2, 0x00)
1017        }
1018    }
1019
1020    /*
1021     * arg0 - number of threads
1022     * arg1 - ID of current thread
1023     * arg2 - Index of current thread
1024     */
1025    Method (MF00, 3, NotSerialized)
1026    {
1027        If (!Arg2)
1028        {
1029            /* Sleeping mode */
1030
1031            SL00 = 0x0A /* default milliseconds to sleep for Control thread */
1032            SL01 = 0x0A /* default milliseconds to sleep for Worker threads */
1033            SLM0 = 0x00  /* sleeping mode for worker threads */
1034        }
1035
1036        If (!Y251)
1037        {
1038            If (!Arg2)
1039            {
1040                /*
1041                 * Initialization of multithreading interconnection:
1042                 * only to check that mt-technique itself works.
1043                 */
1044                If (!M107 (Arg0, Arg1, Arg2, 0x00))
1045                {
1046                    Debug = "Mt-technique doesn\'t work!"
1047                }
1048                Else
1049                {
1050                    Debug = "Mt-technique works"
1051                }
1052
1053                VB04 = 0x00 /* don't print statistics */
1054                CTL0 = 0x01 /* Worker threads - go! */
1055                SRMT ("mt_mutex_tests")
1056            }
1057
1058            Return (Zero)
1059        }
1060
1061        If (0x01)
1062        {
1063            /* Tests */
1064
1065            If (!Arg2)
1066            {
1067                SRMT ("mf01")
1068            }
1069
1070            MF01 (Arg0, Arg1, Arg2)
1071            If (!Arg2)
1072            {
1073                SRMT ("mf02")
1074            }
1075
1076            MF02 (Arg0, Arg1, Arg2)
1077            If (!Arg2)
1078            {
1079                SRMT ("mf03")
1080            }
1081
1082            MF03 (Arg0, Arg1, Arg2)
1083            If (!Arg2)
1084            {
1085                SRMT ("mf04")
1086            }
1087
1088            MF04 (Arg0, Arg1, Arg2)
1089            If (!Arg2)
1090            {
1091                SRMT ("mf05")
1092            }
1093
1094            MF05 (Arg0, Arg1, Arg2)
1095            If (!Arg2)
1096            {
1097                SRMT ("mf06")
1098            }
1099
1100            MF06 (Arg0, Arg1, Arg2)
1101            If (0x01)
1102            {
1103                If (!Arg2)
1104                {
1105                    SRMT ("mf07")
1106                }
1107
1108                MF07 (Arg0, Arg1, Arg2)
1109            }
1110            ElseIf (!Arg2)
1111            {
1112                SRMT ("mf07")
1113                BLCK ()
1114            }
1115
1116            If (!Arg2)
1117            {
1118                SRMT ("mf08")
1119            }
1120
1121            MF08 (Arg0, Arg1, Arg2)
1122            If (!Arg2)
1123            {
1124                SRMT ("mf09")
1125            }
1126
1127            MF09 (Arg0, Arg1, Arg2)
1128            If (!Arg2)
1129            {
1130                SRMT ("mf10")
1131            }
1132
1133            MF10 (Arg0, Arg1, Arg2)
1134            If (!Arg2)
1135            {
1136                SRMT ("mf11")
1137            }
1138
1139            MF11 (Arg0, Arg1, Arg2)
1140            If (!Arg2)
1141            {
1142                SRMT ("mf12")
1143            }
1144
1145            MF12 (Arg0, Arg1, Arg2)
1146            If (!Arg2)
1147            {
1148                SRMT ("mf13")
1149            }
1150
1151            MF13 (Arg0, Arg1, Arg2)
1152            If (!Arg2)
1153            {
1154                SRMT ("mf14")
1155            }
1156
1157            MF14 (Arg0, Arg1, Arg2)
1158            If (!Arg2)
1159            {
1160                SRMT ("mf15")
1161            }
1162
1163            MF15 (Arg0, Arg1, Arg2)
1164            If (!Arg2)
1165            {
1166                SRMT ("mf16")
1167            }
1168
1169            MF16 (Arg0, Arg1, Arg2)
1170            If (!Arg2)
1171            {
1172                SRMT ("mf17")
1173            }
1174
1175            MF17 (Arg0, Arg1, Arg2)
1176            If (!Arg2)
1177            {
1178                SRMT ("mf18")
1179            }
1180
1181            MF18 (Arg0, Arg1, Arg2)
1182        }
1183        Else
1184        {
1185            If (!Arg2)
1186            {
1187                SRMT ("mf01")
1188            }
1189
1190            MF01 (Arg0, Arg1, Arg2)
1191        }
1192
1193        /* Report statistics */
1194
1195        If ((Arg2 == 0x00))
1196        {
1197            /* Control Thread */
1198
1199            If (VB04)
1200            {
1201                M211 (Arg0)
1202            }
1203        }
1204    }
1205