1bc36eafdSMike Gerdts /******************************************************************************
2bc36eafdSMike Gerdts *
3bc36eafdSMike Gerdts * Module Name: nsdump - table dumping routines for debug
4bc36eafdSMike Gerdts *
5bc36eafdSMike Gerdts *****************************************************************************/
6bc36eafdSMike Gerdts
7*35786f68SRobert Mustacchi /******************************************************************************
8*35786f68SRobert Mustacchi *
9*35786f68SRobert Mustacchi * 1. Copyright Notice
10*35786f68SRobert Mustacchi *
11*35786f68SRobert Mustacchi * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
12bc36eafdSMike Gerdts * All rights reserved.
13bc36eafdSMike Gerdts *
14*35786f68SRobert Mustacchi * 2. License
15*35786f68SRobert Mustacchi *
16*35786f68SRobert Mustacchi * 2.1. This is your license from Intel Corp. under its intellectual property
17*35786f68SRobert Mustacchi * rights. You may have additional license terms from the party that provided
18*35786f68SRobert Mustacchi * you this software, covering your right to use that party's intellectual
19*35786f68SRobert Mustacchi * property rights.
20*35786f68SRobert Mustacchi *
21*35786f68SRobert Mustacchi * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22*35786f68SRobert Mustacchi * copy of the source code appearing in this file ("Covered Code") an
23*35786f68SRobert Mustacchi * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24*35786f68SRobert Mustacchi * base code distributed originally by Intel ("Original Intel Code") to copy,
25*35786f68SRobert Mustacchi
26*35786f68SRobert Mustacchi * make derivatives, distribute, use and display any portion of the Covered
27*35786f68SRobert Mustacchi * Code in any form, with the right to sublicense such rights; and
28*35786f68SRobert Mustacchi *
29*35786f68SRobert Mustacchi * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30*35786f68SRobert Mustacchi * license (with the right to sublicense), under only those claims of Intel
31*35786f68SRobert Mustacchi * patents that are infringed by the Original Intel Code, to make, use, sell,
32*35786f68SRobert Mustacchi * offer to sell, and import the Covered Code and derivative works thereof
33*35786f68SRobert Mustacchi * solely to the minimum extent necessary to exercise the above copyright
34*35786f68SRobert Mustacchi * license, and in no event shall the patent license extend to any additions
35*35786f68SRobert Mustacchi * to or modifications of the Original Intel Code. No other license or right
36*35786f68SRobert Mustacchi * is granted directly or by implication, estoppel or otherwise;
37*35786f68SRobert Mustacchi *
38*35786f68SRobert Mustacchi * The above copyright and patent license is granted only if the following
39*35786f68SRobert Mustacchi * conditions are met:
40*35786f68SRobert Mustacchi *
41*35786f68SRobert Mustacchi * 3. Conditions
42*35786f68SRobert Mustacchi *
43*35786f68SRobert Mustacchi * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44*35786f68SRobert Mustacchi * Redistribution of source code of any substantial portion of the Covered
45*35786f68SRobert Mustacchi * Code or modification with rights to further distribute source must include
46*35786f68SRobert Mustacchi * the above Copyright Notice, the above License, this list of Conditions,
47*35786f68SRobert Mustacchi * and the following Disclaimer and Export Compliance provision. In addition,
48*35786f68SRobert Mustacchi * Licensee must cause all Covered Code to which Licensee contributes to
49*35786f68SRobert Mustacchi * contain a file documenting the changes Licensee made to create that Covered
50*35786f68SRobert Mustacchi * Code and the date of any change. Licensee must include in that file the
51*35786f68SRobert Mustacchi * documentation of any changes made by any predecessor Licensee. Licensee
52*35786f68SRobert Mustacchi * must include a prominent statement that the modification is derived,
53*35786f68SRobert Mustacchi * directly or indirectly, from Original Intel Code.
54*35786f68SRobert Mustacchi *
55*35786f68SRobert Mustacchi * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56*35786f68SRobert Mustacchi * Redistribution of source code of any substantial portion of the Covered
57*35786f68SRobert Mustacchi * Code or modification without rights to further distribute source must
58*35786f68SRobert Mustacchi * include the following Disclaimer and Export Compliance provision in the
59*35786f68SRobert Mustacchi * documentation and/or other materials provided with distribution. In
60*35786f68SRobert Mustacchi * addition, Licensee may not authorize further sublicense of source of any
61*35786f68SRobert Mustacchi * portion of the Covered Code, and must include terms to the effect that the
62*35786f68SRobert Mustacchi * license from Licensee to its licensee is limited to the intellectual
63*35786f68SRobert Mustacchi * property embodied in the software Licensee provides to its licensee, and
64*35786f68SRobert Mustacchi * not to intellectual property embodied in modifications its licensee may
65*35786f68SRobert Mustacchi * make.
66*35786f68SRobert Mustacchi *
67*35786f68SRobert Mustacchi * 3.3. Redistribution of Executable. Redistribution in executable form of any
68*35786f68SRobert Mustacchi * substantial portion of the Covered Code or modification must reproduce the
69*35786f68SRobert Mustacchi * above Copyright Notice, and the following Disclaimer and Export Compliance
70*35786f68SRobert Mustacchi * provision in the documentation and/or other materials provided with the
71*35786f68SRobert Mustacchi * distribution.
72*35786f68SRobert Mustacchi *
73*35786f68SRobert Mustacchi * 3.4. Intel retains all right, title, and interest in and to the Original
74*35786f68SRobert Mustacchi * Intel Code.
75*35786f68SRobert Mustacchi *
76*35786f68SRobert Mustacchi * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77*35786f68SRobert Mustacchi * Intel shall be used in advertising or otherwise to promote the sale, use or
78*35786f68SRobert Mustacchi * other dealings in products derived from or relating to the Covered Code
79*35786f68SRobert Mustacchi * without prior written authorization from Intel.
80*35786f68SRobert Mustacchi *
81*35786f68SRobert Mustacchi * 4. Disclaimer and Export Compliance
82*35786f68SRobert Mustacchi *
83*35786f68SRobert Mustacchi * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84*35786f68SRobert Mustacchi * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85*35786f68SRobert Mustacchi * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86*35786f68SRobert Mustacchi * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87*35786f68SRobert Mustacchi * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88*35786f68SRobert Mustacchi * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89*35786f68SRobert Mustacchi * PARTICULAR PURPOSE.
90*35786f68SRobert Mustacchi *
91*35786f68SRobert Mustacchi * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92*35786f68SRobert Mustacchi * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93*35786f68SRobert Mustacchi * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94*35786f68SRobert Mustacchi * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95*35786f68SRobert Mustacchi * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96*35786f68SRobert Mustacchi * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97*35786f68SRobert Mustacchi * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98*35786f68SRobert Mustacchi * LIMITED REMEDY.
99*35786f68SRobert Mustacchi *
100*35786f68SRobert Mustacchi * 4.3. Licensee shall not export, either directly or indirectly, any of this
101*35786f68SRobert Mustacchi * software or system incorporating such software without first obtaining any
102*35786f68SRobert Mustacchi * required license or other approval from the U. S. Department of Commerce or
103*35786f68SRobert Mustacchi * any other agency or department of the United States Government. In the
104*35786f68SRobert Mustacchi * event Licensee exports any such software from the United States or
105*35786f68SRobert Mustacchi * re-exports any such software from a foreign destination, Licensee shall
106*35786f68SRobert Mustacchi * ensure that the distribution and export/re-export of the software is in
107*35786f68SRobert Mustacchi * compliance with all laws, regulations, orders, or other restrictions of the
108*35786f68SRobert Mustacchi * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109*35786f68SRobert Mustacchi * any of its subsidiaries will export/re-export any technical data, process,
110*35786f68SRobert Mustacchi * software, or service, directly or indirectly, to any country for which the
111*35786f68SRobert Mustacchi * United States government or any agency thereof requires an export license,
112*35786f68SRobert Mustacchi * other governmental approval, or letter of assurance, without first obtaining
113*35786f68SRobert Mustacchi * such license, approval or letter.
114*35786f68SRobert Mustacchi *
115*35786f68SRobert Mustacchi *****************************************************************************
116*35786f68SRobert Mustacchi *
117*35786f68SRobert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
118*35786f68SRobert Mustacchi * following license:
119*35786f68SRobert Mustacchi *
120bc36eafdSMike Gerdts * Redistribution and use in source and binary forms, with or without
121bc36eafdSMike Gerdts * modification, are permitted provided that the following conditions
122bc36eafdSMike Gerdts * are met:
123bc36eafdSMike Gerdts * 1. Redistributions of source code must retain the above copyright
124bc36eafdSMike Gerdts * notice, this list of conditions, and the following disclaimer,
125bc36eafdSMike Gerdts * without modification.
126bc36eafdSMike Gerdts * 2. Redistributions in binary form must reproduce at minimum a disclaimer
127bc36eafdSMike Gerdts * substantially similar to the "NO WARRANTY" disclaimer below
128bc36eafdSMike Gerdts * ("Disclaimer") and any redistribution must be conditioned upon
129bc36eafdSMike Gerdts * including a substantially similar Disclaimer requirement for further
130bc36eafdSMike Gerdts * binary redistribution.
131bc36eafdSMike Gerdts * 3. Neither the names of the above-listed copyright holders nor the names
132bc36eafdSMike Gerdts * of any contributors may be used to endorse or promote products derived
133bc36eafdSMike Gerdts * from this software without specific prior written permission.
134bc36eafdSMike Gerdts *
135*35786f68SRobert Mustacchi * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
136*35786f68SRobert Mustacchi * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
137*35786f68SRobert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
138*35786f68SRobert Mustacchi * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
139*35786f68SRobert Mustacchi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
140*35786f68SRobert Mustacchi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
141*35786f68SRobert Mustacchi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
142*35786f68SRobert Mustacchi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
143*35786f68SRobert Mustacchi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
144*35786f68SRobert Mustacchi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
145*35786f68SRobert Mustacchi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146*35786f68SRobert Mustacchi *
147*35786f68SRobert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
148bc36eafdSMike Gerdts * GNU General Public License ("GPL") version 2 as published by the Free
149bc36eafdSMike Gerdts * Software Foundation.
150bc36eafdSMike Gerdts *
151*35786f68SRobert Mustacchi *****************************************************************************/
152bc36eafdSMike Gerdts
153bc36eafdSMike Gerdts #include "acpi.h"
154bc36eafdSMike Gerdts #include "accommon.h"
155bc36eafdSMike Gerdts #include "acnamesp.h"
156bc36eafdSMike Gerdts #include "acoutput.h"
157bc36eafdSMike Gerdts
158bc36eafdSMike Gerdts
159bc36eafdSMike Gerdts #define _COMPONENT ACPI_NAMESPACE
160bc36eafdSMike Gerdts ACPI_MODULE_NAME ("nsdump")
161bc36eafdSMike Gerdts
162bc36eafdSMike Gerdts /* Local prototypes */
163bc36eafdSMike Gerdts
164bc36eafdSMike Gerdts #ifdef ACPI_OBSOLETE_FUNCTIONS
165bc36eafdSMike Gerdts void
166bc36eafdSMike Gerdts AcpiNsDumpRootDevices (
167bc36eafdSMike Gerdts void);
168bc36eafdSMike Gerdts
169bc36eafdSMike Gerdts static ACPI_STATUS
170bc36eafdSMike Gerdts AcpiNsDumpOneDevice (
171bc36eafdSMike Gerdts ACPI_HANDLE ObjHandle,
172bc36eafdSMike Gerdts UINT32 Level,
173bc36eafdSMike Gerdts void *Context,
174bc36eafdSMike Gerdts void **ReturnValue);
175bc36eafdSMike Gerdts #endif
176bc36eafdSMike Gerdts
177bc36eafdSMike Gerdts
178bc36eafdSMike Gerdts #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
179bc36eafdSMike Gerdts
180bc36eafdSMike Gerdts static ACPI_STATUS
181bc36eafdSMike Gerdts AcpiNsDumpOneObjectPath (
182bc36eafdSMike Gerdts ACPI_HANDLE ObjHandle,
183bc36eafdSMike Gerdts UINT32 Level,
184bc36eafdSMike Gerdts void *Context,
185bc36eafdSMike Gerdts void **ReturnValue);
186bc36eafdSMike Gerdts
187bc36eafdSMike Gerdts static ACPI_STATUS
188bc36eafdSMike Gerdts AcpiNsGetMaxDepth (
189bc36eafdSMike Gerdts ACPI_HANDLE ObjHandle,
190bc36eafdSMike Gerdts UINT32 Level,
191bc36eafdSMike Gerdts void *Context,
192bc36eafdSMike Gerdts void **ReturnValue);
193bc36eafdSMike Gerdts
194bc36eafdSMike Gerdts
195bc36eafdSMike Gerdts /*******************************************************************************
196bc36eafdSMike Gerdts *
197bc36eafdSMike Gerdts * FUNCTION: AcpiNsPrintPathname
198bc36eafdSMike Gerdts *
199bc36eafdSMike Gerdts * PARAMETERS: NumSegments - Number of ACPI name segments
200bc36eafdSMike Gerdts * Pathname - The compressed (internal) path
201bc36eafdSMike Gerdts *
202bc36eafdSMike Gerdts * RETURN: None
203bc36eafdSMike Gerdts *
204bc36eafdSMike Gerdts * DESCRIPTION: Print an object's full namespace pathname
205bc36eafdSMike Gerdts *
206bc36eafdSMike Gerdts ******************************************************************************/
207bc36eafdSMike Gerdts
208bc36eafdSMike Gerdts void
AcpiNsPrintPathname(UINT32 NumSegments,const char * Pathname)209bc36eafdSMike Gerdts AcpiNsPrintPathname (
210bc36eafdSMike Gerdts UINT32 NumSegments,
211bc36eafdSMike Gerdts const char *Pathname)
212bc36eafdSMike Gerdts {
213bc36eafdSMike Gerdts UINT32 i;
214bc36eafdSMike Gerdts
215bc36eafdSMike Gerdts
216bc36eafdSMike Gerdts ACPI_FUNCTION_NAME (NsPrintPathname);
217bc36eafdSMike Gerdts
218bc36eafdSMike Gerdts
219bc36eafdSMike Gerdts /* Check if debug output enabled */
220bc36eafdSMike Gerdts
221bc36eafdSMike Gerdts if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
222bc36eafdSMike Gerdts {
223bc36eafdSMike Gerdts return;
224bc36eafdSMike Gerdts }
225bc36eafdSMike Gerdts
226bc36eafdSMike Gerdts /* Print the entire name */
227bc36eafdSMike Gerdts
228bc36eafdSMike Gerdts ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
229bc36eafdSMike Gerdts
230bc36eafdSMike Gerdts while (NumSegments)
231bc36eafdSMike Gerdts {
232bc36eafdSMike Gerdts for (i = 0; i < 4; i++)
233bc36eafdSMike Gerdts {
234bc36eafdSMike Gerdts isprint ((int) Pathname[i]) ?
235bc36eafdSMike Gerdts AcpiOsPrintf ("%c", Pathname[i]) :
236bc36eafdSMike Gerdts AcpiOsPrintf ("?");
237bc36eafdSMike Gerdts }
238bc36eafdSMike Gerdts
239bc36eafdSMike Gerdts Pathname += ACPI_NAME_SIZE;
240bc36eafdSMike Gerdts NumSegments--;
241bc36eafdSMike Gerdts if (NumSegments)
242bc36eafdSMike Gerdts {
243bc36eafdSMike Gerdts AcpiOsPrintf (".");
244bc36eafdSMike Gerdts }
245bc36eafdSMike Gerdts }
246bc36eafdSMike Gerdts
247bc36eafdSMike Gerdts AcpiOsPrintf ("]\n");
248bc36eafdSMike Gerdts }
249bc36eafdSMike Gerdts
250bc36eafdSMike Gerdts
251bc36eafdSMike Gerdts #ifdef ACPI_OBSOLETE_FUNCTIONS
252bc36eafdSMike Gerdts /* Not used at this time, perhaps later */
253bc36eafdSMike Gerdts
254bc36eafdSMike Gerdts /*******************************************************************************
255bc36eafdSMike Gerdts *
256bc36eafdSMike Gerdts * FUNCTION: AcpiNsDumpPathname
257bc36eafdSMike Gerdts *
258bc36eafdSMike Gerdts * PARAMETERS: Handle - Object
259bc36eafdSMike Gerdts * Msg - Prefix message
260bc36eafdSMike Gerdts * Level - Desired debug level
261bc36eafdSMike Gerdts * Component - Caller's component ID
262bc36eafdSMike Gerdts *
263bc36eafdSMike Gerdts * RETURN: None
264bc36eafdSMike Gerdts *
265bc36eafdSMike Gerdts * DESCRIPTION: Print an object's full namespace pathname
266bc36eafdSMike Gerdts * Manages allocation/freeing of a pathname buffer
267bc36eafdSMike Gerdts *
268bc36eafdSMike Gerdts ******************************************************************************/
269bc36eafdSMike Gerdts
270bc36eafdSMike Gerdts void
AcpiNsDumpPathname(ACPI_HANDLE Handle,const char * Msg,UINT32 Level,UINT32 Component)271bc36eafdSMike Gerdts AcpiNsDumpPathname (
272bc36eafdSMike Gerdts ACPI_HANDLE Handle,
273bc36eafdSMike Gerdts const char *Msg,
274bc36eafdSMike Gerdts UINT32 Level,
275bc36eafdSMike Gerdts UINT32 Component)
276bc36eafdSMike Gerdts {
277bc36eafdSMike Gerdts
278bc36eafdSMike Gerdts ACPI_FUNCTION_TRACE (NsDumpPathname);
279bc36eafdSMike Gerdts
280bc36eafdSMike Gerdts
281bc36eafdSMike Gerdts /* Do this only if the requested debug level and component are enabled */
282bc36eafdSMike Gerdts
283bc36eafdSMike Gerdts if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
284bc36eafdSMike Gerdts {
285bc36eafdSMike Gerdts return_VOID;
286bc36eafdSMike Gerdts }
287bc36eafdSMike Gerdts
288bc36eafdSMike Gerdts /* Convert handle to a full pathname and print it (with supplied message) */
289bc36eafdSMike Gerdts
290bc36eafdSMike Gerdts AcpiNsPrintNodePathname (Handle, Msg);
291bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
292bc36eafdSMike Gerdts return_VOID;
293bc36eafdSMike Gerdts }
294bc36eafdSMike Gerdts #endif
295bc36eafdSMike Gerdts
296*35786f68SRobert Mustacchi
297bc36eafdSMike Gerdts /*******************************************************************************
298bc36eafdSMike Gerdts *
299bc36eafdSMike Gerdts * FUNCTION: AcpiNsDumpOneObject
300bc36eafdSMike Gerdts *
301bc36eafdSMike Gerdts * PARAMETERS: ObjHandle - Node to be dumped
302bc36eafdSMike Gerdts * Level - Nesting level of the handle
303bc36eafdSMike Gerdts * Context - Passed into WalkNamespace
304bc36eafdSMike Gerdts * ReturnValue - Not used
305bc36eafdSMike Gerdts *
306bc36eafdSMike Gerdts * RETURN: Status
307bc36eafdSMike Gerdts *
308bc36eafdSMike Gerdts * DESCRIPTION: Dump a single Node
309bc36eafdSMike Gerdts * This procedure is a UserFunction called by AcpiNsWalkNamespace.
310bc36eafdSMike Gerdts *
311bc36eafdSMike Gerdts ******************************************************************************/
312bc36eafdSMike Gerdts
313bc36eafdSMike Gerdts ACPI_STATUS
AcpiNsDumpOneObject(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)314bc36eafdSMike Gerdts AcpiNsDumpOneObject (
315bc36eafdSMike Gerdts ACPI_HANDLE ObjHandle,
316bc36eafdSMike Gerdts UINT32 Level,
317bc36eafdSMike Gerdts void *Context,
318bc36eafdSMike Gerdts void **ReturnValue)
319bc36eafdSMike Gerdts {
320bc36eafdSMike Gerdts ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
321bc36eafdSMike Gerdts ACPI_NAMESPACE_NODE *ThisNode;
322bc36eafdSMike Gerdts ACPI_OPERAND_OBJECT *ObjDesc = NULL;
323bc36eafdSMike Gerdts ACPI_OBJECT_TYPE ObjType;
324bc36eafdSMike Gerdts ACPI_OBJECT_TYPE Type;
325bc36eafdSMike Gerdts UINT32 BytesToDump;
326bc36eafdSMike Gerdts UINT32 DbgLevel;
327bc36eafdSMike Gerdts UINT32 i;
328bc36eafdSMike Gerdts
329bc36eafdSMike Gerdts
330bc36eafdSMike Gerdts ACPI_FUNCTION_NAME (NsDumpOneObject);
331bc36eafdSMike Gerdts
332bc36eafdSMike Gerdts
333bc36eafdSMike Gerdts /* Is output enabled? */
334bc36eafdSMike Gerdts
335bc36eafdSMike Gerdts if (!(AcpiDbgLevel & Info->DebugLevel))
336bc36eafdSMike Gerdts {
337bc36eafdSMike Gerdts return (AE_OK);
338bc36eafdSMike Gerdts }
339bc36eafdSMike Gerdts
340bc36eafdSMike Gerdts if (!ObjHandle)
341bc36eafdSMike Gerdts {
342bc36eafdSMike Gerdts ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
343bc36eafdSMike Gerdts return (AE_OK);
344bc36eafdSMike Gerdts }
345bc36eafdSMike Gerdts
346bc36eafdSMike Gerdts ThisNode = AcpiNsValidateHandle (ObjHandle);
347bc36eafdSMike Gerdts if (!ThisNode)
348bc36eafdSMike Gerdts {
349bc36eafdSMike Gerdts ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
350bc36eafdSMike Gerdts ObjHandle));
351bc36eafdSMike Gerdts return (AE_OK);
352bc36eafdSMike Gerdts }
353bc36eafdSMike Gerdts
354bc36eafdSMike Gerdts Type = ThisNode->Type;
355*35786f68SRobert Mustacchi Info->Count++;
356bc36eafdSMike Gerdts
357bc36eafdSMike Gerdts /* Check if the owner matches */
358bc36eafdSMike Gerdts
359bc36eafdSMike Gerdts if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
360bc36eafdSMike Gerdts (Info->OwnerId != ThisNode->OwnerId))
361bc36eafdSMike Gerdts {
362bc36eafdSMike Gerdts return (AE_OK);
363bc36eafdSMike Gerdts }
364bc36eafdSMike Gerdts
365bc36eafdSMike Gerdts if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
366bc36eafdSMike Gerdts {
367bc36eafdSMike Gerdts /* Indent the object according to the level */
368bc36eafdSMike Gerdts
369bc36eafdSMike Gerdts AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
370bc36eafdSMike Gerdts
371bc36eafdSMike Gerdts /* Check the node type and name */
372bc36eafdSMike Gerdts
373bc36eafdSMike Gerdts if (Type > ACPI_TYPE_LOCAL_MAX)
374bc36eafdSMike Gerdts {
375bc36eafdSMike Gerdts ACPI_WARNING ((AE_INFO,
376bc36eafdSMike Gerdts "Invalid ACPI Object Type 0x%08X", Type));
377bc36eafdSMike Gerdts }
378bc36eafdSMike Gerdts
379bc36eafdSMike Gerdts AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
380bc36eafdSMike Gerdts }
381bc36eafdSMike Gerdts
382bc36eafdSMike Gerdts /* Now we can print out the pertinent information */
383bc36eafdSMike Gerdts
384bc36eafdSMike Gerdts AcpiOsPrintf (" %-12s %p %2.2X ",
385bc36eafdSMike Gerdts AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
386bc36eafdSMike Gerdts
387bc36eafdSMike Gerdts DbgLevel = AcpiDbgLevel;
388bc36eafdSMike Gerdts AcpiDbgLevel = 0;
389bc36eafdSMike Gerdts ObjDesc = AcpiNsGetAttachedObject (ThisNode);
390bc36eafdSMike Gerdts AcpiDbgLevel = DbgLevel;
391bc36eafdSMike Gerdts
392bc36eafdSMike Gerdts /* Temp nodes are those nodes created by a control method */
393bc36eafdSMike Gerdts
394bc36eafdSMike Gerdts if (ThisNode->Flags & ANOBJ_TEMPORARY)
395bc36eafdSMike Gerdts {
396bc36eafdSMike Gerdts AcpiOsPrintf ("(T) ");
397bc36eafdSMike Gerdts }
398bc36eafdSMike Gerdts
399bc36eafdSMike Gerdts switch (Info->DisplayType & ACPI_DISPLAY_MASK)
400bc36eafdSMike Gerdts {
401bc36eafdSMike Gerdts case ACPI_DISPLAY_SUMMARY:
402bc36eafdSMike Gerdts
403bc36eafdSMike Gerdts if (!ObjDesc)
404bc36eafdSMike Gerdts {
405bc36eafdSMike Gerdts /* No attached object. Some types should always have an object */
406bc36eafdSMike Gerdts
407bc36eafdSMike Gerdts switch (Type)
408bc36eafdSMike Gerdts {
409bc36eafdSMike Gerdts case ACPI_TYPE_INTEGER:
410bc36eafdSMike Gerdts case ACPI_TYPE_PACKAGE:
411bc36eafdSMike Gerdts case ACPI_TYPE_BUFFER:
412bc36eafdSMike Gerdts case ACPI_TYPE_STRING:
413bc36eafdSMike Gerdts case ACPI_TYPE_METHOD:
414bc36eafdSMike Gerdts
415bc36eafdSMike Gerdts AcpiOsPrintf ("<No attached object>");
416bc36eafdSMike Gerdts break;
417bc36eafdSMike Gerdts
418bc36eafdSMike Gerdts default:
419bc36eafdSMike Gerdts
420bc36eafdSMike Gerdts break;
421bc36eafdSMike Gerdts }
422bc36eafdSMike Gerdts
423bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
424bc36eafdSMike Gerdts return (AE_OK);
425bc36eafdSMike Gerdts }
426bc36eafdSMike Gerdts
427bc36eafdSMike Gerdts switch (Type)
428bc36eafdSMike Gerdts {
429bc36eafdSMike Gerdts case ACPI_TYPE_PROCESSOR:
430bc36eafdSMike Gerdts
431bc36eafdSMike Gerdts AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
432bc36eafdSMike Gerdts ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
433bc36eafdSMike Gerdts ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address));
434bc36eafdSMike Gerdts break;
435bc36eafdSMike Gerdts
436bc36eafdSMike Gerdts case ACPI_TYPE_DEVICE:
437bc36eafdSMike Gerdts
438bc36eafdSMike Gerdts AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
439bc36eafdSMike Gerdts break;
440bc36eafdSMike Gerdts
441bc36eafdSMike Gerdts case ACPI_TYPE_METHOD:
442bc36eafdSMike Gerdts
443bc36eafdSMike Gerdts AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
444bc36eafdSMike Gerdts (UINT32) ObjDesc->Method.ParamCount,
445bc36eafdSMike Gerdts ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
446bc36eafdSMike Gerdts break;
447bc36eafdSMike Gerdts
448bc36eafdSMike Gerdts case ACPI_TYPE_INTEGER:
449bc36eafdSMike Gerdts
450bc36eafdSMike Gerdts AcpiOsPrintf ("= %8.8X%8.8X\n",
451bc36eafdSMike Gerdts ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
452bc36eafdSMike Gerdts break;
453bc36eafdSMike Gerdts
454bc36eafdSMike Gerdts case ACPI_TYPE_PACKAGE:
455bc36eafdSMike Gerdts
456bc36eafdSMike Gerdts if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
457bc36eafdSMike Gerdts {
458bc36eafdSMike Gerdts AcpiOsPrintf ("Elements %.2X\n",
459bc36eafdSMike Gerdts ObjDesc->Package.Count);
460bc36eafdSMike Gerdts }
461bc36eafdSMike Gerdts else
462bc36eafdSMike Gerdts {
463bc36eafdSMike Gerdts AcpiOsPrintf ("[Length not yet evaluated]\n");
464bc36eafdSMike Gerdts }
465bc36eafdSMike Gerdts break;
466bc36eafdSMike Gerdts
467bc36eafdSMike Gerdts case ACPI_TYPE_BUFFER:
468bc36eafdSMike Gerdts
469bc36eafdSMike Gerdts if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
470bc36eafdSMike Gerdts {
471bc36eafdSMike Gerdts AcpiOsPrintf ("Len %.2X",
472bc36eafdSMike Gerdts ObjDesc->Buffer.Length);
473bc36eafdSMike Gerdts
474bc36eafdSMike Gerdts /* Dump some of the buffer */
475bc36eafdSMike Gerdts
476bc36eafdSMike Gerdts if (ObjDesc->Buffer.Length > 0)
477bc36eafdSMike Gerdts {
478bc36eafdSMike Gerdts AcpiOsPrintf (" =");
479bc36eafdSMike Gerdts for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
480bc36eafdSMike Gerdts {
481bc36eafdSMike Gerdts AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
482bc36eafdSMike Gerdts }
483bc36eafdSMike Gerdts }
484bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
485bc36eafdSMike Gerdts }
486bc36eafdSMike Gerdts else
487bc36eafdSMike Gerdts {
488bc36eafdSMike Gerdts AcpiOsPrintf ("[Length not yet evaluated]\n");
489bc36eafdSMike Gerdts }
490bc36eafdSMike Gerdts break;
491bc36eafdSMike Gerdts
492bc36eafdSMike Gerdts case ACPI_TYPE_STRING:
493bc36eafdSMike Gerdts
494bc36eafdSMike Gerdts AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
495bc36eafdSMike Gerdts AcpiUtPrintString (ObjDesc->String.Pointer, 80);
496bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
497bc36eafdSMike Gerdts break;
498bc36eafdSMike Gerdts
499bc36eafdSMike Gerdts case ACPI_TYPE_REGION:
500bc36eafdSMike Gerdts
501bc36eafdSMike Gerdts AcpiOsPrintf ("[%s]",
502bc36eafdSMike Gerdts AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
503bc36eafdSMike Gerdts if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
504bc36eafdSMike Gerdts {
505bc36eafdSMike Gerdts AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
506bc36eafdSMike Gerdts ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
507bc36eafdSMike Gerdts ObjDesc->Region.Length);
508bc36eafdSMike Gerdts }
509bc36eafdSMike Gerdts else
510bc36eafdSMike Gerdts {
511bc36eafdSMike Gerdts AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
512bc36eafdSMike Gerdts }
513bc36eafdSMike Gerdts break;
514bc36eafdSMike Gerdts
515bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_REFERENCE:
516bc36eafdSMike Gerdts
517bc36eafdSMike Gerdts AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
518bc36eafdSMike Gerdts break;
519bc36eafdSMike Gerdts
520bc36eafdSMike Gerdts case ACPI_TYPE_BUFFER_FIELD:
521bc36eafdSMike Gerdts
522bc36eafdSMike Gerdts if (ObjDesc->BufferField.BufferObj &&
523bc36eafdSMike Gerdts ObjDesc->BufferField.BufferObj->Buffer.Node)
524bc36eafdSMike Gerdts {
525bc36eafdSMike Gerdts AcpiOsPrintf ("Buf [%4.4s]",
526bc36eafdSMike Gerdts AcpiUtGetNodeName (
527bc36eafdSMike Gerdts ObjDesc->BufferField.BufferObj->Buffer.Node));
528bc36eafdSMike Gerdts }
529bc36eafdSMike Gerdts break;
530bc36eafdSMike Gerdts
531bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_REGION_FIELD:
532bc36eafdSMike Gerdts
533bc36eafdSMike Gerdts AcpiOsPrintf ("Rgn [%4.4s]",
534bc36eafdSMike Gerdts AcpiUtGetNodeName (
535bc36eafdSMike Gerdts ObjDesc->CommonField.RegionObj->Region.Node));
536bc36eafdSMike Gerdts break;
537bc36eafdSMike Gerdts
538bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_BANK_FIELD:
539bc36eafdSMike Gerdts
540bc36eafdSMike Gerdts AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
541bc36eafdSMike Gerdts AcpiUtGetNodeName (
542bc36eafdSMike Gerdts ObjDesc->CommonField.RegionObj->Region.Node),
543bc36eafdSMike Gerdts AcpiUtGetNodeName (
544bc36eafdSMike Gerdts ObjDesc->BankField.BankObj->CommonField.Node));
545bc36eafdSMike Gerdts break;
546bc36eafdSMike Gerdts
547bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_INDEX_FIELD:
548bc36eafdSMike Gerdts
549bc36eafdSMike Gerdts AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
550bc36eafdSMike Gerdts AcpiUtGetNodeName (
551bc36eafdSMike Gerdts ObjDesc->IndexField.IndexObj->CommonField.Node),
552bc36eafdSMike Gerdts AcpiUtGetNodeName (
553bc36eafdSMike Gerdts ObjDesc->IndexField.DataObj->CommonField.Node));
554bc36eafdSMike Gerdts break;
555bc36eafdSMike Gerdts
556bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_ALIAS:
557bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_METHOD_ALIAS:
558bc36eafdSMike Gerdts
559bc36eafdSMike Gerdts AcpiOsPrintf ("Target %4.4s (%p)\n",
560bc36eafdSMike Gerdts AcpiUtGetNodeName (ObjDesc), ObjDesc);
561bc36eafdSMike Gerdts break;
562bc36eafdSMike Gerdts
563bc36eafdSMike Gerdts default:
564bc36eafdSMike Gerdts
565bc36eafdSMike Gerdts AcpiOsPrintf ("Object %p\n", ObjDesc);
566bc36eafdSMike Gerdts break;
567bc36eafdSMike Gerdts }
568bc36eafdSMike Gerdts
569bc36eafdSMike Gerdts /* Common field handling */
570bc36eafdSMike Gerdts
571bc36eafdSMike Gerdts switch (Type)
572bc36eafdSMike Gerdts {
573bc36eafdSMike Gerdts case ACPI_TYPE_BUFFER_FIELD:
574bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_REGION_FIELD:
575bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_BANK_FIELD:
576bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_INDEX_FIELD:
577bc36eafdSMike Gerdts
578bc36eafdSMike Gerdts AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
579bc36eafdSMike Gerdts (ObjDesc->CommonField.BaseByteOffset * 8)
580bc36eafdSMike Gerdts + ObjDesc->CommonField.StartFieldBitOffset,
581bc36eafdSMike Gerdts ObjDesc->CommonField.BitLength,
582bc36eafdSMike Gerdts ObjDesc->CommonField.AccessByteWidth);
583bc36eafdSMike Gerdts break;
584bc36eafdSMike Gerdts
585bc36eafdSMike Gerdts default:
586bc36eafdSMike Gerdts
587bc36eafdSMike Gerdts break;
588bc36eafdSMike Gerdts }
589bc36eafdSMike Gerdts break;
590bc36eafdSMike Gerdts
591bc36eafdSMike Gerdts case ACPI_DISPLAY_OBJECTS:
592bc36eafdSMike Gerdts
593bc36eafdSMike Gerdts AcpiOsPrintf ("O:%p", ObjDesc);
594bc36eafdSMike Gerdts if (!ObjDesc)
595bc36eafdSMike Gerdts {
596bc36eafdSMike Gerdts /* No attached object, we are done */
597bc36eafdSMike Gerdts
598bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
599bc36eafdSMike Gerdts return (AE_OK);
600bc36eafdSMike Gerdts }
601bc36eafdSMike Gerdts
602bc36eafdSMike Gerdts AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
603bc36eafdSMike Gerdts
604bc36eafdSMike Gerdts switch (Type)
605bc36eafdSMike Gerdts {
606bc36eafdSMike Gerdts case ACPI_TYPE_METHOD:
607bc36eafdSMike Gerdts
608bc36eafdSMike Gerdts /* Name is a Method and its AML offset/length are set */
609bc36eafdSMike Gerdts
610bc36eafdSMike Gerdts AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
611bc36eafdSMike Gerdts ObjDesc->Method.AmlLength);
612bc36eafdSMike Gerdts break;
613bc36eafdSMike Gerdts
614bc36eafdSMike Gerdts case ACPI_TYPE_INTEGER:
615bc36eafdSMike Gerdts
616bc36eafdSMike Gerdts AcpiOsPrintf (" I:%8.8X8.8%X\n",
617bc36eafdSMike Gerdts ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
618bc36eafdSMike Gerdts break;
619bc36eafdSMike Gerdts
620bc36eafdSMike Gerdts case ACPI_TYPE_STRING:
621bc36eafdSMike Gerdts
622bc36eafdSMike Gerdts AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
623bc36eafdSMike Gerdts ObjDesc->String.Length);
624bc36eafdSMike Gerdts break;
625bc36eafdSMike Gerdts
626bc36eafdSMike Gerdts case ACPI_TYPE_BUFFER:
627bc36eafdSMike Gerdts
628bc36eafdSMike Gerdts AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
629bc36eafdSMike Gerdts ObjDesc->Buffer.Length);
630bc36eafdSMike Gerdts break;
631bc36eafdSMike Gerdts
632bc36eafdSMike Gerdts default:
633bc36eafdSMike Gerdts
634bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
635bc36eafdSMike Gerdts break;
636bc36eafdSMike Gerdts }
637bc36eafdSMike Gerdts break;
638bc36eafdSMike Gerdts
639bc36eafdSMike Gerdts default:
640bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
641bc36eafdSMike Gerdts break;
642bc36eafdSMike Gerdts }
643bc36eafdSMike Gerdts
644bc36eafdSMike Gerdts /* If debug turned off, done */
645bc36eafdSMike Gerdts
646bc36eafdSMike Gerdts if (!(AcpiDbgLevel & ACPI_LV_VALUES))
647bc36eafdSMike Gerdts {
648bc36eafdSMike Gerdts return (AE_OK);
649bc36eafdSMike Gerdts }
650bc36eafdSMike Gerdts
651bc36eafdSMike Gerdts /* If there is an attached object, display it */
652bc36eafdSMike Gerdts
653bc36eafdSMike Gerdts DbgLevel = AcpiDbgLevel;
654bc36eafdSMike Gerdts AcpiDbgLevel = 0;
655bc36eafdSMike Gerdts ObjDesc = AcpiNsGetAttachedObject (ThisNode);
656bc36eafdSMike Gerdts AcpiDbgLevel = DbgLevel;
657bc36eafdSMike Gerdts
658bc36eafdSMike Gerdts /* Dump attached objects */
659bc36eafdSMike Gerdts
660bc36eafdSMike Gerdts while (ObjDesc)
661bc36eafdSMike Gerdts {
662bc36eafdSMike Gerdts ObjType = ACPI_TYPE_INVALID;
663bc36eafdSMike Gerdts AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
664bc36eafdSMike Gerdts
665bc36eafdSMike Gerdts /* Decode the type of attached object and dump the contents */
666bc36eafdSMike Gerdts
667bc36eafdSMike Gerdts switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
668bc36eafdSMike Gerdts {
669bc36eafdSMike Gerdts case ACPI_DESC_TYPE_NAMED:
670bc36eafdSMike Gerdts
671bc36eafdSMike Gerdts AcpiOsPrintf ("(Ptr to Node)\n");
672bc36eafdSMike Gerdts BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
673bc36eafdSMike Gerdts ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
674bc36eafdSMike Gerdts break;
675bc36eafdSMike Gerdts
676bc36eafdSMike Gerdts case ACPI_DESC_TYPE_OPERAND:
677bc36eafdSMike Gerdts
678bc36eafdSMike Gerdts ObjType = ObjDesc->Common.Type;
679bc36eafdSMike Gerdts
680bc36eafdSMike Gerdts if (ObjType > ACPI_TYPE_LOCAL_MAX)
681bc36eafdSMike Gerdts {
682bc36eafdSMike Gerdts AcpiOsPrintf (
683bc36eafdSMike Gerdts "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
684bc36eafdSMike Gerdts ObjType);
685bc36eafdSMike Gerdts
686bc36eafdSMike Gerdts BytesToDump = 32;
687bc36eafdSMike Gerdts }
688bc36eafdSMike Gerdts else
689bc36eafdSMike Gerdts {
690bc36eafdSMike Gerdts AcpiOsPrintf (
691bc36eafdSMike Gerdts "(Pointer to ACPI Object type %.2X [%s])\n",
692bc36eafdSMike Gerdts ObjType, AcpiUtGetTypeName (ObjType));
693bc36eafdSMike Gerdts
694bc36eafdSMike Gerdts BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
695bc36eafdSMike Gerdts }
696bc36eafdSMike Gerdts
697bc36eafdSMike Gerdts ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
698bc36eafdSMike Gerdts break;
699bc36eafdSMike Gerdts
700bc36eafdSMike Gerdts default:
701bc36eafdSMike Gerdts
702bc36eafdSMike Gerdts break;
703bc36eafdSMike Gerdts }
704bc36eafdSMike Gerdts
705bc36eafdSMike Gerdts /* If value is NOT an internal object, we are done */
706bc36eafdSMike Gerdts
707bc36eafdSMike Gerdts if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
708bc36eafdSMike Gerdts {
709bc36eafdSMike Gerdts goto Cleanup;
710bc36eafdSMike Gerdts }
711bc36eafdSMike Gerdts
712bc36eafdSMike Gerdts /* Valid object, get the pointer to next level, if any */
713bc36eafdSMike Gerdts
714bc36eafdSMike Gerdts switch (ObjType)
715bc36eafdSMike Gerdts {
716bc36eafdSMike Gerdts case ACPI_TYPE_BUFFER:
717bc36eafdSMike Gerdts case ACPI_TYPE_STRING:
718bc36eafdSMike Gerdts /*
719bc36eafdSMike Gerdts * NOTE: takes advantage of common fields between string/buffer
720bc36eafdSMike Gerdts */
721bc36eafdSMike Gerdts BytesToDump = ObjDesc->String.Length;
722bc36eafdSMike Gerdts ObjDesc = (void *) ObjDesc->String.Pointer;
723bc36eafdSMike Gerdts
724bc36eafdSMike Gerdts AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n",
725bc36eafdSMike Gerdts ObjDesc, BytesToDump);
726bc36eafdSMike Gerdts ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
727bc36eafdSMike Gerdts goto Cleanup;
728bc36eafdSMike Gerdts
729bc36eafdSMike Gerdts case ACPI_TYPE_BUFFER_FIELD:
730bc36eafdSMike Gerdts
731bc36eafdSMike Gerdts ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
732bc36eafdSMike Gerdts break;
733bc36eafdSMike Gerdts
734bc36eafdSMike Gerdts case ACPI_TYPE_PACKAGE:
735bc36eafdSMike Gerdts
736bc36eafdSMike Gerdts ObjDesc = (void *) ObjDesc->Package.Elements;
737bc36eafdSMike Gerdts break;
738bc36eafdSMike Gerdts
739bc36eafdSMike Gerdts case ACPI_TYPE_METHOD:
740bc36eafdSMike Gerdts
741bc36eafdSMike Gerdts ObjDesc = (void *) ObjDesc->Method.AmlStart;
742bc36eafdSMike Gerdts break;
743bc36eafdSMike Gerdts
744bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_REGION_FIELD:
745bc36eafdSMike Gerdts
746bc36eafdSMike Gerdts ObjDesc = (void *) ObjDesc->Field.RegionObj;
747bc36eafdSMike Gerdts break;
748bc36eafdSMike Gerdts
749bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_BANK_FIELD:
750bc36eafdSMike Gerdts
751bc36eafdSMike Gerdts ObjDesc = (void *) ObjDesc->BankField.RegionObj;
752bc36eafdSMike Gerdts break;
753bc36eafdSMike Gerdts
754bc36eafdSMike Gerdts case ACPI_TYPE_LOCAL_INDEX_FIELD:
755bc36eafdSMike Gerdts
756bc36eafdSMike Gerdts ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
757bc36eafdSMike Gerdts break;
758bc36eafdSMike Gerdts
759bc36eafdSMike Gerdts default:
760bc36eafdSMike Gerdts
761bc36eafdSMike Gerdts goto Cleanup;
762bc36eafdSMike Gerdts }
763bc36eafdSMike Gerdts
764bc36eafdSMike Gerdts ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
765bc36eafdSMike Gerdts }
766bc36eafdSMike Gerdts
767bc36eafdSMike Gerdts Cleanup:
768bc36eafdSMike Gerdts AcpiOsPrintf ("\n");
769bc36eafdSMike Gerdts return (AE_OK);
770bc36eafdSMike Gerdts }
771bc36eafdSMike Gerdts
772bc36eafdSMike Gerdts
773bc36eafdSMike Gerdts /*******************************************************************************
774bc36eafdSMike Gerdts *
775bc36eafdSMike Gerdts * FUNCTION: AcpiNsDumpObjects
776bc36eafdSMike Gerdts *
777bc36eafdSMike Gerdts * PARAMETERS: Type - Object type to be dumped
778bc36eafdSMike Gerdts * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
779bc36eafdSMike Gerdts * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
780bc36eafdSMike Gerdts * for an effectively unlimited depth.
781bc36eafdSMike Gerdts * OwnerId - Dump only objects owned by this ID. Use
782bc36eafdSMike Gerdts * ACPI_UINT32_MAX to match all owners.
783bc36eafdSMike Gerdts * StartHandle - Where in namespace to start/end search
784bc36eafdSMike Gerdts *
785bc36eafdSMike Gerdts * RETURN: None
786bc36eafdSMike Gerdts *
787bc36eafdSMike Gerdts * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
788bc36eafdSMike Gerdts * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
789bc36eafdSMike Gerdts *
790bc36eafdSMike Gerdts ******************************************************************************/
791bc36eafdSMike Gerdts
792bc36eafdSMike Gerdts void
AcpiNsDumpObjects(ACPI_OBJECT_TYPE Type,UINT8 DisplayType,UINT32 MaxDepth,ACPI_OWNER_ID OwnerId,ACPI_HANDLE StartHandle)793bc36eafdSMike Gerdts AcpiNsDumpObjects (
794bc36eafdSMike Gerdts ACPI_OBJECT_TYPE Type,
795bc36eafdSMike Gerdts UINT8 DisplayType,
796bc36eafdSMike Gerdts UINT32 MaxDepth,
797bc36eafdSMike Gerdts ACPI_OWNER_ID OwnerId,
798bc36eafdSMike Gerdts ACPI_HANDLE StartHandle)
799bc36eafdSMike Gerdts {
800bc36eafdSMike Gerdts ACPI_WALK_INFO Info;
801bc36eafdSMike Gerdts ACPI_STATUS Status;
802bc36eafdSMike Gerdts
803bc36eafdSMike Gerdts
804bc36eafdSMike Gerdts ACPI_FUNCTION_ENTRY ();
805bc36eafdSMike Gerdts
806bc36eafdSMike Gerdts
807bc36eafdSMike Gerdts /*
808bc36eafdSMike Gerdts * Just lock the entire namespace for the duration of the dump.
809bc36eafdSMike Gerdts * We don't want any changes to the namespace during this time,
810bc36eafdSMike Gerdts * especially the temporary nodes since we are going to display
811bc36eafdSMike Gerdts * them also.
812bc36eafdSMike Gerdts */
813bc36eafdSMike Gerdts Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
814bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
815bc36eafdSMike Gerdts {
816bc36eafdSMike Gerdts AcpiOsPrintf ("Could not acquire namespace mutex\n");
817bc36eafdSMike Gerdts return;
818bc36eafdSMike Gerdts }
819bc36eafdSMike Gerdts
820*35786f68SRobert Mustacchi Info.Count = 0;
821bc36eafdSMike Gerdts Info.DebugLevel = ACPI_LV_TABLES;
822bc36eafdSMike Gerdts Info.OwnerId = OwnerId;
823bc36eafdSMike Gerdts Info.DisplayType = DisplayType;
824bc36eafdSMike Gerdts
825bc36eafdSMike Gerdts (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
826bc36eafdSMike Gerdts ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
827bc36eafdSMike Gerdts AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
828bc36eafdSMike Gerdts
829*35786f68SRobert Mustacchi AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count);
830bc36eafdSMike Gerdts (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
831bc36eafdSMike Gerdts }
832bc36eafdSMike Gerdts
833bc36eafdSMike Gerdts
834bc36eafdSMike Gerdts /*******************************************************************************
835bc36eafdSMike Gerdts *
836bc36eafdSMike Gerdts * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
837bc36eafdSMike Gerdts *
838bc36eafdSMike Gerdts * PARAMETERS: ObjHandle - Node to be dumped
839bc36eafdSMike Gerdts * Level - Nesting level of the handle
840bc36eafdSMike Gerdts * Context - Passed into WalkNamespace
841bc36eafdSMike Gerdts * ReturnValue - Not used
842bc36eafdSMike Gerdts *
843bc36eafdSMike Gerdts * RETURN: Status
844bc36eafdSMike Gerdts *
845bc36eafdSMike Gerdts * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
846bc36eafdSMike Gerdts * computes the maximum nesting depth in the namespace tree, in
847bc36eafdSMike Gerdts * order to simplify formatting in AcpiNsDumpOneObjectPath.
848bc36eafdSMike Gerdts * These procedures are UserFunctions called by AcpiNsWalkNamespace.
849bc36eafdSMike Gerdts *
850bc36eafdSMike Gerdts ******************************************************************************/
851bc36eafdSMike Gerdts
852bc36eafdSMike Gerdts static ACPI_STATUS
AcpiNsDumpOneObjectPath(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)853bc36eafdSMike Gerdts AcpiNsDumpOneObjectPath (
854bc36eafdSMike Gerdts ACPI_HANDLE ObjHandle,
855bc36eafdSMike Gerdts UINT32 Level,
856bc36eafdSMike Gerdts void *Context,
857bc36eafdSMike Gerdts void **ReturnValue)
858bc36eafdSMike Gerdts {
859bc36eafdSMike Gerdts UINT32 MaxLevel = *((UINT32 *) Context);
860bc36eafdSMike Gerdts char *Pathname;
861bc36eafdSMike Gerdts ACPI_NAMESPACE_NODE *Node;
862bc36eafdSMike Gerdts int PathIndent;
863bc36eafdSMike Gerdts
864bc36eafdSMike Gerdts
865bc36eafdSMike Gerdts if (!ObjHandle)
866bc36eafdSMike Gerdts {
867bc36eafdSMike Gerdts return (AE_OK);
868bc36eafdSMike Gerdts }
869bc36eafdSMike Gerdts
870bc36eafdSMike Gerdts Node = AcpiNsValidateHandle (ObjHandle);
871bc36eafdSMike Gerdts if (!Node)
872bc36eafdSMike Gerdts {
873bc36eafdSMike Gerdts /* Ignore bad node during namespace walk */
874bc36eafdSMike Gerdts
875bc36eafdSMike Gerdts return (AE_OK);
876bc36eafdSMike Gerdts }
877bc36eafdSMike Gerdts
878bc36eafdSMike Gerdts Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
879bc36eafdSMike Gerdts
880bc36eafdSMike Gerdts PathIndent = 1;
881bc36eafdSMike Gerdts if (Level <= MaxLevel)
882bc36eafdSMike Gerdts {
883bc36eafdSMike Gerdts PathIndent = MaxLevel - Level + 1;
884bc36eafdSMike Gerdts }
885bc36eafdSMike Gerdts
886bc36eafdSMike Gerdts AcpiOsPrintf ("%2d%*s%-12s%*s",
887bc36eafdSMike Gerdts Level, Level, " ", AcpiUtGetTypeName (Node->Type),
888bc36eafdSMike Gerdts PathIndent, " ");
889bc36eafdSMike Gerdts
890bc36eafdSMike Gerdts AcpiOsPrintf ("%s\n", &Pathname[1]);
891bc36eafdSMike Gerdts ACPI_FREE (Pathname);
892bc36eafdSMike Gerdts return (AE_OK);
893bc36eafdSMike Gerdts }
894bc36eafdSMike Gerdts
895bc36eafdSMike Gerdts
896bc36eafdSMike Gerdts static ACPI_STATUS
AcpiNsGetMaxDepth(ACPI_HANDLE ObjHandle,UINT32 Level,void * Context,void ** ReturnValue)897bc36eafdSMike Gerdts AcpiNsGetMaxDepth (
898bc36eafdSMike Gerdts ACPI_HANDLE ObjHandle,
899bc36eafdSMike Gerdts UINT32 Level,
900bc36eafdSMike Gerdts void *Context,
901bc36eafdSMike Gerdts void **ReturnValue)
902bc36eafdSMike Gerdts {
903bc36eafdSMike Gerdts UINT32 *MaxLevel = (UINT32 *) Context;
904bc36eafdSMike Gerdts
905bc36eafdSMike Gerdts
906bc36eafdSMike Gerdts if (Level > *MaxLevel)
907bc36eafdSMike Gerdts {
908bc36eafdSMike Gerdts *MaxLevel = Level;
909bc36eafdSMike Gerdts }
910bc36eafdSMike Gerdts return (AE_OK);
911bc36eafdSMike Gerdts }
912bc36eafdSMike Gerdts
913bc36eafdSMike Gerdts
914bc36eafdSMike Gerdts /*******************************************************************************
915bc36eafdSMike Gerdts *
916bc36eafdSMike Gerdts * FUNCTION: AcpiNsDumpObjectPaths
917bc36eafdSMike Gerdts *
918bc36eafdSMike Gerdts * PARAMETERS: Type - Object type to be dumped
919bc36eafdSMike Gerdts * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
920bc36eafdSMike Gerdts * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
921bc36eafdSMike Gerdts * for an effectively unlimited depth.
922bc36eafdSMike Gerdts * OwnerId - Dump only objects owned by this ID. Use
923bc36eafdSMike Gerdts * ACPI_UINT32_MAX to match all owners.
924bc36eafdSMike Gerdts * StartHandle - Where in namespace to start/end search
925bc36eafdSMike Gerdts *
926bc36eafdSMike Gerdts * RETURN: None
927bc36eafdSMike Gerdts *
928bc36eafdSMike Gerdts * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
929bc36eafdSMike Gerdts * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
930bc36eafdSMike Gerdts *
931bc36eafdSMike Gerdts ******************************************************************************/
932bc36eafdSMike Gerdts
933bc36eafdSMike Gerdts void
AcpiNsDumpObjectPaths(ACPI_OBJECT_TYPE Type,UINT8 DisplayType,UINT32 MaxDepth,ACPI_OWNER_ID OwnerId,ACPI_HANDLE StartHandle)934bc36eafdSMike Gerdts AcpiNsDumpObjectPaths (
935bc36eafdSMike Gerdts ACPI_OBJECT_TYPE Type,
936bc36eafdSMike Gerdts UINT8 DisplayType,
937bc36eafdSMike Gerdts UINT32 MaxDepth,
938bc36eafdSMike Gerdts ACPI_OWNER_ID OwnerId,
939bc36eafdSMike Gerdts ACPI_HANDLE StartHandle)
940bc36eafdSMike Gerdts {
941bc36eafdSMike Gerdts ACPI_STATUS Status;
942bc36eafdSMike Gerdts UINT32 MaxLevel = 0;
943bc36eafdSMike Gerdts
944bc36eafdSMike Gerdts
945bc36eafdSMike Gerdts ACPI_FUNCTION_ENTRY ();
946bc36eafdSMike Gerdts
947bc36eafdSMike Gerdts
948bc36eafdSMike Gerdts /*
949bc36eafdSMike Gerdts * Just lock the entire namespace for the duration of the dump.
950bc36eafdSMike Gerdts * We don't want any changes to the namespace during this time,
951bc36eafdSMike Gerdts * especially the temporary nodes since we are going to display
952bc36eafdSMike Gerdts * them also.
953bc36eafdSMike Gerdts */
954bc36eafdSMike Gerdts Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
955bc36eafdSMike Gerdts if (ACPI_FAILURE (Status))
956bc36eafdSMike Gerdts {
957bc36eafdSMike Gerdts AcpiOsPrintf ("Could not acquire namespace mutex\n");
958bc36eafdSMike Gerdts return;
959bc36eafdSMike Gerdts }
960bc36eafdSMike Gerdts
961bc36eafdSMike Gerdts /* Get the max depth of the namespace tree, for formatting later */
962bc36eafdSMike Gerdts
963bc36eafdSMike Gerdts (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
964bc36eafdSMike Gerdts ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
965bc36eafdSMike Gerdts AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
966bc36eafdSMike Gerdts
967bc36eafdSMike Gerdts /* Now dump the entire namespace */
968bc36eafdSMike Gerdts
969bc36eafdSMike Gerdts (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
970bc36eafdSMike Gerdts ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
971bc36eafdSMike Gerdts AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
972bc36eafdSMike Gerdts
973bc36eafdSMike Gerdts (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
974bc36eafdSMike Gerdts }
975bc36eafdSMike Gerdts
976bc36eafdSMike Gerdts
977bc36eafdSMike Gerdts /*******************************************************************************
978bc36eafdSMike Gerdts *
979bc36eafdSMike Gerdts * FUNCTION: AcpiNsDumpEntry
980bc36eafdSMike Gerdts *
981bc36eafdSMike Gerdts * PARAMETERS: Handle - Node to be dumped
982bc36eafdSMike Gerdts * DebugLevel - Output level
983bc36eafdSMike Gerdts *
984bc36eafdSMike Gerdts * RETURN: None
985bc36eafdSMike Gerdts *
986bc36eafdSMike Gerdts * DESCRIPTION: Dump a single Node
987bc36eafdSMike Gerdts *
988bc36eafdSMike Gerdts ******************************************************************************/
989bc36eafdSMike Gerdts
990bc36eafdSMike Gerdts void
AcpiNsDumpEntry(ACPI_HANDLE Handle,UINT32 DebugLevel)991bc36eafdSMike Gerdts AcpiNsDumpEntry (
992bc36eafdSMike Gerdts ACPI_HANDLE Handle,
993bc36eafdSMike Gerdts UINT32 DebugLevel)
994bc36eafdSMike Gerdts {
995bc36eafdSMike Gerdts ACPI_WALK_INFO Info;
996bc36eafdSMike Gerdts
997bc36eafdSMike Gerdts
998bc36eafdSMike Gerdts ACPI_FUNCTION_ENTRY ();
999bc36eafdSMike Gerdts
1000bc36eafdSMike Gerdts
1001bc36eafdSMike Gerdts Info.DebugLevel = DebugLevel;
1002bc36eafdSMike Gerdts Info.OwnerId = ACPI_OWNER_ID_MAX;
1003bc36eafdSMike Gerdts Info.DisplayType = ACPI_DISPLAY_SUMMARY;
1004bc36eafdSMike Gerdts
1005bc36eafdSMike Gerdts (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
1006bc36eafdSMike Gerdts }
1007bc36eafdSMike Gerdts
1008bc36eafdSMike Gerdts
1009bc36eafdSMike Gerdts #ifdef ACPI_ASL_COMPILER
1010bc36eafdSMike Gerdts /*******************************************************************************
1011bc36eafdSMike Gerdts *
1012bc36eafdSMike Gerdts * FUNCTION: AcpiNsDumpTables
1013bc36eafdSMike Gerdts *
1014bc36eafdSMike Gerdts * PARAMETERS: SearchBase - Root of subtree to be dumped, or
1015bc36eafdSMike Gerdts * NS_ALL to dump the entire namespace
1016bc36eafdSMike Gerdts * MaxDepth - Maximum depth of dump. Use INT_MAX
1017bc36eafdSMike Gerdts * for an effectively unlimited depth.
1018bc36eafdSMike Gerdts *
1019bc36eafdSMike Gerdts * RETURN: None
1020bc36eafdSMike Gerdts *
1021bc36eafdSMike Gerdts * DESCRIPTION: Dump the name space, or a portion of it.
1022bc36eafdSMike Gerdts *
1023bc36eafdSMike Gerdts ******************************************************************************/
1024bc36eafdSMike Gerdts
1025bc36eafdSMike Gerdts void
AcpiNsDumpTables(ACPI_HANDLE SearchBase,UINT32 MaxDepth)1026bc36eafdSMike Gerdts AcpiNsDumpTables (
1027bc36eafdSMike Gerdts ACPI_HANDLE SearchBase,
1028bc36eafdSMike Gerdts UINT32 MaxDepth)
1029bc36eafdSMike Gerdts {
1030bc36eafdSMike Gerdts ACPI_HANDLE SearchHandle = SearchBase;
1031bc36eafdSMike Gerdts
1032bc36eafdSMike Gerdts
1033bc36eafdSMike Gerdts ACPI_FUNCTION_TRACE (NsDumpTables);
1034bc36eafdSMike Gerdts
1035bc36eafdSMike Gerdts
1036bc36eafdSMike Gerdts if (!AcpiGbl_RootNode)
1037bc36eafdSMike Gerdts {
1038bc36eafdSMike Gerdts /*
1039bc36eafdSMike Gerdts * If the name space has not been initialized,
1040bc36eafdSMike Gerdts * there is nothing to dump.
1041bc36eafdSMike Gerdts */
1042bc36eafdSMike Gerdts ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
1043bc36eafdSMike Gerdts "namespace not initialized!\n"));
1044bc36eafdSMike Gerdts return_VOID;
1045bc36eafdSMike Gerdts }
1046bc36eafdSMike Gerdts
1047bc36eafdSMike Gerdts if (ACPI_NS_ALL == SearchBase)
1048bc36eafdSMike Gerdts {
1049bc36eafdSMike Gerdts /* Entire namespace */
1050bc36eafdSMike Gerdts
1051bc36eafdSMike Gerdts SearchHandle = AcpiGbl_RootNode;
1052bc36eafdSMike Gerdts ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
1053bc36eafdSMike Gerdts }
1054bc36eafdSMike Gerdts
1055bc36eafdSMike Gerdts AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
1056bc36eafdSMike Gerdts ACPI_OWNER_ID_MAX, SearchHandle);
1057bc36eafdSMike Gerdts return_VOID;
1058bc36eafdSMike Gerdts }
1059bc36eafdSMike Gerdts #endif
1060bc36eafdSMike Gerdts #endif
1061