1 /*******************************************************************************
3 * Module Name: dbdisply - debug display commands
5 ******************************************************************************/
8 * Copyright (C) 2000 - 2016, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #include <acpi/acpi.h>
54 #define _COMPONENT ACPI_CA_DEBUGGER
55 ACPI_MODULE_NAME("dbdisply")
57 /* Local prototypes */
58 static void acpi_db_dump_parser_descriptor(union acpi_parse_object
*op
);
60 static void *acpi_db_get_pointer(void *target
);
63 acpi_db_display_non_root_handlers(acpi_handle obj_handle
,
65 void *context
, void **return_value
);
68 * System handler information.
69 * Used for Handlers command, in acpi_db_display_handlers.
71 #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
72 #define ACPI_HANDLER_NAME_STRING "%30s : "
73 #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
74 #define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)"
75 #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
77 /* All predefined Address Space IDs */
79 static acpi_adr_space_type acpi_gbl_space_id_list
[] = {
80 ACPI_ADR_SPACE_SYSTEM_MEMORY
,
81 ACPI_ADR_SPACE_SYSTEM_IO
,
82 ACPI_ADR_SPACE_PCI_CONFIG
,
86 ACPI_ADR_SPACE_PCI_BAR_TARGET
,
90 ACPI_ADR_SPACE_DATA_TABLE
,
91 ACPI_ADR_SPACE_FIXED_HARDWARE
94 /* Global handler information */
96 typedef struct acpi_handler_info
{
102 static struct acpi_handler_info acpi_gbl_handler_list
[] = {
103 {&acpi_gbl_global_notify
[0].handler
, "System Notifications"},
104 {&acpi_gbl_global_notify
[1].handler
, "Device Notifications"},
105 {&acpi_gbl_table_handler
, "ACPI Table Events"},
106 {&acpi_gbl_exception_handler
, "Control Method Exceptions"},
107 {&acpi_gbl_interface_handler
, "OSI Invocations"}
110 /*******************************************************************************
112 * FUNCTION: acpi_db_get_pointer
114 * PARAMETERS: target - Pointer to string to be converted
116 * RETURN: Converted pointer
118 * DESCRIPTION: Convert an ascii pointer value to a real value
120 ******************************************************************************/
122 static void *acpi_db_get_pointer(void *target
)
127 address
= strtoul(target
, NULL
, 16);
128 obj_ptr
= ACPI_TO_POINTER(address
);
132 /*******************************************************************************
134 * FUNCTION: acpi_db_dump_parser_descriptor
136 * PARAMETERS: op - A parser Op descriptor
140 * DESCRIPTION: Display a formatted parser object
142 ******************************************************************************/
144 static void acpi_db_dump_parser_descriptor(union acpi_parse_object
*op
)
146 const struct acpi_opcode_info
*info
;
148 info
= acpi_ps_get_opcode_info(op
->common
.aml_opcode
);
150 acpi_os_printf("Parser Op Descriptor:\n");
151 acpi_os_printf("%20.20s : %4.4X\n", "Opcode", op
->common
.aml_opcode
);
153 ACPI_DEBUG_ONLY_MEMBERS(acpi_os_printf("%20.20s : %s\n", "Opcode Name",
156 acpi_os_printf("%20.20s : %p\n", "Value/ArgList", op
->common
.value
.arg
);
157 acpi_os_printf("%20.20s : %p\n", "Parent", op
->common
.parent
);
158 acpi_os_printf("%20.20s : %p\n", "NextOp", op
->common
.next
);
161 /*******************************************************************************
163 * FUNCTION: acpi_db_decode_and_display_object
165 * PARAMETERS: target - String with object to be displayed. Names
166 * and hex pointers are supported.
167 * output_type - Byte, Word, Dword, or Qword (B|W|D|Q)
171 * DESCRIPTION: Display a formatted ACPI object
173 ******************************************************************************/
175 void acpi_db_decode_and_display_object(char *target
, char *output_type
)
178 struct acpi_namespace_node
*node
;
179 union acpi_operand_object
*obj_desc
;
180 u32 display
= DB_BYTE_DISPLAY
;
182 struct acpi_buffer ret_buf
;
190 /* Decode the output type */
193 acpi_ut_strupr(output_type
);
194 if (output_type
[0] == 'W') {
195 display
= DB_WORD_DISPLAY
;
196 } else if (output_type
[0] == 'D') {
197 display
= DB_DWORD_DISPLAY
;
198 } else if (output_type
[0] == 'Q') {
199 display
= DB_QWORD_DISPLAY
;
203 ret_buf
.length
= sizeof(buffer
);
204 ret_buf
.pointer
= buffer
;
206 /* Differentiate between a number and a name */
208 if ((target
[0] >= 0x30) && (target
[0] <= 0x39)) {
209 obj_ptr
= acpi_db_get_pointer(target
);
210 if (!acpi_os_readable(obj_ptr
, 16)) {
212 ("Address %p is invalid in this address space\n",
217 /* Decode the object type */
219 switch (ACPI_GET_DESCRIPTOR_TYPE(obj_ptr
)) {
220 case ACPI_DESC_TYPE_NAMED
:
222 /* This is a namespace Node */
224 if (!acpi_os_readable
225 (obj_ptr
, sizeof(struct acpi_namespace_node
))) {
227 ("Cannot read entire Named object at address %p\n",
235 case ACPI_DESC_TYPE_OPERAND
:
237 /* This is a ACPI OPERAND OBJECT */
239 if (!acpi_os_readable
240 (obj_ptr
, sizeof(union acpi_operand_object
))) {
242 ("Cannot read entire ACPI object at address %p\n",
247 acpi_ut_debug_dump_buffer(obj_ptr
,
249 acpi_operand_object
),
250 display
, ACPI_UINT32_MAX
);
251 acpi_ex_dump_object_descriptor(obj_ptr
, 1);
254 case ACPI_DESC_TYPE_PARSER
:
256 /* This is a Parser Op object */
258 if (!acpi_os_readable
259 (obj_ptr
, sizeof(union acpi_parse_object
))) {
261 ("Cannot read entire Parser object at address %p\n",
266 acpi_ut_debug_dump_buffer(obj_ptr
,
269 display
, ACPI_UINT32_MAX
);
270 acpi_db_dump_parser_descriptor((union acpi_parse_object
276 /* Is not a recognizeable object */
279 ("Not a known ACPI internal object, descriptor type %2.2X\n",
280 ACPI_GET_DESCRIPTOR_TYPE(obj_ptr
));
283 if (acpi_os_readable(obj_ptr
, 64)) {
287 /* Just dump some memory */
289 acpi_ut_debug_dump_buffer(obj_ptr
, size
, display
,
297 /* The parameter is a name string that must be resolved to a Named obj */
299 node
= acpi_db_local_ns_lookup(target
);
305 /* Now dump the NS node */
307 status
= acpi_get_name(node
, ACPI_FULL_PATHNAME_NO_TRAILING
, &ret_buf
);
308 if (ACPI_FAILURE(status
)) {
309 acpi_os_printf("Could not convert name to pathname\n");
313 acpi_os_printf("Object (%p) Pathname: %s\n",
314 node
, (char *)ret_buf
.pointer
);
317 if (!acpi_os_readable(node
, sizeof(struct acpi_namespace_node
))) {
318 acpi_os_printf("Invalid Named object at address %p\n", node
);
322 acpi_ut_debug_dump_buffer((void *)node
,
323 sizeof(struct acpi_namespace_node
), display
,
325 acpi_ex_dump_namespace_node(node
, 1);
327 obj_desc
= acpi_ns_get_attached_object(node
);
329 acpi_os_printf("\nAttached Object (%p):\n", obj_desc
);
330 if (!acpi_os_readable
331 (obj_desc
, sizeof(union acpi_operand_object
))) {
333 ("Invalid internal ACPI Object at address %p\n",
338 acpi_ut_debug_dump_buffer((void *)obj_desc
,
339 sizeof(union acpi_operand_object
),
340 display
, ACPI_UINT32_MAX
);
341 acpi_ex_dump_object_descriptor(obj_desc
, 1);
345 /*******************************************************************************
347 * FUNCTION: acpi_db_display_method_info
349 * PARAMETERS: start_op - Root of the control method parse tree
353 * DESCRIPTION: Display information about the current method
355 ******************************************************************************/
357 void acpi_db_display_method_info(union acpi_parse_object
*start_op
)
359 struct acpi_walk_state
*walk_state
;
360 union acpi_operand_object
*obj_desc
;
361 struct acpi_namespace_node
*node
;
362 union acpi_parse_object
*root_op
;
363 union acpi_parse_object
*op
;
364 const struct acpi_opcode_info
*op_info
;
366 u32 num_operands
= 0;
367 u32 num_operators
= 0;
368 u32 num_remaining_ops
= 0;
369 u32 num_remaining_operands
= 0;
370 u32 num_remaining_operators
= 0;
371 u8 count_remaining
= FALSE
;
373 walk_state
= acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list
);
375 acpi_os_printf("There is no method currently executing\n");
379 obj_desc
= walk_state
->method_desc
;
380 node
= walk_state
->method_node
;
382 acpi_os_printf("Currently executing control method is [%4.4s]\n",
383 acpi_ut_get_node_name(node
));
384 acpi_os_printf("%X Arguments, SyncLevel = %X\n",
385 (u32
)obj_desc
->method
.param_count
,
386 (u32
)obj_desc
->method
.sync_level
);
389 while (root_op
->common
.parent
) {
390 root_op
= root_op
->common
.parent
;
396 if (op
== start_op
) {
397 count_remaining
= TRUE
;
401 if (count_remaining
) {
405 /* Decode the opcode */
407 op_info
= acpi_ps_get_opcode_info(op
->common
.aml_opcode
);
408 switch (op_info
->class) {
409 case AML_CLASS_ARGUMENT
:
411 if (count_remaining
) {
412 num_remaining_operands
++;
418 case AML_CLASS_UNKNOWN
:
420 /* Bad opcode or ASCII character */
426 if (count_remaining
) {
427 num_remaining_operators
++;
434 op
= acpi_ps_get_depth_next(start_op
, op
);
438 ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
439 num_ops
, num_operators
, num_operands
);
442 ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
443 num_remaining_ops
, num_remaining_operators
,
444 num_remaining_operands
);
447 /*******************************************************************************
449 * FUNCTION: acpi_db_display_locals
455 * DESCRIPTION: Display all locals for the currently running control method
457 ******************************************************************************/
459 void acpi_db_display_locals(void)
461 struct acpi_walk_state
*walk_state
;
463 walk_state
= acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list
);
465 acpi_os_printf("There is no method currently executing\n");
469 acpi_db_decode_locals(walk_state
);
472 /*******************************************************************************
474 * FUNCTION: acpi_db_display_arguments
480 * DESCRIPTION: Display all arguments for the currently running control method
482 ******************************************************************************/
484 void acpi_db_display_arguments(void)
486 struct acpi_walk_state
*walk_state
;
488 walk_state
= acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list
);
490 acpi_os_printf("There is no method currently executing\n");
494 acpi_db_decode_arguments(walk_state
);
497 /*******************************************************************************
499 * FUNCTION: acpi_db_display_results
505 * DESCRIPTION: Display current contents of a method result stack
507 ******************************************************************************/
509 void acpi_db_display_results(void)
512 struct acpi_walk_state
*walk_state
;
513 union acpi_operand_object
*obj_desc
;
514 u32 result_count
= 0;
515 struct acpi_namespace_node
*node
;
516 union acpi_generic_state
*frame
;
517 u32 index
; /* Index onto current frame */
519 walk_state
= acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list
);
521 acpi_os_printf("There is no method currently executing\n");
525 obj_desc
= walk_state
->method_desc
;
526 node
= walk_state
->method_node
;
528 if (walk_state
->results
) {
529 result_count
= walk_state
->result_count
;
532 acpi_os_printf("Method [%4.4s] has %X stacked result objects\n",
533 acpi_ut_get_node_name(node
), result_count
);
535 /* From the top element of result stack */
537 frame
= walk_state
->results
;
538 index
= (result_count
- 1) % ACPI_RESULTS_FRAME_OBJ_NUM
;
540 for (i
= 0; i
< result_count
; i
++) {
541 obj_desc
= frame
->results
.obj_desc
[index
];
542 acpi_os_printf("Result%u: ", i
);
543 acpi_db_display_internal_object(obj_desc
, walk_state
);
546 frame
= frame
->results
.next
;
547 index
= ACPI_RESULTS_FRAME_OBJ_NUM
;
554 /*******************************************************************************
556 * FUNCTION: acpi_db_display_calling_tree
562 * DESCRIPTION: Display current calling tree of nested control methods
564 ******************************************************************************/
566 void acpi_db_display_calling_tree(void)
568 struct acpi_walk_state
*walk_state
;
569 struct acpi_namespace_node
*node
;
571 walk_state
= acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list
);
573 acpi_os_printf("There is no method currently executing\n");
577 node
= walk_state
->method_node
;
578 acpi_os_printf("Current Control Method Call Tree\n");
581 node
= walk_state
->method_node
;
582 acpi_os_printf(" [%4.4s]\n", acpi_ut_get_node_name(node
));
584 walk_state
= walk_state
->next
;
588 /*******************************************************************************
590 * FUNCTION: acpi_db_display_object_type
592 * PARAMETERS: object_arg - User entered NS node handle
596 * DESCRIPTION: Display type of an arbitrary NS node
598 ******************************************************************************/
600 void acpi_db_display_object_type(char *object_arg
)
604 struct acpi_device_info
*info
;
608 arg
= strtoul(object_arg
, NULL
, 16);
609 handle
= ACPI_TO_POINTER(arg
);
611 status
= acpi_get_object_info(handle
, &info
);
612 if (ACPI_FAILURE(status
)) {
613 acpi_os_printf("Could not get object info, %s\n",
614 acpi_format_exception(status
));
618 acpi_os_printf("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
619 ACPI_FORMAT_UINT64(info
->address
),
620 info
->current_status
, info
->flags
);
622 acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
623 info
->highest_dstates
[0], info
->highest_dstates
[1],
624 info
->highest_dstates
[2], info
->highest_dstates
[3]);
626 acpi_os_printf("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
627 info
->lowest_dstates
[0], info
->lowest_dstates
[1],
628 info
->lowest_dstates
[2], info
->lowest_dstates
[3],
629 info
->lowest_dstates
[4]);
631 if (info
->valid
& ACPI_VALID_HID
) {
632 acpi_os_printf("HID: %s\n", info
->hardware_id
.string
);
635 if (info
->valid
& ACPI_VALID_UID
) {
636 acpi_os_printf("UID: %s\n", info
->unique_id
.string
);
639 if (info
->valid
& ACPI_VALID_CID
) {
640 for (i
= 0; i
< info
->compatible_id_list
.count
; i
++) {
641 acpi_os_printf("CID %u: %s\n", i
,
642 info
->compatible_id_list
.ids
[i
].string
);
649 /*******************************************************************************
651 * FUNCTION: acpi_db_display_result_object
653 * PARAMETERS: obj_desc - Object to be displayed
654 * walk_state - Current walk state
658 * DESCRIPTION: Display the result of an AML opcode
660 * Note: Curently only displays the result object if we are single stepping.
661 * However, this output may be useful in other contexts and could be enabled
662 * to do so if needed.
664 ******************************************************************************/
667 acpi_db_display_result_object(union acpi_operand_object
*obj_desc
,
668 struct acpi_walk_state
*walk_state
)
671 #ifndef ACPI_APPLICATION
672 if (acpi_gbl_db_thread_id
!= acpi_os_get_thread_id()) {
677 /* Only display if single stepping */
679 if (!acpi_gbl_cm_single_step
) {
683 acpi_os_printf("ResultObj: ");
684 acpi_db_display_internal_object(obj_desc
, walk_state
);
685 acpi_os_printf("\n");
688 /*******************************************************************************
690 * FUNCTION: acpi_db_display_argument_object
692 * PARAMETERS: obj_desc - Object to be displayed
693 * walk_state - Current walk state
697 * DESCRIPTION: Display the result of an AML opcode
699 ******************************************************************************/
702 acpi_db_display_argument_object(union acpi_operand_object
*obj_desc
,
703 struct acpi_walk_state
*walk_state
)
706 #ifndef ACPI_APPLICATION
707 if (acpi_gbl_db_thread_id
!= acpi_os_get_thread_id()) {
712 if (!acpi_gbl_cm_single_step
) {
716 acpi_os_printf("ArgObj: ");
717 acpi_db_display_internal_object(obj_desc
, walk_state
);
720 #if (!ACPI_REDUCED_HARDWARE)
721 /*******************************************************************************
723 * FUNCTION: acpi_db_display_gpes
729 * DESCRIPTION: Display the current GPE structures
731 ******************************************************************************/
733 void acpi_db_display_gpes(void)
735 struct acpi_gpe_block_info
*gpe_block
;
736 struct acpi_gpe_xrupt_info
*gpe_xrupt_info
;
737 struct acpi_gpe_event_info
*gpe_event_info
;
738 struct acpi_gpe_register_info
*gpe_register_info
;
740 struct acpi_gpe_notify_info
*notify
;
747 struct acpi_buffer ret_buf
;
750 ret_buf
.length
= sizeof(buffer
);
751 ret_buf
.pointer
= buffer
;
755 /* Walk the GPE lists */
757 gpe_xrupt_info
= acpi_gbl_gpe_xrupt_list_head
;
758 while (gpe_xrupt_info
) {
759 gpe_block
= gpe_xrupt_info
->gpe_block_list_head
;
761 status
= acpi_get_name(gpe_block
->node
,
762 ACPI_FULL_PATHNAME_NO_TRAILING
,
764 if (ACPI_FAILURE(status
)) {
766 ("Could not convert name to pathname\n");
769 if (gpe_block
->node
== acpi_gbl_fadt_gpe_device
) {
770 gpe_type
= "FADT-defined GPE block";
772 gpe_type
= "GPE Block Device";
776 ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
777 block
, gpe_block
, gpe_block
->node
, buffer
,
780 acpi_os_printf(" Registers: %u (%u GPEs)\n",
781 gpe_block
->register_count
,
782 gpe_block
->gpe_count
);
785 (" GPE range: 0x%X to 0x%X on interrupt %u\n",
786 gpe_block
->block_base_number
,
787 gpe_block
->block_base_number
+
788 (gpe_block
->gpe_count
- 1),
789 gpe_xrupt_info
->interrupt_number
);
792 (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
793 gpe_block
->register_info
,
794 ACPI_FORMAT_UINT64(gpe_block
->register_info
->
795 status_address
.address
),
796 ACPI_FORMAT_UINT64(gpe_block
->register_info
->
797 enable_address
.address
));
799 acpi_os_printf(" EventInfo: %p\n",
800 gpe_block
->event_info
);
802 /* Examine each GPE Register within the block */
804 for (i
= 0; i
< gpe_block
->register_count
; i
++) {
806 &gpe_block
->register_info
[i
];
808 acpi_os_printf(" Reg %u: (GPE %.2X-%.2X) "
809 "RunEnable %2.2X WakeEnable %2.2X"
810 " Status %8.8X%8.8X Enable %8.8X%8.8X\n",
816 (ACPI_GPE_REGISTER_WIDTH
- 1),
823 status_address
.address
),
826 enable_address
.address
));
828 /* Now look at the individual GPEs in this byte register */
830 for (j
= 0; j
< ACPI_GPE_REGISTER_WIDTH
; j
++) {
832 (i
* ACPI_GPE_REGISTER_WIDTH
) + j
;
834 &gpe_block
->event_info
[gpe_index
];
836 if (ACPI_GPE_DISPATCH_TYPE
837 (gpe_event_info
->flags
) ==
838 ACPI_GPE_DISPATCH_NONE
) {
840 /* This GPE is not used (no method or handler), ignore it */
846 (" GPE %.2X: %p RunRefs %2.2X Flags %2.2X (",
847 gpe_block
->block_base_number
+
848 gpe_index
, gpe_event_info
,
849 gpe_event_info
->runtime_count
,
850 gpe_event_info
->flags
);
852 /* Decode the flags byte */
855 flags
& ACPI_GPE_LEVEL_TRIGGERED
) {
856 acpi_os_printf("Level, ");
858 acpi_os_printf("Edge, ");
862 flags
& ACPI_GPE_CAN_WAKE
) {
863 acpi_os_printf("CanWake, ");
865 acpi_os_printf("RunOnly, ");
868 switch (ACPI_GPE_DISPATCH_TYPE
869 (gpe_event_info
->flags
)) {
870 case ACPI_GPE_DISPATCH_NONE
:
872 acpi_os_printf("NotUsed");
875 case ACPI_GPE_DISPATCH_METHOD
:
877 acpi_os_printf("Method");
880 case ACPI_GPE_DISPATCH_HANDLER
:
882 acpi_os_printf("Handler");
885 case ACPI_GPE_DISPATCH_NOTIFY
:
889 gpe_event_info
->dispatch
.
893 notify
= notify
->next
;
897 ("Implicit Notify on %u devices",
901 case ACPI_GPE_DISPATCH_RAW_HANDLER
:
903 acpi_os_printf("RawHandler");
908 acpi_os_printf("UNKNOWN: %X",
909 ACPI_GPE_DISPATCH_TYPE
915 acpi_os_printf(")\n");
920 gpe_block
= gpe_block
->next
;
923 gpe_xrupt_info
= gpe_xrupt_info
->next
;
926 #endif /* !ACPI_REDUCED_HARDWARE */
928 /*******************************************************************************
930 * FUNCTION: acpi_db_display_handlers
936 * DESCRIPTION: Display the currently installed global handlers
938 ******************************************************************************/
940 void acpi_db_display_handlers(void)
942 union acpi_operand_object
*obj_desc
;
943 union acpi_operand_object
*handler_obj
;
944 acpi_adr_space_type space_id
;
947 /* Operation region handlers */
949 acpi_os_printf("\nOperation Region Handlers at the namespace root:\n");
951 obj_desc
= acpi_ns_get_attached_object(acpi_gbl_root_node
);
953 for (i
= 0; i
< ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list
); i
++) {
954 space_id
= acpi_gbl_space_id_list
[i
];
956 acpi_os_printf(ACPI_PREDEFINED_PREFIX
,
957 acpi_ut_get_region_name((u8
)space_id
),
961 acpi_ev_find_region_handler(space_id
,
962 obj_desc
->common_notify
.
965 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING
,
966 (handler_obj
->address_space
.
968 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED
)
969 ? "Default" : "User",
970 handler_obj
->address_space
.
976 /* There is no handler for this space_id */
978 acpi_os_printf("None\n");
983 /* Find all handlers for user-defined space_IDs */
985 handler_obj
= obj_desc
->common_notify
.handler
;
986 while (handler_obj
) {
987 if (handler_obj
->address_space
.space_id
>=
988 ACPI_USER_REGION_BEGIN
) {
989 acpi_os_printf(ACPI_PREDEFINED_PREFIX
,
991 handler_obj
->address_space
.
993 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING
,
994 (handler_obj
->address_space
.
996 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED
)
997 ? "Default" : "User",
998 handler_obj
->address_space
.
1002 handler_obj
= handler_obj
->address_space
.next
;
1005 #if (!ACPI_REDUCED_HARDWARE)
1007 /* Fixed event handlers */
1009 acpi_os_printf("\nFixed Event Handlers:\n");
1011 for (i
= 0; i
< ACPI_NUM_FIXED_EVENTS
; i
++) {
1012 acpi_os_printf(ACPI_PREDEFINED_PREFIX
,
1013 acpi_ut_get_event_name(i
), i
);
1014 if (acpi_gbl_fixed_event_handlers
[i
].handler
) {
1015 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING
, "User",
1016 acpi_gbl_fixed_event_handlers
[i
].
1019 acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING
, "None");
1023 #endif /* !ACPI_REDUCED_HARDWARE */
1025 /* Miscellaneous global handlers */
1027 acpi_os_printf("\nMiscellaneous Global Handlers:\n");
1029 for (i
= 0; i
< ACPI_ARRAY_LENGTH(acpi_gbl_handler_list
); i
++) {
1030 acpi_os_printf(ACPI_HANDLER_NAME_STRING
,
1031 acpi_gbl_handler_list
[i
].name
);
1033 if (acpi_gbl_handler_list
[i
].handler
) {
1034 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING
, "User",
1035 acpi_gbl_handler_list
[i
].handler
);
1037 acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING
, "None");
1041 /* Other handlers that are installed throughout the namespace */
1043 acpi_os_printf("\nOperation Region Handlers for specific devices:\n");
1045 (void)acpi_walk_namespace(ACPI_TYPE_DEVICE
, ACPI_ROOT_OBJECT
,
1047 acpi_db_display_non_root_handlers
, NULL
, NULL
,
1051 /*******************************************************************************
1053 * FUNCTION: acpi_db_display_non_root_handlers
1055 * PARAMETERS: acpi_walk_callback
1059 * DESCRIPTION: Display information about all handlers installed for a
1062 ******************************************************************************/
1065 acpi_db_display_non_root_handlers(acpi_handle obj_handle
,
1067 void *context
, void **return_value
)
1069 struct acpi_namespace_node
*node
=
1070 ACPI_CAST_PTR(struct acpi_namespace_node
, obj_handle
);
1071 union acpi_operand_object
*obj_desc
;
1072 union acpi_operand_object
*handler_obj
;
1075 obj_desc
= acpi_ns_get_attached_object(node
);
1080 pathname
= acpi_ns_get_normalized_pathname(node
, TRUE
);
1085 /* Display all handlers associated with this device */
1087 handler_obj
= obj_desc
->common_notify
.handler
;
1088 while (handler_obj
) {
1089 acpi_os_printf(ACPI_PREDEFINED_PREFIX
,
1090 acpi_ut_get_region_name((u8
)handler_obj
->
1091 address_space
.space_id
),
1092 handler_obj
->address_space
.space_id
);
1094 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING2
,
1095 (handler_obj
->address_space
.handler_flags
&
1096 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED
) ? "Default"
1097 : "User", handler_obj
->address_space
.handler
);
1099 acpi_os_printf(" Device Name: %s (%p)\n", pathname
, node
);
1101 handler_obj
= handler_obj
->address_space
.next
;
1104 ACPI_FREE(pathname
);