Debian Codegraph @

tests/aslts/src/runtime/collections/mt/mutex/tests.asl

raw
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 * The test strategies to be managed and controlled by the
30 * Control Thread and fulfilled by the Worker Threads (Workers).
31 */
32 Name (Z152, 0x98)
33 /*
34 * Acquire/Sleep/Release
35 *
36 * All workers:
37 * - Acquire the same mutex
38 * - increment global counter
39 * - set up another global to its Index
40 * - sleep for the specified period
41 * - check that the global contains just its Index
42 * - Release mutex
43 * Control thread:
44 * - check after all threads complete that counter is correct
45 *
46 * arg0 - number of threads
47 * arg1 - Level of mutex
48 * arg2 - Index of mutex
49 * arg3 - Number of mutexes of the same level
50 */
51 Method (M801, 4, Serialized)
52 {
53 Name (LPN0, 0x00)
54 Name (LPC0, 0x00)
55 Name (NUMW, 0x00) /* number of threads in work */
56 /* Number of threads to be actually in work */
57
58 NUMW = M213 (Arg0, 0x05, 0x04)
59 /* Set up per-thread set of mutexes */
60
61 M334 (NUMW, C300, Arg1, 0x00, Arg2, Arg3)
62 /* c103 for all first num threads */
63
64 M210 (BS00, Arg0, C103, 0x00, NUMW, 0x01, C102) /* cmd: Acquire/Sleep/Release */
65 M114 (Arg0) /* run */
66 /* Wait for all Worker threads */
67
68 M103 (Arg0)
69 /* Check up the values of counters of all Mutexes */
70 /* lpC0 - Index of mutex */
71 Local0 = (NUMW - 0x01) /* exclude the Control thread */
72 LPN0 = Arg3
73 LPC0 = Arg2
74 While (LPN0)
75 {
76 M333 (Arg1, LPC0, Local0)
77 LPN0--
78 LPC0++
79 }
80 }
81
82 /*
83 * <Acquire/Sleep>(0-15 levels)/Release(15-0 levels)
84 *
85 * arg0 - number of threads
86 * arg1 - Index of mutex
87 * arg2 - Number of mutexes of the same level
88 */
89 Method (M802, 3, Serialized)
90 {
91 Name (NUMW, 0x00) /* number of threads in work */
92 Name (LPN0, 0x00)
93 Name (LPC0, 0x00)
94 Name (LPN1, 0x00)
95 Name (LPC1, 0x00)
96 /* Number of threads to be actually in work */
97
98 NUMW = M213 (Arg0, 0x05, 0x05)
99 /* Set up per-thread set of mutexes */
100
101 M334 (NUMW, C300, 0x00, 0x00, Arg1, Arg2)
102 /* c104 for all first num threads */
103
104 M210 (BS00, Arg0, C104, 0x00, NUMW, 0x01, C102) /* cmd: <Acquire/Sleep>(0-15 levels)/Release(15-0 levels) */
105 M114 (Arg0) /* run */
106 /* Wait for all Worker threads */
107
108 M103 (Arg0)
109 /* Check up the values of counters of all Mutexes */
110
111 Local0 = (NUMW - 0x01)
112 LPN0 = MAX0 /* \MAX0 */
113 LPC0 = 0x00
114 While (LPN0)
115 {
116 /* lpC0 - Level */
117
118 LPN1 = Arg2
119 LPC1 = Arg1
120 While (LPN1)
121 {
122 /* lpC1 - Index of mutex */
123
124 M333 (LPC0, LPC1, Local0)
125 LPN1--
126 LPC1++
127 }
128
129 LPN0--
130 LPC0++
131 }
132 }
133
134 /*
135 * Example 0
136 *
137 * arg0 - number of threads
138 * arg1 - Index of mutex
139 * arg2 - Number of mutexes of the same level
140 */
141 Method (M803, 1, Serialized)
142 {
143 Name (NUMW, 0x00) /* number of threads in work */
144 Name (LPN0, 0x00)
145 Name (LPC0, 0x00)
146 /* Number of threads to be actually in work */
147
148 NUMW = M213 (Arg0, 0x06, 0x06)
149 /* c105 for all first num threads */
150
151 M210 (BS00, Arg0, C105, 0x00, NUMW, 0x01, C102) /* cmd: Example 0 */
152 M114 (Arg0) /* run */
153 /* Wait for all Worker threads */
154
155 M103 (Arg0)
156 }
157
158 /*
159 * Manage the test m804
160 *
161 * arg0 - number of threads
162 * arg1 - 0 - thread_2 Releases than thread_1 Releases
163 * non-zero - thread_1 Releases than thread_2 Releases
164 * Thread_1:
165 * arg2 - Level of mutex (initial)
166 * arg3 - Number of levels of mutexes
167 * Thread_2:
168 * arg4 - Level of mutex (initial)
169 * arg5 - Number of levels of mutexes
170 */
171 Method (M8FF, 6, Serialized)
172 {
173 Name (LPN0, 0x00)
174 Name (LPC0, 0x00)
175 Name (THR, 0x00)
176 /* ACQUIRING */
177 /* === Thread 1 === */
178 THR = 0x01
179 /* Set up per-thread set of mutexes */
180
181 M334 (Arg0, C300, Arg2, Arg3, 0x00, 0x01)
182 M200 (BS00, Arg0, C102) /* cmd: Sleep */
183 M208 (BS00, THR, C106) /* cmd: Acquire specified set of mutexes */
184 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
185 M114 (Arg0)
186 /* Wait for all Worker threads */
187
188 M103 (Arg0)
189 /* Check up the values of counters of all Mutexes */
190
191 LPN0 = Arg3
192 LPC0 = Arg2
193 While (LPN0)
194 {
195 M333 (LPC0, 0x00, 0x01)
196 LPN0--
197 LPC0++
198 }
199
200 /* === Thread 2 === */
201
202 THR = 0x02
203 /* Set up per-thread set of mutexes */
204
205 M334 (Arg0, C300, Arg4, Arg5, 0x01, 0x01)
206 M200 (BS00, Arg0, C102) /* cmd: Sleep */
207 M208 (BS00, THR, C106) /* cmd: Acquire specified set of mutexes */
208 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
209 M114 (Arg0)
210 /* Wait for all Worker threads */
211
212 M103 (Arg0)
213 /* Check up the values of counters of all Mutexes */
214
215 LPN0 = Arg5
216 LPC0 = Arg4
217 While (LPN0)
218 {
219 M333 (LPC0, 0x01, 0x01)
220 LPN0--
221 LPC0++
222 }
223
224 /* RELEASING */
225
226 If (!Arg1)
227 {
228 /* === Thread 2 === */
229
230 THR = 0x02
231 /* Set up per-thread set of mutexes */
232
233 M334 (Arg0, C300, Arg4, Arg5, 0x01, 0x01)
234 M200 (BS00, Arg0, C102) /* cmd: Sleep */
235 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
236 M114 (Arg0)
237 /* Wait for all Worker threads */
238
239 M103 (Arg0)
240 }
241
242 /* === Thread 1 === */
243
244 THR = 0x01
245 /* Set up per-thread set of mutexes */
246
247 M334 (Arg0, C300, Arg2, Arg3, 0x00, 0x01)
248 M200 (BS00, Arg0, C102) /* cmd: Sleep */
249 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
250 M114 (Arg0)
251 /* Wait for all Worker threads */
252
253 M103 (Arg0)
254 If (Arg1)
255 {
256 /* === Thread 2 === */
257
258 THR = 0x02
259 /* Set up per-thread set of mutexes */
260
261 M334 (Arg0, C300, Arg4, Arg5, 0x01, 0x01)
262 M200 (BS00, Arg0, C102) /* cmd: Sleep */
263 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
264 M114 (Arg0)
265 /* Wait for all Worker threads */
266
267 M103 (Arg0)
268 }
269 }
270
271 /*
272 * arg0 - number of threads
273 */
274 Method (M804, 1, NotSerialized)
275 {
276 /* I */
277
278 M8FF (Arg0, 0x00, 0x00, MAX0, 0x00, MAX0)
279 /* Reset all counters (cnt0) and flags (fl00) corresponding to all Mutexes */
280
281 M330 ()
282 /* II */
283
284 M8FF (Arg0, 0x01, 0x00, MAX0, 0x00, MAX0)
285 /* Reset all counters (cnt0) and flags (fl00) corresponding to all Mutexes */
286
287 M330 ()
288 /* III */
289
290 M8FF (Arg0, 0x01, 0x07, 0x01, 0x00, MAX0)
291 }
292
293 /*
294 * arg0 - number of threads
295 */
296 Method (M805, 1, Serialized)
297 {
298 Name (LPN0, 0x00)
299 Name (LPC0, 0x00)
300 Name (THR, 0x00)
301 Name (EE01, Buffer (Arg0)
302 {
303 0x00, 0x3F, 0x00 // .?.
304 }) /* AE_AML_NOT_OWNER */
305 Name (EE02, Buffer (Arg0)
306 {
307 0x00, 0x00, 0x3F // ..?
308 }) /* AE_AML_NOT_OWNER */
309 /* 1. Thread_1 owns its set of all-level mutexes and falls into sleeping */
310
311 THR = 0x01
312 /* Set up per-thread set of mutexes */
313
314 M334 (Arg0, C300, 0x00, MAX0, 0x00, 0x01)
315 M200 (BS00, Arg0, C102) /* cmd: Sleep */
316 M208 (BS00, THR, C106) /* cmd: Acquire specified set of mutexes */
317 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
318 M114 (Arg0)
319 /* Wait for all Worker threads */
320
321 M103 (Arg0)
322 /* Check up the values of counters of all Mutexes */
323
324 LPN0 = MAX0 /* \MAX0 */
325 LPC0 = 0x00
326 While (LPN0)
327 {
328 M333 (LPC0, 0x00, 0x01)
329 LPN0--
330 LPC0++
331 }
332
333 /* 2,3. Thread_2 tries to Release all those mutexes owned by Thread_1 */
334
335 THR = 0x02
336 /* Set up exception expectation on Release operation */
337
338 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
339 M20F (Arg0, EE02, 0x00) /* Init the exceptional conditions flags (AE_AML_NOT_OWNER) */
340 /* Set up per-thread set of mutexes */
341
342 M334 (Arg0, C300, 0x00, MAX0, 0x00, 0x01)
343 M200 (BS00, Arg0, C102) /* cmd: Sleep */
344 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
345 M114 (Arg0)
346 /* Wait for all Worker threads */
347
348 M103 (Arg0)
349 /* Reset exception expectation */
350
351 M336 (Arg0, 0x01)
352 /* 4. Thread_2 owns its set of all-level mutexes (not intersecting with Thread_1) */
353
354 THR = 0x02
355 /* Set up per-thread set of mutexes */
356
357 M334 (Arg0, C300, 0x00, MAX0, 0x01, 0x01)
358 M200 (BS00, Arg0, C102) /* cmd: Sleep */
359 M208 (BS00, THR, C106) /* cmd: Acquire specified set of mutexes */
360 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
361 M114 (Arg0)
362 /* Wait for all Worker threads */
363
364 M103 (Arg0)
365 /* Check up the values of counters of all Mutexes */
366
367 LPN0 = MAX0 /* \MAX0 */
368 LPC0 = 0x00
369 While (LPN0)
370 {
371 M333 (LPC0, 0x00, 0x01)
372 LPN0--
373 LPC0++
374 }
375
376 /* 5,6. Thread_2 tries again to Release mutexes owned by Thread_1 */
377
378 THR = 0x02
379 /* Set up exception expectation on Release operation */
380
381 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
382 M20F (Arg0, EE02, 0x00) /* Init the exceptional conditions flags (AE_AML_NOT_OWNER) */
383 /* Set up per-thread set of mutexes */
384
385 M334 (Arg0, C300, 0x00, MAX0, 0x00, 0x01)
386 M200 (BS00, Arg0, C102) /* cmd: Sleep */
387 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
388 M114 (Arg0)
389 /* Wait for all Worker threads */
390
391 M103 (Arg0)
392 /* Reset exception expectation */
393
394 M336 (Arg0, 0x01)
395 /* 7,8. Thread_1 tries to Release mutexes owned by Thread_2 */
396
397 THR = 0x01
398 /* Set up exception expectation on Release operation */
399
400 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
401 M20F (Arg0, EE01, 0x00) /* Init the exceptional conditions flags (AE_AML_NOT_OWNER) */
402 /* Set up per-thread set of mutexes */
403
404 M334 (Arg0, C300, 0x00, MAX0, 0x01, 0x01)
405 M200 (BS00, Arg0, C102) /* cmd: Sleep */
406 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
407 M114 (Arg0)
408 /* Wait for all Worker threads */
409
410 M103 (Arg0)
411 /* Reset exception expectation */
412
413 M336 (Arg0, 0x01)
414 /* 9. Thread_1 Releases its mutexes */
415
416 THR = 0x01
417 /* Set up per-thread set of mutexes */
418
419 M334 (Arg0, C300, 0x00, MAX0, 0x00, 0x01)
420 M200 (BS00, Arg0, C102) /* cmd: Sleep */
421 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
422 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
423 M114 (Arg0)
424 /* Wait for all Worker threads */
425
426 M103 (Arg0)
427 /* 10. Thread_2 Releases its mutexes */
428
429 THR = 0x02
430 /* Set up per-thread set of mutexes */
431
432 M334 (Arg0, C300, 0x00, MAX0, 0x01, 0x01)
433 M200 (BS00, Arg0, C102) /* cmd: Sleep */
434 M208 (BS00, THR, C107) /* cmd: Release specified set of mutexes */
435 M114 (Arg0)
436 /* Wait for all Worker threads */
437
438 M103 (Arg0)
439 }
440
441 /*
442 * arg0 - number of threads (total)
443 */
444 Method (M806, 1, Serialized)
445 {
446 Name (NUMW, 0x00) /* number of threads in work */
447 Name (LPN0, 0x00)
448 Name (LPC0, 0x00)
449 Name (NTH0, Buffer (0x02){})
450 Name (IX00, Buffer ((MIN1 * 0x02))
451 {
452 /* 0000 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, // ........
453 /* 0008 */ 0x03, 0x01 // ..
454 })
455 /*
456 * arg0-arg5 - same as m33f
457 * arg6 - index of thread according to the test scenario
458 */
459 Method (M000, 7, Serialized)
460 {
461 Name (NTH1, 0x00) /* actually in work */
462 NTH1 = DerefOf (Arg0 [0x01])
463 If ((Arg6 < NTH1))
464 {
465 M33F (Arg0, Arg1, Arg2, Arg3, Arg4, Arg5, 0x00)
466 }
467 }
468
469 /* Number of threads to be actually in work */
470
471 NUMW = M213 (Arg0, MIN1, 0x04)
472 /* Pack numbers of threads */
473
474 NTH0 = M20D (Arg0, NUMW)
475 /* Data */
476
477 Name (B001, Buffer ((MIN1 * 0x02))
478 {
479 /* 0000 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, // ........
480 /* 0008 */ 0x00, 0x01 // ..
481 })
482 Name (B002, Buffer ((MIN1 * 0x02))
483 {
484 /* 0000 */ 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x01, // ........
485 /* 0008 */ 0x01, 0x01 // ..
486 })
487 Name (B003, Buffer ((MIN1 * 0x02))
488 {
489 /* 0000 */ 0x00, 0x00, 0x02, 0x01, 0x02, 0x01, 0x00, 0x00, // ........
490 /* 0008 */ 0x02, 0x01 // ..
491 })
492 Name (B004, Buffer ((MIN1 * 0x02))
493 {
494 /* 0000 */ 0x00, 0x00, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, // ........
495 /* 0008 */ 0x00, 0x00 // ..
496 })
497 Name (CM01, Package (MIN1)
498 {
499 0x00,
500 C107,
501 0x00,
502 0x00,
503 0x00
504 })
505 Name (EE01, Buffer (MIN1)
506 {
507 0x00, 0x3F, 0x00, 0x00, 0x00 // .?...
508 }) /* AE_AML_NOT_OWNER */
509 Name (CM02, Package (MIN1)
510 {
511 0x00,
512 0x00,
513 C107,
514 0x00,
515 0x00
516 })
517 Name (EE02, Buffer (MIN1)
518 {
519 0x00, 0x00, 0x3F, 0x00, 0x00 // ..?..
520 }) /* AE_AML_NOT_OWNER */
521 Name (CM03, Package (MIN1)
522 {
523 0x00,
524 0x00,
525 0x00,
526 C107,
527 0x00
528 })
529 Name (EE03, Buffer (MIN1)
530 {
531 0x00, 0x00, 0x00, 0x3F, 0x00 // ...?.
532 }) /* AE_AML_NOT_OWNER */
533 Name (CM04, Package (MIN1)
534 {
535 0x00,
536 0x00,
537 0x00,
538 0x00,
539 C107
540 })
541 Name (EE04, Buffer (MIN1)
542 {
543 0x00, 0x00, 0x00, 0x00, 0x3F // ....?
544 }) /* AE_AML_NOT_OWNER */
545 /* Acquire */
546
547 LPN0 = MAX0 /* \MAX0 */
548 LPC0 = 0x00
549 While (LPN0)
550 {
551 /* All threads Acquire their mutexes */
552
553 M33F (NTH0, C106, 0x00, LPC0, IX00, C106, 0x00) /* Expected hang statuses (buffer/Integer) */
554 /* 2. Threads thr-2, thr-3, thr-4 attempt to Release mutex of thr-1 */
555
556 If ((NUMW > 0x01))
557 {
558 M000 (NTH0, CM02, EE02, LPC0, B001, CM02, 0x02)
559 M000 (NTH0, CM03, EE03, LPC0, B001, CM03, 0x03)
560 M000 (NTH0, CM04, EE04, LPC0, B001, CM04, 0x04)
561 }
562
563 /* 3. Threads thr-1, thr-3, thr-4 attempt to Release mutex of thr-2 */
564
565 If ((NUMW > 0x02))
566 {
567 M000 (NTH0, CM01, EE01, LPC0, B002, CM01, 0x01)
568 M000 (NTH0, CM03, EE03, LPC0, B002, CM03, 0x03)
569 M000 (NTH0, CM04, EE04, LPC0, B002, CM04, 0x04)
570 }
571
572 /* 4. Threads thr-1, thr-2, thr-4 attempt to Release mutex of thr-3 */
573
574 If ((NUMW > 0x03))
575 {
576 M000 (NTH0, CM01, EE01, LPC0, B003, CM01, 0x01)
577 M000 (NTH0, CM02, EE02, LPC0, B003, CM02, 0x02)
578 M000 (NTH0, CM04, EE04, LPC0, B003, CM04, 0x04)
579 }
580
581 /* 5. Threads thr-1, thr-2, thr-3 attempt to Release mutex of thr-4 */
582
583 If ((NUMW > 0x04))
584 {
585 M000 (NTH0, CM01, EE01, LPC0, B004, CM01, 0x01)
586 M000 (NTH0, CM02, EE02, LPC0, B004, CM02, 0x02)
587 M000 (NTH0, CM03, EE03, LPC0, B004, CM03, 0x03)
588 }
589
590 /* All threads Release their mutexes */
591
592 M33F (NTH0, C107, 0x00, LPC0, IX00, C107, 0x00) /* Expected hang statuses (buffer/Integer) */
593 LPN0--
594 LPC0++
595 }
596 }
597
598 /*
599 * arg0 - number of threads
600 */
601 Method (M807, 1, Serialized)
602 {
603 Name (LPN0, 0x00)
604 Name (LPC0, 0x00)
605 Name (LPN1, 0x00)
606 Name (LPC1, 0x00)
607 Name (IX00, 0x00)
608 Name (NUMW, 0x00) /* number of threads in work */
609 /* Number of threads to be actually in work */
610
611 NUMW = M213 (Arg0, MIN1, 0x03)
612 /* From 15 to 0 */
613
614 LPN0 = MAX0 /* \MAX0 */
615 IX00 = MAX0 /* \MAX0 */
616 IX00--
617 LPC0 = IX00 /* \M807.IX00 */
618 While (LPN0)
619 {
620 If ((LPC0 != 0x00))
621 {
622 /*
623 * 3. Acquire mutexes from 0 to (N-1) levels:
624 * - Set up per-thread set of mutexes
625 * - Acquire specified set of mutexes
626 * - Wait for all Worker threads
627 * - Check up the values of counters of all Mutexes
628 */
629 M337 (Arg0, NUMW, 0x00, LPC0, 0x01, 0x00)
630 /*
631 * 4. Release mutexes from 0 to (N-1) levels:
632 * - Set up per-thread set of mutexes
633 * - Release specified set of mutexes
634 * - Wait for all Worker threads
635 */
636 M338 (Arg0, NUMW, 0x00, LPC0)
637 /* Reset all counters (cnt0) and flags (fl00) corresponding to all Mutexes */
638
639 M330 ()
640 }
641
642 /* 5. Acquire mutex of level N */
643
644 M337 (Arg0, NUMW, LPC0, 0x01, 0x01, 0x00)
645 If ((LPC0 != 0x00))
646 {
647 /*
648 * 6. Attempt to Acquire mutexes from 0 to (N-1) levels
649 * 7. Exception is expected
650 */
651 M337 (Arg0, NUMW, 0x00, LPC0, 0x00, 0x40) /* With exceptional conditions flags (AE_AML_MUTEX_ORDER) */
652 /* Reset exception expectation */
653
654 M336 (Arg0, 0x01)
655 }
656
657 If ((LPC0 != IX00))
658 {
659 /*
660 * 8. Acquire mutexes from (N+1) to 15 levels
661 * - Set up per-thread set of mutexes
662 * - Acquire specified set of mutexes
663 * - Wait for all Worker threads
664 * - Check up the values of counters of all Mutexes
665 */
666 Local0 = (LPC0 + 0x01)
667 Local1 = (IX00 - LPC0) /* \M807.LPC0 */
668 M337 (Arg0, NUMW, Local0, Local1, 0x01, 0x00)
669 }
670
671 /*
672 * 9. Release all mutexes (starting with lpC0 up to 15 level):
673 * - Set up per-thread set of mutexes
674 * - Release specified set of mutexes
675 * - Wait for all Worker threads
676 */
677 Local1 = (MAX0 - LPC0) /* \M807.LPC0 */
678 M338 (Arg0, NUMW, LPC0, Local1)
679 /* Reset all counters (cnt0) and flags (fl00) corresponding to all Mutexes */
680
681 M330 ()
682 If ((LPC0 != 0x00))
683 {
684 /*
685 * 10. Acquire mutexes from 0 to (N-1) levels:
686 * - Set up per-thread set of mutexes
687 * - Acquire specified set of mutexes
688 * - Wait for all Worker threads
689 * - Check up the values of counters of all Mutexes
690 */
691 M337 (Arg0, NUMW, 0x00, LPC0, 0x01, 0x00)
692 /*
693 * 11. Release mutexes (from 0 to (N-1) levels):
694 * - Set up per-thread set of mutexes
695 * - Release specified set of mutexes
696 * - Wait for all Worker threads
697 */
698 M338 (Arg0, NUMW, 0x00, LPC0)
699 /* Reset all counters (cnt0) and flags (fl00) corresponding to all Mutexes */
700
701 M330 ()
702 }
703
704 LPN0--
705 LPC0--
706 }
707 }
708
709 /*
710 * arg0 - number of threads (total)
711 */
712 Method (M808, 1, Serialized)
713 {
714 Name (PR, 0x00)
715 Name (L000, 0x00)
716 Name (NTH0, Buffer (0x02){})
717 /*
718 * Per-thread indexes of mutexes
719 *
720 * Ctl-thr, thr-1, thr-2, thr-3, thr-4
721 */
722 Name (B000, Buffer ((MIN1 * 0x02))
723 {
724 /* 0000 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, // ........
725 /* 0008 */ 0x03, 0x01 // ..
726 })
727 Name (B001, Buffer ((MIN1 * 0x02))
728 {
729 /* 0000 */ 0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, // ........
730 /* 0008 */ 0x00, 0x01 // ..
731 })
732 Name (B002, Buffer ((MIN1 * 0x02))
733 {
734 /* 0000 */ 0x00, 0x00, 0x02, 0x01, 0x03, 0x01, 0x00, 0x01, // ........
735 /* 0008 */ 0x01, 0x01 // ..
736 })
737 Name (B003, Buffer ((MIN1 * 0x02))
738 {
739 /* 0000 */ 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x01, 0x01, // ........
740 /* 0008 */ 0x02, 0x01 // ..
741 })
742 /* Pack numbers of threads */
743
744 NTH0 = M20D (Arg0, MIN1)
745 /* x-0-123 */
746 /*
747 * Acquire all x-0-123 and check owning
748 *
749 * Threads thr-1, thr-2, thr-3, thr-4
750 * acquire respectively all x-0-123 mutexes
751 * and check owning of all those mutexes.
752 */
753 M33F (NTH0, C106, 0x00, L000, B000, C106, 0x00) /* Expected hang statuses (buffer/Integer) */
754 If (PR)
755 {
756 M20B (0x00, "Acquire all x-0-123")
757 }
758
759 /* At this point threads have Acquired: x-0-123 */
760
761 M8FE (NTH0, L000, B000, B001, PR)
762 M8FE (NTH0, L000, B001, B002, PR)
763 M8FE (NTH0, L000, B002, B003, PR)
764 M8FE (NTH0, L000, B003, B000, PR)
765 /* At this point threads have Acquired: x-0-123 */
766 /* Release mutexes on all threads */
767 Name (CM00, Package (MIN1)
768 {
769 0x00,
770 C107,
771 C107,
772 C107,
773 C107
774 })
775 Name (CP00, Package (MIN1)
776 {
777 0x00,
778 C107,
779 C107,
780 C107,
781 C107
782 })
783 M33F (NTH0, CM00, 0x00, L000, B000, CP00, 0x00) /* Expected hang statuses (buffer/Integer) */
784 If (PR)
785 {
786 M20B (0x00, "Release all")
787 }
788 }
789
790 /*
791 * Manage the test m808
792 *
793 * agr0 - numbers of threads (buffer/Integer)
794 * arg1 - levels of mutexes (buffer/Integer)
795 * arg2 - indexes of mutexes (buffer/Integer) - start point
796 * arg3 - indexes of mutexes (buffer/Integer) - target point
797 * arg4 - printing flag
798 */
799 Method (M8FE, 5, Serialized)
800 {
801 /*
802 * Comments are for one particular transfer step from
803 * x-0-123 to x-1-230, other steps are identical.
804 */
805 /* At this point threads have Acquired: x-0-123 */
806 /* x-1-230 */
807 /* Acquire x-x-230 and check that all -230- hang */
808 Name (CM00, Package (MIN1)
809 {
810 0x00,
811 0x00,
812 C106,
813 C106,
814 C106
815 })
816 M33F (Arg0, CM00, 0x00, Arg1, Arg3, 0x00, CM00) /* Expected hang statuses (buffer/Integer) */
817 If (Arg4)
818 {
819 M20B (0x00, "Acquire x-x-230")
820 }
821
822 /* Release x-0-xxx, this frees mux for thr-4 */
823
824 Name (CM01, Package (MIN1)
825 {
826 0x00,
827 C107,
828 0x00,
829 0x00,
830 0x00
831 })
832 Name (CP01, Package (MIN1)
833 {
834 0x00,
835 C107,
836 0x00,
837 0x00,
838 C106
839 })
840 Name (HG01, Package (MIN1)
841 {
842 0x00,
843 0x00,
844 C106,
845 C106,
846 0x00
847 })
848 M33F (Arg0, CM01, 0x00, Arg1, Arg2, CP01, HG01) /* Expected hang statuses (buffer/Integer) */
849 If (Arg4)
850 {
851 M20B (0x00, "Release x-0-xxx")
852 }
853
854 /* Acquire x-1-xxx and check that it hangs too */
855
856 Name (CM02, Package (MIN1)
857 {
858 0x00,
859 C106,
860 0x00,
861 0x00,
862 0x00
863 })
864 Name (HG02, Package (MIN1)
865 {
866 0x00,
867 C106,
868 C106,
869 C106,
870 0x00
871 })
872 M33F (Arg0, CM02, 0x00, Arg1, Arg3, 0x00, HG02) /* Expected hang statuses (buffer/Integer) */
873 If (Arg4)
874 {
875 M20B (0x00, "Acquire x-1-xxx")
876 }
877
878 /* Release x-x-xx3, this frees mux for thr-3 */
879
880 Name (CM03, Package (MIN1)
881 {
882 0x00,
883 0x00,
884 0x00,
885 0x00,
886 C107
887 })
888 Name (CP03, Package (MIN1)
889 {
890 0x00,
891 0x00,
892 0x00,
893 C106,
894 C107
895 })
896 Name (HG03, Package (MIN1)
897 {
898 0x00,
899 C106,
900 C106,
901 0x00,
902 0x00
903 })
904 M33F (Arg0, CM03, 0x00, Arg1, Arg2, CP03, HG03) /* Expected hang statuses (buffer/Integer) */
905 If (Arg4)
906 {
907 M20B (0x00, "Release x-x-xx3")
908 }
909
910 /* Release x-x-x2x, this frees mux for thr-2 */
911
912 Name (CM04, Package (MIN1)
913 {
914 0x00,
915 0x00,
916 0x00,
917 C107,
918 0x00
919 })
920 Name (CP04, Package (MIN1)
921 {
922 0x00,
923 0x00,
924 C106,
925 C107,
926 0x00
927 })
928 Name (HG04, Package (MIN1)
929 {
930 0x00,
931 C106,
932 0x00,
933 0x00,
934 0x00
935 })
936 M33F (Arg0, CM04, 0x00, Arg1, Arg2, CP04, HG04) /* Expected hang statuses (buffer/Integer) */
937 If (Arg4)
938 {
939 M20B (0x00, "Release x-x-x2x")
940 }
941
942 /* Release x-x-1xx, this frees mux for thr-1 */
943
944 Name (CM05, Package (MIN1)
945 {
946 0x00,
947 0x00,
948 C107,
949 0x00,
950 0x00
951 })
952 Name (CP05, Package (MIN1)
953 {
954 0x00,
955 C106,
956 C107,
957 0x00,
958 0x00
959 })
960 M33F (Arg0, CM05, 0x00, Arg1, Arg2, CP05, 0x00) /* Expected hang statuses (buffer/Integer) */
961 If (Arg4)
962 {
963 M20B (0x00, "Release x-x-1xx")
964 }
965 /* At this point threads have Acquired: x-1-230 */
966 }
967
968 /*
969 * arg0 - number of threads (total)
970 */
971 Method (M809, 1, NotSerialized)
972 {
973 M80C (Arg0, 0x01)
974 }
975
976 /*
977 * arg0 - number of threads (total)
978 * arg1 - variant (of parameters passed to m8fd):
979 * 0:
980 * arg1 - indexes of mutexes (buffer/Integer)
981 * arg2 - levels of mutexes (buffer/Integer) - start point
982 * arg3 - levels of mutexes (buffer/Integer) - target point
983 * 1:
984 * arg1 - levels of mutexes (buffer/Integer)
985 * arg2 - indexes of mutexes (buffer/Integer) - start point
986 * arg3 - indexes of mutexes (buffer/Integer) - target point
987 */
988 Method (M80C, 2, Serialized)
989 {
990 Name (PR, 0x00)
991 Name (IXLL, 0x00)
992 Name (NTH0, Buffer (0x02){})
993 /*
994 * Per-thread indexes/levels (depending on arg1) of mutexes
995 *
996 * Ctl-thr, thr-1, thr-2, thr-3, thr-4
997 */
998 Name (B000, Buffer ((MIN1 * 0x02))
999 {
1000 /* 0000 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, // ........
1001 /* 0008 */ 0x03, 0x01 // ..
1002 })
1003 Name (B001, Buffer ((MIN1 * 0x02))
1004 {
1005 /* 0000 */ 0x00, 0x00, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, // ........
1006 /* 0008 */ 0x04, 0x01 // ..
1007 })
1008 Name (B002, Buffer ((MIN1 * 0x02))
1009 {
1010 /* 0000 */ 0x00, 0x00, 0x02, 0x01, 0x03, 0x01, 0x04, 0x01, // ........
1011 /* 0008 */ 0x05, 0x01 // ..
1012 })
1013 Name (B003, Buffer ((MIN1 * 0x02))
1014 {
1015 /* 0000 */ 0x00, 0x00, 0x03, 0x01, 0x04, 0x01, 0x05, 0x01, // ........
1016 /* 0008 */ 0x06, 0x01 // ..
1017 })
1018 Name (B004, Buffer ((MIN1 * 0x02))
1019 {
1020 /* 0000 */ 0x00, 0x00, 0x04, 0x01, 0x05, 0x01, 0x06, 0x01, // ........
1021 /* 0008 */ 0x07, 0x01 // ..
1022 })
1023 Name (B005, Buffer ((MIN1 * 0x02))
1024 {
1025 /* 0000 */ 0x00, 0x00, 0x05, 0x01, 0x06, 0x01, 0x07, 0x01, // ........
1026 /* 0008 */ 0x08, 0x01 // ..
1027 })
1028 Name (B006, Buffer ((MIN1 * 0x02))
1029 {
1030 /* 0000 */ 0x00, 0x00, 0x06, 0x01, 0x07, 0x01, 0x08, 0x01, // ........
1031 /* 0008 */ 0x09, 0x01 // ..
1032 })
1033 Name (B007, Buffer ((MIN1 * 0x02))
1034 {
1035 /* 0000 */ 0x00, 0x00, 0x07, 0x01, 0x08, 0x01, 0x09, 0x01, // ........
1036 /* 0008 */ 0x0A, 0x01 // ..
1037 })
1038 Name (B008, Buffer ((MIN1 * 0x02))
1039 {
1040 /* 0000 */ 0x00, 0x00, 0x08, 0x01, 0x09, 0x01, 0x0A, 0x01, // ........
1041 /* 0008 */ 0x0B, 0x01 // ..
1042 })
1043 Name (B009, Buffer ((MIN1 * 0x02))
1044 {
1045 /* 0000 */ 0x00, 0x00, 0x09, 0x01, 0x0A, 0x01, 0x0B, 0x01, // ........
1046 /* 0008 */ 0x0C, 0x01 // ..
1047 })
1048 Name (B00A, Buffer ((MIN1 * 0x02))
1049 {
1050 /* 0000 */ 0x00, 0x00, 0x0A, 0x01, 0x0B, 0x01, 0x0C, 0x01, // ........
1051 /* 0008 */ 0x0D, 0x01 // ..
1052 })
1053 Name (B00B, Buffer ((MIN1 * 0x02))
1054 {
1055 /* 0000 */ 0x00, 0x00, 0x0B, 0x01, 0x0C, 0x01, 0x0D, 0x01, // ........
1056 /* 0008 */ 0x0E, 0x01 // ..
1057 })
1058 Name (B00C, Buffer ((MIN1 * 0x02))
1059 {
1060 /* 0000 */ 0x00, 0x00, 0x0C, 0x01, 0x0D, 0x01, 0x0E, 0x01, // ........
1061 /* 0008 */ 0x0F, 0x01 // ..
1062 })
1063 If (Arg1)
1064 {
1065 /* The same level of mutexes */
1066
1067 IXLL = 0x00
1068 }
1069 Else
1070 {
1071 /* The same index of mutexes */
1072
1073 IXLL = 0x00
1074 }
1075
1076 /* Pack numbers of threads */
1077
1078 NTH0 = M20D (Arg0, MIN1)
1079 /* x-0123 */
1080 /*
1081 * x-0-1-2-3
1082 * Acquire all x-0123 and check owning
1083 *
1084 * Threads thr-1, thr-2, thr-3, thr-4
1085 * acquire respectively all x-0123 mutexes
1086 * and check owning of all those mutexes.
1087 */
1088 If (Arg1)
1089 {
1090 Local6 = IXLL /* \M80C.IXLL */
1091 Local7 = B000 /* \M80C.B000 */
1092 }
1093 Else
1094 {
1095 Local6 = B000 /* \M80C.B000 */
1096 Local7 = IXLL /* \M80C.IXLL */
1097 }
1098
1099 M33F (NTH0, C106, 0x00, Local6, Local7, C106, 0x00) /* Expected hang statuses (buffer/Integer) */
1100 If (PR)
1101 {
1102 M20B (0x00, "Acquire all x-0123")
1103 }
1104
1105 M8FD (NTH0, IXLL, B000, B001, PR, Arg1)
1106 M8FD (NTH0, IXLL, B001, B002, PR, Arg1)
1107 M8FD (NTH0, IXLL, B002, B003, PR, Arg1)
1108 M8FD (NTH0, IXLL, B003, B004, PR, Arg1)
1109 M8FD (NTH0, IXLL, B004, B005, PR, Arg1)
1110 M8FD (NTH0, IXLL, B005, B006, PR, Arg1)
1111 M8FD (NTH0, IXLL, B006, B007, PR, Arg1)
1112 M8FD (NTH0, IXLL, B007, B008, PR, Arg1)
1113 M8FD (NTH0, IXLL, B008, B009, PR, Arg1)
1114 M8FD (NTH0, IXLL, B009, B00A, PR, Arg1)
1115 M8FD (NTH0, IXLL, B00A, B00B, PR, Arg1)
1116 M8FD (NTH0, IXLL, B00B, B00C, PR, Arg1)
1117 /* x-(12)-(13)-(14)-(15), Release=x-(12)(13)(14)(15), hang=x-xxxx, success=x-(12)(13)(14)(15) */
1118
1119 If (Arg1)
1120 {
1121 Local6 = IXLL /* \M80C.IXLL */
1122 Local7 = B00C /* \M80C.B00C */
1123 }
1124 Else
1125 {
1126 Local6 = B00C /* \M80C.B00C */
1127 Local7 = IXLL /* \M80C.IXLL */
1128 }
1129
1130 M33F (NTH0, C107, 0x00, Local6, Local7, C107, 0x00) /* Expected hang statuses (buffer/Integer) */
1131 If (PR)
1132 {
1133 M20B (0x00, "Release x-(12)(13)(14)(15)")
1134 }
1135 }
1136
1137 /*
1138 * arg0 - numbers of threads (buffer/Integer)
1139 * arg1 - indexes/levels of mutexes (buffer/Integer)
1140 * arg2 - levels/indexes of mutexes (buffer/Integer) - start point
1141 * arg3 - levels/indexes of mutexes (buffer/Integer) - target point
1142 * arg4 - printing flag
1143 * arg5 - variant (see m80c)
1144 */
1145 Method (M8FD, 6, Serialized)
1146 {
1147 /* At this point threads have Acquired: x-0123 */
1148 /*
1149 * Comments are given for one particular transfer step
1150 * from x-0-123 to x-1-230, other steps are identical.
1151 */
1152 /* x-01-12-23-34, Acquire=x-1234, hang=x-123x, success=x-xxx4 */
1153 Name (CM00, Package (MIN1)
1154 {
1155 0x00,
1156 C106,
1157 C106,
1158 C106,
1159 C106
1160 })
1161 Name (CP00, Package (MIN1)
1162 {
1163 0x00,
1164 0x00,
1165 0x00,
1166 0x00,
1167 C106
1168 })
1169 Name (HG00, Package (MIN1)
1170 {
1171 0x00,
1172 C106,
1173 C106,
1174 C106,
1175 0x00
1176 })
1177 If (Arg5)
1178 {
1179 Local6 = Arg1
1180 Local7 = Arg3
1181 }
1182 Else
1183 {
1184 Local6 = Arg3
1185 Local7 = Arg1
1186 }
1187
1188 M33F (Arg0, CM00, 0x00, Local6, Local7, CP00, HG00) /* Expected hang statuses (buffer/Integer) */
1189 If (Arg4)
1190 {
1191 M20B (0x00, "Acquire x-1234")
1192 }
1193
1194 /* x-01-12-23-3, Release=x-xxx4, hang=x-123x, success=x-xxx4 */
1195
1196 Name (CM01, Package (MIN1)
1197 {
1198 0x00,
1199 0x00,
1200 0x00,
1201 0x00,
1202 C107
1203 })
1204 Name (CP01, Package (MIN1)
1205 {
1206 0x00,
1207 0x00,
1208 0x00,
1209 0x00,
1210 C107
1211 })
1212 Name (HG01, Package (MIN1)
1213 {
1214 0x00,
1215 C106,
1216 C106,
1217 C106,
1218 0x00
1219 })
1220 If (Arg5)
1221 {
1222 Local6 = Arg1
1223 Local7 = Arg3
1224 }
1225 Else
1226 {
1227 Local6 = Arg3
1228 Local7 = Arg1
1229 }
1230
1231 M33F (Arg0, CM01, 0x00, Local6, Local7, CP01, HG01) /* Expected hang statuses (buffer/Integer) */
1232 If (Arg4)
1233 {
1234 M20B (0x00, "Release x-xxx4")
1235 }
1236
1237 /* x-01-12-23-x, Release=x-xxx3, hang=x-12xx, success=x-xx33 */
1238
1239 Name (CM02, Package (MIN1)
1240 {
1241 0x00,
1242 0x00,
1243 0x00,
1244 0x00,
1245 C107
1246 })
1247 Name (CP02, Package (MIN1)
1248 {
1249 0x00,
1250 0x00,
1251 0x00,
1252 C106,
1253 C107
1254 })
1255 Name (HG02, Package (MIN1)
1256 {
1257 0x00,
1258 C106,
1259 C106,
1260 0x00,
1261 0x00
1262 })
1263 If (Arg5)
1264 {
1265 Local6 = Arg1
1266 Local7 = Arg2
1267 }
1268 Else
1269 {
1270 Local6 = Arg2
1271 Local7 = Arg1
1272 }
1273
1274 M33F (Arg0, CM02, 0x00, Local6, Local7, CP02, HG02) /* Expected hang statuses (buffer/Integer) */
1275 If (Arg4)
1276 {
1277 M20B (0x00, "Release x-xxx3")
1278 }
1279
1280 /* x-01-12-23-4, Acquire=x-xxx4, hang=x-12xx, success=x-xxx4 */
1281
1282 Name (CM03, Package (MIN1)
1283 {
1284 0x00,
1285 0x00,
1286 0x00,
1287 0x00,
1288 C106
1289 })
1290 Name (CP03, Package (MIN1)
1291 {
1292 0x00,
1293 0x00,
1294 0x00,
1295 0x00,
1296 C106
1297 })
1298 Name (HG03, Package (MIN1)
1299 {
1300 0x00,
1301 C106,
1302 C106,
1303 0x00,
1304 0x00
1305 })
1306 If (Arg5)
1307 {
1308 Local6 = Arg1
1309 Local7 = Arg3
1310 }
1311 Else
1312 {
1313 Local6 = Arg3
1314 Local7 = Arg1
1315 }
1316
1317 M33F (Arg0, CM03, 0x00, Local6, Local7, CP03, HG03) /* Expected hang statuses (buffer/Integer) */
1318 If (Arg4)
1319 {
1320 M20B (0x00, "Acquire x-xxx4")
1321 }
1322
1323 /* x-01-12-2-4, Release=x-xx3x, hang=x-12xx, success=x-xx3x */
1324
1325 Name (CM05, Package (MIN1)
1326 {
1327 0x00,
1328 0x00,
1329 0x00,
1330 C107,
1331 0x00
1332 })
1333 Name (CP05, Package (MIN1)
1334 {
1335 0x00,
1336 0x00,
1337 0x00,
1338 C107,
1339 0x00
1340 })
1341 Name (HG05, Package (MIN1)
1342 {
1343 0x00,
1344 C106,
1345 C106,
1346 0x00,
1347 0x00
1348 })
1349 If (Arg5)
1350 {
1351 Local6 = Arg1
1352 Local7 = Arg3
1353 }
1354 Else
1355 {
1356 Local6 = Arg3
1357 Local7 = Arg1
1358 }
1359
1360 M33F (Arg0, CM05, 0x00, Local6, Local7, CP05, HG05) /* Expected hang statuses (buffer/Integer) */
1361 If (Arg4)
1362 {
1363 M20B (0x00, "Release x-xx3x")
1364 }
1365
1366 /* x-01-12-x-4, Release=x-xx2x, hang=x-1xxx, success=x-x22x */
1367
1368 Name (CM06, Package (MIN1)
1369 {
1370 0x00,
1371 0x00,
1372 0x00,
1373 C107,
1374 0x00
1375 })
1376 Name (CP06, Package (MIN1)
1377 {
1378 0x00,
1379 0x00,
1380 C106,
1381 C107,
1382 0x00
1383 })
1384 Name (HG06, Package (MIN1)
1385 {
1386 0x00,
1387 C106,
1388 0x00,
1389 0x00,
1390 0x00
1391 })
1392 If (Arg5)
1393 {
1394 Local6 = Arg1
1395 Local7 = Arg2
1396 }
1397 Else
1398 {
1399 Local6 = Arg2
1400 Local7 = Arg1
1401 }
1402
1403 M33F (Arg0, CM06, 0x00, Local6, Local7, CP06, HG06) /* Expected hang statuses (buffer/Integer) */
1404 If (Arg4)
1405 {
1406 M20B (0x00, "Release x-xx2x")
1407 }
1408
1409 /* x-01-12-3-4, Acquire=x-xx3x, hang=x-1xxx, success=x-xx3x */
1410
1411 Name (CM07, Package (MIN1)
1412 {
1413 0x00,
1414 0x00,
1415 0x00,
1416 C106,
1417 0x00
1418 })
1419 Name (CP07, Package (MIN1)
1420 {
1421 0x00,
1422 0x00,
1423 0x00,
1424 C106,
1425 0x00
1426 })
1427 Name (HG07, Package (MIN1)
1428 {
1429 0x00,
1430 C106,
1431 0x00,
1432 0x00,
1433 0x00
1434 })
1435 If (Arg5)
1436 {
1437 Local6 = Arg1
1438 Local7 = Arg3
1439 }
1440 Else
1441 {
1442 Local6 = Arg3
1443 Local7 = Arg1
1444 }
1445
1446 M33F (Arg0, CM07, 0x00, Local6, Local7, CP07, HG07) /* Expected hang statuses (buffer/Integer) */
1447 If (Arg4)
1448 {
1449 M20B (0x00, "Acquire x-xx3x")
1450 }
1451
1452 /* x-01-1-3-4, Release=x-x2xx, hang=x-1xxx, success=x-x2xx */
1453
1454 Name (CM08, Package (MIN1)
1455 {
1456 0x00,
1457 0x00,
1458 C107,
1459 0x00,
1460 0x00
1461 })
1462 Name (CP08, Package (MIN1)
1463 {
1464 0x00,
1465 0x00,
1466 C107,
1467 0x00,
1468 0x00
1469 })
1470 Name (HG08, Package (MIN1)
1471 {
1472 0x00,
1473 C106,
1474 0x00,
1475 0x00,
1476 0x00
1477 })
1478 If (Arg5)
1479 {
1480 Local6 = Arg1
1481 Local7 = Arg3
1482 }
1483 Else
1484 {
1485 Local6 = Arg3
1486 Local7 = Arg1
1487 }
1488
1489 M33F (Arg0, CM08, 0x00, Local6, Local7, CP08, HG08) /* Expected hang statuses (buffer/Integer) */
1490 If (Arg4)
1491 {
1492 M20B (0x00, "Release x-x2xx")
1493 }
1494
1495 /* x-01-x-3-4, Release=x-x1xx, hang=x-xxxx, success=x-11xx */
1496
1497 Name (CM09, Package (MIN1)
1498 {
1499 0x00,
1500 0x00,
1501 C107,
1502 0x00,
1503 0x00
1504 })
1505 Name (CP09, Package (MIN1)
1506 {
1507 0x00,
1508 C106,
1509 C107,
1510 0x00,
1511 0x00
1512 })
1513 If (Arg5)
1514 {
1515 Local6 = Arg1
1516 Local7 = Arg2
1517 }
1518 Else
1519 {
1520 Local6 = Arg2
1521 Local7 = Arg1
1522 }
1523
1524 M33F (Arg0, CM09, 0x00, Local6, Local7, CP09, 0x00) /* Expected hang statuses (buffer/Integer) */
1525 If (Arg4)
1526 {
1527 M20B (0x00, "Release x-x1xx")
1528 }
1529
1530 /* x-01-2-3-4, Acquire=x-x2xx, hang=x-xxxx, success=x-x2xx */
1531
1532 Name (CM0A, Package (MIN1)
1533 {
1534 0x00,
1535 0x00,
1536 C106,
1537 0x00,
1538 0x00
1539 })
1540 Name (CP0A, Package (MIN1)
1541 {
1542 0x00,
1543 0x00,
1544 C106,
1545 0x00,
1546 0x00
1547 })
1548 If (Arg5)
1549 {
1550 Local6 = Arg1
1551 Local7 = Arg3
1552 }
1553 Else
1554 {
1555 Local6 = Arg3
1556 Local7 = Arg1
1557 }
1558
1559 M33F (Arg0, CM0A, 0x00, Local6, Local7, CP0A, 0x00) /* Expected hang statuses (buffer/Integer) */
1560 If (Arg4)
1561 {
1562 M20B (0x00, "Acquire x-x2xx")
1563 }
1564
1565 /* x-0-2-3-4, Release=x-1xxx, hang=x-xxxx, success=x-1xxx */
1566
1567 Name (CM0B, Package (MIN1)
1568 {
1569 0x00,
1570 C107,
1571 0x00,
1572 0x00,
1573 0x00
1574 })
1575 Name (CP0B, Package (MIN1)
1576 {
1577 0x00,
1578 C107,
1579 0x00,
1580 0x00,
1581 0x00
1582 })
1583 If (Arg5)
1584 {
1585 Local6 = Arg1
1586 Local7 = Arg3
1587 }
1588 Else
1589 {
1590 Local6 = Arg3
1591 Local7 = Arg1
1592 }
1593
1594 M33F (Arg0, CM0B, 0x00, Local6, Local7, CP0B, 0x00) /* Expected hang statuses (buffer/Integer) */
1595 If (Arg4)
1596 {
1597 M20B (0x00, "Release x-1xxx")
1598 }
1599
1600 /* x-x-2-3-4, Release=x-0xxx, hang=x-xxxx, success=x-0xxx */
1601
1602 Name (CM0C, Package (MIN1)
1603 {
1604 0x00,
1605 C107,
1606 0x00,
1607 0x00,
1608 0x00
1609 })
1610 Name (CP0C, Package (MIN1)
1611 {
1612 0x00,
1613 C107,
1614 0x00,
1615 0x00,
1616 0x00
1617 })
1618 If (Arg5)
1619 {
1620 Local6 = Arg1
1621 Local7 = Arg2
1622 }
1623 Else
1624 {
1625 Local6 = Arg2
1626 Local7 = Arg1
1627 }
1628
1629 M33F (Arg0, CM0C, 0x00, Local6, Local7, CP0C, 0x00) /* Expected hang statuses (buffer/Integer) */
1630 If (Arg4)
1631 {
1632 M20B (0x00, "Release x-0xxx")
1633 }
1634
1635 /* x-1-2-3-4, Acquire=x-1xxx, hang=x-xxxx, success=x-1xxx */
1636
1637 Name (CM0D, Package (MIN1)
1638 {
1639 0x00,
1640 C106,
1641 0x00,
1642 0x00,
1643 0x00
1644 })
1645 Name (CP0D, Package (MIN1)
1646 {
1647 0x00,
1648 C106,
1649 0x00,
1650 0x00,
1651 0x00
1652 })
1653 If (Arg5)
1654 {
1655 Local6 = Arg1
1656 Local7 = Arg3
1657 }
1658 Else
1659 {
1660 Local6 = Arg3
1661 Local7 = Arg1
1662 }
1663
1664 M33F (Arg0, CM0D, 0x00, Local6, Local7, CP0D, 0x00) /* Expected hang statuses (buffer/Integer) */
1665 If (Arg4)
1666 {
1667 M20B (0x00, "Acquire x-1xxx")
1668 }
1669 /* At this point threads have Acquired: x-1234 */
1670 }
1671
1672 /*
1673 * arg0 - number of threads (total)
1674 */
1675 Method (M810, 1, NotSerialized)
1676 {
1677 M80C (Arg0, 0x00)
1678 }
1679
1680 /*
1681 * arg0 - number of threads (total)
1682 */
1683 Method (M811, 1, Serialized)
1684 {
1685 Name (RPT, 0x04)
1686 Name (LPN0, 0x00)
1687 Name (LPC0, 0x00)
1688 Name (LPN1, 0x00)
1689 Name (LPC1, 0x00)
1690 Name (NTH0, Buffer (0x02){})
1691 Name (IX00, Buffer ((MIN1 * 0x02))
1692 {
1693 /* 0000 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, // ........
1694 /* 0008 */ 0x03, 0x01 // ..
1695 })
1696 Name (NUMW, 0x00) /* number of threads in work */
1697 /* Number of threads to be actually in work */
1698
1699 NUMW = M213 (Arg0, MIN1, 0x04)
1700 /* Pack numbers of threads */
1701
1702 NTH0 = M20D (Arg0, NUMW)
1703 /* Each thread Acquires successfully its mutex N times */
1704
1705 LPN0 = MAX0 /* \MAX0 */
1706 LPC0 = 0x00
1707 While (LPN0)
1708 {
1709 LPN1 = RPT /* \M811.RPT_ */
1710 LPC1 = 0x00
1711 /* Repetition */
1712
1713 While (LPN1)
1714 {
1715 M33F (NTH0, C106, 0x00, LPC0, IX00, C106, 0x00) /* Expected hang statuses (buffer/Integer) */
1716 LPN1--
1717 LPC1++
1718 }
1719
1720 LPN0--
1721 LPC0++
1722 }
1723
1724 /* Each thread Releases successfully its mutex N times */
1725
1726 LPN0 = MAX0 /* \MAX0 */
1727 LPC0 = (MAX0 - 0x01)
1728 While (LPN0)
1729 {
1730 LPN1 = RPT /* \M811.RPT_ */
1731 LPC1 = 0x00
1732 /* Repetition */
1733
1734 While (LPN1)
1735 {
1736 M33F (NTH0, C107, 0x00, LPC0, IX00, C107, 0x00) /* Expected hang statuses (buffer/Integer) */
1737 LPN1--
1738 LPC1++
1739 }
1740
1741 LPN0--
1742 LPC0--
1743 }
1744
1745 /*
1746 * Each thread gets exception AE_AML_MUTEX_NOT_ACQUIRED (65)
1747 * on additional Release.
1748 */
1749 LPN0 = MAX0 /* \MAX0 */
1750 LPC0 = (MAX0 - 0x01)
1751 While (LPN0)
1752 {
1753 M33F (NTH0, C107, 0x41, LPC0, IX00, C107, 0x00) /* Expected hang statuses (buffer/Integer) */
1754 LPN0--
1755 LPC0--
1756 }
1757 }
1758
1759 /*
1760 * arg0 - number of threads (total)
1761 */
1762 Method (M812, 1, Serialized)
1763 {
1764 Name (RPT, 0x03) /* number of repetition */
1765 Name (LPN0, 0x00) /* level */
1766 Name (LPC0, 0x00)
1767 Name (LPN1, 0x00) /* index-thread */
1768 Name (LPC1, 0x00)
1769 Name (INDT, 0x00) /* index of thread */
1770 Name (LPN2, 0x00) /* repetition */
1771 Name (LPC2, 0x00)
1772 Name (LLS0, 0x00)
1773 Name (NUM2, 0x00)
1774 Name (IXSZ, 0x00)
1775 Name (NUMW, 0x00) /* number of threads in work */
1776 Store ((MIN1 * 0x02), IXSZ) /* \M812.IXSZ */
1777 Name (NTH0, Buffer (0x02){})
1778 /* Buffers of indexes of mutexes */
1779
1780 Name (PIXS, Package (MIN1)
1781 {
1782 0x00,
1783 Buffer (IXSZ)
1784 {
1785 /* 0000 */ 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, // ........
1786 /* 0008 */ 0x00, 0x01 // ..
1787 },
1788
1789 Buffer (IXSZ)
1790 {
1791 /* 0000 */ 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, // ........
1792 /* 0008 */ 0x01, 0x01 // ..
1793 },
1794
1795 Buffer (IXSZ)
1796 {
1797 /* 0000 */ 0x00, 0x00, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, // ........
1798 /* 0008 */ 0x02, 0x01 // ..
1799 },
1800
1801 Buffer (IXSZ)
1802 {
1803 /* 0000 */ 0x00, 0x00, 0x03, 0x01, 0x03, 0x01, 0x03, 0x01, // ........
1804 /* 0008 */ 0x03, 0x01 // ..
1805 }
1806 })
1807 Name (BIXS, Buffer (IXSZ){})
1808 Name (CM00, Buffer (MIN1){})
1809 Name (CP00, Buffer (MIN1){})
1810 Name (HG00, Buffer (MIN1){})
1811 /*
1812 * Determine num - number of threads actually in work
1813 *
1814 * Note: maximum for num is min1 here but it can be diminished
1815 * to reduce the time of execution.
1816 */
1817 NUMW = M213 (Arg0, MIN1, 0x03)
1818 NUM2 = (NUMW - 0x01) /* except the control thread */
1819 /* Pack numbers of threads */
1820
1821 NTH0 = M20D (Arg0, NUMW)
1822 /*
1823 * Determine lls0 - number of levels to be in work
1824 *
1825 * Note: maximum for lls0 is max0 here but it can be diminished
1826 * to reduce the time of execution.
1827 */
1828 If (REDM)
1829 {
1830 LLS0 = 0x03
1831 }
1832 Else
1833 {
1834 LLS0 = MAX0 /* \MAX0 */
1835 }
1836
1837 /* 9. Do 1-8 for all Levels of mutex one by one */
1838
1839 LPN0 = LLS0 /* \M812.LLS0 */
1840 LPC0 = 0x00
1841 While (LPN0)
1842 {
1843 /*
1844 * 8. Do 1-7 for all threads one by one (so, for 0-3 Indexes of mutex as well)
1845 */
1846 LPN1 = NUM2 /* \M812.NUM2 */
1847 LPC1 = 0x00
1848 While (LPN1)
1849 {
1850 INDT = (LPC1 + 0x01)
1851 BIXS = DerefOf (PIXS [INDT])
1852 /* 1. Thread thr-i Acquires successfully mutex M0 of (i-1)-th index for N times */
1853 /* c106 for indt-th thread */
1854 M210 (CM00, NUMW, C106, INDT, 0x01, 0x01, 0x00)
1855 /* Repetition */
1856
1857 LPN2 = RPT /* \M812.RPT_ */
1858 LPC2 = 0x00
1859 While (LPN2)
1860 {
1861 M33F (NTH0, CM00, 0x00, LPC0, BIXS, CM00, 0x00) /* Expected hang statuses (buffer/Integer) */
1862 LPN2--
1863 LPC2++
1864 }
1865
1866 /* 2. Other threads Acquire M0 too and hang */
1867 /*
1868 * c103 for all except indt-th thread
1869 * (and except 0-th thread naturally,
1870 * not mentioned more below)
1871 */
1872 M200 (CM00, NUMW, C103)
1873 M208 (CM00, INDT, 0x00)
1874 M33F (NTH0, CM00, 0x00, LPC0, BIXS, 0x00, CM00)
1875 /* 3. Thread thr-i Acquires successfully mutex M0 for N times again */
1876 /* c106 for indt-th thread */
1877 M210 (CM00, NUMW, C106, INDT, 0x01, 0x01, 0x00)
1878 /* c103 for all except indt-th thread */
1879
1880 M200 (HG00, NUMW, C103)
1881 M208 (HG00, INDT, 0x00)
1882 /* Repetition */
1883
1884 LPN2 = RPT /* \M812.RPT_ */
1885 LPC2 = 0x00
1886 While (LPN2)
1887 {
1888 M33F (NTH0, CM00, 0x00, LPC0, BIXS, CM00, HG00)
1889 LPN2--
1890 LPC2++
1891 }
1892
1893 /* 4. Thread thr-i Releases mutex M0 for 2*N times */
1894 /* c107 for indt-th thread */
1895 M210 (CM00, NUMW, C107, INDT, 0x01, 0x01, 0x00)
1896 /* c103 for all except indt-th thread */
1897
1898 M200 (HG00, NUMW, C103)
1899 M208 (HG00, INDT, 0x00)
1900 /* Repetition */
1901
1902 LPN2 = (RPT * 0x02)
1903 LPN2--
1904 LPC2 = 0x00
1905 While (LPN2)
1906 {
1907 M33F (NTH0, CM00, 0x00, LPC0, BIXS, CM00, HG00)
1908 LPN2--
1909 LPC2++
1910 }
1911
1912 /*
1913 * 5. One of other threads (thr-j) owns M0
1914 * 6. Thread thr-j Release M0
1915 * 7. Do 5-6 items for all 'other' threads
1916 */
1917 /* c107 for indt-th thread */
1918 M210 (CM00, NUMW, C107, INDT, 0x01, 0x01, 0x00)
1919 /* c103 for all except indt-th thread, and c107 for indt-th thread */
1920
1921 M200 (CP00, NUMW, C103)
1922 M208 (CP00, INDT, C107)
1923 M33F (NTH0, CM00, 0x00, LPC0, BIXS, CP00, 0x00)
1924 LPN1--
1925 LPC1++
1926 }
1927
1928 LPN0--
1929 LPC0++
1930 }
1931 }
1932
1933 /*
1934 * arg0 - number of threads (total)
1935 */
1936 Method (M813, 1, Serialized)
1937 {
1938 Name (RPT, 0x0100) /* number of repetition */
1939 Name (LPN0, 0x00) /* level */
1940 Name (LPC0, 0x00)
1941 Name (LPN1, 0x00) /* index-thread */
1942 Name (LPC1, 0x00)
1943 Name (INDT, 0x00) /* index of thread */
1944 Name (LPN2, 0x00) /* repetition */
1945 Name (LPC2, 0x00)
1946 Name (LLS0, 0x00) /* number of levels */
1947 Name (NUM2, 0x00)
1948 Name (IXSZ, 0x00)
1949 Name (NUMW, 0x00) /* number of threads in work */
1950 Store ((MIN1 * 0x02), IXSZ) /* \M813.IXSZ */
1951 Name (NTH0, Buffer (0x02){})
1952 /* Buffer of per-thread indexes of mutexes */
1953
1954 Name (IX00, Buffer (IXSZ)
1955 {
1956 /* 0000 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, // ........
1957 /* 0008 */ 0x03, 0x01 // ..
1958 })
1959 Name (CM00, Buffer (MIN1){})
1960 /*
1961 * Determine num - number of threads actually in work
1962 * See input control on arg0 (before m813)
1963 *
1964 * Note: maximum for num is min1 here but it can be diminished
1965 * to reduce the time of execution.
1966 */
1967 NUMW = M213 (Arg0, 0x03, 0x02)
1968 NUM2 = (NUMW - 0x01) /* except the control thread */
1969 /* Pack numbers of threads */
1970
1971 NTH0 = M20D (Arg0, NUMW)
1972 /*
1973 * Determine lls0 - number of levels to be in work
1974 *
1975 * Note: maximum for lls0 is max0 here but it can be diminished
1976 * to reduce the time of execution.
1977 */
1978 If (REDM)
1979 {
1980 LLS0 = 0x01
1981 }
1982 Else
1983 {
1984 LLS0 = MAX0 /* \MAX0 */
1985 }
1986
1987 /* For all Levels of mutex one by one */
1988
1989 LPN0 = LLS0 /* \M813.LLS0 */
1990 LPC0 = 0x00
1991 While (LPN0)
1992 {
1993 /* For different indexes-threads one by one */
1994
1995 LPN1 = NUM2 /* \M813.NUM2 */
1996 LPC1 = 0x00
1997 While (LPN1)
1998 {
1999 INDT = (LPC1 + 0x01)
2000 /* Thread thr-i Acquires successfully mutex M0 of (i-1)-th index for N times */
2001 /* c106 for indt-th thread */
2002 M210 (CM00, NUMW, C106, INDT, 0x01, 0x01, 0x00)
2003 /* Repetition */
2004
2005 LPN2 = RPT /* \M813.RPT_ */
2006 LPC2 = 0x00
2007 While (LPN2)
2008 {
2009 M33F (NTH0, CM00, 0x00, LPC0, IX00, CM00, 0x00) /* Expected hang statuses (buffer/Integer) */
2010 LPN2--
2011 LPC2++
2012 }
2013
2014 /* Thread thr-i Releases mutex M0 for N times */
2015 /* c107 for indt-th thread */
2016 M210 (CM00, NUMW, C107, INDT, 0x01, 0x01, 0x00)
2017 /* Repetition */
2018
2019 LPN2 = RPT /* \M813.RPT_ */
2020 LPC2 = 0x00
2021 While (LPN2)
2022 {
2023 M33F (NTH0, CM00, 0x00, LPC0, IX00, CM00, 0x00)
2024 LPN2--
2025 LPC2++
2026 }
2027
2028 LPN1--
2029 LPC1++
2030 }
2031
2032 LPN0--
2033 LPC0++
2034 }
2035 }
2036
2037 /*
2038 * arg0 - number of threads (total)
2039 */
2040 Method (M814, 1, Serialized)
2041 {
2042 Name (LPN0, 0x00) /* level */
2043 Name (LPC0, 0x00)
2044 Name (LPN1, 0x00) /* index */
2045 Name (LPC1, 0x00)
2046 Name (THR1, 0x00)
2047 Name (THR2, 0x00)
2048 THR1 = 0x01
2049 THR2 = M115 (Arg0) /* thread with the greatest index */
2050 If ((THR2 >= Arg0))
2051 {
2052 Debug = "No alive threads for Test!"
2053 Debug = "Test mf14 skipped!"
2054 SKIP ()
2055 Return (Zero)
2056 }
2057
2058 If ((THR2 <= THR1))
2059 {
2060 Debug = "Insufficient number of threads for Test!"
2061 Debug = "Test mf14 skipped!"
2062 SKIP ()
2063 Return (Zero)
2064 }
2065
2066 /* 1. Thread thr-N Acquires all the mutexes on all levels */
2067 /* Set up per-thread set of mutexes */
2068 M334 (Arg0, C300, 0x00, MAX0, 0x00, MIN0)
2069 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2070 M208 (BS00, THR2, C106) /* cmd: Acquire specified set of mutexes */
2071 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2072 M114 (Arg0) /* run */
2073 /* Wait for all Worker threads */
2074
2075 M103 (Arg0)
2076 /* Check up the values of counters of all Mutexes */
2077
2078 LPN0 = MAX0 /* \MAX0 */
2079 LPC0 = 0x00
2080 While (LPN0)
2081 {
2082 LPN1 = MIN0 /* \MIN0 */
2083 LPC1 = 0x00
2084 While (LPN1)
2085 {
2086 M333 (LPC0, LPC1, 0x01)
2087 LPN1--
2088 LPC1++
2089 }
2090
2091 LPN0--
2092 LPC0++
2093 }
2094
2095 /*
2096 * 2. Thread thr-1 tries to Acquire all the same mutexes
2097 * and gets FAIL (TimeOutValue is not 0xFFFF).
2098 */
2099 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2100 M208 (BS00, THR1, C106) /* cmd: Acquire specified set of mutexes */
2101 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2102 M214 (Arg0, Arg0, TOV1) /* TimeOutValue equal to 1 msec */
2103 M20F (Arg0, EX0D, 0x00) /* Init the exceptional conditions flags (FAIL) */
2104 M114 (Arg0) /* run */
2105 /* Wait for all Worker threads */
2106
2107 M103 (Arg0)
2108 /* 3. Thread thr-N terminates */
2109
2110 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2111 M208 (BS00, THR2, C108) /* cmd: Terminate thread */
2112 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2113 M114 (Arg0) /* run */
2114 /* Wait for all Worker threads */
2115
2116 M103 (Arg0)
2117 /*
2118 * 4. Thread thr-1 Acquire all those mutexes again
2119 * and gets success (TimeOutValue is 0xFFFF)
2120 */
2121 /* Sleep, to ensure the thread thr-N terminates */
2122 M206 (0x00, 0xC8)
2123 /*
2124 * Reset all counters (cnt0) and flags (fl00) corresponding
2125 * to all Mutexes which were set up by thread thr-N.
2126 */
2127 M330 ()
2128 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2129 M208 (BS00, THR1, C106) /* cmd: Acquire specified set of mutexes */
2130 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2131 M114 (Arg0) /* run */
2132 /* Wait for all Worker threads */
2133
2134 M103 (Arg0)
2135 /* 5. Thread thr-1 Releases all mutexes */
2136
2137 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2138 M208 (BS00, THR1, C107) /* cmd: Release specified set of mutexes */
2139 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2140 M114 (Arg0) /* run */
2141 /* Wait for all Worker threads */
2142
2143 M103 (Arg0)
2144 }
2145
2146 /*
2147 * arg0 - number of threads (total)
2148 */
2149 Method (M815, 1, Serialized)
2150 {
2151 Name (LPN0, 0x00) /* level */
2152 Name (LPC0, 0x00)
2153 Name (LPN1, 0x00) /* index */
2154 Name (LPC1, 0x00)
2155 Name (THR1, 0x00)
2156 Name (THR2, 0x00)
2157 THR1 = 0x01
2158 THR2 = M115 (Arg0) /* thread with the greatest index */
2159 If ((THR2 >= Arg0))
2160 {
2161 Debug = "No alive threads for Test!"
2162 Debug = "Test mf14 skipped!"
2163 SKIP ()
2164 Return (Zero)
2165 }
2166
2167 If ((THR2 <= THR1))
2168 {
2169 Debug = "Insufficient number of threads for Test!"
2170 Debug = "Test mf15 skipped!"
2171 SKIP ()
2172 Return (Zero)
2173 }
2174
2175 /* 1. Thread thr-N Acquires all the mutexes on all levels */
2176 /* Set up per-thread set of mutexes */
2177 M334 (Arg0, C300, 0x00, MAX0, 0x00, MIN0)
2178 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2179 M208 (BS00, THR2, C106) /* cmd: Acquire specified set of mutexes */
2180 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2181 M114 (Arg0) /* run */
2182 /* Wait for all Worker threads */
2183
2184 M103 (Arg0)
2185 /* Check up the values of counters of all Mutexes */
2186
2187 LPN0 = MAX0 /* \MAX0 */
2188 LPC0 = 0x00
2189 While (LPN0)
2190 {
2191 LPN1 = MIN0 /* \MIN0 */
2192 LPC1 = 0x00
2193 While (LPN1)
2194 {
2195 M333 (LPC0, LPC1, 0x01)
2196 LPN1--
2197 LPC1++
2198 }
2199
2200 LPN0--
2201 LPC0++
2202 }
2203
2204 /*
2205 * 2. Thread thr-1 tries to Acquire all the same mutexes
2206 * and gets FAIL (TimeOutValue is not 0xFFFF).
2207 */
2208 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2209 M208 (BS00, THR1, C106) /* cmd: Acquire specified set of mutexes */
2210 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2211 M214 (Arg0, Arg0, TOV1) /* TimeOutValue equal to 1 msec */
2212 M20F (Arg0, EX0D, 0x00) /* Init the exceptional conditions flags (FAIL) */
2213 M114 (Arg0) /* run */
2214 /* Wait for all Worker threads */
2215
2216 M103 (Arg0)
2217 /*
2218 * 3. Thread thr-1 tries to Acquire all the same mutexes
2219 * and hang (TimeOutValue is 0xFFFF).
2220 */
2221 /*
2222 * Reset all counters (cnt0) and flags (fl00) corresponding
2223 * to all Mutexes which were set up by thread thr-N.
2224 */
2225 M330 ()
2226 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2227 M208 (BS00, THR1, C106) /* cmd: Acquire specified set of mutexes */
2228 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2229 M114 (Arg0) /* run */
2230 /* Wait for all Worker threads */
2231
2232 Name (CP00, Buffer (Arg0){})
2233 Name (HG00, Buffer (Arg0){})
2234 Name (ID00, Buffer (Arg0){})
2235 CopyObject (BS00, CP00) /* \M815.CP00 */
2236 CP00 [THR1] = 0x00
2237 HG00 [THR1] = C106 /* \C106 */
2238 M110 (Arg0, CP00, HG00, ID00)
2239 /*
2240 * 4. Thread thr-N terminates
2241 * 5. Thread thr-1 owns all those mutexes
2242 */
2243 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2244 M208 (BS00, THR2, C108) /* cmd: Terminate thread */
2245 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2246 M114 (Arg0) /* run */
2247 /* Wait for all Worker threads */
2248
2249 Name (CP01, Buffer (Arg0){})
2250 Name (HG01, Buffer (Arg0){})
2251 Name (ID01, Buffer (Arg0){})
2252 BS00 [THR1] = C106 /* thr-1 hangs on c106 */ /* \C106 */
2253 CopyObject (BS00, CP01) /* \M815.CP01 */
2254 M110 (Arg0, CP01, HG01, ID01)
2255 /* 6. Thread thr-1 Releases all mutexes */
2256
2257 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2258 M208 (BS00, THR1, C107) /* cmd: Release specified set of mutexes */
2259 M215 (Arg0) /* Reset TimeOutValue and exceptional condition flags */
2260 M114 (Arg0) /* run */
2261 /* Wait for all Worker threads */
2262
2263 M103 (Arg0)
2264 }
2265
2266 /*
2267 * Serialized method to be executed by Worker thread
2268 *
2269 * arg0 - number of threads
2270 * arg1 - ID of current thread
2271 * arg2 - Index of current thread
2272 */
2273 Method (M8FC, 3, Serialized)
2274 {
2275 If (FLG2)
2276 {
2277 SE00 (Arg2, ER10, "Error er10")
2278 }
2279
2280 FLG2 = Arg1
2281 M201 (Arg2, VB03, "Execution of Serialized method started")
2282 M206 (Arg2, SL01) /* Sleep */
2283 /*
2284 * NOTE: it is a recurcive second call to m101:
2285 *
2286 * MAIN
2287 * mf00
2288 * mf16
2289 * m101
2290 * m8fc
2291 * m101
2292 *
2293 * So, additional command c101 is needed for it to exit that second call to m101.
2294 */
2295 M201 (Arg2, VB03, "Call recursively m101")
2296 M101 (Arg0, Arg1, Arg2, 0x01)
2297 M206 (Arg2, SL01) /* Sleep */
2298 M201 (Arg2, VB03, "Execution of Serialized method completed")
2299 If ((FLG2 != Arg1))
2300 {
2301 SE00 (Arg2, ER11, "Error er11")
2302 }
2303
2304 FLG2 = 0x00
2305 }
2306
2307 /*
2308 * Non-serialized method to be executed by Worker thread,
2309 * use mutex for exclusive access to critical section.
2310 *
2311 * arg0 - number of threads
2312 * arg1 - ID of current thread
2313 * arg2 - Index of current thread
2314 */
2315 Method (M8FA, 3, NotSerialized)
2316 {
2317 Local0 = MA00 (0x00, 0x00, 0xFFFF)
2318 If (Local0)
2319 {
2320 SE00 (Arg2, ER00, "Error er00")
2321 }
2322
2323 If (FLG2)
2324 {
2325 SE00 (Arg2, ER10, "Error er10")
2326 }
2327
2328 FLG2 = Arg1
2329 M201 (Arg2, VB03, "Execution of critical section started")
2330 M206 (Arg2, SL01) /* Sleep */
2331 /*
2332 * NOTE: it is a recurcive second call to m101:
2333 *
2334 * MAIN
2335 * mf00
2336 * mf16
2337 * m101
2338 * m8fc
2339 * m101
2340 *
2341 * So, additional command c101 is needed for it to exit that second call to m101.
2342 */
2343 M201 (Arg2, VB03, "Call recursively m101")
2344 M101 (Arg0, Arg1, Arg2, 0x01)
2345 M206 (Arg2, SL01) /* Sleep */
2346 M201 (Arg2, VB03, "Execution of critical section completed")
2347 If ((FLG2 != Arg1))
2348 {
2349 SE00 (Arg2, ER11, "Error er11")
2350 }
2351
2352 FLG2 = 0x00
2353 If (!Local0)
2354 {
2355 MA10 (0x00)
2356 }
2357 }
2358
2359 /*
2360 * Non-serialized method to be executed by Worker thread
2361 *
2362 * non-serialized method is grabbed simultaneously by several threads
2363 *
2364 * arg0 - number of threads
2365 * arg1 - ID of current thread
2366 * arg2 - Index of current thread
2367 */
2368 Method (M8F9, 3, NotSerialized)
2369 {
2370 /*
2371 * Index of one of two threads participating in test is 1
2372 */
2373 If ((Arg2 == 0x01))
2374 {
2375 If (FLG2)
2376 {
2377 SE00 (Arg2, ER12, "Error er12")
2378 }
2379 Else
2380 {
2381 FLG2 = Arg2
2382 }
2383 }
2384 ElseIf (FLG3)
2385 {
2386 SE00 (Arg2, ER12, "Error er12")
2387 }
2388 Else
2389 {
2390 FLG3 = Arg2
2391 }
2392
2393 M201 (Arg2, VB03, "Execution of non-serialized method started")
2394 M206 (Arg2, SL01) /* Sleep */
2395 /*
2396 * NOTE: it is a recurcive second call to m101:
2397 *
2398 * MAIN
2399 * mf00
2400 * mf16
2401 * m101
2402 * m8fc
2403 * m101
2404 *
2405 * So, additional command c101 is needed for it to exit that second call to m101.
2406 */
2407 M201 (Arg2, VB03, "Call recursively m101")
2408 M101 (Arg0, Arg1, Arg2, 0x01)
2409 M206 (Arg2, SL01) /* Sleep */
2410 M201 (Arg2, VB03, "Execution of non-serialized method completed")
2411 If (!FLG2)
2412 {
2413 SE00 (Arg2, ER12, "Error er12")
2414 }
2415
2416 If (!FLG3)
2417 {
2418 SE00 (Arg2, ER13, "Error er13")
2419 }
2420 }
2421
2422 /*
2423 * arg0 - number of threads (total)
2424 * arg1 - main command for worker thread
2425 */
2426 Method (M8FB, 2, Serialized)
2427 {
2428 Name (LPN0, 0x00) /* level */
2429 Name (LPC0, 0x00)
2430 Name (LPN1, 0x00) /* index */
2431 Name (LPC1, 0x00)
2432 Name (THR1, 0x00)
2433 Name (THR2, 0x00)
2434 THR1 = 0x01
2435 THR2 = M115 (Arg0) /* thread with the greatest index */
2436 If ((THR2 >= Arg0))
2437 {
2438 Debug = "No alive threads for Test!"
2439 Debug = "Test mf14 skipped!"
2440 SKIP ()
2441 Return (Zero)
2442 }
2443
2444 If ((THR2 <= THR1))
2445 {
2446 Debug = "Insufficient number of threads for Test!"
2447 Debug = "Test mf15 skipped!"
2448 SKIP ()
2449 Return (Zero)
2450 }
2451
2452 /*
2453 * 1. Thread thr-1 invokes method MXXX (by c109/c10a) which allows
2454 * exclusive access to the critical section.
2455 * Then it calls recursively m101 (infinite loop of worker threads)
2456 * so becomes identical to other threads for managing it.
2457 */
2458 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2459 M208 (BS00, THR1, Arg1) /* cmd: c109/c10a */
2460 M20F (Arg0, 0x00, 0x00) /* Init (Reset) the exceptional conditions flags (SUCCESS) */
2461 M114 (Arg0) /* run */
2462 /* Wait for all Worker threads */
2463
2464 M103 (Arg0)
2465 /*
2466 * 2. Thread thr-2 invokes the same method MXXX (by c109/c10a) and hangs
2467 * because method MXXX provides exclusive access and is already grabbed by thr-1.
2468 */
2469 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2470 M208 (BS00, THR2, Arg1) /* cmd: c109/c10a */
2471 M20F (Arg0, 0x00, 0x00) /* Init (Reset) the exceptional conditions flags (SUCCESS) */
2472 M114 (Arg0) /* run */
2473 /* Wait for all Worker threads */
2474
2475 Name (CP00, Buffer (Arg0){})
2476 Name (HG00, Buffer (Arg0){})
2477 Name (ID00, Buffer (Arg0){})
2478 CopyObject (BS00, CP00) /* \M8FB.CP00 */
2479 CP00 [THR2] = 0x00
2480 HG00 [THR2] = Arg1
2481 M110 (Arg0, CP00, HG00, ID00)
2482 /*
2483 * 3. Sleep for all
2484 */
2485 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2486 M114 (Arg0) /* run */
2487 /* Wait for all Worker threads */
2488
2489 Name (CP01, Buffer (Arg0){})
2490 Name (HG01, Buffer (Arg0){})
2491 Name (ID01, Buffer (Arg0){})
2492 CopyObject (BS00, CP01) /* \M8FB.CP01 */
2493 CP01 [THR2] = 0x00
2494 HG01 [THR2] = Arg1
2495 M110 (Arg0, CP01, HG01, ID01)
2496 /*
2497 * 4. Thread thr-1 is directed to exit recursive (second) call to m101
2498 * (infinite loop of worker threads).
2499 */
2500 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2501 M208 (BS00, THR1, C101) /* cmd: Exit the infinite loop */
2502 M114 (Arg0) /* run */
2503 /* Wait for all Worker threads */
2504
2505 Name (CP02, Buffer (Arg0){})
2506 Name (HG02, Buffer (Arg0){})
2507 Name (ID02, Buffer (Arg0){})
2508 CopyObject (BS00, CP02) /* \M8FB.CP02 */
2509 CP02 [THR2] = 0x00
2510 HG02 [THR2] = Arg1
2511 M110 (Arg0, CP02, HG02, ID02)
2512 /*
2513 * 5. Thread thr-2 is directed to exit recursive (second) call to m101
2514 * (infinite loop of worker threads).
2515 */
2516 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2517 M208 (BS00, THR2, C101) /* cmd: Exit the infinite loop */
2518 M114 (Arg0) /* run */
2519 /* Wait for all Worker threads */
2520
2521 M103 (Arg0)
2522 }
2523
2524 /*
2525 * Use Serialized method for exclusive access to critical section
2526 *
2527 * arg0 - number of threads (total)
2528 */
2529 Method (M816, 1, NotSerialized)
2530 {
2531 M8FB (Arg0, C109)
2532 }
2533
2534 /*
2535 * Use Mutex for exclusive access to critical section, invoke non-Serialized method
2536 *
2537 * arg0 - number of threads (total)
2538 */
2539 Method (M817, 1, NotSerialized)
2540 {
2541 M8FB (Arg0, C10A)
2542 }
2543
2544 /*
2545 * Non-serialized method is grabbed simultaneously
2546 *
2547 * arg0 - number of threads (total)
2548 */
2549 Method (M818, 1, Serialized)
2550 {
2551 Name (LPN0, 0x00) /* level */
2552 Name (LPC0, 0x00)
2553 Name (LPN1, 0x00) /* index */
2554 Name (LPC1, 0x00)
2555 Name (THR1, 0x00)
2556 Name (THR2, 0x00)
2557 FLG2 = 0x00
2558 FLG3 = 0x00
2559 THR1 = 0x01
2560 THR2 = M115 (Arg0) /* thread with the greatest index */
2561 If ((THR2 >= Arg0))
2562 {
2563 Debug = "No alive threads for Test!"
2564 Debug = "Test mf14 skipped!"
2565 SKIP ()
2566 Return (Zero)
2567 }
2568
2569 If ((THR2 <= THR1))
2570 {
2571 Debug = "Insufficient number of threads for Test!"
2572 Debug = "Test mf15 skipped!"
2573 SKIP ()
2574 Return (Zero)
2575 }
2576
2577 /*
2578 * 1. Thread thr-1 invokes non-Serialized method MXXX.
2579 * Then it calls recursively m101 (infinite loop of worker threads)
2580 * so becomes identical to other threads for managing it.
2581 */
2582 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2583 M208 (BS00, THR1, C10B) /* cmd: Invoke non-Serialized method */
2584 M20F (Arg0, 0x00, 0x00) /* Init (Reset) the exceptional conditions flags (SUCCESS) */
2585 M114 (Arg0) /* run */
2586 /* Wait for all Worker threads */
2587
2588 M103 (Arg0)
2589 /*
2590 * 2. Sleep for all
2591 */
2592 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2593 M20F (Arg0, 0x00, 0x00) /* Init (Reset) the exceptional conditions flags (SUCCESS) */
2594 M114 (Arg0) /* run */
2595 /* Wait for all Worker threads */
2596
2597 M103 (Arg0)
2598 /*
2599 * 3. Thread thr-N invokes non-Serialized method MXXX.
2600 * Then it calls recursively m101 (infinite loop of worker threads)
2601 * so becomes identical to other threads for managing it.
2602 */
2603 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2604 M208 (BS00, THR2, C10B) /* cmd: Invoke non-Serialized method */
2605 M20F (Arg0, 0x00, 0x00) /* Init (Reset) the exceptional conditions flags (SUCCESS) */
2606 M114 (Arg0) /* run */
2607 /* Wait for all Worker threads */
2608
2609 M103 (Arg0)
2610 /*
2611 * 4. Sleep for all
2612 */
2613 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2614 M20F (Arg0, 0x00, 0x00) /* Init (Reset) the exceptional conditions flags (SUCCESS) */
2615 M114 (Arg0) /* run */
2616 /* Wait for all Worker threads */
2617
2618 M103 (Arg0)
2619 /*
2620 * 5. Both threads thr-1 and thr-N are directed to exit recursive (second) calls to m101
2621 * (infinite loops of worker threads).
2622 */
2623 M200 (BS00, Arg0, C102) /* cmd: Sleep */
2624 M208 (BS00, THR1, C101) /* cmd: Exit the infinite loop */
2625 M208 (BS00, THR2, C101) /* cmd: Exit the infinite loop */
2626 M20F (Arg0, 0x00, 0x00) /* Init (Reset) the exceptional conditions flags (SUCCESS) */
2627 M114 (Arg0) /* run */
2628 /* Wait for all Worker threads */
2629
2630 M103 (Arg0)
2631 If ((FLG2 != THR1))
2632 {
2633 ERR (Arg0, Z152, __LINE__, 0x00, 0x00, FLG2, THR1)
2634 }
2635
2636 If ((FLG3 != THR2))
2637 {
2638 ERR (Arg0, Z152, __LINE__, 0x00, 0x00, FLG3, THR2)
2639 }
2640 }