Debian Codegraph @

tests/aslts/src/runtime/common/TCI/tcicmd.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 Command Interface with the ACPICA (_TCI)
30 *
31 * Note: _TCI and TCI mean the same in comments below.
32 * But, actually the name of the relevant predefined
33 * Method is _TCI.
34 */
35 Name (Z128, 0x80)
36 Name (DE00, 0x00) /* Disable reporting errors from m3a4, needed in m3aa (not enough params) */
37 Name (FOPT, 0x00) /* Flag of optimization */
38 /*
39 * Constants
40 */
41 /* Opcodes of the Test Commands provided by _TCI */
42 Name (C200, 0x00CD0000) /* _TCI-end statistics */
43 Name (C201, 0x00CD0001) /* _TCI-begin statistics */
44 Name (C202, 0x00CD0002) /* TCI_CMD_CHECK_SUPPORTED */
45 Name (C203, 0x00CD0003) /* TCI_CMD_GET_ID_OF_THREADS */
46 /* Tags of commands (to be filled into TCI Package by aslts) */
47
48 Name (C208, 0xEEEE0596) /* TCI_TAG_GET_MC_STAT_AFTER_TCI_TERM */
49 Name (C209, 0xBBBB063A) /* TCI_TAG_GET_MC_STAT_BEFORE_TCI_RUN */
50 Name (C20A, 0xCCCC07B9) /* TCI_TAG_CHECK_SUPPORTED */
51 Name (C20B, 0xDDDD01F5) /* TCI_TAG_GET_ID_OF_THREADS */
52 /*
53 * The layout of the Package for Memory Consumption Statistics
54 * applied for TCI commands:
55 * _TCI-end statistics (command TCI_CMD_GET_MC_STAT_AFTER_TCI_TERM)
56 * _TCI-begin statistics (command TCI_CMD_GET_MC_STAT_BEFORE_TCI_RUN)
57 */
58 Name (C210, 0x00) /* Title */
59 Name (C211, 0x04) /* acq0 */
60 Name (C212, 0x09) /* acq1 (-) */
61 Name (C213, 0x0E) /* acq2 (-) */
62 Name (C214, 0x13) /* acq3 */
63 Name (C215, 0x18) /* acq4 (-) */
64 Name (C216, 0x1D) /* acq5 */
65 Name (C217, 0x22) /* rel0 */
66 Name (C218, 0x27) /* rel1 */
67 Name (C219, 0x2C) /* rel2 (-) */
68 Name (C21A, 0x31) /* rel3 */
69 Name (C21B, 0x36) /* Created Objects */
70 Name (C21C, 0x54) /* Deleted Objects */
71 Name (C21D, 0x72) /* Miscellaneous Stat */
72 Name (C220, 0x79) /* the length of the Package for */
73 /* Memory Consumption Statistics. */
74 /* The layout of header of the common _TCI Package */
75 /* Input, data of header passed to ACPICA */
76 Name (C222, 0x00) /* Tag of command (to be set up by aslts) */
77 /* Output, data of header returned to aslts from ACPICA */
78
79 Name (C223, 0x01) /* Size (number of elements actually packed into TCI package, */
80 /* to be filled by ACPICA) */
81
82 Name (C224, 0x02) /* Cmd (command has been executed, to be filled by ACPICA) */
83 Name (C225, 0x03) /* CACHE_ENABLED (object cache is enabled info flag, */
84 /* to be filled by ACPICA) */
85
86 Name (C22B, 0x04) /* length of the common _TCI Package header */
87 /* The layout of header of TCI_CMD_GET_ID_OF_THREADS command */
88 /* (returned to aslts from ACPICA) */
89 Name (C22C, 0x04) /* TCI_PACKAGE_THR_NUM */
90 Name (C22D, 0x05) /* TCI_PACKAGE_THR_NUM_REAL */
91 Name (C22E, 0x06) /* TCI_PACKAGE_THR_ID */
92 Name (C22F, 0x07) /* length TCI_PACKAGE_THR_HEADER_SIZE */
93 Name (C221, 0x05) /* CACHE_LISTS_NUMBER (Object Caches): */
94 /* CLIST_ID_NAMESPACE 0 -- Acpi-Namespace */
95 /* CLIST_ID_STATE 1 -- Acpi-State */
96 /* CLIST_ID_OPERAND 2 -- Acpi-Operand */
97 /* CLIST_ID_PSNODE 3 -- Acpi-Parse */
98 /* CLIST_ID_PSNODE_EXT 4 -- Acpi-ParseExt */
99 Name (C226, 0x00) /* CLIST_ID_NAMESPACE */
100 Name (C227, 0x01) /* CLIST_ID_STATE */
101 Name (C228, 0x02) /* CLIST_ID_OPERAND */
102 Name (C229, 0x03) /* CLIST_ID_PSNODE */
103 Name (C22A, 0x04) /* CLIST_ID_PSNODE_EXT */
104 /*
105 * The main Test Command interface with the ACPICA
106 *
107 * arg0 - opcode of the Test Command
108 * arg1 - Package for different needs depending on the command.
109 * So, in case of the Memory Consumption Statistics commands it
110 * is filled by ACPICA with the Memory Consumption Statistics.
111 * The length of package in this case should be not less than c220,
112 * otherwise, no any failure arises but not all data are returned
113 * by Package just only the relevant part of it. It is true for all
114 * commands.
115 * Note: use m3a0 or m165 to prepare the arg1-package.
116 */
117 Method (_TCI, 2, NotSerialized)
118 {
119 /*
120 * Before to run this method reset location
121 * of Command which is to be filled by ACPICA
122 * to acknowledge the interconnection.
123 * It is performed in m3a0 and m3a4.
124 */
125 Return (Arg1)
126 }
127
128 /*
129 * Create and initialize the Package for _TCI
130 *
131 * arg0 - opcode of the Test Command.
132 * Use 0 for allocation without initialization.
133 * arg1 - number of element of Package (for some of commands)
134 *
135 * Return the resulting Package:
136 *
137 * - if arg0 is zero - the Package of c220 length
138 * - otherwise - the Package of length depending on
139 * the command is additionally initialized
140 */
141 Method (M165, 2, Serialized)
142 {
143 Name (NUM, 0x00)
144 Name (TAG, 0x00)
145 If (Arg0)
146 {
147 Switch (ToInteger (Arg0))
148 {
149 Case (0x00CD0000)
150 {
151 /* _TCI-end statistics */
152
153 TAG = C208 /* \C208 */
154 NUM = C220 /* \C220 */
155 }
156 Case (0x00CD0001)
157 {
158 /* _TCI-begin statistics */
159
160 TAG = C209 /* \C209 */
161 NUM = C220 /* \C220 */
162 }
163 Case (0x00CD0002)
164 {
165 /* TCI_CMD_CHECK_SUPPORTED */
166
167 TAG = C20A /* \C20A */
168 NUM = C22B /* \C22B */
169 }
170 Case (0x00CD0003)
171 {
172 /* TCI_CMD_GET_ID_OF_THREADS */
173
174 TAG = C20B /* \C20B */
175 NUM = Arg1
176 }
177 Default
178 {
179 ERR ("m165", Z128, __LINE__, 0x00, 0x00, Arg0, 0x00)
180 }
181
182 }
183
184 If ((NUM < C22B))
185 {
186 ERR ("m165", Z128, __LINE__, 0x00, 0x00, NUM, C22B)
187 }
188 Else
189 {
190 Name (P000, Package (NUM){})
191 Name (LPN0, 0x00)
192 Name (LPC0, 0x00)
193 LPN0 = NUM /* \M165.NUM_ */
194 LPC0 = 0x00
195 While (LPN0)
196 {
197 P000 [LPC0] = 0x00
198 LPN0--
199 LPC0++
200 }
201
202 P000 [0x00] = TAG /* \M165.TAG_ */
203 Return (P000) /* \M165.P000 */
204 }
205 }
206 Else
207 {
208 Name (P001, Package (C220){})
209 Return (P001) /* \M165.P001 */
210 }
211
212 Return (0x00)
213 }
214
215 /*
216 * Create and initialize the Package for simple cases
217 * entirely specified by the opcode of command.
218 *
219 * a. for Memory Consumption Statistics
220 * (_TCI-begin or _TCI-end statistics).
221 *
222 * b. TCI_CMD_CHECK_SUPPORTED
223 *
224 * arg0 - opcode of the Test Command.
225 * Use 0 for allocation without initialization.
226 *
227 * Returns the TCI Package
228 */
229 Method (M3A0, 1, NotSerialized)
230 {
231 Local0 = M165 (Arg0, 0x00)
232 Return (Local0)
233 }
234
235 Method (M3A1, 2, NotSerialized)
236 {
237 Local0 = DerefOf (NMTP [Arg1])
238 Concatenate ("", Arg0, Local2)
239 Concatenate (Local2, " ", Local1)
240 Concatenate (Local1, Local0, Debug)
241 }
242
243 /*
244 * Print out the Memory Consumption Statistics Package
245 *
246 * arg0 - Memory Consumption Statistics Package
247 * arg1 - opcode of the title message
248 */
249 Method (M3A2, 2, Serialized)
250 {
251 If ((Arg1 == 0x00))
252 {
253 Debug = "==== _TCI-end statistics"
254 }
255 ElseIf ((Arg1 == 0x01))
256 {
257 Debug = "==== _TCI-begin statistics"
258 }
259 ElseIf ((Arg1 == 0x02))
260 {
261 Debug = "==== _TCI-end-begin difference"
262 }
263 Else
264 {
265 Debug = "???"
266 }
267
268 Name (LPN0, 0x00)
269 Name (LPC0, 0x00)
270 LPN0 = C220 /* \C220 */
271 LPC0 = 0x00
272 Local1 = 0x00
273 Local2 = 0x00
274 While (LPN0)
275 {
276 If ((LPC0 == C210))
277 {
278 Debug = "Title:"
279 }
280 ElseIf ((LPC0 == C211))
281 {
282 Debug = "acq0: all calls to AcpiUtAcquireFromCache"
283 }
284 ElseIf ((LPC0 == C212))
285 {
286 Debug = "acq1: +AcpiUtAcquireMutex"
287 }
288 ElseIf ((LPC0 == C213))
289 {
290 Debug = "acq2: +there is a cache object available"
291 }
292 ElseIf ((LPC0 == C214))
293 {
294 Debug = "acq3: +AcpiUtReleaseMutex"
295 }
296 ElseIf ((LPC0 == C215))
297 {
298 Debug = "acq4: +otherwise, the cache is empty, create a new object"
299 }
300 ElseIf ((LPC0 == C216))
301 {
302 Debug = "acq5: +AcpiUtReleaseMutex"
303 }
304 ElseIf ((LPC0 == C217))
305 {
306 Debug = "rel0: all calls to AcpiUtReleaseToCache"
307 }
308 ElseIf ((LPC0 == C218))
309 {
310 Debug = "rel1: +walk cache is full, just free this object"
311 }
312 ElseIf ((LPC0 == C219))
313 {
314 Debug = "rel2: +otherwise, put this object back into the cache"
315 }
316 ElseIf ((LPC0 == C21A))
317 {
318 Debug = "rel3: +AcpiUtAcquireMutex"
319 }
320 ElseIf ((LPC0 == C21B))
321 {
322 Debug = "Created Objects:"
323 }
324 ElseIf ((LPC0 == C21C))
325 {
326 Debug = "Deleted Objects:"
327 }
328 ElseIf ((LPC0 == C21D))
329 {
330 Debug = "Miscellaneous Stat:"
331 }
332
333 If ((LPC0 >= C21D))
334 {
335 Debug = DerefOf (Arg0 [LPC0])
336 }
337 ElseIf ((LPC0 >= C21C))
338 {
339 Local0 = DerefOf (Arg0 [LPC0])
340 M3A1 (Local0, Local1)
341 Local1++
342 }
343 ElseIf ((LPC0 >= C21B))
344 {
345 Local0 = DerefOf (Arg0 [LPC0])
346 M3A1 (Local0, Local2)
347 Local2++
348 }
349 Else
350 {
351 Debug = DerefOf (Arg0 [LPC0])
352 }
353
354 LPN0--
355 LPC0++
356 }
357 }
358
359 /*
360 * Calculate the difference between the two
361 * Memory Consumption Statistics Packages.
362 *
363 * arg0 - Package of _TCI-end statistics
364 * arg1 - Package of _TCI-begin statistics
365 * arg2 - Package for _TCI-end-begin difference
366 */
367 Method (M3A3, 3, Serialized)
368 {
369 Name (LPN0, 0x00)
370 Name (LPC0, 0x00)
371 LPN0 = C220 /* \C220 */
372 LPC0 = 0x00
373 While (LPN0)
374 {
375 Local0 = DerefOf (Arg0 [LPC0])
376 Local1 = DerefOf (Arg1 [LPC0])
377 Local2 = (Local1 - Local0)
378 Arg2 [LPC0] = Local2
379 LPN0--
380 LPC0++
381 }
382 }
383
384 /*
385 * Verify difference of Memory Consumption Statistics between
386 * two points: _TCI-end statistics and _TCI-begin statistics
387 * (and reset locations of Command of arg0 and arg1 Packages
388 * for the following run).
389 *
390 * Check that the Memory Consumption Statistics measured at the first point
391 * as '_TCI-end statistics' was then changed as expected to the second point
392 * where statistics was measured as '_TCI-begin statistics'. Between these
393 * two points we initiate some AML activity which involves the memory
394 * consumption acquire/release to be then analyzed and verified.
395 *
396 *
397 * arg0 - Package of _TCI-end statistics
398 * arg1 - Package of _TCI-begin statistics
399 * arg2 - Package for _TCI-end-begin difference
400 * arg3 - Package with the benchmark information on Created Objects
401 * arg4 - Package with the benchmark information on Deleted Objects
402 * (if non-Package, then arg3 is used)
403 * arg5 - Package with the benchmark information on memory acq0 and rel0
404 * (if non-Package, then compare acq0 and rel0 of arg2,
405 * otherwise, arg5 is a Package with the expected per-memory
406 * type differences, expected: acq0[i] - rel0[i] = arg5[i])
407 * arg6 - index of checking (inside the file)
408 *
409 * Return:
410 * 0 - success
411 * 1 - incorrect Memory Consumption Statistics encountered
412 * otherwise - failed to determine the Memory Consumption Statistics
413 *
414 * See: the time of execution can be reduced (design and use additional flags):
415 * - exclude initialization before each operation
416 * (ACPICA writes all elements, benchmarks for the
417 * following sub-test mostly differ previous ones)
418 * - restrict checkings (use flag) by the acq0 & rel0,
419 * and add & del.
420 */
421 Method (M3A4, 7, Serialized)
422 {
423 /* Flag of printing */
424
425 Name (PR1, 0x00)
426 Name (PR2, 0x00)
427 Name (LPN0, 0x00)
428 Name (LPC0, 0x00)
429 If (PR1)
430 {
431 M3A2 (Arg0, 0x00)
432 M3A2 (Arg1, 0x01)
433 }
434
435 If (PR2)
436 {
437 M3A2 (Arg2, 0x02)
438 }
439
440 Local7 = 0x00
441 /* Check headers of Packages */
442
443 If (M3A6 (Arg0, 0x00, Arg6))
444 {
445 Local7 = 0x02
446 }
447
448 If (M3A6 (Arg1, 0x01, Arg6))
449 {
450 Local7 = 0x02
451 }
452
453 /* Check statistics specified by index */
454
455 If (M3A7 (Arg0, 0x00, Arg6))
456 {
457 Local7 = 0x02
458 }
459
460 If (M3A7 (Arg1, 0x00, Arg6))
461 {
462 Local7 = 0x02
463 }
464
465 If (M3A7 (Arg2, 0x01, Arg6))
466 {
467 Local7 = 0x02
468 }
469
470 /*
471 * acq0 and rel0 of arg2-difference
472 * are to be equal each to another
473 * (or correspond to arg5):
474 */
475 If ((ObjectType (Arg5) == C00C))
476 {
477 Local0 = C211 /* \C211 */
478 Local1 = C217 /* \C217 */
479 Local4 = 0x00
480 LPN0 = C221 /* \C221 */
481 LPC0 = 0x00
482 While (LPN0)
483 {
484 Local2 = DerefOf (Arg2 [Local0])
485 Local3 = DerefOf (Arg2 [Local1])
486 Local5 = DerefOf (Arg5 [Local4])
487 Local6 = (Local2 - Local3)
488 If ((Local6 != Local5))
489 {
490 If (!DE00)
491 {
492 ERR ("m3a4", Z128, __LINE__, 0x00, Arg6, Local6, Local5)
493 Debug = LPC0 /* \M3A4.LPC0 */
494 Debug = Local0
495 Debug = Local1
496 Debug = Local4
497 Debug = Local2
498 Debug = Local3
499 Debug = Local5
500 Debug = Local6
501 }
502
503 Local7 = 0x01
504 }
505
506 Local0++
507 Local1++
508 Local4++
509 LPN0--
510 LPC0++
511 }
512 }
513 Else
514 {
515 Local0 = C211 /* \C211 */
516 Local1 = C217 /* \C217 */
517 LPN0 = C221 /* \C221 */
518 LPC0 = 0x00
519 While (LPN0)
520 {
521 Local2 = DerefOf (Arg2 [Local0])
522 Local3 = DerefOf (Arg2 [Local1])
523 If ((Local2 != Local3))
524 {
525 If (!DE00)
526 {
527 ERR ("m3a4", Z128, __LINE__, 0x00, Arg6, Local2, Local3)
528 }
529
530 Local7 = 0x01
531 }
532
533 Local0++
534 Local1++
535 LPN0--
536 LPC0++
537 }
538 }
539
540 /* arg2-difference: acq0 == acq3 + acq5 */
541
542 Local0 = C211 /* \C211 */
543 Local1 = C214 /* \C214 */
544 Local2 = C216 /* \C216 */
545 LPN0 = C221 /* \C221 */
546 LPC0 = 0x00
547 While (LPN0)
548 {
549 Local3 = DerefOf (Arg2 [Local0])
550 Local4 = DerefOf (Arg2 [Local1])
551 Local5 = DerefOf (Arg2 [Local2])
552 Local6 = (Local4 + Local5)
553 If ((Local3 != Local6))
554 {
555 If (!DE00)
556 {
557 ERR ("m3a4", Z128, __LINE__, 0x00, Arg6, Local3, Local6)
558 }
559
560 Local7 = 0x01
561 }
562
563 Local0++
564 Local1++
565 Local2++
566 LPN0--
567 LPC0++
568 }
569
570 /* arg2-difference: rel0 == rel1 + rel3 */
571
572 Local0 = C217 /* \C217 */
573 Local1 = C218 /* \C218 */
574 Local2 = C21A /* \C21A */
575 LPN0 = C221 /* \C221 */
576 LPC0 = 0x00
577 While (LPN0)
578 {
579 Local3 = DerefOf (Arg2 [Local0])
580 Local4 = DerefOf (Arg2 [Local1])
581 Local5 = DerefOf (Arg2 [Local2])
582 Local6 = (Local4 + Local5)
583 If ((Local3 != Local6))
584 {
585 If (!DE00)
586 {
587 ERR ("m3a4", Z128, __LINE__, 0x00, Arg6, Local3, Local6)
588 }
589
590 Local7 = 0x01
591 }
592
593 Local0++
594 Local1++
595 Local2++
596 LPN0--
597 LPC0++
598 }
599
600 /* Check, created Objects are identical to the benchmark ones */
601
602 If ((ObjectType (Arg3) == C00C))
603 {
604 LPN0 = C027 /* \C027 */
605 Local0 = C21B /* \C21B */
606 Local1 = 0x00
607 While (LPN0)
608 {
609 Local2 = DerefOf (Arg2 [Local0])
610 Local3 = DerefOf (Arg3 [Local1])
611 If ((Local2 != Local3))
612 {
613 If (!DE00)
614 {
615 ERR ("m3a4", Z128, __LINE__, 0x00, Arg6, Local2, Local3)
616 }
617
618 Local7 = 0x01
619 }
620
621 Local0++
622 Local1++
623 LPN0--
624 }
625 }
626
627 /* Check, deleted Objects are identical to the benchmark ones */
628
629 LPN0 = C027 /* \C027 */
630 Local0 = C21C /* \C21C */
631 Local1 = 0x00
632 Local4 = 0x00
633 If ((ObjectType (Arg4) == C00C))
634 {
635 Local4 = Arg4
636 }
637 ElseIf ((ObjectType (Arg3) == C00C))
638 {
639 Local4 = Arg3
640 }
641
642 If ((ObjectType (Local4) == C00C))
643 {
644 While (LPN0)
645 {
646 Local2 = DerefOf (Arg2 [Local0])
647 Local3 = DerefOf (Local4 [Local1])
648 If ((Local2 != Local3))
649 {
650 If (!DE00)
651 {
652 ERR ("m3a4", Z128, __LINE__, 0x00, Arg6, Local2, Local3)
653 }
654
655 Local7 = 0x01
656 }
657
658 Local0++
659 Local1++
660 LPN0--
661 }
662 }
663
664 /*
665 * Reset locations of Command of arg0 and arg1
666 * Packages for the following run.
667 * Store(0, Index(arg0, c224))
668 * Store(0, Index(arg1, c224))
669 */
670 Return (Local7)
671 }
672
673 /*
674 * Return non-zero in case the Test Command interface
675 * with the ACPICA (_TCI) is supported.
676 */
677 Method (M3A5, 0, NotSerialized)
678 {
679 Local0 = M3A0 (C202) /* TCI_CMD_CHECK_SUPPORTED */
680 _TCI (C202, Local0)
681 Local1 = DerefOf (Local0 [C224])
682 If ((Local1 != C202))
683 {
684 Return (0x00)
685 }
686
687 Return (0x01)
688 }
689
690 /*
691 * Check header of Memory Consumption Statistics Package
692 * arg0 - Memory Consumption Statistics Package
693 * arg1 - Means:
694 * 0 - _TCI-end statistics
695 * otherwise - _TCI-begin statistics
696 * arg2 - index of checking (inside the file)
697 */
698 Method (M3A6, 3, NotSerialized)
699 {
700 Local7 = 0x00
701 /* Tag of command */
702
703 If (Arg1)
704 {
705 Local0 = C209 /* \C209 */
706 }
707 Else
708 {
709 Local0 = C208 /* \C208 */
710 }
711
712 Local1 = DerefOf (Arg0 [0x00])
713 If ((Local1 != Local0))
714 {
715 ERR ("m3a6", Z128, __LINE__, 0x00, Arg2, Local1, Local0)
716 Local7 = 0x01
717 }
718
719 /* Number of elements actually packed */
720
721 Local1 = DerefOf (Arg0 [0x01])
722 If ((Local1 != C220))
723 {
724 ERR ("m3a6", Z128, __LINE__, 0x00, Arg2, Local1, C220)
725 Local7 = 0x01
726 }
727
728 /* Command has been executed */
729
730 If (Arg1)
731 {
732 Local0 = C201 /* \C201 */
733 }
734 Else
735 {
736 Local0 = C200 /* \C200 */
737 }
738
739 Local1 = DerefOf (Arg0 [0x02])
740 If ((Local1 != Local0))
741 {
742 ERR ("m3a6", Z128, __LINE__, 0x00, Arg2, Local1, Local0)
743 Local7 = 0x01
744 }
745
746 /* Object cache is enabled */
747
748 Local1 = DerefOf (Arg0 [0x03])
749 If (!Local1)
750 {
751 ERR ("m3a6", Z128, __LINE__, 0x00, Arg2, Local1, 0x01)
752 Local7 = 0x01
753 }
754
755 Return (Local7)
756 }
757
758 /*
759 * Check statistics specified by index
760 *
761 * arg0 - Memory Consumption Statistics Package
762 * arg1 - Means:
763 * non-zero - _TCI-end-begin difference Package
764 * otherwise - usual Memory Consumption Statistics Package
765 * arg2 - index of checking (inside the file)
766 */
767 Method (M3A7, 3, NotSerialized)
768 {
769 Local7 = 0x00
770 If (Arg1){ /*
771 // ACPI_STAT_SUCCESS_FREE == ACPI_STAT_SUCCESS_ALLOC
772 Add(c21d, 5, Local0)
773 Store(DerefOf(Index(arg0, Local0)), Local1)
774 Increment(Local0)
775 Store(DerefOf(Index(arg0, Local0)), Local2)
776 if (LNotEqual(Local2, Local1)) {
777 err("m3a7", z128, __LINE__, 0, arg2, Local2, Local1)
778 Store(1, Local7)
779 }
780 */
781 }
782 Else
783 {
784 /* ACPI_STAT_INVALID_EXBUF */
785
786 Local0 = C21D /* \C21D */
787 Local1 = DerefOf (Arg0 [Local0])
788 If (Local1)
789 {
790 ERR ("m3a7", Z128, __LINE__, 0x00, Arg2, Local1, 0x00)
791 Local7 = 0x01
792 }
793
794 /* ACPI_STAT_ZONE0_CORRUPTED */
795
796 Local0++
797 Local1 = DerefOf (Arg0 [Local0])
798 If (Local1)
799 {
800 ERR ("m3a7", Z128, __LINE__, 0x00, Arg2, Local1, 0x00)
801 Local7 = 0x01
802 }
803
804 /* ACPI_STAT_ZONE1_CORRUPTED */
805
806 Local0++
807 Local1 = DerefOf (Arg0 [Local0])
808 If (Local1)
809 {
810 ERR ("m3a7", Z128, __LINE__, 0x00, Arg2, Local1, 0x00)
811 Local7 = 0x01
812 }
813
814 /* ACPI_STAT_FAILED_ALLOC */
815
816 Local0++
817 Local1 = DerefOf (Arg0 [Local0])
818 If (Local1)
819 {
820 ERR ("m3a7", Z128, __LINE__, 0x00, Arg2, Local1, 0x00)
821 Local7 = 0x01
822 }
823
824 /* ACPI_STAT_NULL_FREE */
825
826 Local0++
827 Local1 = DerefOf (Arg0 [Local0])
828 If (Local1)
829 {
830 ERR ("m3a7", Z128, __LINE__, 0x00, Arg2, Local1, 0x00)
831 Local7 = 0x01
832 }
833 }
834
835 Return (Local7)
836 }
837
838 /*
839 * Create and initialize the sample Package for the
840 * per-object type benchmark Memory Consumption Statistics
841 */
842 Method (M3A8, 0, Serialized)
843 {
844 Name (P000, Package (0x20)
845 {
846 0x00,
847 0x00,
848 0x00,
849 0x00,
850 0x00,
851 0x00,
852 0x00,
853 0x00,
854 0x00,
855 0x00,
856 0x00,
857 0x00,
858 0x00,
859 0x00,
860 0x00,
861 0x00,
862 0x00,
863 0x00,
864 0x00,
865 0x00,
866 0x00,
867 0x00,
868 0x00,
869 0x00,
870 0x00,
871 0x00,
872 0x00,
873 0x00,
874 0x00,
875 0x00,
876 0x00,
877 0x00
878 })
879 Return (P000) /* \M3A8.P000 */
880 }
881
882 /*
883 * Create and initialize the sample Package for the
884 * per-memory type benchmark Memory Consumption Statistics
885 */
886 Method (M3A9, 0, Serialized)
887 {
888 Name (P000, Package (0x07)
889 {
890 0x00,
891 0x00,
892 0x00,
893 0x00,
894 0x00,
895 0x00,
896 0x00
897 })
898 Return (P000) /* \M3A9.P000 */
899 }
900
901 /*
902 * Determine the flag of optimization: check that
903 * processing of the Add operation corresponds to
904 * the expectation: optimized/non-optimized.
905 *
906 * Mode of run, optimized/non-optimized, is essential
907 * for this kind tests (memory consumption).
908 *
909 * arg0 - Means:
910 * 0 - check for Optimization is tuned off
911 * otherwise - check for Optimization is tuned on
912 */
913 Method (M3AA, 0, Serialized)
914 {
915 Name (I000, 0x00)
916 Name (P000, Package (0x01){})
917 Name (P00B, Package (0x01){})
918 FOPT = 0xFF
919 Local0 = M3A0 (C200) /* _TCI-end statistics */
920 P00B = M3A0 (C201) /* _TCI-begin statistics */
921 Local1 = M3A0 (0x00) /* difference */
922 _TCI (C200, Local0)
923 Store ((0x03 + 0x04), I000) /* \M3AA.I000 */
924 _TCI (C201, P00B)
925 M3A3 (Local0, P00B, Local1)
926 /* Statistics expected in case Optimization is tuned off */
927
928 P000 = M3A8 ()
929 P000 [C009] = 0x04 /* Integer */
930 DE00 = 0x01
931 Local6 = M3A4 (Local0, P00B, Local1, P000, 0x00, 0x00, 0x00)
932 DE00 = 0x00
933 If ((Local6 == 0x02))
934 {
935 Debug = "Failed to determine the flag of optimization"
936 Return (Zero)
937 }
938 Else
939 {
940 /* Statistics expected in case Optimization is tuned on */
941
942 P000 = M3A8 ()
943 P000 [C009] = 0x01 /* Integer */
944 DE00 = 0x01
945 Local7 = M3A4 (Local0, P00B, Local1, P000, 0x00, 0x00, 0x01)
946 DE00 = 0x00
947 If ((Local7 == 0x02))
948 {
949 Debug = "Failed to determine the flag of optimization"
950 Return (Zero)
951 }
952 }
953
954 If ((Local6 == Local7))
955 {
956 Debug = "Internal error 0"
957 ERR ("m3aa", Z128, __LINE__, 0x00, 0x00, Local6, Local7)
958 }
959 ElseIf (Local6)
960 {
961 FOPT = 0x01
962 }
963 Else
964 {
965 FOPT = 0x00
966 }
967 }
968
969 /*
970 * Return Package with the array of thread indexes
971 * otherwise Integer 0.
972 *
973 * arg0 - number of threads
974 */
975 Method (M163, 1, Serialized)
976 {
977 Name (SIZE, 0x00)
978 SIZE = (C22F + Arg0)
979 Local0 = M165 (C203, SIZE) /* TCI_CMD_GET_ID_OF_THREADS */
980 _TCI (C203, Local0)
981 Local1 = DerefOf (Local0 [C224])
982 If ((Local1 != C203))
983 {
984 Return (0x00)
985 }
986
987 Return (Local0)
988 }