sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / acpi / acpica / dbdisply.c
blob502bb587f1128a8a2e37194aed9e581be29f3f99
1 /*******************************************************************************
3 * Module Name: dbdisply - debug display commands
5 ******************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2016, Intel Corp.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
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.
30 * NO WARRANTY
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>
45 #include "accommon.h"
46 #include "amlcode.h"
47 #include "acdispat.h"
48 #include "acnamesp.h"
49 #include "acparser.h"
50 #include "acinterp.h"
51 #include "acevents.h"
52 #include "acdebug.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);
62 static acpi_status
63 acpi_db_display_non_root_handlers(acpi_handle obj_handle,
64 u32 nesting_level,
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,
83 ACPI_ADR_SPACE_EC,
84 ACPI_ADR_SPACE_SMBUS,
85 ACPI_ADR_SPACE_CMOS,
86 ACPI_ADR_SPACE_PCI_BAR_TARGET,
87 ACPI_ADR_SPACE_IPMI,
88 ACPI_ADR_SPACE_GPIO,
89 ACPI_ADR_SPACE_GSBUS,
90 ACPI_ADR_SPACE_DATA_TABLE,
91 ACPI_ADR_SPACE_FIXED_HARDWARE
94 /* Global handler information */
96 typedef struct acpi_handler_info {
97 void *handler;
98 char *name;
100 } 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)
124 void *obj_ptr;
125 acpi_size address;
127 address = strtoul(target, NULL, 16);
128 obj_ptr = ACPI_TO_POINTER(address);
129 return (obj_ptr);
132 /*******************************************************************************
134 * FUNCTION: acpi_db_dump_parser_descriptor
136 * PARAMETERS: op - A parser Op descriptor
138 * RETURN: None
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",
154 info->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)
169 * RETURN: None
171 * DESCRIPTION: Display a formatted ACPI object
173 ******************************************************************************/
175 void acpi_db_decode_and_display_object(char *target, char *output_type)
177 void *obj_ptr;
178 struct acpi_namespace_node *node;
179 union acpi_operand_object *obj_desc;
180 u32 display = DB_BYTE_DISPLAY;
181 char buffer[80];
182 struct acpi_buffer ret_buf;
183 acpi_status status;
184 u32 size;
186 if (!target) {
187 return;
190 /* Decode the output type */
192 if (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)) {
211 acpi_os_printf
212 ("Address %p is invalid in this address space\n",
213 obj_ptr);
214 return;
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))) {
226 acpi_os_printf
227 ("Cannot read entire Named object at address %p\n",
228 obj_ptr);
229 return;
232 node = obj_ptr;
233 goto dump_node;
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))) {
241 acpi_os_printf
242 ("Cannot read entire ACPI object at address %p\n",
243 obj_ptr);
244 return;
247 acpi_ut_debug_dump_buffer(obj_ptr,
248 sizeof(union
249 acpi_operand_object),
250 display, ACPI_UINT32_MAX);
251 acpi_ex_dump_object_descriptor(obj_ptr, 1);
252 break;
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))) {
260 acpi_os_printf
261 ("Cannot read entire Parser object at address %p\n",
262 obj_ptr);
263 return;
266 acpi_ut_debug_dump_buffer(obj_ptr,
267 sizeof(union
268 acpi_parse_object),
269 display, ACPI_UINT32_MAX);
270 acpi_db_dump_parser_descriptor((union acpi_parse_object
271 *)obj_ptr);
272 break;
274 default:
276 /* Is not a recognizeable object */
278 acpi_os_printf
279 ("Not a known ACPI internal object, descriptor type %2.2X\n",
280 ACPI_GET_DESCRIPTOR_TYPE(obj_ptr));
282 size = 16;
283 if (acpi_os_readable(obj_ptr, 64)) {
284 size = 64;
287 /* Just dump some memory */
289 acpi_ut_debug_dump_buffer(obj_ptr, size, display,
290 ACPI_UINT32_MAX);
291 break;
294 return;
297 /* The parameter is a name string that must be resolved to a Named obj */
299 node = acpi_db_local_ns_lookup(target);
300 if (!node) {
301 return;
304 dump_node:
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");
312 else {
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);
319 return;
322 acpi_ut_debug_dump_buffer((void *)node,
323 sizeof(struct acpi_namespace_node), display,
324 ACPI_UINT32_MAX);
325 acpi_ex_dump_namespace_node(node, 1);
327 obj_desc = acpi_ns_get_attached_object(node);
328 if (obj_desc) {
329 acpi_os_printf("\nAttached Object (%p):\n", obj_desc);
330 if (!acpi_os_readable
331 (obj_desc, sizeof(union acpi_operand_object))) {
332 acpi_os_printf
333 ("Invalid internal ACPI Object at address %p\n",
334 obj_desc);
335 return;
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
351 * RETURN: None
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;
365 u32 num_ops = 0;
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);
374 if (!walk_state) {
375 acpi_os_printf("There is no method currently executing\n");
376 return;
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);
388 root_op = start_op;
389 while (root_op->common.parent) {
390 root_op = root_op->common.parent;
393 op = root_op;
395 while (op) {
396 if (op == start_op) {
397 count_remaining = TRUE;
400 num_ops++;
401 if (count_remaining) {
402 num_remaining_ops++;
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++;
415 num_operands++;
416 break;
418 case AML_CLASS_UNKNOWN:
420 /* Bad opcode or ASCII character */
422 continue;
424 default:
426 if (count_remaining) {
427 num_remaining_operators++;
430 num_operators++;
431 break;
434 op = acpi_ps_get_depth_next(start_op, op);
437 acpi_os_printf
438 ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
439 num_ops, num_operators, num_operands);
441 acpi_os_printf
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
451 * PARAMETERS: None
453 * RETURN: None
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);
464 if (!walk_state) {
465 acpi_os_printf("There is no method currently executing\n");
466 return;
469 acpi_db_decode_locals(walk_state);
472 /*******************************************************************************
474 * FUNCTION: acpi_db_display_arguments
476 * PARAMETERS: None
478 * RETURN: None
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);
489 if (!walk_state) {
490 acpi_os_printf("There is no method currently executing\n");
491 return;
494 acpi_db_decode_arguments(walk_state);
497 /*******************************************************************************
499 * FUNCTION: acpi_db_display_results
501 * PARAMETERS: None
503 * RETURN: None
505 * DESCRIPTION: Display current contents of a method result stack
507 ******************************************************************************/
509 void acpi_db_display_results(void)
511 u32 i;
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);
520 if (!walk_state) {
521 acpi_os_printf("There is no method currently executing\n");
522 return;
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);
545 if (index == 0) {
546 frame = frame->results.next;
547 index = ACPI_RESULTS_FRAME_OBJ_NUM;
550 index--;
554 /*******************************************************************************
556 * FUNCTION: acpi_db_display_calling_tree
558 * PARAMETERS: None
560 * RETURN: None
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);
572 if (!walk_state) {
573 acpi_os_printf("There is no method currently executing\n");
574 return;
577 node = walk_state->method_node;
578 acpi_os_printf("Current Control Method Call Tree\n");
580 while (walk_state) {
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
594 * RETURN: None
596 * DESCRIPTION: Display type of an arbitrary NS node
598 ******************************************************************************/
600 void acpi_db_display_object_type(char *object_arg)
602 acpi_size arg;
603 acpi_handle handle;
604 struct acpi_device_info *info;
605 acpi_status status;
606 u32 i;
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));
615 return;
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);
646 ACPI_FREE(info);
649 /*******************************************************************************
651 * FUNCTION: acpi_db_display_result_object
653 * PARAMETERS: obj_desc - Object to be displayed
654 * walk_state - Current walk state
656 * RETURN: None
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 ******************************************************************************/
666 void
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()) {
673 return;
675 #endif
677 /* Only display if single stepping */
679 if (!acpi_gbl_cm_single_step) {
680 return;
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
695 * RETURN: None
697 * DESCRIPTION: Display the result of an AML opcode
699 ******************************************************************************/
701 void
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()) {
708 return;
710 #endif
712 if (!acpi_gbl_cm_single_step) {
713 return;
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
725 * PARAMETERS: None
727 * RETURN: None
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;
739 char *gpe_type;
740 struct acpi_gpe_notify_info *notify;
741 u32 gpe_index;
742 u32 block = 0;
743 u32 i;
744 u32 j;
745 u32 count;
746 char buffer[80];
747 struct acpi_buffer ret_buf;
748 acpi_status status;
750 ret_buf.length = sizeof(buffer);
751 ret_buf.pointer = buffer;
753 block = 0;
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;
760 while (gpe_block) {
761 status = acpi_get_name(gpe_block->node,
762 ACPI_FULL_PATHNAME_NO_TRAILING,
763 &ret_buf);
764 if (ACPI_FAILURE(status)) {
765 acpi_os_printf
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";
771 } else {
772 gpe_type = "GPE Block Device";
775 acpi_os_printf
776 ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
777 block, gpe_block, gpe_block->node, buffer,
778 gpe_type);
780 acpi_os_printf(" Registers: %u (%u GPEs)\n",
781 gpe_block->register_count,
782 gpe_block->gpe_count);
784 acpi_os_printf
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);
791 acpi_os_printf
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++) {
805 gpe_register_info =
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",
812 gpe_register_info->
813 base_gpe_number,
814 gpe_register_info->
815 base_gpe_number +
816 (ACPI_GPE_REGISTER_WIDTH - 1),
817 gpe_register_info->
818 enable_for_run,
819 gpe_register_info->
820 enable_for_wake,
821 ACPI_FORMAT_UINT64
822 (gpe_register_info->
823 status_address.address),
824 ACPI_FORMAT_UINT64
825 (gpe_register_info->
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++) {
831 gpe_index =
832 (i * ACPI_GPE_REGISTER_WIDTH) + j;
833 gpe_event_info =
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 */
842 continue;
845 acpi_os_printf
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 */
854 if (gpe_event_info->
855 flags & ACPI_GPE_LEVEL_TRIGGERED) {
856 acpi_os_printf("Level, ");
857 } else {
858 acpi_os_printf("Edge, ");
861 if (gpe_event_info->
862 flags & ACPI_GPE_CAN_WAKE) {
863 acpi_os_printf("CanWake, ");
864 } else {
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");
873 break;
875 case ACPI_GPE_DISPATCH_METHOD:
877 acpi_os_printf("Method");
878 break;
880 case ACPI_GPE_DISPATCH_HANDLER:
882 acpi_os_printf("Handler");
883 break;
885 case ACPI_GPE_DISPATCH_NOTIFY:
887 count = 0;
888 notify =
889 gpe_event_info->dispatch.
890 notify_list;
891 while (notify) {
892 count++;
893 notify = notify->next;
896 acpi_os_printf
897 ("Implicit Notify on %u devices",
898 count);
899 break;
901 case ACPI_GPE_DISPATCH_RAW_HANDLER:
903 acpi_os_printf("RawHandler");
904 break;
906 default:
908 acpi_os_printf("UNKNOWN: %X",
909 ACPI_GPE_DISPATCH_TYPE
910 (gpe_event_info->
911 flags));
912 break;
915 acpi_os_printf(")\n");
919 block++;
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
932 * PARAMETERS: None
934 * RETURN: None
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;
945 u32 i;
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);
952 if (obj_desc) {
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),
958 space_id);
960 handler_obj =
961 acpi_ev_find_region_handler(space_id,
962 obj_desc->common_notify.
963 handler);
964 if (handler_obj) {
965 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING,
966 (handler_obj->address_space.
967 handler_flags &
968 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
969 ? "Default" : "User",
970 handler_obj->address_space.
971 handler);
973 goto found_handler;
976 /* There is no handler for this space_id */
978 acpi_os_printf("None\n");
980 found_handler: ;
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,
990 "User-defined ID",
991 handler_obj->address_space.
992 space_id);
993 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING,
994 (handler_obj->address_space.
995 handler_flags &
996 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
997 ? "Default" : "User",
998 handler_obj->address_space.
999 handler);
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].
1017 handler);
1018 } else {
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);
1036 } else {
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,
1046 ACPI_UINT32_MAX,
1047 acpi_db_display_non_root_handlers, NULL, NULL,
1048 NULL);
1051 /*******************************************************************************
1053 * FUNCTION: acpi_db_display_non_root_handlers
1055 * PARAMETERS: acpi_walk_callback
1057 * RETURN: Status
1059 * DESCRIPTION: Display information about all handlers installed for a
1060 * device object.
1062 ******************************************************************************/
1064 static acpi_status
1065 acpi_db_display_non_root_handlers(acpi_handle obj_handle,
1066 u32 nesting_level,
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;
1073 char *pathname;
1075 obj_desc = acpi_ns_get_attached_object(node);
1076 if (!obj_desc) {
1077 return (AE_OK);
1080 pathname = acpi_ns_get_normalized_pathname(node, TRUE);
1081 if (!pathname) {
1082 return (AE_OK);
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);
1105 return (AE_OK);