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 * Exceptional conditions support 30 */ 31 Name (Z063, 0x3F) 32 /* The current number of exceptions handled */ 33 34 Name (EXC0, 0x00) 35 /* The total number of exceptions handled */ 36 37 Name (EXC1, 0x00) 38 /* Opcode of the last exception */ 39 40 Name (EX00, 0x00) 41 /* Name of the last exception */ 42 43 Name (EX01, "") 44 /* Opcode of the first exception */ 45 46 Name (EX04, 0x00) 47 /* Name of the first exception */ 48 49 Name (EX05, "") 50 /* 51 * Undefined opcodes of exception 52 */ 53 Name (EX0D, 0xFD) 54 Name (EX0E, 0xFE) 55 /* Undefined opcode of exception means 'any exceptions' */ 56 57 Name (EX0F, 0xFF) 58 /* Description of all exceptional conditions */ 59 60 Name (PF00, Package (0x57) 61 { 62 /* ix opcodes names */ 63 64 Package (0x03) 65 { 66 0x00, 67 0x00, 68 "AE_OK" 69 }, 70 71 Package (0x03) 72 { 73 0x01, 74 0x01, 75 "AE_ERROR" 76 }, 77 78 Package (0x03) 79 { 80 0x02, 81 0x02, 82 "AE_NO_ACPI_TABLES" 83 }, 84 85 Package (0x03) 86 { 87 0x03, 88 0x03, 89 "AE_NO_NAMESPACE" 90 }, 91 92 Package (0x03) 93 { 94 0x04, 95 0x04, 96 "AE_NO_MEMORY" 97 }, 98 99 Package (0x03) 100 { 101 0x05, 102 0x05, 103 "AE_NOT_FOUND" 104 }, 105 106 Package (0x03) 107 { 108 0x06, 109 0x06, 110 "AE_NOT_EXIST" 111 }, 112 113 Package (0x03) 114 { 115 0x07, 116 0x07, 117 "AE_ALREADY_EXISTS" 118 }, 119 120 Package (0x03) 121 { 122 0x08, 123 0x08, 124 "AE_TYPE" 125 }, 126 127 Package (0x03) 128 { 129 0x09, 130 0x09, 131 "AE_NULL_OBJECT" 132 }, 133 134 Package (0x03) 135 { 136 0x0A, 137 0x0A, 138 "AE_NULL_ENTRY" 139 }, 140 141 Package (0x03) 142 { 143 0x0B, 144 0x0B, 145 "AE_BUFFER_OVERFLOW" 146 }, 147 148 Package (0x03) 149 { 150 0x0C, 151 0x0C, 152 "AE_STACK_OVERFLOW" 153 }, 154 155 Package (0x03) 156 { 157 0x0D, 158 0x0D, 159 "AE_STACK_UNDERFLOW" 160 }, 161 162 Package (0x03) 163 { 164 0x0E, 165 0x0E, 166 "AE_NOT_IMPLEMENTED" 167 }, 168 169 Package (0x03) 170 { 171 0x0F, 172 0x0F, 173 "AE_VERSION_MISMATCH" 174 }, 175 176 /* obsolete */ 177 178 Package (0x03) 179 { 180 0x10, 181 0x0F, 182 "AE_SUPPORT" 183 }, 184 185 Package (0x03) 186 { 187 0x11, 188 0x11, 189 "AE_SHARE" 190 }, 191 192 /* obsolete */ 193 194 Package (0x03) 195 { 196 0x12, 197 0x10, 198 "AE_LIMIT" 199 }, 200 201 Package (0x03) 202 { 203 0x13, 204 0x11, 205 "AE_TIME" 206 }, 207 208 Package (0x03) 209 { 210 0x14, 211 0x14, 212 "AE_UNKNOWN_STATUS" 213 }, 214 215 /* obsolete */ 216 217 Package (0x03) 218 { 219 0x15, 220 0x12, 221 "AE_ACQUIRE_DEADLOCK" 222 }, 223 224 Package (0x03) 225 { 226 0x16, 227 0x13, 228 "AE_RELEASE_DEADLOCK" 229 }, 230 231 Package (0x03) 232 { 233 0x17, 234 0x14, 235 "AE_NOT_ACQUIRED" 236 }, 237 238 Package (0x03) 239 { 240 0x18, 241 0x15, 242 "AE_ALREADY_ACQUIRED" 243 }, 244 245 Package (0x03) 246 { 247 0x19, 248 0x16, 249 "AE_NO_HARDWARE_RESPONSE" 250 }, 251 252 Package (0x03) 253 { 254 0x1A, 255 0x17, 256 "AE_NO_GLOBAL_LOCK" 257 }, 258 259 Package (0x03) 260 { 261 0x1B, 262 0x18, 263 "AE_ABORT_METHOD" 264 }, 265 266 Package (0x03) 267 { 268 0x1C, 269 0x1001, 270 "AE_BAD_PARAMETER" 271 }, 272 273 Package (0x03) 274 { 275 0x1D, 276 0x1002, 277 "AE_BAD_CHARACTER" 278 }, 279 280 Package (0x03) 281 { 282 0x1E, 283 0x1003, 284 "AE_BAD_PATHNAME" 285 }, 286 287 Package (0x03) 288 { 289 0x1F, 290 0x1004, 291 "AE_BAD_DATA" 292 }, 293 294 Package (0x03) 295 { 296 0x20, 297 0x1005, 298 "AE_BAD_ADDRESS" 299 }, 300 301 /* obsolete */ 302 303 Package (0x03) 304 { 305 0x21, 306 0x1006, 307 "AE_ALIGNMENT" 308 }, 309 310 /* obsolete */ 311 312 Package (0x03) 313 { 314 0x22, 315 0x1005, 316 "AE_BAD_HEX_CONSTANT" 317 }, 318 319 Package (0x03) 320 { 321 0x23, 322 0x1006, 323 "AE_BAD_OCTAL_CONSTANT" 324 }, 325 326 Package (0x03) 327 { 328 0x24, 329 0x1007, 330 "AE_BAD_DECIMAL_CONSTANT" 331 }, 332 333 Package (0x03) 334 { 335 0x25, 336 0x2001, 337 "AE_BAD_SIGNATURE" 338 }, 339 340 Package (0x03) 341 { 342 0x26, 343 0x2002, 344 "AE_BAD_HEADER" 345 }, 346 347 Package (0x03) 348 { 349 0x27, 350 0x2003, 351 "AE_BAD_CHECKSUM" 352 }, 353 354 Package (0x03) 355 { 356 0x28, 357 0x2004, 358 "AE_BAD_VALUE" 359 }, 360 361 Package (0x03) 362 { 363 0x29, 364 0x2005, 365 "AE_TABLE_NOT_SUPPORTED" 366 }, 367 368 /* obsolete */ 369 370 Package (0x03) 371 { 372 0x2A, 373 0x2005, 374 "AE_INVALID_TABLE_LENGTH" 375 }, 376 377 Package (0x03) 378 { 379 0x2B, 380 0x3001, 381 "AE_AML_ERROR" 382 }, 383 384 /* obsolete */ 385 386 Package (0x03) 387 { 388 0x2C, 389 0x3002, 390 "AE_AML_PARSE" 391 }, 392 393 /* obsolete */ 394 395 Package (0x03) 396 { 397 0x2D, 398 0x3001, 399 "AE_AML_BAD_OPCODE" 400 }, 401 402 Package (0x03) 403 { 404 0x2E, 405 0x3002, 406 "AE_AML_NO_OPERAND" 407 }, 408 409 Package (0x03) 410 { 411 0x2F, 412 0x3003, 413 "AE_AML_OPERAND_TYPE" 414 }, 415 416 Package (0x03) 417 { 418 0x30, 419 0x3004, 420 "AE_AML_OPERAND_VALUE" 421 }, 422 423 Package (0x03) 424 { 425 0x31, 426 0x3005, 427 "AE_AML_UNINITIALIZED_LOCAL" 428 }, 429 430 Package (0x03) 431 { 432 0x32, 433 0x3006, 434 "AE_AML_UNINITIALIZED_ARG" 435 }, 436 437 Package (0x03) 438 { 439 0x33, 440 0x3007, 441 "AE_AML_UNINITIALIZED_ELEMENT" 442 }, 443 444 Package (0x03) 445 { 446 0x34, 447 0x3008, 448 "AE_AML_NUMERIC_OVERFLOW" 449 }, 450 451 Package (0x03) 452 { 453 0x35, 454 0x3009, 455 "AE_AML_REGION_LIMIT" 456 }, 457 458 Package (0x03) 459 { 460 0x36, 461 0x300A, 462 "AE_AML_BUFFER_LIMIT" 463 }, 464 465 Package (0x03) 466 { 467 0x37, 468 0x300B, 469 "AE_AML_PACKAGE_LIMIT" 470 }, 471 472 Package (0x03) 473 { 474 0x38, 475 0x300C, 476 "AE_AML_DIVIDE_BY_ZERO" 477 }, 478 479 Package (0x03) 480 { 481 0x39, 482 0x300D, 483 "AE_AML_BAD_NAME" 484 }, 485 486 Package (0x03) 487 { 488 0x3A, 489 0x300E, 490 "AE_AML_NAME_NOT_FOUND" 491 }, 492 493 Package (0x03) 494 { 495 0x3B, 496 0x300F, 497 "AE_AML_INTERNAL" 498 }, 499 500 Package (0x03) 501 { 502 0x3C, 503 0x3010, 504 "AE_AML_INVALID_SPACE_ID" 505 }, 506 507 Package (0x03) 508 { 509 0x3D, 510 0x3011, 511 "AE_AML_STRING_LIMIT" 512 }, 513 514 Package (0x03) 515 { 516 0x3E, 517 0x3012, 518 "AE_AML_NO_RETURN_VALUE" 519 }, 520 521 Package (0x03) 522 { 523 0x3F, 524 0x3014, 525 "AE_AML_NOT_OWNER" 526 }, 527 528 Package (0x03) 529 { 530 0x40, 531 0x3015, 532 "AE_AML_MUTEX_ORDER" 533 }, 534 535 Package (0x03) 536 { 537 0x41, 538 0x3016, 539 "AE_AML_MUTEX_NOT_ACQUIRED" 540 }, 541 542 Package (0x03) 543 { 544 0x42, 545 0x3017, 546 "AE_AML_INVALID_RESOURCE_TYPE" 547 }, 548 549 Package (0x03) 550 { 551 0x43, 552 0x3018, 553 "AE_AML_INVALID_INDEX" 554 }, 555 556 Package (0x03) 557 { 558 0x44, 559 0x3019, 560 "AE_AML_REGISTER_LIMIT" 561 }, 562 563 Package (0x03) 564 { 565 0x45, 566 0x301A, 567 "AE_AML_NO_WHILE" 568 }, 569 570 Package (0x03) 571 { 572 0x46, 573 0x301B, 574 "AE_AML_ALIGNMENT" 575 }, 576 577 Package (0x03) 578 { 579 0x47, 580 0x301C, 581 "AE_AML_NO_RESOURCE_END_TAG" 582 }, 583 584 Package (0x03) 585 { 586 0x48, 587 0x301D, 588 "AE_AML_BAD_RESOURCE_VALUE" 589 }, 590 591 Package (0x03) 592 { 593 0x49, 594 0x301E, 595 "AE_AML_CIRCULAR_REFERENCE" 596 }, 597 598 Package (0x03) 599 { 600 0x4A, 601 0x4001, 602 "AE_CTRL_RETURN_VALUE" 603 }, 604 605 Package (0x03) 606 { 607 0x4B, 608 0x4002, 609 "AE_CTRL_PENDING" 610 }, 611 612 Package (0x03) 613 { 614 0x4C, 615 0x4003, 616 "AE_CTRL_TERMINATE" 617 }, 618 619 Package (0x03) 620 { 621 0x4D, 622 0x4004, 623 "AE_CTRL_TRUE" 624 }, 625 626 Package (0x03) 627 { 628 0x4E, 629 0x4005, 630 "AE_CTRL_FALSE" 631 }, 632 633 Package (0x03) 634 { 635 0x4F, 636 0x4006, 637 "AE_CTRL_DEPTH" 638 }, 639 640 Package (0x03) 641 { 642 0x50, 643 0x4007, 644 "AE_CTRL_END" 645 }, 646 647 Package (0x03) 648 { 649 0x51, 650 0x4008, 651 "AE_CTRL_TRANSFER" 652 }, 653 654 Package (0x03) 655 { 656 0x52, 657 0x4009, 658 "AE_CTRL_BREAK" 659 }, 660 661 Package (0x03) 662 { 663 0x53, 664 0x400A, 665 "AE_CTRL_CONTINUE" 666 }, 667 668 /* New additional are here not to touch previous indexes */ 669 670 Package (0x03) 671 { 672 0x54, 673 0x3013, 674 "AE_AML_METHOD_LIMIT" 675 }, 676 677 Package (0x03) 678 { 679 0x55, 680 0x100B, 681 "AE_INDEX_TO_NOT_ATTACHED" 682 }, 683 684 Package (0x03) 685 { 686 0x56, 687 0x1B, 688 "AE_OWNER_ID_LIMIT" 689 } 690 }) 691 /* 692 * (multi-threading) 693 * 694 * Packages to store per-thread information about exceptions 695 * (used in mt-mode) 696 * 697 * EXC2 - maximal number of exception can be registered 698 * EX02 - package to store ID of thread where exception occurs 699 * EX03 - package to store opcode of exception 700 */ 701 Name (EXC2, 0xC8) 702 Name (EX02, Package (EXC2){}) 703 Name (EX03, Package (EXC2){}) 704 /* 705 * Exceptional conditions handler 706 * 707 * arg0 - AcpiStatus 708 * arg1 - AsciiExceptionString 709 * arg2 - ID of current thread 710 */ 711 Method (_ERR, 3, NotSerialized) 712 { 713 EX00 = Arg0 714 EX01 = Arg1 715 If ((EX04 == 0x00)) 716 { 717 EX04 = Arg0 718 EX05 = Arg1 719 } 720 721 /* multi-threading */ 722 723 If (MTHR) 724 { 725 /* If the current number of exceptions handled doesn't exceed EXC2 */ 726 727 If ((EXC0 < EXC2)) 728 { 729 EX02 [EXC0] = Arg2 730 EX03 [EXC0] = Arg0 731 } 732 Else 733 { 734 Debug = "Maximal number of exceptions exceeded" 735 ERR ("_ERR", Z063, __LINE__, 0x00, 0x00, EXC0, EXC2) 736 } 737 } 738 739 EXC0++ 740 EXC1++ 741 /* Store("Run-time exception:", Debug) */ 742 /* Store(arg0, Debug) */ 743 /* Store(arg1, Debug) */ 744 /* Store(arg2, Debug) */ 745 Return (0x00) /* Map error to AE_OK */ 746 } 747 748 /* Check that exceptions has not arisen at all */ 749 750 Method (CH02, 0, NotSerialized) 751 { 752 If (EXC1) 753 { 754 Concatenate ("Some unexpected exceptions were handled, 0x", EXC1, Local0) 755 ERR ("CH02", Z063, __LINE__, 0x00, 0x00, Local0, 0x00) 756 } 757 758 Return (EXC1) /* \EXC1 */ 759 } 760 761 /* 762 * Check that the counter of current exceptions is zero. Set it to zero. 763 * arg0 - diagnostic message 764 * arg1 - absolute index of file initiating the checking 765 * arg2 - line number of checking 766 * arg3 - arg5 of err, "received value" 767 * arg4 - arg6 of err, "expected value" 768 */ 769 Method (CH03, 5, NotSerialized) 770 { 771 Local7 = 0x00 772 If (EXC0) 773 { 774 Concatenate ("Unexpected exceptions (count ", EXC0, Local0) 775 Concatenate (Local0, "), the last is ", Local1) 776 Concatenate (Local1, EX01, Local0) 777 Concatenate (Local0, ", ", Local1) 778 Concatenate (Local1, EX00, Debug) 779 ERR (Arg0, Z063, __LINE__, Arg1, Arg2, Arg3, Arg4) 780 Local7 = EXC0 /* \EXC0 */ 781 } 782 783 EXC0 = 0x00 784 EX04 = 0x00 785 Return (Local7) 786 } 787 788 /* */ 789 /* Convert 32/64 bit integer to 16-bit Hex value */ 790 /* */ 791 Method (ST16, 1, Serialized) 792 { 793 Name (EBUF, Buffer (ISZC){}) 794 /* 8 or 16 bytes, depending on 32/64 mode */ 795 796 Name (RBUF, Buffer (0x04){}) 797 EBUF = ToHexString (Arg0) 798 Mid (EBUF, (ISZC - 0x04), 0x04, RBUF) /* \ST16.RBUF */ 799 Return (Concatenate ("0x", ToString (RBUF, Ones))) 800 } 801 802 /* 803 * Check that exceptions are handled as expected, report errors 804 * (if any) and set the current number of exceptions to zero. 805 * 806 * Verified: 807 * - exception has arisen 808 * - check the number of exceptions 809 * - the last arisen exception matches one described by arguments 810 * 811 * arg0 - diagnostic message 812 * arg1 - 813 * zero means: 814 * - check that only one exception has arisen (current number is equal to 1) 815 * - check that opcode is equal to that specified by arg2 816 * non-zero means: 817 * - check that the number of exception arisen is not less than 1 818 * (current number is equal to 1 or greater) 819 * 1: check that the first opcode is equal to that specified by arg2 820 * 2: check that the last opcode is equal to that specified by arg2 821 * 822 * arg2 - index of exception info in pf00 Package 823 * arg3 - absolute index of file initiating the checking 824 * arg4 - line number of checking 825 * arg5 - arg5 of err, "received value" 826 * arg6 - arg6 of err, "expected value" 827 */ 828 Method (CH04, 7, NotSerialized) 829 { 830 Local5 = 0x00 831 If ((Arg2 == 0xFF)) 832 { 833 If ((EXC0 == 0x00)) 834 { 835 Local5 = 0x01 836 Debug = "ERROR: No ANY exception has arisen." 837 } 838 } 839 Else 840 { 841 /* Determine opcode and name of the expected exception */ 842 843 Local2 = DerefOf (PF00 [Arg2]) /* exception info */ 844 Local3 = DerefOf (Local2 [0x01]) /* opcode */ 845 Local4 = DerefOf (Local2 [0x02]) /* name */ 846 If ((EXC0 == 0x00)) 847 { 848 Local5 = 0x01 849 Concatenate ("No exception - expected: ", Local4, Local0) 850 Concatenate (Local0, "-", Local0) 851 Concatenate (Local0, ST16 (Local3), Local0) 852 Debug = Local0 853 } 854 ElseIf ((!Arg1 && (EXC0 > 0x01))) 855 { 856 Local5 = 0x01 857 Concatenate ("More than one exception: 0x", EXC0, Local0) 858 Debug = Local0 859 } 860 Else 861 { 862 If ((Arg1 == 0x01)) 863 { 864 /* Opcode of the first exception */ 865 866 Local6 = EX04 /* \EX04 */ 867 Local7 = EX05 /* \EX05 */ 868 } 869 Else 870 { 871 /* Opcode of the last exception */ 872 873 Local6 = EX00 /* \EX00 */ 874 Local7 = EX01 /* \EX01 */ 875 } 876 877 If ((Local3 != Local6)) 878 { 879 Local5 = 0x01 880 Concatenate ("Exception: ", Local7, Local0) 881 Concatenate (Local0, "-", Local0) 882 Concatenate (Local0, ST16 (Local6), Local0) 883 Concatenate (" differs from expected: ", Local4, Local1) 884 Concatenate (Local0, Local1, Local0) 885 Concatenate (Local0, "-", Local0) 886 Concatenate (Local0, ST16 (Local3), Local0) 887 Debug = Local0 888 } 889 890 If ((Local4 != Local7)) 891 { 892 Local5 = 0x01 893 Debug = "Unexpected exception:" 894 Debug = Concatenate ("Expected: ", Local4) 895 Debug = Concatenate ("Received: ", Local7) 896 } 897 } 898 } 899 900 /* if(LNotEqual(arg2,0xff)) */ 901 902 EXC0 = 0x00 903 EX04 = 0x00 904 If (Local5) 905 { 906 ERR (Arg0, Z063, __LINE__, Arg3, Arg4, Arg5, Arg6) 907 } 908 909 Return (Local5) 910 } 911 912 Method (CH05, 0, NotSerialized) 913 { 914 Return (CH03 ("CH05", 0x00, __LINE__, 0x00, 0x00)) 915 } 916 917 Method (CH06, 3, NotSerialized) 918 { 919 If (EXCV) 920 { 921 Return (CH04 (Arg0, 0x00, Arg2, 0x00, __LINE__, 0x00, 0x00)) 922 } 923 Else 924 { 925 /* Just only presence of ANY exception(s) */ 926 927 Return (CH04 (Arg0, 0x00, 0xFF, 0x00, __LINE__, 0x00, 0x00)) 928 } 929 } 930 931 /* 932 * Check for any exception when the slack mode is initiated 933 */ 934 Method (CH07, 7, NotSerialized) 935 { 936 If (SLCK) 937 { 938 CH03 (Arg0, Arg3, __LINE__, 0x00, Arg6) 939 } 940 Else 941 { 942 CH04 (Arg0, Arg1, Arg2, Arg3, __LINE__, Arg5, Arg6) 943 } 944 } 945 946 /* MULTI-THREADING */ 947 /* 948 * Report message of thread 949 * (adds ID of thread and reports the message) 950 * 951 * arg0 - ID of current thread 952 * arg1 - string 953 */ 954 Method (MSG0, 2, NotSerialized) 955 { 956 Concatenate ("THREAD ID ", Arg0, Local0) 957 Concatenate (Local0, ": ", Local1) 958 Concatenate (Local1, Arg1, Local0) 959 Debug = Local0 960 } 961 962 /* 963 * Used in multi-threading mode 964 * 965 * Return the first encountered exception corresponding to this Thread ID 966 * and the total number of exceptions corresponding to this Thread ID. 967 * Reset all the entries corresponding to the thread identified by arg0. 968 * 969 * Note: this method is used in mt-mode (by several threads simultaneously) 970 * but each of threads changes only its elements of EX02. 971 * 972 * arg0 - ID of current thread 973 */ 974 Method (MTEX, 1, NotSerialized) 975 { 976 Local2 = Package (0x02) 977 { 978 0x00, 979 0x00 980 } /* Package to be returned */ 981 Local3 = 0x00 /* found */ 982 Local4 = EXC0 /* lpN0 */ /* \EXC0 */ 983 Local5 = 0x00 /* lpC0 */ 984 While (Local4) 985 { 986 Local0 = DerefOf (EX02 [Local5]) 987 /* Matching ID of current thread */ 988 989 If ((Local0 == Arg0)) 990 { 991 Local1 = DerefOf (EX03 [Local5]) 992 If ((Local3 == 0x00)) 993 { 994 /* Opcode of the first exception */ 995 996 Local2 [0x00] = Local1 997 } 998 999 Local3++ 1000 /* Reset information about this exception */ 1001 1002 EX02 [Local5] = 0x00 1003 } 1004 1005 Local4-- 1006 Local5++ 1007 } 1008 1009 Local2 [0x01] = Local3 1010 Return (Local2) 1011 } 1012 1013 /* 1014 * The same as CH03, but to be used in multi-threading mode 1015 * 1016 * arg0 - diagnostic message 1017 * arg1 - ID of current thread 1018 * arg2 - absolute index of file initiating the checking 1019 * arg3 - index of checking 1020 * arg4 - arg5 of err, "received value" 1021 * arg5 - arg6 of err, "expected value" 1022 * 1023 * Return: current number of exceptions occur on this thread 1024 */ 1025 Method (CH08, 6, NotSerialized) 1026 { 1027 Local2 = MTEX (Arg1) 1028 Local3 = DerefOf (Local2 [0x00]) /* opcode of the first exception */ 1029 Local4 = DerefOf (Local2 [0x01]) /* number of exceptions */ 1030 Local7 = 0x00 1031 If (Local4) 1032 { 1033 Concatenate ("Unexpected exception 0x", Local3, Local0) 1034 Concatenate (Local0, ", number of exceptions 0x", Local1) 1035 Concatenate (Local1, Local4, Local0) 1036 MSG0 (Arg1, Local0) 1037 ERR (Arg0, Z063, __LINE__, Arg2, Arg3, Arg4, Arg5) 1038 Local7 = 0x01 1039 } 1040 1041 /* 1042 * Reset of EXC0 should be done by Control thread 1043 * Store(0, EXC0) 1044 */ 1045 Return (Local4) 1046 } 1047 1048 /* 1049 * The same as CH04, but to be used in multi-threading mode 1050 * 1051 * arg0 - non-zero means to treat "More than one exceptions" as error 1052 * arg1 - ID of current thread 1053 * arg2 - index of exception info in pf00 Package 1054 * arg3 - absolute index of file initiating the checking 1055 * arg4 - index of checking 1056 * arg5 - RefOf to Integer to return 'current number of exceptions occur on this thread' 1057 * 1058 * Return: non-zero when errors detected 1059 */ 1060 Method (CH09, 6, NotSerialized) 1061 { 1062 Local7 = MTEX (Arg1) 1063 Local6 = DerefOf (Local7 [0x00]) /* opcode of the first exception */ 1064 Local7 = DerefOf (Local7 [0x01]) /* number of exceptions */ 1065 Local5 = 0x00 1066 If ((Arg2 == 0xFF)) 1067 { 1068 If ((Local7 == 0x00)) 1069 { 1070 /* No exceptions */ 1071 1072 Local5 = 0x01 1073 MSG0 (Arg1, "ERROR: No ANY exception has arisen.") 1074 } 1075 } 1076 Else 1077 { 1078 /* Determine opcode and name of the expected exception */ 1079 1080 Local2 = DerefOf (PF00 [Arg2]) /* exception info */ 1081 Local3 = DerefOf (Local2 [0x01]) /* opcode */ 1082 Local4 = DerefOf (Local2 [0x02]) /* name */ 1083 If ((Local7 == 0x00)) 1084 { 1085 /* No exceptions */ 1086 1087 Local5 = 0x01 1088 Concatenate ("No exception has arisen, expected: ", Local4, Local0) 1089 Concatenate (", opcode 0x", Local3, Local1) 1090 Concatenate (Local0, Local1, Local0) 1091 MSG0 (Arg1, Local0) 1092 } 1093 ElseIf ((Arg0 && (Local7 > 0x01))) 1094 { 1095 Local5 = 0x01 1096 Concatenate ("More than one exception has arisen: 0x", Local7, Local0) 1097 MSG0 (Arg1, Local0) 1098 } 1099 ElseIf /* Opcode of the first exception */ 1100 1101 ((Local3 != Local6)) 1102 { 1103 Local5 = 0x01 1104 Concatenate ("The exception 0x", Local6, Local0) 1105 Concatenate (Local0, " differs from expected ", Local1) 1106 Concatenate (Local1, ST16 (Local3), Local0) 1107 MSG0 (Arg1, Local0) 1108 } 1109 } 1110 1111 /* if(LNotEqual(arg2,0xff)) */ 1112 /* 1113 * Reset of EXC0 should be done by Control thread 1114 * Store(0, EXC0) 1115 */ 1116 If (Local5) 1117 { 1118 ERR (__METHOD__, Z063, __LINE__, Arg3, Arg4, 0x00, 0x00) 1119 } 1120 1121 Arg5 = Local7 1122 Return (Local5) 1123 } 1124 1125 /* 1126 * Reset EXC0 (the current number of exceptions handled) 1127 * 1128 * It should be invoked by the Control thread. 1129 */ 1130 Method (CH0A, 0, NotSerialized) 1131 { 1132 EXC0 = 0x00 1133 } 1134