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