xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/components/namespace/nsdump.c (revision 6dde014f768e0ee49bae871ed857cf433837b9ff)
10174267aSFredrik Holmqvist /******************************************************************************
20174267aSFredrik Holmqvist  *
30174267aSFredrik Holmqvist  * Module Name: nsdump - table dumping routines for debug
40174267aSFredrik Holmqvist  *
50174267aSFredrik Holmqvist  *****************************************************************************/
60174267aSFredrik Holmqvist 
70174267aSFredrik Holmqvist /******************************************************************************
80174267aSFredrik Holmqvist  *
90174267aSFredrik Holmqvist  * 1. Copyright Notice
100174267aSFredrik Holmqvist  *
11*6dde014fSPulkoMandy  * Some or all of this work - Copyright (c) 1999 - 2024, Intel Corp.
120174267aSFredrik Holmqvist  * All rights reserved.
130174267aSFredrik Holmqvist  *
140174267aSFredrik Holmqvist  * 2. License
150174267aSFredrik Holmqvist  *
160174267aSFredrik Holmqvist  * 2.1. This is your license from Intel Corp. under its intellectual property
170174267aSFredrik Holmqvist  * rights. You may have additional license terms from the party that provided
180174267aSFredrik Holmqvist  * you this software, covering your right to use that party's intellectual
190174267aSFredrik Holmqvist  * property rights.
200174267aSFredrik Holmqvist  *
210174267aSFredrik Holmqvist  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220174267aSFredrik Holmqvist  * copy of the source code appearing in this file ("Covered Code") an
230174267aSFredrik Holmqvist  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240174267aSFredrik Holmqvist  * base code distributed originally by Intel ("Original Intel Code") to copy,
250174267aSFredrik Holmqvist 
260174267aSFredrik Holmqvist  * make derivatives, distribute, use and display any portion of the Covered
270174267aSFredrik Holmqvist  * Code in any form, with the right to sublicense such rights; and
280174267aSFredrik Holmqvist  *
290174267aSFredrik Holmqvist  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
300174267aSFredrik Holmqvist  * license (with the right to sublicense), under only those claims of Intel
310174267aSFredrik Holmqvist  * patents that are infringed by the Original Intel Code, to make, use, sell,
320174267aSFredrik Holmqvist  * offer to sell, and import the Covered Code and derivative works thereof
330174267aSFredrik Holmqvist  * solely to the minimum extent necessary to exercise the above copyright
340174267aSFredrik Holmqvist  * license, and in no event shall the patent license extend to any additions
350174267aSFredrik Holmqvist  * to or modifications of the Original Intel Code. No other license or right
360174267aSFredrik Holmqvist  * is granted directly or by implication, estoppel or otherwise;
370174267aSFredrik Holmqvist  *
380174267aSFredrik Holmqvist  * The above copyright and patent license is granted only if the following
390174267aSFredrik Holmqvist  * conditions are met:
400174267aSFredrik Holmqvist  *
410174267aSFredrik Holmqvist  * 3. Conditions
420174267aSFredrik Holmqvist  *
430174267aSFredrik Holmqvist  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
440174267aSFredrik Holmqvist  * Redistribution of source code of any substantial portion of the Covered
450174267aSFredrik Holmqvist  * Code or modification with rights to further distribute source must include
460174267aSFredrik Holmqvist  * the above Copyright Notice, the above License, this list of Conditions,
470174267aSFredrik Holmqvist  * and the following Disclaimer and Export Compliance provision. In addition,
480174267aSFredrik Holmqvist  * Licensee must cause all Covered Code to which Licensee contributes to
490174267aSFredrik Holmqvist  * contain a file documenting the changes Licensee made to create that Covered
500174267aSFredrik Holmqvist  * Code and the date of any change. Licensee must include in that file the
510174267aSFredrik Holmqvist  * documentation of any changes made by any predecessor Licensee. Licensee
520174267aSFredrik Holmqvist  * must include a prominent statement that the modification is derived,
530174267aSFredrik Holmqvist  * directly or indirectly, from Original Intel Code.
540174267aSFredrik Holmqvist  *
550174267aSFredrik Holmqvist  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
560174267aSFredrik Holmqvist  * Redistribution of source code of any substantial portion of the Covered
570174267aSFredrik Holmqvist  * Code or modification without rights to further distribute source must
580174267aSFredrik Holmqvist  * include the following Disclaimer and Export Compliance provision in the
590174267aSFredrik Holmqvist  * documentation and/or other materials provided with distribution. In
600174267aSFredrik Holmqvist  * addition, Licensee may not authorize further sublicense of source of any
610174267aSFredrik Holmqvist  * portion of the Covered Code, and must include terms to the effect that the
620174267aSFredrik Holmqvist  * license from Licensee to its licensee is limited to the intellectual
630174267aSFredrik Holmqvist  * property embodied in the software Licensee provides to its licensee, and
640174267aSFredrik Holmqvist  * not to intellectual property embodied in modifications its licensee may
650174267aSFredrik Holmqvist  * make.
660174267aSFredrik Holmqvist  *
670174267aSFredrik Holmqvist  * 3.3. Redistribution of Executable. Redistribution in executable form of any
680174267aSFredrik Holmqvist  * substantial portion of the Covered Code or modification must reproduce the
690174267aSFredrik Holmqvist  * above Copyright Notice, and the following Disclaimer and Export Compliance
700174267aSFredrik Holmqvist  * provision in the documentation and/or other materials provided with the
710174267aSFredrik Holmqvist  * distribution.
720174267aSFredrik Holmqvist  *
730174267aSFredrik Holmqvist  * 3.4. Intel retains all right, title, and interest in and to the Original
740174267aSFredrik Holmqvist  * Intel Code.
750174267aSFredrik Holmqvist  *
760174267aSFredrik Holmqvist  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
770174267aSFredrik Holmqvist  * Intel shall be used in advertising or otherwise to promote the sale, use or
780174267aSFredrik Holmqvist  * other dealings in products derived from or relating to the Covered Code
790174267aSFredrik Holmqvist  * without prior written authorization from Intel.
800174267aSFredrik Holmqvist  *
810174267aSFredrik Holmqvist  * 4. Disclaimer and Export Compliance
820174267aSFredrik Holmqvist  *
830174267aSFredrik Holmqvist  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
840174267aSFredrik Holmqvist  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
850174267aSFredrik Holmqvist  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
860174267aSFredrik Holmqvist  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
870174267aSFredrik Holmqvist  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
880174267aSFredrik Holmqvist  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
890174267aSFredrik Holmqvist  * PARTICULAR PURPOSE.
900174267aSFredrik Holmqvist  *
910174267aSFredrik Holmqvist  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
920174267aSFredrik Holmqvist  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
930174267aSFredrik Holmqvist  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
940174267aSFredrik Holmqvist  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
950174267aSFredrik Holmqvist  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
960174267aSFredrik Holmqvist  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
970174267aSFredrik Holmqvist  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
980174267aSFredrik Holmqvist  * LIMITED REMEDY.
990174267aSFredrik Holmqvist  *
1000174267aSFredrik Holmqvist  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1010174267aSFredrik Holmqvist  * software or system incorporating such software without first obtaining any
1020174267aSFredrik Holmqvist  * required license or other approval from the U. S. Department of Commerce or
1030174267aSFredrik Holmqvist  * any other agency or department of the United States Government. In the
1040174267aSFredrik Holmqvist  * event Licensee exports any such software from the United States or
1050174267aSFredrik Holmqvist  * re-exports any such software from a foreign destination, Licensee shall
1060174267aSFredrik Holmqvist  * ensure that the distribution and export/re-export of the software is in
1070174267aSFredrik Holmqvist  * compliance with all laws, regulations, orders, or other restrictions of the
1080174267aSFredrik Holmqvist  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1090174267aSFredrik Holmqvist  * any of its subsidiaries will export/re-export any technical data, process,
1100174267aSFredrik Holmqvist  * software, or service, directly or indirectly, to any country for which the
1110174267aSFredrik Holmqvist  * United States government or any agency thereof requires an export license,
1120174267aSFredrik Holmqvist  * other governmental approval, or letter of assurance, without first obtaining
1130174267aSFredrik Holmqvist  * such license, approval or letter.
1140174267aSFredrik Holmqvist  *
115ff2e2f81SFredrik Holmqvist  *****************************************************************************
116ff2e2f81SFredrik Holmqvist  *
117ff2e2f81SFredrik Holmqvist  * Alternatively, you may choose to be licensed under the terms of the
118ff2e2f81SFredrik Holmqvist  * following license:
119ff2e2f81SFredrik Holmqvist  *
120ff2e2f81SFredrik Holmqvist  * Redistribution and use in source and binary forms, with or without
121ff2e2f81SFredrik Holmqvist  * modification, are permitted provided that the following conditions
122ff2e2f81SFredrik Holmqvist  * are met:
123ff2e2f81SFredrik Holmqvist  * 1. Redistributions of source code must retain the above copyright
124ff2e2f81SFredrik Holmqvist  *    notice, this list of conditions, and the following disclaimer,
125ff2e2f81SFredrik Holmqvist  *    without modification.
126ff2e2f81SFredrik Holmqvist  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
127ff2e2f81SFredrik Holmqvist  *    substantially similar to the "NO WARRANTY" disclaimer below
128ff2e2f81SFredrik Holmqvist  *    ("Disclaimer") and any redistribution must be conditioned upon
129ff2e2f81SFredrik Holmqvist  *    including a substantially similar Disclaimer requirement for further
130ff2e2f81SFredrik Holmqvist  *    binary redistribution.
131ff2e2f81SFredrik Holmqvist  * 3. Neither the names of the above-listed copyright holders nor the names
132ff2e2f81SFredrik Holmqvist  *    of any contributors may be used to endorse or promote products derived
133ff2e2f81SFredrik Holmqvist  *    from this software without specific prior written permission.
134ff2e2f81SFredrik Holmqvist  *
135ff2e2f81SFredrik Holmqvist  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
136ff2e2f81SFredrik Holmqvist  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
137ff2e2f81SFredrik Holmqvist  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
138ff2e2f81SFredrik Holmqvist  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
139ff2e2f81SFredrik Holmqvist  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
140ff2e2f81SFredrik Holmqvist  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
141ff2e2f81SFredrik Holmqvist  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
142ff2e2f81SFredrik Holmqvist  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
143ff2e2f81SFredrik Holmqvist  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
144ff2e2f81SFredrik Holmqvist  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
145ff2e2f81SFredrik Holmqvist  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146ff2e2f81SFredrik Holmqvist  *
147ff2e2f81SFredrik Holmqvist  * Alternatively, you may choose to be licensed under the terms of the
148ff2e2f81SFredrik Holmqvist  * GNU General Public License ("GPL") version 2 as published by the Free
149ff2e2f81SFredrik Holmqvist  * Software Foundation.
150ff2e2f81SFredrik Holmqvist  *
1510174267aSFredrik Holmqvist  *****************************************************************************/
1520174267aSFredrik Holmqvist 
1530174267aSFredrik Holmqvist #include "acpi.h"
1540174267aSFredrik Holmqvist #include "accommon.h"
1550174267aSFredrik Holmqvist #include "acnamesp.h"
156c70258b7SJérôme Duval #include "acoutput.h"
1570174267aSFredrik Holmqvist 
1580174267aSFredrik Holmqvist 
1590174267aSFredrik Holmqvist #define _COMPONENT          ACPI_NAMESPACE
1600174267aSFredrik Holmqvist         ACPI_MODULE_NAME    ("nsdump")
1610174267aSFredrik Holmqvist 
1620174267aSFredrik Holmqvist /* Local prototypes */
1630174267aSFredrik Holmqvist 
1640174267aSFredrik Holmqvist #ifdef ACPI_OBSOLETE_FUNCTIONS
1650174267aSFredrik Holmqvist void
1660174267aSFredrik Holmqvist AcpiNsDumpRootDevices (
1670174267aSFredrik Holmqvist     void);
1680174267aSFredrik Holmqvist 
1690174267aSFredrik Holmqvist static ACPI_STATUS
1700174267aSFredrik Holmqvist AcpiNsDumpOneDevice (
1710174267aSFredrik Holmqvist     ACPI_HANDLE             ObjHandle,
1720174267aSFredrik Holmqvist     UINT32                  Level,
1730174267aSFredrik Holmqvist     void                    *Context,
1740174267aSFredrik Holmqvist     void                    **ReturnValue);
1750174267aSFredrik Holmqvist #endif
1760174267aSFredrik Holmqvist 
1770174267aSFredrik Holmqvist 
1780174267aSFredrik Holmqvist #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
179c70258b7SJérôme Duval 
180c70258b7SJérôme Duval static ACPI_STATUS
181c70258b7SJérôme Duval AcpiNsDumpOneObjectPath (
182c70258b7SJérôme Duval     ACPI_HANDLE             ObjHandle,
183c70258b7SJérôme Duval     UINT32                  Level,
184c70258b7SJérôme Duval     void                    *Context,
185c70258b7SJérôme Duval     void                    **ReturnValue);
186c70258b7SJérôme Duval 
187c70258b7SJérôme Duval static ACPI_STATUS
188c70258b7SJérôme Duval AcpiNsGetMaxDepth (
189c70258b7SJérôme Duval     ACPI_HANDLE             ObjHandle,
190c70258b7SJérôme Duval     UINT32                  Level,
191c70258b7SJérôme Duval     void                    *Context,
192c70258b7SJérôme Duval     void                    **ReturnValue);
193c70258b7SJérôme Duval 
194c70258b7SJérôme Duval 
1950174267aSFredrik Holmqvist /*******************************************************************************
1960174267aSFredrik Holmqvist  *
1970174267aSFredrik Holmqvist  * FUNCTION:    AcpiNsPrintPathname
1980174267aSFredrik Holmqvist  *
1990174267aSFredrik Holmqvist  * PARAMETERS:  NumSegments         - Number of ACPI name segments
2000174267aSFredrik Holmqvist  *              Pathname            - The compressed (internal) path
2010174267aSFredrik Holmqvist  *
2020174267aSFredrik Holmqvist  * RETURN:      None
2030174267aSFredrik Holmqvist  *
2040174267aSFredrik Holmqvist  * DESCRIPTION: Print an object's full namespace pathname
2050174267aSFredrik Holmqvist  *
2060174267aSFredrik Holmqvist  ******************************************************************************/
2070174267aSFredrik Holmqvist 
2080174267aSFredrik Holmqvist void
AcpiNsPrintPathname(UINT32 NumSegments,const char * Pathname)2090174267aSFredrik Holmqvist AcpiNsPrintPathname (
2100174267aSFredrik Holmqvist     UINT32                  NumSegments,
21174ffd18dSFredrik Holmqvist     const char              *Pathname)
2120174267aSFredrik Holmqvist {
2130174267aSFredrik Holmqvist     UINT32                  i;
2140174267aSFredrik Holmqvist 
2150174267aSFredrik Holmqvist 
2160174267aSFredrik Holmqvist     ACPI_FUNCTION_NAME (NsPrintPathname);
2170174267aSFredrik Holmqvist 
2180174267aSFredrik Holmqvist 
219c70258b7SJérôme Duval     /* Check if debug output enabled */
220c70258b7SJérôme Duval 
221c70258b7SJérôme Duval     if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
2220174267aSFredrik Holmqvist     {
2230174267aSFredrik Holmqvist         return;
2240174267aSFredrik Holmqvist     }
2250174267aSFredrik Holmqvist 
2260174267aSFredrik Holmqvist     /* Print the entire name */
2270174267aSFredrik Holmqvist 
2280174267aSFredrik Holmqvist     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
2290174267aSFredrik Holmqvist 
2300174267aSFredrik Holmqvist     while (NumSegments)
2310174267aSFredrik Holmqvist     {
2320174267aSFredrik Holmqvist         for (i = 0; i < 4; i++)
2330174267aSFredrik Holmqvist         {
234e226d1d0SFredrik Holmqvist             isprint ((int) Pathname[i]) ?
2350174267aSFredrik Holmqvist                 AcpiOsPrintf ("%c", Pathname[i]) :
2360174267aSFredrik Holmqvist                 AcpiOsPrintf ("?");
2370174267aSFredrik Holmqvist         }
2380174267aSFredrik Holmqvist 
2390ffed378SFredrik Holmqvist         Pathname += ACPI_NAMESEG_SIZE;
2400174267aSFredrik Holmqvist         NumSegments--;
2410174267aSFredrik Holmqvist         if (NumSegments)
2420174267aSFredrik Holmqvist         {
2430174267aSFredrik Holmqvist             AcpiOsPrintf (".");
2440174267aSFredrik Holmqvist         }
2450174267aSFredrik Holmqvist     }
2460174267aSFredrik Holmqvist 
2470174267aSFredrik Holmqvist     AcpiOsPrintf ("]\n");
2480174267aSFredrik Holmqvist }
2490174267aSFredrik Holmqvist 
2500174267aSFredrik Holmqvist 
25174ffd18dSFredrik Holmqvist #ifdef ACPI_OBSOLETE_FUNCTIONS
25274ffd18dSFredrik Holmqvist /* Not used at this time, perhaps later */
25374ffd18dSFredrik Holmqvist 
2540174267aSFredrik Holmqvist /*******************************************************************************
2550174267aSFredrik Holmqvist  *
2560174267aSFredrik Holmqvist  * FUNCTION:    AcpiNsDumpPathname
2570174267aSFredrik Holmqvist  *
2580174267aSFredrik Holmqvist  * PARAMETERS:  Handle              - Object
2590174267aSFredrik Holmqvist  *              Msg                 - Prefix message
2600174267aSFredrik Holmqvist  *              Level               - Desired debug level
2610174267aSFredrik Holmqvist  *              Component           - Caller's component ID
2620174267aSFredrik Holmqvist  *
2630174267aSFredrik Holmqvist  * RETURN:      None
2640174267aSFredrik Holmqvist  *
2650174267aSFredrik Holmqvist  * DESCRIPTION: Print an object's full namespace pathname
2660174267aSFredrik Holmqvist  *              Manages allocation/freeing of a pathname buffer
2670174267aSFredrik Holmqvist  *
2680174267aSFredrik Holmqvist  ******************************************************************************/
2690174267aSFredrik Holmqvist 
2700174267aSFredrik Holmqvist void
AcpiNsDumpPathname(ACPI_HANDLE Handle,const char * Msg,UINT32 Level,UINT32 Component)2710174267aSFredrik Holmqvist AcpiNsDumpPathname (
2720174267aSFredrik Holmqvist     ACPI_HANDLE             Handle,
27374ffd18dSFredrik Holmqvist     const char              *Msg,
2740174267aSFredrik Holmqvist     UINT32                  Level,
2750174267aSFredrik Holmqvist     UINT32                  Component)
2760174267aSFredrik Holmqvist {
2770174267aSFredrik Holmqvist 
2780174267aSFredrik Holmqvist     ACPI_FUNCTION_TRACE (NsDumpPathname);
2790174267aSFredrik Holmqvist 
2800174267aSFredrik Holmqvist 
2810174267aSFredrik Holmqvist     /* Do this only if the requested debug level and component are enabled */
2820174267aSFredrik Holmqvist 
283c70258b7SJérôme Duval     if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
2840174267aSFredrik Holmqvist     {
2850174267aSFredrik Holmqvist         return_VOID;
2860174267aSFredrik Holmqvist     }
2870174267aSFredrik Holmqvist 
2880174267aSFredrik Holmqvist     /* Convert handle to a full pathname and print it (with supplied message) */
2890174267aSFredrik Holmqvist 
2900174267aSFredrik Holmqvist     AcpiNsPrintNodePathname (Handle, Msg);
2910174267aSFredrik Holmqvist     AcpiOsPrintf ("\n");
2920174267aSFredrik Holmqvist     return_VOID;
2930174267aSFredrik Holmqvist }
29474ffd18dSFredrik Holmqvist #endif
2950174267aSFredrik Holmqvist 
29608c9948cSFredrik Holmqvist 
2970174267aSFredrik Holmqvist /*******************************************************************************
2980174267aSFredrik Holmqvist  *
2990174267aSFredrik Holmqvist  * FUNCTION:    AcpiNsDumpOneObject
3000174267aSFredrik Holmqvist  *
3010174267aSFredrik Holmqvist  * PARAMETERS:  ObjHandle           - Node to be dumped
3020174267aSFredrik Holmqvist  *              Level               - Nesting level of the handle
3030174267aSFredrik Holmqvist  *              Context             - Passed into WalkNamespace
3040174267aSFredrik Holmqvist  *              ReturnValue         - Not used
3050174267aSFredrik Holmqvist  *
3060174267aSFredrik Holmqvist  * RETURN:      Status
3070174267aSFredrik Holmqvist  *
3080174267aSFredrik Holmqvist  * DESCRIPTION: Dump a single Node
3090174267aSFredrik Holmqvist  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
3100174267aSFredrik Holmqvist  *
3110174267aSFredrik Holmqvist  ******************************************************************************/
3120174267aSFredrik Holmqvist 
3130174267aSFredrik Holmqvist ACPI_STATUS
AcpiNsDumpOneObject(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)3140174267aSFredrik Holmqvist AcpiNsDumpOneObject (
3150174267aSFredrik Holmqvist     ACPI_HANDLE             ObjHandle,
3160174267aSFredrik Holmqvist     UINT32                  Level,
3170174267aSFredrik Holmqvist     void                    *Context,
3180174267aSFredrik Holmqvist     void                    **ReturnValue)
3190174267aSFredrik Holmqvist {
3200174267aSFredrik Holmqvist     ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
3210174267aSFredrik Holmqvist     ACPI_NAMESPACE_NODE     *ThisNode;
3220174267aSFredrik Holmqvist     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
3230174267aSFredrik Holmqvist     ACPI_OBJECT_TYPE        ObjType;
3240174267aSFredrik Holmqvist     ACPI_OBJECT_TYPE        Type;
3250174267aSFredrik Holmqvist     UINT32                  BytesToDump;
3260174267aSFredrik Holmqvist     UINT32                  DbgLevel;
3270174267aSFredrik Holmqvist     UINT32                  i;
3280174267aSFredrik Holmqvist 
3290174267aSFredrik Holmqvist 
3300174267aSFredrik Holmqvist     ACPI_FUNCTION_NAME (NsDumpOneObject);
3310174267aSFredrik Holmqvist 
3320174267aSFredrik Holmqvist 
3330174267aSFredrik Holmqvist     /* Is output enabled? */
3340174267aSFredrik Holmqvist 
3350174267aSFredrik Holmqvist     if (!(AcpiDbgLevel & Info->DebugLevel))
3360174267aSFredrik Holmqvist     {
3370174267aSFredrik Holmqvist         return (AE_OK);
3380174267aSFredrik Holmqvist     }
3390174267aSFredrik Holmqvist 
3400174267aSFredrik Holmqvist     if (!ObjHandle)
3410174267aSFredrik Holmqvist     {
3420174267aSFredrik Holmqvist         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
3430174267aSFredrik Holmqvist         return (AE_OK);
3440174267aSFredrik Holmqvist     }
3450174267aSFredrik Holmqvist 
3460174267aSFredrik Holmqvist     ThisNode = AcpiNsValidateHandle (ObjHandle);
3470174267aSFredrik Holmqvist     if (!ThisNode)
3480174267aSFredrik Holmqvist     {
3490174267aSFredrik Holmqvist         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
3500174267aSFredrik Holmqvist             ObjHandle));
3510174267aSFredrik Holmqvist         return (AE_OK);
3520174267aSFredrik Holmqvist     }
3530174267aSFredrik Holmqvist 
3540174267aSFredrik Holmqvist     Type = ThisNode->Type;
35508c9948cSFredrik Holmqvist     Info->Count++;
3560174267aSFredrik Holmqvist 
3570174267aSFredrik Holmqvist     /* Check if the owner matches */
3580174267aSFredrik Holmqvist 
3590174267aSFredrik Holmqvist     if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
3600174267aSFredrik Holmqvist         (Info->OwnerId != ThisNode->OwnerId))
3610174267aSFredrik Holmqvist     {
3620174267aSFredrik Holmqvist         return (AE_OK);
3630174267aSFredrik Holmqvist     }
3640174267aSFredrik Holmqvist 
3650174267aSFredrik Holmqvist     if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
3660174267aSFredrik Holmqvist     {
3670174267aSFredrik Holmqvist         /* Indent the object according to the level */
3680174267aSFredrik Holmqvist 
3690174267aSFredrik Holmqvist         AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
3700174267aSFredrik Holmqvist 
3710174267aSFredrik Holmqvist         /* Check the node type and name */
3720174267aSFredrik Holmqvist 
3730174267aSFredrik Holmqvist         if (Type > ACPI_TYPE_LOCAL_MAX)
3740174267aSFredrik Holmqvist         {
375b64e8511SFredrik Holmqvist             ACPI_WARNING ((AE_INFO,
376b64e8511SFredrik Holmqvist                 "Invalid ACPI Object Type 0x%08X", Type));
3770174267aSFredrik Holmqvist         }
3780174267aSFredrik Holmqvist 
3790174267aSFredrik Holmqvist         AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
3800174267aSFredrik Holmqvist     }
3810174267aSFredrik Holmqvist 
3820174267aSFredrik Holmqvist     /* Now we can print out the pertinent information */
3830174267aSFredrik Holmqvist 
3840ffed378SFredrik Holmqvist     AcpiOsPrintf (" %-12s %p %3.3X ",
3850174267aSFredrik Holmqvist         AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
3860174267aSFredrik Holmqvist 
3870174267aSFredrik Holmqvist     DbgLevel = AcpiDbgLevel;
3880174267aSFredrik Holmqvist     AcpiDbgLevel = 0;
3890174267aSFredrik Holmqvist     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
3900174267aSFredrik Holmqvist     AcpiDbgLevel = DbgLevel;
3910174267aSFredrik Holmqvist 
3920174267aSFredrik Holmqvist     /* Temp nodes are those nodes created by a control method */
3930174267aSFredrik Holmqvist 
3940174267aSFredrik Holmqvist     if (ThisNode->Flags & ANOBJ_TEMPORARY)
3950174267aSFredrik Holmqvist     {
3960174267aSFredrik Holmqvist         AcpiOsPrintf ("(T) ");
3970174267aSFredrik Holmqvist     }
3980174267aSFredrik Holmqvist 
3990174267aSFredrik Holmqvist     switch (Info->DisplayType & ACPI_DISPLAY_MASK)
4000174267aSFredrik Holmqvist     {
4010174267aSFredrik Holmqvist     case ACPI_DISPLAY_SUMMARY:
4020174267aSFredrik Holmqvist 
4030174267aSFredrik Holmqvist         if (!ObjDesc)
4040174267aSFredrik Holmqvist         {
4056822cda0SFredrik Holmqvist             /* No attached object. Some types should always have an object */
4066822cda0SFredrik Holmqvist 
4076822cda0SFredrik Holmqvist             switch (Type)
4086822cda0SFredrik Holmqvist             {
4096822cda0SFredrik Holmqvist             case ACPI_TYPE_INTEGER:
4106822cda0SFredrik Holmqvist             case ACPI_TYPE_PACKAGE:
4116822cda0SFredrik Holmqvist             case ACPI_TYPE_BUFFER:
4126822cda0SFredrik Holmqvist             case ACPI_TYPE_STRING:
4136822cda0SFredrik Holmqvist             case ACPI_TYPE_METHOD:
414c70258b7SJérôme Duval 
4156822cda0SFredrik Holmqvist                 AcpiOsPrintf ("<No attached object>");
4166822cda0SFredrik Holmqvist                 break;
4176822cda0SFredrik Holmqvist 
4186822cda0SFredrik Holmqvist             default:
419c70258b7SJérôme Duval 
4206822cda0SFredrik Holmqvist                 break;
4216822cda0SFredrik Holmqvist             }
4220174267aSFredrik Holmqvist 
4230174267aSFredrik Holmqvist             AcpiOsPrintf ("\n");
4240174267aSFredrik Holmqvist             return (AE_OK);
4250174267aSFredrik Holmqvist         }
4260174267aSFredrik Holmqvist 
4270174267aSFredrik Holmqvist         switch (Type)
4280174267aSFredrik Holmqvist         {
4290174267aSFredrik Holmqvist         case ACPI_TYPE_PROCESSOR:
4300174267aSFredrik Holmqvist 
431e226d1d0SFredrik Holmqvist             AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
4320174267aSFredrik Holmqvist                 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
433e226d1d0SFredrik Holmqvist                 ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address));
4340174267aSFredrik Holmqvist             break;
4350174267aSFredrik Holmqvist 
4360174267aSFredrik Holmqvist         case ACPI_TYPE_DEVICE:
4370174267aSFredrik Holmqvist 
4380174267aSFredrik Holmqvist             AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
4390174267aSFredrik Holmqvist             break;
4400174267aSFredrik Holmqvist 
4410174267aSFredrik Holmqvist         case ACPI_TYPE_METHOD:
4420174267aSFredrik Holmqvist 
4430174267aSFredrik Holmqvist             AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
4440174267aSFredrik Holmqvist                 (UINT32) ObjDesc->Method.ParamCount,
4450174267aSFredrik Holmqvist                 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
4460174267aSFredrik Holmqvist             break;
4470174267aSFredrik Holmqvist 
4480174267aSFredrik Holmqvist         case ACPI_TYPE_INTEGER:
4490174267aSFredrik Holmqvist 
4500174267aSFredrik Holmqvist             AcpiOsPrintf ("= %8.8X%8.8X\n",
4510174267aSFredrik Holmqvist                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
4520174267aSFredrik Holmqvist             break;
4530174267aSFredrik Holmqvist 
4540174267aSFredrik Holmqvist         case ACPI_TYPE_PACKAGE:
4550174267aSFredrik Holmqvist 
4560174267aSFredrik Holmqvist             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
4570174267aSFredrik Holmqvist             {
4580174267aSFredrik Holmqvist                 AcpiOsPrintf ("Elements %.2X\n",
4590174267aSFredrik Holmqvist                     ObjDesc->Package.Count);
4600174267aSFredrik Holmqvist             }
4610174267aSFredrik Holmqvist             else
4620174267aSFredrik Holmqvist             {
4630174267aSFredrik Holmqvist                 AcpiOsPrintf ("[Length not yet evaluated]\n");
4640174267aSFredrik Holmqvist             }
4650174267aSFredrik Holmqvist             break;
4660174267aSFredrik Holmqvist 
4670174267aSFredrik Holmqvist         case ACPI_TYPE_BUFFER:
4680174267aSFredrik Holmqvist 
4690174267aSFredrik Holmqvist             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
4700174267aSFredrik Holmqvist             {
4710174267aSFredrik Holmqvist                 AcpiOsPrintf ("Len %.2X",
4720174267aSFredrik Holmqvist                     ObjDesc->Buffer.Length);
4730174267aSFredrik Holmqvist 
4740174267aSFredrik Holmqvist                 /* Dump some of the buffer */
4750174267aSFredrik Holmqvist 
4760174267aSFredrik Holmqvist                 if (ObjDesc->Buffer.Length > 0)
4770174267aSFredrik Holmqvist                 {
4780174267aSFredrik Holmqvist                     AcpiOsPrintf (" =");
4790174267aSFredrik Holmqvist                     for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
4800174267aSFredrik Holmqvist                     {
4810ffed378SFredrik Holmqvist                         AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
4820174267aSFredrik Holmqvist                     }
4830174267aSFredrik Holmqvist                 }
4840174267aSFredrik Holmqvist                 AcpiOsPrintf ("\n");
4850174267aSFredrik Holmqvist             }
4860174267aSFredrik Holmqvist             else
4870174267aSFredrik Holmqvist             {
4880174267aSFredrik Holmqvist                 AcpiOsPrintf ("[Length not yet evaluated]\n");
4890174267aSFredrik Holmqvist             }
4900174267aSFredrik Holmqvist             break;
4910174267aSFredrik Holmqvist 
4920174267aSFredrik Holmqvist         case ACPI_TYPE_STRING:
4930174267aSFredrik Holmqvist 
4940174267aSFredrik Holmqvist             AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
49574ffd18dSFredrik Holmqvist             AcpiUtPrintString (ObjDesc->String.Pointer, 80);
4960174267aSFredrik Holmqvist             AcpiOsPrintf ("\n");
4970174267aSFredrik Holmqvist             break;
4980174267aSFredrik Holmqvist 
4990174267aSFredrik Holmqvist         case ACPI_TYPE_REGION:
5000174267aSFredrik Holmqvist 
5010174267aSFredrik Holmqvist             AcpiOsPrintf ("[%s]",
5020174267aSFredrik Holmqvist                 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
5030174267aSFredrik Holmqvist             if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
5040174267aSFredrik Holmqvist             {
5050174267aSFredrik Holmqvist                 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
506e226d1d0SFredrik Holmqvist                     ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
5070174267aSFredrik Holmqvist                     ObjDesc->Region.Length);
5080174267aSFredrik Holmqvist             }
5090174267aSFredrik Holmqvist             else
5100174267aSFredrik Holmqvist             {
5110174267aSFredrik Holmqvist                 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
5120174267aSFredrik Holmqvist             }
5130174267aSFredrik Holmqvist             break;
5140174267aSFredrik Holmqvist 
5150174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_REFERENCE:
5160174267aSFredrik Holmqvist 
5170174267aSFredrik Holmqvist             AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
5180174267aSFredrik Holmqvist             break;
5190174267aSFredrik Holmqvist 
5200174267aSFredrik Holmqvist         case ACPI_TYPE_BUFFER_FIELD:
5210174267aSFredrik Holmqvist 
5220174267aSFredrik Holmqvist             if (ObjDesc->BufferField.BufferObj &&
5230174267aSFredrik Holmqvist                 ObjDesc->BufferField.BufferObj->Buffer.Node)
5240174267aSFredrik Holmqvist             {
5250174267aSFredrik Holmqvist                 AcpiOsPrintf ("Buf [%4.4s]",
5260174267aSFredrik Holmqvist                     AcpiUtGetNodeName (
5270174267aSFredrik Holmqvist                         ObjDesc->BufferField.BufferObj->Buffer.Node));
5280174267aSFredrik Holmqvist             }
5290174267aSFredrik Holmqvist             break;
5300174267aSFredrik Holmqvist 
5310174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_REGION_FIELD:
5320174267aSFredrik Holmqvist 
5330174267aSFredrik Holmqvist             AcpiOsPrintf ("Rgn [%4.4s]",
5340174267aSFredrik Holmqvist                 AcpiUtGetNodeName (
5350174267aSFredrik Holmqvist                     ObjDesc->CommonField.RegionObj->Region.Node));
5360174267aSFredrik Holmqvist             break;
5370174267aSFredrik Holmqvist 
5380174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_BANK_FIELD:
5390174267aSFredrik Holmqvist 
5400174267aSFredrik Holmqvist             AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
5410174267aSFredrik Holmqvist                 AcpiUtGetNodeName (
5420174267aSFredrik Holmqvist                     ObjDesc->CommonField.RegionObj->Region.Node),
5430174267aSFredrik Holmqvist                 AcpiUtGetNodeName (
5440174267aSFredrik Holmqvist                     ObjDesc->BankField.BankObj->CommonField.Node));
5450174267aSFredrik Holmqvist             break;
5460174267aSFredrik Holmqvist 
5470174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_INDEX_FIELD:
5480174267aSFredrik Holmqvist 
5490174267aSFredrik Holmqvist             AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
5500174267aSFredrik Holmqvist                 AcpiUtGetNodeName (
5510174267aSFredrik Holmqvist                     ObjDesc->IndexField.IndexObj->CommonField.Node),
5520174267aSFredrik Holmqvist                 AcpiUtGetNodeName (
5530174267aSFredrik Holmqvist                     ObjDesc->IndexField.DataObj->CommonField.Node));
5540174267aSFredrik Holmqvist             break;
5550174267aSFredrik Holmqvist 
5560174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_ALIAS:
5570174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_METHOD_ALIAS:
5580174267aSFredrik Holmqvist 
5590174267aSFredrik Holmqvist             AcpiOsPrintf ("Target %4.4s (%p)\n",
5600174267aSFredrik Holmqvist                 AcpiUtGetNodeName (ObjDesc), ObjDesc);
5610174267aSFredrik Holmqvist             break;
5620174267aSFredrik Holmqvist 
5630174267aSFredrik Holmqvist         default:
5640174267aSFredrik Holmqvist 
5650174267aSFredrik Holmqvist             AcpiOsPrintf ("Object %p\n", ObjDesc);
5660174267aSFredrik Holmqvist             break;
5670174267aSFredrik Holmqvist         }
5680174267aSFredrik Holmqvist 
5690174267aSFredrik Holmqvist         /* Common field handling */
5700174267aSFredrik Holmqvist 
5710174267aSFredrik Holmqvist         switch (Type)
5720174267aSFredrik Holmqvist         {
5730174267aSFredrik Holmqvist         case ACPI_TYPE_BUFFER_FIELD:
5740174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_REGION_FIELD:
5750174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_BANK_FIELD:
5760174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_INDEX_FIELD:
5770174267aSFredrik Holmqvist 
5780ffed378SFredrik Holmqvist             AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2X\n",
5790174267aSFredrik Holmqvist                 (ObjDesc->CommonField.BaseByteOffset * 8)
5800174267aSFredrik Holmqvist                     + ObjDesc->CommonField.StartFieldBitOffset,
5810174267aSFredrik Holmqvist                 ObjDesc->CommonField.BitLength,
5820174267aSFredrik Holmqvist                 ObjDesc->CommonField.AccessByteWidth);
5830174267aSFredrik Holmqvist             break;
5840174267aSFredrik Holmqvist 
5850174267aSFredrik Holmqvist         default:
586c70258b7SJérôme Duval 
5870174267aSFredrik Holmqvist             break;
5880174267aSFredrik Holmqvist         }
5890174267aSFredrik Holmqvist         break;
5900174267aSFredrik Holmqvist 
5910174267aSFredrik Holmqvist     case ACPI_DISPLAY_OBJECTS:
5920174267aSFredrik Holmqvist 
5930174267aSFredrik Holmqvist         AcpiOsPrintf ("O:%p", ObjDesc);
5940174267aSFredrik Holmqvist         if (!ObjDesc)
5950174267aSFredrik Holmqvist         {
5960174267aSFredrik Holmqvist             /* No attached object, we are done */
5970174267aSFredrik Holmqvist 
5980174267aSFredrik Holmqvist             AcpiOsPrintf ("\n");
5990174267aSFredrik Holmqvist             return (AE_OK);
6000174267aSFredrik Holmqvist         }
6010174267aSFredrik Holmqvist 
6020174267aSFredrik Holmqvist         AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
6030174267aSFredrik Holmqvist 
6040174267aSFredrik Holmqvist         switch (Type)
6050174267aSFredrik Holmqvist         {
6060174267aSFredrik Holmqvist         case ACPI_TYPE_METHOD:
6070174267aSFredrik Holmqvist 
6080174267aSFredrik Holmqvist             /* Name is a Method and its AML offset/length are set */
6090174267aSFredrik Holmqvist 
6100174267aSFredrik Holmqvist             AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
6110174267aSFredrik Holmqvist                 ObjDesc->Method.AmlLength);
6120174267aSFredrik Holmqvist             break;
6130174267aSFredrik Holmqvist 
6140174267aSFredrik Holmqvist         case ACPI_TYPE_INTEGER:
6150174267aSFredrik Holmqvist 
6160174267aSFredrik Holmqvist             AcpiOsPrintf (" I:%8.8X8.8%X\n",
6170174267aSFredrik Holmqvist                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
6180174267aSFredrik Holmqvist             break;
6190174267aSFredrik Holmqvist 
6200174267aSFredrik Holmqvist         case ACPI_TYPE_STRING:
6210174267aSFredrik Holmqvist 
6220174267aSFredrik Holmqvist             AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
6230174267aSFredrik Holmqvist                 ObjDesc->String.Length);
6240174267aSFredrik Holmqvist             break;
6250174267aSFredrik Holmqvist 
6260174267aSFredrik Holmqvist         case ACPI_TYPE_BUFFER:
6270174267aSFredrik Holmqvist 
6280174267aSFredrik Holmqvist             AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
6290174267aSFredrik Holmqvist                 ObjDesc->Buffer.Length);
6300174267aSFredrik Holmqvist             break;
6310174267aSFredrik Holmqvist 
6320174267aSFredrik Holmqvist         default:
6330174267aSFredrik Holmqvist 
6340174267aSFredrik Holmqvist             AcpiOsPrintf ("\n");
6350174267aSFredrik Holmqvist             break;
6360174267aSFredrik Holmqvist         }
6370174267aSFredrik Holmqvist         break;
6380174267aSFredrik Holmqvist 
6390174267aSFredrik Holmqvist     default:
6400174267aSFredrik Holmqvist         AcpiOsPrintf ("\n");
6410174267aSFredrik Holmqvist         break;
6420174267aSFredrik Holmqvist     }
6430174267aSFredrik Holmqvist 
6440174267aSFredrik Holmqvist     /* If debug turned off, done */
6450174267aSFredrik Holmqvist 
6460174267aSFredrik Holmqvist     if (!(AcpiDbgLevel & ACPI_LV_VALUES))
6470174267aSFredrik Holmqvist     {
6480174267aSFredrik Holmqvist         return (AE_OK);
6490174267aSFredrik Holmqvist     }
6500174267aSFredrik Holmqvist 
6510174267aSFredrik Holmqvist     /* If there is an attached object, display it */
6520174267aSFredrik Holmqvist 
6530174267aSFredrik Holmqvist     DbgLevel = AcpiDbgLevel;
6540174267aSFredrik Holmqvist     AcpiDbgLevel = 0;
6550174267aSFredrik Holmqvist     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
6560174267aSFredrik Holmqvist     AcpiDbgLevel = DbgLevel;
6570174267aSFredrik Holmqvist 
6580174267aSFredrik Holmqvist     /* Dump attached objects */
6590174267aSFredrik Holmqvist 
6600174267aSFredrik Holmqvist     while (ObjDesc)
6610174267aSFredrik Holmqvist     {
6620174267aSFredrik Holmqvist         ObjType = ACPI_TYPE_INVALID;
6630174267aSFredrik Holmqvist         AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
6640174267aSFredrik Holmqvist 
6650174267aSFredrik Holmqvist         /* Decode the type of attached object and dump the contents */
6660174267aSFredrik Holmqvist 
6670174267aSFredrik Holmqvist         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
6680174267aSFredrik Holmqvist         {
6690174267aSFredrik Holmqvist         case ACPI_DESC_TYPE_NAMED:
6700174267aSFredrik Holmqvist 
6710174267aSFredrik Holmqvist             AcpiOsPrintf ("(Ptr to Node)\n");
6720174267aSFredrik Holmqvist             BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
6730174267aSFredrik Holmqvist             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
6740174267aSFredrik Holmqvist             break;
6750174267aSFredrik Holmqvist 
6760174267aSFredrik Holmqvist         case ACPI_DESC_TYPE_OPERAND:
6770174267aSFredrik Holmqvist 
6780174267aSFredrik Holmqvist             ObjType = ObjDesc->Common.Type;
6790174267aSFredrik Holmqvist 
6800174267aSFredrik Holmqvist             if (ObjType > ACPI_TYPE_LOCAL_MAX)
6810174267aSFredrik Holmqvist             {
682b64e8511SFredrik Holmqvist                 AcpiOsPrintf (
683b64e8511SFredrik Holmqvist                     "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
6840174267aSFredrik Holmqvist                     ObjType);
685b64e8511SFredrik Holmqvist 
6860174267aSFredrik Holmqvist                 BytesToDump = 32;
6870174267aSFredrik Holmqvist             }
6880174267aSFredrik Holmqvist             else
6890174267aSFredrik Holmqvist             {
690b64e8511SFredrik Holmqvist                 AcpiOsPrintf (
691b64e8511SFredrik Holmqvist                     "(Pointer to ACPI Object type %.2X [%s])\n",
6920174267aSFredrik Holmqvist                     ObjType, AcpiUtGetTypeName (ObjType));
693b64e8511SFredrik Holmqvist 
6940174267aSFredrik Holmqvist                 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
6950174267aSFredrik Holmqvist             }
6960174267aSFredrik Holmqvist 
6970174267aSFredrik Holmqvist             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
6980174267aSFredrik Holmqvist             break;
6990174267aSFredrik Holmqvist 
7000174267aSFredrik Holmqvist         default:
7010174267aSFredrik Holmqvist 
7020174267aSFredrik Holmqvist             break;
7030174267aSFredrik Holmqvist         }
7040174267aSFredrik Holmqvist 
7050174267aSFredrik Holmqvist         /* If value is NOT an internal object, we are done */
7060174267aSFredrik Holmqvist 
7070174267aSFredrik Holmqvist         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
7080174267aSFredrik Holmqvist         {
7090174267aSFredrik Holmqvist             goto Cleanup;
7100174267aSFredrik Holmqvist         }
7110174267aSFredrik Holmqvist 
7120174267aSFredrik Holmqvist         /* Valid object, get the pointer to next level, if any */
7130174267aSFredrik Holmqvist 
7140174267aSFredrik Holmqvist         switch (ObjType)
7150174267aSFredrik Holmqvist         {
7160174267aSFredrik Holmqvist         case ACPI_TYPE_BUFFER:
7170174267aSFredrik Holmqvist         case ACPI_TYPE_STRING:
7180174267aSFredrik Holmqvist             /*
7190174267aSFredrik Holmqvist              * NOTE: takes advantage of common fields between string/buffer
7200174267aSFredrik Holmqvist              */
7210174267aSFredrik Holmqvist             BytesToDump = ObjDesc->String.Length;
7220174267aSFredrik Holmqvist             ObjDesc = (void *) ObjDesc->String.Pointer;
723b64e8511SFredrik Holmqvist 
7240174267aSFredrik Holmqvist             AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n",
7250174267aSFredrik Holmqvist                 ObjDesc, BytesToDump);
7260174267aSFredrik Holmqvist             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
7270174267aSFredrik Holmqvist             goto Cleanup;
7280174267aSFredrik Holmqvist 
7290174267aSFredrik Holmqvist         case ACPI_TYPE_BUFFER_FIELD:
730c70258b7SJérôme Duval 
7310174267aSFredrik Holmqvist             ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
7320174267aSFredrik Holmqvist             break;
7330174267aSFredrik Holmqvist 
7340174267aSFredrik Holmqvist         case ACPI_TYPE_PACKAGE:
735c70258b7SJérôme Duval 
7360174267aSFredrik Holmqvist             ObjDesc = (void *) ObjDesc->Package.Elements;
7370174267aSFredrik Holmqvist             break;
7380174267aSFredrik Holmqvist 
7390174267aSFredrik Holmqvist         case ACPI_TYPE_METHOD:
740c70258b7SJérôme Duval 
7410174267aSFredrik Holmqvist             ObjDesc = (void *) ObjDesc->Method.AmlStart;
7420174267aSFredrik Holmqvist             break;
7430174267aSFredrik Holmqvist 
7440174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_REGION_FIELD:
745c70258b7SJérôme Duval 
7460174267aSFredrik Holmqvist             ObjDesc = (void *) ObjDesc->Field.RegionObj;
7470174267aSFredrik Holmqvist             break;
7480174267aSFredrik Holmqvist 
7490174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_BANK_FIELD:
750c70258b7SJérôme Duval 
7510174267aSFredrik Holmqvist             ObjDesc = (void *) ObjDesc->BankField.RegionObj;
7520174267aSFredrik Holmqvist             break;
7530174267aSFredrik Holmqvist 
7540174267aSFredrik Holmqvist         case ACPI_TYPE_LOCAL_INDEX_FIELD:
755c70258b7SJérôme Duval 
7560174267aSFredrik Holmqvist             ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
7570174267aSFredrik Holmqvist             break;
7580174267aSFredrik Holmqvist 
7590174267aSFredrik Holmqvist         default:
760c70258b7SJérôme Duval 
7610174267aSFredrik Holmqvist             goto Cleanup;
7620174267aSFredrik Holmqvist         }
7630174267aSFredrik Holmqvist     }
7640174267aSFredrik Holmqvist 
7650174267aSFredrik Holmqvist Cleanup:
7660174267aSFredrik Holmqvist     AcpiOsPrintf ("\n");
7670174267aSFredrik Holmqvist     return (AE_OK);
7680174267aSFredrik Holmqvist }
7690174267aSFredrik Holmqvist 
7700174267aSFredrik Holmqvist 
7710174267aSFredrik Holmqvist /*******************************************************************************
7720174267aSFredrik Holmqvist  *
7730174267aSFredrik Holmqvist  * FUNCTION:    AcpiNsDumpObjects
7740174267aSFredrik Holmqvist  *
7750174267aSFredrik Holmqvist  * PARAMETERS:  Type                - Object type to be dumped
7760174267aSFredrik Holmqvist  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
7770174267aSFredrik Holmqvist  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
7780174267aSFredrik Holmqvist  *                                    for an effectively unlimited depth.
7790174267aSFredrik Holmqvist  *              OwnerId             - Dump only objects owned by this ID. Use
7800174267aSFredrik Holmqvist  *                                    ACPI_UINT32_MAX to match all owners.
7810174267aSFredrik Holmqvist  *              StartHandle         - Where in namespace to start/end search
7820174267aSFredrik Holmqvist  *
7830174267aSFredrik Holmqvist  * RETURN:      None
7840174267aSFredrik Holmqvist  *
7850174267aSFredrik Holmqvist  * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
7860174267aSFredrik Holmqvist  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
7870174267aSFredrik Holmqvist  *
7880174267aSFredrik Holmqvist  ******************************************************************************/
7890174267aSFredrik Holmqvist 
7900174267aSFredrik Holmqvist void
AcpiNsDumpObjects(ACPI_OBJECT_TYPE Type,UINT8 DisplayType,UINT32 MaxDepth,ACPI_OWNER_ID OwnerId,ACPI_HANDLE StartHandle)7910174267aSFredrik Holmqvist AcpiNsDumpObjects (
7920174267aSFredrik Holmqvist     ACPI_OBJECT_TYPE        Type,
7930174267aSFredrik Holmqvist     UINT8                   DisplayType,
7940174267aSFredrik Holmqvist     UINT32                  MaxDepth,
7950174267aSFredrik Holmqvist     ACPI_OWNER_ID           OwnerId,
7960174267aSFredrik Holmqvist     ACPI_HANDLE             StartHandle)
7970174267aSFredrik Holmqvist {
7980174267aSFredrik Holmqvist     ACPI_WALK_INFO          Info;
7990174267aSFredrik Holmqvist     ACPI_STATUS             Status;
8000174267aSFredrik Holmqvist 
8010174267aSFredrik Holmqvist 
8020174267aSFredrik Holmqvist     ACPI_FUNCTION_ENTRY ();
8030174267aSFredrik Holmqvist 
8040174267aSFredrik Holmqvist 
8050174267aSFredrik Holmqvist     /*
8060174267aSFredrik Holmqvist      * Just lock the entire namespace for the duration of the dump.
8070174267aSFredrik Holmqvist      * We don't want any changes to the namespace during this time,
8080174267aSFredrik Holmqvist      * especially the temporary nodes since we are going to display
8090174267aSFredrik Holmqvist      * them also.
8100174267aSFredrik Holmqvist      */
8110174267aSFredrik Holmqvist     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
8120174267aSFredrik Holmqvist     if (ACPI_FAILURE (Status))
8130174267aSFredrik Holmqvist     {
8140174267aSFredrik Holmqvist         AcpiOsPrintf ("Could not acquire namespace mutex\n");
8150174267aSFredrik Holmqvist         return;
8160174267aSFredrik Holmqvist     }
8170174267aSFredrik Holmqvist 
81808c9948cSFredrik Holmqvist     Info.Count = 0;
8190174267aSFredrik Holmqvist     Info.DebugLevel = ACPI_LV_TABLES;
8200174267aSFredrik Holmqvist     Info.OwnerId = OwnerId;
8210174267aSFredrik Holmqvist     Info.DisplayType = DisplayType;
8220174267aSFredrik Holmqvist 
8230174267aSFredrik Holmqvist     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
8240174267aSFredrik Holmqvist         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
8250174267aSFredrik Holmqvist         AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
8260174267aSFredrik Holmqvist 
82708c9948cSFredrik Holmqvist     AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count);
8280174267aSFredrik Holmqvist     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
8290174267aSFredrik Holmqvist }
8300174267aSFredrik Holmqvist 
8310174267aSFredrik Holmqvist 
8320174267aSFredrik Holmqvist /*******************************************************************************
8330174267aSFredrik Holmqvist  *
834c70258b7SJérôme Duval  * FUNCTION:    AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
835c70258b7SJérôme Duval  *
836c70258b7SJérôme Duval  * PARAMETERS:  ObjHandle           - Node to be dumped
837c70258b7SJérôme Duval  *              Level               - Nesting level of the handle
838c70258b7SJérôme Duval  *              Context             - Passed into WalkNamespace
839c70258b7SJérôme Duval  *              ReturnValue         - Not used
840c70258b7SJérôme Duval  *
841c70258b7SJérôme Duval  * RETURN:      Status
842c70258b7SJérôme Duval  *
843c70258b7SJérôme Duval  * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
844c70258b7SJérôme Duval  *              computes the maximum nesting depth in the namespace tree, in
845c70258b7SJérôme Duval  *              order to simplify formatting in AcpiNsDumpOneObjectPath.
846c70258b7SJérôme Duval  *              These procedures are UserFunctions called by AcpiNsWalkNamespace.
847c70258b7SJérôme Duval  *
848c70258b7SJérôme Duval  ******************************************************************************/
849c70258b7SJérôme Duval 
850c70258b7SJérôme Duval static ACPI_STATUS
AcpiNsDumpOneObjectPath(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)851c70258b7SJérôme Duval AcpiNsDumpOneObjectPath (
852c70258b7SJérôme Duval     ACPI_HANDLE             ObjHandle,
853c70258b7SJérôme Duval     UINT32                  Level,
854c70258b7SJérôme Duval     void                    *Context,
855c70258b7SJérôme Duval     void                    **ReturnValue)
856c70258b7SJérôme Duval {
857c70258b7SJérôme Duval     UINT32                  MaxLevel = *((UINT32 *) Context);
858c70258b7SJérôme Duval     char                    *Pathname;
859c70258b7SJérôme Duval     ACPI_NAMESPACE_NODE     *Node;
860c70258b7SJérôme Duval     int                     PathIndent;
861c70258b7SJérôme Duval 
862c70258b7SJérôme Duval 
863c70258b7SJérôme Duval     if (!ObjHandle)
864c70258b7SJérôme Duval     {
865c70258b7SJérôme Duval         return (AE_OK);
866c70258b7SJérôme Duval     }
867c70258b7SJérôme Duval 
868c70258b7SJérôme Duval     Node = AcpiNsValidateHandle (ObjHandle);
869ad5bbfb8SFredrik Holmqvist     if (!Node)
870ad5bbfb8SFredrik Holmqvist     {
871ad5bbfb8SFredrik Holmqvist         /* Ignore bad node during namespace walk */
872ad5bbfb8SFredrik Holmqvist 
873ad5bbfb8SFredrik Holmqvist         return (AE_OK);
874ad5bbfb8SFredrik Holmqvist     }
875ad5bbfb8SFredrik Holmqvist 
876b64e8511SFredrik Holmqvist     Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
877c70258b7SJérôme Duval 
878c70258b7SJérôme Duval     PathIndent = 1;
879c70258b7SJérôme Duval     if (Level <= MaxLevel)
880c70258b7SJérôme Duval     {
881c70258b7SJérôme Duval         PathIndent = MaxLevel - Level + 1;
882c70258b7SJérôme Duval     }
883c70258b7SJérôme Duval 
884c70258b7SJérôme Duval     AcpiOsPrintf ("%2d%*s%-12s%*s",
885c70258b7SJérôme Duval         Level, Level, " ", AcpiUtGetTypeName (Node->Type),
886c70258b7SJérôme Duval         PathIndent, " ");
887c70258b7SJérôme Duval 
888c70258b7SJérôme Duval     AcpiOsPrintf ("%s\n", &Pathname[1]);
889c70258b7SJérôme Duval     ACPI_FREE (Pathname);
890c70258b7SJérôme Duval     return (AE_OK);
891c70258b7SJérôme Duval }
892c70258b7SJérôme Duval 
893c70258b7SJérôme Duval 
894c70258b7SJérôme Duval static ACPI_STATUS
AcpiNsGetMaxDepth(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)895c70258b7SJérôme Duval AcpiNsGetMaxDepth (
896c70258b7SJérôme Duval     ACPI_HANDLE             ObjHandle,
897c70258b7SJérôme Duval     UINT32                  Level,
898c70258b7SJérôme Duval     void                    *Context,
899c70258b7SJérôme Duval     void                    **ReturnValue)
900c70258b7SJérôme Duval {
901c70258b7SJérôme Duval     UINT32                  *MaxLevel = (UINT32 *) Context;
902c70258b7SJérôme Duval 
903c70258b7SJérôme Duval 
904c70258b7SJérôme Duval     if (Level > *MaxLevel)
905c70258b7SJérôme Duval     {
906c70258b7SJérôme Duval         *MaxLevel = Level;
907c70258b7SJérôme Duval     }
908c70258b7SJérôme Duval     return (AE_OK);
909c70258b7SJérôme Duval }
910c70258b7SJérôme Duval 
911c70258b7SJérôme Duval 
912c70258b7SJérôme Duval /*******************************************************************************
913c70258b7SJérôme Duval  *
914c70258b7SJérôme Duval  * FUNCTION:    AcpiNsDumpObjectPaths
915c70258b7SJérôme Duval  *
916c70258b7SJérôme Duval  * PARAMETERS:  Type                - Object type to be dumped
917c70258b7SJérôme Duval  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
918c70258b7SJérôme Duval  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
919c70258b7SJérôme Duval  *                                    for an effectively unlimited depth.
920c70258b7SJérôme Duval  *              OwnerId             - Dump only objects owned by this ID. Use
921c70258b7SJérôme Duval  *                                    ACPI_UINT32_MAX to match all owners.
922c70258b7SJérôme Duval  *              StartHandle         - Where in namespace to start/end search
923c70258b7SJérôme Duval  *
924c70258b7SJérôme Duval  * RETURN:      None
925c70258b7SJérôme Duval  *
926c70258b7SJérôme Duval  * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
927c70258b7SJérôme Duval  *              AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
928c70258b7SJérôme Duval  *
929c70258b7SJérôme Duval  ******************************************************************************/
930c70258b7SJérôme Duval 
931c70258b7SJérôme Duval void
AcpiNsDumpObjectPaths(ACPI_OBJECT_TYPE Type,UINT8 DisplayType,UINT32 MaxDepth,ACPI_OWNER_ID OwnerId,ACPI_HANDLE StartHandle)932c70258b7SJérôme Duval AcpiNsDumpObjectPaths (
933c70258b7SJérôme Duval     ACPI_OBJECT_TYPE        Type,
934c70258b7SJérôme Duval     UINT8                   DisplayType,
935c70258b7SJérôme Duval     UINT32                  MaxDepth,
936c70258b7SJérôme Duval     ACPI_OWNER_ID           OwnerId,
937c70258b7SJérôme Duval     ACPI_HANDLE             StartHandle)
938c70258b7SJérôme Duval {
939c70258b7SJérôme Duval     ACPI_STATUS             Status;
940c70258b7SJérôme Duval     UINT32                  MaxLevel = 0;
941c70258b7SJérôme Duval 
942c70258b7SJérôme Duval 
943c70258b7SJérôme Duval     ACPI_FUNCTION_ENTRY ();
944c70258b7SJérôme Duval 
945c70258b7SJérôme Duval 
946c70258b7SJérôme Duval     /*
947c70258b7SJérôme Duval      * Just lock the entire namespace for the duration of the dump.
948c70258b7SJérôme Duval      * We don't want any changes to the namespace during this time,
949c70258b7SJérôme Duval      * especially the temporary nodes since we are going to display
950c70258b7SJérôme Duval      * them also.
951c70258b7SJérôme Duval      */
952c70258b7SJérôme Duval     Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
953c70258b7SJérôme Duval     if (ACPI_FAILURE (Status))
954c70258b7SJérôme Duval     {
955c70258b7SJérôme Duval         AcpiOsPrintf ("Could not acquire namespace mutex\n");
956c70258b7SJérôme Duval         return;
957c70258b7SJérôme Duval     }
958c70258b7SJérôme Duval 
959c70258b7SJérôme Duval     /* Get the max depth of the namespace tree, for formatting later */
960c70258b7SJérôme Duval 
961c70258b7SJérôme Duval     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
962c70258b7SJérôme Duval         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
963c70258b7SJérôme Duval         AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
964c70258b7SJérôme Duval 
965c70258b7SJérôme Duval     /* Now dump the entire namespace */
966c70258b7SJérôme Duval 
967c70258b7SJérôme Duval     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
968c70258b7SJérôme Duval         ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
969c70258b7SJérôme Duval         AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
970c70258b7SJérôme Duval 
971c70258b7SJérôme Duval     (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
972c70258b7SJérôme Duval }
973c70258b7SJérôme Duval 
974c70258b7SJérôme Duval 
975c70258b7SJérôme Duval /*******************************************************************************
976c70258b7SJérôme Duval  *
9770174267aSFredrik Holmqvist  * FUNCTION:    AcpiNsDumpEntry
9780174267aSFredrik Holmqvist  *
9790174267aSFredrik Holmqvist  * PARAMETERS:  Handle              - Node to be dumped
9800174267aSFredrik Holmqvist  *              DebugLevel          - Output level
9810174267aSFredrik Holmqvist  *
9820174267aSFredrik Holmqvist  * RETURN:      None
9830174267aSFredrik Holmqvist  *
9840174267aSFredrik Holmqvist  * DESCRIPTION: Dump a single Node
9850174267aSFredrik Holmqvist  *
9860174267aSFredrik Holmqvist  ******************************************************************************/
9870174267aSFredrik Holmqvist 
9880174267aSFredrik Holmqvist void
AcpiNsDumpEntry(ACPI_HANDLE Handle,UINT32 DebugLevel)9890174267aSFredrik Holmqvist AcpiNsDumpEntry (
9900174267aSFredrik Holmqvist     ACPI_HANDLE             Handle,
9910174267aSFredrik Holmqvist     UINT32                  DebugLevel)
9920174267aSFredrik Holmqvist {
9930174267aSFredrik Holmqvist     ACPI_WALK_INFO          Info;
9940174267aSFredrik Holmqvist 
9950174267aSFredrik Holmqvist 
9960174267aSFredrik Holmqvist     ACPI_FUNCTION_ENTRY ();
9970174267aSFredrik Holmqvist 
9980174267aSFredrik Holmqvist 
9990174267aSFredrik Holmqvist     Info.DebugLevel = DebugLevel;
10000174267aSFredrik Holmqvist     Info.OwnerId = ACPI_OWNER_ID_MAX;
10010174267aSFredrik Holmqvist     Info.DisplayType = ACPI_DISPLAY_SUMMARY;
10020174267aSFredrik Holmqvist 
10030174267aSFredrik Holmqvist     (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
10040174267aSFredrik Holmqvist }
10050174267aSFredrik Holmqvist 
10060174267aSFredrik Holmqvist 
10070174267aSFredrik Holmqvist #ifdef ACPI_ASL_COMPILER
10080174267aSFredrik Holmqvist /*******************************************************************************
10090174267aSFredrik Holmqvist  *
10100174267aSFredrik Holmqvist  * FUNCTION:    AcpiNsDumpTables
10110174267aSFredrik Holmqvist  *
10120174267aSFredrik Holmqvist  * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
10130174267aSFredrik Holmqvist  *                                    NS_ALL to dump the entire namespace
10140174267aSFredrik Holmqvist  *              MaxDepth            - Maximum depth of dump. Use INT_MAX
10150174267aSFredrik Holmqvist  *                                    for an effectively unlimited depth.
10160174267aSFredrik Holmqvist  *
10170174267aSFredrik Holmqvist  * RETURN:      None
10180174267aSFredrik Holmqvist  *
10190174267aSFredrik Holmqvist  * DESCRIPTION: Dump the name space, or a portion of it.
10200174267aSFredrik Holmqvist  *
10210174267aSFredrik Holmqvist  ******************************************************************************/
10220174267aSFredrik Holmqvist 
10230174267aSFredrik Holmqvist void
AcpiNsDumpTables(ACPI_HANDLE SearchBase,UINT32 MaxDepth)10240174267aSFredrik Holmqvist AcpiNsDumpTables (
10250174267aSFredrik Holmqvist     ACPI_HANDLE             SearchBase,
10260174267aSFredrik Holmqvist     UINT32                  MaxDepth)
10270174267aSFredrik Holmqvist {
10280174267aSFredrik Holmqvist     ACPI_HANDLE             SearchHandle = SearchBase;
10290174267aSFredrik Holmqvist 
10300174267aSFredrik Holmqvist 
10310174267aSFredrik Holmqvist     ACPI_FUNCTION_TRACE (NsDumpTables);
10320174267aSFredrik Holmqvist 
10330174267aSFredrik Holmqvist 
10340174267aSFredrik Holmqvist     if (!AcpiGbl_RootNode)
10350174267aSFredrik Holmqvist     {
10360174267aSFredrik Holmqvist         /*
10370174267aSFredrik Holmqvist          * If the name space has not been initialized,
10380174267aSFredrik Holmqvist          * there is nothing to dump.
10390174267aSFredrik Holmqvist          */
1040b64e8511SFredrik Holmqvist         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
1041b64e8511SFredrik Holmqvist             "namespace not initialized!\n"));
10420174267aSFredrik Holmqvist         return_VOID;
10430174267aSFredrik Holmqvist     }
10440174267aSFredrik Holmqvist 
10450174267aSFredrik Holmqvist     if (ACPI_NS_ALL == SearchBase)
10460174267aSFredrik Holmqvist     {
10470174267aSFredrik Holmqvist         /* Entire namespace */
10480174267aSFredrik Holmqvist 
10490174267aSFredrik Holmqvist         SearchHandle = AcpiGbl_RootNode;
10500174267aSFredrik Holmqvist         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
10510174267aSFredrik Holmqvist     }
10520174267aSFredrik Holmqvist 
10530174267aSFredrik Holmqvist     AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
10540174267aSFredrik Holmqvist         ACPI_OWNER_ID_MAX, SearchHandle);
10550174267aSFredrik Holmqvist     return_VOID;
10560174267aSFredrik Holmqvist }
10570174267aSFredrik Holmqvist #endif
10580174267aSFredrik Holmqvist #endif
1059