nsdump.c revision 167802
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Module Name: nsdump - table dumping routines for debug 4167802Sjkim * $Revision: 1.182 $ 567754Smsmith * 667754Smsmith *****************************************************************************/ 767754Smsmith 867754Smsmith/****************************************************************************** 967754Smsmith * 1067754Smsmith * 1. Copyright Notice 1167754Smsmith * 12167802Sjkim * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 1370243Smsmith * All rights reserved. 1467754Smsmith * 1567754Smsmith * 2. License 1667754Smsmith * 1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property 1867754Smsmith * rights. You may have additional license terms from the party that provided 1967754Smsmith * you this software, covering your right to use that party's intellectual 2067754Smsmith * property rights. 2167754Smsmith * 2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an 2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy, 2667754Smsmith 2767754Smsmith * make derivatives, distribute, use and display any portion of the Covered 2867754Smsmith * Code in any form, with the right to sublicense such rights; and 2967754Smsmith * 3067754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3167754Smsmith * license (with the right to sublicense), under only those claims of Intel 3267754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell, 3367754Smsmith * offer to sell, and import the Covered Code and derivative works thereof 3467754Smsmith * solely to the minimum extent necessary to exercise the above copyright 3567754Smsmith * license, and in no event shall the patent license extend to any additions 3667754Smsmith * to or modifications of the Original Intel Code. No other license or right 3767754Smsmith * is granted directly or by implication, estoppel or otherwise; 3867754Smsmith * 3967754Smsmith * The above copyright and patent license is granted only if the following 4067754Smsmith * conditions are met: 4167754Smsmith * 4267754Smsmith * 3. Conditions 4367754Smsmith * 4467754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4567754Smsmith * Redistribution of source code of any substantial portion of the Covered 4667754Smsmith * Code or modification with rights to further distribute source must include 4767754Smsmith * the above Copyright Notice, the above License, this list of Conditions, 4867754Smsmith * and the following Disclaimer and Export Compliance provision. In addition, 4967754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to 5067754Smsmith * contain a file documenting the changes Licensee made to create that Covered 5167754Smsmith * Code and the date of any change. Licensee must include in that file the 5267754Smsmith * documentation of any changes made by any predecessor Licensee. Licensee 5367754Smsmith * must include a prominent statement that the modification is derived, 5467754Smsmith * directly or indirectly, from Original Intel Code. 5567754Smsmith * 5667754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5767754Smsmith * Redistribution of source code of any substantial portion of the Covered 5867754Smsmith * Code or modification without rights to further distribute source must 5967754Smsmith * include the following Disclaimer and Export Compliance provision in the 6067754Smsmith * documentation and/or other materials provided with distribution. In 6167754Smsmith * addition, Licensee may not authorize further sublicense of source of any 6267754Smsmith * portion of the Covered Code, and must include terms to the effect that the 6367754Smsmith * license from Licensee to its licensee is limited to the intellectual 6467754Smsmith * property embodied in the software Licensee provides to its licensee, and 6567754Smsmith * not to intellectual property embodied in modifications its licensee may 6667754Smsmith * make. 6767754Smsmith * 6867754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any 6967754Smsmith * substantial portion of the Covered Code or modification must reproduce the 7067754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance 7167754Smsmith * provision in the documentation and/or other materials provided with the 7267754Smsmith * distribution. 7367754Smsmith * 7467754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original 7567754Smsmith * Intel Code. 7667754Smsmith * 7767754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by 7867754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or 7967754Smsmith * other dealings in products derived from or relating to the Covered Code 8067754Smsmith * without prior written authorization from Intel. 8167754Smsmith * 8267754Smsmith * 4. Disclaimer and Export Compliance 8367754Smsmith * 8467754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8567754Smsmith * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8667754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 8767754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 8867754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 8967754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 9067754Smsmith * PARTICULAR PURPOSE. 9167754Smsmith * 9267754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9367754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9467754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9567754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9667754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 9767754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 9867754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 9967754Smsmith * LIMITED REMEDY. 10067754Smsmith * 10167754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this 10267754Smsmith * software or system incorporating such software without first obtaining any 10367754Smsmith * required license or other approval from the U. S. Department of Commerce or 10467754Smsmith * any other agency or department of the United States Government. In the 10567754Smsmith * event Licensee exports any such software from the United States or 10667754Smsmith * re-exports any such software from a foreign destination, Licensee shall 10767754Smsmith * ensure that the distribution and export/re-export of the software is in 10867754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the 10967754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor 11067754Smsmith * any of its subsidiaries will export/re-export any technical data, process, 11167754Smsmith * software, or service, directly or indirectly, to any country for which the 11267754Smsmith * United States government or any agency thereof requires an export license, 11367754Smsmith * other governmental approval, or letter of assurance, without first obtaining 11467754Smsmith * such license, approval or letter. 11567754Smsmith * 11667754Smsmith *****************************************************************************/ 11767754Smsmith 11867754Smsmith#define __NSDUMP_C__ 11967754Smsmith 120151600Sobrien#include <contrib/dev/acpica/acpi.h> 121151600Sobrien#include <contrib/dev/acpica/acnamesp.h> 122151600Sobrien#include <contrib/dev/acpica/acparser.h> 12367754Smsmith 12467754Smsmith 12577424Smsmith#define _COMPONENT ACPI_NAMESPACE 12691116Smsmith ACPI_MODULE_NAME ("nsdump") 12767754Smsmith 128151937Sjkim/* Local prototypes */ 129123315Snjl 130151937Sjkim#ifdef ACPI_OBSOLETE_FUNCTIONS 131151937Sjkimvoid 132151937SjkimAcpiNsDumpRootDevices ( 133151937Sjkim void); 134151937Sjkim 135151937Sjkimstatic ACPI_STATUS 136151937SjkimAcpiNsDumpOneDevice ( 137151937Sjkim ACPI_HANDLE ObjHandle, 138151937Sjkim UINT32 Level, 139151937Sjkim void *Context, 140151937Sjkim void **ReturnValue); 141151937Sjkim#endif 142151937Sjkim 143151937Sjkim 144102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 14577424Smsmith/******************************************************************************* 14667754Smsmith * 14787031Smsmith * FUNCTION: AcpiNsPrintPathname 14887031Smsmith * 149151937Sjkim * PARAMETERS: NumSegments - Number of ACPI name segments 15087031Smsmith * Pathname - The compressed (internal) path 15187031Smsmith * 152151937Sjkim * RETURN: None 153151937Sjkim * 15487031Smsmith * DESCRIPTION: Print an object's full namespace pathname 15587031Smsmith * 15687031Smsmith ******************************************************************************/ 15787031Smsmith 15887031Smsmithvoid 15987031SmsmithAcpiNsPrintPathname ( 16087031Smsmith UINT32 NumSegments, 16187031Smsmith char *Pathname) 16287031Smsmith{ 163151937Sjkim ACPI_NATIVE_UINT i; 164151937Sjkim 165151937Sjkim 166167802Sjkim ACPI_FUNCTION_NAME (NsPrintPathname); 16787031Smsmith 16887031Smsmith 16987031Smsmith if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) 17087031Smsmith { 17187031Smsmith return; 17287031Smsmith } 17387031Smsmith 174123315Snjl /* Print the entire name */ 17587031Smsmith 17687031Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); 17787031Smsmith 17891116Smsmith while (NumSegments) 17987031Smsmith { 180151937Sjkim for (i = 0; i < 4; i++) 181151937Sjkim { 182151937Sjkim ACPI_IS_PRINT (Pathname[i]) ? 183151937Sjkim AcpiOsPrintf ("%c", Pathname[i]) : 184151937Sjkim AcpiOsPrintf ("?"); 185151937Sjkim } 186151937Sjkim 18791116Smsmith Pathname += ACPI_NAME_SIZE; 18891116Smsmith NumSegments--; 18991116Smsmith if (NumSegments) 19091116Smsmith { 19191116Smsmith AcpiOsPrintf ("."); 19291116Smsmith } 19387031Smsmith } 19487031Smsmith 19587031Smsmith AcpiOsPrintf ("]\n"); 19687031Smsmith} 19787031Smsmith 19887031Smsmith 19987031Smsmith/******************************************************************************* 20087031Smsmith * 20167754Smsmith * FUNCTION: AcpiNsDumpPathname 20267754Smsmith * 20367754Smsmith * PARAMETERS: Handle - Object 20467754Smsmith * Msg - Prefix message 20567754Smsmith * Level - Desired debug level 20667754Smsmith * Component - Caller's component ID 20767754Smsmith * 208151937Sjkim * RETURN: None 209151937Sjkim * 21067754Smsmith * DESCRIPTION: Print an object's full namespace pathname 21167754Smsmith * Manages allocation/freeing of a pathname buffer 21267754Smsmith * 21377424Smsmith ******************************************************************************/ 21467754Smsmith 215114237Snjlvoid 21667754SmsmithAcpiNsDumpPathname ( 21767754Smsmith ACPI_HANDLE Handle, 218114237Snjl char *Msg, 21967754Smsmith UINT32 Level, 22067754Smsmith UINT32 Component) 22167754Smsmith{ 22267754Smsmith 223167802Sjkim ACPI_FUNCTION_TRACE (NsDumpPathname); 22467754Smsmith 22583174Smsmith 22667754Smsmith /* Do this only if the requested debug level and component are enabled */ 22767754Smsmith 22867754Smsmith if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) 22967754Smsmith { 230114237Snjl return_VOID; 23167754Smsmith } 23267754Smsmith 23367754Smsmith /* Convert handle to a full pathname and print it (with supplied message) */ 23467754Smsmith 235114237Snjl AcpiNsPrintNodePathname (Handle, Msg); 236114237Snjl AcpiOsPrintf ("\n"); 237114237Snjl return_VOID; 23867754Smsmith} 23967754Smsmith 24067754Smsmith 24177424Smsmith/******************************************************************************* 24267754Smsmith * 24367754Smsmith * FUNCTION: AcpiNsDumpOneObject 24467754Smsmith * 245151937Sjkim * PARAMETERS: ObjHandle - Node to be dumped 24667754Smsmith * Level - Nesting level of the handle 24767754Smsmith * Context - Passed into WalkNamespace 248151937Sjkim * ReturnValue - Not used 24967754Smsmith * 250151937Sjkim * RETURN: Status 251151937Sjkim * 25267754Smsmith * DESCRIPTION: Dump a single Node 25367754Smsmith * This procedure is a UserFunction called by AcpiNsWalkNamespace. 25467754Smsmith * 25577424Smsmith ******************************************************************************/ 25667754Smsmith 25767754SmsmithACPI_STATUS 25867754SmsmithAcpiNsDumpOneObject ( 25967754Smsmith ACPI_HANDLE ObjHandle, 26067754Smsmith UINT32 Level, 26167754Smsmith void *Context, 26267754Smsmith void **ReturnValue) 26367754Smsmith{ 26467754Smsmith ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 26567754Smsmith ACPI_NAMESPACE_NODE *ThisNode; 26667754Smsmith ACPI_OPERAND_OBJECT *ObjDesc = NULL; 26791116Smsmith ACPI_OBJECT_TYPE ObjType; 26891116Smsmith ACPI_OBJECT_TYPE Type; 26967754Smsmith UINT32 BytesToDump; 270107325Siwasaki UINT32 DbgLevel; 27185756Smsmith UINT32 i; 27267754Smsmith 27367754Smsmith 274167802Sjkim ACPI_FUNCTION_NAME (NsDumpOneObject); 27582367Smsmith 27682367Smsmith 277107325Siwasaki /* Is output enabled? */ 27867754Smsmith 27967754Smsmith if (!(AcpiDbgLevel & Info->DebugLevel)) 28067754Smsmith { 28167754Smsmith return (AE_OK); 28267754Smsmith } 28367754Smsmith 28467754Smsmith if (!ObjHandle) 28567754Smsmith { 28682367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); 28767754Smsmith return (AE_OK); 28867754Smsmith } 28967754Smsmith 290107325Siwasaki ThisNode = AcpiNsMapHandleToNode (ObjHandle); 291107325Siwasaki Type = ThisNode->Type; 292107325Siwasaki 29367754Smsmith /* Check if the owner matches */ 29467754Smsmith 295151937Sjkim if ((Info->OwnerId != ACPI_OWNER_ID_MAX) && 29667754Smsmith (Info->OwnerId != ThisNode->OwnerId)) 29767754Smsmith { 29867754Smsmith return (AE_OK); 29967754Smsmith } 30067754Smsmith 301151937Sjkim if (!(Info->DisplayType & ACPI_DISPLAY_SHORT)) 302151937Sjkim { 303151937Sjkim /* Indent the object according to the level */ 30467754Smsmith 305151937Sjkim AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); 30667754Smsmith 307151937Sjkim /* Check the node type and name */ 30867754Smsmith 309151937Sjkim if (Type > ACPI_TYPE_LOCAL_MAX) 310151937Sjkim { 311167802Sjkim ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type)); 312151937Sjkim } 31367754Smsmith 314151937Sjkim if (!AcpiUtValidAcpiName (ThisNode->Name.Integer)) 315151937Sjkim { 316167802Sjkim ThisNode->Name.Integer = AcpiUtRepairName (ThisNode->Name.Ascii); 317167802Sjkim 318167802Sjkim ACPI_WARNING ((AE_INFO, "Invalid ACPI Name %08X", 319151937Sjkim ThisNode->Name.Integer)); 320151937Sjkim } 321151937Sjkim 322151937Sjkim AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode)); 32367754Smsmith } 32467754Smsmith 32567754Smsmith /* 32667754Smsmith * Now we can print out the pertinent information 32767754Smsmith */ 328167802Sjkim AcpiOsPrintf (" %-12s %p %2.2X ", 329167802Sjkim AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId); 33067754Smsmith 33191116Smsmith DbgLevel = AcpiDbgLevel; 33291116Smsmith AcpiDbgLevel = 0; 33387031Smsmith ObjDesc = AcpiNsGetAttachedObject (ThisNode); 33491116Smsmith AcpiDbgLevel = DbgLevel; 33567754Smsmith 336167802Sjkim /* Temp nodes are those nodes created by a control method */ 337167802Sjkim 338167802Sjkim if (ThisNode->Flags & ANOBJ_TEMPORARY) 339167802Sjkim { 340167802Sjkim AcpiOsPrintf ("(T) "); 341167802Sjkim } 342167802Sjkim 343151937Sjkim switch (Info->DisplayType & ACPI_DISPLAY_MASK) 34467754Smsmith { 34585756Smsmith case ACPI_DISPLAY_SUMMARY: 34667754Smsmith 34785756Smsmith if (!ObjDesc) 34885756Smsmith { 34985756Smsmith /* No attached object, we are done */ 35067754Smsmith 35187031Smsmith AcpiOsPrintf ("\n"); 35285756Smsmith return (AE_OK); 35385756Smsmith } 35467754Smsmith 35585756Smsmith switch (Type) 35685756Smsmith { 35785756Smsmith case ACPI_TYPE_PROCESSOR: 358102550Siwasaki 359107325Siwasaki AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", 360138287Smarks ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, 361138287Smarks (char *) ObjDesc->Processor.Address); 36285756Smsmith break; 36367754Smsmith 36499146Siwasaki 36585756Smsmith case ACPI_TYPE_DEVICE: 366102550Siwasaki 367123315Snjl AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); 36885756Smsmith break; 36967754Smsmith 37099146Siwasaki 37185756Smsmith case ACPI_TYPE_METHOD: 372102550Siwasaki 373107325Siwasaki AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", 374138287Smarks (UINT32) ObjDesc->Method.ParamCount, 375138287Smarks ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); 37685756Smsmith break; 37767754Smsmith 37899146Siwasaki 37985756Smsmith case ACPI_TYPE_INTEGER: 380102550Siwasaki 381107325Siwasaki AcpiOsPrintf ("= %8.8X%8.8X\n", 382138287Smarks ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 38385756Smsmith break; 38467754Smsmith 38599146Siwasaki 38685756Smsmith case ACPI_TYPE_PACKAGE: 38799146Siwasaki 38899146Siwasaki if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 38999146Siwasaki { 390107325Siwasaki AcpiOsPrintf ("Elements %.2X\n", 391138287Smarks ObjDesc->Package.Count); 39299146Siwasaki } 39399146Siwasaki else 39499146Siwasaki { 395107325Siwasaki AcpiOsPrintf ("[Length not yet evaluated]\n"); 39699146Siwasaki } 39785756Smsmith break; 39867754Smsmith 39999146Siwasaki 40085756Smsmith case ACPI_TYPE_BUFFER: 40167754Smsmith 40299146Siwasaki if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 40399146Siwasaki { 404107325Siwasaki AcpiOsPrintf ("Len %.2X", 40599146Siwasaki ObjDesc->Buffer.Length); 40667754Smsmith 40799146Siwasaki /* Dump some of the buffer */ 40899146Siwasaki 40999146Siwasaki if (ObjDesc->Buffer.Length > 0) 41085756Smsmith { 41199146Siwasaki AcpiOsPrintf (" ="); 41299146Siwasaki for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) 41399146Siwasaki { 41499679Siwasaki AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); 41599146Siwasaki } 41685756Smsmith } 41799146Siwasaki AcpiOsPrintf ("\n"); 41885756Smsmith } 41999146Siwasaki else 42099146Siwasaki { 421107325Siwasaki AcpiOsPrintf ("[Length not yet evaluated]\n"); 42299146Siwasaki } 42385756Smsmith break; 42467754Smsmith 42599146Siwasaki 42685756Smsmith case ACPI_TYPE_STRING: 427102550Siwasaki 428107325Siwasaki AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); 429107325Siwasaki AcpiUtPrintString (ObjDesc->String.Pointer, 32); 43087031Smsmith AcpiOsPrintf ("\n"); 43185756Smsmith break; 43267754Smsmith 43399146Siwasaki 43485756Smsmith case ACPI_TYPE_REGION: 435102550Siwasaki 436138287Smarks AcpiOsPrintf ("[%s]", 437138287Smarks AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); 43885756Smsmith if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) 43985756Smsmith { 44087031Smsmith AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", 441138287Smarks ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), 442138287Smarks ObjDesc->Region.Length); 44385756Smsmith } 44485756Smsmith else 44585756Smsmith { 44699146Siwasaki AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); 44785756Smsmith } 44885756Smsmith break; 44967754Smsmith 45099146Siwasaki 451107325Siwasaki case ACPI_TYPE_LOCAL_REFERENCE: 452102550Siwasaki 453107325Siwasaki AcpiOsPrintf ("[%s]\n", 454138287Smarks AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); 45585756Smsmith break; 45667754Smsmith 45799146Siwasaki 45885756Smsmith case ACPI_TYPE_BUFFER_FIELD: 459102550Siwasaki 46087031Smsmith if (ObjDesc->BufferField.BufferObj && 46187031Smsmith ObjDesc->BufferField.BufferObj->Buffer.Node) 46287031Smsmith { 463107325Siwasaki AcpiOsPrintf ("Buf [%4.4s]", 464138287Smarks AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node)); 46587031Smsmith } 46685756Smsmith break; 46785756Smsmith 46899146Siwasaki 469107325Siwasaki case ACPI_TYPE_LOCAL_REGION_FIELD: 470102550Siwasaki 471107325Siwasaki AcpiOsPrintf ("Rgn [%4.4s]", 472138287Smarks AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node)); 47385756Smsmith break; 47485756Smsmith 47599146Siwasaki 476107325Siwasaki case ACPI_TYPE_LOCAL_BANK_FIELD: 477102550Siwasaki 478107325Siwasaki AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", 479138287Smarks AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node), 480138287Smarks AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node)); 48185756Smsmith break; 48285756Smsmith 48399146Siwasaki 484107325Siwasaki case ACPI_TYPE_LOCAL_INDEX_FIELD: 485102550Siwasaki 486107325Siwasaki AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", 487138287Smarks AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node), 488138287Smarks AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node)); 48985756Smsmith break; 49085756Smsmith 49199146Siwasaki 492107325Siwasaki case ACPI_TYPE_LOCAL_ALIAS: 493128212Snjl case ACPI_TYPE_LOCAL_METHOD_ALIAS: 494104470Siwasaki 495138287Smarks AcpiOsPrintf ("Target %4.4s (%p)\n", 496138287Smarks AcpiUtGetNodeName (ObjDesc), ObjDesc); 497104470Siwasaki break; 498104470Siwasaki 49985756Smsmith default: 500102550Siwasaki 501107325Siwasaki AcpiOsPrintf ("Object %p\n", ObjDesc); 50285756Smsmith break; 50385756Smsmith } 50485756Smsmith 50585756Smsmith /* Common field handling */ 50685756Smsmith 50785756Smsmith switch (Type) 50885756Smsmith { 50985756Smsmith case ACPI_TYPE_BUFFER_FIELD: 510107325Siwasaki case ACPI_TYPE_LOCAL_REGION_FIELD: 511107325Siwasaki case ACPI_TYPE_LOCAL_BANK_FIELD: 512107325Siwasaki case ACPI_TYPE_LOCAL_INDEX_FIELD: 513107325Siwasaki 514123315Snjl AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n", 515138287Smarks (ObjDesc->CommonField.BaseByteOffset * 8) 516138287Smarks + ObjDesc->CommonField.StartFieldBitOffset, 517138287Smarks ObjDesc->CommonField.BitLength, 518138287Smarks ObjDesc->CommonField.AccessByteWidth); 51985756Smsmith break; 520102550Siwasaki 52199679Siwasaki default: 52299679Siwasaki break; 52385756Smsmith } 52467754Smsmith break; 52567754Smsmith 52667754Smsmith 52785756Smsmith case ACPI_DISPLAY_OBJECTS: 52867754Smsmith 529107325Siwasaki AcpiOsPrintf ("O:%p", ObjDesc); 53085756Smsmith if (!ObjDesc) 53185756Smsmith { 53285756Smsmith /* No attached object, we are done */ 53385756Smsmith 53487031Smsmith AcpiOsPrintf ("\n"); 53585756Smsmith return (AE_OK); 53685756Smsmith } 53785756Smsmith 538151937Sjkim AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount); 53985756Smsmith 54085756Smsmith switch (Type) 54185756Smsmith { 54285756Smsmith case ACPI_TYPE_METHOD: 54385756Smsmith 54485756Smsmith /* Name is a Method and its AML offset/length are set */ 54585756Smsmith 54687031Smsmith AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, 54787031Smsmith ObjDesc->Method.AmlLength); 54885756Smsmith break; 54985756Smsmith 55085756Smsmith case ACPI_TYPE_INTEGER: 55185756Smsmith 552123315Snjl AcpiOsPrintf (" I:%8.8X8.8%X\n", 553123315Snjl ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 55485756Smsmith break; 55585756Smsmith 55685756Smsmith case ACPI_TYPE_STRING: 55785756Smsmith 55887031Smsmith AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, 55987031Smsmith ObjDesc->String.Length); 56085756Smsmith break; 56185756Smsmith 56285756Smsmith case ACPI_TYPE_BUFFER: 56385756Smsmith 56487031Smsmith AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, 56587031Smsmith ObjDesc->Buffer.Length); 56685756Smsmith break; 56785756Smsmith 56885756Smsmith default: 56985756Smsmith 57087031Smsmith AcpiOsPrintf ("\n"); 57185756Smsmith break; 57285756Smsmith } 57367754Smsmith break; 57487031Smsmith 57587031Smsmith 57687031Smsmith default: 57787031Smsmith AcpiOsPrintf ("\n"); 57887031Smsmith break; 57967754Smsmith } 58067754Smsmith 58167754Smsmith /* If debug turned off, done */ 58267754Smsmith 58382367Smsmith if (!(AcpiDbgLevel & ACPI_LV_VALUES)) 58467754Smsmith { 58567754Smsmith return (AE_OK); 58667754Smsmith } 58767754Smsmith 58867754Smsmith 58967754Smsmith /* If there is an attached object, display it */ 59067754Smsmith 591104470Siwasaki DbgLevel = AcpiDbgLevel; 59291116Smsmith AcpiDbgLevel = 0; 593104470Siwasaki ObjDesc = AcpiNsGetAttachedObject (ThisNode); 59491116Smsmith AcpiDbgLevel = DbgLevel; 59567754Smsmith 59667754Smsmith /* Dump attached objects */ 59767754Smsmith 59885756Smsmith while (ObjDesc) 59967754Smsmith { 600107325Siwasaki ObjType = ACPI_TYPE_INVALID; 601151937Sjkim AcpiOsPrintf ("Attached Object %p: ", ObjDesc); 60267754Smsmith 60367754Smsmith /* Decode the type of attached object and dump the contents */ 60467754Smsmith 60591116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 60691116Smsmith { 60791116Smsmith case ACPI_DESC_TYPE_NAMED: 60867754Smsmith 60987031Smsmith AcpiOsPrintf ("(Ptr to Node)\n"); 61067754Smsmith BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 611151937Sjkim ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 61291116Smsmith break; 61367754Smsmith 61499679Siwasaki case ACPI_DESC_TYPE_OPERAND: 61591116Smsmith 61699679Siwasaki ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc); 61767754Smsmith 618107325Siwasaki if (ObjType > ACPI_TYPE_LOCAL_MAX) 61967754Smsmith { 620138287Smarks AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", 621138287Smarks ObjType); 62267754Smsmith BytesToDump = 32; 62367754Smsmith } 62467754Smsmith else 62567754Smsmith { 626151937Sjkim AcpiOsPrintf ("(Ptr to ACPI Object type %X [%s])\n", 627151937Sjkim ObjType, AcpiUtGetTypeName (ObjType)); 62867754Smsmith BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 62967754Smsmith } 630151937Sjkim 631151937Sjkim ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 63291116Smsmith break; 63391116Smsmith 63491116Smsmith default: 63591116Smsmith 63691116Smsmith break; 63767754Smsmith } 63867754Smsmith 63967754Smsmith /* If value is NOT an internal object, we are done */ 64067754Smsmith 64199679Siwasaki if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 64267754Smsmith { 64367754Smsmith goto Cleanup; 64467754Smsmith } 64567754Smsmith 64667754Smsmith /* 64767754Smsmith * Valid object, get the pointer to next level, if any 64867754Smsmith */ 64967754Smsmith switch (ObjType) 65067754Smsmith { 651151937Sjkim case ACPI_TYPE_BUFFER: 65267754Smsmith case ACPI_TYPE_STRING: 653151937Sjkim /* 654151937Sjkim * NOTE: takes advantage of common fields between string/buffer 655151937Sjkim */ 656151937Sjkim BytesToDump = ObjDesc->String.Length; 65799679Siwasaki ObjDesc = (void *) ObjDesc->String.Pointer; 658151937Sjkim AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n", 659151937Sjkim ObjDesc, BytesToDump); 660151937Sjkim ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 661151937Sjkim goto Cleanup; 66267754Smsmith 66377424Smsmith case ACPI_TYPE_BUFFER_FIELD: 66485756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; 66577424Smsmith break; 66677424Smsmith 66767754Smsmith case ACPI_TYPE_PACKAGE: 66899679Siwasaki ObjDesc = (void *) ObjDesc->Package.Elements; 66967754Smsmith break; 67067754Smsmith 67167754Smsmith case ACPI_TYPE_METHOD: 67299679Siwasaki ObjDesc = (void *) ObjDesc->Method.AmlStart; 67367754Smsmith break; 67467754Smsmith 675107325Siwasaki case ACPI_TYPE_LOCAL_REGION_FIELD: 67699679Siwasaki ObjDesc = (void *) ObjDesc->Field.RegionObj; 67767754Smsmith break; 67867754Smsmith 679107325Siwasaki case ACPI_TYPE_LOCAL_BANK_FIELD: 68099679Siwasaki ObjDesc = (void *) ObjDesc->BankField.RegionObj; 68167754Smsmith break; 68267754Smsmith 683107325Siwasaki case ACPI_TYPE_LOCAL_INDEX_FIELD: 68499679Siwasaki ObjDesc = (void *) ObjDesc->IndexField.IndexObj; 68567754Smsmith break; 68667754Smsmith 68799679Siwasaki default: 68867754Smsmith goto Cleanup; 68967754Smsmith } 69067754Smsmith 691107325Siwasaki ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ 69267754Smsmith } 69367754Smsmith 69467754SmsmithCleanup: 69587031Smsmith AcpiOsPrintf ("\n"); 69667754Smsmith return (AE_OK); 69767754Smsmith} 69867754Smsmith 69967754Smsmith 70077424Smsmith/******************************************************************************* 70167754Smsmith * 70267754Smsmith * FUNCTION: AcpiNsDumpObjects 70367754Smsmith * 70467754Smsmith * PARAMETERS: Type - Object type to be dumped 705151937Sjkim * DisplayType - 0 or ACPI_DISPLAY_SUMMARY 706138287Smarks * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 70767754Smsmith * for an effectively unlimited depth. 70867754Smsmith * OwnerId - Dump only objects owned by this ID. Use 70967754Smsmith * ACPI_UINT32_MAX to match all owners. 71067754Smsmith * StartHandle - Where in namespace to start/end search 71167754Smsmith * 712151937Sjkim * RETURN: None 713151937Sjkim * 71467754Smsmith * DESCRIPTION: Dump typed objects within the loaded namespace. 71567754Smsmith * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 71667754Smsmith * 71777424Smsmith ******************************************************************************/ 71867754Smsmith 71967754Smsmithvoid 72067754SmsmithAcpiNsDumpObjects ( 72191116Smsmith ACPI_OBJECT_TYPE Type, 72285756Smsmith UINT8 DisplayType, 72367754Smsmith UINT32 MaxDepth, 724151937Sjkim ACPI_OWNER_ID OwnerId, 72567754Smsmith ACPI_HANDLE StartHandle) 72667754Smsmith{ 72767754Smsmith ACPI_WALK_INFO Info; 72867754Smsmith 72967754Smsmith 73091116Smsmith ACPI_FUNCTION_ENTRY (); 73183174Smsmith 73283174Smsmith 73382367Smsmith Info.DebugLevel = ACPI_LV_TABLES; 73467754Smsmith Info.OwnerId = OwnerId; 73585756Smsmith Info.DisplayType = DisplayType; 73667754Smsmith 737102550Siwasaki (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 738167802Sjkim ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES, 739167802Sjkim AcpiNsDumpOneObject, (void *) &Info, NULL); 74067754Smsmith} 74167754Smsmith 74267754Smsmith 74377424Smsmith/******************************************************************************* 74467754Smsmith * 745151937Sjkim * FUNCTION: AcpiNsDumpEntry 746151937Sjkim * 747151937Sjkim * PARAMETERS: Handle - Node to be dumped 748151937Sjkim * DebugLevel - Output level 749151937Sjkim * 750151937Sjkim * RETURN: None 751151937Sjkim * 752151937Sjkim * DESCRIPTION: Dump a single Node 753151937Sjkim * 754151937Sjkim ******************************************************************************/ 755151937Sjkim 756151937Sjkimvoid 757151937SjkimAcpiNsDumpEntry ( 758151937Sjkim ACPI_HANDLE Handle, 759151937Sjkim UINT32 DebugLevel) 760151937Sjkim{ 761151937Sjkim ACPI_WALK_INFO Info; 762151937Sjkim 763151937Sjkim 764151937Sjkim ACPI_FUNCTION_ENTRY (); 765151937Sjkim 766151937Sjkim 767151937Sjkim Info.DebugLevel = DebugLevel; 768151937Sjkim Info.OwnerId = ACPI_OWNER_ID_MAX; 769151937Sjkim Info.DisplayType = ACPI_DISPLAY_SUMMARY; 770151937Sjkim 771151937Sjkim (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 772151937Sjkim} 773151937Sjkim 774151937Sjkim 775151937Sjkim#ifdef ACPI_ASL_COMPILER 776151937Sjkim/******************************************************************************* 777151937Sjkim * 77867754Smsmith * FUNCTION: AcpiNsDumpTables 77967754Smsmith * 78067754Smsmith * PARAMETERS: SearchBase - Root of subtree to be dumped, or 78167754Smsmith * NS_ALL to dump the entire namespace 78267754Smsmith * MaxDepth - Maximum depth of dump. Use INT_MAX 78367754Smsmith * for an effectively unlimited depth. 78467754Smsmith * 785151937Sjkim * RETURN: None 786151937Sjkim * 78767754Smsmith * DESCRIPTION: Dump the name space, or a portion of it. 78867754Smsmith * 78977424Smsmith ******************************************************************************/ 79067754Smsmith 79167754Smsmithvoid 79267754SmsmithAcpiNsDumpTables ( 79367754Smsmith ACPI_HANDLE SearchBase, 79467754Smsmith UINT32 MaxDepth) 79567754Smsmith{ 79667754Smsmith ACPI_HANDLE SearchHandle = SearchBase; 79767754Smsmith 79867754Smsmith 799167802Sjkim ACPI_FUNCTION_TRACE (NsDumpTables); 80067754Smsmith 80167754Smsmith 80267754Smsmith if (!AcpiGbl_RootNode) 80367754Smsmith { 80467754Smsmith /* 80567754Smsmith * If the name space has not been initialized, 80667754Smsmith * there is nothing to dump. 80767754Smsmith */ 808104470Siwasaki ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); 80967754Smsmith return_VOID; 81067754Smsmith } 81167754Smsmith 81291116Smsmith if (ACPI_NS_ALL == SearchBase) 81367754Smsmith { 814151937Sjkim /* Entire namespace */ 81567754Smsmith 81667754Smsmith SearchHandle = AcpiGbl_RootNode; 81782367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 81867754Smsmith } 81967754Smsmith 82087031Smsmith AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, 821151937Sjkim ACPI_OWNER_ID_MAX, SearchHandle); 82267754Smsmith return_VOID; 82367754Smsmith} 82467754Smsmith#endif 825151937Sjkim#endif 82667754Smsmith 827