xref: /onnv-gate/usr/src/uts/intel/io/acpica/namespace/nsdump.c (revision 3446:5903aece022d)
1*3446Smrj /******************************************************************************
2*3446Smrj  *
3*3446Smrj  * Module Name: nsdump - table dumping routines for debug
4*3446Smrj  *              $Revision: 1.178 $
5*3446Smrj  *
6*3446Smrj  *****************************************************************************/
7*3446Smrj 
8*3446Smrj /******************************************************************************
9*3446Smrj  *
10*3446Smrj  * 1. Copyright Notice
11*3446Smrj  *
12*3446Smrj  * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
13*3446Smrj  * All rights reserved.
14*3446Smrj  *
15*3446Smrj  * 2. License
16*3446Smrj  *
17*3446Smrj  * 2.1. This is your license from Intel Corp. under its intellectual property
18*3446Smrj  * rights.  You may have additional license terms from the party that provided
19*3446Smrj  * you this software, covering your right to use that party's intellectual
20*3446Smrj  * property rights.
21*3446Smrj  *
22*3446Smrj  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23*3446Smrj  * copy of the source code appearing in this file ("Covered Code") an
24*3446Smrj  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25*3446Smrj  * base code distributed originally by Intel ("Original Intel Code") to copy,
26*3446Smrj 
27*3446Smrj  * make derivatives, distribute, use and display any portion of the Covered
28*3446Smrj  * Code in any form, with the right to sublicense such rights; and
29*3446Smrj  *
30*3446Smrj  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31*3446Smrj  * license (with the right to sublicense), under only those claims of Intel
32*3446Smrj  * patents that are infringed by the Original Intel Code, to make, use, sell,
33*3446Smrj  * offer to sell, and import the Covered Code and derivative works thereof
34*3446Smrj  * solely to the minimum extent necessary to exercise the above copyright
35*3446Smrj  * license, and in no event shall the patent license extend to any additions
36*3446Smrj  * to or modifications of the Original Intel Code.  No other license or right
37*3446Smrj  * is granted directly or by implication, estoppel or otherwise;
38*3446Smrj  *
39*3446Smrj  * The above copyright and patent license is granted only if the following
40*3446Smrj  * conditions are met:
41*3446Smrj  *
42*3446Smrj  * 3. Conditions
43*3446Smrj  *
44*3446Smrj  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45*3446Smrj  * Redistribution of source code of any substantial portion of the Covered
46*3446Smrj  * Code or modification with rights to further distribute source must include
47*3446Smrj  * the above Copyright Notice, the above License, this list of Conditions,
48*3446Smrj  * and the following Disclaimer and Export Compliance provision.  In addition,
49*3446Smrj  * Licensee must cause all Covered Code to which Licensee contributes to
50*3446Smrj  * contain a file documenting the changes Licensee made to create that Covered
51*3446Smrj  * Code and the date of any change.  Licensee must include in that file the
52*3446Smrj  * documentation of any changes made by any predecessor Licensee.  Licensee
53*3446Smrj  * must include a prominent statement that the modification is derived,
54*3446Smrj  * directly or indirectly, from Original Intel Code.
55*3446Smrj  *
56*3446Smrj  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57*3446Smrj  * Redistribution of source code of any substantial portion of the Covered
58*3446Smrj  * Code or modification without rights to further distribute source must
59*3446Smrj  * include the following Disclaimer and Export Compliance provision in the
60*3446Smrj  * documentation and/or other materials provided with distribution.  In
61*3446Smrj  * addition, Licensee may not authorize further sublicense of source of any
62*3446Smrj  * portion of the Covered Code, and must include terms to the effect that the
63*3446Smrj  * license from Licensee to its licensee is limited to the intellectual
64*3446Smrj  * property embodied in the software Licensee provides to its licensee, and
65*3446Smrj  * not to intellectual property embodied in modifications its licensee may
66*3446Smrj  * make.
67*3446Smrj  *
68*3446Smrj  * 3.3. Redistribution of Executable. Redistribution in executable form of any
69*3446Smrj  * substantial portion of the Covered Code or modification must reproduce the
70*3446Smrj  * above Copyright Notice, and the following Disclaimer and Export Compliance
71*3446Smrj  * provision in the documentation and/or other materials provided with the
72*3446Smrj  * distribution.
73*3446Smrj  *
74*3446Smrj  * 3.4. Intel retains all right, title, and interest in and to the Original
75*3446Smrj  * Intel Code.
76*3446Smrj  *
77*3446Smrj  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78*3446Smrj  * Intel shall be used in advertising or otherwise to promote the sale, use or
79*3446Smrj  * other dealings in products derived from or relating to the Covered Code
80*3446Smrj  * without prior written authorization from Intel.
81*3446Smrj  *
82*3446Smrj  * 4. Disclaimer and Export Compliance
83*3446Smrj  *
84*3446Smrj  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85*3446Smrj  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86*3446Smrj  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87*3446Smrj  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88*3446Smrj  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89*3446Smrj  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90*3446Smrj  * PARTICULAR PURPOSE.
91*3446Smrj  *
92*3446Smrj  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93*3446Smrj  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94*3446Smrj  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95*3446Smrj  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96*3446Smrj  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97*3446Smrj  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98*3446Smrj  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99*3446Smrj  * LIMITED REMEDY.
100*3446Smrj  *
101*3446Smrj  * 4.3. Licensee shall not export, either directly or indirectly, any of this
102*3446Smrj  * software or system incorporating such software without first obtaining any
103*3446Smrj  * required license or other approval from the U. S. Department of Commerce or
104*3446Smrj  * any other agency or department of the United States Government.  In the
105*3446Smrj  * event Licensee exports any such software from the United States or
106*3446Smrj  * re-exports any such software from a foreign destination, Licensee shall
107*3446Smrj  * ensure that the distribution and export/re-export of the software is in
108*3446Smrj  * compliance with all laws, regulations, orders, or other restrictions of the
109*3446Smrj  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110*3446Smrj  * any of its subsidiaries will export/re-export any technical data, process,
111*3446Smrj  * software, or service, directly or indirectly, to any country for which the
112*3446Smrj  * United States government or any agency thereof requires an export license,
113*3446Smrj  * other governmental approval, or letter of assurance, without first obtaining
114*3446Smrj  * such license, approval or letter.
115*3446Smrj  *
116*3446Smrj  *****************************************************************************/
117*3446Smrj 
118*3446Smrj #define __NSDUMP_C__
119*3446Smrj 
120*3446Smrj #include "acpi.h"
121*3446Smrj #include "acnamesp.h"
122*3446Smrj #include "acparser.h"
123*3446Smrj 
124*3446Smrj 
125*3446Smrj #define _COMPONENT          ACPI_NAMESPACE
126*3446Smrj         ACPI_MODULE_NAME    ("nsdump")
127*3446Smrj 
128*3446Smrj /* Local prototypes */
129*3446Smrj 
130*3446Smrj #ifdef ACPI_OBSOLETE_FUNCTIONS
131*3446Smrj void
132*3446Smrj AcpiNsDumpRootDevices (
133*3446Smrj     void);
134*3446Smrj 
135*3446Smrj static ACPI_STATUS
136*3446Smrj AcpiNsDumpOneDevice (
137*3446Smrj     ACPI_HANDLE             ObjHandle,
138*3446Smrj     UINT32                  Level,
139*3446Smrj     void                    *Context,
140*3446Smrj     void                    **ReturnValue);
141*3446Smrj #endif
142*3446Smrj 
143*3446Smrj 
144*3446Smrj #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
145*3446Smrj /*******************************************************************************
146*3446Smrj  *
147*3446Smrj  * FUNCTION:    AcpiNsPrintPathname
148*3446Smrj  *
149*3446Smrj  * PARAMETERS:  NumSegments         - Number of ACPI name segments
150*3446Smrj  *              Pathname            - The compressed (internal) path
151*3446Smrj  *
152*3446Smrj  * RETURN:      None
153*3446Smrj  *
154*3446Smrj  * DESCRIPTION: Print an object's full namespace pathname
155*3446Smrj  *
156*3446Smrj  ******************************************************************************/
157*3446Smrj 
158*3446Smrj void
159*3446Smrj AcpiNsPrintPathname (
160*3446Smrj     UINT32                  NumSegments,
161*3446Smrj     char                    *Pathname)
162*3446Smrj {
163*3446Smrj     ACPI_NATIVE_UINT        i;
164*3446Smrj 
165*3446Smrj 
166*3446Smrj     ACPI_FUNCTION_NAME (NsPrintPathname);
167*3446Smrj 
168*3446Smrj 
169*3446Smrj     if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
170*3446Smrj     {
171*3446Smrj         return;
172*3446Smrj     }
173*3446Smrj 
174*3446Smrj     /* Print the entire name */
175*3446Smrj 
176*3446Smrj     ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
177*3446Smrj 
178*3446Smrj     while (NumSegments)
179*3446Smrj     {
180*3446Smrj         for (i = 0; i < 4; i++)
181*3446Smrj         {
182*3446Smrj             ACPI_IS_PRINT (Pathname[i]) ?
183*3446Smrj                 AcpiOsPrintf ("%c", Pathname[i]) :
184*3446Smrj                 AcpiOsPrintf ("?");
185*3446Smrj         }
186*3446Smrj 
187*3446Smrj         Pathname += ACPI_NAME_SIZE;
188*3446Smrj         NumSegments--;
189*3446Smrj         if (NumSegments)
190*3446Smrj         {
191*3446Smrj             AcpiOsPrintf (".");
192*3446Smrj         }
193*3446Smrj     }
194*3446Smrj 
195*3446Smrj     AcpiOsPrintf ("]\n");
196*3446Smrj }
197*3446Smrj 
198*3446Smrj 
199*3446Smrj /*******************************************************************************
200*3446Smrj  *
201*3446Smrj  * FUNCTION:    AcpiNsDumpPathname
202*3446Smrj  *
203*3446Smrj  * PARAMETERS:  Handle              - Object
204*3446Smrj  *              Msg                 - Prefix message
205*3446Smrj  *              Level               - Desired debug level
206*3446Smrj  *              Component           - Caller's component ID
207*3446Smrj  *
208*3446Smrj  * RETURN:      None
209*3446Smrj  *
210*3446Smrj  * DESCRIPTION: Print an object's full namespace pathname
211*3446Smrj  *              Manages allocation/freeing of a pathname buffer
212*3446Smrj  *
213*3446Smrj  ******************************************************************************/
214*3446Smrj 
215*3446Smrj void
216*3446Smrj AcpiNsDumpPathname (
217*3446Smrj     ACPI_HANDLE             Handle,
218*3446Smrj     char                    *Msg,
219*3446Smrj     UINT32                  Level,
220*3446Smrj     UINT32                  Component)
221*3446Smrj {
222*3446Smrj 
223*3446Smrj     ACPI_FUNCTION_TRACE (NsDumpPathname);
224*3446Smrj 
225*3446Smrj 
226*3446Smrj     /* Do this only if the requested debug level and component are enabled */
227*3446Smrj 
228*3446Smrj     if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
229*3446Smrj     {
230*3446Smrj         return_VOID;
231*3446Smrj     }
232*3446Smrj 
233*3446Smrj     /* Convert handle to a full pathname and print it (with supplied message) */
234*3446Smrj 
235*3446Smrj     AcpiNsPrintNodePathname (Handle, Msg);
236*3446Smrj     AcpiOsPrintf ("\n");
237*3446Smrj     return_VOID;
238*3446Smrj }
239*3446Smrj 
240*3446Smrj 
241*3446Smrj /*******************************************************************************
242*3446Smrj  *
243*3446Smrj  * FUNCTION:    AcpiNsDumpOneObject
244*3446Smrj  *
245*3446Smrj  * PARAMETERS:  ObjHandle           - Node to be dumped
246*3446Smrj  *              Level               - Nesting level of the handle
247*3446Smrj  *              Context             - Passed into WalkNamespace
248*3446Smrj  *              ReturnValue         - Not used
249*3446Smrj  *
250*3446Smrj  * RETURN:      Status
251*3446Smrj  *
252*3446Smrj  * DESCRIPTION: Dump a single Node
253*3446Smrj  *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
254*3446Smrj  *
255*3446Smrj  ******************************************************************************/
256*3446Smrj 
257*3446Smrj ACPI_STATUS
258*3446Smrj AcpiNsDumpOneObject (
259*3446Smrj     ACPI_HANDLE             ObjHandle,
260*3446Smrj     UINT32                  Level,
261*3446Smrj     void                    *Context,
262*3446Smrj     void                    **ReturnValue)
263*3446Smrj {
264*3446Smrj     ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
265*3446Smrj     ACPI_NAMESPACE_NODE     *ThisNode;
266*3446Smrj     ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
267*3446Smrj     ACPI_OBJECT_TYPE        ObjType;
268*3446Smrj     ACPI_OBJECT_TYPE        Type;
269*3446Smrj     UINT32                  BytesToDump;
270*3446Smrj     UINT32                  DbgLevel;
271*3446Smrj     UINT32                  i;
272*3446Smrj 
273*3446Smrj 
274*3446Smrj     ACPI_FUNCTION_NAME (NsDumpOneObject);
275*3446Smrj 
276*3446Smrj 
277*3446Smrj     /* Is output enabled? */
278*3446Smrj 
279*3446Smrj     if (!(AcpiDbgLevel & Info->DebugLevel))
280*3446Smrj     {
281*3446Smrj         return (AE_OK);
282*3446Smrj     }
283*3446Smrj 
284*3446Smrj     if (!ObjHandle)
285*3446Smrj     {
286*3446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
287*3446Smrj         return (AE_OK);
288*3446Smrj     }
289*3446Smrj 
290*3446Smrj     ThisNode = AcpiNsMapHandleToNode (ObjHandle);
291*3446Smrj     Type = ThisNode->Type;
292*3446Smrj 
293*3446Smrj     /* Check if the owner matches */
294*3446Smrj 
295*3446Smrj     if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
296*3446Smrj         (Info->OwnerId != ThisNode->OwnerId))
297*3446Smrj     {
298*3446Smrj         return (AE_OK);
299*3446Smrj     }
300*3446Smrj 
301*3446Smrj     if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
302*3446Smrj     {
303*3446Smrj         /* Indent the object according to the level */
304*3446Smrj 
305*3446Smrj         AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
306*3446Smrj 
307*3446Smrj         /* Check the node type and name */
308*3446Smrj 
309*3446Smrj         if (Type > ACPI_TYPE_LOCAL_MAX)
310*3446Smrj         {
311*3446Smrj             ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type));
312*3446Smrj         }
313*3446Smrj 
314*3446Smrj         if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
315*3446Smrj         {
316*3446Smrj             ThisNode->Name.Integer = AcpiUtRepairName (ThisNode->Name.Integer);
317*3446Smrj 
318*3446Smrj             ACPI_WARNING ((AE_INFO, "Invalid ACPI Name %08X",
319*3446Smrj                 ThisNode->Name.Integer));
320*3446Smrj         }
321*3446Smrj 
322*3446Smrj         AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
323*3446Smrj     }
324*3446Smrj 
325*3446Smrj     /*
326*3446Smrj      * Now we can print out the pertinent information
327*3446Smrj      */
328*3446Smrj     AcpiOsPrintf (" %-12s %p %2.2X ",
329*3446Smrj             AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
330*3446Smrj 
331*3446Smrj     DbgLevel = AcpiDbgLevel;
332*3446Smrj     AcpiDbgLevel = 0;
333*3446Smrj     ObjDesc = AcpiNsGetAttachedObject (ThisNode);
334*3446Smrj     AcpiDbgLevel = DbgLevel;
335*3446Smrj 
336*3446Smrj     switch (Info->DisplayType & ACPI_DISPLAY_MASK)
337*3446Smrj     {
338*3446Smrj     case ACPI_DISPLAY_SUMMARY:
339*3446Smrj 
340*3446Smrj         if (!ObjDesc)
341*3446Smrj         {
342*3446Smrj             /* No attached object, we are done */
343*3446Smrj 
344*3446Smrj             AcpiOsPrintf ("\n");
345*3446Smrj             return (AE_OK);
346*3446Smrj         }
347*3446Smrj 
348*3446Smrj         switch (Type)
349*3446Smrj         {
350*3446Smrj         case ACPI_TYPE_PROCESSOR:
351*3446Smrj 
352*3446Smrj             AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
353*3446Smrj                 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
354*3446Smrj                 (char *) ObjDesc->Processor.Address);
355*3446Smrj             break;
356*3446Smrj 
357*3446Smrj 
358*3446Smrj         case ACPI_TYPE_DEVICE:
359*3446Smrj 
360*3446Smrj             AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
361*3446Smrj             break;
362*3446Smrj 
363*3446Smrj 
364*3446Smrj         case ACPI_TYPE_METHOD:
365*3446Smrj 
366*3446Smrj             AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
367*3446Smrj                 (UINT32) ObjDesc->Method.ParamCount,
368*3446Smrj                 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
369*3446Smrj             break;
370*3446Smrj 
371*3446Smrj 
372*3446Smrj         case ACPI_TYPE_INTEGER:
373*3446Smrj 
374*3446Smrj             AcpiOsPrintf ("= %8.8X%8.8X\n",
375*3446Smrj                 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
376*3446Smrj             break;
377*3446Smrj 
378*3446Smrj 
379*3446Smrj         case ACPI_TYPE_PACKAGE:
380*3446Smrj 
381*3446Smrj             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
382*3446Smrj             {
383*3446Smrj                 AcpiOsPrintf ("Elements %.2X\n",
384*3446Smrj                     ObjDesc->Package.Count);
385*3446Smrj             }
386*3446Smrj             else
387*3446Smrj             {
388*3446Smrj                 AcpiOsPrintf ("[Length not yet evaluated]\n");
389*3446Smrj             }
390*3446Smrj             break;
391*3446Smrj 
392*3446Smrj 
393*3446Smrj         case ACPI_TYPE_BUFFER:
394*3446Smrj 
395*3446Smrj             if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
396*3446Smrj             {
397*3446Smrj                 AcpiOsPrintf ("Len %.2X",
398*3446Smrj                             ObjDesc->Buffer.Length);
399*3446Smrj 
400*3446Smrj                 /* Dump some of the buffer */
401*3446Smrj 
402*3446Smrj                 if (ObjDesc->Buffer.Length > 0)
403*3446Smrj                 {
404*3446Smrj                     AcpiOsPrintf (" =");
405*3446Smrj                     for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
406*3446Smrj                     {
407*3446Smrj                         AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
408*3446Smrj                     }
409*3446Smrj                 }
410*3446Smrj                 AcpiOsPrintf ("\n");
411*3446Smrj             }
412*3446Smrj             else
413*3446Smrj             {
414*3446Smrj                 AcpiOsPrintf ("[Length not yet evaluated]\n");
415*3446Smrj             }
416*3446Smrj             break;
417*3446Smrj 
418*3446Smrj 
419*3446Smrj         case ACPI_TYPE_STRING:
420*3446Smrj 
421*3446Smrj             AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
422*3446Smrj             AcpiUtPrintString (ObjDesc->String.Pointer, 32);
423*3446Smrj             AcpiOsPrintf ("\n");
424*3446Smrj             break;
425*3446Smrj 
426*3446Smrj 
427*3446Smrj         case ACPI_TYPE_REGION:
428*3446Smrj 
429*3446Smrj             AcpiOsPrintf ("[%s]",
430*3446Smrj                 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
431*3446Smrj             if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
432*3446Smrj             {
433*3446Smrj                 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
434*3446Smrj                     ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
435*3446Smrj                     ObjDesc->Region.Length);
436*3446Smrj             }
437*3446Smrj             else
438*3446Smrj             {
439*3446Smrj                 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
440*3446Smrj             }
441*3446Smrj             break;
442*3446Smrj 
443*3446Smrj 
444*3446Smrj         case ACPI_TYPE_LOCAL_REFERENCE:
445*3446Smrj 
446*3446Smrj             AcpiOsPrintf ("[%s]\n",
447*3446Smrj                 AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode));
448*3446Smrj             break;
449*3446Smrj 
450*3446Smrj 
451*3446Smrj         case ACPI_TYPE_BUFFER_FIELD:
452*3446Smrj 
453*3446Smrj             if (ObjDesc->BufferField.BufferObj &&
454*3446Smrj                 ObjDesc->BufferField.BufferObj->Buffer.Node)
455*3446Smrj             {
456*3446Smrj                 AcpiOsPrintf ("Buf [%4.4s]",
457*3446Smrj                     AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node));
458*3446Smrj             }
459*3446Smrj             break;
460*3446Smrj 
461*3446Smrj 
462*3446Smrj         case ACPI_TYPE_LOCAL_REGION_FIELD:
463*3446Smrj 
464*3446Smrj             AcpiOsPrintf ("Rgn [%4.4s]",
465*3446Smrj                 AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node));
466*3446Smrj             break;
467*3446Smrj 
468*3446Smrj 
469*3446Smrj         case ACPI_TYPE_LOCAL_BANK_FIELD:
470*3446Smrj 
471*3446Smrj             AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
472*3446Smrj                 AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node),
473*3446Smrj                 AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node));
474*3446Smrj             break;
475*3446Smrj 
476*3446Smrj 
477*3446Smrj         case ACPI_TYPE_LOCAL_INDEX_FIELD:
478*3446Smrj 
479*3446Smrj             AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
480*3446Smrj                 AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node),
481*3446Smrj                 AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node));
482*3446Smrj             break;
483*3446Smrj 
484*3446Smrj 
485*3446Smrj         case ACPI_TYPE_LOCAL_ALIAS:
486*3446Smrj         case ACPI_TYPE_LOCAL_METHOD_ALIAS:
487*3446Smrj 
488*3446Smrj             AcpiOsPrintf ("Target %4.4s (%p)\n",
489*3446Smrj                 AcpiUtGetNodeName (ObjDesc), ObjDesc);
490*3446Smrj             break;
491*3446Smrj 
492*3446Smrj         default:
493*3446Smrj 
494*3446Smrj             AcpiOsPrintf ("Object %p\n", ObjDesc);
495*3446Smrj             break;
496*3446Smrj         }
497*3446Smrj 
498*3446Smrj         /* Common field handling */
499*3446Smrj 
500*3446Smrj         switch (Type)
501*3446Smrj         {
502*3446Smrj         case ACPI_TYPE_BUFFER_FIELD:
503*3446Smrj         case ACPI_TYPE_LOCAL_REGION_FIELD:
504*3446Smrj         case ACPI_TYPE_LOCAL_BANK_FIELD:
505*3446Smrj         case ACPI_TYPE_LOCAL_INDEX_FIELD:
506*3446Smrj 
507*3446Smrj             AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
508*3446Smrj                 (ObjDesc->CommonField.BaseByteOffset * 8)
509*3446Smrj                     + ObjDesc->CommonField.StartFieldBitOffset,
510*3446Smrj                 ObjDesc->CommonField.BitLength,
511*3446Smrj                 ObjDesc->CommonField.AccessByteWidth);
512*3446Smrj             break;
513*3446Smrj 
514*3446Smrj         default:
515*3446Smrj             break;
516*3446Smrj         }
517*3446Smrj         break;
518*3446Smrj 
519*3446Smrj 
520*3446Smrj     case ACPI_DISPLAY_OBJECTS:
521*3446Smrj 
522*3446Smrj         AcpiOsPrintf ("O:%p", ObjDesc);
523*3446Smrj         if (!ObjDesc)
524*3446Smrj         {
525*3446Smrj             /* No attached object, we are done */
526*3446Smrj 
527*3446Smrj             AcpiOsPrintf ("\n");
528*3446Smrj             return (AE_OK);
529*3446Smrj         }
530*3446Smrj 
531*3446Smrj         AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount);
532*3446Smrj 
533*3446Smrj         switch (Type)
534*3446Smrj         {
535*3446Smrj         case ACPI_TYPE_METHOD:
536*3446Smrj 
537*3446Smrj             /* Name is a Method and its AML offset/length are set */
538*3446Smrj 
539*3446Smrj             AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
540*3446Smrj                                         ObjDesc->Method.AmlLength);
541*3446Smrj             break;
542*3446Smrj 
543*3446Smrj         case ACPI_TYPE_INTEGER:
544*3446Smrj 
545*3446Smrj             AcpiOsPrintf (" I:%8.8X8.8%X\n",
546*3446Smrj                     ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
547*3446Smrj             break;
548*3446Smrj 
549*3446Smrj         case ACPI_TYPE_STRING:
550*3446Smrj 
551*3446Smrj             AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
552*3446Smrj                                         ObjDesc->String.Length);
553*3446Smrj             break;
554*3446Smrj 
555*3446Smrj         case ACPI_TYPE_BUFFER:
556*3446Smrj 
557*3446Smrj             AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
558*3446Smrj                                         ObjDesc->Buffer.Length);
559*3446Smrj             break;
560*3446Smrj 
561*3446Smrj         default:
562*3446Smrj 
563*3446Smrj             AcpiOsPrintf ("\n");
564*3446Smrj             break;
565*3446Smrj         }
566*3446Smrj         break;
567*3446Smrj 
568*3446Smrj 
569*3446Smrj     default:
570*3446Smrj         AcpiOsPrintf ("\n");
571*3446Smrj         break;
572*3446Smrj     }
573*3446Smrj 
574*3446Smrj     /* If debug turned off, done */
575*3446Smrj 
576*3446Smrj     if (!(AcpiDbgLevel & ACPI_LV_VALUES))
577*3446Smrj     {
578*3446Smrj         return (AE_OK);
579*3446Smrj     }
580*3446Smrj 
581*3446Smrj 
582*3446Smrj     /* If there is an attached object, display it */
583*3446Smrj 
584*3446Smrj     DbgLevel     = AcpiDbgLevel;
585*3446Smrj     AcpiDbgLevel = 0;
586*3446Smrj     ObjDesc      = AcpiNsGetAttachedObject (ThisNode);
587*3446Smrj     AcpiDbgLevel = DbgLevel;
588*3446Smrj 
589*3446Smrj     /* Dump attached objects */
590*3446Smrj 
591*3446Smrj     while (ObjDesc)
592*3446Smrj     {
593*3446Smrj         ObjType = ACPI_TYPE_INVALID;
594*3446Smrj         AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
595*3446Smrj 
596*3446Smrj         /* Decode the type of attached object and dump the contents */
597*3446Smrj 
598*3446Smrj         switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
599*3446Smrj         {
600*3446Smrj         case ACPI_DESC_TYPE_NAMED:
601*3446Smrj 
602*3446Smrj             AcpiOsPrintf ("(Ptr to Node)\n");
603*3446Smrj             BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
604*3446Smrj             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
605*3446Smrj             break;
606*3446Smrj 
607*3446Smrj         case ACPI_DESC_TYPE_OPERAND:
608*3446Smrj 
609*3446Smrj             ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc);
610*3446Smrj 
611*3446Smrj             if (ObjType > ACPI_TYPE_LOCAL_MAX)
612*3446Smrj             {
613*3446Smrj                 AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
614*3446Smrj                     ObjType);
615*3446Smrj                 BytesToDump = 32;
616*3446Smrj             }
617*3446Smrj             else
618*3446Smrj             {
619*3446Smrj                 AcpiOsPrintf ("(Ptr to ACPI Object type %X [%s])\n",
620*3446Smrj                     ObjType, AcpiUtGetTypeName (ObjType));
621*3446Smrj                 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
622*3446Smrj             }
623*3446Smrj 
624*3446Smrj             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
625*3446Smrj             break;
626*3446Smrj 
627*3446Smrj         default:
628*3446Smrj 
629*3446Smrj             break;
630*3446Smrj         }
631*3446Smrj 
632*3446Smrj         /* If value is NOT an internal object, we are done */
633*3446Smrj 
634*3446Smrj         if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
635*3446Smrj         {
636*3446Smrj             goto Cleanup;
637*3446Smrj         }
638*3446Smrj 
639*3446Smrj         /*
640*3446Smrj          * Valid object, get the pointer to next level, if any
641*3446Smrj          */
642*3446Smrj         switch (ObjType)
643*3446Smrj         {
644*3446Smrj         case ACPI_TYPE_BUFFER:
645*3446Smrj         case ACPI_TYPE_STRING:
646*3446Smrj             /*
647*3446Smrj              * NOTE: takes advantage of common fields between string/buffer
648*3446Smrj              */
649*3446Smrj             BytesToDump = ObjDesc->String.Length;
650*3446Smrj             ObjDesc = (void *) ObjDesc->String.Pointer;
651*3446Smrj             AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
652*3446Smrj                 ObjDesc, BytesToDump);
653*3446Smrj             ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
654*3446Smrj             goto Cleanup;
655*3446Smrj 
656*3446Smrj         case ACPI_TYPE_BUFFER_FIELD:
657*3446Smrj             ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
658*3446Smrj             break;
659*3446Smrj 
660*3446Smrj         case ACPI_TYPE_PACKAGE:
661*3446Smrj             ObjDesc = (void *) ObjDesc->Package.Elements;
662*3446Smrj             break;
663*3446Smrj 
664*3446Smrj         case ACPI_TYPE_METHOD:
665*3446Smrj             ObjDesc = (void *) ObjDesc->Method.AmlStart;
666*3446Smrj             break;
667*3446Smrj 
668*3446Smrj         case ACPI_TYPE_LOCAL_REGION_FIELD:
669*3446Smrj             ObjDesc = (void *) ObjDesc->Field.RegionObj;
670*3446Smrj             break;
671*3446Smrj 
672*3446Smrj         case ACPI_TYPE_LOCAL_BANK_FIELD:
673*3446Smrj             ObjDesc = (void *) ObjDesc->BankField.RegionObj;
674*3446Smrj             break;
675*3446Smrj 
676*3446Smrj         case ACPI_TYPE_LOCAL_INDEX_FIELD:
677*3446Smrj             ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
678*3446Smrj             break;
679*3446Smrj 
680*3446Smrj         default:
681*3446Smrj             goto Cleanup;
682*3446Smrj         }
683*3446Smrj 
684*3446Smrj         ObjType = ACPI_TYPE_INVALID;   /* Terminate loop after next pass */
685*3446Smrj     }
686*3446Smrj 
687*3446Smrj Cleanup:
688*3446Smrj     AcpiOsPrintf ("\n");
689*3446Smrj     return (AE_OK);
690*3446Smrj }
691*3446Smrj 
692*3446Smrj 
693*3446Smrj /*******************************************************************************
694*3446Smrj  *
695*3446Smrj  * FUNCTION:    AcpiNsDumpObjects
696*3446Smrj  *
697*3446Smrj  * PARAMETERS:  Type                - Object type to be dumped
698*3446Smrj  *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
699*3446Smrj  *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
700*3446Smrj  *                                    for an effectively unlimited depth.
701*3446Smrj  *              OwnerId             - Dump only objects owned by this ID.  Use
702*3446Smrj  *                                    ACPI_UINT32_MAX to match all owners.
703*3446Smrj  *              StartHandle         - Where in namespace to start/end search
704*3446Smrj  *
705*3446Smrj  * RETURN:      None
706*3446Smrj  *
707*3446Smrj  * DESCRIPTION: Dump typed objects within the loaded namespace.
708*3446Smrj  *              Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
709*3446Smrj  *
710*3446Smrj  ******************************************************************************/
711*3446Smrj 
712*3446Smrj void
713*3446Smrj AcpiNsDumpObjects (
714*3446Smrj     ACPI_OBJECT_TYPE        Type,
715*3446Smrj     UINT8                   DisplayType,
716*3446Smrj     UINT32                  MaxDepth,
717*3446Smrj     ACPI_OWNER_ID           OwnerId,
718*3446Smrj     ACPI_HANDLE             StartHandle)
719*3446Smrj {
720*3446Smrj     ACPI_WALK_INFO          Info;
721*3446Smrj 
722*3446Smrj 
723*3446Smrj     ACPI_FUNCTION_ENTRY ();
724*3446Smrj 
725*3446Smrj 
726*3446Smrj     Info.DebugLevel = ACPI_LV_TABLES;
727*3446Smrj     Info.OwnerId = OwnerId;
728*3446Smrj     Info.DisplayType = DisplayType;
729*3446Smrj 
730*3446Smrj     (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
731*3446Smrj                 ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
732*3446Smrj                 (void *) &Info, NULL);
733*3446Smrj }
734*3446Smrj 
735*3446Smrj 
736*3446Smrj /*******************************************************************************
737*3446Smrj  *
738*3446Smrj  * FUNCTION:    AcpiNsDumpEntry
739*3446Smrj  *
740*3446Smrj  * PARAMETERS:  Handle              - Node to be dumped
741*3446Smrj  *              DebugLevel          - Output level
742*3446Smrj  *
743*3446Smrj  * RETURN:      None
744*3446Smrj  *
745*3446Smrj  * DESCRIPTION: Dump a single Node
746*3446Smrj  *
747*3446Smrj  ******************************************************************************/
748*3446Smrj 
749*3446Smrj void
750*3446Smrj AcpiNsDumpEntry (
751*3446Smrj     ACPI_HANDLE             Handle,
752*3446Smrj     UINT32                  DebugLevel)
753*3446Smrj {
754*3446Smrj     ACPI_WALK_INFO          Info;
755*3446Smrj 
756*3446Smrj 
757*3446Smrj     ACPI_FUNCTION_ENTRY ();
758*3446Smrj 
759*3446Smrj 
760*3446Smrj     Info.DebugLevel = DebugLevel;
761*3446Smrj     Info.OwnerId = ACPI_OWNER_ID_MAX;
762*3446Smrj     Info.DisplayType = ACPI_DISPLAY_SUMMARY;
763*3446Smrj 
764*3446Smrj     (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
765*3446Smrj }
766*3446Smrj 
767*3446Smrj 
768*3446Smrj #ifdef ACPI_ASL_COMPILER
769*3446Smrj /*******************************************************************************
770*3446Smrj  *
771*3446Smrj  * FUNCTION:    AcpiNsDumpTables
772*3446Smrj  *
773*3446Smrj  * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
774*3446Smrj  *                                    NS_ALL to dump the entire namespace
775*3446Smrj  *              MaxDepth            - Maximum depth of dump.  Use INT_MAX
776*3446Smrj  *                                    for an effectively unlimited depth.
777*3446Smrj  *
778*3446Smrj  * RETURN:      None
779*3446Smrj  *
780*3446Smrj  * DESCRIPTION: Dump the name space, or a portion of it.
781*3446Smrj  *
782*3446Smrj  ******************************************************************************/
783*3446Smrj 
784*3446Smrj void
785*3446Smrj AcpiNsDumpTables (
786*3446Smrj     ACPI_HANDLE             SearchBase,
787*3446Smrj     UINT32                  MaxDepth)
788*3446Smrj {
789*3446Smrj     ACPI_HANDLE             SearchHandle = SearchBase;
790*3446Smrj 
791*3446Smrj 
792*3446Smrj     ACPI_FUNCTION_TRACE (NsDumpTables);
793*3446Smrj 
794*3446Smrj 
795*3446Smrj     if (!AcpiGbl_RootNode)
796*3446Smrj     {
797*3446Smrj         /*
798*3446Smrj          * If the name space has not been initialized,
799*3446Smrj          * there is nothing to dump.
800*3446Smrj          */
801*3446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
802*3446Smrj         return_VOID;
803*3446Smrj     }
804*3446Smrj 
805*3446Smrj     if (ACPI_NS_ALL == SearchBase)
806*3446Smrj     {
807*3446Smrj         /* Entire namespace */
808*3446Smrj 
809*3446Smrj         SearchHandle = AcpiGbl_RootNode;
810*3446Smrj         ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
811*3446Smrj     }
812*3446Smrj 
813*3446Smrj     AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
814*3446Smrj             ACPI_OWNER_ID_MAX, SearchHandle);
815*3446Smrj     return_VOID;
816*3446Smrj }
817*3446Smrj #endif
818*3446Smrj #endif
819*3446Smrj 
820