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