Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Module Name: nsdump - table dumping routines for debug | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
25f044e6 | 8 | * Copyright (C) 2000 - 2013, Intel Corp. |
1da177e4 LT |
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 | 44 | #include <acpi/acpi.h> |
e2f7a777 LB |
45 | #include "accommon.h" |
46 | #include "acnamesp.h" | |
e81a52b8 | 47 | #include <acpi/acoutput.h> |
1da177e4 | 48 | |
1da177e4 | 49 | #define _COMPONENT ACPI_NAMESPACE |
4be44fcd | 50 | ACPI_MODULE_NAME("nsdump") |
1da177e4 | 51 | |
44f6c012 | 52 | /* Local prototypes */ |
44f6c012 | 53 | #ifdef ACPI_OBSOLETE_FUNCTIONS |
4be44fcd | 54 | void acpi_ns_dump_root_devices(void); |
1da177e4 | 55 | |
44f6c012 | 56 | static acpi_status |
4be44fcd LB |
57 | acpi_ns_dump_one_device(acpi_handle obj_handle, |
58 | u32 level, void *context, void **return_value); | |
44f6c012 RM |
59 | #endif |
60 | ||
44f6c012 | 61 | #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) |
1da177e4 LT |
62 | /******************************************************************************* |
63 | * | |
64 | * FUNCTION: acpi_ns_print_pathname | |
65 | * | |
44f6c012 | 66 | * PARAMETERS: num_segments - Number of ACPI name segments |
ba494bee | 67 | * pathname - The compressed (internal) path |
1da177e4 | 68 | * |
44f6c012 RM |
69 | * RETURN: None |
70 | * | |
1da177e4 LT |
71 | * DESCRIPTION: Print an object's full namespace pathname |
72 | * | |
73 | ******************************************************************************/ | |
74 | ||
4be44fcd | 75 | void acpi_ns_print_pathname(u32 num_segments, char *pathname) |
1da177e4 | 76 | { |
67a119f9 | 77 | u32 i; |
0c9938cc | 78 | |
b229cf92 | 79 | ACPI_FUNCTION_NAME(ns_print_pathname); |
0c9938cc | 80 | |
10e9e759 BM |
81 | /* Check if debug output enabled */ |
82 | ||
83 | if (!ACPI_IS_DEBUG_ENABLED(ACPI_LV_NAMES, ACPI_NAMESPACE)) { | |
1da177e4 LT |
84 | return; |
85 | } | |
86 | ||
87 | /* Print the entire name */ | |
88 | ||
4be44fcd | 89 | ACPI_DEBUG_PRINT((ACPI_DB_NAMES, "[")); |
1da177e4 LT |
90 | |
91 | while (num_segments) { | |
0c9938cc | 92 | for (i = 0; i < 4; i++) { |
4be44fcd LB |
93 | ACPI_IS_PRINT(pathname[i]) ? |
94 | acpi_os_printf("%c", pathname[i]) : | |
95 | acpi_os_printf("?"); | |
0c9938cc | 96 | } |
1da177e4 | 97 | |
0c9938cc | 98 | pathname += ACPI_NAME_SIZE; |
1da177e4 LT |
99 | num_segments--; |
100 | if (num_segments) { | |
4be44fcd | 101 | acpi_os_printf("."); |
1da177e4 LT |
102 | } |
103 | } | |
104 | ||
4be44fcd | 105 | acpi_os_printf("]\n"); |
1da177e4 LT |
106 | } |
107 | ||
1da177e4 LT |
108 | /******************************************************************************* |
109 | * | |
110 | * FUNCTION: acpi_ns_dump_pathname | |
111 | * | |
ba494bee BM |
112 | * PARAMETERS: handle - Object |
113 | * msg - Prefix message | |
114 | * level - Desired debug level | |
115 | * component - Caller's component ID | |
1da177e4 | 116 | * |
44f6c012 RM |
117 | * RETURN: None |
118 | * | |
1da177e4 LT |
119 | * DESCRIPTION: Print an object's full namespace pathname |
120 | * Manages allocation/freeing of a pathname buffer | |
121 | * | |
122 | ******************************************************************************/ | |
123 | ||
124 | void | |
4be44fcd | 125 | acpi_ns_dump_pathname(acpi_handle handle, char *msg, u32 level, u32 component) |
1da177e4 LT |
126 | { |
127 | ||
b229cf92 | 128 | ACPI_FUNCTION_TRACE(ns_dump_pathname); |
1da177e4 LT |
129 | |
130 | /* Do this only if the requested debug level and component are enabled */ | |
131 | ||
10e9e759 | 132 | if (!ACPI_IS_DEBUG_ENABLED(level, component)) { |
1da177e4 LT |
133 | return_VOID; |
134 | } | |
135 | ||
136 | /* Convert handle to a full pathname and print it (with supplied message) */ | |
137 | ||
4be44fcd LB |
138 | acpi_ns_print_node_pathname(handle, msg); |
139 | acpi_os_printf("\n"); | |
1da177e4 LT |
140 | return_VOID; |
141 | } | |
142 | ||
1da177e4 LT |
143 | /******************************************************************************* |
144 | * | |
145 | * FUNCTION: acpi_ns_dump_one_object | |
146 | * | |
44f6c012 | 147 | * PARAMETERS: obj_handle - Node to be dumped |
ba494bee BM |
148 | * level - Nesting level of the handle |
149 | * context - Passed into walk_namespace | |
44f6c012 RM |
150 | * return_value - Not used |
151 | * | |
152 | * RETURN: Status | |
1da177e4 LT |
153 | * |
154 | * DESCRIPTION: Dump a single Node | |
155 | * This procedure is a user_function called by acpi_ns_walk_namespace. | |
156 | * | |
157 | ******************************************************************************/ | |
158 | ||
159 | acpi_status | |
4be44fcd LB |
160 | acpi_ns_dump_one_object(acpi_handle obj_handle, |
161 | u32 level, void *context, void **return_value) | |
1da177e4 | 162 | { |
4be44fcd LB |
163 | struct acpi_walk_info *info = (struct acpi_walk_info *)context; |
164 | struct acpi_namespace_node *this_node; | |
165 | union acpi_operand_object *obj_desc = NULL; | |
166 | acpi_object_type obj_type; | |
167 | acpi_object_type type; | |
168 | u32 bytes_to_dump; | |
169 | u32 dbg_level; | |
170 | u32 i; | |
1da177e4 | 171 | |
b229cf92 | 172 | ACPI_FUNCTION_NAME(ns_dump_one_object); |
1da177e4 LT |
173 | |
174 | /* Is output enabled? */ | |
175 | ||
176 | if (!(acpi_dbg_level & info->debug_level)) { | |
177 | return (AE_OK); | |
178 | } | |
179 | ||
180 | if (!obj_handle) { | |
4be44fcd | 181 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Null object handle\n")); |
1da177e4 LT |
182 | return (AE_OK); |
183 | } | |
184 | ||
f24b664d | 185 | this_node = acpi_ns_validate_handle(obj_handle); |
4bbfb85d BM |
186 | if (!this_node) { |
187 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Invalid object handle %p\n", | |
188 | obj_handle)); | |
189 | return (AE_OK); | |
190 | } | |
191 | ||
1da177e4 LT |
192 | type = this_node->type; |
193 | ||
194 | /* Check if the owner matches */ | |
195 | ||
f9f4601f | 196 | if ((info->owner_id != ACPI_OWNER_ID_MAX) && |
4be44fcd | 197 | (info->owner_id != this_node->owner_id)) { |
1da177e4 LT |
198 | return (AE_OK); |
199 | } | |
200 | ||
73459f73 | 201 | if (!(info->display_type & ACPI_DISPLAY_SHORT)) { |
52fc0b02 | 202 | |
73459f73 | 203 | /* Indent the object according to the level */ |
1da177e4 | 204 | |
4be44fcd | 205 | acpi_os_printf("%2d%*s", (u32) level - 1, (int)level * 2, " "); |
1da177e4 | 206 | |
73459f73 | 207 | /* Check the node type and name */ |
1da177e4 | 208 | |
73459f73 | 209 | if (type > ACPI_TYPE_LOCAL_MAX) { |
f6a22b0b BM |
210 | ACPI_WARNING((AE_INFO, |
211 | "Invalid ACPI Object Type 0x%08X", type)); | |
73459f73 RM |
212 | } |
213 | ||
4be44fcd | 214 | acpi_os_printf("%4.4s", acpi_ut_get_node_name(this_node)); |
1da177e4 LT |
215 | } |
216 | ||
d4913dc6 BM |
217 | /* Now we can print out the pertinent information */ |
218 | ||
28f55ebc BM |
219 | acpi_os_printf(" %-12s %p %2.2X ", |
220 | acpi_ut_get_type_name(type), this_node, | |
221 | this_node->owner_id); | |
1da177e4 LT |
222 | |
223 | dbg_level = acpi_dbg_level; | |
224 | acpi_dbg_level = 0; | |
4be44fcd | 225 | obj_desc = acpi_ns_get_attached_object(this_node); |
1da177e4 LT |
226 | acpi_dbg_level = dbg_level; |
227 | ||
d1fdda83 BM |
228 | /* Temp nodes are those nodes created by a control method */ |
229 | ||
230 | if (this_node->flags & ANOBJ_TEMPORARY) { | |
231 | acpi_os_printf("(T) "); | |
232 | } | |
233 | ||
73459f73 | 234 | switch (info->display_type & ACPI_DISPLAY_MASK) { |
1da177e4 LT |
235 | case ACPI_DISPLAY_SUMMARY: |
236 | ||
237 | if (!obj_desc) { | |
52fc0b02 | 238 | |
4acb6884 BM |
239 | /* No attached object. Some types should always have an object */ |
240 | ||
241 | switch (type) { | |
242 | case ACPI_TYPE_INTEGER: | |
243 | case ACPI_TYPE_PACKAGE: | |
244 | case ACPI_TYPE_BUFFER: | |
245 | case ACPI_TYPE_STRING: | |
246 | case ACPI_TYPE_METHOD: | |
247 | acpi_os_printf("<No attached object>"); | |
248 | break; | |
249 | ||
250 | default: | |
251 | break; | |
252 | } | |
1da177e4 | 253 | |
4be44fcd | 254 | acpi_os_printf("\n"); |
1da177e4 LT |
255 | return (AE_OK); |
256 | } | |
257 | ||
258 | switch (type) { | |
259 | case ACPI_TYPE_PROCESSOR: | |
260 | ||
0b232fca | 261 | acpi_os_printf("ID %02X Len %02X Addr %p\n", |
4be44fcd LB |
262 | obj_desc->processor.proc_id, |
263 | obj_desc->processor.length, | |
1d18c058 BM |
264 | ACPI_CAST_PTR(void, |
265 | obj_desc->processor. | |
266 | address)); | |
1da177e4 LT |
267 | break; |
268 | ||
1da177e4 LT |
269 | case ACPI_TYPE_DEVICE: |
270 | ||
4be44fcd | 271 | acpi_os_printf("Notify Object: %p\n", obj_desc); |
1da177e4 LT |
272 | break; |
273 | ||
1da177e4 LT |
274 | case ACPI_TYPE_METHOD: |
275 | ||
4be44fcd LB |
276 | acpi_os_printf("Args %X Len %.4X Aml %p\n", |
277 | (u32) obj_desc->method.param_count, | |
278 | obj_desc->method.aml_length, | |
279 | obj_desc->method.aml_start); | |
1da177e4 LT |
280 | break; |
281 | ||
1da177e4 LT |
282 | case ACPI_TYPE_INTEGER: |
283 | ||
4be44fcd LB |
284 | acpi_os_printf("= %8.8X%8.8X\n", |
285 | ACPI_FORMAT_UINT64(obj_desc->integer. | |
286 | value)); | |
1da177e4 LT |
287 | break; |
288 | ||
1da177e4 LT |
289 | case ACPI_TYPE_PACKAGE: |
290 | ||
291 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | |
4be44fcd LB |
292 | acpi_os_printf("Elements %.2X\n", |
293 | obj_desc->package.count); | |
294 | } else { | |
295 | acpi_os_printf("[Length not yet evaluated]\n"); | |
1da177e4 LT |
296 | } |
297 | break; | |
298 | ||
1da177e4 LT |
299 | case ACPI_TYPE_BUFFER: |
300 | ||
301 | if (obj_desc->common.flags & AOPOBJ_DATA_VALID) { | |
4be44fcd LB |
302 | acpi_os_printf("Len %.2X", |
303 | obj_desc->buffer.length); | |
1da177e4 LT |
304 | |
305 | /* Dump some of the buffer */ | |
306 | ||
307 | if (obj_desc->buffer.length > 0) { | |
4be44fcd LB |
308 | acpi_os_printf(" ="); |
309 | for (i = 0; | |
310 | (i < obj_desc->buffer.length | |
311 | && i < 12); i++) { | |
312 | acpi_os_printf(" %.2hX", | |
313 | obj_desc->buffer. | |
314 | pointer[i]); | |
1da177e4 LT |
315 | } |
316 | } | |
4be44fcd LB |
317 | acpi_os_printf("\n"); |
318 | } else { | |
319 | acpi_os_printf("[Length not yet evaluated]\n"); | |
1da177e4 LT |
320 | } |
321 | break; | |
322 | ||
1da177e4 LT |
323 | case ACPI_TYPE_STRING: |
324 | ||
4be44fcd LB |
325 | acpi_os_printf("Len %.2X ", obj_desc->string.length); |
326 | acpi_ut_print_string(obj_desc->string.pointer, 32); | |
327 | acpi_os_printf("\n"); | |
1da177e4 LT |
328 | break; |
329 | ||
1da177e4 LT |
330 | case ACPI_TYPE_REGION: |
331 | ||
4be44fcd LB |
332 | acpi_os_printf("[%s]", |
333 | acpi_ut_get_region_name(obj_desc->region. | |
334 | space_id)); | |
1da177e4 | 335 | if (obj_desc->region.flags & AOPOBJ_DATA_VALID) { |
4be44fcd | 336 | acpi_os_printf(" Addr %8.8X%8.8X Len %.4X\n", |
1d18c058 BM |
337 | ACPI_FORMAT_NATIVE_UINT |
338 | (obj_desc->region.address), | |
4be44fcd LB |
339 | obj_desc->region.length); |
340 | } else { | |
341 | acpi_os_printf | |
342 | (" [Address/Length not yet evaluated]\n"); | |
1da177e4 LT |
343 | } |
344 | break; | |
345 | ||
1da177e4 LT |
346 | case ACPI_TYPE_LOCAL_REFERENCE: |
347 | ||
4be44fcd | 348 | acpi_os_printf("[%s]\n", |
1044f1f6 | 349 | acpi_ut_get_reference_name(obj_desc)); |
1da177e4 LT |
350 | break; |
351 | ||
1da177e4 LT |
352 | case ACPI_TYPE_BUFFER_FIELD: |
353 | ||
354 | if (obj_desc->buffer_field.buffer_obj && | |
4be44fcd LB |
355 | obj_desc->buffer_field.buffer_obj->buffer.node) { |
356 | acpi_os_printf("Buf [%4.4s]", | |
357 | acpi_ut_get_node_name(obj_desc-> | |
358 | buffer_field. | |
359 | buffer_obj-> | |
360 | buffer. | |
361 | node)); | |
1da177e4 LT |
362 | } |
363 | break; | |
364 | ||
1da177e4 LT |
365 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
366 | ||
4be44fcd LB |
367 | acpi_os_printf("Rgn [%4.4s]", |
368 | acpi_ut_get_node_name(obj_desc-> | |
369 | common_field. | |
370 | region_obj->region. | |
371 | node)); | |
1da177e4 LT |
372 | break; |
373 | ||
1da177e4 LT |
374 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
375 | ||
4be44fcd LB |
376 | acpi_os_printf("Rgn [%4.4s] Bnk [%4.4s]", |
377 | acpi_ut_get_node_name(obj_desc-> | |
378 | common_field. | |
379 | region_obj->region. | |
380 | node), | |
381 | acpi_ut_get_node_name(obj_desc-> | |
382 | bank_field. | |
383 | bank_obj-> | |
384 | common_field. | |
385 | node)); | |
1da177e4 LT |
386 | break; |
387 | ||
1da177e4 LT |
388 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
389 | ||
4be44fcd LB |
390 | acpi_os_printf("Idx [%4.4s] Dat [%4.4s]", |
391 | acpi_ut_get_node_name(obj_desc-> | |
392 | index_field. | |
393 | index_obj-> | |
394 | common_field.node), | |
395 | acpi_ut_get_node_name(obj_desc-> | |
396 | index_field. | |
397 | data_obj-> | |
398 | common_field. | |
399 | node)); | |
1da177e4 LT |
400 | break; |
401 | ||
1da177e4 LT |
402 | case ACPI_TYPE_LOCAL_ALIAS: |
403 | case ACPI_TYPE_LOCAL_METHOD_ALIAS: | |
404 | ||
4be44fcd LB |
405 | acpi_os_printf("Target %4.4s (%p)\n", |
406 | acpi_ut_get_node_name(obj_desc), | |
407 | obj_desc); | |
1da177e4 LT |
408 | break; |
409 | ||
410 | default: | |
411 | ||
4be44fcd | 412 | acpi_os_printf("Object %p\n", obj_desc); |
1da177e4 LT |
413 | break; |
414 | } | |
415 | ||
416 | /* Common field handling */ | |
417 | ||
418 | switch (type) { | |
419 | case ACPI_TYPE_BUFFER_FIELD: | |
420 | case ACPI_TYPE_LOCAL_REGION_FIELD: | |
421 | case ACPI_TYPE_LOCAL_BANK_FIELD: | |
422 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | |
423 | ||
4be44fcd LB |
424 | acpi_os_printf(" Off %.3X Len %.2X Acc %.2hd\n", |
425 | (obj_desc->common_field. | |
426 | base_byte_offset * 8) | |
427 | + | |
428 | obj_desc->common_field. | |
429 | start_field_bit_offset, | |
430 | obj_desc->common_field.bit_length, | |
431 | obj_desc->common_field. | |
432 | access_byte_width); | |
1da177e4 LT |
433 | break; |
434 | ||
435 | default: | |
436 | break; | |
437 | } | |
438 | break; | |
439 | ||
1da177e4 LT |
440 | case ACPI_DISPLAY_OBJECTS: |
441 | ||
4be44fcd | 442 | acpi_os_printf("O:%p", obj_desc); |
1da177e4 | 443 | if (!obj_desc) { |
52fc0b02 | 444 | |
1da177e4 LT |
445 | /* No attached object, we are done */ |
446 | ||
4be44fcd | 447 | acpi_os_printf("\n"); |
1da177e4 LT |
448 | return (AE_OK); |
449 | } | |
450 | ||
b27d6597 | 451 | acpi_os_printf("(R%u)", obj_desc->common.reference_count); |
1da177e4 LT |
452 | |
453 | switch (type) { | |
454 | case ACPI_TYPE_METHOD: | |
455 | ||
456 | /* Name is a Method and its AML offset/length are set */ | |
457 | ||
4be44fcd LB |
458 | acpi_os_printf(" M:%p-%X\n", obj_desc->method.aml_start, |
459 | obj_desc->method.aml_length); | |
1da177e4 LT |
460 | break; |
461 | ||
462 | case ACPI_TYPE_INTEGER: | |
463 | ||
4be44fcd LB |
464 | acpi_os_printf(" I:%8.8X8.8%X\n", |
465 | ACPI_FORMAT_UINT64(obj_desc->integer. | |
466 | value)); | |
1da177e4 LT |
467 | break; |
468 | ||
469 | case ACPI_TYPE_STRING: | |
470 | ||
4be44fcd LB |
471 | acpi_os_printf(" S:%p-%X\n", obj_desc->string.pointer, |
472 | obj_desc->string.length); | |
1da177e4 LT |
473 | break; |
474 | ||
475 | case ACPI_TYPE_BUFFER: | |
476 | ||
4be44fcd LB |
477 | acpi_os_printf(" B:%p-%X\n", obj_desc->buffer.pointer, |
478 | obj_desc->buffer.length); | |
1da177e4 LT |
479 | break; |
480 | ||
481 | default: | |
482 | ||
4be44fcd | 483 | acpi_os_printf("\n"); |
1da177e4 LT |
484 | break; |
485 | } | |
486 | break; | |
487 | ||
1da177e4 | 488 | default: |
4be44fcd | 489 | acpi_os_printf("\n"); |
1da177e4 LT |
490 | break; |
491 | } | |
492 | ||
493 | /* If debug turned off, done */ | |
494 | ||
495 | if (!(acpi_dbg_level & ACPI_LV_VALUES)) { | |
496 | return (AE_OK); | |
497 | } | |
498 | ||
1da177e4 LT |
499 | /* If there is an attached object, display it */ |
500 | ||
4be44fcd | 501 | dbg_level = acpi_dbg_level; |
1da177e4 | 502 | acpi_dbg_level = 0; |
4be44fcd | 503 | obj_desc = acpi_ns_get_attached_object(this_node); |
1da177e4 LT |
504 | acpi_dbg_level = dbg_level; |
505 | ||
506 | /* Dump attached objects */ | |
507 | ||
508 | while (obj_desc) { | |
509 | obj_type = ACPI_TYPE_INVALID; | |
4be44fcd | 510 | acpi_os_printf("Attached Object %p: ", obj_desc); |
1da177e4 LT |
511 | |
512 | /* Decode the type of attached object and dump the contents */ | |
513 | ||
4be44fcd | 514 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
1da177e4 LT |
515 | case ACPI_DESC_TYPE_NAMED: |
516 | ||
4be44fcd LB |
517 | acpi_os_printf("(Ptr to Node)\n"); |
518 | bytes_to_dump = sizeof(struct acpi_namespace_node); | |
519 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); | |
1da177e4 LT |
520 | break; |
521 | ||
1da177e4 LT |
522 | case ACPI_DESC_TYPE_OPERAND: |
523 | ||
3371c19c | 524 | obj_type = obj_desc->common.type; |
1da177e4 LT |
525 | |
526 | if (obj_type > ACPI_TYPE_LOCAL_MAX) { | |
4be44fcd | 527 | acpi_os_printf |
71d993e1 | 528 | ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n", |
4be44fcd | 529 | obj_type); |
1da177e4 | 530 | bytes_to_dump = 32; |
4be44fcd LB |
531 | } else { |
532 | acpi_os_printf | |
71d993e1 | 533 | ("(Pointer to ACPI Object type %.2X [%s])\n", |
4be44fcd LB |
534 | obj_type, acpi_ut_get_type_name(obj_type)); |
535 | bytes_to_dump = | |
536 | sizeof(union acpi_operand_object); | |
1da177e4 | 537 | } |
1da177e4 | 538 | |
4be44fcd | 539 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); |
6f42ccf2 | 540 | break; |
1da177e4 LT |
541 | |
542 | default: | |
543 | ||
1da177e4 LT |
544 | break; |
545 | } | |
546 | ||
1da177e4 LT |
547 | /* If value is NOT an internal object, we are done */ |
548 | ||
4be44fcd LB |
549 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) != |
550 | ACPI_DESC_TYPE_OPERAND) { | |
1da177e4 LT |
551 | goto cleanup; |
552 | } | |
553 | ||
d4913dc6 BM |
554 | /* Valid object, get the pointer to next level, if any */ |
555 | ||
1da177e4 | 556 | switch (obj_type) { |
6f42ccf2 | 557 | case ACPI_TYPE_BUFFER: |
1da177e4 | 558 | case ACPI_TYPE_STRING: |
6f42ccf2 RM |
559 | /* |
560 | * NOTE: takes advantage of common fields between string/buffer | |
561 | */ | |
562 | bytes_to_dump = obj_desc->string.length; | |
4be44fcd LB |
563 | obj_desc = (void *)obj_desc->string.pointer; |
564 | acpi_os_printf("(Buffer/String pointer %p length %X)\n", | |
565 | obj_desc, bytes_to_dump); | |
566 | ACPI_DUMP_BUFFER(obj_desc, bytes_to_dump); | |
6f42ccf2 | 567 | goto cleanup; |
1da177e4 LT |
568 | |
569 | case ACPI_TYPE_BUFFER_FIELD: | |
4be44fcd LB |
570 | obj_desc = |
571 | (union acpi_operand_object *)obj_desc->buffer_field. | |
572 | buffer_obj; | |
1da177e4 LT |
573 | break; |
574 | ||
575 | case ACPI_TYPE_PACKAGE: | |
4be44fcd | 576 | obj_desc = (void *)obj_desc->package.elements; |
1da177e4 LT |
577 | break; |
578 | ||
579 | case ACPI_TYPE_METHOD: | |
4be44fcd | 580 | obj_desc = (void *)obj_desc->method.aml_start; |
1da177e4 LT |
581 | break; |
582 | ||
583 | case ACPI_TYPE_LOCAL_REGION_FIELD: | |
4be44fcd | 584 | obj_desc = (void *)obj_desc->field.region_obj; |
1da177e4 LT |
585 | break; |
586 | ||
587 | case ACPI_TYPE_LOCAL_BANK_FIELD: | |
4be44fcd | 588 | obj_desc = (void *)obj_desc->bank_field.region_obj; |
1da177e4 LT |
589 | break; |
590 | ||
591 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | |
4be44fcd | 592 | obj_desc = (void *)obj_desc->index_field.index_obj; |
1da177e4 LT |
593 | break; |
594 | ||
595 | default: | |
596 | goto cleanup; | |
597 | } | |
598 | ||
4be44fcd | 599 | obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ |
1da177e4 LT |
600 | } |
601 | ||
4be44fcd LB |
602 | cleanup: |
603 | acpi_os_printf("\n"); | |
1da177e4 LT |
604 | return (AE_OK); |
605 | } | |
606 | ||
1da177e4 | 607 | #ifdef ACPI_FUTURE_USAGE |
1da177e4 LT |
608 | /******************************************************************************* |
609 | * | |
610 | * FUNCTION: acpi_ns_dump_objects | |
611 | * | |
ba494bee | 612 | * PARAMETERS: type - Object type to be dumped |
44f6c012 | 613 | * display_type - 0 or ACPI_DISPLAY_SUMMARY |
1da177e4 LT |
614 | * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX |
615 | * for an effectively unlimited depth. | |
d4913dc6 | 616 | * owner_id - Dump only objects owned by this ID. Use |
1da177e4 LT |
617 | * ACPI_UINT32_MAX to match all owners. |
618 | * start_handle - Where in namespace to start/end search | |
619 | * | |
44f6c012 RM |
620 | * RETURN: None |
621 | * | |
d4913dc6 BM |
622 | * DESCRIPTION: Dump typed objects within the loaded namespace. Uses |
623 | * acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object. | |
1da177e4 LT |
624 | * |
625 | ******************************************************************************/ | |
626 | ||
627 | void | |
4be44fcd LB |
628 | acpi_ns_dump_objects(acpi_object_type type, |
629 | u8 display_type, | |
630 | u32 max_depth, | |
631 | acpi_owner_id owner_id, acpi_handle start_handle) | |
1da177e4 | 632 | { |
4be44fcd | 633 | struct acpi_walk_info info; |
672af843 | 634 | acpi_status status; |
1da177e4 | 635 | |
4be44fcd | 636 | ACPI_FUNCTION_ENTRY(); |
1da177e4 | 637 | |
672af843 BM |
638 | /* |
639 | * Just lock the entire namespace for the duration of the dump. | |
640 | * We don't want any changes to the namespace during this time, | |
641 | * especially the temporary nodes since we are going to display | |
642 | * them also. | |
643 | */ | |
644 | status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); | |
645 | if (ACPI_FAILURE(status)) { | |
646 | acpi_os_printf("Could not acquire namespace mutex\n"); | |
647 | return; | |
648 | } | |
649 | ||
1da177e4 LT |
650 | info.debug_level = ACPI_LV_TABLES; |
651 | info.owner_id = owner_id; | |
652 | info.display_type = display_type; | |
653 | ||
4be44fcd | 654 | (void)acpi_ns_walk_namespace(type, start_handle, max_depth, |
d1fdda83 BM |
655 | ACPI_NS_WALK_NO_UNLOCK | |
656 | ACPI_NS_WALK_TEMP_NODES, | |
2263576c LM |
657 | acpi_ns_dump_one_object, NULL, |
658 | (void *)&info, NULL); | |
672af843 BM |
659 | |
660 | (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); | |
1da177e4 | 661 | } |
4be44fcd | 662 | #endif /* ACPI_FUTURE_USAGE */ |
1da177e4 | 663 | |
44f6c012 RM |
664 | /******************************************************************************* |
665 | * | |
666 | * FUNCTION: acpi_ns_dump_entry | |
667 | * | |
ba494bee | 668 | * PARAMETERS: handle - Node to be dumped |
44f6c012 RM |
669 | * debug_level - Output level |
670 | * | |
671 | * RETURN: None | |
672 | * | |
673 | * DESCRIPTION: Dump a single Node | |
674 | * | |
675 | ******************************************************************************/ | |
676 | ||
4be44fcd | 677 | void acpi_ns_dump_entry(acpi_handle handle, u32 debug_level) |
44f6c012 | 678 | { |
4be44fcd | 679 | struct acpi_walk_info info; |
44f6c012 | 680 | |
4be44fcd | 681 | ACPI_FUNCTION_ENTRY(); |
44f6c012 RM |
682 | |
683 | info.debug_level = debug_level; | |
f9f4601f | 684 | info.owner_id = ACPI_OWNER_ID_MAX; |
44f6c012 RM |
685 | info.display_type = ACPI_DISPLAY_SUMMARY; |
686 | ||
4be44fcd | 687 | (void)acpi_ns_dump_one_object(handle, 1, &info, NULL); |
44f6c012 RM |
688 | } |
689 | ||
73459f73 | 690 | #ifdef ACPI_ASL_COMPILER |
1da177e4 LT |
691 | /******************************************************************************* |
692 | * | |
693 | * FUNCTION: acpi_ns_dump_tables | |
694 | * | |
695 | * PARAMETERS: search_base - Root of subtree to be dumped, or | |
696 | * NS_ALL to dump the entire namespace | |
73a3090a | 697 | * max_depth - Maximum depth of dump. Use INT_MAX |
1da177e4 LT |
698 | * for an effectively unlimited depth. |
699 | * | |
44f6c012 RM |
700 | * RETURN: None |
701 | * | |
1da177e4 LT |
702 | * DESCRIPTION: Dump the name space, or a portion of it. |
703 | * | |
704 | ******************************************************************************/ | |
705 | ||
4be44fcd | 706 | void acpi_ns_dump_tables(acpi_handle search_base, u32 max_depth) |
1da177e4 | 707 | { |
4be44fcd | 708 | acpi_handle search_handle = search_base; |
1da177e4 | 709 | |
b229cf92 | 710 | ACPI_FUNCTION_TRACE(ns_dump_tables); |
1da177e4 LT |
711 | |
712 | if (!acpi_gbl_root_node) { | |
713 | /* | |
714 | * If the name space has not been initialized, | |
715 | * there is nothing to dump. | |
716 | */ | |
4be44fcd LB |
717 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, |
718 | "namespace not initialized!\n")); | |
1da177e4 LT |
719 | return_VOID; |
720 | } | |
721 | ||
722 | if (ACPI_NS_ALL == search_base) { | |
52fc0b02 | 723 | |
44f6c012 | 724 | /* Entire namespace */ |
1da177e4 LT |
725 | |
726 | search_handle = acpi_gbl_root_node; | |
4be44fcd | 727 | ACPI_DEBUG_PRINT((ACPI_DB_TABLES, "\\\n")); |
1da177e4 LT |
728 | } |
729 | ||
4be44fcd LB |
730 | acpi_ns_dump_objects(ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, max_depth, |
731 | ACPI_OWNER_ID_MAX, search_handle); | |
1da177e4 LT |
732 | return_VOID; |
733 | } | |
75c8044f LZ |
734 | #endif |
735 | #endif |