Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Module Name: exdump - Interpreter debug output routines
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   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.


 114     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer),         NULL},
 115     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Buffer.Length),                "Length"},
 116     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Buffer.Pointer),               "Pointer"},
 117     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Buffer.Node),                  "Parent Node"},
 118     {ACPI_EXD_BUFFER,   0,                                              NULL}
 119 };
 120 
 121 static ACPI_EXDUMP_INFO     AcpiExDumpPackage[5] =
 122 {
 123     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage),        NULL},
 124     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Package.Flags),                "Flags"},
 125     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Package.Count),                "Elements"},
 126     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Package.Elements),             "Element List"},
 127     {ACPI_EXD_PACKAGE,  0,                                              NULL}
 128 };
 129 
 130 static ACPI_EXDUMP_INFO     AcpiExDumpDevice[4] =
 131 {
 132     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice),         NULL},
 133     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.Handler),               "Handler"},
 134     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.SystemNotify),          "System Notify"},
 135     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.DeviceNotify),          "Device Notify"}
 136 };
 137 
 138 static ACPI_EXDUMP_INFO     AcpiExDumpEvent[2] =
 139 {
 140     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent),          NULL},
 141     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Event.OsSemaphore),            "OsSemaphore"}
 142 };
 143 
 144 static ACPI_EXDUMP_INFO     AcpiExDumpMethod[9] =
 145 {
 146     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod),         NULL},
 147     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.InfoFlags),             "Info Flags"},
 148     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ParamCount),            "Parameter Count"},
 149     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.SyncLevel),             "Sync Level"},
 150     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.Mutex),                 "Mutex"},
 151     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.OwnerId),               "Owner Id"},
 152     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ThreadCount),           "Thread Count"},
 153     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Method.AmlLength),             "Aml Length"},
 154     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.AmlStart),              "Aml Start"}
 155 };


 162     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Mutex.AcquisitionDepth),       "Acquire Depth"},
 163     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Mutex.OsMutex),                "OsMutex"}
 164 };
 165 
 166 static ACPI_EXDUMP_INFO     AcpiExDumpRegion[7] =
 167 {
 168     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion),         NULL},
 169     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.SpaceId),               "Space Id"},
 170     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.Flags),                 "Flags"},
 171     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Region.Address),               "Address"},
 172     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Region.Length),                "Length"},
 173     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Region.Handler),               "Handler"},
 174     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Region.Next),                  "Next"}
 175 };
 176 
 177 static ACPI_EXDUMP_INFO     AcpiExDumpPower[5] =
 178 {
 179     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPower),          NULL},
 180     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.SystemLevel),    "System Level"},
 181     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.ResourceOrder),  "Resource Order"},
 182     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.SystemNotify),   "System Notify"},
 183     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.DeviceNotify),   "Device Notify"}
 184 };
 185 
 186 static ACPI_EXDUMP_INFO     AcpiExDumpProcessor[7] =
 187 {
 188     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor),      NULL},
 189     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Processor.ProcId),             "Processor ID"},
 190     {ACPI_EXD_UINT8 ,   ACPI_EXD_OFFSET (Processor.Length),             "Length"},
 191     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Processor.Address),            "Address"},
 192     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.SystemNotify),       "System Notify"},
 193     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.DeviceNotify),       "Device Notify"},
 194     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.Handler),            "Handler"}
 195 };
 196 
 197 static ACPI_EXDUMP_INFO     AcpiExDumpThermal[4] =
 198 {
 199     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal),        NULL},
 200     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.SystemNotify),     "System Notify"},
 201     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.DeviceNotify),     "Device Notify"},
 202     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.Handler),          "Handler"}
 203 };
 204 
 205 static ACPI_EXDUMP_INFO     AcpiExDumpBufferField[3] =
 206 {
 207     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField),    NULL},
 208     {ACPI_EXD_FIELD,    0,                                              NULL},
 209     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BufferField.BufferObj),        "Buffer Object"}
 210 };
 211 
 212 static ACPI_EXDUMP_INFO     AcpiExDumpRegionField[3] =
 213 {
 214     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField),    NULL},
 215     {ACPI_EXD_FIELD,    0,                                              NULL},
 216     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Field.RegionObj),              "Region Object"}


 217 };
 218 
 219 static ACPI_EXDUMP_INFO     AcpiExDumpBankField[5] =
 220 {
 221     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
 222     {ACPI_EXD_FIELD,    0,                                              NULL},
 223     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (BankField.Value),              "Value"},
 224     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.RegionObj),          "Region Object"},
 225     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.BankObj),            "Bank Object"}
 226 };
 227 
 228 static ACPI_EXDUMP_INFO     AcpiExDumpIndexField[5] =
 229 {
 230     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
 231     {ACPI_EXD_FIELD,    0,                                              NULL},
 232     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (IndexField.Value),             "Value"},
 233     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.IndexObj),          "Index Object"},
 234     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.DataObj),           "Data Object"}
 235 };
 236 


 239     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpReference),       NULL},
 240     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.Class),              "Class"},
 241     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.TargetType),         "Target Type"},
 242     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Reference.Value),              "Value"},
 243     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Object),             "Object Desc"},
 244     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Node),               "Node"},
 245     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Where),              "Where"},
 246     {ACPI_EXD_REFERENCE,0,                                              NULL}
 247 };
 248 
 249 static ACPI_EXDUMP_INFO     AcpiExDumpAddressHandler[6] =
 250 {
 251     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
 252     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (AddressSpace.SpaceId),         "Space Id"},
 253     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Next),            "Next"},
 254     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.RegionList),      "Region List"},
 255     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Node),            "Node"},
 256     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Context),         "Context"}
 257 };
 258 
 259 static ACPI_EXDUMP_INFO     AcpiExDumpNotify[3] =
 260 {
 261     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify),         NULL},
 262     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Node),                  "Node"},
 263     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Context),               "Context"}




 264 };
 265 
 266 
 267 /* Miscellaneous tables */
 268 
 269 static ACPI_EXDUMP_INFO     AcpiExDumpCommon[4] =
 270 {
 271     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon),         NULL},
 272     {ACPI_EXD_TYPE ,    0,                                              NULL},
 273     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Common.ReferenceCount),        "Reference Count"},
 274     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Common.Flags),                 "Flags"}
 275 };
 276 
 277 static ACPI_EXDUMP_INFO     AcpiExDumpFieldCommon[7] =
 278 {
 279     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon),    NULL},
 280     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.FieldFlags),       "Field Flags"},
 281     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.AccessByteWidth),  "Access Byte Width"},
 282     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (CommonField.BitLength),        "Bit Length"},
 283     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},


 334  *
 335  * FUNCTION:    AcpiExDumpObject
 336  *
 337  * PARAMETERS:  ObjDesc             - Descriptor to dump
 338  *              Info                - Info table corresponding to this object
 339  *                                    type
 340  *
 341  * RETURN:      None
 342  *
 343  * DESCRIPTION: Walk the info table for this object
 344  *
 345  ******************************************************************************/
 346 
 347 static void
 348 AcpiExDumpObject (
 349     ACPI_OPERAND_OBJECT     *ObjDesc,
 350     ACPI_EXDUMP_INFO        *Info)
 351 {
 352     UINT8                   *Target;
 353     char                    *Name;

 354     UINT8                   Count;
 355 
 356 
 357     if (!Info)
 358     {
 359         AcpiOsPrintf (
 360             "ExDumpObject: Display not implemented for object type %s\n",
 361             AcpiUtGetObjectTypeName (ObjDesc));
 362         return;
 363     }
 364 
 365     /* First table entry must contain the table length (# of table entries) */
 366 
 367     Count = Info->Offset;
 368 
 369     while (Count)
 370     {
 371         Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
 372         Name = Info->Name;
 373 
 374         switch (Info->Opcode)
 375         {
 376         case ACPI_EXD_INIT:

 377             break;
 378 
 379         case ACPI_EXD_TYPE:
 380 
 381             AcpiExOutString  ("Type", AcpiUtGetObjectTypeName (ObjDesc));
 382             break;
 383 
 384         case ACPI_EXD_UINT8:
 385 
 386             AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
 387             break;
 388 
 389         case ACPI_EXD_UINT16:
 390 
 391             AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
 392             break;
 393 
 394         case ACPI_EXD_UINT32:
 395 
 396             AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));


 417         case ACPI_EXD_BUFFER:
 418 
 419             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
 420             break;
 421 
 422         case ACPI_EXD_PACKAGE:
 423 
 424             /* Dump the package contents */
 425 
 426             AcpiOsPrintf ("\nPackage Contents:\n");
 427             AcpiExDumpPackageObj (ObjDesc, 0, 0);
 428             break;
 429 
 430         case ACPI_EXD_FIELD:
 431 
 432             AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
 433             break;
 434 
 435         case ACPI_EXD_REFERENCE:
 436 
 437             AcpiExOutString ("Class Name",
 438                 ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc)));
 439             AcpiExDumpReferenceObj (ObjDesc);
 440             break;
 441 
 442         default:
 443 
 444             AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
 445                 Info->Opcode);
 446             return;
 447         }
 448 
 449         Info++;
 450         Count--;
 451     }
 452 }
 453 
 454 
 455 /*******************************************************************************
 456  *
 457  * FUNCTION:    AcpiExDumpOperand
 458  *


 460  *              Depth           - Current nesting depth
 461  *
 462  * RETURN:      None
 463  *
 464  * DESCRIPTION: Dump an operand object
 465  *
 466  ******************************************************************************/
 467 
 468 void
 469 AcpiExDumpOperand (
 470     ACPI_OPERAND_OBJECT     *ObjDesc,
 471     UINT32                  Depth)
 472 {
 473     UINT32                  Length;
 474     UINT32                  Index;
 475 
 476 
 477     ACPI_FUNCTION_NAME (ExDumpOperand)
 478 
 479 
 480     if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))


 481     {
 482         return;
 483     }
 484 
 485     if (!ObjDesc)
 486     {
 487         /* This could be a null element of a package */
 488 
 489         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
 490         return;
 491     }
 492 
 493     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
 494     {
 495         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
 496         ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
 497         return;
 498     }
 499 
 500     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)


 516     else
 517     {
 518         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
 519     }
 520 
 521     /* Decode object type */
 522 
 523     switch (ObjDesc->Common.Type)
 524     {
 525     case ACPI_TYPE_LOCAL_REFERENCE:
 526 
 527         AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc));
 528 
 529         switch (ObjDesc->Reference.Class)
 530         {
 531         case ACPI_REFCLASS_DEBUG:
 532 
 533             AcpiOsPrintf ("\n");
 534             break;
 535 
 536 
 537         case ACPI_REFCLASS_INDEX:
 538 
 539             AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
 540             break;
 541 
 542 
 543         case ACPI_REFCLASS_TABLE:
 544 
 545             AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
 546             break;
 547 
 548 
 549         case ACPI_REFCLASS_REFOF:
 550 
 551             AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
 552                 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
 553                     ObjDesc->Reference.Object)->Common.Type));
 554             break;
 555 
 556 
 557         case ACPI_REFCLASS_NAME:
 558 
 559             AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
 560             break;
 561 
 562 
 563         case ACPI_REFCLASS_ARG:
 564         case ACPI_REFCLASS_LOCAL:
 565 
 566             AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
 567             break;
 568 
 569 
 570         default:    /* Unknown reference class */
 571 
 572             AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
 573             break;
 574         }
 575         break;
 576 
 577 
 578     case ACPI_TYPE_BUFFER:
 579 
 580         AcpiOsPrintf ("Buffer length %.2X @ %p\n",
 581             ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
 582 
 583         /* Debug only -- dump the buffer contents */
 584 
 585         if (ObjDesc->Buffer.Pointer)
 586         {
 587             Length = ObjDesc->Buffer.Length;
 588             if (Length > 128)
 589             {
 590                 Length = 128;
 591             }
 592 
 593             AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
 594                 Length);
 595             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
 596         }
 597         break;
 598 
 599 
 600     case ACPI_TYPE_INTEGER:
 601 
 602         AcpiOsPrintf ("Integer %8.8X%8.8X\n",
 603             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
 604         break;
 605 
 606 
 607     case ACPI_TYPE_PACKAGE:
 608 
 609         AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
 610             ObjDesc->Package.Count, ObjDesc->Package.Elements);
 611 
 612         /*
 613          * If elements exist, package element pointer is valid,
 614          * and debug_level exceeds 1, dump package's elements.
 615          */
 616         if (ObjDesc->Package.Count &&
 617             ObjDesc->Package.Elements &&
 618             AcpiDbgLevel > 1)
 619         {
 620             for (Index = 0; Index < ObjDesc->Package.Count; Index++)
 621             {
 622                 AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1);
 623             }
 624         }
 625         break;
 626 
 627 
 628     case ACPI_TYPE_REGION:
 629 
 630         AcpiOsPrintf ("Region %s (%X)",
 631             AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
 632             ObjDesc->Region.SpaceId);
 633 
 634         /*
 635          * If the address and length have not been evaluated,
 636          * don't print them.
 637          */
 638         if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
 639         {
 640             AcpiOsPrintf ("\n");
 641         }
 642         else
 643         {
 644             AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
 645                 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
 646                 ObjDesc->Region.Length);
 647         }
 648         break;
 649 
 650 
 651     case ACPI_TYPE_STRING:
 652 
 653         AcpiOsPrintf ("String length %X @ %p ",
 654             ObjDesc->String.Length,
 655             ObjDesc->String.Pointer);
 656 
 657         AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
 658         AcpiOsPrintf ("\n");
 659         break;
 660 
 661 
 662     case ACPI_TYPE_LOCAL_BANK_FIELD:
 663 
 664         AcpiOsPrintf ("BankField\n");
 665         break;
 666 
 667 
 668     case ACPI_TYPE_LOCAL_REGION_FIELD:
 669 
 670         AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
 671             "byte=%X bit=%X of below:\n",
 672             ObjDesc->Field.BitLength,
 673             ObjDesc->Field.AccessByteWidth,
 674             ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
 675             ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
 676             ObjDesc->Field.BaseByteOffset,
 677             ObjDesc->Field.StartFieldBitOffset);
 678 
 679         AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
 680         break;
 681 
 682 
 683     case ACPI_TYPE_LOCAL_INDEX_FIELD:
 684 
 685         AcpiOsPrintf ("IndexField\n");
 686         break;
 687 
 688 
 689     case ACPI_TYPE_BUFFER_FIELD:
 690 
 691         AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
 692             ObjDesc->BufferField.BitLength,
 693             ObjDesc->BufferField.BaseByteOffset,
 694             ObjDesc->BufferField.StartFieldBitOffset);
 695 
 696         if (!ObjDesc->BufferField.BufferObj)
 697         {
 698             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
 699         }
 700         else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
 701                     ACPI_TYPE_BUFFER)
 702         {
 703             AcpiOsPrintf ("*not a Buffer*\n");
 704         }
 705         else
 706         {
 707             AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1);
 708         }
 709         break;
 710 
 711 
 712     case ACPI_TYPE_EVENT:
 713 
 714         AcpiOsPrintf ("Event\n");
 715         break;
 716 
 717 
 718     case ACPI_TYPE_METHOD:
 719 
 720         AcpiOsPrintf ("Method(%X) @ %p:%X\n",
 721             ObjDesc->Method.ParamCount,
 722             ObjDesc->Method.AmlStart,
 723             ObjDesc->Method.AmlLength);
 724         break;
 725 
 726 
 727     case ACPI_TYPE_MUTEX:
 728 
 729         AcpiOsPrintf ("Mutex\n");
 730         break;
 731 
 732 
 733     case ACPI_TYPE_DEVICE:
 734 
 735         AcpiOsPrintf ("Device\n");
 736         break;
 737 
 738 
 739     case ACPI_TYPE_POWER:
 740 
 741         AcpiOsPrintf ("Power\n");
 742         break;
 743 
 744 
 745     case ACPI_TYPE_PROCESSOR:
 746 
 747         AcpiOsPrintf ("Processor\n");
 748         break;
 749 
 750 
 751     case ACPI_TYPE_THERMAL:
 752 
 753         AcpiOsPrintf ("Thermal\n");
 754         break;
 755 
 756 
 757     default:

 758         /* Unknown Type */
 759 
 760         AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
 761         break;
 762     }
 763 
 764     return;
 765 }
 766 
 767 
 768 /*******************************************************************************
 769  *
 770  * FUNCTION:    AcpiExDumpOperands
 771  *
 772  * PARAMETERS:  Operands            - A list of Operand objects
 773  *              OpcodeName          - AML opcode name
 774  *              NumOperands         - Operand count for this opcode
 775  *
 776  * DESCRIPTION: Dump the operands associated with the opcode
 777  *


 850  * FUNCTION:    AcpiExDumpNamespaceNode
 851  *
 852  * PARAMETERS:  Node                - Descriptor to dump
 853  *              Flags               - Force display if TRUE
 854  *
 855  * DESCRIPTION: Dumps the members of the given.Node
 856  *
 857  ******************************************************************************/
 858 
 859 void
 860 AcpiExDumpNamespaceNode (
 861     ACPI_NAMESPACE_NODE     *Node,
 862     UINT32                  Flags)
 863 {
 864 
 865     ACPI_FUNCTION_ENTRY ();
 866 
 867 
 868     if (!Flags)
 869     {
 870         if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))


 871         {
 872             return;
 873         }
 874     }
 875 
 876     AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
 877     AcpiExOutString  ("Type", AcpiUtGetTypeName (Node->Type));
 878     AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
 879     AcpiExOutPointer ("Parent", Node->Parent);
 880 
 881     AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
 882         AcpiExDumpNode);
 883 }
 884 
 885 
 886 /*******************************************************************************
 887  *
 888  * FUNCTION:    AcpiExDumpReferenceObj
 889  *
 890  * PARAMETERS:  Object              - Descriptor to dump


 978     AcpiOsPrintf ("%p ", ObjDesc);
 979 
 980     /* Null package elements are allowed */
 981 
 982     if (!ObjDesc)
 983     {
 984         AcpiOsPrintf ("[Null Object]\n");
 985         return;
 986     }
 987 
 988     /* Packages may only contain a few object types */
 989 
 990     switch (ObjDesc->Common.Type)
 991     {
 992     case ACPI_TYPE_INTEGER:
 993 
 994         AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
 995             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
 996         break;
 997 
 998 
 999     case ACPI_TYPE_STRING:
1000 
1001         AcpiOsPrintf ("[String]  Value: ");
1002         for (i = 0; i < ObjDesc->String.Length; i++)
1003         {
1004             AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
1005         }
1006         AcpiOsPrintf ("\n");
1007         break;
1008 
1009 
1010     case ACPI_TYPE_BUFFER:
1011 
1012         AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
1013         if (ObjDesc->Buffer.Length)
1014         {
1015             AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
1016                 ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
1017         }
1018         else
1019         {
1020             AcpiOsPrintf ("\n");
1021         }
1022         break;
1023 
1024 
1025     case ACPI_TYPE_PACKAGE:
1026 
1027         AcpiOsPrintf ("[Package] Contains %u Elements:\n",
1028             ObjDesc->Package.Count);
1029 
1030         for (i = 0; i < ObjDesc->Package.Count; i++)
1031         {
1032             AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
1033         }
1034         break;
1035 
1036 
1037     case ACPI_TYPE_LOCAL_REFERENCE:
1038 
1039         AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
1040             AcpiUtGetReferenceName (ObjDesc),
1041             ObjDesc->Reference.Class);
1042         AcpiExDumpReferenceObj (ObjDesc);
1043         break;
1044 
1045 
1046     default:
1047 
1048         AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
1049         break;
1050     }
1051 }
1052 
1053 
1054 /*******************************************************************************
1055  *
1056  * FUNCTION:    AcpiExDumpObjectDescriptor
1057  *
1058  * PARAMETERS:  ObjDesc             - Descriptor to dump
1059  *              Flags               - Force display if TRUE
1060  *
1061  * DESCRIPTION: Dumps the members of the object descriptor given.
1062  *
1063  ******************************************************************************/
1064 
1065 void
1066 AcpiExDumpObjectDescriptor (
1067     ACPI_OPERAND_OBJECT     *ObjDesc,
1068     UINT32                  Flags)
1069 {
1070     ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
1071 
1072 
1073     if (!ObjDesc)
1074     {
1075         return_VOID;
1076     }
1077 
1078     if (!Flags)
1079     {
1080         if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))


