s390/ptrace: get rid of long longs in psw_bits
[linux/fpc-iii.git] / drivers / acpi / acpica / dbdisply.c
blob672977ec7c7df275fa174b84c14f544892250d8e
1 /*******************************************************************************
3 * Module Name: dbdisply - debug display commands
5 ******************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2015, 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 "acdebug.h"
53 #define _COMPONENT ACPI_CA_DEBUGGER
54 ACPI_MODULE_NAME("dbdisply")
56 /* Local prototypes */
57 static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op);
59 static void *acpi_db_get_pointer(void *target);
61 static acpi_status
62 acpi_db_display_non_root_handlers(acpi_handle obj_handle,
63 u32 nesting_level,
64 void *context, void **return_value);
67 * System handler information.
68 * Used for Handlers command, in acpi_db_display_handlers.
70 #define ACPI_PREDEFINED_PREFIX "%25s (%.2X) : "
71 #define ACPI_HANDLER_NAME_STRING "%30s : "
72 #define ACPI_HANDLER_PRESENT_STRING "%-9s (%p)\n"
73 #define ACPI_HANDLER_PRESENT_STRING2 "%-9s (%p)"
74 #define ACPI_HANDLER_NOT_PRESENT_STRING "%-9s\n"
76 /* All predefined Address Space IDs */
78 static acpi_adr_space_type acpi_gbl_space_id_list[] = {
79 ACPI_ADR_SPACE_SYSTEM_MEMORY,
80 ACPI_ADR_SPACE_SYSTEM_IO,
81 ACPI_ADR_SPACE_PCI_CONFIG,
82 ACPI_ADR_SPACE_EC,
83 ACPI_ADR_SPACE_SMBUS,
84 ACPI_ADR_SPACE_CMOS,
85 ACPI_ADR_SPACE_PCI_BAR_TARGET,
86 ACPI_ADR_SPACE_IPMI,
87 ACPI_ADR_SPACE_GPIO,
88 ACPI_ADR_SPACE_GSBUS,
89 ACPI_ADR_SPACE_DATA_TABLE,
90 ACPI_ADR_SPACE_FIXED_HARDWARE
93 /* Global handler information */
95 typedef struct acpi_handler_info {
96 void *handler;
97 char *name;
99 } acpi_handler_info;
101 static struct acpi_handler_info acpi_gbl_handler_list[] = {
102 {&acpi_gbl_global_notify[0].handler, "System Notifications"},
103 {&acpi_gbl_global_notify[1].handler, "Device Notifications"},
104 {&acpi_gbl_table_handler, "ACPI Table Events"},
105 {&acpi_gbl_exception_handler, "Control Method Exceptions"},
106 {&acpi_gbl_interface_handler, "OSI Invocations"}
109 /*******************************************************************************
111 * FUNCTION: acpi_db_get_pointer
113 * PARAMETERS: target - Pointer to string to be converted
115 * RETURN: Converted pointer
117 * DESCRIPTION: Convert an ascii pointer value to a real value
119 ******************************************************************************/
121 static void *acpi_db_get_pointer(void *target)
123 void *obj_ptr;
124 acpi_size address;
126 address = strtoul(target, NULL, 16);
127 obj_ptr = ACPI_TO_POINTER(address);
128 return (obj_ptr);
131 /*******************************************************************************
133 * FUNCTION: acpi_db_dump_parser_descriptor
135 * PARAMETERS: op - A parser Op descriptor
137 * RETURN: None
139 * DESCRIPTION: Display a formatted parser object
141 ******************************************************************************/
143 static void acpi_db_dump_parser_descriptor(union acpi_parse_object *op)
145 const struct acpi_opcode_info *info;
147 info = acpi_ps_get_opcode_info(op->common.aml_opcode);
149 acpi_os_printf("Parser Op Descriptor:\n");
150 acpi_os_printf("%20.20s : %4.4X\n", "Opcode", op->common.aml_opcode);
152 ACPI_DEBUG_ONLY_MEMBERS(acpi_os_printf("%20.20s : %s\n", "Opcode Name",
153 info->name));
155 acpi_os_printf("%20.20s : %p\n", "Value/ArgList", op->common.value.arg);
156 acpi_os_printf("%20.20s : %p\n", "Parent", op->common.parent);
157 acpi_os_printf("%20.20s : %p\n", "NextOp", op->common.next);
160 /*******************************************************************************
162 * FUNCTION: acpi_db_decode_and_display_object
164 * PARAMETERS: target - String with object to be displayed. Names
165 * and hex pointers are supported.
166 * output_type - Byte, Word, Dword, or Qword (B|W|D|Q)
168 * RETURN: None
170 * DESCRIPTION: Display a formatted ACPI object
172 ******************************************************************************/
174 void acpi_db_decode_and_display_object(char *target, char *output_type)
176 void *obj_ptr;
177 struct acpi_namespace_node *node;
178 union acpi_operand_object *obj_desc;
179 u32 display = DB_BYTE_DISPLAY;
180 char buffer[80];
181 struct acpi_buffer ret_buf;
182 acpi_status status;
183 u32 size;
185 if (!target) {
186 return;
189 /* Decode the output type */
191 if (output_type) {
192 acpi_ut_strupr(output_type);
193 if (output_type[0] == 'W') {
194 display = DB_WORD_DISPLAY;
195 } else if (output_type[0] == 'D') {
196 display = DB_DWORD_DISPLAY;
197 } else if (output_type[0] == 'Q') {
198 display = DB_QWORD_DISPLAY;
202 ret_buf.length = sizeof(buffer);
203 ret_buf.pointer = buffer;
205 /* Differentiate between a number and a name */
207 if ((target[0] >= 0x30) && (target[0] <= 0x39)) {
208 obj_ptr = acpi_db_get_pointer(target);
209 if (!acpi_os_readable(obj_ptr, 16)) {
210 acpi_os_printf
211 ("Address %p is invalid in this address space\n",
212 obj_ptr);
213 return;
216 /* Decode the object type */
218 switch (ACPI_GET_DESCRIPTOR_TYPE(obj_ptr)) {
219 case ACPI_DESC_TYPE_NAMED:
221 /* This is a namespace Node */
223 if (!acpi_os_readable
224 (obj_ptr, sizeof(struct acpi_namespace_node))) {
225 acpi_os_printf
226 ("Cannot read entire Named object at address %p\n",
227 obj_ptr);
228 return;
231 node = obj_ptr;
232 goto dump_node;
234 case ACPI_DESC_TYPE_OPERAND:
236 /* This is a ACPI OPERAND OBJECT */
238 if (!acpi_os_readable
239 (obj_ptr, sizeof(union acpi_operand_object))) {
240 acpi_os_printf
241 ("Cannot read entire ACPI object at address %p\n",
242 obj_ptr);
243 return;
246 acpi_ut_debug_dump_buffer(obj_ptr,
247 sizeof(union
248 acpi_operand_object),
249 display, ACPI_UINT32_MAX);
250 acpi_ex_dump_object_descriptor(obj_ptr, 1);
251 break;
253 case ACPI_DESC_TYPE_PARSER:
255 /* This is a Parser Op object */
257 if (!acpi_os_readable
258 (obj_ptr, sizeof(union acpi_parse_object))) {
259 acpi_os_printf
260 ("Cannot read entire Parser object at address %p\n",
261 obj_ptr);
262 return;
265 acpi_ut_debug_dump_buffer(obj_ptr,
266 sizeof(union
267 acpi_parse_object),
268 display, ACPI_UINT32_MAX);
269 acpi_db_dump_parser_descriptor((union acpi_parse_object
270 *)obj_ptr);
271 break;
273 default:
275 /* Is not a recognizeable object */
277 acpi_os_printf
278 ("Not a known ACPI internal object, descriptor type %2.2X\n",
279 ACPI_GET_DESCRIPTOR_TYPE(obj_ptr));
281 size = 16;
282 if (acpi_os_readable(obj_ptr, 64)) {
283 size = 64;
286 /* Just dump some memory */
288 acpi_ut_debug_dump_buffer(obj_ptr, size, display,
289 ACPI_UINT32_MAX);
290 break;
293 return;
296 /* The parameter is a name string that must be resolved to a Named obj */
298 node = acpi_db_local_ns_lookup(target);
299 if (!node) {
300 return;
303 dump_node:
304 /* Now dump the NS node */
306 status = acpi_get_name(node, ACPI_FULL_PATHNAME_NO_TRAILING, &ret_buf);
307 if (ACPI_FAILURE(status)) {
308 acpi_os_printf("Could not convert name to pathname\n");
311 else {
312 acpi_os_printf("Object (%p) Pathname: %s\n",
313 node, (char *)ret_buf.pointer);
316 if (!acpi_os_readable(node, sizeof(struct acpi_namespace_node))) {
317 acpi_os_printf("Invalid Named object at address %p\n", node);
318 return;
321 acpi_ut_debug_dump_buffer((void *)node,
322 sizeof(struct acpi_namespace_node), display,
323 ACPI_UINT32_MAX);
324 acpi_ex_dump_namespace_node(node, 1);
326 obj_desc = acpi_ns_get_attached_object(node);
327 if (obj_desc) {
328 acpi_os_printf("\nAttached Object (%p):\n", obj_desc);
329 if (!acpi_os_readable
330 (obj_desc, sizeof(union acpi_operand_object))) {
331 acpi_os_printf
332 ("Invalid internal ACPI Object at address %p\n",
333 obj_desc);
334 return;
337 acpi_ut_debug_dump_buffer((void *)obj_desc,
338 sizeof(union acpi_operand_object),
339 display, ACPI_UINT32_MAX);
340 acpi_ex_dump_object_descriptor(obj_desc, 1);
344 /*******************************************************************************
346 * FUNCTION: acpi_db_display_method_info
348 * PARAMETERS: start_op - Root of the control method parse tree
350 * RETURN: None
352 * DESCRIPTION: Display information about the current method
354 ******************************************************************************/
356 void acpi_db_display_method_info(union acpi_parse_object *start_op)
358 struct acpi_walk_state *walk_state;
359 union acpi_operand_object *obj_desc;
360 struct acpi_namespace_node *node;
361 union acpi_parse_object *root_op;
362 union acpi_parse_object *op;
363 const struct acpi_opcode_info *op_info;
364 u32 num_ops = 0;
365 u32 num_operands = 0;
366 u32 num_operators = 0;
367 u32 num_remaining_ops = 0;
368 u32 num_remaining_operands = 0;
369 u32 num_remaining_operators = 0;
370 u8 count_remaining = FALSE;
372 walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
373 if (!walk_state) {
374 acpi_os_printf("There is no method currently executing\n");
375 return;
378 obj_desc = walk_state->method_desc;
379 node = walk_state->method_node;
381 acpi_os_printf("Currently executing control method is [%4.4s]\n",
382 acpi_ut_get_node_name(node));
383 acpi_os_printf("%X Arguments, SyncLevel = %X\n",
384 (u32)obj_desc->method.param_count,
385 (u32)obj_desc->method.sync_level);
387 root_op = start_op;
388 while (root_op->common.parent) {
389 root_op = root_op->common.parent;
392 op = root_op;
394 while (op) {
395 if (op == start_op) {
396 count_remaining = TRUE;
399 num_ops++;
400 if (count_remaining) {
401 num_remaining_ops++;
404 /* Decode the opcode */
406 op_info = acpi_ps_get_opcode_info(op->common.aml_opcode);
407 switch (op_info->class) {
408 case AML_CLASS_ARGUMENT:
410 if (count_remaining) {
411 num_remaining_operands++;
414 num_operands++;
415 break;
417 case AML_CLASS_UNKNOWN:
419 /* Bad opcode or ASCII character */
421 continue;
423 default:
425 if (count_remaining) {
426 num_remaining_operators++;
429 num_operators++;
430 break;
433 op = acpi_ps_get_depth_next(start_op, op);
436 acpi_os_printf
437 ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
438 num_ops, num_operators, num_operands);
440 acpi_os_printf
441 ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
442 num_remaining_ops, num_remaining_operators,
443 num_remaining_operands);
446 /*******************************************************************************
448 * FUNCTION: acpi_db_display_locals
450 * PARAMETERS: None
452 * RETURN: None
454 * DESCRIPTION: Display all locals for the currently running control method
456 ******************************************************************************/
458 void acpi_db_display_locals(void)
460 struct acpi_walk_state *walk_state;
462 walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
463 if (!walk_state) {
464 acpi_os_printf("There is no method currently executing\n");
465 return;
468 acpi_db_decode_locals(walk_state);
471 /*******************************************************************************
473 * FUNCTION: acpi_db_display_arguments
475 * PARAMETERS: None
477 * RETURN: None
479 * DESCRIPTION: Display all arguments for the currently running control method
481 ******************************************************************************/
483 void acpi_db_display_arguments(void)
485 struct acpi_walk_state *walk_state;
487 walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
488 if (!walk_state) {
489 acpi_os_printf("There is no method currently executing\n");
490 return;
493 acpi_db_decode_arguments(walk_state);
496 /*******************************************************************************
498 * FUNCTION: acpi_db_display_results
500 * PARAMETERS: None
502 * RETURN: None
504 * DESCRIPTION: Display current contents of a method result stack
506 ******************************************************************************/
508 void acpi_db_display_results(void)
510 u32 i;
511 struct acpi_walk_state *walk_state;
512 union acpi_operand_object *obj_desc;
513 u32 result_count = 0;
514 struct acpi_namespace_node *node;
515 union acpi_generic_state *frame;
516 u32 index; /* Index onto current frame */
518 walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
519 if (!walk_state) {
520 acpi_os_printf("There is no method currently executing\n");
521 return;
524 obj_desc = walk_state->method_desc;
525 node = walk_state->method_node;
527 if (walk_state->results) {
528 result_count = walk_state->result_count;
531 acpi_os_printf("Method [%4.4s] has %X stacked result objects\n",
532 acpi_ut_get_node_name(node), result_count);
534 /* From the top element of result stack */
536 frame = walk_state->results;
537 index = (result_count - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
539 for (i = 0; i < result_count; i++) {
540 obj_desc = frame->results.obj_desc[index];
541 acpi_os_printf("Result%u: ", i);
542 acpi_db_display_internal_object(obj_desc, walk_state);
544 if (index == 0) {
545 frame = frame->results.next;
546 index = ACPI_RESULTS_FRAME_OBJ_NUM;
549 index--;
553 /*******************************************************************************
555 * FUNCTION: acpi_db_display_calling_tree
557 * PARAMETERS: None
559 * RETURN: None
561 * DESCRIPTION: Display current calling tree of nested control methods
563 ******************************************************************************/
565 void acpi_db_display_calling_tree(void)
567 struct acpi_walk_state *walk_state;
568 struct acpi_namespace_node *node;
570 walk_state = acpi_ds_get_current_walk_state(acpi_gbl_current_walk_list);
571 if (!walk_state) {
572 acpi_os_printf("There is no method currently executing\n");
573 return;
576 node = walk_state->method_node;
577 acpi_os_printf("Current Control Method Call Tree\n");
579 while (walk_state) {
580 node = walk_state->method_node;
581 acpi_os_printf(" [%4.4s]\n", acpi_ut_get_node_name(node));
583 walk_state = walk_state->next;
587 /*******************************************************************************
589 * FUNCTION: acpi_db_display_object_type
591 * PARAMETERS: name - User entered NS node handle or name
593 * RETURN: None
595 * DESCRIPTION: Display type of an arbitrary NS node
597 ******************************************************************************/
599 void acpi_db_display_object_type(char *name)
601 struct acpi_namespace_node *node;
602 struct acpi_device_info *info;
603 acpi_status status;
604 u32 i;
606 node = acpi_db_convert_to_node(name);
607 if (!node) {
608 return;
611 status = acpi_get_object_info(ACPI_CAST_PTR(acpi_handle, node), &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 if (info->valid & ACPI_VALID_ADR) {
619 acpi_os_printf("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
620 ACPI_FORMAT_UINT64(info->address),
621 info->current_status, info->flags);
623 if (info->valid & ACPI_VALID_SXDS) {
624 acpi_os_printf("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
625 info->highest_dstates[0],
626 info->highest_dstates[1],
627 info->highest_dstates[2],
628 info->highest_dstates[3]);
630 if (info->valid & ACPI_VALID_SXWS) {
631 acpi_os_printf
632 ("S0W-%2.2X S1W-%2.2X S2W-%2.2X S3W-%2.2X S4W-%2.2X\n",
633 info->lowest_dstates[0], info->lowest_dstates[1],
634 info->lowest_dstates[2], info->lowest_dstates[3],
635 info->lowest_dstates[4]);
638 if (info->valid & ACPI_VALID_HID) {
639 acpi_os_printf("HID: %s\n", info->hardware_id.string);
642 if (info->valid & ACPI_VALID_UID) {
643 acpi_os_printf("UID: %s\n", info->unique_id.string);
646 if (info->valid & ACPI_VALID_SUB) {
647 acpi_os_printf("SUB: %s\n", info->subsystem_id.string);
650 if (info->valid & ACPI_VALID_CID) {
651 for (i = 0; i < info->compatible_id_list.count; i++) {
652 acpi_os_printf("CID %u: %s\n", i,
653 info->compatible_id_list.ids[i].string);
657 ACPI_FREE(info);
660 /*******************************************************************************
662 * FUNCTION: acpi_db_display_result_object
664 * PARAMETERS: obj_desc - Object to be displayed
665 * walk_state - Current walk state
667 * RETURN: None
669 * DESCRIPTION: Display the result of an AML opcode
671 * Note: Curently only displays the result object if we are single stepping.
672 * However, this output may be useful in other contexts and could be enabled
673 * to do so if needed.
675 ******************************************************************************/
677 void
678 acpi_db_display_result_object(union acpi_operand_object *obj_desc,
679 struct acpi_walk_state *walk_state)
682 /* Only display if single stepping */
684 if (!acpi_gbl_cm_single_step) {
685 return;
688 acpi_os_printf("ResultObj: ");
689 acpi_db_display_internal_object(obj_desc, walk_state);
690 acpi_os_printf("\n");
693 /*******************************************************************************
695 * FUNCTION: acpi_db_display_argument_object
697 * PARAMETERS: obj_desc - Object to be displayed
698 * walk_state - Current walk state
700 * RETURN: None
702 * DESCRIPTION: Display the result of an AML opcode
704 ******************************************************************************/
706 void
707 acpi_db_display_argument_object(union acpi_operand_object *obj_desc,
708 struct acpi_walk_state *walk_state)
711 if (!acpi_gbl_cm_single_step) {
712 return;
715 acpi_os_printf("ArgObj: ");
716 acpi_db_display_internal_object(obj_desc, walk_state);
719 #if (!ACPI_REDUCED_HARDWARE)
720 /*******************************************************************************
722 * FUNCTION: acpi_db_display_gpes
724 * PARAMETERS: None
726 * RETURN: None
728 * DESCRIPTION: Display the current GPE structures
730 ******************************************************************************/
732 void acpi_db_display_gpes(void)
734 struct acpi_gpe_block_info *gpe_block;
735 struct acpi_gpe_xrupt_info *gpe_xrupt_info;
736 struct acpi_gpe_event_info *gpe_event_info;
737 struct acpi_gpe_register_info *gpe_register_info;
738 char *gpe_type;
739 struct acpi_gpe_notify_info *notify;
740 u32 gpe_index;
741 u32 block = 0;
742 u32 i;
743 u32 j;
744 u32 count;
745 char buffer[80];
746 struct acpi_buffer ret_buf;
747 acpi_status status;
749 ret_buf.length = sizeof(buffer);
750 ret_buf.pointer = buffer;
752 block = 0;
754 /* Walk the GPE lists */
756 gpe_xrupt_info = acpi_gbl_gpe_xrupt_list_head;
757 while (gpe_xrupt_info) {
758 gpe_block = gpe_xrupt_info->gpe_block_list_head;
759 while (gpe_block) {
760 status = acpi_get_name(gpe_block->node,
761 ACPI_FULL_PATHNAME_NO_TRAILING,
762 &ret_buf);
763 if (ACPI_FAILURE(status)) {
764 acpi_os_printf
765 ("Could not convert name to pathname\n");
768 if (gpe_block->node == acpi_gbl_fadt_gpe_device) {
769 gpe_type = "FADT-defined GPE block";
770 } else {
771 gpe_type = "GPE Block Device";
774 acpi_os_printf
775 ("\nBlock %u - Info %p DeviceNode %p [%s] - %s\n",
776 block, gpe_block, gpe_block->node, buffer,
777 gpe_type);
779 acpi_os_printf(" Registers: %u (%u GPEs)\n",
780 gpe_block->register_count,
781 gpe_block->gpe_count);
783 acpi_os_printf
784 (" GPE range: 0x%X to 0x%X on interrupt %u\n",
785 gpe_block->block_base_number,
786 gpe_block->block_base_number +
787 (gpe_block->gpe_count - 1),
788 gpe_xrupt_info->interrupt_number);
790 acpi_os_printf
791 (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
792 gpe_block->register_info,
793 ACPI_FORMAT_UINT64(gpe_block->register_info->
794 status_address.address),
795 ACPI_FORMAT_UINT64(gpe_block->register_info->
796 enable_address.address));
798 acpi_os_printf(" EventInfo: %p\n",
799 gpe_block->event_info);
801 /* Examine each GPE Register within the block */
803 for (i = 0; i < gpe_block->register_count; i++) {
804 gpe_register_info =
805 &gpe_block->register_info[i];
807 acpi_os_printf(" Reg %u: (GPE %.2X-%.2X) "
808 "RunEnable %2.2X WakeEnable %2.2X"
809 " Status %8.8X%8.8X Enable %8.8X%8.8X\n",
811 gpe_register_info->
812 base_gpe_number,
813 gpe_register_info->
814 base_gpe_number +
815 (ACPI_GPE_REGISTER_WIDTH - 1),
816 gpe_register_info->
817 enable_for_run,
818 gpe_register_info->
819 enable_for_wake,
820 ACPI_FORMAT_UINT64
821 (gpe_register_info->
822 status_address.address),
823 ACPI_FORMAT_UINT64
824 (gpe_register_info->
825 enable_address.address));
827 /* Now look at the individual GPEs in this byte register */
829 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) {
830 gpe_index =
831 (i * ACPI_GPE_REGISTER_WIDTH) + j;
832 gpe_event_info =
833 &gpe_block->event_info[gpe_index];
835 if (ACPI_GPE_DISPATCH_TYPE
836 (gpe_event_info->flags) ==
837 ACPI_GPE_DISPATCH_NONE) {
839 /* This GPE is not used (no method or handler), ignore it */
841 continue;
844 acpi_os_printf
845 (" GPE %.2X: %p RunRefs %2.2X Flags %2.2X (",
846 gpe_block->block_base_number +
847 gpe_index, gpe_event_info,
848 gpe_event_info->runtime_count,
849 gpe_event_info->flags);
851 /* Decode the flags byte */
853 if (gpe_event_info->
854 flags & ACPI_GPE_LEVEL_TRIGGERED) {
855 acpi_os_printf("Level, ");
856 } else {
857 acpi_os_printf("Edge, ");
860 if (gpe_event_info->
861 flags & ACPI_GPE_CAN_WAKE) {
862 acpi_os_printf("CanWake, ");
863 } else {
864 acpi_os_printf("RunOnly, ");
867 switch (ACPI_GPE_DISPATCH_TYPE
868 (gpe_event_info->flags)) {
869 case ACPI_GPE_DISPATCH_NONE:
871 acpi_os_printf("NotUsed");
872 break;
874 case ACPI_GPE_DISPATCH_METHOD:
876 acpi_os_printf("Method");
877 break;
879 case ACPI_GPE_DISPATCH_HANDLER:
881 acpi_os_printf("Handler");
882 break;
884 case ACPI_GPE_DISPATCH_NOTIFY:
886 count = 0;
887 notify =
888 gpe_event_info->dispatch.
889 notify_list;
890 while (notify) {
891 count++;
892 notify = notify->next;
895 acpi_os_printf
896 ("Implicit Notify on %u devices",
897 count);
898 break;
900 case ACPI_GPE_DISPATCH_RAW_HANDLER:
902 acpi_os_printf("RawHandler");
903 break;
905 default:
907 acpi_os_printf("UNKNOWN: %X",
908 ACPI_GPE_DISPATCH_TYPE
909 (gpe_event_info->
910 flags));
911 break;
914 acpi_os_printf(")\n");
918 block++;
919 gpe_block = gpe_block->next;
922 gpe_xrupt_info = gpe_xrupt_info->next;
925 #endif /* !ACPI_REDUCED_HARDWARE */
927 /*******************************************************************************
929 * FUNCTION: acpi_db_display_handlers
931 * PARAMETERS: None
933 * RETURN: None
935 * DESCRIPTION: Display the currently installed global handlers
937 ******************************************************************************/
939 void acpi_db_display_handlers(void)
941 union acpi_operand_object *obj_desc;
942 union acpi_operand_object *handler_obj;
943 acpi_adr_space_type space_id;
944 u32 i;
946 /* Operation region handlers */
948 acpi_os_printf("\nOperation Region Handlers at the namespace root:\n");
950 obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node);
951 if (obj_desc) {
952 for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_space_id_list); i++) {
953 space_id = acpi_gbl_space_id_list[i];
954 handler_obj = obj_desc->device.handler;
956 acpi_os_printf(ACPI_PREDEFINED_PREFIX,
957 acpi_ut_get_region_name((u8)space_id),
958 space_id);
960 while (handler_obj) {
961 if (acpi_gbl_space_id_list[i] ==
962 handler_obj->address_space.space_id) {
963 acpi_os_printf
964 (ACPI_HANDLER_PRESENT_STRING,
965 (handler_obj->address_space.
966 handler_flags &
967 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
968 ? "Default" : "User",
969 handler_obj->address_space.
970 handler);
972 goto found_handler;
975 handler_obj = handler_obj->address_space.next;
978 /* There is no handler for this space_id */
980 acpi_os_printf("None\n");
982 found_handler: ;
985 /* Find all handlers for user-defined space_IDs */
987 handler_obj = obj_desc->device.handler;
988 while (handler_obj) {
989 if (handler_obj->address_space.space_id >=
990 ACPI_USER_REGION_BEGIN) {
991 acpi_os_printf(ACPI_PREDEFINED_PREFIX,
992 "User-defined ID",
993 handler_obj->address_space.
994 space_id);
995 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING,
996 (handler_obj->address_space.
997 handler_flags &
998 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
999 ? "Default" : "User",
1000 handler_obj->address_space.
1001 handler);
1004 handler_obj = handler_obj->address_space.next;
1007 #if (!ACPI_REDUCED_HARDWARE)
1009 /* Fixed event handlers */
1011 acpi_os_printf("\nFixed Event Handlers:\n");
1013 for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) {
1014 acpi_os_printf(ACPI_PREDEFINED_PREFIX,
1015 acpi_ut_get_event_name(i), i);
1016 if (acpi_gbl_fixed_event_handlers[i].handler) {
1017 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User",
1018 acpi_gbl_fixed_event_handlers[i].
1019 handler);
1020 } else {
1021 acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1025 #endif /* !ACPI_REDUCED_HARDWARE */
1027 /* Miscellaneous global handlers */
1029 acpi_os_printf("\nMiscellaneous Global Handlers:\n");
1031 for (i = 0; i < ACPI_ARRAY_LENGTH(acpi_gbl_handler_list); i++) {
1032 acpi_os_printf(ACPI_HANDLER_NAME_STRING,
1033 acpi_gbl_handler_list[i].name);
1035 if (acpi_gbl_handler_list[i].handler) {
1036 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING, "User",
1037 acpi_gbl_handler_list[i].handler);
1038 } else {
1039 acpi_os_printf(ACPI_HANDLER_NOT_PRESENT_STRING, "None");
1043 /* Other handlers that are installed throughout the namespace */
1045 acpi_os_printf("\nOperation Region Handlers for specific devices:\n");
1047 (void)acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
1048 ACPI_UINT32_MAX,
1049 acpi_db_display_non_root_handlers, NULL, NULL,
1050 NULL);
1053 /*******************************************************************************
1055 * FUNCTION: acpi_db_display_non_root_handlers
1057 * PARAMETERS: acpi_walk_callback
1059 * RETURN: Status
1061 * DESCRIPTION: Display information about all handlers installed for a
1062 * device object.
1064 ******************************************************************************/
1066 static acpi_status
1067 acpi_db_display_non_root_handlers(acpi_handle obj_handle,
1068 u32 nesting_level,
1069 void *context, void **return_value)
1071 struct acpi_namespace_node *node =
1072 ACPI_CAST_PTR(struct acpi_namespace_node, obj_handle);
1073 union acpi_operand_object *obj_desc;
1074 union acpi_operand_object *handler_obj;
1075 char *pathname;
1077 obj_desc = acpi_ns_get_attached_object(node);
1078 if (!obj_desc) {
1079 return (AE_OK);
1082 pathname = acpi_ns_get_external_pathname(node);
1083 if (!pathname) {
1084 return (AE_OK);
1087 /* Display all handlers associated with this device */
1089 handler_obj = obj_desc->device.handler;
1090 while (handler_obj) {
1091 acpi_os_printf(ACPI_PREDEFINED_PREFIX,
1092 acpi_ut_get_region_name((u8)handler_obj->
1093 address_space.space_id),
1094 handler_obj->address_space.space_id);
1096 acpi_os_printf(ACPI_HANDLER_PRESENT_STRING2,
1097 (handler_obj->address_space.handler_flags &
1098 ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) ? "Default"
1099 : "User", handler_obj->address_space.handler);
1101 acpi_os_printf(" Device Name: %s (%p)\n", pathname, node);
1103 handler_obj = handler_obj->address_space.next;
1106 ACPI_FREE(pathname);
1107 return (AE_OK);