17c478bdstevel@tonic-gate/******************************************************************************
27c478bdstevel@tonic-gate *
37c478bdstevel@tonic-gate * Module Name: nsdump - table dumping routines for debug
47c478bdstevel@tonic-gate *
57c478bdstevel@tonic-gate *****************************************************************************/
67c478bdstevel@tonic-gate
735786f6Robert Mustacchi/******************************************************************************
835786f6Robert Mustacchi *
935786f6Robert Mustacchi * 1. Copyright Notice
1035786f6Robert Mustacchi *
1135786f6Robert Mustacchi * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
127c478bdstevel@tonic-gate * All rights reserved.
137c478bdstevel@tonic-gate *
1435786f6Robert Mustacchi * 2. License
1535786f6Robert Mustacchi *
1635786f6Robert Mustacchi * 2.1. This is your license from Intel Corp. under its intellectual property
1735786f6Robert Mustacchi * rights. You may have additional license terms from the party that provided
1835786f6Robert Mustacchi * you this software, covering your right to use that party's intellectual
1935786f6Robert Mustacchi * property rights.
2035786f6Robert Mustacchi *
2135786f6Robert Mustacchi * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2235786f6Robert Mustacchi * copy of the source code appearing in this file ("Covered Code") an
2335786f6Robert Mustacchi * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2435786f6Robert Mustacchi * base code distributed originally by Intel ("Original Intel Code") to copy,
2535786f6Robert Mustacchi
2635786f6Robert Mustacchi * make derivatives, distribute, use and display any portion of the Covered
2735786f6Robert Mustacchi * Code in any form, with the right to sublicense such rights; and
2835786f6Robert Mustacchi *
2935786f6Robert Mustacchi * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3035786f6Robert Mustacchi * license (with the right to sublicense), under only those claims of Intel
3135786f6Robert Mustacchi * patents that are infringed by the Original Intel Code, to make, use, sell,
3235786f6Robert Mustacchi * offer to sell, and import the Covered Code and derivative works thereof
3335786f6Robert Mustacchi * solely to the minimum extent necessary to exercise the above copyright
3435786f6Robert Mustacchi * license, and in no event shall the patent license extend to any additions
3535786f6Robert Mustacchi * to or modifications of the Original Intel Code. No other license or right
3635786f6Robert Mustacchi * is granted directly or by implication, estoppel or otherwise;
3735786f6Robert Mustacchi *
3835786f6Robert Mustacchi * The above copyright and patent license is granted only if the following
3935786f6Robert Mustacchi * conditions are met:
4035786f6Robert Mustacchi *
4135786f6Robert Mustacchi * 3. Conditions
4235786f6Robert Mustacchi *
4335786f6Robert Mustacchi * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4435786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
4535786f6Robert Mustacchi * Code or modification with rights to further distribute source must include
4635786f6Robert Mustacchi * the above Copyright Notice, the above License, this list of Conditions,
4735786f6Robert Mustacchi * and the following Disclaimer and Export Compliance provision. In addition,
4835786f6Robert Mustacchi * Licensee must cause all Covered Code to which Licensee contributes to
4935786f6Robert Mustacchi * contain a file documenting the changes Licensee made to create that Covered
5035786f6Robert Mustacchi * Code and the date of any change. Licensee must include in that file the
5135786f6Robert Mustacchi * documentation of any changes made by any predecessor Licensee. Licensee
5235786f6Robert Mustacchi * must include a prominent statement that the modification is derived,
5335786f6Robert Mustacchi * directly or indirectly, from Original Intel Code.
5435786f6Robert Mustacchi *
5535786f6Robert Mustacchi * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5635786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
5735786f6Robert Mustacchi * Code or modification without rights to further distribute source must
5835786f6Robert Mustacchi * include the following Disclaimer and Export Compliance provision in the
5935786f6Robert Mustacchi * documentation and/or other materials provided with distribution. In
6035786f6Robert Mustacchi * addition, Licensee may not authorize further sublicense of source of any
6135786f6Robert Mustacchi * portion of the Covered Code, and must include terms to the effect that the
6235786f6Robert Mustacchi * license from Licensee to its licensee is limited to the intellectual
6335786f6Robert Mustacchi * property embodied in the software Licensee provides to its licensee, and
6435786f6Robert Mustacchi * not to intellectual property embodied in modifications its licensee may
6535786f6Robert Mustacchi * make.
6635786f6Robert Mustacchi *
6735786f6Robert Mustacchi * 3.3. Redistribution of Executable. Redistribution in executable form of any
6835786f6Robert Mustacchi * substantial portion of the Covered Code or modification must reproduce the
6935786f6Robert Mustacchi * above Copyright Notice, and the following Disclaimer and Export Compliance
7035786f6Robert Mustacchi * provision in the documentation and/or other materials provided with the
7135786f6Robert Mustacchi * distribution.
7235786f6Robert Mustacchi *
7335786f6Robert Mustacchi * 3.4. Intel retains all right, title, and interest in and to the Original
7435786f6Robert Mustacchi * Intel Code.
7535786f6Robert Mustacchi *
7635786f6Robert Mustacchi * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7735786f6Robert Mustacchi * Intel shall be used in advertising or otherwise to promote the sale, use or
7835786f6Robert Mustacchi * other dealings in products derived from or relating to the Covered Code
7935786f6Robert Mustacchi * without prior written authorization from Intel.
8035786f6Robert Mustacchi *
8135786f6Robert Mustacchi * 4. Disclaimer and Export Compliance
8235786f6Robert Mustacchi *
8335786f6Robert Mustacchi * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8435786f6Robert Mustacchi * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8535786f6Robert Mustacchi * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
8635786f6Robert Mustacchi * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
8735786f6Robert Mustacchi * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
8835786f6Robert Mustacchi * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8935786f6Robert Mustacchi * PARTICULAR PURPOSE.
9035786f6Robert Mustacchi *
9135786f6Robert Mustacchi * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9235786f6Robert Mustacchi * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9335786f6Robert Mustacchi * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9435786f6Robert Mustacchi * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9535786f6Robert Mustacchi * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9635786f6Robert Mustacchi * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
9735786f6Robert Mustacchi * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9835786f6Robert Mustacchi * LIMITED REMEDY.
9935786f6Robert Mustacchi *
10035786f6Robert Mustacchi * 4.3. Licensee shall not export, either directly or indirectly, any of this
10135786f6Robert Mustacchi * software or system incorporating such software without first obtaining any
10235786f6Robert Mustacchi * required license or other approval from the U. S. Department of Commerce or
10335786f6Robert Mustacchi * any other agency or department of the United States Government. In the
10435786f6Robert Mustacchi * event Licensee exports any such software from the United States or
10535786f6Robert Mustacchi * re-exports any such software from a foreign destination, Licensee shall
10635786f6Robert Mustacchi * ensure that the distribution and export/re-export of the software is in
10735786f6Robert Mustacchi * compliance with all laws, regulations, orders, or other restrictions of the
10835786f6Robert Mustacchi * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10935786f6Robert Mustacchi * any of its subsidiaries will export/re-export any technical data, process,
11035786f6Robert Mustacchi * software, or service, directly or indirectly, to any country for which the
11135786f6Robert Mustacchi * United States government or any agency thereof requires an export license,
11235786f6Robert Mustacchi * other governmental approval, or letter of assurance, without first obtaining
11335786f6Robert Mustacchi * such license, approval or letter.
11435786f6Robert Mustacchi *
11535786f6Robert Mustacchi *****************************************************************************
11635786f6Robert Mustacchi *
11735786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
11835786f6Robert Mustacchi * following license:
11935786f6Robert Mustacchi *
12026f3cdfGordon Ross * Redistribution and use in source and binary forms, with or without
12126f3cdfGordon Ross * modification, are permitted provided that the following conditions
12226f3cdfGordon Ross * are met:
12326f3cdfGordon Ross * 1. Redistributions of source code must retain the above copyright
12426f3cdfGordon Ross *    notice, this list of conditions, and the following disclaimer,
12526f3cdfGordon Ross *    without modification.
12626f3cdfGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12726f3cdfGordon Ross *    substantially similar to the "NO WARRANTY" disclaimer below
12826f3cdfGordon Ross *    ("Disclaimer") and any redistribution must be conditioned upon
12926f3cdfGordon Ross *    including a substantially similar Disclaimer requirement for further
13026f3cdfGordon Ross *    binary redistribution.
13126f3cdfGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
13226f3cdfGordon Ross *    of any contributors may be used to endorse or promote products derived
13326f3cdfGordon Ross *    from this software without specific prior written permission.
13426f3cdfGordon Ross *
13526f3cdfGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13626f3cdfGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13735786f6Robert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13826f3cdfGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
13935786f6Robert Mustacchi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
14035786f6Robert Mustacchi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14135786f6Robert Mustacchi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14235786f6Robert Mustacchi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14335786f6Robert Mustacchi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14435786f6Robert Mustacchi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14535786f6Robert Mustacchi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14635786f6Robert Mustacchi *
14735786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
14835786f6Robert Mustacchi * GNU General Public License ("GPL") version 2 as published by the Free
14935786f6Robert Mustacchi * Software Foundation.
15035786f6Robert Mustacchi *
15135786f6Robert Mustacchi *****************************************************************************/
1527c478bdstevel@tonic-gate
1537c478bdstevel@tonic-gate#include "acpi.h"
154aa2aa9aDana Myers#include "accommon.h"
1557c478bdstevel@tonic-gate#include "acnamesp.h"
1567b1019aJerry Jelinek#include "acoutput.h"
1577c478bdstevel@tonic-gate
1587c478bdstevel@tonic-gate
1597c478bdstevel@tonic-gate#define _COMPONENT          ACPI_NAMESPACE
1607c478bdstevel@tonic-gate        ACPI_MODULE_NAME    ("nsdump")
1617c478bdstevel@tonic-gate
1627c478bdstevel@tonic-gate/* Local prototypes */
1637c478bdstevel@tonic-gate
1647c478bdstevel@tonic-gate#ifdef ACPI_OBSOLETE_FUNCTIONS
1657c478bdstevel@tonic-gatevoid
1667c478bdstevel@tonic-gateAcpiNsDumpRootDevices (
1677c478bdstevel@tonic-gate    void);
1687c478bdstevel@tonic-gate
1697c478bdstevel@tonic-gatestatic ACPI_STATUS
1707c478bdstevel@tonic-gateAcpiNsDumpOneDevice (
1717c478bdstevel@tonic-gate    ACPI_HANDLE             ObjHandle,
1727c478bdstevel@tonic-gate    UINT32                  Level,
1737c478bdstevel@tonic-gate    void                    *Context,
1747c478bdstevel@tonic-gate    void                    **ReturnValue);
1757c478bdstevel@tonic-gate#endif
1767c478bdstevel@tonic-gate
1777c478bdstevel@tonic-gate
1787c478bdstevel@tonic-gate#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
1797b1019aJerry Jelinek
1807b1019aJerry Jelinekstatic ACPI_STATUS
1817b1019aJerry JelinekAcpiNsDumpOneObjectPath (
1827b1019aJerry Jelinek    ACPI_HANDLE             ObjHandle,
1837b1019aJerry Jelinek    UINT32                  Level,
1847b1019aJerry Jelinek    void                    *Context,
1857b1019aJerry Jelinek    void                    **ReturnValue);
1867b1019aJerry Jelinek
1877b1019aJerry Jelinekstatic ACPI_STATUS
1887b1019aJerry JelinekAcpiNsGetMaxDepth (
1897b1019aJerry Jelinek    ACPI_HANDLE             ObjHandle,
1907b1019aJerry Jelinek    UINT32                  Level,
1917b1019aJerry Jelinek    void                    *Context,
1927b1019aJerry Jelinek    void                    **ReturnValue);
1937b1019aJerry Jelinek
1947b1019aJerry Jelinek
1957c478bdstevel@tonic-gate/*******************************************************************************
1967c478bdstevel@tonic-gate *
1977c478bdstevel@tonic-gate * FUNCTION:    AcpiNsPrintPathname
1987c478bdstevel@tonic-gate *
1997c478bdstevel@tonic-gate * PARAMETERS:  NumSegments         - Number of ACPI name segments
2007c478bdstevel@tonic-gate *              Pathname            - The compressed (internal) path
2017c478bdstevel@tonic-gate *
2027c478bdstevel@tonic-gate * RETURN:      None
2037c478bdstevel@tonic-gate *
2047c478bdstevel@tonic-gate * DESCRIPTION: Print an object's full namespace pathname
2057c478bdstevel@tonic-gate *
2067c478bdstevel@tonic-gate ******************************************************************************/
2077c478bdstevel@tonic-gate
2087c478bdstevel@tonic-gatevoid
2097c478bdstevel@tonic-gateAcpiNsPrintPathname (
2107c478bdstevel@tonic-gate    UINT32                  NumSegments,
2117b1019aJerry Jelinek    const char              *Pathname)
2127c478bdstevel@tonic-gate{
213db2bae3Dana Myers    UINT32                  i;
214186507amyers
215186507amyers
21627f7c58myers    ACPI_FUNCTION_NAME (NsPrintPathname);
2177c478bdstevel@tonic-gate
2187c478bdstevel@tonic-gate
2197b1019aJerry Jelinek    /* Check if debug output enabled */
2207b1019aJerry Jelinek
2217b1019aJerry Jelinek    if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
2227c478bdstevel@tonic-gate    {
2237c478bdstevel@tonic-gate        return;
2247c478bdstevel@tonic-gate    }
2257c478bdstevel@tonic-gate
2267c478bdstevel@tonic-gate    /* Print the entire name */
2277c478bdstevel@tonic-gate
2287c478bdstevel@tonic-gate    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
2297c478bdstevel@tonic-gate
2307c478bdstevel@tonic-gate    while (NumSegments)
2317c478bdstevel@tonic-gate    {
232186507amyers        for (i = 0; i < 4; i++)
233186507amyers        {
2347b1019aJerry Jelinek            isprint ((int) Pathname[i]) ?
235186507amyers                AcpiOsPrintf ("%c", Pathname[i]) :
236186507amyers                AcpiOsPrintf ("?");
237186507amyers        }
2387c478bdstevel@tonic-gate
239186507amyers        Pathname += ACPI_NAME_SIZE;
2407c478bdstevel@tonic-gate        NumSegments--;
2417c478bdstevel@tonic-gate        if (NumSegments)
2427c478bdstevel@tonic-gate        {
2437c478bdstevel@tonic-gate            AcpiOsPrintf (".");
2447c478bdstevel@tonic-gate        }
2457c478bdstevel@tonic-gate    }
2467c478bdstevel@tonic-gate
2477c478bdstevel@tonic-gate    AcpiOsPrintf ("]\n");
2487c478bdstevel@tonic-gate}
2497c478bdstevel@tonic-gate
2507c478bdstevel@tonic-gate
2517b1019aJerry Jelinek#ifdef ACPI_OBSOLETE_FUNCTIONS
2527b1019aJerry Jelinek/* Not used at this time, perhaps later */
2537b1019aJerry Jelinek
2547c478bdstevel@tonic-gate/*******************************************************************************
2557c478bdstevel@tonic-gate *
2567c478bdstevel@tonic-gate * FUNCTION:    AcpiNsDumpPathname
2577c478bdstevel@tonic-gate *
2587c478bdstevel@tonic-gate * PARAMETERS:  Handle              - Object
2597c478bdstevel@tonic-gate *              Msg                 - Prefix message
2607c478bdstevel@tonic-gate *              Level               - Desired debug level
2617c478bdstevel@tonic-gate *              Component           - Caller's component ID
2627c478bdstevel@tonic-gate *
2637c478bdstevel@tonic-gate * RETURN:      None
2647c478bdstevel@tonic-gate *
2657c478bdstevel@tonic-gate * DESCRIPTION: Print an object's full namespace pathname
2667c478bdstevel@tonic-gate *              Manages allocation/freeing of a pathname buffer
2677c478bdstevel@tonic-gate *
2687c478bdstevel@tonic-gate ******************************************************************************/
2697c478bdstevel@tonic-gate
2707c478bdstevel@tonic-gatevoid
2717c478bdstevel@tonic-gateAcpiNsDumpPathname (
2727c478bdstevel@tonic-gate    ACPI_HANDLE             Handle,
2737b1019aJerry Jelinek    const char              *Msg,
2747c478bdstevel@tonic-gate    UINT32                  Level,
2757c478bdstevel@tonic-gate    UINT32                  Component)
2767c478bdstevel@tonic-gate{
2777c478bdstevel@tonic-gate
27827f7c58myers    ACPI_FUNCTION_TRACE (NsDumpPathname);
2797c478bdstevel@tonic-gate
2807c478bdstevel@tonic-gate
2817c478bdstevel@tonic-gate    /* Do this only if the requested debug level and component are enabled */
2827c478bdstevel@tonic-gate
2837b1019aJerry Jelinek    if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
2847c478bdstevel@tonic-gate    {
2857c478bdstevel@tonic-gate        return_VOID;
2867c478bdstevel@tonic-gate    }
2877c478bdstevel@tonic-gate
2887c478bdstevel@tonic-gate    /* Convert handle to a full pathname and print it (with supplied message) */
2897c478bdstevel@tonic-gate
2907c478bdstevel@tonic-gate    AcpiNsPrintNodePathname (Handle, Msg);
2917c478bdstevel@tonic-gate    AcpiOsPrintf ("\n");
2927c478bdstevel@tonic-gate    return_VOID;
2937c478bdstevel@tonic-gate}
2947b1019aJerry Jelinek#endif
2957c478bdstevel@tonic-gate
29635786f6Robert Mustacchi
2977c478bdstevel@tonic-gate/*******************************************************************************
2987c478bdstevel@tonic-gate *
2997c478bdstevel@tonic-gate * FUNCTION:    AcpiNsDumpOneObject
3007c478bdstevel@tonic-gate *
3017c478bdstevel@tonic-gate * PARAMETERS:  ObjHandle           - Node to be dumped
3027c478bdstevel@tonic-gate *              Level               - Nesting level of the handle
3037c478bdstevel@tonic-gate *              Context             - Passed into WalkNamespace
3047c478bdstevel@tonic-gate *              ReturnValue         - Not used
3057c478bdstevel@tonic-gate *
3067c478bdstevel@tonic-gate * RETURN:      Status
3077c478bdstevel@tonic-gate *
3087c478bdstevel@tonic-gate * DESCRIPTION: Dump a single Node
3097c478bdstevel@tonic-gate *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
3107c478bdstevel@tonic-gate *
3117c478bdstevel@tonic-gate ******************************************************************************/
3127c478bdstevel@tonic-gate
3137c478bdstevel@tonic-gateACPI_STATUS
3147c478bdstevel@tonic-gateAcpiNsDumpOneObject (
3157c478bdstevel@tonic-gate    ACPI_HANDLE             ObjHandle,
3167c478bdstevel@tonic-gate    UINT32                  Level,
3177c478bdstevel@tonic-gate    void                    *Context,
3187c478bdstevel@tonic-gate    void                    **ReturnValue)
3197c478bdstevel@tonic-gate{
3207c478bdstevel@tonic-gate    ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
3217c478bdstevel@tonic-gate    ACPI_NAMESPACE_NODE     *ThisNode;
3227c478bdstevel@tonic-gate    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
3237c478bdstevel@tonic-gate    ACPI_OBJECT_TYPE        ObjType;
3247c478bdstevel@tonic-gate    ACPI_OBJECT_TYPE        Type;
3257c478bdstevel@tonic-gate    UINT32                  BytesToDump;
3267c478bdstevel@tonic-gate    UINT32                  DbgLevel;
3277c478bdstevel@tonic-gate    UINT32                  i;
3287c478bdstevel@tonic-gate
3297c478bdstevel@tonic-gate
33027f7c58myers    ACPI_FUNCTION_NAME (NsDumpOneObject);
3317c478bdstevel@tonic-gate
3327c478bdstevel@tonic-gate
3337c478bdstevel@tonic-gate    /* Is output enabled? */
3347c478bdstevel@tonic-gate
3357c478bdstevel@tonic-gate    if (!(AcpiDbgLevel & Info->DebugLevel))
3367c478bdstevel@tonic-gate    {
3377c478bdstevel@tonic-gate        return (AE_OK);
3387c478bdstevel@tonic-gate    }
3397c478bdstevel@tonic-gate
3407c478bdstevel@tonic-gate    if (!ObjHandle)
3417c478bdstevel@tonic-gate    {
3427c478bdstevel@tonic-gate        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
3437c478bdstevel@tonic-gate        return (AE_OK);
3447c478bdstevel@tonic-gate    }
3457c478bdstevel@tonic-gate
34626f3cdfGordon Ross    ThisNode = AcpiNsValidateHandle (ObjHandle);
347aa2aa9aDana Myers    if (!ThisNode)
348aa2aa9aDana Myers    {
349aa2aa9aDana Myers        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
350aa2aa9aDana Myers            ObjHandle));
351aa2aa9aDana Myers        return (AE_OK);
352aa2aa9aDana Myers    }
353aa2aa9aDana Myers
3547c478bdstevel@tonic-gate    Type = ThisNode->Type;
35535786f6Robert Mustacchi    Info->Count++;
3567c478bdstevel@tonic-gate
3577c478bdstevel@tonic-gate    /* Check if the owner matches */
3587c478bdstevel@tonic-gate
359450d696myers    if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
3607c478bdstevel@tonic-gate        (Info->OwnerId != ThisNode->OwnerId))
3617c478bdstevel@tonic-gate    {
3627c478bdstevel@tonic-gate        return (AE_OK);
3637c478bdstevel@tonic-gate    }
3647c478bdstevel@tonic-gate
365450d696myers    if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
366450d696myers    {
367450d696myers        /* Indent the object according to the level */
3687c478bdstevel@tonic-gate
369450d696myers        AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
3707c478bdstevel@tonic-gate
371450d696myers        /* Check the node type and name */
3727c478bdstevel@tonic-gate
373450d696myers        if (Type > ACPI_TYPE_LOCAL_MAX)
374450d696myers        {
3757b1019aJerry Jelinek            ACPI_WARNING ((AE_INFO,
3767b1019aJerry Jelinek                "Invalid ACPI Object Type 0x%08X", Type));
377450d696myers        }
3787c478bdstevel@tonic-gate
379450d696myers        AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
3807c478bdstevel@tonic-gate    }
3817c478bdstevel@tonic-gate
382aa2aa9aDana Myers    /* Now we can print out the pertinent information */
383aa2aa9aDana Myers
38430082d0myers    AcpiOsPrintf (" %-12s %p %2.2X ",
3857b1019aJerry Jelinek        AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
3867c478bdstevel@tonic-gate
3877c478bdstevel@tonic-gate    DbgLevel = AcpiDbgLevel;
3887c478bdstevel@tonic-gate    AcpiDbgLevel = 0;
3897c478bdstevel@tonic-gate    ObjDesc = AcpiNsGetAttachedObject (ThisNode);
3907c478bdstevel@tonic-gate    AcpiDbgLevel = DbgLevel;
3917c478bdstevel@tonic-gate
392db2bae3Dana Myers    /* Temp nodes are those nodes created by a control method */
393db2bae3Dana Myers
394db2bae3Dana Myers    if (ThisNode->Flags & ANOBJ_TEMPORARY)
395db2bae3Dana Myers    {
396db2bae3Dana Myers        AcpiOsPrintf ("(T) ");
397db2bae3Dana Myers    }
398db2bae3Dana Myers
399450d696myers    switch (Info->DisplayType & ACPI_DISPLAY_MASK)
4007c478bdstevel@tonic-gate    {
4017c478bdstevel@tonic-gate    case ACPI_DISPLAY_SUMMARY:
4027c478bdstevel@tonic-gate
4037c478bdstevel@tonic-gate        if (!ObjDesc)
4047c478bdstevel@tonic-gate        {
4057b1019aJerry Jelinek            /* No attached object. Some types should always have an object */
4067b1019aJerry Jelinek
4077b1019aJerry Jelinek            switch (Type)
4087b1019aJerry Jelinek            {
4097b1019aJerry Jelinek            case ACPI_TYPE_INTEGER:
4107b1019aJerry Jelinek            case ACPI_TYPE_PACKAGE:
4117b1019aJerry Jelinek            case ACPI_TYPE_BUFFER:
4127b1019aJerry Jelinek            case ACPI_TYPE_STRING:
4137b1019aJerry Jelinek            case ACPI_TYPE_METHOD:
4147b1019aJerry Jelinek
4157b1019aJerry Jelinek                AcpiOsPrintf ("<No attached object>");
4167b1019aJerry Jelinek                break;
4177b1019aJerry Jelinek
4187b1019aJerry Jelinek            default:
4197b1019aJerry Jelinek
4207b1019aJerry Jelinek                break;
4217b1019aJerry Jelinek            }
4227c478bdstevel@tonic-gate
4237c478bdstevel@tonic-gate            AcpiOsPrintf ("\n");
4247c478bdstevel@tonic-gate            return (AE_OK);
4257c478bdstevel@tonic-gate        }
4267c478bdstevel@tonic-gate
4277c478bdstevel@tonic-gate        switch (Type)
4287c478bdstevel@tonic-gate        {
4297c478bdstevel@tonic-gate        case ACPI_TYPE_PROCESSOR:
4307c478bdstevel@tonic-gate
4317b1019aJerry Jelinek            AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
4327c478bdstevel@tonic-gate                ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
4337b1019aJerry Jelinek                ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address));
4347c478bdstevel@tonic-gate            break;
4357c478bdstevel@tonic-gate
4367c478bdstevel@tonic-gate        case ACPI_TYPE_DEVICE:
4377c478bdstevel@tonic-gate
4387c478bdstevel@tonic-gate            AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
4397c478bdstevel@tonic-gate            break;
4407c478bdstevel@tonic-gate
4417c478bdstevel@tonic-gate        case ACPI_TYPE_METHOD:
4427c478bdstevel@tonic-gate
4437c478bdstevel@tonic-gate            AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
4447c478bdstevel@tonic-gate                (UINT32) ObjDesc->Method.ParamCount,
4457c478bdstevel@tonic-gate                ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
4467c478bdstevel@tonic-gate            break;
4477c478bdstevel@tonic-gate
4487c478bdstevel@tonic-gate        case ACPI_TYPE_INTEGER:
4497c478bdstevel@tonic-gate
4507c478bdstevel@tonic-gate            AcpiOsPrintf ("= %8.8X%8.8X\n",
4517c478bdstevel@tonic-gate                ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
4527c478bdstevel@tonic-gate            break;
4537c478bdstevel@tonic-gate
4547c478bdstevel@tonic-gate        case ACPI_TYPE_PACKAGE:
4557c478bdstevel@tonic-gate
4567c478bdstevel@tonic-gate            if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
4577c478bdstevel@tonic-gate            {
4587c478bdstevel@tonic-gate                AcpiOsPrintf ("Elements %.2X\n",
4597c478bdstevel@tonic-gate                    ObjDesc->Package.Count);
4607c478bdstevel@tonic-gate            }
4617c478bdstevel@tonic-gate            else
4627c478bdstevel@tonic-gate            {
4637c478bdstevel@tonic-gate                AcpiOsPrintf ("[Length not yet evaluated]\n");
4647c478bdstevel@tonic-gate            }
4657c478bdstevel@tonic-gate            break;
4667c478bdstevel@tonic-gate
4677c478bdstevel@tonic-gate        case ACPI_TYPE_BUFFER:
4687c478bdstevel@tonic-gate
4697c478bdstevel@tonic-gate            if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
4707c478bdstevel@tonic-gate            {
4717c478bdstevel@tonic-gate                AcpiOsPrintf ("Len %.2X",
4727b1019aJerry Jelinek                    ObjDesc->Buffer.Length);
4737c478bdstevel@tonic-gate
4747c478bdstevel@tonic-gate                /* Dump some of the buffer */
4757c478bdstevel@tonic-gate
4767c478bdstevel@tonic-gate                if (ObjDesc->Buffer.Length > 0)
4777c478bdstevel@tonic-gate                {
4787c478bdstevel@tonic-gate                    AcpiOsPrintf (" =");
4797c478bdstevel@tonic-gate                    for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
4807c478bdstevel@tonic-gate                    {
4817c478bdstevel@tonic-gate                        AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
4827c478bdstevel@tonic-gate                    }
4837c478bdstevel@tonic-gate                }
4847c478bdstevel@tonic-gate                AcpiOsPrintf ("\n");
4857c478bdstevel@tonic-gate            }
4867c478bdstevel@tonic-gate            else
4877c478bdstevel@tonic-gate            {
4887c478bdstevel@tonic-gate                AcpiOsPrintf ("[Length not yet evaluated]\n");
4897c478bdstevel@tonic-gate            }
4907c478bdstevel@tonic-gate            break;
4917c478bdstevel@tonic-gate
4927c478bdstevel@tonic-gate        case ACPI_TYPE_STRING:
4937c478bdstevel@tonic-gate
4947c478bdstevel@tonic-gate            AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
4957b1019aJerry Jelinek            AcpiUtPrintString (ObjDesc->String.Pointer, 80);
4967c478bdstevel@tonic-gate            AcpiOsPrintf ("\n");
4977c478bdstevel@tonic-gate            break;
4987c478bdstevel@tonic-gate
4997c478bdstevel@tonic-gate        case ACPI_TYPE_REGION:
5007c478bdstevel@tonic-gate
5017c478bdstevel@tonic-gate            AcpiOsPrintf ("[%s]",
5027c478bdstevel@tonic-gate                AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
5037c478bdstevel@tonic-gate            if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
5047c478bdstevel@tonic-gate            {
5057c478bdstevel@tonic-gate                AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
5067b1019aJerry Jelinek                    ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
5077c478bdstevel@tonic-gate                    ObjDesc->Region.Length);
5087c478bdstevel@tonic-gate            }
5097c478bdstevel@tonic-gate            else
5107c478bdstevel@tonic-gate            {
5117c478bdstevel@tonic-gate                AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
5127c478bdstevel@tonic-gate            }
5137c478bdstevel@tonic-gate            break;
5147c478bdstevel@tonic-gate
5157c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_REFERENCE:
5167c478bdstevel@tonic-gate
517db2bae3Dana Myers            AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
5187c478bdstevel@tonic-gate            break;
5197c478bdstevel@tonic-gate
5207c478bdstevel@tonic-gate        case ACPI_TYPE_BUFFER_FIELD:
5217c478bdstevel@tonic-gate
5227c478bdstevel@tonic-gate            if (ObjDesc->BufferField.BufferObj &&
5237c478bdstevel@tonic-gate                ObjDesc->BufferField.BufferObj->Buffer.Node)
5247c478bdstevel@tonic-gate            {
5257c478bdstevel@tonic-gate                AcpiOsPrintf ("Buf [%4.4s]",
526aa2aa9aDana Myers                    AcpiUtGetNodeName (
527aa2aa9aDana Myers                        ObjDesc->BufferField.BufferObj->Buffer.Node));
5287c478bdstevel@tonic-gate            }
5297c478bdstevel@tonic-gate            break;
5307c478bdstevel@tonic-gate
5317c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_REGION_FIELD:
5327c478bdstevel@tonic-gate
5337c478bdstevel@tonic-gate            AcpiOsPrintf ("Rgn [%4.4s]",
534aa2aa9aDana Myers                AcpiUtGetNodeName (
535aa2aa9aDana Myers                    ObjDesc->CommonField.RegionObj->Region.Node));
5367c478bdstevel@tonic-gate            break;
5377c478bdstevel@tonic-gate
5387c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_BANK_FIELD:
5397c478bdstevel@tonic-gate
5407c478bdstevel@tonic-gate            AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
541aa2aa9aDana Myers                AcpiUtGetNodeName (
542aa2aa9aDana Myers                    ObjDesc->CommonField.RegionObj->Region.Node),
543aa2aa9aDana Myers                AcpiUtGetNodeName (
544aa2aa9aDana Myers                    ObjDesc->BankField.BankObj->CommonField.Node));
5457c478bdstevel@tonic-gate            break;
5467c478bdstevel@tonic-gate
5477c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_INDEX_FIELD:
5487c478bdstevel@tonic-gate
5497c478bdstevel@tonic-gate            AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
550aa2aa9aDana Myers                AcpiUtGetNodeName (
551aa2aa9aDana Myers                    ObjDesc->IndexField.IndexObj->CommonField.Node),
552aa2aa9aDana Myers                AcpiUtGetNodeName (
553aa2aa9aDana Myers                    ObjDesc->IndexField.DataObj->CommonField.Node));
5547c478bdstevel@tonic-gate            break;
5557c478bdstevel@tonic-gate
5567c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_ALIAS:
5577c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_METHOD_ALIAS:
5587c478bdstevel@tonic-gate
5597c478bdstevel@tonic-gate            AcpiOsPrintf ("Target %4.4s (%p)\n",
5607c478bdstevel@tonic-gate                AcpiUtGetNodeName (ObjDesc), ObjDesc);
5617c478bdstevel@tonic-gate            break;
5627c478bdstevel@tonic-gate
5637c478bdstevel@tonic-gate        default:
5647c478bdstevel@tonic-gate
5657c478bdstevel@tonic-gate            AcpiOsPrintf ("Object %p\n", ObjDesc);
5667c478bdstevel@tonic-gate            break;
5677c478bdstevel@tonic-gate        }
5687c478bdstevel@tonic-gate
5697c478bdstevel@tonic-gate        /* Common field handling */
5707c478bdstevel@tonic-gate
5717c478bdstevel@tonic-gate        switch (Type)
5727c478bdstevel@tonic-gate        {
5737c478bdstevel@tonic-gate        case ACPI_TYPE_BUFFER_FIELD:
5747c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_REGION_FIELD:
5757c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_BANK_FIELD:
5767c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_INDEX_FIELD:
5777c478bdstevel@tonic-gate
5787c478bdstevel@tonic-gate            AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
5797c478bdstevel@tonic-gate                (ObjDesc->CommonField.BaseByteOffset * 8)
5807c478bdstevel@tonic-gate                    + ObjDesc->CommonField.StartFieldBitOffset,
5817c478bdstevel@tonic-gate                ObjDesc->CommonField.BitLength,
5827c478bdstevel@tonic-gate                ObjDesc->CommonField.AccessByteWidth);
5837c478bdstevel@tonic-gate            break;
5847c478bdstevel@tonic-gate
5857c478bdstevel@tonic-gate        default:
5867b1019aJerry Jelinek
5877c478bdstevel@tonic-gate            break;
5887c478bdstevel@tonic-gate        }
5897c478bdstevel@tonic-gate        break;
5907c478bdstevel@tonic-gate
5917c478bdstevel@tonic-gate    case ACPI_DISPLAY_OBJECTS:
5927c478bdstevel@tonic-gate
5937c478bdstevel@tonic-gate        AcpiOsPrintf ("O:%p", ObjDesc);
5947c478bdstevel@tonic-gate        if (!ObjDesc)
5957c478bdstevel@tonic-gate        {
5967c478bdstevel@tonic-gate            /* No attached object, we are done */
5977c478bdstevel@tonic-gate
5987c478bdstevel@tonic-gate            AcpiOsPrintf ("\n");
5997c478bdstevel@tonic-gate            return (AE_OK);
6007c478bdstevel@tonic-gate        }
6017c478bdstevel@tonic-gate
60226f3cdfGordon Ross        AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
6037c478bdstevel@tonic-gate
6047c478bdstevel@tonic-gate        switch (Type)
6057c478bdstevel@tonic-gate        {
6067c478bdstevel@tonic-gate        case ACPI_TYPE_METHOD:
6077c478bdstevel@tonic-gate
6087c478bdstevel@tonic-gate            /* Name is a Method and its AML offset/length are set */
6097c478bdstevel@tonic-gate
6107c478bdstevel@tonic-gate            AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
611aa2aa9aDana Myers                ObjDesc->Method.AmlLength);
6127c478bdstevel@tonic-gate            break;
6137c478bdstevel@tonic-gate
6147c478bdstevel@tonic-gate        case ACPI_TYPE_INTEGER:
6157c478bdstevel@tonic-gate
6167c478bdstevel@tonic-gate            AcpiOsPrintf (" I:%8.8X8.8%X\n",
617aa2aa9aDana Myers                ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
6187c478bdstevel@tonic-gate            break;
6197c478bdstevel@tonic-gate
6207c478bdstevel@tonic-gate        case ACPI_TYPE_STRING:
6217c478bdstevel@tonic-gate
6227c478bdstevel@tonic-gate            AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
623aa2aa9aDana Myers                ObjDesc->String.Length);
6247c478bdstevel@tonic-gate            break;
6257c478bdstevel@tonic-gate
6267c478bdstevel@tonic-gate        case ACPI_TYPE_BUFFER:
6277c478bdstevel@tonic-gate
6287c478bdstevel@tonic-gate            AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
629aa2aa9aDana Myers                ObjDesc->Buffer.Length);
6307c478bdstevel@tonic-gate            break;
6317c478bdstevel@tonic-gate
6327c478bdstevel@tonic-gate        default:
6337c478bdstevel@tonic-gate
6347c478bdstevel@tonic-gate            AcpiOsPrintf ("\n");
6357c478bdstevel@tonic-gate            break;
6367c478bdstevel@tonic-gate        }
6377c478bdstevel@tonic-gate        break;
6387c478bdstevel@tonic-gate
6397c478bdstevel@tonic-gate    default:
6407c478bdstevel@tonic-gate        AcpiOsPrintf ("\n");
6417c478bdstevel@tonic-gate        break;
6427c478bdstevel@tonic-gate    }
6437c478bdstevel@tonic-gate
6447c478bdstevel@tonic-gate    /* If debug turned off, done */
6457c478bdstevel@tonic-gate
6467c478bdstevel@tonic-gate    if (!(AcpiDbgLevel & ACPI_LV_VALUES))
6477c478bdstevel@tonic-gate    {
6487c478bdstevel@tonic-gate        return (AE_OK);
6497c478bdstevel@tonic-gate    }
6507c478bdstevel@tonic-gate
6517c478bdstevel@tonic-gate    /* If there is an attached object, display it */
6527c478bdstevel@tonic-gate
6537b1019aJerry Jelinek    DbgLevel = AcpiDbgLevel;
6547c478bdstevel@tonic-gate    AcpiDbgLevel = 0;
6557b1019aJerry Jelinek    ObjDesc = AcpiNsGetAttachedObject (ThisNode);
6567c478bdstevel@tonic-gate    AcpiDbgLevel = DbgLevel;
6577c478bdstevel@tonic-gate
6587c478bdstevel@tonic-gate    /* Dump attached objects */
6597c478bdstevel@tonic-gate
6607c478bdstevel@tonic-gate    while (ObjDesc)
6617c478bdstevel@tonic-gate    {
6627c478bdstevel@tonic-gate        ObjType = ACPI_TYPE_INVALID;
663450d696myers        AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
6647c478bdstevel@tonic-gate
6657c478bdstevel@tonic-gate        /* Decode the type of attached object and dump the contents */
6667c478bdstevel@tonic-gate
6677c478bdstevel@tonic-gate        switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
6687c478bdstevel@tonic-gate        {
6697c478bdstevel@tonic-gate        case ACPI_DESC_TYPE_NAMED:
6707c478bdstevel@tonic-gate
6717c478bdstevel@tonic-gate            AcpiOsPrintf ("(Ptr to Node)\n");
6727c478bdstevel@tonic-gate            BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
673450d696myers            ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
6747c478bdstevel@tonic-gate            break;
6757c478bdstevel@tonic-gate
6767c478bdstevel@tonic-gate        case ACPI_DESC_TYPE_OPERAND:
6777c478bdstevel@tonic-gate
678aa2aa9aDana Myers            ObjType = ObjDesc->Common.Type;
6797c478bdstevel@tonic-gate
6807c478bdstevel@tonic-gate            if (ObjType > ACPI_TYPE_LOCAL_MAX)
6817c478bdstevel@tonic-gate            {
6827b1019aJerry Jelinek                AcpiOsPrintf (
6837b1019aJerry Jelinek                    "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
6847c478bdstevel@tonic-gate                    ObjType);
6857b1019aJerry Jelinek
6867c478bdstevel@tonic-gate                BytesToDump = 32;
6877c478bdstevel@tonic-gate            }
6887c478bdstevel@tonic-gate            else
6897c478bdstevel@tonic-gate            {
6907b1019aJerry Jelinek                AcpiOsPrintf (
6917b1019aJerry Jelinek                    "(Pointer to ACPI Object type %.2X [%s])\n",
692450d696myers                    ObjType, AcpiUtGetTypeName (ObjType));
6937b1019aJerry Jelinek
6947c478bdstevel@tonic-gate                BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
6957c478bdstevel@tonic-gate            }
6967c478bdstevel@tonic-gate
697450d696myers            ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
698450d696myers            break;
6997c478bdstevel@tonic-gate
7007c478bdstevel@tonic-gate        default:
7017c478bdstevel@tonic-gate
7027c478bdstevel@tonic-gate            break;
7037c478bdstevel@tonic-gate        }
7047c478bdstevel@tonic-gate
7057c478bdstevel@tonic-gate        /* If value is NOT an internal object, we are done */
7067c478bdstevel@tonic-gate
7077c478bdstevel@tonic-gate        if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
7087c478bdstevel@tonic-gate        {
7097c478bdstevel@tonic-gate            goto Cleanup;
7107c478bdstevel@tonic-gate        }
7117c478bdstevel@tonic-gate
712aa2aa9aDana Myers        /* Valid object, get the pointer to next level, if any */
713aa2aa9aDana Myers
7147c478bdstevel@tonic-gate        switch (ObjType)
7157c478bdstevel@tonic-gate        {
716450d696myers        case ACPI_TYPE_BUFFER:
7177c478bdstevel@tonic-gate        case ACPI_TYPE_STRING:
718450d696myers            /*
719450d696myers             * NOTE: takes advantage of common fields between string/buffer
720450d696myers             */
721450d696myers            BytesToDump = ObjDesc->String.Length;
7227c478bdstevel@tonic-gate            ObjDesc = (void *) ObjDesc->String.Pointer;
7237b1019aJerry Jelinek
7247b1019aJerry Jelinek            AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n",
725450d696myers                ObjDesc, BytesToDump);
726450d696myers            ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
727450d696myers            goto Cleanup;
7287c478bdstevel@tonic-gate
7297c478bdstevel@tonic-gate        case ACPI_TYPE_BUFFER_FIELD:
7307b1019aJerry Jelinek
7317c478bdstevel@tonic-gate            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
7327c478bdstevel@tonic-gate            break;
7337c478bdstevel@tonic-gate
7347c478bdstevel@tonic-gate        case ACPI_TYPE_PACKAGE:
7357b1019aJerry Jelinek
7367c478bdstevel@tonic-gate            ObjDesc = (void *) ObjDesc->Package.Elements;
7377c478bdstevel@tonic-gate            break;
7387c478bdstevel@tonic-gate
7397c478bdstevel@tonic-gate        case ACPI_TYPE_METHOD:
7407b1019aJerry Jelinek
7417c478bdstevel@tonic-gate            ObjDesc = (void *) ObjDesc->Method.AmlStart;
7427c478bdstevel@tonic-gate            break;
7437c478bdstevel@tonic-gate
7447c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_REGION_FIELD:
7457b1019aJerry Jelinek
7467c478bdstevel@tonic-gate            ObjDesc = (void *) ObjDesc->Field.RegionObj;
7477c478bdstevel@tonic-gate            break;
7487c478bdstevel@tonic-gate
7497c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_BANK_FIELD:
7507b1019aJerry Jelinek
7517c478bdstevel@tonic-gate            ObjDesc = (void *) ObjDesc->BankField.RegionObj;
7527c478bdstevel@tonic-gate            break;
7537c478bdstevel@tonic-gate
7547c478bdstevel@tonic-gate        case ACPI_TYPE_LOCAL_INDEX_FIELD:
7557b1019aJerry Jelinek
7567c478bdstevel@tonic-gate            ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
7577c478bdstevel@tonic-gate            break;
7587c478bdstevel@tonic-gate
7597c478bdstevel@tonic-gate        default:
7607b1019aJerry Jelinek
7617c478bdstevel@tonic-gate            goto Cleanup;
7627c478bdstevel@tonic-gate        }
7637c478bdstevel@tonic-gate
7647c478bdstevel@tonic-gate        ObjType = ACPI_TYPE_INVALID;   /* Terminate loop after next pass */
7657c478bdstevel@tonic-gate    }
7667c478bdstevel@tonic-gate
7677c478bdstevel@tonic-gateCleanup:
7687c478bdstevel@tonic-gate    AcpiOsPrintf ("\n");
7697c478bdstevel@tonic-gate    return (AE_OK);
7707c478bdstevel@tonic-gate}
7717c478bdstevel@tonic-gate
7727c478bdstevel@tonic-gate
7737c478bdstevel@tonic-gate/*******************************************************************************
7747c478bdstevel@tonic-gate *
7757c478bdstevel@tonic-gate * FUNCTION:    AcpiNsDumpObjects
7767c478bdstevel@tonic-gate *
7777c478bdstevel@tonic-gate * PARAMETERS:  Type                - Object type to be dumped
7787c478bdstevel@tonic-gate *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
7797c478bdstevel@tonic-gate *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
7807c478bdstevel@tonic-gate *                                    for an effectively unlimited depth.
781aa2aa9aDana Myers *              OwnerId             - Dump only objects owned by this ID. Use
7827c478bdstevel@tonic-gate *                                    ACPI_UINT32_MAX to match all owners.
7837c478bdstevel@tonic-gate *              StartHandle         - Where in namespace to start/end search
7847c478bdstevel@tonic-gate *
7857c478bdstevel@tonic-gate * RETURN:      None
7867c478bdstevel@tonic-gate *
787aa2aa9aDana Myers * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
788aa2aa9aDana Myers *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
7897c478bdstevel@tonic-gate *
7907c478bdstevel@tonic-gate ******************************************************************************/
7917c478bdstevel@tonic-gate
7927c478bdstevel@tonic-gatevoid
7937c478bdstevel@tonic-gateAcpiNsDumpObjects (
7947c478bdstevel@tonic-gate    ACPI_OBJECT_TYPE        Type,
7957c478bdstevel@tonic-gate    UINT8                   DisplayType,
7967c478bdstevel@tonic-gate    UINT32                  MaxDepth,
797450d696myers    ACPI_OWNER_ID           OwnerId,
7987c478bdstevel@tonic-gate    ACPI_HANDLE             StartHandle)
7997c478bdstevel@tonic-gate{
8007c478bdstevel@tonic-gate    ACPI_WALK_INFO          Info;
80126f3cdfGordon Ross    ACPI_STATUS             Status;
8027c478bdstevel@tonic-gate
8037c478bdstevel@tonic-gate
8047c478bdstevel@tonic-gate    ACPI_FUNCTION_ENTRY ();
8057c478bdstevel@tonic-gate
8067c478bdstevel@tonic-gate
80726f3cdfGordon Ross    /*
80826f3cdfGordon Ross     * Just lock the entire namespace for the duration of the dump.
80926f3cdfGordon Ross     * We don't want any changes to the namespace during this time,
81026f3cdfGordon Ross     * especially the temporary nodes since we are going to display
81126f3cdfGordon Ross     * them also.
81226f3cdfGordon Ross     */
81326f3cdfGordon Ross    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
81426f3cdfGordon Ross    if (ACPI_FAILURE (Status))
81526f3cdfGordon Ross    {
81626f3cdfGordon Ross        AcpiOsPrintf ("Could not acquire namespace mutex\n");
81726f3cdfGordon Ross        return;
81826f3cdfGordon Ross    }
81926f3cdfGordon Ross
82035786f6Robert Mustacchi    Info.Count = 0;
8217c478bdstevel@tonic-gate    Info.DebugLevel = ACPI_LV_TABLES;
8227c478bdstevel@tonic-gate    Info.OwnerId = OwnerId;
8237c478bdstevel@tonic-gate    Info.DisplayType = DisplayType;
8247c478bdstevel@tonic-gate
8257c478bdstevel@tonic-gate    (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
8267b1019aJerry Jelinek        ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
8277b1019aJerry Jelinek        AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
8287b1019aJerry Jelinek
82935786f6Robert Mustacchi    AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count);
8307b1019aJerry Jelinek    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
8317b1019aJerry Jelinek}
8327b1019aJerry Jelinek
8337b1019aJerry Jelinek
8347b1019aJerry Jelinek/*******************************************************************************
8357b1019aJerry Jelinek *
8367b1019aJerry Jelinek * FUNCTION:    AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
8377b1019aJerry Jelinek *
8387b1019aJerry Jelinek * PARAMETERS:  ObjHandle           - Node to be dumped
8397b1019aJerry Jelinek *              Level               - Nesting level of the handle
8407b1019aJerry Jelinek *              Context             - Passed into WalkNamespace
8417b1019aJerry Jelinek *              ReturnValue         - Not used
8427b1019aJerry Jelinek *
8437b1019aJerry Jelinek * RETURN:      Status
8447b1019aJerry Jelinek *
8457b1019aJerry Jelinek * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
8467b1019aJerry Jelinek *              computes the maximum nesting depth in the namespace tree, in
8477b1019aJerry Jelinek *              order to simplify formatting in AcpiNsDumpOneObjectPath.
8487b1019aJerry Jelinek *              These procedures are UserFunctions called by AcpiNsWalkNamespace.
8497b1019aJerry Jelinek *
8507b1019aJerry Jelinek ******************************************************************************/
8517b1019aJerry Jelinek
8527b1019aJerry Jelinekstatic ACPI_STATUS
8537b1019aJerry JelinekAcpiNsDumpOneObjectPath (
8547b1019aJerry Jelinek    ACPI_HANDLE             ObjHandle,
8557b1019aJerry Jelinek    UINT32                  Level,
8567b1019aJerry Jelinek    void                    *Context,
8577b1019aJerry Jelinek    void                    **ReturnValue)
8587b1019aJerry Jelinek{
8597b1019aJerry Jelinek    UINT32                  MaxLevel = *((UINT32 *) Context);
8607b1019aJerry Jelinek    char                    *Pathname;
8617b1019aJerry Jelinek    ACPI_NAMESPACE_NODE     *Node;
8627b1019aJerry Jelinek    int                     PathIndent;
8637b1019aJerry Jelinek
8647b1019aJerry Jelinek
8657b1019aJerry Jelinek    if (!ObjHandle)
8667b1019aJerry Jelinek    {
8677b1019aJerry Jelinek        return (AE_OK);
8687b1019aJerry Jelinek    }
8697b1019aJerry Jelinek
8707b1019aJerry Jelinek    Node = AcpiNsValidateHandle (ObjHandle);
8717b1019aJerry Jelinek    if (!Node)
8727b1019aJerry Jelinek    {
8737b1019aJerry Jelinek        /* Ignore bad node during namespace walk */
8747b1019aJerry Jelinek
8757b1019aJerry Jelinek        return (AE_OK);
8767b1019aJerry Jelinek    }
8777b1019aJerry Jelinek
8787b1019aJerry Jelinek    Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
8797b1019aJerry Jelinek
8807b1019aJerry Jelinek    PathIndent = 1;
8817b1019aJerry Jelinek    if (Level <= MaxLevel)
8827b1019aJerry Jelinek    {
8837b1019aJerry Jelinek        PathIndent = MaxLevel - Level + 1;
8847b1019aJerry Jelinek    }
8857b1019aJerry Jelinek
8867b1019aJerry Jelinek    AcpiOsPrintf ("%2d%*s%-12s%*s",
8877b1019aJerry Jelinek        Level, Level, " ", AcpiUtGetTypeName (Node->Type),
8887b1019aJerry Jelinek        PathIndent, " ");
8897b1019aJerry Jelinek
8907b1019aJerry Jelinek    AcpiOsPrintf ("%s\n", &Pathname[1]);
8917b1019aJerry Jelinek    ACPI_FREE (Pathname);
8927b1019aJerry Jelinek    return (AE_OK);
8937b1019aJerry Jelinek}
8947b1019aJerry Jelinek
8957b1019aJerry Jelinek
8967b1019aJerry Jelinekstatic ACPI_STATUS
8977b1019aJerry JelinekAcpiNsGetMaxDepth (
8987b1019aJerry Jelinek    ACPI_HANDLE             ObjHandle,
8997b1019aJerry Jelinek    UINT32                  Level,
9007b1019aJerry Jelinek    void                    *Context,
9017b1019aJerry Jelinek    void                    **ReturnValue)
9027b1019aJerry Jelinek{
9037b1019aJerry Jelinek    UINT32                  *MaxLevel = (UINT32 *) Context;
9047b1019aJerry Jelinek
9057b1019aJerry Jelinek
9067b1019aJerry Jelinek    if (Level > *MaxLevel)
9077b1019aJerry Jelinek    {
9087b1019aJerry Jelinek        *MaxLevel = Level;
9097b1019aJerry Jelinek    }
9107b1019aJerry Jelinek    return (AE_OK);
9117b1019aJerry Jelinek}
9127b1019aJerry Jelinek
9137b1019aJerry Jelinek
9147b1019aJerry Jelinek/*******************************************************************************
9157b1019aJerry Jelinek *
9167b1019aJerry Jelinek * FUNCTION:    AcpiNsDumpObjectPaths
9177b1019aJerry Jelinek *
9187b1019aJerry Jelinek * PARAMETERS:  Type                - Object type to be dumped
9197b1019aJerry Jelinek *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
9207b1019aJerry Jelinek *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
9217b1019aJerry Jelinek *                                    for an effectively unlimited depth.
9227b1019aJerry Jelinek *              OwnerId             - Dump only objects owned by this ID. Use
9237b1019aJerry Jelinek *                                    ACPI_UINT32_MAX to match all owners.
9247b1019aJerry Jelinek *              StartHandle         - Where in namespace to start/end search
9257b1019aJerry Jelinek *
9267b1019aJerry Jelinek * RETURN:      None
9277b1019aJerry Jelinek *
9287b1019aJerry Jelinek * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
9297b1019aJerry Jelinek *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
9307b1019aJerry Jelinek *
9317b1019aJerry Jelinek ******************************************************************************/
9327b1019aJerry Jelinek
9337b1019aJerry Jelinekvoid
9347b1019aJerry JelinekAcpiNsDumpObjectPaths (
9357b1019aJerry Jelinek    ACPI_OBJECT_TYPE        Type,
9367b1019aJerry Jelinek    UINT8                   DisplayType,
9377b1019aJerry Jelinek    UINT32                  MaxDepth,
9387b1019aJerry Jelinek    ACPI_OWNER_ID           OwnerId,
9397b1019aJerry Jelinek    ACPI_HANDLE             StartHandle)
9407b1019aJerry Jelinek{
9417b1019aJerry Jelinek    ACPI_STATUS             Status;
9427b1019aJerry Jelinek    UINT32                  MaxLevel = 0;
9437b1019aJerry Jelinek
9447b1019aJerry Jelinek
9457b1019aJerry Jelinek    ACPI_FUNCTION_ENTRY ();
9467b1019aJerry Jelinek
9477b1019aJerry Jelinek
9487b1019aJerry Jelinek    /*
9497b1019aJerry Jelinek     * Just lock the entire namespace for the duration of the dump.
9507b1019aJerry Jelinek     * We don't want any changes to the namespace during this time,
9517b1019aJerry Jelinek     * especially the temporary nodes since we are going to display
9527b1019aJerry Jelinek     * them also.
9537b1019aJerry Jelinek     */
9547b1019aJerry Jelinek    Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
9557b1019aJerry Jelinek    if (ACPI_FAILURE (Status))
9567b1019aJerry Jelinek    {
9577b1019aJerry Jelinek        AcpiOsPrintf ("Could not acquire namespace mutex\n");
9587b1019aJerry Jelinek        return;
9597b1019aJerry Jelinek    }
9607b1019aJerry Jelinek
9617b1019aJerry Jelinek    /* Get the max depth of the namespace tree, for formatting later */
9627b1019aJerry Jelinek
9637b1019aJerry Jelinek    (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
9647b1019aJerry Jelinek        ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
9657b1019aJerry Jelinek        AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
9667b1019aJerry Jelinek
9677b1019aJerry Jelinek    /* Now dump the entire namespace */
9687b1019aJerry Jelinek
9697b1019aJerry Jelinek    (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
9707b1019aJerry Jelinek        ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
9717b1019aJerry Jelinek        AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
97226f3cdfGordon Ross
97326f3cdfGordon Ross    (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
9747c478bdstevel@tonic-gate}
9757c478bdstevel@tonic-gate
9767c478bdstevel@tonic-gate
9777c478bdstevel@tonic-gate/*******************************************************************************
9787c478bdstevel@tonic-gate *
9797c478bdstevel@tonic-gate * FUNCTION:    AcpiNsDumpEntry
9807c478bdstevel@tonic-gate *
9817c478bdstevel@tonic-gate * PARAMETERS:  Handle              - Node to be dumped
9827c478bdstevel@tonic-gate *              DebugLevel          - Output level
9837c478bdstevel@tonic-gate *
9847c478bdstevel@tonic-gate * RETURN:      None
9857c478bdstevel@tonic-gate *
9867c478bdstevel@tonic-gate * DESCRIPTION: Dump a single Node
9877c478bdstevel@tonic-gate *
9887c478bdstevel@tonic-gate ******************************************************************************/
9897c478bdstevel@tonic-gate
9907c478bdstevel@tonic-gatevoid
9917c478bdstevel@tonic-gateAcpiNsDumpEntry (
9927c478bdstevel@tonic-gate    ACPI_HANDLE             Handle,
9937c478bdstevel@tonic-gate    UINT32                  DebugLevel)
9947c478bdstevel@tonic-gate{
9957c478bdstevel@tonic-gate    ACPI_WALK_INFO          Info;
9967c478bdstevel@tonic-gate
9977c478bdstevel@tonic-gate
9987c478bdstevel@tonic-gate    ACPI_FUNCTION_ENTRY ();
9997c478bdstevel@tonic-gate
10007c478bdstevel@tonic-gate
10017c478bdstevel@tonic-gate    Info.DebugLevel = DebugLevel;
1002450d696myers    Info.OwnerId = ACPI_OWNER_ID_MAX;
10037c478bdstevel@tonic-gate    Info.DisplayType = ACPI_DISPLAY_SUMMARY;
10047c478bdstevel@tonic-gate
10057c478bdstevel@tonic-gate    (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
10067c478bdstevel@tonic-gate}
10077c478bdstevel@tonic-gate
10087c478bdstevel@tonic-gate
1009450d696myers#ifdef ACPI_ASL_COMPILER
10107c478bdstevel@tonic-gate/*******************************************************************************
10117c478bdstevel@tonic-gate *
10127c478bdstevel@tonic-gate * FUNCTION:    AcpiNsDumpTables
10137c478bdstevel@tonic-gate *
10147c478bdstevel@tonic-gate * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
10157c478bdstevel@tonic-gate *                                    NS_ALL to dump the entire namespace
10167b1019aJerry Jelinek *              MaxDepth            - Maximum depth of dump. Use INT_MAX
10177c478bdstevel@tonic-gate *                                    for an effectively unlimited depth.
10187c478bdstevel@tonic-gate *
10197c478bdstevel@tonic-gate * RETURN:      None
10207c478bdstevel@tonic-gate *
10217c478bdstevel@tonic-gate * DESCRIPTION: Dump the name space, or a portion of it.
10227c478bdstevel@tonic-gate *
10237c478bdstevel@tonic-gate ******************************************************************************/
10247c478bdstevel@tonic-gate
10257c478bdstevel@tonic-gatevoid
10267c478bdstevel@tonic-gateAcpiNsDumpTables (
10277c478bdstevel@tonic-gate    ACPI_HANDLE             SearchBase,
10287c478bdstevel@tonic-gate    UINT32                  MaxDepth)
10297c478bdstevel@tonic-gate{
10307c478bdstevel@tonic-gate    ACPI_HANDLE             SearchHandle = SearchBase;
10317c478bdstevel@tonic-gate
10327c478bdstevel@tonic-gate
103327f7c58myers    ACPI_FUNCTION_TRACE (NsDumpTables);
10347c478bdstevel@tonic-gate
10357c478bdstevel@tonic-gate
10367c478bdstevel@tonic-gate    if (!AcpiGbl_RootNode)
10377c478bdstevel@tonic-gate    {
10387c478bdstevel@tonic-gate        /*
10397c478bdstevel@tonic-gate         * If the name space has not been initialized,
10407c478bdstevel@tonic-gate         * there is nothing to dump.
10417c478bdstevel@tonic-gate         */
10427b1019aJerry Jelinek        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
10437b1019aJerry Jelinek            "namespace not initialized!\n"));
10447c478bdstevel@tonic-gate        return_VOID;
10457c478bdstevel@tonic-gate    }
10467c478bdstevel@tonic-gate
10477c478bdstevel@tonic-gate    if (ACPI_NS_ALL == SearchBase)
10487c478bdstevel@tonic-gate    {
10497c478bdstevel@tonic-gate        /* Entire namespace */
10507c478bdstevel@tonic-gate
10517c478bdstevel@tonic-gate        SearchHandle = AcpiGbl_RootNode;
10527c478bdstevel@tonic-gate        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
10537c478bdstevel@tonic-gate    }
10547c478bdstevel@tonic-gate
10557c478bdstevel@tonic-gate    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
10567b1019aJerry Jelinek        ACPI_OWNER_ID_MAX, SearchHandle);
10577c478bdstevel@tonic-gate    return_VOID;
10587c478bdstevel@tonic-gate}
10597c478bdstevel@tonic-gate#endif
10607c478bdstevel@tonic-gate#endif
1061