nsdump.c revision 151600
167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Module Name: nsdump - table dumping routines for debug 4138287Smarks * $Revision: 160 $ 567754Smsmith * 667754Smsmith *****************************************************************************/ 767754Smsmith 867754Smsmith/****************************************************************************** 967754Smsmith * 1067754Smsmith * 1. Copyright Notice 1167754Smsmith * 12126372Snjl * Some or all of this work - Copyright (c) 1999 - 2004, 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 128123315Snjl 129102550Siwasaki#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 13067754Smsmith 13177424Smsmith/******************************************************************************* 13267754Smsmith * 13387031Smsmith * FUNCTION: AcpiNsPrintPathname 13487031Smsmith * 13587031Smsmith * PARAMETERS: NumSegment - Number of ACPI name segments 13687031Smsmith * Pathname - The compressed (internal) path 13787031Smsmith * 13887031Smsmith * DESCRIPTION: Print an object's full namespace pathname 13987031Smsmith * 14087031Smsmith ******************************************************************************/ 14187031Smsmith 14287031Smsmithvoid 14387031SmsmithAcpiNsPrintPathname ( 14487031Smsmith UINT32 NumSegments, 14587031Smsmith char *Pathname) 14687031Smsmith{ 14799146Siwasaki ACPI_FUNCTION_NAME ("NsPrintPathname"); 14887031Smsmith 14987031Smsmith 15087031Smsmith if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE)) 15187031Smsmith { 15287031Smsmith return; 15387031Smsmith } 15487031Smsmith 155123315Snjl /* Print the entire name */ 15687031Smsmith 15787031Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[")); 15887031Smsmith 15991116Smsmith while (NumSegments) 16087031Smsmith { 16191116Smsmith AcpiOsPrintf ("%4.4s", Pathname); 16291116Smsmith Pathname += ACPI_NAME_SIZE; 16391116Smsmith 16491116Smsmith NumSegments--; 16591116Smsmith if (NumSegments) 16691116Smsmith { 16791116Smsmith AcpiOsPrintf ("."); 16891116Smsmith } 16987031Smsmith } 17087031Smsmith 17187031Smsmith AcpiOsPrintf ("]\n"); 17287031Smsmith} 17387031Smsmith 17487031Smsmith 17587031Smsmith/******************************************************************************* 17687031Smsmith * 17767754Smsmith * FUNCTION: AcpiNsDumpPathname 17867754Smsmith * 17967754Smsmith * PARAMETERS: Handle - Object 18067754Smsmith * Msg - Prefix message 18167754Smsmith * Level - Desired debug level 18267754Smsmith * Component - Caller's component ID 18367754Smsmith * 18467754Smsmith * DESCRIPTION: Print an object's full namespace pathname 18567754Smsmith * Manages allocation/freeing of a pathname buffer 18667754Smsmith * 18777424Smsmith ******************************************************************************/ 18867754Smsmith 189114237Snjlvoid 19067754SmsmithAcpiNsDumpPathname ( 19167754Smsmith ACPI_HANDLE Handle, 192114237Snjl char *Msg, 19367754Smsmith UINT32 Level, 19467754Smsmith UINT32 Component) 19567754Smsmith{ 19667754Smsmith 19791116Smsmith ACPI_FUNCTION_TRACE ("NsDumpPathname"); 19867754Smsmith 19983174Smsmith 20067754Smsmith /* Do this only if the requested debug level and component are enabled */ 20167754Smsmith 20267754Smsmith if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component)) 20367754Smsmith { 204114237Snjl return_VOID; 20567754Smsmith } 20667754Smsmith 20767754Smsmith /* Convert handle to a full pathname and print it (with supplied message) */ 20867754Smsmith 209114237Snjl AcpiNsPrintNodePathname (Handle, Msg); 210114237Snjl AcpiOsPrintf ("\n"); 211114237Snjl return_VOID; 21267754Smsmith} 21367754Smsmith 21467754Smsmith 21577424Smsmith/******************************************************************************* 21667754Smsmith * 21767754Smsmith * FUNCTION: AcpiNsDumpOneObject 21867754Smsmith * 21967754Smsmith * PARAMETERS: Handle - Node to be dumped 22067754Smsmith * Level - Nesting level of the handle 22167754Smsmith * Context - Passed into WalkNamespace 22267754Smsmith * 22367754Smsmith * DESCRIPTION: Dump a single Node 22467754Smsmith * This procedure is a UserFunction called by AcpiNsWalkNamespace. 22567754Smsmith * 22677424Smsmith ******************************************************************************/ 22767754Smsmith 22867754SmsmithACPI_STATUS 22967754SmsmithAcpiNsDumpOneObject ( 23067754Smsmith ACPI_HANDLE ObjHandle, 23167754Smsmith UINT32 Level, 23267754Smsmith void *Context, 23367754Smsmith void **ReturnValue) 23467754Smsmith{ 23567754Smsmith ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 23667754Smsmith ACPI_NAMESPACE_NODE *ThisNode; 23767754Smsmith ACPI_OPERAND_OBJECT *ObjDesc = NULL; 23891116Smsmith ACPI_OBJECT_TYPE ObjType; 23991116Smsmith ACPI_OBJECT_TYPE Type; 24067754Smsmith UINT32 BytesToDump; 241107325Siwasaki UINT32 DbgLevel; 24285756Smsmith UINT32 i; 24367754Smsmith 24467754Smsmith 24591116Smsmith ACPI_FUNCTION_NAME ("NsDumpOneObject"); 24682367Smsmith 24782367Smsmith 248107325Siwasaki /* Is output enabled? */ 24967754Smsmith 25067754Smsmith if (!(AcpiDbgLevel & Info->DebugLevel)) 25167754Smsmith { 25267754Smsmith return (AE_OK); 25367754Smsmith } 25467754Smsmith 25567754Smsmith if (!ObjHandle) 25667754Smsmith { 25782367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n")); 25867754Smsmith return (AE_OK); 25967754Smsmith } 26067754Smsmith 261107325Siwasaki ThisNode = AcpiNsMapHandleToNode (ObjHandle); 262107325Siwasaki Type = ThisNode->Type; 263107325Siwasaki 26467754Smsmith /* Check if the owner matches */ 26567754Smsmith 26667754Smsmith if ((Info->OwnerId != ACPI_UINT32_MAX) && 26767754Smsmith (Info->OwnerId != ThisNode->OwnerId)) 26867754Smsmith { 26967754Smsmith return (AE_OK); 27067754Smsmith } 27167754Smsmith 27267754Smsmith /* Indent the object according to the level */ 27367754Smsmith 274107325Siwasaki AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " "); 27567754Smsmith 276107325Siwasaki /* Check the node type and name */ 27767754Smsmith 278107325Siwasaki if (Type > ACPI_TYPE_LOCAL_MAX) 27967754Smsmith { 280107325Siwasaki ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type)); 28167754Smsmith } 28267754Smsmith 28399146Siwasaki if (!AcpiUtValidAcpiName (ThisNode->Name.Integer)) 28467754Smsmith { 285138287Smarks ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", 286138287Smarks ThisNode->Name.Integer)); 28767754Smsmith } 28867754Smsmith 28967754Smsmith /* 29067754Smsmith * Now we can print out the pertinent information 29167754Smsmith */ 292107325Siwasaki AcpiOsPrintf ("%4.4s %-12s %p ", 293123315Snjl AcpiUtGetNodeName (ThisNode), AcpiUtGetTypeName (Type), ThisNode); 29467754Smsmith 29591116Smsmith DbgLevel = AcpiDbgLevel; 29691116Smsmith AcpiDbgLevel = 0; 29787031Smsmith ObjDesc = AcpiNsGetAttachedObject (ThisNode); 29891116Smsmith AcpiDbgLevel = DbgLevel; 29967754Smsmith 30085756Smsmith switch (Info->DisplayType) 30167754Smsmith { 30285756Smsmith case ACPI_DISPLAY_SUMMARY: 30367754Smsmith 30485756Smsmith if (!ObjDesc) 30585756Smsmith { 30685756Smsmith /* No attached object, we are done */ 30767754Smsmith 30887031Smsmith AcpiOsPrintf ("\n"); 30985756Smsmith return (AE_OK); 31085756Smsmith } 31167754Smsmith 31285756Smsmith switch (Type) 31385756Smsmith { 31485756Smsmith case ACPI_TYPE_PROCESSOR: 315102550Siwasaki 316107325Siwasaki AcpiOsPrintf ("ID %X Len %.4X Addr %p\n", 317138287Smarks ObjDesc->Processor.ProcId, ObjDesc->Processor.Length, 318138287Smarks (char *) ObjDesc->Processor.Address); 31985756Smsmith break; 32067754Smsmith 32199146Siwasaki 32285756Smsmith case ACPI_TYPE_DEVICE: 323102550Siwasaki 324123315Snjl AcpiOsPrintf ("Notify Object: %p\n", ObjDesc); 32585756Smsmith break; 32667754Smsmith 32799146Siwasaki 32885756Smsmith case ACPI_TYPE_METHOD: 329102550Siwasaki 330107325Siwasaki AcpiOsPrintf ("Args %X Len %.4X Aml %p\n", 331138287Smarks (UINT32) ObjDesc->Method.ParamCount, 332138287Smarks ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart); 33385756Smsmith break; 33467754Smsmith 33599146Siwasaki 33685756Smsmith case ACPI_TYPE_INTEGER: 337102550Siwasaki 338107325Siwasaki AcpiOsPrintf ("= %8.8X%8.8X\n", 339138287Smarks ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 34085756Smsmith break; 34167754Smsmith 34299146Siwasaki 34385756Smsmith case ACPI_TYPE_PACKAGE: 34499146Siwasaki 34599146Siwasaki if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 34699146Siwasaki { 347107325Siwasaki AcpiOsPrintf ("Elements %.2X\n", 348138287Smarks ObjDesc->Package.Count); 34999146Siwasaki } 35099146Siwasaki else 35199146Siwasaki { 352107325Siwasaki AcpiOsPrintf ("[Length not yet evaluated]\n"); 35399146Siwasaki } 35485756Smsmith break; 35567754Smsmith 35699146Siwasaki 35785756Smsmith case ACPI_TYPE_BUFFER: 35867754Smsmith 35999146Siwasaki if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID) 36099146Siwasaki { 361107325Siwasaki AcpiOsPrintf ("Len %.2X", 36299146Siwasaki ObjDesc->Buffer.Length); 36367754Smsmith 36499146Siwasaki /* Dump some of the buffer */ 36599146Siwasaki 36699146Siwasaki if (ObjDesc->Buffer.Length > 0) 36785756Smsmith { 36899146Siwasaki AcpiOsPrintf (" ="); 36999146Siwasaki for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++) 37099146Siwasaki { 37199679Siwasaki AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]); 37299146Siwasaki } 37385756Smsmith } 37499146Siwasaki AcpiOsPrintf ("\n"); 37585756Smsmith } 37699146Siwasaki else 37799146Siwasaki { 378107325Siwasaki AcpiOsPrintf ("[Length not yet evaluated]\n"); 37999146Siwasaki } 38085756Smsmith break; 38167754Smsmith 38299146Siwasaki 38385756Smsmith case ACPI_TYPE_STRING: 384102550Siwasaki 385107325Siwasaki AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length); 386107325Siwasaki AcpiUtPrintString (ObjDesc->String.Pointer, 32); 38787031Smsmith AcpiOsPrintf ("\n"); 38885756Smsmith break; 38967754Smsmith 39099146Siwasaki 39185756Smsmith case ACPI_TYPE_REGION: 392102550Siwasaki 393138287Smarks AcpiOsPrintf ("[%s]", 394138287Smarks AcpiUtGetRegionName (ObjDesc->Region.SpaceId)); 39585756Smsmith if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID) 39685756Smsmith { 39787031Smsmith AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n", 398138287Smarks ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), 399138287Smarks ObjDesc->Region.Length); 40085756Smsmith } 40185756Smsmith else 40285756Smsmith { 40399146Siwasaki AcpiOsPrintf (" [Address/Length not yet evaluated]\n"); 40485756Smsmith } 40585756Smsmith break; 40667754Smsmith 40799146Siwasaki 408107325Siwasaki case ACPI_TYPE_LOCAL_REFERENCE: 409102550Siwasaki 410107325Siwasaki AcpiOsPrintf ("[%s]\n", 411138287Smarks AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode)); 41285756Smsmith break; 41367754Smsmith 41499146Siwasaki 41585756Smsmith case ACPI_TYPE_BUFFER_FIELD: 416102550Siwasaki 41787031Smsmith if (ObjDesc->BufferField.BufferObj && 41887031Smsmith ObjDesc->BufferField.BufferObj->Buffer.Node) 41987031Smsmith { 420107325Siwasaki AcpiOsPrintf ("Buf [%4.4s]", 421138287Smarks AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node)); 42287031Smsmith } 42385756Smsmith break; 42485756Smsmith 42599146Siwasaki 426107325Siwasaki case ACPI_TYPE_LOCAL_REGION_FIELD: 427102550Siwasaki 428107325Siwasaki AcpiOsPrintf ("Rgn [%4.4s]", 429138287Smarks AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node)); 43085756Smsmith break; 43185756Smsmith 43299146Siwasaki 433107325Siwasaki case ACPI_TYPE_LOCAL_BANK_FIELD: 434102550Siwasaki 435107325Siwasaki AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]", 436138287Smarks AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node), 437138287Smarks AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node)); 43885756Smsmith break; 43985756Smsmith 44099146Siwasaki 441107325Siwasaki case ACPI_TYPE_LOCAL_INDEX_FIELD: 442102550Siwasaki 443107325Siwasaki AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]", 444138287Smarks AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node), 445138287Smarks AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node)); 44685756Smsmith break; 44785756Smsmith 44899146Siwasaki 449107325Siwasaki case ACPI_TYPE_LOCAL_ALIAS: 450128212Snjl case ACPI_TYPE_LOCAL_METHOD_ALIAS: 451104470Siwasaki 452138287Smarks AcpiOsPrintf ("Target %4.4s (%p)\n", 453138287Smarks AcpiUtGetNodeName (ObjDesc), ObjDesc); 454104470Siwasaki break; 455104470Siwasaki 45685756Smsmith default: 457102550Siwasaki 458107325Siwasaki AcpiOsPrintf ("Object %p\n", ObjDesc); 45985756Smsmith break; 46085756Smsmith } 46185756Smsmith 46285756Smsmith /* Common field handling */ 46385756Smsmith 46485756Smsmith switch (Type) 46585756Smsmith { 46685756Smsmith case ACPI_TYPE_BUFFER_FIELD: 467107325Siwasaki case ACPI_TYPE_LOCAL_REGION_FIELD: 468107325Siwasaki case ACPI_TYPE_LOCAL_BANK_FIELD: 469107325Siwasaki case ACPI_TYPE_LOCAL_INDEX_FIELD: 470107325Siwasaki 471123315Snjl AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n", 472138287Smarks (ObjDesc->CommonField.BaseByteOffset * 8) 473138287Smarks + ObjDesc->CommonField.StartFieldBitOffset, 474138287Smarks ObjDesc->CommonField.BitLength, 475138287Smarks ObjDesc->CommonField.AccessByteWidth); 47685756Smsmith break; 477102550Siwasaki 47899679Siwasaki default: 47999679Siwasaki break; 48085756Smsmith } 48167754Smsmith break; 48267754Smsmith 48367754Smsmith 48485756Smsmith case ACPI_DISPLAY_OBJECTS: 48567754Smsmith 486107325Siwasaki AcpiOsPrintf ("O:%p", ObjDesc); 48785756Smsmith if (!ObjDesc) 48885756Smsmith { 48985756Smsmith /* No attached object, we are done */ 49085756Smsmith 49187031Smsmith AcpiOsPrintf ("\n"); 49285756Smsmith return (AE_OK); 49385756Smsmith } 49485756Smsmith 49587031Smsmith AcpiOsPrintf ("(R%d)", 49687031Smsmith ObjDesc->Common.ReferenceCount); 49785756Smsmith 49885756Smsmith switch (Type) 49985756Smsmith { 50085756Smsmith case ACPI_TYPE_METHOD: 50185756Smsmith 50285756Smsmith /* Name is a Method and its AML offset/length are set */ 50385756Smsmith 50487031Smsmith AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart, 50587031Smsmith ObjDesc->Method.AmlLength); 50685756Smsmith break; 50785756Smsmith 50885756Smsmith case ACPI_TYPE_INTEGER: 50985756Smsmith 510123315Snjl AcpiOsPrintf (" I:%8.8X8.8%X\n", 511123315Snjl ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 51285756Smsmith break; 51385756Smsmith 51485756Smsmith case ACPI_TYPE_STRING: 51585756Smsmith 51687031Smsmith AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer, 51787031Smsmith ObjDesc->String.Length); 51885756Smsmith break; 51985756Smsmith 52085756Smsmith case ACPI_TYPE_BUFFER: 52185756Smsmith 52287031Smsmith AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer, 52387031Smsmith ObjDesc->Buffer.Length); 52485756Smsmith break; 52585756Smsmith 52685756Smsmith default: 52785756Smsmith 52887031Smsmith AcpiOsPrintf ("\n"); 52985756Smsmith break; 53085756Smsmith } 53167754Smsmith break; 53287031Smsmith 53387031Smsmith 53487031Smsmith default: 53587031Smsmith AcpiOsPrintf ("\n"); 53687031Smsmith break; 53767754Smsmith } 53867754Smsmith 53967754Smsmith /* If debug turned off, done */ 54067754Smsmith 54182367Smsmith if (!(AcpiDbgLevel & ACPI_LV_VALUES)) 54267754Smsmith { 54367754Smsmith return (AE_OK); 54467754Smsmith } 54567754Smsmith 54667754Smsmith 54767754Smsmith /* If there is an attached object, display it */ 54867754Smsmith 549104470Siwasaki DbgLevel = AcpiDbgLevel; 55091116Smsmith AcpiDbgLevel = 0; 551104470Siwasaki ObjDesc = AcpiNsGetAttachedObject (ThisNode); 55291116Smsmith AcpiDbgLevel = DbgLevel; 55367754Smsmith 55467754Smsmith /* Dump attached objects */ 55567754Smsmith 55685756Smsmith while (ObjDesc) 55767754Smsmith { 558107325Siwasaki ObjType = ACPI_TYPE_INVALID; 55991116Smsmith AcpiOsPrintf (" Attached Object %p: ", ObjDesc); 56067754Smsmith 56167754Smsmith /* Decode the type of attached object and dump the contents */ 56267754Smsmith 56391116Smsmith switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)) 56491116Smsmith { 56591116Smsmith case ACPI_DESC_TYPE_NAMED: 56667754Smsmith 56787031Smsmith AcpiOsPrintf ("(Ptr to Node)\n"); 56867754Smsmith BytesToDump = sizeof (ACPI_NAMESPACE_NODE); 56991116Smsmith break; 57067754Smsmith 57191116Smsmith 57299679Siwasaki case ACPI_DESC_TYPE_OPERAND: 57391116Smsmith 57499679Siwasaki ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc); 57567754Smsmith 576107325Siwasaki if (ObjType > ACPI_TYPE_LOCAL_MAX) 57767754Smsmith { 578138287Smarks AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", 579138287Smarks ObjType); 58067754Smsmith BytesToDump = 32; 58167754Smsmith } 58267754Smsmith else 58367754Smsmith { 58499679Siwasaki AcpiOsPrintf ("(Ptr to ACPI Object type %s, %X)\n", 585138287Smarks AcpiUtGetTypeName (ObjType), ObjType); 58667754Smsmith BytesToDump = sizeof (ACPI_OPERAND_OBJECT); 58767754Smsmith } 58891116Smsmith break; 58991116Smsmith 59091116Smsmith 59191116Smsmith default: 59291116Smsmith 593138287Smarks AcpiOsPrintf ( 594138287Smarks "(String or Buffer ptr - not an object descriptor) [%s]\n", 595138287Smarks AcpiUtGetDescriptorName (ObjDesc)); 59667754Smsmith BytesToDump = 16; 59791116Smsmith break; 59867754Smsmith } 59967754Smsmith 60091116Smsmith ACPI_DUMP_BUFFER (ObjDesc, BytesToDump); 60167754Smsmith 60267754Smsmith /* If value is NOT an internal object, we are done */ 60367754Smsmith 60499679Siwasaki if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) 60567754Smsmith { 60667754Smsmith goto Cleanup; 60767754Smsmith } 60867754Smsmith 60967754Smsmith /* 61067754Smsmith * Valid object, get the pointer to next level, if any 61167754Smsmith */ 61267754Smsmith switch (ObjType) 61367754Smsmith { 61467754Smsmith case ACPI_TYPE_STRING: 61599679Siwasaki ObjDesc = (void *) ObjDesc->String.Pointer; 61667754Smsmith break; 61767754Smsmith 61867754Smsmith case ACPI_TYPE_BUFFER: 61999679Siwasaki ObjDesc = (void *) ObjDesc->Buffer.Pointer; 62067754Smsmith break; 62167754Smsmith 62277424Smsmith case ACPI_TYPE_BUFFER_FIELD: 62385756Smsmith ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj; 62477424Smsmith break; 62577424Smsmith 62667754Smsmith case ACPI_TYPE_PACKAGE: 62799679Siwasaki ObjDesc = (void *) ObjDesc->Package.Elements; 62867754Smsmith break; 62967754Smsmith 63067754Smsmith case ACPI_TYPE_METHOD: 63199679Siwasaki ObjDesc = (void *) ObjDesc->Method.AmlStart; 63267754Smsmith break; 63367754Smsmith 634107325Siwasaki case ACPI_TYPE_LOCAL_REGION_FIELD: 63599679Siwasaki ObjDesc = (void *) ObjDesc->Field.RegionObj; 63667754Smsmith break; 63767754Smsmith 638107325Siwasaki case ACPI_TYPE_LOCAL_BANK_FIELD: 63999679Siwasaki ObjDesc = (void *) ObjDesc->BankField.RegionObj; 64067754Smsmith break; 64167754Smsmith 642107325Siwasaki case ACPI_TYPE_LOCAL_INDEX_FIELD: 64399679Siwasaki ObjDesc = (void *) ObjDesc->IndexField.IndexObj; 64467754Smsmith break; 64567754Smsmith 64699679Siwasaki default: 64767754Smsmith goto Cleanup; 64867754Smsmith } 64967754Smsmith 650107325Siwasaki ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ 65167754Smsmith } 65267754Smsmith 65367754SmsmithCleanup: 65487031Smsmith AcpiOsPrintf ("\n"); 65567754Smsmith return (AE_OK); 65667754Smsmith} 65767754Smsmith 65867754Smsmith 65977424Smsmith/******************************************************************************* 66067754Smsmith * 66167754Smsmith * FUNCTION: AcpiNsDumpObjects 66267754Smsmith * 66367754Smsmith * PARAMETERS: Type - Object type to be dumped 664138287Smarks * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX 66567754Smsmith * for an effectively unlimited depth. 66667754Smsmith * OwnerId - Dump only objects owned by this ID. Use 66767754Smsmith * ACPI_UINT32_MAX to match all owners. 66867754Smsmith * StartHandle - Where in namespace to start/end search 66967754Smsmith * 67067754Smsmith * DESCRIPTION: Dump typed objects within the loaded namespace. 67167754Smsmith * Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject. 67267754Smsmith * 67377424Smsmith ******************************************************************************/ 67467754Smsmith 67567754Smsmithvoid 67667754SmsmithAcpiNsDumpObjects ( 67791116Smsmith ACPI_OBJECT_TYPE Type, 67885756Smsmith UINT8 DisplayType, 67967754Smsmith UINT32 MaxDepth, 68067754Smsmith UINT32 OwnerId, 68167754Smsmith ACPI_HANDLE StartHandle) 68267754Smsmith{ 68367754Smsmith ACPI_WALK_INFO Info; 68467754Smsmith 68567754Smsmith 68691116Smsmith ACPI_FUNCTION_ENTRY (); 68783174Smsmith 68883174Smsmith 68982367Smsmith Info.DebugLevel = ACPI_LV_TABLES; 69067754Smsmith Info.OwnerId = OwnerId; 69185756Smsmith Info.DisplayType = DisplayType; 69267754Smsmith 693102550Siwasaki (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, 69499679Siwasaki ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject, 69599679Siwasaki (void *) &Info, NULL); 69667754Smsmith} 69767754Smsmith 69867754Smsmith 69977424Smsmith/******************************************************************************* 70067754Smsmith * 70167754Smsmith * FUNCTION: AcpiNsDumpTables 70267754Smsmith * 70367754Smsmith * PARAMETERS: SearchBase - Root of subtree to be dumped, or 70467754Smsmith * NS_ALL to dump the entire namespace 70567754Smsmith * MaxDepth - Maximum depth of dump. Use INT_MAX 70667754Smsmith * for an effectively unlimited depth. 70767754Smsmith * 70867754Smsmith * DESCRIPTION: Dump the name space, or a portion of it. 70967754Smsmith * 71077424Smsmith ******************************************************************************/ 71167754Smsmith 71267754Smsmithvoid 71367754SmsmithAcpiNsDumpTables ( 71467754Smsmith ACPI_HANDLE SearchBase, 71567754Smsmith UINT32 MaxDepth) 71667754Smsmith{ 71767754Smsmith ACPI_HANDLE SearchHandle = SearchBase; 71867754Smsmith 71967754Smsmith 72091116Smsmith ACPI_FUNCTION_TRACE ("NsDumpTables"); 72167754Smsmith 72267754Smsmith 72367754Smsmith if (!AcpiGbl_RootNode) 72467754Smsmith { 72567754Smsmith /* 72667754Smsmith * If the name space has not been initialized, 72767754Smsmith * there is nothing to dump. 72867754Smsmith */ 729104470Siwasaki ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n")); 73067754Smsmith return_VOID; 73167754Smsmith } 73267754Smsmith 73391116Smsmith if (ACPI_NS_ALL == SearchBase) 73467754Smsmith { 73567754Smsmith /* entire namespace */ 73667754Smsmith 73767754Smsmith SearchHandle = AcpiGbl_RootNode; 73882367Smsmith ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n")); 73967754Smsmith } 74067754Smsmith 74187031Smsmith AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth, 74285756Smsmith ACPI_UINT32_MAX, SearchHandle); 74367754Smsmith return_VOID; 74467754Smsmith} 74567754Smsmith 74667754Smsmith 74777424Smsmith/******************************************************************************* 74867754Smsmith * 74967754Smsmith * FUNCTION: AcpiNsDumpEntry 75067754Smsmith * 75167754Smsmith * PARAMETERS: Handle - Node to be dumped 75267754Smsmith * DebugLevel - Output level 75367754Smsmith * 75467754Smsmith * DESCRIPTION: Dump a single Node 75567754Smsmith * 75677424Smsmith ******************************************************************************/ 75767754Smsmith 75867754Smsmithvoid 75967754SmsmithAcpiNsDumpEntry ( 76067754Smsmith ACPI_HANDLE Handle, 76167754Smsmith UINT32 DebugLevel) 76267754Smsmith{ 76367754Smsmith ACPI_WALK_INFO Info; 76467754Smsmith 76567754Smsmith 76691116Smsmith ACPI_FUNCTION_ENTRY (); 76767754Smsmith 76883174Smsmith 76967754Smsmith Info.DebugLevel = DebugLevel; 77067754Smsmith Info.OwnerId = ACPI_UINT32_MAX; 77187031Smsmith Info.DisplayType = ACPI_DISPLAY_SUMMARY; 77267754Smsmith 77399679Siwasaki (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL); 77467754Smsmith} 77567754Smsmith 77667754Smsmith#endif 77767754Smsmith 778