1081         {
1082             return_VOID;
1083         }
1084     }
1085 
1086     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1087     {
1088         AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
1089 
1090         AcpiOsPrintf ("\nAttached Object (%p):\n",
1091             ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
1092 
1093         AcpiExDumpObjectDescriptor (
1094             ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
1095         return_VOID;
1096     }
1097 
1098     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
1099     {
1100         AcpiOsPrintf (


1102             ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
1103         return_VOID;
1104     }
1105 
1106     if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
1107     {
1108         return_VOID;
1109     }
1110 
1111     /* Common Fields */
1112 
1113     AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
1114 
1115     /* Object-specific fields */
1116 
1117     AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
1118     return_VOID;
1119 }
1120 
1121 #endif
1122 
   1 /******************************************************************************
   2  *
   3  * Module Name: exdump - Interpreter debug output routines
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, Intel Corp.
   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.


 114     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer),         NULL},
 115     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Buffer.Length),                "Length"},
 116     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Buffer.Pointer),               "Pointer"},
 117     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Buffer.Node),                  "Parent Node"},
 118     {ACPI_EXD_BUFFER,   0,                                              NULL}
 119 };
 120 
 121 static ACPI_EXDUMP_INFO     AcpiExDumpPackage[5] =
 122 {
 123     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage),        NULL},
 124     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Package.Flags),                "Flags"},
 125     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Package.Count),                "Elements"},
 126     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Package.Elements),             "Element List"},
 127     {ACPI_EXD_PACKAGE,  0,                                              NULL}
 128 };
 129 
 130 static ACPI_EXDUMP_INFO     AcpiExDumpDevice[4] =
 131 {
 132     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice),         NULL},
 133     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.Handler),               "Handler"},
 134     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.NotifyList[0]),         "System Notify"},
 135     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Device.NotifyList[1]),         "Device Notify"}
 136 };
 137 
 138 static ACPI_EXDUMP_INFO     AcpiExDumpEvent[2] =
 139 {
 140     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent),          NULL},
 141     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Event.OsSemaphore),            "OsSemaphore"}
 142 };
 143 
 144 static ACPI_EXDUMP_INFO     AcpiExDumpMethod[9] =
 145 {
 146     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod),         NULL},
 147     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.InfoFlags),             "Info Flags"},
 148     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ParamCount),            "Parameter Count"},
 149     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.SyncLevel),             "Sync Level"},
 150     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.Mutex),                 "Mutex"},
 151     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.OwnerId),               "Owner Id"},
 152     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Method.ThreadCount),           "Thread Count"},
 153     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Method.AmlLength),             "Aml Length"},
 154     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Method.AmlStart),              "Aml Start"}
 155 };


 162     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Mutex.AcquisitionDepth),       "Acquire Depth"},
 163     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Mutex.OsMutex),                "OsMutex"}
 164 };
 165 
 166 static ACPI_EXDUMP_INFO     AcpiExDumpRegion[7] =
 167 {
 168     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion),         NULL},
 169     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.SpaceId),               "Space Id"},
 170     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Region.Flags),                 "Flags"},
 171     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Region.Address),               "Address"},
 172     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Region.Length),                "Length"},
 173     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Region.Handler),               "Handler"},
 174     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Region.Next),                  "Next"}
 175 };
 176 
 177 static ACPI_EXDUMP_INFO     AcpiExDumpPower[5] =
 178 {
 179     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpPower),          NULL},
 180     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.SystemLevel),    "System Level"},
 181     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (PowerResource.ResourceOrder),  "Resource Order"},
 182     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.NotifyList[0]),  "System Notify"},
 183     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (PowerResource.NotifyList[1]),  "Device Notify"}
 184 };
 185 
 186 static ACPI_EXDUMP_INFO     AcpiExDumpProcessor[7] =
 187 {
 188     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor),      NULL},
 189     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Processor.ProcId),             "Processor ID"},
 190     {ACPI_EXD_UINT8 ,   ACPI_EXD_OFFSET (Processor.Length),             "Length"},
 191     {ACPI_EXD_ADDRESS,  ACPI_EXD_OFFSET (Processor.Address),            "Address"},
 192     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.NotifyList[0]),      "System Notify"},
 193     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.NotifyList[1]),      "Device Notify"},
 194     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Processor.Handler),            "Handler"}
 195 };
 196 
 197 static ACPI_EXDUMP_INFO     AcpiExDumpThermal[4] =
 198 {
 199     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal),        NULL},
 200     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.NotifyList[0]),    "System Notify"},
 201     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.NotifyList[1]),    "Device Notify"},
 202     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (ThermalZone.Handler),          "Handler"}
 203 };
 204 
 205 static ACPI_EXDUMP_INFO     AcpiExDumpBufferField[3] =
 206 {
 207     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField),    NULL},
 208     {ACPI_EXD_FIELD,    0,                                              NULL},
 209     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BufferField.BufferObj),        "Buffer Object"}
 210 };
 211 
 212 static ACPI_EXDUMP_INFO     AcpiExDumpRegionField[5] =
 213 {
 214     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField),    NULL},
 215     {ACPI_EXD_FIELD,    0,                                              NULL},
 216     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Field.AccessLength),           "AccessLength"},
 217     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Field.RegionObj),              "Region Object"},
 218     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Field.ResourceBuffer),         "ResourceBuffer"}
 219 };
 220 
 221 static ACPI_EXDUMP_INFO     AcpiExDumpBankField[5] =
 222 {
 223     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
 224     {ACPI_EXD_FIELD,    0,                                              NULL},
 225     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (BankField.Value),              "Value"},
 226     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.RegionObj),          "Region Object"},
 227     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (BankField.BankObj),            "Bank Object"}
 228 };
 229 
 230 static ACPI_EXDUMP_INFO     AcpiExDumpIndexField[5] =
 231 {
 232     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField),      NULL},
 233     {ACPI_EXD_FIELD,    0,                                              NULL},
 234     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (IndexField.Value),             "Value"},
 235     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.IndexObj),          "Index Object"},
 236     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (IndexField.DataObj),           "Data Object"}
 237 };
 238 


 241     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpReference),       NULL},
 242     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.Class),              "Class"},
 243     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Reference.TargetType),         "Target Type"},
 244     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Reference.Value),              "Value"},
 245     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Object),             "Object Desc"},
 246     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Node),               "Node"},
 247     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Reference.Where),              "Where"},
 248     {ACPI_EXD_REFERENCE,0,                                              NULL}
 249 };
 250 
 251 static ACPI_EXDUMP_INFO     AcpiExDumpAddressHandler[6] =
 252 {
 253     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
 254     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (AddressSpace.SpaceId),         "Space Id"},
 255     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Next),            "Next"},
 256     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.RegionList),      "Region List"},
 257     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Node),            "Node"},
 258     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (AddressSpace.Context),         "Context"}
 259 };
 260 
 261 static ACPI_EXDUMP_INFO     AcpiExDumpNotify[7] =
 262 {
 263     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify),         NULL},
 264     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Node),                  "Node"},
 265     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (Notify.HandlerType),           "Handler Type"},
 266     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Handler),               "Handler"},
 267     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Context),               "Context"},
 268     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Next[0]),               "Next System Notify"},
 269     {ACPI_EXD_POINTER,  ACPI_EXD_OFFSET (Notify.Next[1]),               "Next Device Notify"}
 270 };
 271 
 272 
 273 /* Miscellaneous tables */
 274 
 275 static ACPI_EXDUMP_INFO     AcpiExDumpCommon[4] =
 276 {
 277     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon),         NULL},
 278     {ACPI_EXD_TYPE ,    0,                                              NULL},
 279     {ACPI_EXD_UINT16,   ACPI_EXD_OFFSET (Common.ReferenceCount),        "Reference Count"},
 280     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (Common.Flags),                 "Flags"}
 281 };
 282 
 283 static ACPI_EXDUMP_INFO     AcpiExDumpFieldCommon[7] =
 284 {
 285     {ACPI_EXD_INIT,     ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon),    NULL},
 286     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.FieldFlags),       "Field Flags"},
 287     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.AccessByteWidth),  "Access Byte Width"},
 288     {ACPI_EXD_UINT32,   ACPI_EXD_OFFSET (CommonField.BitLength),        "Bit Length"},
 289     {ACPI_EXD_UINT8,    ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},


 340  *
 341  * FUNCTION:    AcpiExDumpObject
 342  *
 343  * PARAMETERS:  ObjDesc             - Descriptor to dump
 344  *              Info                - Info table corresponding to this object
 345  *                                    type
 346  *
 347  * RETURN:      None
 348  *
 349  * DESCRIPTION: Walk the info table for this object
 350  *
 351  ******************************************************************************/
 352 
 353 static void
 354 AcpiExDumpObject (
 355     ACPI_OPERAND_OBJECT     *ObjDesc,
 356     ACPI_EXDUMP_INFO        *Info)
 357 {
 358     UINT8                   *Target;
 359     char                    *Name;
 360     const char              *ReferenceName;
 361     UINT8                   Count;
 362 
 363 
 364     if (!Info)
 365     {
 366         AcpiOsPrintf (
 367             "ExDumpObject: Display not implemented for object type %s\n",
 368             AcpiUtGetObjectTypeName (ObjDesc));
 369         return;
 370     }
 371 
 372     /* First table entry must contain the table length (# of table entries) */
 373 
 374     Count = Info->Offset;
 375 
 376     while (Count)
 377     {
 378         Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
 379         Name = Info->Name;
 380 
 381         switch (Info->Opcode)
 382         {
 383         case ACPI_EXD_INIT:
 384 
 385             break;
 386 
 387         case ACPI_EXD_TYPE:
 388 
 389             AcpiExOutString  ("Type", AcpiUtGetObjectTypeName (ObjDesc));
 390             break;
 391 
 392         case ACPI_EXD_UINT8:
 393 
 394             AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
 395             break;
 396 
 397         case ACPI_EXD_UINT16:
 398 
 399             AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
 400             break;
 401 
 402         case ACPI_EXD_UINT32:
 403 
 404             AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));


 425         case ACPI_EXD_BUFFER:
 426 
 427             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
 428             break;
 429 
 430         case ACPI_EXD_PACKAGE:
 431 
 432             /* Dump the package contents */
 433 
 434             AcpiOsPrintf ("\nPackage Contents:\n");
 435             AcpiExDumpPackageObj (ObjDesc, 0, 0);
 436             break;
 437 
 438         case ACPI_EXD_FIELD:
 439 
 440             AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
 441             break;
 442 
 443         case ACPI_EXD_REFERENCE:
 444 
 445             ReferenceName = AcpiUtGetReferenceName (ObjDesc);
 446             AcpiExOutString ("Class Name", ACPI_CAST_PTR (char, ReferenceName));
 447             AcpiExDumpReferenceObj (ObjDesc);
 448             break;
 449 
 450         default:
 451 
 452             AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
 453                 Info->Opcode);
 454             return;
 455         }
 456 
 457         Info++;
 458         Count--;
 459     }
 460 }
 461 
 462 
 463 /*******************************************************************************
 464  *
 465  * FUNCTION:    AcpiExDumpOperand
 466  *


 468  *              Depth           - Current nesting depth
 469  *
 470  * RETURN:      None
 471  *
 472  * DESCRIPTION: Dump an operand object
 473  *
 474  ******************************************************************************/
 475 
 476 void
 477 AcpiExDumpOperand (
 478     ACPI_OPERAND_OBJECT     *ObjDesc,
 479     UINT32                  Depth)
 480 {
 481     UINT32                  Length;
 482     UINT32                  Index;
 483 
 484 
 485     ACPI_FUNCTION_NAME (ExDumpOperand)
 486 
 487 
 488     /* Check if debug output enabled */
 489 
 490     if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_EXEC, _COMPONENT))
 491     {
 492         return;
 493     }
 494 
 495     if (!ObjDesc)
 496     {
 497         /* This could be a null element of a package */
 498 
 499         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
 500         return;
 501     }
 502 
 503     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
 504     {
 505         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
 506         ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
 507         return;
 508     }
 509 
 510     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)


 526     else
 527     {
 528         ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
 529     }
 530 
 531     /* Decode object type */
 532 
 533     switch (ObjDesc->Common.Type)
 534     {
 535     case ACPI_TYPE_LOCAL_REFERENCE:
 536 
 537         AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc));
 538 
 539         switch (ObjDesc->Reference.Class)
 540         {
 541         case ACPI_REFCLASS_DEBUG:
 542 
 543             AcpiOsPrintf ("\n");
 544             break;
 545 

 546         case ACPI_REFCLASS_INDEX:
 547 
 548             AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object);
 549             break;
 550 

 551         case ACPI_REFCLASS_TABLE:
 552 
 553             AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value);
 554             break;
 555 

 556         case ACPI_REFCLASS_REFOF:
 557 
 558             AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object,
 559                 AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *)
 560                     ObjDesc->Reference.Object)->Common.Type));
 561             break;
 562 

 563         case ACPI_REFCLASS_NAME:
 564 
 565             AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii);
 566             break;
 567 

 568         case ACPI_REFCLASS_ARG:
 569         case ACPI_REFCLASS_LOCAL:
 570 
 571             AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value);
 572             break;
 573 

 574         default:    /* Unknown reference class */
 575 
 576             AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class);
 577             break;
 578         }
 579         break;
 580 

 581     case ACPI_TYPE_BUFFER:
 582 
 583         AcpiOsPrintf ("Buffer length %.2X @ %p\n",
 584             ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
 585 
 586         /* Debug only -- dump the buffer contents */
 587 
 588         if (ObjDesc->Buffer.Pointer)
 589         {
 590             Length = ObjDesc->Buffer.Length;
 591             if (Length > 128)
 592             {
 593                 Length = 128;
 594             }
 595 
 596             AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n",
 597                 Length);
 598             ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length);
 599         }
 600         break;
 601 

 602     case ACPI_TYPE_INTEGER:
 603 
 604         AcpiOsPrintf ("Integer %8.8X%8.8X\n",
 605             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
 606         break;
 607 

 608     case ACPI_TYPE_PACKAGE:
 609 
 610         AcpiOsPrintf ("Package [Len %X] ElementArray %p\n",
 611             ObjDesc->Package.Count, ObjDesc->Package.Elements);
 612 
 613         /*
 614          * If elements exist, package element pointer is valid,
 615          * and debug_level exceeds 1, dump package's elements.
 616          */
 617         if (ObjDesc->Package.Count &&
 618             ObjDesc->Package.Elements &&
 619             AcpiDbgLevel > 1)
 620         {
 621             for (Index = 0; Index < ObjDesc->Package.Count; Index++)
 622             {
 623                 AcpiExDumpOperand (ObjDesc->Package.Elements[Index], Depth+1);
 624             }
 625         }
 626         break;
 627 

 628     case ACPI_TYPE_REGION:
 629 
 630         AcpiOsPrintf ("Region %s (%X)",
 631             AcpiUtGetRegionName (ObjDesc->Region.SpaceId),
 632             ObjDesc->Region.SpaceId);
 633 
 634         /*
 635          * If the address and length have not been evaluated,
 636          * don't print them.
 637          */
 638         if (!(ObjDesc->Region.Flags & AOPOBJ_DATA_VALID))
 639         {
 640             AcpiOsPrintf ("\n");
 641         }
 642         else
 643         {
 644             AcpiOsPrintf (" base %8.8X%8.8X Length %X\n",
 645                 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
 646                 ObjDesc->Region.Length);
 647         }
 648         break;
 649 

 650     case ACPI_TYPE_STRING:
 651 
 652         AcpiOsPrintf ("String length %X @ %p ",
 653             ObjDesc->String.Length,
 654             ObjDesc->String.Pointer);
 655 
 656         AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
 657         AcpiOsPrintf ("\n");
 658         break;
 659 

 660     case ACPI_TYPE_LOCAL_BANK_FIELD:
 661 
 662         AcpiOsPrintf ("BankField\n");
 663         break;
 664 

 665     case ACPI_TYPE_LOCAL_REGION_FIELD:
 666 
 667         AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at "
 668             "byte=%X bit=%X of below:\n",
 669             ObjDesc->Field.BitLength,
 670             ObjDesc->Field.AccessByteWidth,
 671             ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
 672             ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
 673             ObjDesc->Field.BaseByteOffset,
 674             ObjDesc->Field.StartFieldBitOffset);
 675 
 676         AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
 677         break;
 678 

 679     case ACPI_TYPE_LOCAL_INDEX_FIELD:
 680 
 681         AcpiOsPrintf ("IndexField\n");
 682         break;
 683 

 684     case ACPI_TYPE_BUFFER_FIELD:
 685 
 686         AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n",
 687             ObjDesc->BufferField.BitLength,
 688             ObjDesc->BufferField.BaseByteOffset,
 689             ObjDesc->BufferField.StartFieldBitOffset);
 690 
 691         if (!ObjDesc->BufferField.BufferObj)
 692         {
 693             ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
 694         }
 695         else if ((ObjDesc->BufferField.BufferObj)->Common.Type !=
 696                     ACPI_TYPE_BUFFER)
 697         {
 698             AcpiOsPrintf ("*not a Buffer*\n");
 699         }
 700         else
 701         {
 702             AcpiExDumpOperand (ObjDesc->BufferField.BufferObj, Depth+1);
 703         }
 704         break;
 705 

 706     case ACPI_TYPE_EVENT:
 707 
 708         AcpiOsPrintf ("Event\n");
 709         break;
 710 

 711     case ACPI_TYPE_METHOD:
 712 
 713         AcpiOsPrintf ("Method(%X) @ %p:%X\n",
 714             ObjDesc->Method.ParamCount,
 715             ObjDesc->Method.AmlStart,
 716             ObjDesc->Method.AmlLength);
 717         break;
 718 

 719     case ACPI_TYPE_MUTEX:
 720 
 721         AcpiOsPrintf ("Mutex\n");
 722         break;
 723 

 724     case ACPI_TYPE_DEVICE:
 725 
 726         AcpiOsPrintf ("Device\n");
 727         break;
 728 

 729     case ACPI_TYPE_POWER:
 730 
 731         AcpiOsPrintf ("Power\n");
 732         break;
 733 

 734     case ACPI_TYPE_PROCESSOR:
 735 
 736         AcpiOsPrintf ("Processor\n");
 737         break;
 738 

 739     case ACPI_TYPE_THERMAL:
 740 
 741         AcpiOsPrintf ("Thermal\n");
 742         break;
 743 

 744     default:
 745 
 746         /* Unknown Type */
 747 
 748         AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type);
 749         break;
 750     }
 751 
 752     return;
 753 }
 754 
 755 
 756 /*******************************************************************************
 757  *
 758  * FUNCTION:    AcpiExDumpOperands
 759  *
 760  * PARAMETERS:  Operands            - A list of Operand objects
 761  *              OpcodeName          - AML opcode name
 762  *              NumOperands         - Operand count for this opcode
 763  *
 764  * DESCRIPTION: Dump the operands associated with the opcode
 765  *


 838  * FUNCTION:    AcpiExDumpNamespaceNode
 839  *
 840  * PARAMETERS:  Node                - Descriptor to dump
 841  *              Flags               - Force display if TRUE
 842  *
 843  * DESCRIPTION: Dumps the members of the given.Node
 844  *
 845  ******************************************************************************/
 846 
 847 void
 848 AcpiExDumpNamespaceNode (
 849     ACPI_NAMESPACE_NODE     *Node,
 850     UINT32                  Flags)
 851 {
 852 
 853     ACPI_FUNCTION_ENTRY ();
 854 
 855 
 856     if (!Flags)
 857     {
 858         /* Check if debug output enabled */
 859 
 860         if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
 861         {
 862             return;
 863         }
 864     }
 865 
 866     AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
 867     AcpiExOutString  ("Type", AcpiUtGetTypeName (Node->Type));
 868     AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
 869     AcpiExOutPointer ("Parent", Node->Parent);
 870 
 871     AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
 872         AcpiExDumpNode);
 873 }
 874 
 875 
 876 /*******************************************************************************
 877  *
 878  * FUNCTION:    AcpiExDumpReferenceObj
 879  *
 880  * PARAMETERS:  Object              - Descriptor to dump


 968     AcpiOsPrintf ("%p ", ObjDesc);
 969 
 970     /* Null package elements are allowed */
 971 
 972     if (!ObjDesc)
 973     {
 974         AcpiOsPrintf ("[Null Object]\n");
 975         return;
 976     }
 977 
 978     /* Packages may only contain a few object types */
 979 
 980     switch (ObjDesc->Common.Type)
 981     {
 982     case ACPI_TYPE_INTEGER:
 983 
 984         AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
 985             ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
 986         break;
 987 

 988     case ACPI_TYPE_STRING:
 989 
 990         AcpiOsPrintf ("[String]  Value: ");
 991         AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);



 992         AcpiOsPrintf ("\n");
 993         break;
 994 

 995     case ACPI_TYPE_BUFFER:
 996 
 997         AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
 998         if (ObjDesc->Buffer.Length)
 999         {
1000             AcpiUtDebugDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
1001                 ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
1002         }
1003         else
1004         {
1005             AcpiOsPrintf ("\n");
1006         }
1007         break;
1008 

