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#include <acpi/acpi.h>
45#include "accommon.h"
46#include "acinterp.h"
47
48#define _COMPONENT ACPI_EXECUTER
49ACPI_MODULE_NAME("exdebug")
50
51#ifndef ACPI_NO_ERROR_MESSAGES
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73void
74acpi_ex_do_debug_object(union acpi_operand_object *source_desc,
75 u32 level, u32 index)
76{
77 u32 i;
78
79 ACPI_FUNCTION_TRACE_PTR(ex_do_debug_object, source_desc);
80
81
82
83 if (!acpi_gbl_enable_aml_debug_object &&
84 !(acpi_dbg_level & ACPI_LV_DEBUG_OBJECT)) {
85 return_VOID;
86 }
87
88
89
90
91
92 if (!((level > 0) && index == 0)) {
93 acpi_os_printf("[ACPI Debug] %*s", level, " ");
94 }
95
96
97
98 if (index > 0) {
99 acpi_os_printf("(%.2u) ", index - 1);
100 }
101
102 if (!source_desc) {
103 acpi_os_printf("[Null Object]\n");
104 return_VOID;
105 }
106
107 if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) == ACPI_DESC_TYPE_OPERAND) {
108 acpi_os_printf("%s ",
109 acpi_ut_get_object_type_name(source_desc));
110
111 if (!acpi_ut_valid_internal_object(source_desc)) {
112 acpi_os_printf("%p, Invalid Internal Object!\n",
113 source_desc);
114 return_VOID;
115 }
116 } else if (ACPI_GET_DESCRIPTOR_TYPE(source_desc) ==
117 ACPI_DESC_TYPE_NAMED) {
118 acpi_os_printf("%s: %p\n",
119 acpi_ut_get_type_name(((struct
120 acpi_namespace_node *)
121 source_desc)->type),
122 source_desc);
123 return_VOID;
124 } else {
125 return_VOID;
126 }
127
128
129
130 switch (source_desc->common.type) {
131 case ACPI_TYPE_INTEGER:
132
133
134
135 if (acpi_gbl_integer_byte_width == 4) {
136 acpi_os_printf("0x%8.8X\n",
137 (u32)source_desc->integer.value);
138 } else {
139 acpi_os_printf("0x%8.8X%8.8X\n",
140 ACPI_FORMAT_UINT64(source_desc->integer.
141 value));
142 }
143 break;
144
145 case ACPI_TYPE_BUFFER:
146
147 acpi_os_printf("[0x%.2X]\n", (u32)source_desc->buffer.length);
148 acpi_ut_dump_buffer(source_desc->buffer.pointer,
149 (source_desc->buffer.length < 256) ?
150 source_desc->buffer.length : 256,
151 DB_BYTE_DISPLAY, 0);
152 break;
153
154 case ACPI_TYPE_STRING:
155
156 acpi_os_printf("[0x%.2X] \"%s\"\n",
157 source_desc->string.length,
158 source_desc->string.pointer);
159 break;
160
161 case ACPI_TYPE_PACKAGE:
162
163 acpi_os_printf("[Contains 0x%.2X Elements]\n",
164 source_desc->package.count);
165
166
167
168 for (i = 0; i < source_desc->package.count; i++) {
169 acpi_ex_do_debug_object(source_desc->package.
170 elements[i], level + 4, i + 1);
171 }
172 break;
173
174 case ACPI_TYPE_LOCAL_REFERENCE:
175
176 acpi_os_printf("[%s] ",
177 acpi_ut_get_reference_name(source_desc));
178
179
180
181 switch (source_desc->reference.class) {
182 case ACPI_REFCLASS_INDEX:
183
184 acpi_os_printf("0x%X\n", source_desc->reference.value);
185 break;
186
187 case ACPI_REFCLASS_TABLE:
188
189
190
191 acpi_os_printf("Table Index 0x%X\n",
192 source_desc->reference.value);
193 return_VOID;
194
195 default:
196
197 break;
198 }
199
200 acpi_os_printf(" ");
201
202
203
204 if (source_desc->reference.node) {
205 if (ACPI_GET_DESCRIPTOR_TYPE
206 (source_desc->reference.node) !=
207 ACPI_DESC_TYPE_NAMED) {
208 acpi_os_printf
209 (" %p - Not a valid namespace node\n",
210 source_desc->reference.node);
211 } else {
212 acpi_os_printf("Node %p [%4.4s] ",
213 source_desc->reference.node,
214 (source_desc->reference.node)->
215 name.ascii);
216
217 switch ((source_desc->reference.node)->type) {
218
219
220
221 case ACPI_TYPE_DEVICE:
222 acpi_os_printf("Device\n");
223 break;
224
225 case ACPI_TYPE_THERMAL:
226 acpi_os_printf("Thermal Zone\n");
227 break;
228
229 default:
230
231 acpi_ex_do_debug_object((source_desc->
232 reference.
233 node)->object,
234 level + 4, 0);
235 break;
236 }
237 }
238 } else if (source_desc->reference.object) {
239 if (ACPI_GET_DESCRIPTOR_TYPE
240 (source_desc->reference.object) ==
241 ACPI_DESC_TYPE_NAMED) {
242 acpi_ex_do_debug_object(((struct
243 acpi_namespace_node *)
244 source_desc->reference.
245 object)->object,
246 level + 4, 0);
247 } else {
248 acpi_ex_do_debug_object(source_desc->reference.
249 object, level + 4, 0);
250 }
251 }
252 break;
253
254 default:
255
256 acpi_os_printf("%p\n", source_desc);
257 break;
258 }
259
260 ACPI_DEBUG_PRINT_RAW((ACPI_DB_EXEC, "\n"));
261 return_VOID;
262}
263#endif
264