| 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.h" |
| 45 |
#include "accommon.h" |
| 46 |
#include "acnamesp.h" |
| 47 |
#include "acdebug.h" |
| 48 |
|
| 49 |
|
| 50 |
#define _COMPONENT ACPI_CA_DEBUGGER |
| 51 |
ACPI_MODULE_NAME ("dbobject") |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
static void |
| 57 |
AcpiDbDecodeNode ( |
| 58 |
ACPI_NAMESPACE_NODE *Node); |
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
void |
| 77 |
AcpiDbDumpMethodInfo ( |
| 78 |
ACPI_STATUS Status, |
| 79 |
ACPI_WALK_STATE *WalkState) |
| 80 |
{ |
| 81 |
ACPI_THREAD_STATE *Thread; |
| 82 |
ACPI_NAMESPACE_NODE *Node; |
| 83 |
|
| 84 |
|
| 85 |
Node = WalkState->MethodNode; |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
if (Node == AcpiGbl_RootNode) |
| 90 |
{ |
| 91 |
return; |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
if (ACPI_CNTL_EXCEPTION (Status)) |
| 97 |
{ |
| 98 |
return; |
| 99 |
} |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
if (WalkState->DeferredNode) |
| 104 |
{ |
| 105 |
AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); |
| 106 |
return; |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
Thread = WalkState->Thread; |
| 115 |
if (!Thread) |
| 116 |
{ |
| 117 |
return; |
| 118 |
} |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
AcpiOsPrintf ("\n"); |
| 123 |
AcpiDbDecodeLocals (WalkState); |
| 124 |
AcpiOsPrintf ("\n"); |
| 125 |
AcpiDbDecodeArguments (WalkState); |
| 126 |
AcpiOsPrintf ("\n"); |
| 127 |
} |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
void |
| 143 |
AcpiDbDecodeInternalObject ( |
| 144 |
ACPI_OPERAND_OBJECT *ObjDesc) |
| 145 |
{ |
| 146 |
UINT32 i; |
| 147 |
|
| 148 |
|
| 149 |
if (!ObjDesc) |
| 150 |
{ |
| 151 |
AcpiOsPrintf (" Uninitialized"); |
| 152 |
return; |
| 153 |
} |
| 154 |
|
| 155 |
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) |
| 156 |
{ |
| 157 |
AcpiOsPrintf (" %p [%s]", ObjDesc, |
| 158 |
AcpiUtGetDescriptorName (ObjDesc)); |
| 159 |
return; |
| 160 |
} |
| 161 |
|
| 162 |
AcpiOsPrintf (" %s", AcpiUtGetObjectTypeName (ObjDesc)); |
| 163 |
|
| 164 |
switch (ObjDesc->Common.Type) |
| 165 |
{ |
| 166 |
case ACPI_TYPE_INTEGER: |
| 167 |
|
| 168 |
AcpiOsPrintf (" %8.8X%8.8X", |
| 169 |
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); |
| 170 |
break; |
| 171 |
|
| 172 |
case ACPI_TYPE_STRING: |
| 173 |
|
| 174 |
AcpiOsPrintf ("(%u) \"%.60s", |
| 175 |
ObjDesc->String.Length, ObjDesc->String.Pointer); |
| 176 |
|
| 177 |
if (ObjDesc->String.Length > 60) |
| 178 |
{ |
| 179 |
AcpiOsPrintf ("..."); |
| 180 |
} |
| 181 |
else |
| 182 |
{ |
| 183 |
AcpiOsPrintf ("\""); |
| 184 |
} |
| 185 |
break; |
| 186 |
|
| 187 |
case ACPI_TYPE_BUFFER: |
| 188 |
|
| 189 |
AcpiOsPrintf ("(%u)", ObjDesc->Buffer.Length); |
| 190 |
for (i = 0; (i < 8) && (i < ObjDesc->Buffer.Length); i++) |
| 191 |
{ |
| 192 |
AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]); |
| 193 |
} |
| 194 |
break; |
| 195 |
|
| 196 |
default: |
| 197 |
|
| 198 |
AcpiOsPrintf (" %p", ObjDesc); |
| 199 |
break; |
| 200 |
} |
| 201 |
} |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
static void |
| 217 |
AcpiDbDecodeNode ( |
| 218 |
ACPI_NAMESPACE_NODE *Node) |
| 219 |
{ |
| 220 |
|
| 221 |
AcpiOsPrintf ("<Node> Name %4.4s", |
| 222 |
AcpiUtGetNodeName (Node)); |
| 223 |
|
| 224 |
if (Node->Flags & ANOBJ_METHOD_ARG) |
| 225 |
{ |
| 226 |
AcpiOsPrintf (" [Method Arg]"); |
| 227 |
} |
| 228 |
if (Node->Flags & ANOBJ_METHOD_LOCAL) |
| 229 |
{ |
| 230 |
AcpiOsPrintf (" [Method Local]"); |
| 231 |
} |
| 232 |
|
| 233 |
switch (Node->Type) |
| 234 |
{ |
| 235 |
|
| 236 |
|
| 237 |
case ACPI_TYPE_DEVICE: |
| 238 |
|
| 239 |
AcpiOsPrintf (" Device"); |
| 240 |
break; |
| 241 |
|
| 242 |
case ACPI_TYPE_THERMAL: |
| 243 |
|
| 244 |
AcpiOsPrintf (" Thermal Zone"); |
| 245 |
break; |
| 246 |
|
| 247 |
default: |
| 248 |
|
| 249 |
AcpiDbDecodeInternalObject (AcpiNsGetAttachedObject (Node)); |
| 250 |
break; |
| 251 |
} |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
void |
| 269 |
AcpiDbDisplayInternalObject ( |
| 270 |
ACPI_OPERAND_OBJECT *ObjDesc, |
| 271 |
ACPI_WALK_STATE *WalkState) |
| 272 |
{ |
| 273 |
UINT8 Type; |
| 274 |
|
| 275 |
|
| 276 |
AcpiOsPrintf ("%p ", ObjDesc); |
| 277 |
|
| 278 |
if (!ObjDesc) |
| 279 |
{ |
| 280 |
AcpiOsPrintf ("<Null Object>\n"); |
| 281 |
return; |
| 282 |
} |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) |
| 287 |
{ |
| 288 |
case ACPI_DESC_TYPE_PARSER: |
| 289 |
|
| 290 |
AcpiOsPrintf ("<Parser> "); |
| 291 |
break; |
| 292 |
|
| 293 |
case ACPI_DESC_TYPE_NAMED: |
| 294 |
|
| 295 |
AcpiDbDecodeNode ((ACPI_NAMESPACE_NODE *) ObjDesc); |
| 296 |
break; |
| 297 |
|
| 298 |
case ACPI_DESC_TYPE_OPERAND: |
| 299 |
|
| 300 |
Type = ObjDesc->Common.Type; |
| 301 |
if (Type > ACPI_TYPE_LOCAL_MAX) |
| 302 |
{ |
| 303 |
AcpiOsPrintf (" Type %X [Invalid Type]", (UINT32) Type); |
| 304 |
return; |
| 305 |
} |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
switch (ObjDesc->Common.Type) |
| 310 |
{ |
| 311 |
case ACPI_TYPE_LOCAL_REFERENCE: |
| 312 |
|
| 313 |
AcpiOsPrintf ("[%s] ", AcpiUtGetReferenceName (ObjDesc)); |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
switch (ObjDesc->Reference.Class) |
| 318 |
{ |
| 319 |
case ACPI_REFCLASS_LOCAL: |
| 320 |
|
| 321 |
AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); |
| 322 |
if (WalkState) |
| 323 |
{ |
| 324 |
ObjDesc = WalkState->LocalVariables |
| 325 |
[ObjDesc->Reference.Value].Object; |
| 326 |
AcpiOsPrintf ("%p", ObjDesc); |
| 327 |
AcpiDbDecodeInternalObject (ObjDesc); |
| 328 |
} |
| 329 |
break; |
| 330 |
|
| 331 |
case ACPI_REFCLASS_ARG: |
| 332 |
|
| 333 |
AcpiOsPrintf ("%X ", ObjDesc->Reference.Value); |
| 334 |
if (WalkState) |
| 335 |
{ |
| 336 |
ObjDesc = WalkState->Arguments |
| 337 |
[ObjDesc->Reference.Value].Object; |
| 338 |
AcpiOsPrintf ("%p", ObjDesc); |
| 339 |
AcpiDbDecodeInternalObject (ObjDesc); |
| 340 |
} |
| 341 |
break; |
| 342 |
|
| 343 |
case ACPI_REFCLASS_INDEX: |
| 344 |
|
| 345 |
switch (ObjDesc->Reference.TargetType) |
| 346 |
{ |
| 347 |
case ACPI_TYPE_BUFFER_FIELD: |
| 348 |
|
| 349 |
AcpiOsPrintf ("%p", ObjDesc->Reference.Object); |
| 350 |
AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); |
| 351 |
break; |
| 352 |
|
| 353 |
case ACPI_TYPE_PACKAGE: |
| 354 |
|
| 355 |
AcpiOsPrintf ("%p", ObjDesc->Reference.Where); |
| 356 |
if (!ObjDesc->Reference.Where) |
| 357 |
{ |
| 358 |
AcpiOsPrintf (" Uninitialized WHERE pointer"); |
| 359 |
} |
| 360 |
else |
| 361 |
{ |
| 362 |
AcpiDbDecodeInternalObject ( |
| 363 |
*(ObjDesc->Reference.Where)); |
| 364 |
} |
| 365 |
break; |
| 366 |
|
| 367 |
default: |
| 368 |
|
| 369 |
AcpiOsPrintf ("Unknown index target type"); |
| 370 |
break; |
| 371 |
} |
| 372 |
break; |
| 373 |
|
| 374 |
case ACPI_REFCLASS_REFOF: |
| 375 |
|
| 376 |
if (!ObjDesc->Reference.Object) |
| 377 |
{ |
| 378 |
AcpiOsPrintf ( |
| 379 |
"Uninitialized reference subobject pointer"); |
| 380 |
break; |
| 381 |
} |
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc->Reference.Object)) |
| 386 |
{ |
| 387 |
case ACPI_DESC_TYPE_NAMED: |
| 388 |
|
| 389 |
AcpiDbDecodeNode (ObjDesc->Reference.Object); |
| 390 |
break; |
| 391 |
|
| 392 |
case ACPI_DESC_TYPE_OPERAND: |
| 393 |
|
| 394 |
AcpiDbDecodeInternalObject (ObjDesc->Reference.Object); |
| 395 |
break; |
| 396 |
|
| 397 |
default: |
| 398 |
break; |
| 399 |
} |
| 400 |
break; |
| 401 |
|
| 402 |
case ACPI_REFCLASS_NAME: |
| 403 |
|
| 404 |
AcpiDbDecodeNode (ObjDesc->Reference.Node); |
| 405 |
break; |
| 406 |
|
| 407 |
case ACPI_REFCLASS_DEBUG: |
| 408 |
case ACPI_REFCLASS_TABLE: |
| 409 |
|
| 410 |
AcpiOsPrintf ("\n"); |
| 411 |
break; |
| 412 |
|
| 413 |
default: |
| 414 |
|
| 415 |
AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); |
| 416 |
break; |
| 417 |
} |
| 418 |
break; |
| 419 |
|
| 420 |
default: |
| 421 |
|
| 422 |
AcpiOsPrintf ("<Obj> "); |
| 423 |
AcpiDbDecodeInternalObject (ObjDesc); |
| 424 |
break; |
| 425 |
} |
| 426 |
break; |
| 427 |
|
| 428 |
default: |
| 429 |
|
| 430 |
AcpiOsPrintf ("<Not a valid ACPI Object Descriptor> [%s]", |
| 431 |
AcpiUtGetDescriptorName (ObjDesc)); |
| 432 |
break; |
| 433 |
} |
| 434 |
|
| 435 |
AcpiOsPrintf ("\n"); |
| 436 |
} |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
void |
| 452 |
AcpiDbDecodeLocals ( |
| 453 |
ACPI_WALK_STATE *WalkState) |
| 454 |
{ |
| 455 |
UINT32 i; |
| 456 |
ACPI_OPERAND_OBJECT *ObjDesc; |
| 457 |
ACPI_NAMESPACE_NODE *Node; |
| 458 |
BOOLEAN DisplayLocals = FALSE; |
| 459 |
|
| 460 |
|
| 461 |
Node = WalkState->MethodNode; |
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
if (Node == AcpiGbl_RootNode) |
| 466 |
{ |
| 467 |
return; |
| 468 |
} |
| 469 |
|
| 470 |
if (!Node) |
| 471 |
{ |
| 472 |
AcpiOsPrintf ( |
| 473 |
"No method node (Executing subtree for buffer or opregion)\n"); |
| 474 |
return; |
| 475 |
} |
| 476 |
|
| 477 |
if (Node->Type != ACPI_TYPE_METHOD) |
| 478 |
{ |
| 479 |
AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); |
| 480 |
return; |
| 481 |
} |
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) |
| 486 |
{ |
| 487 |
ObjDesc = WalkState->LocalVariables[i].Object; |
| 488 |
if (ObjDesc) |
| 489 |
{ |
| 490 |
DisplayLocals = TRUE; |
| 491 |
break; |
| 492 |
} |
| 493 |
} |
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
if (DisplayLocals) |
| 498 |
{ |
| 499 |
AcpiOsPrintf ("\nInitialized Local Variables for Method [%4.4s]:\n", |
| 500 |
AcpiUtGetNodeName (Node)); |
| 501 |
|
| 502 |
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) |
| 503 |
{ |
| 504 |
ObjDesc = WalkState->LocalVariables[i].Object; |
| 505 |
if (ObjDesc) |
| 506 |
{ |
| 507 |
AcpiOsPrintf (" Local%X: ", i); |
| 508 |
AcpiDbDisplayInternalObject (ObjDesc, WalkState); |
| 509 |
} |
| 510 |
} |
| 511 |
} |
| 512 |
else |
| 513 |
{ |
| 514 |
AcpiOsPrintf ( |
| 515 |
"No Local Variables are initialized for Method [%4.4s]\n", |
| 516 |
AcpiUtGetNodeName (Node)); |
| 517 |
} |
| 518 |
} |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
void |
| 534 |
AcpiDbDecodeArguments ( |
| 535 |
ACPI_WALK_STATE *WalkState) |
| 536 |
{ |
| 537 |
UINT32 i; |
| 538 |
ACPI_OPERAND_OBJECT *ObjDesc; |
| 539 |
ACPI_NAMESPACE_NODE *Node; |
| 540 |
BOOLEAN DisplayArgs = FALSE; |
| 541 |
|
| 542 |
|
| 543 |
Node = WalkState->MethodNode; |
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
if (Node == AcpiGbl_RootNode) |
| 548 |
{ |
| 549 |
return; |
| 550 |
} |
| 551 |
|
| 552 |
if (!Node) |
| 553 |
{ |
| 554 |
AcpiOsPrintf ( |
| 555 |
"No method node (Executing subtree for buffer or opregion)\n"); |
| 556 |
return; |
| 557 |
} |
| 558 |
|
| 559 |
if (Node->Type != ACPI_TYPE_METHOD) |
| 560 |
{ |
| 561 |
AcpiOsPrintf ("Executing subtree for Buffer/Package/Region\n"); |
| 562 |
return; |
| 563 |
} |
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) |
| 568 |
{ |
| 569 |
ObjDesc = WalkState->Arguments[i].Object; |
| 570 |
if (ObjDesc) |
| 571 |
{ |
| 572 |
DisplayArgs = TRUE; |
| 573 |
break; |
| 574 |
} |
| 575 |
} |
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
if (DisplayArgs) |
| 580 |
{ |
| 581 |
AcpiOsPrintf ( |
| 582 |
"Initialized Arguments for Method [%4.4s]: " |
| 583 |
"(%X arguments defined for method invocation)\n", |
| 584 |
AcpiUtGetNodeName (Node), Node->Object->Method.ParamCount); |
| 585 |
|
| 586 |
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) |
| 587 |
{ |
| 588 |
ObjDesc = WalkState->Arguments[i].Object; |
| 589 |
if (ObjDesc) |
| 590 |
{ |
| 591 |
AcpiOsPrintf (" Arg%u: ", i); |
| 592 |
AcpiDbDisplayInternalObject (ObjDesc, WalkState); |
| 593 |
} |
| 594 |
} |
| 595 |
} |
| 596 |
else |
| 597 |
{ |
| 598 |
AcpiOsPrintf ( |
| 599 |
"No Arguments are initialized for method [%4.4s]\n", |
| 600 |
AcpiUtGetNodeName (Node)); |
| 601 |
} |
| 602 |
} |