xref: /onnv-gate/usr/src/uts/intel/io/acpica/namespace/nsdump.c (revision 11225:eb6056029d84)
13446Smrj /******************************************************************************
23446Smrj  *
33446Smrj  * Module Name: nsdump - table dumping routines for debug
43446Smrj  *
53446Smrj  *****************************************************************************/
63446Smrj 
73446Smrj /******************************************************************************
83446Smrj  *
93446Smrj  * 1. Copyright Notice
103446Smrj  *
119980SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
123446Smrj  * All rights reserved.
133446Smrj  *
143446Smrj  * 2. License
153446Smrj  *
163446Smrj  * 2.1. This is your license from Intel Corp. under its intellectual property
173446Smrj  * rights.  You may have additional license terms from the party that provided
183446Smrj  * you this software, covering your right to use that party's intellectual
193446Smrj  * property rights.
203446Smrj  *
213446Smrj  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
223446Smrj  * copy of the source code appearing in this file ("Covered Code") an
233446Smrj  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
243446Smrj  * base code distributed originally by Intel ("Original Intel Code") to copy,
253446Smrj 
263446Smrj  * make derivatives, distribute, use and display any portion of the Covered
273446Smrj  * Code in any form, with the right to sublicense such rights; and
283446Smrj  *
293446Smrj  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
303446Smrj  * license (with the right to sublicense), under only those claims of Intel
313446Smrj  * patents that are infringed by the Original Intel Code, to make, use, sell,
323446Smrj  * offer to sell, and import the Covered Code and derivative works thereof
333446Smrj  * solely to the minimum extent necessary to exercise the above copyright
343446Smrj  * license, and in no event shall the patent license extend to any additions
353446Smrj  * to or modifications of the Original Intel Code.  No other license or right
363446Smrj  * is granted directly or by implication, estoppel or otherwise;
373446Smrj  *
383446Smrj  * The above copyright and patent license is granted only if the following
393446Smrj  * conditions are met:
403446Smrj  *
413446Smrj  * 3. Conditions
423446Smrj  *
433446Smrj  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
443446Smrj  * Redistribution of source code of any substantial portion of the Covered
453446Smrj  * Code or modification with rights to further distribute source must include
463446Smrj  * the above Copyright Notice, the above License, this list of Conditions,
473446Smrj  * and the following Disclaimer and Export Compliance provision.  In addition,
483446Smrj  * Licensee must cause all Covered Code to which Licensee contributes to
493446Smrj  * contain a file documenting the changes Licensee made to create that Covered
503446Smrj  * Code and the date of any change.  Licensee must include in that file the
513446Smrj  * documentation of any changes made by any predecessor Licensee.  Licensee
523446Smrj  * must include a prominent statement that the modification is derived,
533446Smrj  * directly or indirectly, from Original Intel Code.
543446Smrj  *
553446Smrj  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
563446Smrj  * Redistribution of source code of any substantial portion of the Covered
573446Smrj  * Code or modification without rights to further distribute source must
583446Smrj  * include the following Disclaimer and Export Compliance provision in the
593446Smrj  * documentation and/or other materials provided with distribution.  In
603446Smrj  * addition, Licensee may not authorize further sublicense of source of any
613446Smrj  * portion of the Covered Code, and must include terms to the effect that the
623446Smrj  * license from Licensee to its licensee is limited to the intellectual
633446Smrj  * property embodied in the software Licensee provides to its licensee, and
643446Smrj  * not to intellectual property embodied in modifications its licensee may
653446Smrj  * make.
663446Smrj  *
673446Smrj  * 3.3. Redistribution of Executable. Redistribution in executable form of any
683446Smrj  * substantial portion of the Covered Code or modification must reproduce the
693446Smrj  * above Copyright Notice, and the following Disclaimer and Export Compliance
703446Smrj  * provision in the documentation and/or other materials provided with the
713446Smrj  * distribution.
723446Smrj  *
733446Smrj  * 3.4. Intel retains all right, title, and interest in and to the Original
743446Smrj  * Intel Code.
753446Smrj  *
763446Smrj  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
773446Smrj  * Intel shall be used in advertising or otherwise to promote the sale, use or
783446Smrj  * other dealings in products derived from or relating to the Covered Code
793446Smrj  * without prior written authorization from Intel.
803446Smrj  *
813446Smrj  * 4. Disclaimer and Export Compliance
823446Smrj  *
833446Smrj  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
843446Smrj  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
853446Smrj  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
863446Smrj  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
873446Smrj  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
883446Smrj  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
893446Smrj  * PARTICULAR PURPOSE.
903446Smrj  *
913446Smrj  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
923446Smrj  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
933446Smrj  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
943446Smrj  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
953446Smrj  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
963446Smrj  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
973446Smrj  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
983446Smrj  * LIMITED REMEDY.
993446Smrj  *
1003446Smrj  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1013446Smrj  * software or system incorporating such software without first obtaining any
1023446Smrj  * required license or other approval from the U. S. Department of Commerce or
1033446Smrj  * any other agency or department of the United States Government.  In the
1043446Smrj  * event Licensee exports any such software from the United States or
1053446Smrj  * re-exports any such software from a foreign destination, Licensee shall
1063446Smrj  * ensure that the distribution and export/re-export of the software is in
1073446Smrj  * compliance with all laws, regulations, orders, or other restrictions of the
1083446Smrj  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1093446Smrj  * any of its subsidiaries will export/re-export any technical data, process,
1103446Smrj  * software, or service, directly or indirectly, to any country for which the
1113446Smrj  * United States government or any agency thereof requires an export license,
1123446Smrj  * other governmental approval, or letter of assurance, without first obtaining
1133446Smrj  * such license, approval or letter.
1143446Smrj  *
1153446Smrj  *****************************************************************************/
1163446Smrj 
1173446Smrj #define __NSDUMP_C__
1183446Smrj 
1193446Smrj #include "acpi.h"
1209980SDana.Myers@Sun.COM #include "accommon.h"
1213446Smrj #include "acnamesp.h"
1223446Smrj 
1233446Smrj 
1243446Smrj #define _COMPONENT          ACPI_NAMESPACE
1253446Smrj         ACPI_MODULE_NAME    ("nsdump")
1263446Smrj 
1273446Smrj /* Local prototypes */
1283446Smrj 
1293446Smrj #ifdef ACPI_OBSOLETE_FUNCTIONS
1303446Smrj void
1313446Smrj AcpiNsDumpRootDevices (
1323446Smrj     void);
1333446Smrj 
1343446Smrj static ACPI_STATUS
1353446Smrj AcpiNsDumpOneDevice (
1363446Smrj     ACPI_HANDLE             ObjHandle,
1373446Smrj     UINT32                  Level,
1383446Smrj     void                    *Context,
1393446Smrj     void                    **ReturnValue);
1403446Smrj #endif
1413446Smrj 
1423446Smrj 
1433446Smrj #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
1443446Smrj /*******************************************************************************
1453446Smrj  *
1463446Smrj  * FUNCTION:    AcpiNsPrintPathname
1473446Smrj  *
1483446Smrj  * PARAMETERS:  NumSegments         - Number of ACPI name segments
1493446Smrj  *              Pathname            - The compressed (internal) path
1503446Smrj  *
1513446Smrj  * RETURN:      None
1523446Smrj  *
1533446Smrj  * DESCRIPTION: Print an object's full namespace pathname
1543446Smrj  *
1553446Smrj  ******************************************************************************/
1563446Smrj 
1573446Smrj void
AcpiNsPrintPathname(UINT32 NumSegments,char * Pathname)1583446Smrj AcpiNsPrintPathname (
1593446Smrj     UINT32                  NumSegments,
1603446Smrj     char                    *Pathname)
1613446Smrj {
1627851SDana.Myers@Sun.COM     UINT32                  i;
1633446Smrj 
1643446Smrj 
1653446Smrj     ACPI_FUNCTION_NAME (NsPrintPathname);
1663446Smrj 
1673446Smrj 
1683446Smrj     if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
1693446Smrj     {
1703446Smrj         return;
1713446Smrj     }
1723446Smrj 
1733446Smrj     /* Print the entire name */
1743446Smrj 
1753446Smrj     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
1763446Smrj 
1773446Smrj     while (NumSegments)
1783446Smrj     {
1793446Smrj         for (i = 0; i < 4; i++)
1803446Smrj         {
1813446Smrj             ACPI_IS_PRINT (Pathname[i]) ?
1823446Smrj                 AcpiOsPrintf ("%c", Pathname[i]) :
1833446Smrj                 AcpiOsPrintf ("?");
1843446Smrj         }
1853446Smrj 
1863446Smrj         Pathname += ACPI_NAME_SIZE;
1873446Smrj         NumSegments--;
1883446Smrj         if (NumSegments)
1893446Smrj         {
1903446Smrj             AcpiOsPrintf (".");
1913446Smrj         }
1923446Smrj     }
1933446Smrj 
1943446Smrj     AcpiOsPrintf ("]\n");
1953446Smrj }
1963446Smrj 
1973446Smrj 
1983446Smrj /*******************************************************************************
1993446Smrj  *
2003446Smrj  * FUNCTION:    AcpiNsDumpPathname
2013446Smrj  *
2023446Smrj  * PARAMETERS:  Handle              - Object
2033446Smrj  *              Msg                 - Prefix message
2043446Smrj  *              Level               - Desired debug level
2053446Smrj  *              Component           - Caller's component ID
2063446Smrj  *
2073446Smrj  * RETURN:      None
2083446Smrj  *
2093446Smrj  * DESCRIPTION: Print an object's full namespace pathname
2103446Smrj  *              Manages allocation/freeing of a pathname buffer
2113446Smrj  *
2123446Smrj  ******************************************************************************/
2133446Smrj 
2143446Smrj void
AcpiNsDumpPathname(ACPI_HANDLE Handle,char * Msg,UINT32 Level,UINT32 Component)2153446Smrj AcpiNsDumpPathname (
2163446Smrj     ACPI_HANDLE             Handle,
2173446Smrj     char                    *Msg,
2183446Smrj     UINT32                  Level,
2193446Smrj     UINT32                  Component)
2203446Smrj {
2213446Smrj 
2223446Smrj     ACPI_FUNCTION_TRACE (NsDumpPathname);
2233446Smrj 
2243446Smrj 
2253446Smrj     /* Do this only if the requested debug level and component are enabled */
2263446Smrj 
2273446Smrj     if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
2283446Smrj     {
2293446Smrj         return_VOID;
2303446Smrj     }
2313446Smrj 
2323446Smrj     /* Convert handle to a full pathname and print it (with supplied message) */
2333446Smrj 
2343446Smrj     AcpiNsPrintNodePathname (Handle, Msg);
2353446Smrj     AcpiOsPrintf ("\n");
2363446Smrj     return_VOID;
2373446Smrj }
2383446Smrj 
2393446Smrj 
2403446Smrj /*******************************************************************************
2413446Smrj  *
2423446Smrj  * FUNCTION:    AcpiNsDumpOneObject
2433446Smrj  *
2443446Smrj  * PARAMETERS:  ObjHandle           - Node to be dumped
2453446Smrj  *              Level               - Nesting level of the handle
2463446Smrj  *              Context             - Passed into WalkNamespace
2473446Smrj  *              ReturnValue         - Not used
2483446Smrj  *
2493446Smrj  * RETURN:      Status
2503446Smrj  *
2513446Smrj  * DESCRIPTION: Dump a single Node
2523446Smrj  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
2533446Smrj  *
2543446Smrj  ******************************************************************************/
2553446Smrj 
2563446Smrj ACPI_STATUS
AcpiNsDumpOneObject(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)2573446Smrj AcpiNsDumpOneObject (
2583446Smrj     ACPI_HANDLE             ObjHandle,
2593446Smrj     UINT32                  Level,
2603446Smrj     void                    *Context,
2613446Smrj     void                    **ReturnValue)
2623446Smrj {
2633446Smrj     ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
2643446Smrj     ACPI_NAMESPACE_NODE     *ThisNode;
2653446Smrj     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
2663446Smrj     ACPI_OBJECT_TYPE        ObjType;
2673446Smrj     ACPI_OBJECT_TYPE        Type;
2683446Smrj     UINT32                  BytesToDump;
2693446Smrj     UINT32                  DbgLevel;
2703446Smrj     UINT32                  i;
2713446Smrj 
2723446Smrj 
2733446Smrj     ACPI_FUNCTION_NAME (NsDumpOneObject);
2743446Smrj 
2753446Smrj 
2763446Smrj     /* Is output enabled? */
2773446Smrj 
2783446Smrj     if (!(AcpiDbgLevel & Info->DebugLevel))
2793446Smrj     {
2803446Smrj         return (AE_OK);
2813446Smrj     }
2823446Smrj 
2833446Smrj     if (!ObjHandle)
2843446Smrj     {
2853446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
2863446Smrj         return (AE_OK);
2873446Smrj     }
2883446Smrj 
2893446Smrj     ThisNode = AcpiNsMapHandleToNode (ObjHandle);
2909980SDana.Myers@Sun.COM     if (!ThisNode)
2919980SDana.Myers@Sun.COM     {
2929980SDana.Myers@Sun.COM         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
2939980SDana.Myers@Sun.COM             ObjHandle));
2949980SDana.Myers@Sun.COM         return (AE_OK);
2959980SDana.Myers@Sun.COM     }
2969980SDana.Myers@Sun.COM 
2973446Smrj     Type = ThisNode->Type;
2983446Smrj 
2993446Smrj     /* Check if the owner matches */
3003446Smrj 
3013446Smrj     if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
3023446Smrj         (Info->OwnerId != ThisNode->OwnerId))
3033446Smrj     {
3043446Smrj         return (AE_OK);
3053446Smrj     }
3063446Smrj 
3073446Smrj     if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
3083446Smrj     {
3093446Smrj         /* Indent the object according to the level */
3103446Smrj 
3113446Smrj         AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
3123446Smrj 
3133446Smrj         /* Check the node type and name */
3143446Smrj 
3153446Smrj         if (Type > ACPI_TYPE_LOCAL_MAX)
3163446Smrj         {
3173446Smrj             ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type));
3183446Smrj         }
3193446Smrj 
3203446Smrj         AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
3213446Smrj     }
3223446Smrj 
3239980SDana.Myers@Sun.COM     /* Now we can print out the pertinent information */
3249980SDana.Myers@Sun.COM 
3253446Smrj     AcpiOsPrintf (" %-12s %p %2.2X ",
3263446Smrj             AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
3273446Smrj 
3283446Smrj     DbgLevel = AcpiDbgLevel;
3293446Smrj     AcpiDbgLevel = 0;
3303446Smrj     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
3313446Smrj     AcpiDbgLevel = DbgLevel;
3323446Smrj 
3337851SDana.Myers@Sun.COM     /* Temp nodes are those nodes created by a control method */
3347851SDana.Myers@Sun.COM 
3357851SDana.Myers@Sun.COM     if (ThisNode->Flags & ANOBJ_TEMPORARY)
3367851SDana.Myers@Sun.COM     {
3377851SDana.Myers@Sun.COM         AcpiOsPrintf ("(T) ");
3387851SDana.Myers@Sun.COM     }
3397851SDana.Myers@Sun.COM 
3403446Smrj     switch (Info->DisplayType & ACPI_DISPLAY_MASK)
3413446Smrj     {
3423446Smrj     case ACPI_DISPLAY_SUMMARY:
3433446Smrj 
3443446Smrj         if (!ObjDesc)
3453446Smrj         {
3463446Smrj             /* No attached object, we are done */
3473446Smrj 
3483446Smrj             AcpiOsPrintf ("\n");
3493446Smrj             return (AE_OK);
3503446Smrj         }
3513446Smrj 
3523446Smrj         switch (Type)
3533446Smrj         {
3543446Smrj         case ACPI_TYPE_PROCESSOR:
3553446Smrj 
3563446Smrj             AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
3573446Smrj                 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
3587851SDana.Myers@Sun.COM                 ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
3593446Smrj             break;
3603446Smrj 
3613446Smrj 
3623446Smrj         case ACPI_TYPE_DEVICE:
3633446Smrj 
3643446Smrj             AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
3653446Smrj             break;
3663446Smrj 
3673446Smrj 
3683446Smrj         case ACPI_TYPE_METHOD:
3693446Smrj 
3703446Smrj             AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
3713446Smrj                 (UINT32) ObjDesc->Method.ParamCount,
3723446Smrj                 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
3733446Smrj             break;
3743446Smrj 
3753446Smrj 
3763446Smrj         case ACPI_TYPE_INTEGER:
3773446Smrj 
3783446Smrj             AcpiOsPrintf ("= %8.8X%8.8X\n",
3793446Smrj                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
3803446Smrj             break;
3813446Smrj 
3823446Smrj 
3833446Smrj         case ACPI_TYPE_PACKAGE:
3843446Smrj 
3853446Smrj             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
3863446Smrj             {
3873446Smrj                 AcpiOsPrintf ("Elements %.2X\n",
3883446Smrj                     ObjDesc->Package.Count);
3893446Smrj             }
3903446Smrj             else
3913446Smrj             {
3923446Smrj                 AcpiOsPrintf ("[Length not yet evaluated]\n");
3933446Smrj             }
3943446Smrj             break;
3953446Smrj 
3963446Smrj 
3973446Smrj         case ACPI_TYPE_BUFFER:
3983446Smrj 
3993446Smrj             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
4003446Smrj             {
4013446Smrj                 AcpiOsPrintf ("Len %.2X",
4023446Smrj                             ObjDesc->Buffer.Length);
4033446Smrj 
4043446Smrj                 /* Dump some of the buffer */
4053446Smrj 
4063446Smrj                 if (ObjDesc->Buffer.Length > 0)
4073446Smrj                 {
4083446Smrj                     AcpiOsPrintf (" =");
4093446Smrj                     for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
4103446Smrj                     {
4113446Smrj                         AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
4123446Smrj                     }
4133446Smrj                 }
4143446Smrj                 AcpiOsPrintf ("\n");
4153446Smrj             }
4163446Smrj             else
4173446Smrj             {
4183446Smrj                 AcpiOsPrintf ("[Length not yet evaluated]\n");
4193446Smrj             }
4203446Smrj             break;
4213446Smrj 
4223446Smrj 
4233446Smrj         case ACPI_TYPE_STRING:
4243446Smrj 
4253446Smrj             AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
4263446Smrj             AcpiUtPrintString (ObjDesc->String.Pointer, 32);
4273446Smrj             AcpiOsPrintf ("\n");
4283446Smrj             break;
4293446Smrj 
4303446Smrj 
4313446Smrj         case ACPI_TYPE_REGION:
4323446Smrj 
4333446Smrj             AcpiOsPrintf ("[%s]",
4343446Smrj                 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
4353446Smrj             if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
4363446Smrj             {
4373446Smrj                 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
4387851SDana.Myers@Sun.COM                     ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
4393446Smrj                     ObjDesc->Region.Length);
4403446Smrj             }
4413446Smrj             else
4423446Smrj             {
4433446Smrj                 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
4443446Smrj             }
4453446Smrj             break;
4463446Smrj 
4473446Smrj 
4483446Smrj         case ACPI_TYPE_LOCAL_REFERENCE:
4493446Smrj 
4507851SDana.Myers@Sun.COM             AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
4513446Smrj             break;
4523446Smrj 
4533446Smrj 
4543446Smrj         case ACPI_TYPE_BUFFER_FIELD:
4553446Smrj 
4563446Smrj             if (ObjDesc->BufferField.BufferObj &&
4573446Smrj                 ObjDesc->BufferField.BufferObj->Buffer.Node)
4583446Smrj             {
4593446Smrj                 AcpiOsPrintf ("Buf [%4.4s]",
4609980SDana.Myers@Sun.COM                     AcpiUtGetNodeName (
4619980SDana.Myers@Sun.COM                         ObjDesc->BufferField.BufferObj->Buffer.Node));
4623446Smrj             }
4633446Smrj             break;
4643446Smrj 
4653446Smrj 
4663446Smrj         case ACPI_TYPE_LOCAL_REGION_FIELD:
4673446Smrj 
4683446Smrj             AcpiOsPrintf ("Rgn [%4.4s]",
4699980SDana.Myers@Sun.COM                 AcpiUtGetNodeName (
4709980SDana.Myers@Sun.COM                     ObjDesc->CommonField.RegionObj->Region.Node));
4713446Smrj             break;
4723446Smrj 
4733446Smrj 
4743446Smrj         case ACPI_TYPE_LOCAL_BANK_FIELD:
4753446Smrj 
4763446Smrj             AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
4779980SDana.Myers@Sun.COM                 AcpiUtGetNodeName (
4789980SDana.Myers@Sun.COM                     ObjDesc->CommonField.RegionObj->Region.Node),
4799980SDana.Myers@Sun.COM                 AcpiUtGetNodeName (
4809980SDana.Myers@Sun.COM                     ObjDesc->BankField.BankObj->CommonField.Node));
4813446Smrj             break;
4823446Smrj 
4833446Smrj 
4843446Smrj         case ACPI_TYPE_LOCAL_INDEX_FIELD:
4853446Smrj 
4863446Smrj             AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
4879980SDana.Myers@Sun.COM                 AcpiUtGetNodeName (
4889980SDana.Myers@Sun.COM                     ObjDesc->IndexField.IndexObj->CommonField.Node),
4899980SDana.Myers@Sun.COM                 AcpiUtGetNodeName (
4909980SDana.Myers@Sun.COM                     ObjDesc->IndexField.DataObj->CommonField.Node));
4913446Smrj             break;
4923446Smrj 
4933446Smrj 
4943446Smrj         case ACPI_TYPE_LOCAL_ALIAS:
4953446Smrj         case ACPI_TYPE_LOCAL_METHOD_ALIAS:
4963446Smrj 
4973446Smrj             AcpiOsPrintf ("Target %4.4s (%p)\n",
4983446Smrj                 AcpiUtGetNodeName (ObjDesc), ObjDesc);
4993446Smrj             break;
5003446Smrj 
5013446Smrj         default:
5023446Smrj 
5033446Smrj             AcpiOsPrintf ("Object %p\n", ObjDesc);
5043446Smrj             break;
5053446Smrj         }
5063446Smrj 
5073446Smrj         /* Common field handling */
5083446Smrj 
5093446Smrj         switch (Type)
5103446Smrj         {
5113446Smrj         case ACPI_TYPE_BUFFER_FIELD:
5123446Smrj         case ACPI_TYPE_LOCAL_REGION_FIELD:
5133446Smrj         case ACPI_TYPE_LOCAL_BANK_FIELD:
5143446Smrj         case ACPI_TYPE_LOCAL_INDEX_FIELD:
5153446Smrj 
5163446Smrj             AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
5173446Smrj                 (ObjDesc->CommonField.BaseByteOffset * 8)
5183446Smrj                     + ObjDesc->CommonField.StartFieldBitOffset,
5193446Smrj                 ObjDesc->CommonField.BitLength,
5203446Smrj                 ObjDesc->CommonField.AccessByteWidth);
5213446Smrj             break;
5223446Smrj 
5233446Smrj         default:
5243446Smrj             break;
5253446Smrj         }
5263446Smrj         break;
5273446Smrj 
5283446Smrj 
5293446Smrj     case ACPI_DISPLAY_OBJECTS:
5303446Smrj 
5313446Smrj         AcpiOsPrintf ("O:%p", ObjDesc);
5323446Smrj         if (!ObjDesc)
5333446Smrj         {
5343446Smrj             /* No attached object, we are done */
5353446Smrj 
5363446Smrj             AcpiOsPrintf ("\n");
5373446Smrj             return (AE_OK);
5383446Smrj         }
5393446Smrj 
5403446Smrj         AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount);
5413446Smrj 
5423446Smrj         switch (Type)
5433446Smrj         {
5443446Smrj         case ACPI_TYPE_METHOD:
5453446Smrj 
5463446Smrj             /* Name is a Method and its AML offset/length are set */
5473446Smrj 
5483446Smrj             AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
5499980SDana.Myers@Sun.COM                 ObjDesc->Method.AmlLength);
5503446Smrj             break;
5513446Smrj 
5523446Smrj         case ACPI_TYPE_INTEGER:
5533446Smrj 
5543446Smrj             AcpiOsPrintf (" I:%8.8X8.8%X\n",
5559980SDana.Myers@Sun.COM                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
5563446Smrj             break;
5573446Smrj 
5583446Smrj         case ACPI_TYPE_STRING:
5593446Smrj 
5603446Smrj             AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
5619980SDana.Myers@Sun.COM                 ObjDesc->String.Length);
5623446Smrj             break;
5633446Smrj 
5643446Smrj         case ACPI_TYPE_BUFFER:
5653446Smrj 
5663446Smrj             AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
5679980SDana.Myers@Sun.COM                 ObjDesc->Buffer.Length);
5683446Smrj             break;
5693446Smrj 
5703446Smrj         default:
5713446Smrj 
5723446Smrj             AcpiOsPrintf ("\n");
5733446Smrj             break;
5743446Smrj         }
5753446Smrj         break;
5763446Smrj 
5773446Smrj 
5783446Smrj     default:
5793446Smrj         AcpiOsPrintf ("\n");
5803446Smrj         break;
5813446Smrj     }
5823446Smrj 
5833446Smrj     /* If debug turned off, done */
5843446Smrj 
5853446Smrj     if (!(AcpiDbgLevel & ACPI_LV_VALUES))
5863446Smrj     {
5873446Smrj         return (AE_OK);
5883446Smrj     }
5893446Smrj 
5903446Smrj     /* If there is an attached object, display it */
5913446Smrj 
5923446Smrj     DbgLevel     = AcpiDbgLevel;
5933446Smrj     AcpiDbgLevel = 0;
5943446Smrj     ObjDesc      = AcpiNsGetAttachedObject (ThisNode);
5953446Smrj     AcpiDbgLevel = DbgLevel;
5963446Smrj 
5973446Smrj     /* Dump attached objects */
5983446Smrj 
5993446Smrj     while (ObjDesc)
6003446Smrj     {
6013446Smrj         ObjType = ACPI_TYPE_INVALID;
6023446Smrj         AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
6033446Smrj 
6043446Smrj         /* Decode the type of attached object and dump the contents */
6053446Smrj 
6063446Smrj         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
6073446Smrj         {
6083446Smrj         case ACPI_DESC_TYPE_NAMED:
6093446Smrj 
6103446Smrj             AcpiOsPrintf ("(Ptr to Node)\n");
6113446Smrj             BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
6123446Smrj             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
6133446Smrj             break;
6143446Smrj 
6153446Smrj         case ACPI_DESC_TYPE_OPERAND:
6163446Smrj 
6179980SDana.Myers@Sun.COM             ObjType = ObjDesc->Common.Type;
6183446Smrj 
6193446Smrj             if (ObjType > ACPI_TYPE_LOCAL_MAX)
6203446Smrj             {
6217851SDana.Myers@Sun.COM                 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
6223446Smrj                     ObjType);
6233446Smrj                 BytesToDump = 32;
6243446Smrj             }
6253446Smrj             else
6263446Smrj             {
6277851SDana.Myers@Sun.COM                 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n",
6283446Smrj                     ObjType, AcpiUtGetTypeName (ObjType));
6293446Smrj                 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
6303446Smrj             }
6313446Smrj 
6323446Smrj             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
6333446Smrj             break;
6343446Smrj 
6353446Smrj         default:
6363446Smrj 
6373446Smrj             break;
6383446Smrj         }
6393446Smrj 
6403446Smrj         /* If value is NOT an internal object, we are done */
6413446Smrj 
6423446Smrj         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
6433446Smrj         {
6443446Smrj             goto Cleanup;
6453446Smrj         }
6463446Smrj 
6479980SDana.Myers@Sun.COM         /* Valid object, get the pointer to next level, if any */
6489980SDana.Myers@Sun.COM 
6493446Smrj         switch (ObjType)
6503446Smrj         {
6513446Smrj         case ACPI_TYPE_BUFFER:
6523446Smrj         case ACPI_TYPE_STRING:
6533446Smrj             /*
6543446Smrj              * NOTE: takes advantage of common fields between string/buffer
6553446Smrj              */
6563446Smrj             BytesToDump = ObjDesc->String.Length;
6573446Smrj             ObjDesc = (void *) ObjDesc->String.Pointer;
6583446Smrj             AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
6593446Smrj                 ObjDesc, BytesToDump);
6603446Smrj             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
6613446Smrj             goto Cleanup;
6623446Smrj 
6633446Smrj         case ACPI_TYPE_BUFFER_FIELD:
6643446Smrj             ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
6653446Smrj             break;
6663446Smrj 
6673446Smrj         case ACPI_TYPE_PACKAGE:
6683446Smrj             ObjDesc = (void *) ObjDesc->Package.Elements;
6693446Smrj             break;
6703446Smrj 
6713446Smrj         case ACPI_TYPE_METHOD:
6723446Smrj             ObjDesc = (void *) ObjDesc->Method.AmlStart;
6733446Smrj             break;
6743446Smrj 
6753446Smrj         case ACPI_TYPE_LOCAL_REGION_FIELD:
6763446Smrj             ObjDesc = (void *) ObjDesc->Field.RegionObj;
6773446Smrj             break;
6783446Smrj 
6793446Smrj         case ACPI_TYPE_LOCAL_BANK_FIELD:
6803446Smrj             ObjDesc = (void *) ObjDesc->BankField.RegionObj;
6813446Smrj             break;
6823446Smrj 
6833446Smrj         case ACPI_TYPE_LOCAL_INDEX_FIELD:
6843446Smrj             ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
6853446Smrj             break;
6863446Smrj 
6873446Smrj         default:
6883446Smrj             goto Cleanup;
6893446Smrj         }
6903446Smrj 
6913446Smrj         ObjType = ACPI_TYPE_INVALID;   /* Terminate loop after next pass */
6923446Smrj     }
6933446Smrj 
6943446Smrj Cleanup:
6953446Smrj     AcpiOsPrintf ("\n");
6963446Smrj     return (AE_OK);
6973446Smrj }
6983446Smrj 
6993446Smrj 
7003446Smrj /*******************************************************************************
7013446Smrj  *
7023446Smrj  * FUNCTION:    AcpiNsDumpObjects
7033446Smrj  *
7043446Smrj  * PARAMETERS:  Type                - Object type to be dumped
7053446Smrj  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
7063446Smrj  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
7073446Smrj  *                                    for an effectively unlimited depth.
7089980SDana.Myers@Sun.COM  *              OwnerId             - Dump only objects owned by this ID. Use
7093446Smrj  *                                    ACPI_UINT32_MAX to match all owners.
7103446Smrj  *              StartHandle         - Where in namespace to start/end search
7113446Smrj  *
7123446Smrj  * RETURN:      None
7133446Smrj  *
7149980SDana.Myers@Sun.COM  * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
7159980SDana.Myers@Sun.COM  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
7163446Smrj  *
7173446Smrj  ******************************************************************************/
7183446Smrj 
7193446Smrj void
AcpiNsDumpObjects(ACPI_OBJECT_TYPE Type,UINT8 DisplayType,UINT32 MaxDepth,ACPI_OWNER_ID OwnerId,ACPI_HANDLE StartHandle)7203446Smrj AcpiNsDumpObjects (
7213446Smrj     ACPI_OBJECT_TYPE        Type,
7223446Smrj     UINT8                   DisplayType,
7233446Smrj     UINT32                  MaxDepth,
7243446Smrj     ACPI_OWNER_ID           OwnerId,
7253446Smrj     ACPI_HANDLE             StartHandle)
7263446Smrj {
7273446Smrj     ACPI_WALK_INFO          Info;
7283446Smrj 
7293446Smrj 
7303446Smrj     ACPI_FUNCTION_ENTRY ();
7313446Smrj 
7323446Smrj 
7333446Smrj     Info.DebugLevel = ACPI_LV_TABLES;
7343446Smrj     Info.OwnerId = OwnerId;
7353446Smrj     Info.DisplayType = DisplayType;
7363446Smrj 
7373446Smrj     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
7387851SDana.Myers@Sun.COM                 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
739*11225SDana.Myers@Sun.COM                 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
7403446Smrj }
7413446Smrj 
7423446Smrj 
7433446Smrj /*******************************************************************************
7443446Smrj  *
7453446Smrj  * FUNCTION:    AcpiNsDumpEntry
7463446Smrj  *
7473446Smrj  * PARAMETERS:  Handle              - Node to be dumped
7483446Smrj  *              DebugLevel          - Output level
7493446Smrj  *
7503446Smrj  * RETURN:      None
7513446Smrj  *
7523446Smrj  * DESCRIPTION: Dump a single Node
7533446Smrj  *
7543446Smrj  ******************************************************************************/
7553446Smrj 
7563446Smrj void
AcpiNsDumpEntry(ACPI_HANDLE Handle,UINT32 DebugLevel)7573446Smrj AcpiNsDumpEntry (
7583446Smrj     ACPI_HANDLE             Handle,
7593446Smrj     UINT32                  DebugLevel)
7603446Smrj {
7613446Smrj     ACPI_WALK_INFO          Info;
7623446Smrj 
7633446Smrj 
7643446Smrj     ACPI_FUNCTION_ENTRY ();
7653446Smrj 
7663446Smrj 
7673446Smrj     Info.DebugLevel = DebugLevel;
7683446Smrj     Info.OwnerId = ACPI_OWNER_ID_MAX;
7693446Smrj     Info.DisplayType = ACPI_DISPLAY_SUMMARY;
7703446Smrj 
7713446Smrj     (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
7723446Smrj }
7733446Smrj 
7743446Smrj 
7753446Smrj #ifdef ACPI_ASL_COMPILER
7763446Smrj /*******************************************************************************
7773446Smrj  *
7783446Smrj  * FUNCTION:    AcpiNsDumpTables
7793446Smrj  *
7803446Smrj  * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
7813446Smrj  *                                    NS_ALL to dump the entire namespace
7823446Smrj  *              MaxDepth            - Maximum depth of dump.  Use INT_MAX
7833446Smrj  *                                    for an effectively unlimited depth.
7843446Smrj  *
7853446Smrj  * RETURN:      None
7863446Smrj  *
7873446Smrj  * DESCRIPTION: Dump the name space, or a portion of it.
7883446Smrj  *
7893446Smrj  ******************************************************************************/
7903446Smrj 
7913446Smrj void
AcpiNsDumpTables(ACPI_HANDLE SearchBase,UINT32 MaxDepth)7923446Smrj AcpiNsDumpTables (
7933446Smrj     ACPI_HANDLE             SearchBase,
7943446Smrj     UINT32                  MaxDepth)
7953446Smrj {
7963446Smrj     ACPI_HANDLE             SearchHandle = SearchBase;
7973446Smrj 
7983446Smrj 
7993446Smrj     ACPI_FUNCTION_TRACE (NsDumpTables);
8003446Smrj 
8013446Smrj 
8023446Smrj     if (!AcpiGbl_RootNode)
8033446Smrj     {
8043446Smrj         /*
8053446Smrj          * If the name space has not been initialized,
8063446Smrj          * there is nothing to dump.
8073446Smrj          */
8083446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
8093446Smrj         return_VOID;
8103446Smrj     }
8113446Smrj 
8123446Smrj     if (ACPI_NS_ALL == SearchBase)
8133446Smrj     {
8143446Smrj         /* Entire namespace */
8153446Smrj 
8163446Smrj         SearchHandle = AcpiGbl_RootNode;
8173446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
8183446Smrj     }
8193446Smrj 
8203446Smrj     AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
8213446Smrj             ACPI_OWNER_ID_MAX, SearchHandle);
8223446Smrj     return_VOID;
8233446Smrj }
8243446Smrj #endif
8253446Smrj #endif
8263446Smrj 
827