Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 /******************************************************************************* * * Module Name: dbdisply - debug display commands * ******************************************************************************/ #include <acpi/acpi.h> #include "accommon.h" #include "amlcode.h" #include "acdispat.h" #include "acnamesp.h" #include "acparser.h" #include "acinterp.h" #include "acevents.h" #include "acdebug.h" #define _COMPONENT ACPI_CA_DEBUGGER ACPI_MODULE_NAME("dbdisply") /* Local prototypes */ static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op); static void *acpi_db_get_pointer(void *target); static acpi_status acpi_db_display_non_root_handlers(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value); /* * System handler information. * Used for Handlers command, in acpi_db_display_handlers. */ #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : " #define ACPI_HANDLER_NAME_STRING "%30s : " #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n" #define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)" #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n" /* All predefined Address Space IDs */ static acpi_adr_space_type acpi_gbl_space_id_list[] = { ACPI_ADR_SPACE_SYSTEM_MEMORY, ACPI_ADR_SPACE_SYSTEM_IO, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_ADR_SPACE_EC, ACPI_ADR_SPACE_SMBUS, ACPI_ADR_SPACE_CMOS, ACPI_ADR_SPACE_PCI_BAR_TARGET, ACPI_ADR_SPACE_IPMI, ACPI_ADR_SPACE_GPIO, ACPI_ADR_SPACE_GSBUS, ACPI_ADR_SPACE_PLATFORM_COMM, ACPI_ADR_SPACE_PLATFORM_RT, ACPI_ADR_SPACE_DATA_TABLE, ACPI_ADR_SPACE_FIXED_HARDWARE }; /* Global handler information */ typedef struct acpi_handler_info { void *handler; char *name; } acpi_handler_info; static struct acpi_handler_info acpi_gbl_handler_list[] = { {&acpi_gbl_global_notify[0].handler, "System Notifications"}, {&acpi_gbl_global_notify[1].handler, "Device Notifications"}, {&acpi_gbl_table_handler, "ACPI Table Events"}, {&acpi_gbl_exception_handler, "Control Method Exceptions"}, {&acpi_gbl_interface_handler, "OSI Invocations"} }; /******************************************************************************* * * FUNCTION: acpi_db_get_pointer * * PARAMETERS: target - Pointer to string to be converted * * RETURN: Converted pointer * * DESCRIPTION: Convert an ascii pointer value to a real value * ******************************************************************************/ static void *acpi_db_get_pointer(void *target) { void *obj_ptr; acpi_size address; address = strtoul(target, NULL, 16); obj_ptr = ACPI_TO_POINTER(address); return (obj_ptr); } /******************************************************************************* * * FUNCTION: acpi_db_dump_parser_descriptor * * PARAMETERS: op - A parser Op descriptor * * RETURN: None * * DESCRIPTION: Display a formatted parser object * ******************************************************************************/ static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op) { const struct acpi_opcode_info *info; info = acpi_ps_get_opcode_info(op->common.aml_opcode); acpi_os_printf("Parser Op Descriptor:\n"); acpi_os_printf("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode); ACPI_DEBUG_ONLY_MEMBERS(acpi_os_printf("%20.20s : %s\n", "Opcode Name", info->name)); acpi_os_printf("%20.20s : %p\n", "Value/ArgList", op->common.value.arg); acpi_os_printf("%20.20s : %p\n", "Parent", op->common.parent); acpi_os_printf("%20.20s : %p\n", "NextOp", op->common.next); } /******************************************************************************* * * FUNCTION: acpi_db_decode_and_display_object * * PARAMETERS: target - String with object to be displayed. Names * and hex pointers are supported. * output_type - Byte, Word, Dword, or Qword (B|W|D|Q) * * RETURN: None * * DESCRIPTION: Display a formatted ACPI object * ******************************************************************************/ void acpi_db_decode_and_display_object(char *target, char *output_type) { void *obj_ptr; struct acpi_namespace_node *node; union acpi_operand_object *obj_desc; u32 display = DB_BYTE_DISPLAY; char buffer[80]; struct acpi_buffer ret_buf; acpi_status status; u32 size; if (!target) { return; } /* Decode the output type */ if (output_type) { acpi_ut_strupr(output_type); if (output_type[0] == 'W') { display = DB_WORD_DISPLAY; } else if (output_type[0] == 'D') { display = DB_DWORD_DISPLAY; } else if (output_type[0] == 'Q') { display = DB_QWORD_DISPLAY; } } ret_buf.length = sizeof(buffer); ret_buf.pointer = buffer; /* Differentiate between a number and a name */ if ((target[0] >= 0x30) && (target[0] <= 0x39)) { obj_ptr = acpi_db_get_pointer(target); if (!acpi_os_readable(obj_ptr, 16)) { acpi_os_printf ("Address %p is invalid in this address space\n", obj_ptr); return; } /* Decode the object type */ switch (ACPI_GET_DESCRIPTOR_TYPE(obj_ptr)) { case ACPI_DESC_TYPE_NAMED: /* This is a namespace Node */ if (!acpi_os_readable (obj_ptr, sizeof(struct acpi_namespace_node))) { acpi_os_printf ("Cannot read entire Named object at address %p\n", obj_ptr); return; } node = obj_ptr; goto dump_node; case ACPI_DESC_TYPE_OPERAND: /* This is a ACPI OPERAND OBJECT */ if (!acpi_os_readable (obj_ptr, sizeof(union acpi_operand_object))) { acpi_os_printf ("Cannot read entire ACPI object at address %p\n", obj_ptr); return; } acpi_ut_debug_dump_buffer(obj_ptr, sizeof(union acpi_operand_object), display, ACPI_UINT32_MAX); acpi_ex_dump_object_descriptor(obj_ptr, 1); break; case ACPI_DESC_TYPE_PARSER: /* This is a Parser Op object */ if (!acpi_os_readable (obj_ptr, sizeof(union acpi_parse_object))) { acpi_os_printf ("Cannot read entire Parser object at address %p\n", obj_ptr); return; } acpi_ut_debug_dump_buffer(obj_ptr, sizeof(union acpi_parse_object), display, ACPI_UINT32_MAX); acpi_db_dump_parser_descriptor((union acpi_parse_object *)obj_ptr); break; default: /* Is not a recognizable object */ acpi_os_printf ("Not a known ACPI internal object, descriptor type %2.2X\n", ACPI_GET_DESCRIPTOR_TYPE(obj_ptr)); size = 16; if (acpi_os_readable(obj_ptr, 64)) { size = 64; } /* Just dump some memory */ acpi_ut_debug_dump_buffer(obj_ptr, size, display, ACPI_UINT32_MAX); break; } return; } /* The parameter is a name string that must be resolved to a Named obj */ node = acpi_db_local_ns_lookup(target); if (!node) { return; } dump_node: /* Now dump the NS node */ status = acpi_get_name(node, ACPI_FULL_PATHNAME_NO_TRAILING, &ret_buf); if (ACPI_FAILURE(status)) { acpi_os_printf("Could not convert name to pathname\n"); } else { acpi_os_printf("Object %p: Namespace Node - Pathname: %s\n", node, (char *)ret_buf.pointer); } if (!acpi_os_readable(node, sizeof(struct acpi_namespace_node))) { acpi_os_printf("Invalid Named object at address %p\n", node); return; } acpi_ut_debug_dump_buffer((void *)node, sizeof(struct acpi_namespace_node), display, ACPI_UINT32_MAX); acpi_ex_dump_namespace_node(node, 1); obj_desc = acpi_ns_get_attached_object(node); if (obj_desc) { acpi_os_printf("\nAttached Object %p:", obj_desc); if (!acpi_os_readable (obj_desc, sizeof(union acpi_operand_object))) { acpi_os_printf ("Invalid internal ACPI Object at address %p\n", obj_desc); return; } if (ACPI_GET_DESCRIPTOR_TYPE(((struct acpi_namespace_node *) obj_desc)) == ACPI_DESC_TYPE_NAMED) { acpi_os_printf(" Namespace Node - "); status = acpi_get_name((struct acpi_namespace_node *) obj_desc, ACPI_FULL_PATHNAME_NO_TRAILING, &ret_buf); if (ACPI_FAILURE(status)) { acpi_os_printf ("Could not convert name to pathname\n"); } else { acpi_os_printf("Pathname: %s", (char *)ret_buf.pointer); } acpi_os_printf("\n"); acpi_ut_debug_dump_buffer((void *)obj_desc, sizeof(struct acpi_namespace_node), display, ACPI_UINT32_MAX); } else { acpi_os_printf("\n"); acpi_ut_debug_dump_buffer((void *)obj_desc, sizeof(union acpi_operand_object), display, ACPI_UINT32_MAX); } acpi_ex_dump_object_descriptor(obj_desc, 1); } } /******************************************************************************* * * FUNCTION: acpi_db_display_method_info * * PARAMETERS: start_op - Root of the control method parse tree * * RETURN: None * * DESCRIPTION: Display information about the current method * ******************************************************************************/ void acpi_db_display_method_info(union acpi_parse_object *start_op) { struct acpi_walk_state *walk_state; union acpi_operand_object *obj_desc; struct acpi_namespace_node *node; union acpi_parse_object *root_op; union acpi_parse_object *op; const struct acpi_opcode_info *op_info; u32 num_ops = 0; u32 num_operands = 0; u32 num_operators = 0; u32 num_remaining_ops = 0; u32 num_remaining_operands = 0; u32 num_remaining_operators = 0; u8 count_remaining = FALSE; walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list); if (!walk_state) { acpi_os_printf("There is no method currently executing\n"); return; } obj_desc = walk_state->method_desc; node = walk_state->method_node; acpi_os_printf("Currently executing control method is [%4.4s]\n", acpi_ut_get_node_name(node)); acpi_os_printf("%X Arguments, SyncLevel = %X\n", (u32)obj_desc->method.param_count, (u32)obj_desc->method.sync_level); root_op = start_op; while (root_op->common.parent) { root_op = root_op->common.parent; } op = root_op; while (op) { if (op == start_op) { count_remaining = TRUE; } num_ops++; if (count_remaining) { num_remaining_ops++; } /* Decode the opcode */ op_info = acpi_ps_get_opcode_info(op->common.aml_opcode); switch (op_info->class) { case AML_CLASS_ARGUMENT: if (count_remaining) { num_remaining_operands++; } num_operands++; break; case AML_CLASS_UNKNOWN: /* Bad opcode or ASCII character */ continue; default: if (count_remaining) { num_remaining_operators++; } num_operators++; break; } op = acpi_ps_get_depth_next(start_op, op); } acpi_os_printf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n", num_ops, num_operators, num_operands); acpi_os_printf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n", num_remaining_ops, num_remaining_operators, num_remaining_operands); } /******************************************************************************* * * FUNCTION: acpi_db_display_locals * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display all locals for the currently running control method * ******************************************************************************/ void acpi_db_display_locals(void) { struct acpi_walk_state *walk_state; walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list); if (!walk_state) { acpi_os_printf("There is no method currently executing\n"); return; } acpi_db_decode_locals(walk_state); } /******************************************************************************* * * FUNCTION: acpi_db_display_arguments * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display all arguments for the currently running control method * ******************************************************************************/ void acpi_db_display_arguments(void) { struct acpi_walk_state *walk_state; walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list); if (!walk_state) { acpi_os_printf("There is no method currently executing\n"); return; } acpi_db_decode_arguments(walk_state); } /******************************************************************************* * * FUNCTION: acpi_db_display_results * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display current contents of a method result stack * ******************************************************************************/ void acpi_db_display_results(void) { u32 i; struct acpi_walk_state *walk_state; union acpi_operand_object *obj_desc; u32 result_count = 0; struct acpi_namespace_node *node; union acpi_generic_state *frame; u32 index; /* Index onto current frame */ walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list); if (!walk_state) { acpi_os_printf("There is no method currently executing\n"); return; } node = walk_state->method_node; if (walk_state->results) { result_count = walk_state->result_count; } acpi_os_printf("Method [%4.4s] has %X stacked result objects\n", acpi_ut_get_node_name(node), result_count); /* From the top element of result stack */ frame = walk_state->results; index = (result_count - 1) % ACPI_RESULTS_FRAME_OBJ_NUM; for (i = 0; i < result_count; i++) { obj_desc = frame->results.obj_desc[index]; acpi_os_printf("Result%u: ", i); acpi_db_display_internal_object(obj_desc, walk_state); if (index == 0) { frame = frame->results.next; index = ACPI_RESULTS_FRAME_OBJ_NUM; } index--; } } /******************************************************************************* * * FUNCTION: acpi_db_display_calling_tree * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display current calling tree of nested control methods * ******************************************************************************/ void acpi_db_display_calling_tree(void) { struct acpi_walk_state *walk_state; struct acpi_namespace_node *node; walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list); if (!walk_state) { acpi_os_printf("There is no method currently executing\n"); return; } acpi_os_printf("Current Control Method Call Tree\n"); while (walk_state) { node = walk_state->method_node; acpi_os_printf(" [%4.4s]\n", acpi_ut_get_node_name(node)); walk_state = walk_state->next; } } /******************************************************************************* * * FUNCTION: acpi_db_display_object_type * * PARAMETERS: object_arg - User entered NS node handle * * RETURN: None * * DESCRIPTION: Display type of an arbitrary NS node * ******************************************************************************/ void acpi_db_display_object_type(char *object_arg) { acpi_size arg; acpi_handle handle; struct acpi_device_info *info; acpi_status status; u32 i; arg = strtoul(object_arg, NULL, 16); handle = ACPI_TO_POINTER(arg); status = acpi_get_object_info(handle, &info); if (ACPI_FAILURE(status)) { acpi_os_printf("Could not get object info, %s\n", acpi_format_exception(status)); return; } acpi_os_printf("ADR: %8.8X%8.8X, Flags: %X\n", ACPI_FORMAT_UINT64(info->address), info->flags); acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n", info->highest_dstates[0], info->highest_dstates[1], info->highest_dstates[2], info->highest_dstates[3]); acpi_os_printf("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n", info->lowest_dstates[0], info->lowest_dstates[1], info->lowest_dstates[2], info->lowest_dstates[3], info->lowest_dstates[4]); if (info->valid & ACPI_VALID_HID) { acpi_os_printf("HID: %s\n", info->hardware_id.string); } if (info->valid & ACPI_VALID_UID) { acpi_os_printf("UID: %s\n", info->unique_id.string); } if (info->valid & ACPI_VALID_CID) { for (i = 0; i < info->compatible_id_list.count; i++) { acpi_os_printf("CID %u: %s\n", i, info->compatible_id_list.ids[i].string); } } ACPI_FREE(info); } /******************************************************************************* * * FUNCTION: acpi_db_display_result_object * * PARAMETERS: obj_desc - Object to be displayed * walk_state - Current walk state * * RETURN: None * * DESCRIPTION: Display the result of an AML opcode * * Note: Currently only displays the result object if we are single stepping. * However, this output may be useful in other contexts and could be enabled * to do so if needed. * ******************************************************************************/ void acpi_db_display_result_object(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { #ifndef ACPI_APPLICATION if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { return; } #endif /* Only display if single stepping */ if (!acpi_gbl_cm_single_step) { return; } acpi_os_printf("ResultObj: "); acpi_db_display_internal_object(obj_desc, walk_state); acpi_os_printf("\n"); } /******************************************************************************* * * FUNCTION: acpi_db_display_argument_object * * PARAMETERS: obj_desc - Object to be displayed * walk_state - Current walk state * * RETURN: None * * DESCRIPTION: Display the result of an AML opcode * ******************************************************************************/ void acpi_db_display_argument_object(union acpi_operand_object *obj_desc, struct acpi_walk_state *walk_state) { #ifndef ACPI_APPLICATION if (acpi_gbl_db_thread_id != acpi_os_get_thread_id()) { return; } #endif if (!acpi_gbl_cm_single_step) { return; } acpi_os_printf("ArgObj: "); acpi_db_display_internal_object(obj_desc, walk_state); } #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * * FUNCTION: acpi_db_display_gpes * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display the current GPE structures * ******************************************************************************/ void acpi_db_display_gpes(void) { struct acpi_gpe_block_info *gpe_block; struct acpi_gpe_xrupt_info *gpe_xrupt_info; struct acpi_gpe_event_info *gpe_event_info; struct acpi_gpe_register_info *gpe_register_info; char *gpe_type; struct acpi_gpe_notify_info *notify; u32 gpe_index; u32 block = 0; u32 i; u32 j; u32 count; char buffer[80]; struct acpi_buffer ret_buf; acpi_status status; ret_buf.length = sizeof(buffer); ret_buf.pointer = buffer; block = 0; /* Walk the GPE lists */ gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head; while (gpe_xrupt_info) { gpe_block = gpe_xrupt_info->gpe_block_list_head; while (gpe_block) { status = acpi_get_name(gpe_block->node, ACPI_FULL_PATHNAME_NO_TRAILING, &ret_buf); if (ACPI_FAILURE(status)) { acpi_os_printf ("Could not convert name to pathname\n"); } if (gpe_block->node == acpi_gbl_fadt_gpe_device) { gpe_type = "FADT-defined GPE block"; } else { gpe_type = "GPE Block Device"; } acpi_os_printf ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n", block, gpe_block, gpe_block->node, buffer, gpe_type); acpi_os_printf(" Registers: %u (%u GPEs)\n", gpe_block->register_count, gpe_block->gpe_count); acpi_os_printf (" GPE range: 0x%X to 0x%X on interrupt %u\n", gpe_block->block_base_number, gpe_block->block_base_number + (gpe_block->gpe_count - 1), gpe_xrupt_info->interrupt_number); acpi_os_printf (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n", gpe_block->register_info, ACPI_FORMAT_UINT64(gpe_block->register_info-> status_address.address), ACPI_FORMAT_UINT64(gpe_block->register_info-> enable_address.address)); acpi_os_printf(" EventInfo: %p\n", gpe_block->event_info); /* Examine each GPE Register within the block */ for (i = 0; i < gpe_block->register_count; i++) { gpe_register_info = &gpe_block->register_info[i]; acpi_os_printf(" Reg %u: (GPE %.2X-%.2X) " "RunEnable %2.2X WakeEnable %2.2X" " Status %8.8X%8.8X Enable %8.8X%8.8X\n", i, gpe_register_info-> base_gpe_number, gpe_register_info-> base_gpe_number + (ACPI_GPE_REGISTER_WIDTH - 1), gpe_register_info-> enable_for_run, gpe_register_info-> enable_for_wake, ACPI_FORMAT_UINT64 (gpe_register_info-> status_address.address), ACPI_FORMAT_UINT64 (gpe_register_info-> enable_address.address)); /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { gpe_index = (i * ACPI_GPE_REGISTER_WIDTH) + j; gpe_event_info = &gpe_block->event_info[gpe_index]; if (ACPI_GPE_DISPATCH_TYPE (gpe_event_info->flags) == ACPI_GPE_DISPATCH_NONE) { /* This GPE is not used (no method or handler), ignore it */ continue; } acpi_os_printf (" GPE %.2X: %p RunRefs %2.2X Flags %2.2X (", gpe_block->block_base_number + gpe_index, gpe_event_info, gpe_event_info->runtime_count, gpe_event_info->flags); /* Decode the flags byte */ if (gpe_event_info-> flags & ACPI_GPE_LEVEL_TRIGGERED) { acpi_os_printf("Level, "); } else { acpi_os_printf("Edge, "); } if (gpe_event_info-> flags & ACPI_GPE_CAN_WAKE) { acpi_os_printf("CanWake, "); } else { acpi_os_printf("RunOnly, "); } switch (ACPI_GPE_DISPATCH_TYPE (gpe_event_info->flags)) { case ACPI_GPE_DISPATCH_NONE: acpi_os_printf("NotUsed"); break; case ACPI_GPE_DISPATCH_METHOD: acpi_os_printf("Method"); break; case ACPI_GPE_DISPATCH_HANDLER: acpi_os_printf("Handler"); break; case ACPI_GPE_DISPATCH_NOTIFY: count = 0; notify = gpe_event_info->dispatch. notify_list; while (notify) { count++; notify = notify->next; } acpi_os_printf ("Implicit Notify on %u devices", count); break; case ACPI_GPE_DISPATCH_RAW_HANDLER: acpi_os_printf("RawHandler"); break; default: acpi_os_printf("UNKNOWN: %X", ACPI_GPE_DISPATCH_TYPE (gpe_event_info-> flags)); break; } acpi_os_printf(")\n"); } } block++; gpe_block = gpe_block->next; } gpe_xrupt_info = gpe_xrupt_info->next; } } #endif /* !ACPI_REDUCED_HARDWARE */ /******************************************************************************* * * FUNCTION: acpi_db_display_handlers * * PARAMETERS: None * * RETURN: None * * DESCRIPTION: Display the currently installed global handlers * ******************************************************************************/ void acpi_db_display_handlers(void) { union acpi_operand_object *obj_desc; union acpi_operand_object *handler_obj; acpi_adr_space_type space_id; u32 i; /* Operation region handlers */ acpi_os_printf("\nOperation Region Handlers at the namespace root:\n"); obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node); if (obj_desc) { for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list); i++) { space_id = acpi_gbl_space_id_list[i]; acpi_os_printf(ACPI_PREDEFINED_PREFIX, acpi_ut_get_region_name((u8)space_id), space_id); handler_obj = acpi_ev_find_region_handler(space_id, obj_desc->common_notify. handler); if (handler_obj) { acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, (handler_obj->address_space. handler_flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", handler_obj->address_space. handler); goto found_handler; } /* There is no handler for this space_id */ acpi_os_printf("None\n"); found_handler: ; } /* Find all handlers for user-defined space_IDs */ handler_obj = obj_desc->common_notify.handler; while (handler_obj) { if (handler_obj->address_space.space_id >= ACPI_USER_REGION_BEGIN) { acpi_os_printf(ACPI_PREDEFINED_PREFIX, "User-defined ID", handler_obj->address_space. space_id); acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, (handler_obj->address_space. handler_flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", handler_obj->address_space. handler); } handler_obj = handler_obj->address_space.next; } } #if (!ACPI_REDUCED_HARDWARE) /* Fixed event handlers */ acpi_os_printf("\nFixed Event Handlers:\n"); for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { acpi_os_printf(ACPI_PREDEFINED_PREFIX, acpi_ut_get_event_name(i), i); if (acpi_gbl_fixed_event_handlers[i].handler) { acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User", acpi_gbl_fixed_event_handlers[i]. handler); } else { acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } #endif /* !ACPI_REDUCED_HARDWARE */ /* Miscellaneous global handlers */ acpi_os_printf("\nMiscellaneous Global Handlers:\n"); for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_handler_list); i++) { acpi_os_printf(ACPI_HANDLER_NAME_STRING, acpi_gbl_handler_list[i].name); if (acpi_gbl_handler_list[i].handler) { acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User", acpi_gbl_handler_list[i].handler); } else { acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None"); } } /* Other handlers that are installed throughout the namespace */ acpi_os_printf("\nOperation Region Handlers for specific devices:\n"); (void)acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, acpi_db_display_non_root_handlers, NULL, NULL, NULL); } /******************************************************************************* * * FUNCTION: acpi_db_display_non_root_handlers * * PARAMETERS: acpi_walk_callback * * RETURN: Status * * DESCRIPTION: Display information about all handlers installed for a * device object. * ******************************************************************************/ static acpi_status acpi_db_display_non_root_handlers(acpi_handle obj_handle, u32 nesting_level, void *context, void **return_value) { struct acpi_namespace_node *node = ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle); union acpi_operand_object *obj_desc; union acpi_operand_object *handler_obj; char *pathname; obj_desc = acpi_ns_get_attached_object(node); if (!obj_desc) { return (AE_OK); } pathname = acpi_ns_get_normalized_pathname(node, TRUE); if (!pathname) { return (AE_OK); } /* Display all handlers associated with this device */ handler_obj = obj_desc->common_notify.handler; while (handler_obj) { acpi_os_printf(ACPI_PREDEFINED_PREFIX, acpi_ut_get_region_name((u8)handler_obj-> address_space.space_id), handler_obj->address_space.space_id); acpi_os_printf(ACPI_HANDLER_PRESENT_STRING2, (handler_obj->address_space.handler_flags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default" : "User", handler_obj->address_space.handler); acpi_os_printf(" Device Name: %s (%p)\n", pathname, node); handler_obj = handler_obj->address_space.next; } ACPI_FREE(pathname); return (AE_OK); } |