1009     case ACPI_TYPE_PACKAGE:
1010 
1011         AcpiOsPrintf ("[Package] Contains %u Elements:\n",
1012             ObjDesc->Package.Count);
1013 
1014         for (i = 0; i < ObjDesc->Package.Count; i++)
1015         {
1016             AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
1017         }
1018         break;
1019 

1020     case ACPI_TYPE_LOCAL_REFERENCE:
1021 
1022         AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X",
1023             AcpiUtGetReferenceName (ObjDesc),
1024             ObjDesc->Reference.Class);
1025         AcpiExDumpReferenceObj (ObjDesc);
1026         break;
1027 

1028     default:
1029 
1030         AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type);
1031         break;
1032     }
1033 }
1034 
1035 
1036 /*******************************************************************************
1037  *
1038  * FUNCTION:    AcpiExDumpObjectDescriptor
1039  *
1040  * PARAMETERS:  ObjDesc             - Descriptor to dump
1041  *              Flags               - Force display if TRUE
1042  *
1043  * DESCRIPTION: Dumps the members of the object descriptor given.
1044  *
1045  ******************************************************************************/
1046 
1047 void
1048 AcpiExDumpObjectDescriptor (
1049     ACPI_OPERAND_OBJECT     *ObjDesc,
1050     UINT32                  Flags)
1051 {
1052     ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
1053 
1054 
1055     if (!ObjDesc)
1056     {
1057         return_VOID;
1058     }
1059 
1060     if (!Flags)
1061     {
1062         /* Check if debug output enabled */
1063 
1064         if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_OBJECTS, _COMPONENT))
1065         {
1066             return_VOID;
1067         }
1068     }
1069 
1070     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
1071     {
1072         AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
1073 
1074         AcpiOsPrintf ("\nAttached Object (%p):\n",
1075             ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
1076 
1077         AcpiExDumpObjectDescriptor (
1078             ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
1079         return_VOID;
1080     }
1081 
1082     if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
1083     {
1084         AcpiOsPrintf (


1086             ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
1087         return_VOID;
1088     }
1089 
1090     if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
1091     {
1092         return_VOID;
1093     }
1094 
1095     /* Common Fields */
1096 
1097     AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
1098 
1099     /* Object-specific fields */
1100 
1101     AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
1102     return_VOID;
1103 }
1104 
1105 #endif