Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Module Name: exdump - Interpreter debug output routines | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | |
9 | * All rights reserved. | |
10 | * | |
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. | |
25 | * | |
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. | |
29 | * | |
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. | |
42 | */ | |
43 | ||
1da177e4 LT |
44 | #include <acpi/acpi.h> |
45 | #include <acpi/acinterp.h> | |
46 | #include <acpi/amlcode.h> | |
47 | #include <acpi/acnamesp.h> | |
48 | #include <acpi/acparser.h> | |
49 | ||
50 | #define _COMPONENT ACPI_EXECUTER | |
4be44fcd | 51 | ACPI_MODULE_NAME("exdump") |
1da177e4 | 52 | |
6f42ccf2 RM |
53 | /* |
54 | * The following routines are used for debug output only | |
55 | */ | |
56 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) | |
44f6c012 | 57 | /* Local prototypes */ |
44f6c012 | 58 | #ifdef ACPI_FUTURE_USAGE |
4be44fcd | 59 | static void acpi_ex_out_string(char *title, char *value); |
44f6c012 | 60 | |
4be44fcd | 61 | static void acpi_ex_out_pointer(char *title, void *value); |
44f6c012 | 62 | |
4be44fcd | 63 | static void acpi_ex_out_integer(char *title, u32 value); |
44f6c012 | 64 | |
4be44fcd | 65 | static void acpi_ex_out_address(char *title, acpi_physical_address value); |
44f6c012 | 66 | |
4be44fcd | 67 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc); |
73459f73 RM |
68 | |
69 | static void | |
4be44fcd LB |
70 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index); |
71 | #endif /* ACPI_FUTURE_USAGE */ | |
1da177e4 | 72 | |
44f6c012 | 73 | /******************************************************************************* |
1da177e4 LT |
74 | * |
75 | * FUNCTION: acpi_ex_dump_operand | |
76 | * | |
44f6c012 RM |
77 | * PARAMETERS: *obj_desc - Pointer to entry to be dumped |
78 | * Depth - Current nesting depth | |
1da177e4 LT |
79 | * |
80 | * RETURN: None | |
81 | * | |
82 | * DESCRIPTION: Dump an operand object | |
83 | * | |
44f6c012 | 84 | ******************************************************************************/ |
1da177e4 | 85 | |
4be44fcd | 86 | void acpi_ex_dump_operand(union acpi_operand_object *obj_desc, u32 depth) |
1da177e4 | 87 | { |
4be44fcd LB |
88 | u32 length; |
89 | u32 index; | |
1da177e4 | 90 | |
4be44fcd | 91 | ACPI_FUNCTION_NAME("ex_dump_operand") |
1da177e4 | 92 | |
4be44fcd LB |
93 | if (! |
94 | ((ACPI_LV_EXEC & acpi_dbg_level) | |
95 | && (_COMPONENT & acpi_dbg_layer))) { | |
1da177e4 LT |
96 | return; |
97 | } | |
98 | ||
99 | if (!obj_desc) { | |
44f6c012 RM |
100 | /* This could be a null element of a package */ |
101 | ||
4be44fcd | 102 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Null Object Descriptor\n")); |
1da177e4 LT |
103 | return; |
104 | } | |
105 | ||
4be44fcd LB |
106 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { |
107 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p Namespace Node: ", | |
108 | obj_desc)); | |
109 | ACPI_DUMP_ENTRY(obj_desc, ACPI_LV_EXEC); | |
1da177e4 LT |
110 | return; |
111 | } | |
112 | ||
4be44fcd LB |
113 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
114 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, | |
115 | "%p is not a node or operand object: [%s]\n", | |
116 | obj_desc, | |
117 | acpi_ut_get_descriptor_name(obj_desc))); | |
118 | ACPI_DUMP_BUFFER(obj_desc, sizeof(union acpi_operand_object)); | |
1da177e4 LT |
119 | return; |
120 | } | |
121 | ||
122 | /* obj_desc is a valid object */ | |
123 | ||
124 | if (depth > 0) { | |
4be44fcd LB |
125 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%*s[%u] %p ", |
126 | depth, " ", depth, obj_desc)); | |
127 | } else { | |
128 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%p ", obj_desc)); | |
1da177e4 LT |
129 | } |
130 | ||
44f6c012 RM |
131 | /* Decode object type */ |
132 | ||
4be44fcd | 133 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
1da177e4 LT |
134 | case ACPI_TYPE_LOCAL_REFERENCE: |
135 | ||
136 | switch (obj_desc->reference.opcode) { | |
137 | case AML_DEBUG_OP: | |
138 | ||
4be44fcd | 139 | acpi_os_printf("Reference: Debug\n"); |
1da177e4 LT |
140 | break; |
141 | ||
1da177e4 LT |
142 | case AML_NAME_OP: |
143 | ||
4be44fcd LB |
144 | ACPI_DUMP_PATHNAME(obj_desc->reference.object, |
145 | "Reference: Name: ", ACPI_LV_INFO, | |
146 | _COMPONENT); | |
147 | ACPI_DUMP_ENTRY(obj_desc->reference.object, | |
148 | ACPI_LV_INFO); | |
1da177e4 LT |
149 | break; |
150 | ||
1da177e4 LT |
151 | case AML_INDEX_OP: |
152 | ||
4be44fcd LB |
153 | acpi_os_printf("Reference: Index %p\n", |
154 | obj_desc->reference.object); | |
1da177e4 LT |
155 | break; |
156 | ||
1da177e4 LT |
157 | case AML_REF_OF_OP: |
158 | ||
4be44fcd LB |
159 | acpi_os_printf("Reference: (ref_of) %p\n", |
160 | obj_desc->reference.object); | |
1da177e4 LT |
161 | break; |
162 | ||
1da177e4 LT |
163 | case AML_ARG_OP: |
164 | ||
4be44fcd LB |
165 | acpi_os_printf("Reference: Arg%d", |
166 | obj_desc->reference.offset); | |
1da177e4 | 167 | |
4be44fcd | 168 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
1da177e4 LT |
169 | /* Value is an Integer */ |
170 | ||
4be44fcd LB |
171 | acpi_os_printf(" value is [%8.8X%8.8x]", |
172 | ACPI_FORMAT_UINT64(obj_desc-> | |
173 | integer. | |
174 | value)); | |
1da177e4 LT |
175 | } |
176 | ||
4be44fcd | 177 | acpi_os_printf("\n"); |
1da177e4 LT |
178 | break; |
179 | ||
1da177e4 LT |
180 | case AML_LOCAL_OP: |
181 | ||
4be44fcd LB |
182 | acpi_os_printf("Reference: Local%d", |
183 | obj_desc->reference.offset); | |
1da177e4 | 184 | |
4be44fcd | 185 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
1da177e4 LT |
186 | |
187 | /* Value is an Integer */ | |
188 | ||
4be44fcd LB |
189 | acpi_os_printf(" value is [%8.8X%8.8x]", |
190 | ACPI_FORMAT_UINT64(obj_desc-> | |
191 | integer. | |
192 | value)); | |
1da177e4 LT |
193 | } |
194 | ||
4be44fcd | 195 | acpi_os_printf("\n"); |
1da177e4 LT |
196 | break; |
197 | ||
1da177e4 LT |
198 | case AML_INT_NAMEPATH_OP: |
199 | ||
4be44fcd LB |
200 | acpi_os_printf("Reference.Node->Name %X\n", |
201 | obj_desc->reference.node->name.integer); | |
1da177e4 LT |
202 | break; |
203 | ||
1da177e4 LT |
204 | default: |
205 | ||
206 | /* Unknown opcode */ | |
207 | ||
4be44fcd LB |
208 | acpi_os_printf("Unknown Reference opcode=%X\n", |
209 | obj_desc->reference.opcode); | |
1da177e4 LT |
210 | break; |
211 | ||
212 | } | |
213 | break; | |
214 | ||
1da177e4 LT |
215 | case ACPI_TYPE_BUFFER: |
216 | ||
4be44fcd LB |
217 | acpi_os_printf("Buffer len %X @ %p \n", |
218 | obj_desc->buffer.length, | |
219 | obj_desc->buffer.pointer); | |
1da177e4 LT |
220 | |
221 | length = obj_desc->buffer.length; | |
222 | if (length > 64) { | |
223 | length = 64; | |
224 | } | |
225 | ||
226 | /* Debug only -- dump the buffer contents */ | |
227 | ||
228 | if (obj_desc->buffer.pointer) { | |
4be44fcd | 229 | acpi_os_printf("Buffer Contents: "); |
1da177e4 LT |
230 | |
231 | for (index = 0; index < length; index++) { | |
4be44fcd LB |
232 | acpi_os_printf(" %02x", |
233 | obj_desc->buffer.pointer[index]); | |
1da177e4 | 234 | } |
4be44fcd | 235 | acpi_os_printf("\n"); |
1da177e4 LT |
236 | } |
237 | break; | |
238 | ||
1da177e4 LT |
239 | case ACPI_TYPE_INTEGER: |
240 | ||
4be44fcd LB |
241 | acpi_os_printf("Integer %8.8X%8.8X\n", |
242 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); | |
1da177e4 LT |
243 | break; |
244 | ||
1da177e4 LT |
245 | case ACPI_TYPE_PACKAGE: |
246 | ||
4be44fcd LB |
247 | acpi_os_printf("Package [Len %X] element_array %p\n", |
248 | obj_desc->package.count, | |
249 | obj_desc->package.elements); | |
1da177e4 LT |
250 | |
251 | /* | |
252 | * If elements exist, package element pointer is valid, | |
253 | * and debug_level exceeds 1, dump package's elements. | |
254 | */ | |
255 | if (obj_desc->package.count && | |
4be44fcd LB |
256 | obj_desc->package.elements && acpi_dbg_level > 1) { |
257 | for (index = 0; index < obj_desc->package.count; | |
258 | index++) { | |
259 | acpi_ex_dump_operand(obj_desc->package. | |
260 | elements[index], | |
261 | depth + 1); | |
1da177e4 LT |
262 | } |
263 | } | |
264 | break; | |
265 | ||
1da177e4 LT |
266 | case ACPI_TYPE_REGION: |
267 | ||
4be44fcd LB |
268 | acpi_os_printf("Region %s (%X)", |
269 | acpi_ut_get_region_name(obj_desc->region. | |
270 | space_id), | |
271 | obj_desc->region.space_id); | |
1da177e4 LT |
272 | |
273 | /* | |
274 | * If the address and length have not been evaluated, | |
275 | * don't print them. | |
276 | */ | |
277 | if (!(obj_desc->region.flags & AOPOBJ_DATA_VALID)) { | |
4be44fcd LB |
278 | acpi_os_printf("\n"); |
279 | } else { | |
280 | acpi_os_printf(" base %8.8X%8.8X Length %X\n", | |
281 | ACPI_FORMAT_UINT64(obj_desc->region. | |
282 | address), | |
283 | obj_desc->region.length); | |
1da177e4 LT |
284 | } |
285 | break; | |
286 | ||
1da177e4 LT |
287 | case ACPI_TYPE_STRING: |
288 | ||
4be44fcd LB |
289 | acpi_os_printf("String length %X @ %p ", |
290 | obj_desc->string.length, | |
291 | obj_desc->string.pointer); | |
44f6c012 | 292 | |
4be44fcd LB |
293 | acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); |
294 | acpi_os_printf("\n"); | |
1da177e4 LT |
295 | break; |
296 | ||
1da177e4 LT |
297 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
298 | ||
4be44fcd | 299 | acpi_os_printf("bank_field\n"); |
1da177e4 LT |
300 | break; |
301 | ||
1da177e4 LT |
302 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
303 | ||
4be44fcd LB |
304 | acpi_os_printf |
305 | ("region_field: Bits=%X acc_width=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", | |
306 | obj_desc->field.bit_length, | |
307 | obj_desc->field.access_byte_width, | |
308 | obj_desc->field.field_flags & AML_FIELD_LOCK_RULE_MASK, | |
309 | obj_desc->field.field_flags & AML_FIELD_UPDATE_RULE_MASK, | |
310 | obj_desc->field.base_byte_offset, | |
311 | obj_desc->field.start_field_bit_offset); | |
44f6c012 | 312 | |
4be44fcd | 313 | acpi_ex_dump_operand(obj_desc->field.region_obj, depth + 1); |
1da177e4 LT |
314 | break; |
315 | ||
1da177e4 LT |
316 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
317 | ||
4be44fcd | 318 | acpi_os_printf("index_field\n"); |
1da177e4 LT |
319 | break; |
320 | ||
1da177e4 LT |
321 | case ACPI_TYPE_BUFFER_FIELD: |
322 | ||
4be44fcd LB |
323 | acpi_os_printf("buffer_field: %X bits at byte %X bit %X of \n", |
324 | obj_desc->buffer_field.bit_length, | |
325 | obj_desc->buffer_field.base_byte_offset, | |
326 | obj_desc->buffer_field.start_field_bit_offset); | |
1da177e4 LT |
327 | |
328 | if (!obj_desc->buffer_field.buffer_obj) { | |
4be44fcd LB |
329 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "*NULL* \n")); |
330 | } else | |
331 | if (ACPI_GET_OBJECT_TYPE(obj_desc->buffer_field.buffer_obj) | |
332 | != ACPI_TYPE_BUFFER) { | |
333 | acpi_os_printf("*not a Buffer* \n"); | |
334 | } else { | |
335 | acpi_ex_dump_operand(obj_desc->buffer_field.buffer_obj, | |
336 | depth + 1); | |
1da177e4 LT |
337 | } |
338 | break; | |
339 | ||
1da177e4 LT |
340 | case ACPI_TYPE_EVENT: |
341 | ||
4be44fcd | 342 | acpi_os_printf("Event\n"); |
1da177e4 LT |
343 | break; |
344 | ||
1da177e4 LT |
345 | case ACPI_TYPE_METHOD: |
346 | ||
4be44fcd LB |
347 | acpi_os_printf("Method(%X) @ %p:%X\n", |
348 | obj_desc->method.param_count, | |
349 | obj_desc->method.aml_start, | |
350 | obj_desc->method.aml_length); | |
1da177e4 LT |
351 | break; |
352 | ||
1da177e4 LT |
353 | case ACPI_TYPE_MUTEX: |
354 | ||
4be44fcd | 355 | acpi_os_printf("Mutex\n"); |
1da177e4 LT |
356 | break; |
357 | ||
1da177e4 LT |
358 | case ACPI_TYPE_DEVICE: |
359 | ||
4be44fcd | 360 | acpi_os_printf("Device\n"); |
1da177e4 LT |
361 | break; |
362 | ||
1da177e4 LT |
363 | case ACPI_TYPE_POWER: |
364 | ||
4be44fcd | 365 | acpi_os_printf("Power\n"); |
1da177e4 LT |
366 | break; |
367 | ||
1da177e4 LT |
368 | case ACPI_TYPE_PROCESSOR: |
369 | ||
4be44fcd | 370 | acpi_os_printf("Processor\n"); |
1da177e4 LT |
371 | break; |
372 | ||
1da177e4 LT |
373 | case ACPI_TYPE_THERMAL: |
374 | ||
4be44fcd | 375 | acpi_os_printf("Thermal\n"); |
1da177e4 LT |
376 | break; |
377 | ||
1da177e4 LT |
378 | default: |
379 | /* Unknown Type */ | |
380 | ||
4be44fcd LB |
381 | acpi_os_printf("Unknown Type %X\n", |
382 | ACPI_GET_OBJECT_TYPE(obj_desc)); | |
1da177e4 LT |
383 | break; |
384 | } | |
385 | ||
386 | return; | |
387 | } | |
388 | ||
44f6c012 | 389 | /******************************************************************************* |
1da177e4 LT |
390 | * |
391 | * FUNCTION: acpi_ex_dump_operands | |
392 | * | |
393 | * PARAMETERS: Operands - Operand list | |
394 | * interpreter_mode - Load or Exec | |
395 | * Ident - Identification | |
396 | * num_levels - # of stack entries to dump above line | |
397 | * Note - Output notation | |
398 | * module_name - Caller's module name | |
399 | * line_number - Caller's invocation line number | |
400 | * | |
401 | * DESCRIPTION: Dump the object stack | |
402 | * | |
44f6c012 | 403 | ******************************************************************************/ |
1da177e4 LT |
404 | |
405 | void | |
4be44fcd LB |
406 | acpi_ex_dump_operands(union acpi_operand_object **operands, |
407 | acpi_interpreter_mode interpreter_mode, | |
408 | char *ident, | |
409 | u32 num_levels, | |
410 | char *note, char *module_name, u32 line_number) | |
1da177e4 | 411 | { |
4be44fcd | 412 | acpi_native_uint i; |
1da177e4 | 413 | |
4be44fcd | 414 | ACPI_FUNCTION_NAME("ex_dump_operands"); |
1da177e4 LT |
415 | |
416 | if (!ident) { | |
417 | ident = "?"; | |
418 | } | |
419 | ||
420 | if (!note) { | |
421 | note = "?"; | |
422 | } | |
423 | ||
4be44fcd LB |
424 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
425 | "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", | |
426 | ident, num_levels)); | |
1da177e4 LT |
427 | |
428 | if (num_levels == 0) { | |
429 | num_levels = 1; | |
430 | } | |
431 | ||
432 | /* Dump the operand stack starting at the top */ | |
433 | ||
434 | for (i = 0; num_levels > 0; i--, num_levels--) { | |
4be44fcd | 435 | acpi_ex_dump_operand(operands[i], 0); |
1da177e4 LT |
436 | } |
437 | ||
4be44fcd LB |
438 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
439 | "************* Operand Stack dump from %s(%d), %s\n", | |
440 | module_name, line_number, note)); | |
1da177e4 LT |
441 | return; |
442 | } | |
443 | ||
1da177e4 | 444 | #ifdef ACPI_FUTURE_USAGE |
44f6c012 | 445 | /******************************************************************************* |
1da177e4 | 446 | * |
44f6c012 | 447 | * FUNCTION: acpi_ex_out* functions |
1da177e4 LT |
448 | * |
449 | * PARAMETERS: Title - Descriptive text | |
450 | * Value - Value to be displayed | |
451 | * | |
452 | * DESCRIPTION: Object dump output formatting functions. These functions | |
453 | * reduce the number of format strings required and keeps them | |
454 | * all in one place for easy modification. | |
455 | * | |
44f6c012 | 456 | ******************************************************************************/ |
1da177e4 | 457 | |
4be44fcd | 458 | static void acpi_ex_out_string(char *title, char *value) |
1da177e4 | 459 | { |
4be44fcd | 460 | acpi_os_printf("%20s : %s\n", title, value); |
1da177e4 LT |
461 | } |
462 | ||
4be44fcd | 463 | static void acpi_ex_out_pointer(char *title, void *value) |
1da177e4 | 464 | { |
4be44fcd | 465 | acpi_os_printf("%20s : %p\n", title, value); |
1da177e4 LT |
466 | } |
467 | ||
4be44fcd | 468 | static void acpi_ex_out_integer(char *title, u32 value) |
1da177e4 | 469 | { |
4be44fcd | 470 | acpi_os_printf("%20s : %.2X\n", title, value); |
1da177e4 LT |
471 | } |
472 | ||
4be44fcd | 473 | static void acpi_ex_out_address(char *title, acpi_physical_address value) |
1da177e4 LT |
474 | { |
475 | ||
476 | #if ACPI_MACHINE_WIDTH == 16 | |
4be44fcd | 477 | acpi_os_printf("%20s : %p\n", title, value); |
1da177e4 | 478 | #else |
4be44fcd | 479 | acpi_os_printf("%20s : %8.8X%8.8X\n", title, ACPI_FORMAT_UINT64(value)); |
1da177e4 LT |
480 | #endif |
481 | } | |
482 | ||
44f6c012 | 483 | /******************************************************************************* |
1da177e4 LT |
484 | * |
485 | * FUNCTION: acpi_ex_dump_node | |
486 | * | |
487 | * PARAMETERS: *Node - Descriptor to dump | |
44f6c012 | 488 | * Flags - Force display if TRUE |
1da177e4 LT |
489 | * |
490 | * DESCRIPTION: Dumps the members of the given.Node | |
491 | * | |
44f6c012 | 492 | ******************************************************************************/ |
1da177e4 | 493 | |
4be44fcd | 494 | void acpi_ex_dump_node(struct acpi_namespace_node *node, u32 flags) |
1da177e4 LT |
495 | { |
496 | ||
4be44fcd | 497 | ACPI_FUNCTION_ENTRY(); |
1da177e4 LT |
498 | |
499 | if (!flags) { | |
4be44fcd LB |
500 | if (! |
501 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | |
502 | && (_COMPONENT & acpi_dbg_layer))) { | |
1da177e4 LT |
503 | return; |
504 | } | |
505 | } | |
506 | ||
4be44fcd LB |
507 | acpi_os_printf("%20s : %4.4s\n", "Name", acpi_ut_get_node_name(node)); |
508 | acpi_ex_out_string("Type", acpi_ut_get_type_name(node->type)); | |
509 | acpi_ex_out_integer("Flags", node->flags); | |
510 | acpi_ex_out_integer("Owner Id", node->owner_id); | |
511 | acpi_ex_out_integer("Reference Count", node->reference_count); | |
512 | acpi_ex_out_pointer("Attached Object", | |
513 | acpi_ns_get_attached_object(node)); | |
514 | acpi_ex_out_pointer("child_list", node->child); | |
515 | acpi_ex_out_pointer("next_peer", node->peer); | |
516 | acpi_ex_out_pointer("Parent", acpi_ns_get_parent_node(node)); | |
1da177e4 LT |
517 | } |
518 | ||
73459f73 RM |
519 | /******************************************************************************* |
520 | * | |
521 | * FUNCTION: acpi_ex_dump_reference | |
522 | * | |
523 | * PARAMETERS: Object - Descriptor to dump | |
524 | * | |
525 | * DESCRIPTION: Dumps a reference object | |
526 | * | |
527 | ******************************************************************************/ | |
528 | ||
4be44fcd | 529 | static void acpi_ex_dump_reference(union acpi_operand_object *obj_desc) |
73459f73 | 530 | { |
4be44fcd LB |
531 | struct acpi_buffer ret_buf; |
532 | acpi_status status; | |
73459f73 RM |
533 | |
534 | if (obj_desc->reference.opcode == AML_INT_NAMEPATH_OP) { | |
4be44fcd | 535 | acpi_os_printf("Named Object %p ", obj_desc->reference.node); |
73459f73 | 536 | ret_buf.length = ACPI_ALLOCATE_LOCAL_BUFFER; |
4be44fcd LB |
537 | status = |
538 | acpi_ns_handle_to_pathname(obj_desc->reference.node, | |
539 | &ret_buf); | |
540 | if (ACPI_FAILURE(status)) { | |
541 | acpi_os_printf("Could not convert name to pathname\n"); | |
542 | } else { | |
543 | acpi_os_printf("%s\n", (char *)ret_buf.pointer); | |
544 | ACPI_MEM_FREE(ret_buf.pointer); | |
73459f73 | 545 | } |
4be44fcd LB |
546 | } else if (obj_desc->reference.object) { |
547 | acpi_os_printf("\nReferenced Object: %p\n", | |
548 | obj_desc->reference.object); | |
73459f73 RM |
549 | } |
550 | } | |
551 | ||
73459f73 RM |
552 | /******************************************************************************* |
553 | * | |
554 | * FUNCTION: acpi_ex_dump_package | |
555 | * | |
556 | * PARAMETERS: Object - Descriptor to dump | |
557 | * Level - Indentation Level | |
558 | * Index - Package index for this object | |
559 | * | |
560 | * DESCRIPTION: Dumps the elements of the package | |
561 | * | |
562 | ******************************************************************************/ | |
563 | ||
564 | static void | |
4be44fcd | 565 | acpi_ex_dump_package(union acpi_operand_object *obj_desc, u32 level, u32 index) |
73459f73 | 566 | { |
4be44fcd | 567 | u32 i; |
73459f73 RM |
568 | |
569 | /* Indentation and index output */ | |
570 | ||
571 | if (level > 0) { | |
572 | for (i = 0; i < level; i++) { | |
4be44fcd | 573 | acpi_os_printf(" "); |
73459f73 RM |
574 | } |
575 | ||
4be44fcd | 576 | acpi_os_printf("[%.2d] ", index); |
73459f73 RM |
577 | } |
578 | ||
4be44fcd | 579 | acpi_os_printf("%p ", obj_desc); |
73459f73 RM |
580 | |
581 | /* Null package elements are allowed */ | |
582 | ||
583 | if (!obj_desc) { | |
4be44fcd | 584 | acpi_os_printf("[Null Object]\n"); |
73459f73 RM |
585 | return; |
586 | } | |
587 | ||
588 | /* Packages may only contain a few object types */ | |
589 | ||
4be44fcd | 590 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
73459f73 RM |
591 | case ACPI_TYPE_INTEGER: |
592 | ||
4be44fcd LB |
593 | acpi_os_printf("[Integer] = %8.8X%8.8X\n", |
594 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); | |
73459f73 RM |
595 | break; |
596 | ||
73459f73 RM |
597 | case ACPI_TYPE_STRING: |
598 | ||
4be44fcd | 599 | acpi_os_printf("[String] Value: "); |
73459f73 | 600 | for (i = 0; i < obj_desc->string.length; i++) { |
4be44fcd | 601 | acpi_os_printf("%c", obj_desc->string.pointer[i]); |
73459f73 | 602 | } |
4be44fcd | 603 | acpi_os_printf("\n"); |
73459f73 RM |
604 | break; |
605 | ||
73459f73 RM |
606 | case ACPI_TYPE_BUFFER: |
607 | ||
4be44fcd LB |
608 | acpi_os_printf("[Buffer] Length %.2X = ", |
609 | obj_desc->buffer.length); | |
73459f73 | 610 | if (obj_desc->buffer.length) { |
4be44fcd LB |
611 | acpi_ut_dump_buffer((u8 *) obj_desc->buffer.pointer, |
612 | obj_desc->buffer.length, | |
613 | DB_DWORD_DISPLAY, _COMPONENT); | |
614 | } else { | |
615 | acpi_os_printf("\n"); | |
73459f73 RM |
616 | } |
617 | break; | |
618 | ||
73459f73 RM |
619 | case ACPI_TYPE_PACKAGE: |
620 | ||
4be44fcd LB |
621 | acpi_os_printf("[Package] Contains %d Elements: \n", |
622 | obj_desc->package.count); | |
73459f73 RM |
623 | |
624 | for (i = 0; i < obj_desc->package.count; i++) { | |
4be44fcd LB |
625 | acpi_ex_dump_package(obj_desc->package.elements[i], |
626 | level + 1, i); | |
73459f73 RM |
627 | } |
628 | break; | |
629 | ||
73459f73 RM |
630 | case ACPI_TYPE_LOCAL_REFERENCE: |
631 | ||
4be44fcd LB |
632 | acpi_os_printf("[Object Reference] "); |
633 | acpi_ex_dump_reference(obj_desc); | |
73459f73 RM |
634 | break; |
635 | ||
73459f73 RM |
636 | default: |
637 | ||
4be44fcd LB |
638 | acpi_os_printf("[Unknown Type] %X\n", |
639 | ACPI_GET_OBJECT_TYPE(obj_desc)); | |
73459f73 RM |
640 | break; |
641 | } | |
642 | } | |
643 | ||
44f6c012 | 644 | /******************************************************************************* |
1da177e4 LT |
645 | * |
646 | * FUNCTION: acpi_ex_dump_object_descriptor | |
647 | * | |
73459f73 | 648 | * PARAMETERS: Object - Descriptor to dump |
44f6c012 | 649 | * Flags - Force display if TRUE |
1da177e4 LT |
650 | * |
651 | * DESCRIPTION: Dumps the members of the object descriptor given. | |
652 | * | |
44f6c012 | 653 | ******************************************************************************/ |
1da177e4 LT |
654 | |
655 | void | |
4be44fcd | 656 | acpi_ex_dump_object_descriptor(union acpi_operand_object *obj_desc, u32 flags) |
1da177e4 | 657 | { |
4be44fcd | 658 | ACPI_FUNCTION_TRACE("ex_dump_object_descriptor"); |
1da177e4 | 659 | |
44f6c012 RM |
660 | if (!obj_desc) { |
661 | return_VOID; | |
662 | } | |
663 | ||
1da177e4 | 664 | if (!flags) { |
4be44fcd LB |
665 | if (! |
666 | ((ACPI_LV_OBJECTS & acpi_dbg_level) | |
667 | && (_COMPONENT & acpi_dbg_layer))) { | |
1da177e4 LT |
668 | return_VOID; |
669 | } | |
670 | } | |
671 | ||
4be44fcd LB |
672 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == ACPI_DESC_TYPE_NAMED) { |
673 | acpi_ex_dump_node((struct acpi_namespace_node *)obj_desc, | |
674 | flags); | |
675 | acpi_os_printf("\nAttached Object (%p):\n", | |
676 | ((struct acpi_namespace_node *)obj_desc)-> | |
677 | object); | |
678 | acpi_ex_dump_object_descriptor(((struct acpi_namespace_node *) | |
679 | obj_desc)->object, flags); | |
1da177e4 LT |
680 | return_VOID; |
681 | } | |
682 | ||
4be44fcd LB |
683 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != ACPI_DESC_TYPE_OPERAND) { |
684 | acpi_os_printf | |
685 | ("ex_dump_object_descriptor: %p is not an ACPI operand object: [%s]\n", | |
686 | obj_desc, acpi_ut_get_descriptor_name(obj_desc)); | |
1da177e4 LT |
687 | return_VOID; |
688 | } | |
689 | ||
690 | /* Common Fields */ | |
691 | ||
4be44fcd LB |
692 | acpi_ex_out_string("Type", acpi_ut_get_object_type_name(obj_desc)); |
693 | acpi_ex_out_integer("Reference Count", | |
694 | obj_desc->common.reference_count); | |
695 | acpi_ex_out_integer("Flags", obj_desc->common.flags); | |
1da177e4 LT |
696 | |
697 | /* Object-specific Fields */ | |
698 | ||
4be44fcd | 699 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
1da177e4 LT |
700 | case ACPI_TYPE_INTEGER: |
701 | ||
4be44fcd LB |
702 | acpi_os_printf("%20s : %8.8X%8.8X\n", "Value", |
703 | ACPI_FORMAT_UINT64(obj_desc->integer.value)); | |
1da177e4 LT |
704 | break; |
705 | ||
1da177e4 LT |
706 | case ACPI_TYPE_STRING: |
707 | ||
4be44fcd | 708 | acpi_ex_out_integer("Length", obj_desc->string.length); |
1da177e4 | 709 | |
4be44fcd LB |
710 | acpi_os_printf("%20s : %p ", "Pointer", |
711 | obj_desc->string.pointer); | |
712 | acpi_ut_print_string(obj_desc->string.pointer, ACPI_UINT8_MAX); | |
713 | acpi_os_printf("\n"); | |
1da177e4 LT |
714 | break; |
715 | ||
1da177e4 LT |
716 | case ACPI_TYPE_BUFFER: |
717 | ||
4be44fcd LB |
718 | acpi_ex_out_integer("Length", obj_desc->buffer.length); |
719 | acpi_ex_out_pointer("Pointer", obj_desc->buffer.pointer); | |
720 | ACPI_DUMP_BUFFER(obj_desc->buffer.pointer, | |
721 | obj_desc->buffer.length); | |
1da177e4 LT |
722 | break; |
723 | ||
1da177e4 LT |
724 | case ACPI_TYPE_PACKAGE: |
725 | ||
4be44fcd LB |
726 | acpi_ex_out_integer("Flags", obj_desc->package.flags); |
727 | acpi_ex_out_integer("Elements", obj_desc->package.count); | |
728 | acpi_ex_out_pointer("Element List", obj_desc->package.elements); | |
1da177e4 LT |
729 | |
730 | /* Dump the package contents */ | |
731 | ||
4be44fcd LB |
732 | acpi_os_printf("\nPackage Contents:\n"); |
733 | acpi_ex_dump_package(obj_desc, 0, 0); | |
1da177e4 LT |
734 | break; |
735 | ||
1da177e4 LT |
736 | case ACPI_TYPE_DEVICE: |
737 | ||
4be44fcd LB |
738 | acpi_ex_out_pointer("Handler", obj_desc->device.handler); |
739 | acpi_ex_out_pointer("system_notify", | |
740 | obj_desc->device.system_notify); | |
741 | acpi_ex_out_pointer("device_notify", | |
742 | obj_desc->device.device_notify); | |
1da177e4 LT |
743 | break; |
744 | ||
1da177e4 LT |
745 | case ACPI_TYPE_EVENT: |
746 | ||
4be44fcd | 747 | acpi_ex_out_pointer("Semaphore", obj_desc->event.semaphore); |
1da177e4 LT |
748 | break; |
749 | ||
1da177e4 LT |
750 | case ACPI_TYPE_METHOD: |
751 | ||
4be44fcd LB |
752 | acpi_ex_out_integer("param_count", |
753 | obj_desc->method.param_count); | |
754 | acpi_ex_out_integer("Concurrency", | |
755 | obj_desc->method.concurrency); | |
756 | acpi_ex_out_pointer("Semaphore", obj_desc->method.semaphore); | |
757 | acpi_ex_out_integer("owner_id", obj_desc->method.owner_id); | |
758 | acpi_ex_out_integer("aml_length", obj_desc->method.aml_length); | |
759 | acpi_ex_out_pointer("aml_start", obj_desc->method.aml_start); | |
1da177e4 LT |
760 | break; |
761 | ||
1da177e4 LT |
762 | case ACPI_TYPE_MUTEX: |
763 | ||
4be44fcd LB |
764 | acpi_ex_out_integer("sync_level", obj_desc->mutex.sync_level); |
765 | acpi_ex_out_pointer("owner_thread", | |
766 | obj_desc->mutex.owner_thread); | |
767 | acpi_ex_out_integer("acquire_depth", | |
768 | obj_desc->mutex.acquisition_depth); | |
769 | acpi_ex_out_pointer("Semaphore", obj_desc->mutex.semaphore); | |
1da177e4 LT |
770 | break; |
771 | ||
1da177e4 LT |
772 | case ACPI_TYPE_REGION: |
773 | ||
4be44fcd LB |
774 | acpi_ex_out_integer("space_id", obj_desc->region.space_id); |
775 | acpi_ex_out_integer("Flags", obj_desc->region.flags); | |
776 | acpi_ex_out_address("Address", obj_desc->region.address); | |
777 | acpi_ex_out_integer("Length", obj_desc->region.length); | |
778 | acpi_ex_out_pointer("Handler", obj_desc->region.handler); | |
779 | acpi_ex_out_pointer("Next", obj_desc->region.next); | |
1da177e4 LT |
780 | break; |
781 | ||
1da177e4 LT |
782 | case ACPI_TYPE_POWER: |
783 | ||
4be44fcd LB |
784 | acpi_ex_out_integer("system_level", |
785 | obj_desc->power_resource.system_level); | |
786 | acpi_ex_out_integer("resource_order", | |
787 | obj_desc->power_resource.resource_order); | |
788 | acpi_ex_out_pointer("system_notify", | |
789 | obj_desc->power_resource.system_notify); | |
790 | acpi_ex_out_pointer("device_notify", | |
791 | obj_desc->power_resource.device_notify); | |
1da177e4 LT |
792 | break; |
793 | ||
1da177e4 LT |
794 | case ACPI_TYPE_PROCESSOR: |
795 | ||
4be44fcd LB |
796 | acpi_ex_out_integer("Processor ID", |
797 | obj_desc->processor.proc_id); | |
798 | acpi_ex_out_integer("Length", obj_desc->processor.length); | |
799 | acpi_ex_out_address("Address", | |
800 | (acpi_physical_address) obj_desc->processor. | |
801 | address); | |
802 | acpi_ex_out_pointer("system_notify", | |
803 | obj_desc->processor.system_notify); | |
804 | acpi_ex_out_pointer("device_notify", | |
805 | obj_desc->processor.device_notify); | |
806 | acpi_ex_out_pointer("Handler", obj_desc->processor.handler); | |
1da177e4 LT |
807 | break; |
808 | ||
1da177e4 LT |
809 | case ACPI_TYPE_THERMAL: |
810 | ||
4be44fcd LB |
811 | acpi_ex_out_pointer("system_notify", |
812 | obj_desc->thermal_zone.system_notify); | |
813 | acpi_ex_out_pointer("device_notify", | |
814 | obj_desc->thermal_zone.device_notify); | |
815 | acpi_ex_out_pointer("Handler", obj_desc->thermal_zone.handler); | |
1da177e4 LT |
816 | break; |
817 | ||
1da177e4 LT |
818 | case ACPI_TYPE_BUFFER_FIELD: |
819 | case ACPI_TYPE_LOCAL_REGION_FIELD: | |
820 | case ACPI_TYPE_LOCAL_BANK_FIELD: | |
821 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | |
822 | ||
4be44fcd LB |
823 | acpi_ex_out_integer("field_flags", |
824 | obj_desc->common_field.field_flags); | |
825 | acpi_ex_out_integer("access_byte_width", | |
826 | obj_desc->common_field.access_byte_width); | |
827 | acpi_ex_out_integer("bit_length", | |
828 | obj_desc->common_field.bit_length); | |
829 | acpi_ex_out_integer("fld_bit_offset", | |
830 | obj_desc->common_field. | |
831 | start_field_bit_offset); | |
832 | acpi_ex_out_integer("base_byte_offset", | |
833 | obj_desc->common_field.base_byte_offset); | |
834 | acpi_ex_out_pointer("parent_node", obj_desc->common_field.node); | |
835 | ||
836 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | |
1da177e4 | 837 | case ACPI_TYPE_BUFFER_FIELD: |
4be44fcd LB |
838 | acpi_ex_out_pointer("buffer_obj", |
839 | obj_desc->buffer_field.buffer_obj); | |
1da177e4 LT |
840 | break; |
841 | ||
842 | case ACPI_TYPE_LOCAL_REGION_FIELD: | |
4be44fcd LB |
843 | acpi_ex_out_pointer("region_obj", |
844 | obj_desc->field.region_obj); | |
1da177e4 LT |
845 | break; |
846 | ||
847 | case ACPI_TYPE_LOCAL_BANK_FIELD: | |
4be44fcd LB |
848 | acpi_ex_out_integer("Value", |
849 | obj_desc->bank_field.value); | |
850 | acpi_ex_out_pointer("region_obj", | |
851 | obj_desc->bank_field.region_obj); | |
852 | acpi_ex_out_pointer("bank_obj", | |
853 | obj_desc->bank_field.bank_obj); | |
1da177e4 LT |
854 | break; |
855 | ||
856 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | |
4be44fcd LB |
857 | acpi_ex_out_integer("Value", |
858 | obj_desc->index_field.value); | |
859 | acpi_ex_out_pointer("Index", | |
860 | obj_desc->index_field.index_obj); | |
861 | acpi_ex_out_pointer("Data", | |
862 | obj_desc->index_field.data_obj); | |
1da177e4 LT |
863 | break; |
864 | ||
865 | default: | |
866 | /* All object types covered above */ | |
867 | break; | |
868 | } | |
869 | break; | |
870 | ||
1da177e4 LT |
871 | case ACPI_TYPE_LOCAL_REFERENCE: |
872 | ||
4be44fcd LB |
873 | acpi_ex_out_integer("target_type", |
874 | obj_desc->reference.target_type); | |
875 | acpi_ex_out_string("Opcode", | |
876 | (acpi_ps_get_opcode_info | |
877 | (obj_desc->reference.opcode))->name); | |
878 | acpi_ex_out_integer("Offset", obj_desc->reference.offset); | |
879 | acpi_ex_out_pointer("obj_desc", obj_desc->reference.object); | |
880 | acpi_ex_out_pointer("Node", obj_desc->reference.node); | |
881 | acpi_ex_out_pointer("Where", obj_desc->reference.where); | |
44f6c012 | 882 | |
4be44fcd | 883 | acpi_ex_dump_reference(obj_desc); |
1da177e4 LT |
884 | break; |
885 | ||
1da177e4 LT |
886 | case ACPI_TYPE_LOCAL_ADDRESS_HANDLER: |
887 | ||
4be44fcd LB |
888 | acpi_ex_out_integer("space_id", |
889 | obj_desc->address_space.space_id); | |
890 | acpi_ex_out_pointer("Next", obj_desc->address_space.next); | |
891 | acpi_ex_out_pointer("region_list", | |
892 | obj_desc->address_space.region_list); | |
893 | acpi_ex_out_pointer("Node", obj_desc->address_space.node); | |
894 | acpi_ex_out_pointer("Context", obj_desc->address_space.context); | |
1da177e4 LT |
895 | break; |
896 | ||
1da177e4 LT |
897 | case ACPI_TYPE_LOCAL_NOTIFY: |
898 | ||
4be44fcd LB |
899 | acpi_ex_out_pointer("Node", obj_desc->notify.node); |
900 | acpi_ex_out_pointer("Context", obj_desc->notify.context); | |
1da177e4 LT |
901 | break; |
902 | ||
1da177e4 LT |
903 | case ACPI_TYPE_LOCAL_ALIAS: |
904 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | |
905 | case ACPI_TYPE_LOCAL_EXTRA: | |
906 | case ACPI_TYPE_LOCAL_DATA: | |
907 | default: | |
908 | ||
4be44fcd LB |
909 | acpi_os_printf |
910 | ("ex_dump_object_descriptor: Display not implemented for object type %s\n", | |
911 | acpi_ut_get_object_type_name(obj_desc)); | |
1da177e4 LT |
912 | break; |
913 | } | |
914 | ||
915 | return_VOID; | |
916 | } | |
917 | ||
4be44fcd | 918 | #endif /* ACPI_FUTURE_USAGE */ |
1da177e4 | 919 | #endif |