dt-bindings: mtd: ingenic: Use standard ecc-engine property
[linux/fpc-iii.git] / drivers / acpi / acpica / dsdebug.c
blob0d3e1ced1f5764b1b084be71ba9db0a28c1c1639
1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /******************************************************************************
4 * Module Name: dsdebug - Parser/Interpreter interface - debugging
6 * Copyright (C) 2000 - 2019, Intel Corp.
8 *****************************************************************************/
10 #include <acpi/acpi.h>
11 #include "accommon.h"
12 #include "acdispat.h"
13 #include "acnamesp.h"
14 #ifdef ACPI_DISASSEMBLER
15 #include "acdisasm.h"
16 #endif
17 #include "acinterp.h"
19 #define _COMPONENT ACPI_DISPATCHER
20 ACPI_MODULE_NAME("dsdebug")
22 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
23 /* Local prototypes */
24 static void
25 acpi_ds_print_node_pathname(struct acpi_namespace_node *node,
26 const char *message);
28 /*******************************************************************************
30 * FUNCTION: acpi_ds_print_node_pathname
32 * PARAMETERS: node - Object
33 * message - Prefix message
35 * DESCRIPTION: Print an object's full namespace pathname
36 * Manages allocation/freeing of a pathname buffer
38 ******************************************************************************/
40 static void
41 acpi_ds_print_node_pathname(struct acpi_namespace_node *node,
42 const char *message)
44 struct acpi_buffer buffer;
45 acpi_status status;
47 ACPI_FUNCTION_TRACE(ds_print_node_pathname);
49 if (!node) {
50 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "[NULL NAME]"));
51 return_VOID;
54 /* Convert handle to full pathname and print it (with supplied message) */
56 buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER;
58 status = acpi_ns_handle_to_pathname(node, &buffer, TRUE);
59 if (ACPI_SUCCESS(status)) {
60 if (message) {
61 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "%s ",
62 message));
65 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "[%s] (Node %p)",
66 (char *)buffer.pointer, node));
67 ACPI_FREE(buffer.pointer);
70 return_VOID;
73 /*******************************************************************************
75 * FUNCTION: acpi_ds_dump_method_stack
77 * PARAMETERS: status - Method execution status
78 * walk_state - Current state of the parse tree walk
79 * op - Executing parse op
81 * RETURN: None
83 * DESCRIPTION: Called when a method has been aborted because of an error.
84 * Dumps the method execution stack.
86 ******************************************************************************/
88 void
89 acpi_ds_dump_method_stack(acpi_status status,
90 struct acpi_walk_state *walk_state,
91 union acpi_parse_object *op)
93 union acpi_parse_object *next;
94 struct acpi_thread_state *thread;
95 struct acpi_walk_state *next_walk_state;
96 struct acpi_namespace_node *previous_method = NULL;
97 union acpi_operand_object *method_desc;
99 ACPI_FUNCTION_TRACE(ds_dump_method_stack);
101 /* Ignore control codes, they are not errors */
103 if ((status & AE_CODE_MASK) == AE_CODE_CONTROL) {
104 return_VOID;
107 /* We may be executing a deferred opcode */
109 if (walk_state->deferred_node) {
110 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
111 "Executing subtree for Buffer/Package/Region\n"));
112 return_VOID;
116 * If there is no Thread, we are not actually executing a method.
117 * This can happen when the iASL compiler calls the interpreter
118 * to perform constant folding.
120 thread = walk_state->thread;
121 if (!thread) {
122 return_VOID;
125 /* Display exception and method name */
127 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
128 "\n**** Exception %s during execution of method ",
129 acpi_format_exception(status)));
131 acpi_ds_print_node_pathname(walk_state->method_node, NULL);
133 /* Display stack of executing methods */
135 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH,
136 "\n\nMethod Execution Stack:\n"));
137 next_walk_state = thread->walk_state_list;
139 /* Walk list of linked walk states */
141 while (next_walk_state) {
142 method_desc = next_walk_state->method_desc;
143 if (method_desc) {
144 acpi_ex_stop_trace_method((struct acpi_namespace_node *)
145 method_desc->method.node,
146 method_desc, walk_state);
149 ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
150 " Method [%4.4s] executing: ",
151 acpi_ut_get_node_name(next_walk_state->
152 method_node)));
154 /* First method is the currently executing method */
156 if (next_walk_state == walk_state) {
157 if (op) {
159 /* Display currently executing ASL statement */
161 next = op->common.next;
162 op->common.next = NULL;
164 #ifdef ACPI_DISASSEMBLER
165 if (walk_state->method_node !=
166 acpi_gbl_root_node) {
168 /* More verbose if not module-level code */
170 acpi_os_printf("Failed at ");
171 acpi_dm_disassemble(next_walk_state, op,
172 ACPI_UINT32_MAX);
174 #endif
175 op->common.next = next;
177 } else {
179 * This method has called another method
180 * NOTE: the method call parse subtree is already deleted at
181 * this point, so we cannot disassemble the method invocation.
183 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH,
184 "Call to method "));
185 acpi_ds_print_node_pathname(previous_method, NULL);
188 previous_method = next_walk_state->method_node;
189 next_walk_state = next_walk_state->next;
190 ACPI_DEBUG_PRINT_RAW((ACPI_DB_DISPATCH, "\n"));
193 return_VOID;
196 #else
197 void
198 acpi_ds_dump_method_stack(acpi_status status,
199 struct acpi_walk_state *walk_state,
200 union acpi_parse_object *op)
202 return;
205 #endif