nsdump.c revision 67754
1117395Skan/******************************************************************************
2117395Skan *
3117395Skan * Module Name: nsdump - table dumping routines for debug
4117395Skan *              $Revision: 80 $
5117395Skan *
6117395Skan *****************************************************************************/
7117395Skan
8117395Skan/******************************************************************************
9117395Skan *
10117395Skan * 1. Copyright Notice
11117395Skan *
12117395Skan * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
13117395Skan * reserved.
14117395Skan *
15117395Skan * 2. License
16117395Skan *
17117395Skan * 2.1. This is your license from Intel Corp. under its intellectual property
18117395Skan * rights.  You may have additional license terms from the party that provided
19117395Skan * you this software, covering your right to use that party's intellectual
20117395Skan * property rights.
21117395Skan *
22117395Skan * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23117395Skan * copy of the source code appearing in this file ("Covered Code") an
24117395Skan * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25117395Skan * base code distributed originally by Intel ("Original Intel Code") to copy,
26117395Skan
27117395Skan * make derivatives, distribute, use and display any portion of the Covered
28117395Skan * Code in any form, with the right to sublicense such rights; and
29117395Skan *
30117395Skan * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31117395Skan * license (with the right to sublicense), under only those claims of Intel
32117395Skan * patents that are infringed by the Original Intel Code, to make, use, sell,
33117395Skan * offer to sell, and import the Covered Code and derivative works thereof
34117395Skan * solely to the minimum extent necessary to exercise the above copyright
35117395Skan * license, and in no event shall the patent license extend to any additions
36117395Skan * to or modifications of the Original Intel Code.  No other license or right
37117395Skan * is granted directly or by implication, estoppel or otherwise;
38117395Skan *
39117395Skan * The above copyright and patent license is granted only if the following
40117395Skan * conditions are met:
41117395Skan *
42117395Skan * 3. Conditions
43117395Skan *
44117395Skan * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45117395Skan * Redistribution of source code of any substantial portion of the Covered
46117395Skan * Code or modification with rights to further distribute source must include
47117395Skan * the above Copyright Notice, the above License, this list of Conditions,
48117395Skan * and the following Disclaimer and Export Compliance provision.  In addition,
49117395Skan * Licensee must cause all Covered Code to which Licensee contributes to
50117395Skan * contain a file documenting the changes Licensee made to create that Covered
51117395Skan * Code and the date of any change.  Licensee must include in that file the
52117395Skan * documentation of any changes made by any predecessor Licensee.  Licensee
53117395Skan * must include a prominent statement that the modification is derived,
54117395Skan * directly or indirectly, from Original Intel Code.
55117395Skan *
56117395Skan * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57117395Skan * Redistribution of source code of any substantial portion of the Covered
58117395Skan * Code or modification without rights to further distribute source must
59117395Skan * include the following Disclaimer and Export Compliance provision in the
60117395Skan * documentation and/or other materials provided with distribution.  In
61117395Skan * addition, Licensee may not authorize further sublicense of source of any
62117395Skan * portion of the Covered Code, and must include terms to the effect that the
63117395Skan * license from Licensee to its licensee is limited to the intellectual
64117395Skan * property embodied in the software Licensee provides to its licensee, and
65117395Skan * not to intellectual property embodied in modifications its licensee may
66117395Skan * make.
67117395Skan *
68117395Skan * 3.3. Redistribution of Executable. Redistribution in executable form of any
69117395Skan * substantial portion of the Covered Code or modification must reproduce the
70117395Skan * above Copyright Notice, and the following Disclaimer and Export Compliance
71117395Skan * provision in the documentation and/or other materials provided with the
72117395Skan * distribution.
73117395Skan *
74117395Skan * 3.4. Intel retains all right, title, and interest in and to the Original
75117395Skan * Intel Code.
76117395Skan *
77117395Skan * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78117395Skan * Intel shall be used in advertising or otherwise to promote the sale, use or
79117395Skan * other dealings in products derived from or relating to the Covered Code
80117395Skan * without prior written authorization from Intel.
81117395Skan *
82117395Skan * 4. Disclaimer and Export Compliance
83117395Skan *
84117395Skan * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85117395Skan * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86117395Skan * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87117395Skan * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88117395Skan * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89117395Skan * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90117395Skan * PARTICULAR PURPOSE.
91117395Skan *
92117395Skan * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93117395Skan * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94117395Skan * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95117395Skan * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96117395Skan * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97117395Skan * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98117395Skan * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99117395Skan * LIMITED REMEDY.
100117395Skan *
101117395Skan * 4.3. Licensee shall not export, either directly or indirectly, any of this
102117395Skan * software or system incorporating such software without first obtaining any
103117395Skan * required license or other approval from the U. S. Department of Commerce or
104117395Skan * any other agency or department of the United States Government.  In the
105117395Skan * event Licensee exports any such software from the United States or
106117395Skan * re-exports any such software from a foreign destination, Licensee shall
107117395Skan * ensure that the distribution and export/re-export of the software is in
108117395Skan * compliance with all laws, regulations, orders, or other restrictions of the
109117395Skan * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110117395Skan * any of its subsidiaries will export/re-export any technical data, process,
111117395Skan * software, or service, directly or indirectly, to any country for which the
112117395Skan * United States government or any agency thereof requires an export license,
113117395Skan * other governmental approval, or letter of assurance, without first obtaining
114117395Skan * such license, approval or letter.
115117395Skan *
116117395Skan *****************************************************************************/
117117395Skan
118117395Skan#define __NSDUMP_C__
119117395Skan
120117395Skan#include "acpi.h"
121117395Skan#include "acinterp.h"
122117395Skan#include "acnamesp.h"
123117395Skan#include "actables.h"
124117395Skan
125117395Skan
126117395Skan#define _COMPONENT          NAMESPACE
127117395Skan        MODULE_NAME         ("nsdump")
128117395Skan
129117395Skan
130117395Skan#ifdef ACPI_DEBUG
131117395Skan
132117395Skan/****************************************************************************
133117395Skan *
134117395Skan * FUNCTION:    AcpiNsDumpPathname
135117395Skan *
136117395Skan * PARAMETERS:  Handle              - Object
137117395Skan *              Msg                 - Prefix message
138117395Skan *              Level               - Desired debug level
139117395Skan *              Component           - Caller's component ID
140117395Skan *
141117395Skan * DESCRIPTION: Print an object's full namespace pathname
142117395Skan *              Manages allocation/freeing of a pathname buffer
143117395Skan *
144117395Skan ***************************************************************************/
145117395Skan
146117395SkanACPI_STATUS
147117395SkanAcpiNsDumpPathname (
148117395Skan    ACPI_HANDLE             Handle,
149117395Skan    NATIVE_CHAR             *Msg,
150117395Skan    UINT32                  Level,
151117395Skan    UINT32                  Component)
152117395Skan{
153117395Skan    NATIVE_CHAR             *Buffer;
154117395Skan    UINT32                  Length;
155117395Skan
156117395Skan
157117395Skan    FUNCTION_TRACE ("NsDumpPathname");
158117395Skan
159117395Skan    /* Do this only if the requested debug level and component are enabled */
160117395Skan
161117395Skan    if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
162117395Skan    {
163117395Skan        return_ACPI_STATUS (AE_OK);
164117395Skan    }
165117395Skan
166117395Skan    Buffer = AcpiCmAllocate (PATHNAME_MAX);
167117395Skan    if (!Buffer)
168117395Skan    {
169117395Skan        return_ACPI_STATUS (AE_NO_MEMORY);
170117395Skan    }
171117395Skan
172117395Skan    /* Convert handle to a full pathname and print it (with supplied message) */
173117395Skan
174117395Skan    Length = PATHNAME_MAX;
175117395Skan    if (ACPI_SUCCESS (AcpiNsHandleToPathname (Handle, &Length, Buffer)))
176117395Skan    {
177117395Skan        AcpiOsPrintf ("%s %s (%p)\n", Msg, Buffer, Handle);
178117395Skan    }
179117395Skan
180117395Skan    AcpiCmFree (Buffer);
181117395Skan
182117395Skan    return_ACPI_STATUS (AE_OK);
183117395Skan}
184117395Skan
185117395Skan
186117395Skan/****************************************************************************
187117395Skan *
188117395Skan * FUNCTION:    AcpiNsDumpOneObject
189117395Skan *
190117395Skan * PARAMETERS:  Handle              - Node to be dumped
191117395Skan *              Level               - Nesting level of the handle
192117395Skan *              Context             - Passed into WalkNamespace
193117395Skan *
194117395Skan * DESCRIPTION: Dump a single Node
195117395Skan *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
196117395Skan *
197117395Skan ***************************************************************************/
198117395Skan
199117395SkanACPI_STATUS
200117395SkanAcpiNsDumpOneObject (
201117395Skan    ACPI_HANDLE             ObjHandle,
202117395Skan    UINT32                  Level,
203117395Skan    void                    *Context,
204117395Skan    void                    **ReturnValue)
205117395Skan{
206117395Skan    ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
207117395Skan    ACPI_NAMESPACE_NODE     *ThisNode;
208117395Skan    UINT8                   *Value;
209117395Skan    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
210117395Skan    OBJECT_TYPE_INTERNAL    ObjType;
211117395Skan    OBJECT_TYPE_INTERNAL    Type;
212117395Skan    UINT32                  BytesToDump;
213117395Skan    UINT32                  DownstreamSiblingMask = 0;
214117395Skan    UINT32                  LevelTmp;
215117395Skan    UINT32                  WhichBit;
216117395Skan
217117395Skan
218117395Skan    ThisNode = AcpiNsConvertHandleToEntry (ObjHandle);
219117395Skan
220117395Skan    LevelTmp    = Level;
221117395Skan    Type        = ThisNode->Type;
222117395Skan    WhichBit    = 1;
223117395Skan
224117395Skan
225117395Skan    if (!(AcpiDbgLevel & Info->DebugLevel))
226117395Skan    {
227117395Skan        return (AE_OK);
228117395Skan    }
229117395Skan
230117395Skan    if (!ObjHandle)
231117395Skan    {
232117395Skan        DEBUG_PRINT (ACPI_INFO, ("Null object handle\n"));
233117395Skan        return (AE_OK);
234117395Skan    }
235117395Skan
236117395Skan    /* Check if the owner matches */
237117395Skan
238117395Skan    if ((Info->OwnerId != ACPI_UINT32_MAX) &&
239117395Skan        (Info->OwnerId != ThisNode->OwnerId))
240117395Skan    {
241117395Skan        return (AE_OK);
242117395Skan    }
243117395Skan
244117395Skan
245117395Skan    /* Indent the object according to the level */
246117395Skan
247117395Skan    while (LevelTmp--)
248117395Skan    {
249117395Skan
250117395Skan        /* Print appropriate characters to form tree structure */
251117395Skan
252117395Skan        if (LevelTmp)
253117395Skan        {
254117395Skan            if (DownstreamSiblingMask & WhichBit)
255117395Skan            {
256117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("|"));
257117395Skan            }
258117395Skan
259117395Skan            else
260117395Skan            {
261117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, (" "));
262117395Skan            }
263117395Skan
264117395Skan            WhichBit <<= 1;
265117395Skan        }
266117395Skan
267117395Skan        else
268117395Skan        {
269117395Skan            if (AcpiNsExistDownstreamSibling (ThisNode + 1))
270117395Skan            {
271117395Skan                DownstreamSiblingMask |= (1 << (Level - 1));
272117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("+"));
273117395Skan            }
274117395Skan
275117395Skan            else
276117395Skan            {
277117395Skan                DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1));
278117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("+"));
279117395Skan            }
280117395Skan
281117395Skan            if (ThisNode->Child == NULL)
282117395Skan            {
283117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("-"));
284117395Skan            }
285117395Skan
286117395Skan            else if (AcpiNsExistDownstreamSibling (ThisNode->Child))
287117395Skan            {
288117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("+"));
289117395Skan            }
290117395Skan
291117395Skan            else
292117395Skan            {
293117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("-"));
294117395Skan            }
295117395Skan        }
296117395Skan    }
297117395Skan
298117395Skan
299117395Skan    /* Check the integrity of our data */
300117395Skan
301117395Skan    if (Type > INTERNAL_TYPE_MAX)
302117395Skan    {
303117395Skan        Type = INTERNAL_TYPE_DEF_ANY;                                /* prints as *ERROR* */
304117395Skan    }
305117395Skan
306117395Skan    if (!AcpiCmValidAcpiName (ThisNode->Name))
307117395Skan    {
308117395Skan        REPORT_WARNING (("Invalid ACPI Name 0x%X\n", ThisNode->Name));
309117395Skan    }
310117395Skan
311117395Skan    /*
312117395Skan     * Now we can print out the pertinent information
313117395Skan     */
314117395Skan
315117395Skan    DEBUG_PRINT_RAW (TRACE_TABLES, (" %4.4s %-9s ", &ThisNode->Name, AcpiCmGetTypeName (Type)));
316117395Skan    DEBUG_PRINT_RAW (TRACE_TABLES, ("%p S:%p O:%p",  ThisNode, ThisNode->Child, ThisNode->Object));
317117395Skan
318117395Skan
319117395Skan    if (!ThisNode->Object)
320117395Skan    {
321117395Skan        /* No attached object, we are done */
322117395Skan
323117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, ("\n"));
324117395Skan        return (AE_OK);
325117395Skan    }
326117395Skan
327117395Skan    switch (Type)
328117395Skan    {
329117395Skan
330117395Skan    case ACPI_TYPE_METHOD:
331117395Skan
332117395Skan        /* Name is a Method and its AML offset/length are set */
333117395Skan
334117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, (" M:%p-%X\n",
335117395Skan                    ((ACPI_OPERAND_OBJECT  *) ThisNode->Object)->Method.Pcode,
336117395Skan                    ((ACPI_OPERAND_OBJECT  *) ThisNode->Object)->Method.PcodeLength));
337117395Skan
338117395Skan        break;
339117395Skan
340117395Skan
341117395Skan    case ACPI_TYPE_NUMBER:
342117395Skan
343117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, (" N:%X\n",
344117395Skan                    ((ACPI_OPERAND_OBJECT  *) ThisNode->Object)->Number.Value));
345117395Skan        break;
346117395Skan
347117395Skan
348117395Skan    case ACPI_TYPE_STRING:
349117395Skan
350117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, (" S:%p-%X\n",
351117395Skan                    ((ACPI_OPERAND_OBJECT  *) ThisNode->Object)->String.Pointer,
352117395Skan                    ((ACPI_OPERAND_OBJECT  *) ThisNode->Object)->String.Length));
353117395Skan        break;
354117395Skan
355117395Skan
356117395Skan    case ACPI_TYPE_BUFFER:
357117395Skan
358117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, (" B:%p-%X\n",
359117395Skan                    ((ACPI_OPERAND_OBJECT  *) ThisNode->Object)->Buffer.Pointer,
360117395Skan                    ((ACPI_OPERAND_OBJECT  *) ThisNode->Object)->Buffer.Length));
361117395Skan        break;
362117395Skan
363117395Skan
364117395Skan    default:
365117395Skan
366117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, ("\n"));
367117395Skan        break;
368117395Skan    }
369117395Skan
370117395Skan    /* If debug turned off, done */
371117395Skan
372117395Skan    if (!(AcpiDbgLevel & TRACE_VALUES))
373117395Skan    {
374117395Skan        return (AE_OK);
375117395Skan    }
376117395Skan
377117395Skan
378117395Skan    /* If there is an attached object, display it */
379117395Skan
380117395Skan    Value = ThisNode->Object;
381117395Skan
382117395Skan    /* Dump attached objects */
383117395Skan
384117395Skan    while (Value)
385117395Skan    {
386117395Skan        ObjType = INTERNAL_TYPE_INVALID;
387117395Skan
388117395Skan        /* Decode the type of attached object and dump the contents */
389117395Skan
390117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, ("        Attached Object %p: ", Value));
391117395Skan
392117395Skan        if (AcpiTbSystemTablePointer (Value))
393117395Skan        {
394117395Skan            DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to AML Code)\n"));
395117395Skan            BytesToDump = 16;
396117395Skan        }
397117395Skan
398117395Skan        else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED))
399117395Skan        {
400117395Skan            DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to Node)\n"));
401117395Skan            BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
402117395Skan        }
403117395Skan
404117395Skan
405117395Skan        else if (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_INTERNAL))
406117395Skan        {
407117395Skan            ObjDesc = (ACPI_OPERAND_OBJECT  *) Value;
408117395Skan            ObjType = ObjDesc->Common.Type;
409117395Skan
410117395Skan            if (ObjType > INTERNAL_TYPE_MAX)
411117395Skan            {
412117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to ACPI Object type 0x%X [UNKNOWN])\n", ObjType));
413117395Skan                BytesToDump = 32;
414117395Skan            }
415117395Skan
416117395Skan            else
417117395Skan            {
418117395Skan                DEBUG_PRINT_RAW (TRACE_TABLES, ("(Ptr to ACPI Object type 0x%X [%s])\n",
419117395Skan                                    ObjType, AcpiCmGetTypeName (ObjType)));
420117395Skan                BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
421117395Skan            }
422117395Skan        }
423117395Skan
424117395Skan        else
425117395Skan        {
426117395Skan            DEBUG_PRINT_RAW (TRACE_TABLES, ("(String or Buffer - not descriptor)\n", Value));
427117395Skan            BytesToDump = 16;
428117395Skan        }
429117395Skan
430117395Skan        DUMP_BUFFER (Value, BytesToDump);
431117395Skan
432117395Skan        /* If value is NOT an internal object, we are done */
433117395Skan
434117395Skan        if ((AcpiTbSystemTablePointer (Value)) ||
435117395Skan            (VALID_DESCRIPTOR_TYPE (Value, ACPI_DESC_TYPE_NAMED)))
436117395Skan        {
437117395Skan            goto Cleanup;
438117395Skan        }
439117395Skan
440117395Skan        /*
441117395Skan         * Valid object, get the pointer to next level, if any
442117395Skan         */
443117395Skan        switch (ObjType)
444117395Skan        {
445117395Skan        case ACPI_TYPE_STRING:
446117395Skan            Value = (UINT8 *) ObjDesc->String.Pointer;
447117395Skan            break;
448117395Skan
449117395Skan        case ACPI_TYPE_BUFFER:
450117395Skan            Value = (UINT8 *) ObjDesc->Buffer.Pointer;
451117395Skan            break;
452117395Skan
453117395Skan        case ACPI_TYPE_PACKAGE:
454117395Skan            Value = (UINT8 *) ObjDesc->Package.Elements;
455117395Skan            break;
456117395Skan
457117395Skan        case ACPI_TYPE_METHOD:
458117395Skan            Value = (UINT8 *) ObjDesc->Method.Pcode;
459117395Skan            break;
460117395Skan
461117395Skan        case ACPI_TYPE_FIELD_UNIT:
462117395Skan            Value = (UINT8 *) ObjDesc->FieldUnit.Container;
463117395Skan            break;
464117395Skan
465117395Skan        case INTERNAL_TYPE_DEF_FIELD:
466117395Skan            Value = (UINT8 *) ObjDesc->Field.Container;
467117395Skan            break;
468117395Skan
469117395Skan        case INTERNAL_TYPE_BANK_FIELD:
470117395Skan            Value = (UINT8 *) ObjDesc->BankField.Container;
471117395Skan            break;
472117395Skan
473117395Skan        case INTERNAL_TYPE_INDEX_FIELD:
474117395Skan            Value = (UINT8 *) ObjDesc->IndexField.Index;
475117395Skan            break;
476117395Skan
477117395Skan       default:
478117395Skan            goto Cleanup;
479117395Skan        }
480117395Skan
481117395Skan        ObjType = INTERNAL_TYPE_INVALID;     /* Terminate loop after next pass */
482117395Skan    }
483117395Skan
484117395SkanCleanup:
485117395Skan    DEBUG_PRINT_RAW (TRACE_TABLES, ("\n"));
486117395Skan    return (AE_OK);
487117395Skan}
488117395Skan
489117395Skan
490117395Skan/****************************************************************************
491117395Skan *
492117395Skan * FUNCTION:    AcpiNsDumpObjects
493117395Skan *
494117395Skan * PARAMETERS:  Type                - Object type to be dumped
495117395Skan *              MaxDepth            - Maximum depth of dump.  Use ACPI_UINT32_MAX
496117395Skan *                                    for an effectively unlimited depth.
497117395Skan *              OwnerId             - Dump only objects owned by this ID.  Use
498117395Skan *                                    ACPI_UINT32_MAX to match all owners.
499117395Skan *              StartHandle         - Where in namespace to start/end search
500117395Skan *
501117395Skan * DESCRIPTION: Dump typed objects within the loaded namespace.
502117395Skan *              Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
503117395Skan *
504117395Skan ***************************************************************************/
505117395Skan
506117395Skanvoid
507117395SkanAcpiNsDumpObjects (
508117395Skan    OBJECT_TYPE_INTERNAL    Type,
509117395Skan    UINT32                  MaxDepth,
510117395Skan    UINT32                  OwnerId,
511117395Skan    ACPI_HANDLE             StartHandle)
512117395Skan{
513117395Skan    ACPI_WALK_INFO          Info;
514117395Skan
515117395Skan
516117395Skan    Info.DebugLevel = TRACE_TABLES;
517117395Skan    Info.OwnerId = OwnerId;
518117395Skan
519117395Skan    AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
520117395Skan                        (void *) &Info, NULL);
521117395Skan}
522117395Skan
523117395Skan
524117395Skan/****************************************************************************
525117395Skan *
526117395Skan * FUNCTION:    AcpiNsDumpOneDevice
527117395Skan *
528117395Skan * PARAMETERS:  Handle              - Node to be dumped
529117395Skan *              Level               - Nesting level of the handle
530117395Skan *              Context             - Passed into WalkNamespace
531117395Skan *
532117395Skan * DESCRIPTION: Dump a single Node that represents a device
533117395Skan *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
534117395Skan *
535117395Skan ***************************************************************************/
536117395Skan
537117395SkanACPI_STATUS
538117395SkanAcpiNsDumpOneDevice (
539117395Skan    ACPI_HANDLE             ObjHandle,
540117395Skan    UINT32                  Level,
541117395Skan    void                    *Context,
542117395Skan    void                    **ReturnValue)
543117395Skan{
544117395Skan    ACPI_DEVICE_INFO        Info;
545117395Skan    ACPI_STATUS             Status;
546117395Skan    UINT32                  i;
547117395Skan
548117395Skan
549117395Skan    Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
550117395Skan
551117395Skan    Status = AcpiGetObjectInfo (ObjHandle, &Info);
552117395Skan    if (ACPI_SUCCESS (Status))
553117395Skan    {
554117395Skan        for (i = 0; i < Level; i++)
555117395Skan        {
556117395Skan            DEBUG_PRINT_RAW (TRACE_TABLES, (" "));
557117395Skan        }
558117395Skan
559117395Skan        DEBUG_PRINT_RAW (TRACE_TABLES, ("    HID: %.8X, ADR: %.8X, Status: %x\n",
560117395Skan                        Info.HardwareId, Info.Address, Info.CurrentStatus));
561117395Skan    }
562117395Skan
563117395Skan    return (Status);
564117395Skan}
565117395Skan
566117395Skan
567117395Skan/****************************************************************************
568117395Skan *
569117395Skan * FUNCTION:    AcpiNsDumpRootDevices
570117395Skan *
571117395Skan * PARAMETERS:  None
572117395Skan *
573117395Skan * DESCRIPTION: Dump all objects of type "device"
574117395Skan *
575117395Skan ***************************************************************************/
576117395Skan
577117395Skanvoid
578117395SkanAcpiNsDumpRootDevices (void)
579117395Skan{
580117395Skan    ACPI_HANDLE             SysBusHandle;
581117395Skan
582117395Skan
583117395Skan    /* Only dump the table if tracing is enabled */
584117395Skan
585117395Skan    if (!(TRACE_TABLES & AcpiDbgLevel))
586117395Skan    {
587117395Skan        return;
588117395Skan    }
589117395Skan
590117395Skan    AcpiGetHandle (0, NS_SYSTEM_BUS, &SysBusHandle);
591117395Skan
592117395Skan    DEBUG_PRINT (TRACE_TABLES, ("Display of all devices in the namespace:\n"));
593117395Skan    AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, NS_WALK_NO_UNLOCK,
594117395Skan                        AcpiNsDumpOneDevice, NULL, NULL);
595117395Skan}
596117395Skan
597117395Skan
598117395Skan/****************************************************************************
599117395Skan *
600117395Skan * FUNCTION:    AcpiNsDumpTables
601117395Skan *
602117395Skan * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
603117395Skan *                                    NS_ALL to dump the entire namespace
604117395Skan *              MaxDepth            - Maximum depth of dump.  Use INT_MAX
605117395Skan *                                    for an effectively unlimited depth.
606117395Skan *
607117395Skan * DESCRIPTION: Dump the name space, or a portion of it.
608117395Skan *
609117395Skan ***************************************************************************/
610117395Skan
611117395Skanvoid
612117395SkanAcpiNsDumpTables (
613117395Skan    ACPI_HANDLE             SearchBase,
614117395Skan    UINT32                  MaxDepth)
615117395Skan{
616117395Skan    ACPI_HANDLE             SearchHandle = SearchBase;
617117395Skan
618117395Skan
619117395Skan    FUNCTION_TRACE ("NsDumpTables");
620117395Skan
621117395Skan
622117395Skan    if (!AcpiGbl_RootNode)
623117395Skan    {
624117395Skan        /*
625117395Skan         * If the name space has not been initialized,
626117395Skan         * there is nothing to dump.
627117395Skan         */
628117395Skan        DEBUG_PRINT (TRACE_TABLES, ("NsDumpTables: name space not initialized!\n"));
629117395Skan        return_VOID;
630117395Skan    }
631117395Skan
632117395Skan    if (NS_ALL == SearchBase)
633117395Skan    {
634117395Skan        /*  entire namespace    */
635117395Skan
636117395Skan        SearchHandle = AcpiGbl_RootNode;
637117395Skan        DEBUG_PRINT (TRACE_TABLES, ("\\\n"));
638117395Skan    }
639117395Skan
640117395Skan
641117395Skan    AcpiNsDumpObjects (ACPI_TYPE_ANY, MaxDepth, ACPI_UINT32_MAX, SearchHandle);
642117395Skan    return_VOID;
643117395Skan}
644117395Skan
645117395Skan
646117395Skan/****************************************************************************
647117395Skan *
648117395Skan * FUNCTION:    AcpiNsDumpEntry
649117395Skan *
650117395Skan * PARAMETERS:  Handle              - Node to be dumped
651117395Skan *              DebugLevel          - Output level
652117395Skan *
653117395Skan * DESCRIPTION: Dump a single Node
654117395Skan *
655117395Skan ***************************************************************************/
656117395Skan
657117395Skanvoid
658117395SkanAcpiNsDumpEntry (
659117395Skan    ACPI_HANDLE             Handle,
660117395Skan    UINT32                  DebugLevel)
661117395Skan{
662117395Skan    ACPI_WALK_INFO          Info;
663117395Skan
664117395Skan
665117395Skan    FUNCTION_TRACE_PTR ("NsDumpEntry", Handle);
666117395Skan
667117395Skan    Info.DebugLevel = DebugLevel;
668117395Skan    Info.OwnerId = ACPI_UINT32_MAX;
669117395Skan
670117395Skan    AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
671117395Skan
672117395Skan    DEBUG_PRINT (TRACE_EXEC, ("leave AcpiNsDumpEntry %p\n", Handle));
673117395Skan    return_VOID;
674117395Skan}
675117395Skan
676117395Skan#endif
677117395Skan
678117395Skan