nsdump.c revision 151937
1168515Sgshapiro/******************************************************************************
2168515Sgshapiro *
3168515Sgshapiro * Module Name: nsdump - table dumping routines for debug
4132943Sgshapiro *              $Revision: 1.172 $
5266692Sgshapiro *
6132943Sgshapiro *****************************************************************************/
7168515Sgshapiro
890792Sgshapiro/******************************************************************************
9168515Sgshapiro *
1090792Sgshapiro * 1. Copyright Notice
11168515Sgshapiro *
12168515Sgshapiro * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
1390792Sgshapiro * All rights reserved.
1490792Sgshapiro *
1590792Sgshapiro * 2. License
1690792Sgshapiro *
1790792Sgshapiro * 2.1. This is your license from Intel Corp. under its intellectual property
1890792Sgshapiro * rights.  You may have additional license terms from the party that provided
1990792Sgshapiro * you this software, covering your right to use that party's intellectual
20168515Sgshapiro * property rights.
21120256Sgshapiro *
22168515Sgshapiro * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2390792Sgshapiro * copy of the source code appearing in this file ("Covered Code") an
2490792Sgshapiro * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25168515Sgshapiro * base code distributed originally by Intel ("Original Intel Code") to copy,
26168515Sgshapiro
27168515Sgshapiro * make derivatives, distribute, use and display any portion of the Covered
28168515Sgshapiro * Code in any form, with the right to sublicense such rights; and
29168515Sgshapiro *
30168515Sgshapiro * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31168515Sgshapiro * license (with the right to sublicense), under only those claims of Intel
32168515Sgshapiro * patents that are infringed by the Original Intel Code, to make, use, sell,
33168515Sgshapiro * offer to sell, and import the Covered Code and derivative works thereof
34168515Sgshapiro * solely to the minimum extent necessary to exercise the above copyright
3590792Sgshapiro * license, and in no event shall the patent license extend to any additions
36168515Sgshapiro * to or modifications of the Original Intel Code.  No other license or right
37168515Sgshapiro * is granted directly or by implication, estoppel or otherwise;
38168515Sgshapiro *
3990792Sgshapiro * The above copyright and patent license is granted only if the following
4090792Sgshapiro * conditions are met:
41168515Sgshapiro *
42168515Sgshapiro * 3. Conditions
43168515Sgshapiro *
44168515Sgshapiro * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45168515Sgshapiro * Redistribution of source code of any substantial portion of the Covered
46168515Sgshapiro * Code or modification with rights to further distribute source must include
47168515Sgshapiro * the above Copyright Notice, the above License, this list of Conditions,
48168515Sgshapiro * and the following Disclaimer and Export Compliance provision.  In addition,
49120256Sgshapiro * Licensee must cause all Covered Code to which Licensee contributes to
50120256Sgshapiro * contain a file documenting the changes Licensee made to create that Covered
51168515Sgshapiro * Code and the date of any change.  Licensee must include in that file the
52168515Sgshapiro * documentation of any changes made by any predecessor Licensee.  Licensee
53168515Sgshapiro * must include a prominent statement that the modification is derived,
54120256Sgshapiro * directly or indirectly, from Original Intel Code.
55168515Sgshapiro *
56168515Sgshapiro * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57168515Sgshapiro * Redistribution of source code of any substantial portion of the Covered
58168515Sgshapiro * Code or modification without rights to further distribute source must
59168515Sgshapiro * include the following Disclaimer and Export Compliance provision in the
60168515Sgshapiro * documentation and/or other materials provided with distribution.  In
6190792Sgshapiro * addition, Licensee may not authorize further sublicense of source of any
6290792Sgshapiro * portion of the Covered Code, and must include terms to the effect that the
63168515Sgshapiro * license from Licensee to its licensee is limited to the intellectual
64168515Sgshapiro * property embodied in the software Licensee provides to its licensee, and
6590792Sgshapiro * not to intellectual property embodied in modifications its licensee may
66168515Sgshapiro * make.
67168515Sgshapiro *
68168515Sgshapiro * 3.3. Redistribution of Executable. Redistribution in executable form of any
69168515Sgshapiro * substantial portion of the Covered Code or modification must reproduce the
70168515Sgshapiro * above Copyright Notice, and the following Disclaimer and Export Compliance
7190792Sgshapiro * provision in the documentation and/or other materials provided with the
72168515Sgshapiro * distribution.
73168515Sgshapiro *
7490792Sgshapiro * 3.4. Intel retains all right, title, and interest in and to the Original
7590792Sgshapiro * Intel Code.
76168515Sgshapiro *
77168515Sgshapiro * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78168515Sgshapiro * Intel shall be used in advertising or otherwise to promote the sale, use or
79168515Sgshapiro * other dealings in products derived from or relating to the Covered Code
80168515Sgshapiro * without prior written authorization from Intel.
81168515Sgshapiro *
82125820Sgshapiro * 4. Disclaimer and Export Compliance
83125820Sgshapiro *
84125820Sgshapiro * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85125820Sgshapiro * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86168515Sgshapiro * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
87168515Sgshapiro * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88168515Sgshapiro * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89168515Sgshapiro * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90120256Sgshapiro * PARTICULAR PURPOSE.
91168515Sgshapiro *
92168515Sgshapiro * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93168515Sgshapiro * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9494334Sgshapiro * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95168515Sgshapiro * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9694334Sgshapiro * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97132943Sgshapiro * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98132943Sgshapiro * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99132943Sgshapiro * LIMITED REMEDY.
100168515Sgshapiro *
101168515Sgshapiro * 4.3. Licensee shall not export, either directly or indirectly, any of this
102168515Sgshapiro * software or system incorporating such software without first obtaining any
103168515Sgshapiro * required license or other approval from the U. S. Department of Commerce or
104168515Sgshapiro * any other agency or department of the United States Government.  In the
10590792Sgshapiro * event Licensee exports any such software from the United States or
106168515Sgshapiro * re-exports any such software from a foreign destination, Licensee shall
10790792Sgshapiro * ensure that the distribution and export/re-export of the software is in
108168515Sgshapiro * compliance with all laws, regulations, orders, or other restrictions of the
109168515Sgshapiro * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110261363Sgshapiro * any of its subsidiaries will export/re-export any technical data, process,
11190792Sgshapiro * software, or service, directly or indirectly, to any country for which the
112168515Sgshapiro * United States government or any agency thereof requires an export license,
11390792Sgshapiro * other governmental approval, or letter of assurance, without first obtaining
114112810Sgshapiro * such license, approval or letter.
115168515Sgshapiro *
116168515Sgshapiro *****************************************************************************/
117168515Sgshapiro
118#define __NSDUMP_C__
119
120#include <contrib/dev/acpica/acpi.h>
121#include <contrib/dev/acpica/acnamesp.h>
122#include <contrib/dev/acpica/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_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type));
312        }
313
314        if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
315        {
316            ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
317                ThisNode->Name.Integer));
318        }
319
320        AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
321    }
322
323    /*
324     * Now we can print out the pertinent information
325     */
326    AcpiOsPrintf (" %-12s %p ",
327            AcpiUtGetTypeName (Type), ThisNode);
328
329    DbgLevel = AcpiDbgLevel;
330    AcpiDbgLevel = 0;
331    ObjDesc = AcpiNsGetAttachedObject (ThisNode);
332    AcpiDbgLevel = DbgLevel;
333
334    switch (Info->DisplayType & ACPI_DISPLAY_MASK)
335    {
336    case ACPI_DISPLAY_SUMMARY:
337
338        if (!ObjDesc)
339        {
340            /* No attached object, we are done */
341
342            AcpiOsPrintf ("\n");
343            return (AE_OK);
344        }
345
346        switch (Type)
347        {
348        case ACPI_TYPE_PROCESSOR:
349
350            AcpiOsPrintf ("ID %X Len %.4X Addr %p\n",
351                ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
352                (char *) ObjDesc->Processor.Address);
353            break;
354
355
356        case ACPI_TYPE_DEVICE:
357
358            AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
359            break;
360
361
362        case ACPI_TYPE_METHOD:
363
364            AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
365                (UINT32) ObjDesc->Method.ParamCount,
366                ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
367            break;
368
369
370        case ACPI_TYPE_INTEGER:
371
372            AcpiOsPrintf ("= %8.8X%8.8X\n",
373                ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
374            break;
375
376
377        case ACPI_TYPE_PACKAGE:
378
379            if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
380            {
381                AcpiOsPrintf ("Elements %.2X\n",
382                    ObjDesc->Package.Count);
383            }
384            else
385            {
386                AcpiOsPrintf ("[Length not yet evaluated]\n");
387            }
388            break;
389
390
391        case ACPI_TYPE_BUFFER:
392
393            if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
394            {
395                AcpiOsPrintf ("Len %.2X",
396                            ObjDesc->Buffer.Length);
397
398                /* Dump some of the buffer */
399
400                if (ObjDesc->Buffer.Length > 0)
401                {
402                    AcpiOsPrintf (" =");
403                    for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
404                    {
405                        AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
406                    }
407                }
408                AcpiOsPrintf ("\n");
409            }
410            else
411            {
412                AcpiOsPrintf ("[Length not yet evaluated]\n");
413            }
414            break;
415
416
417        case ACPI_TYPE_STRING:
418
419            AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
420            AcpiUtPrintString (ObjDesc->String.Pointer, 32);
421            AcpiOsPrintf ("\n");
422            break;
423
424
425        case ACPI_TYPE_REGION:
426
427            AcpiOsPrintf ("[%s]",
428                AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
429            if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
430            {
431                AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
432                    ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
433                    ObjDesc->Region.Length);
434            }
435            else
436            {
437                AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
438            }
439            break;
440
441
442        case ACPI_TYPE_LOCAL_REFERENCE:
443
444            AcpiOsPrintf ("[%s]\n",
445                AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode));
446            break;
447
448
449        case ACPI_TYPE_BUFFER_FIELD:
450
451            if (ObjDesc->BufferField.BufferObj &&
452                ObjDesc->BufferField.BufferObj->Buffer.Node)
453            {
454                AcpiOsPrintf ("Buf [%4.4s]",
455                    AcpiUtGetNodeName (ObjDesc->BufferField.BufferObj->Buffer.Node));
456            }
457            break;
458
459
460        case ACPI_TYPE_LOCAL_REGION_FIELD:
461
462            AcpiOsPrintf ("Rgn [%4.4s]",
463                AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node));
464            break;
465
466
467        case ACPI_TYPE_LOCAL_BANK_FIELD:
468
469            AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
470                AcpiUtGetNodeName (ObjDesc->CommonField.RegionObj->Region.Node),
471                AcpiUtGetNodeName (ObjDesc->BankField.BankObj->CommonField.Node));
472            break;
473
474
475        case ACPI_TYPE_LOCAL_INDEX_FIELD:
476
477            AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
478                AcpiUtGetNodeName (ObjDesc->IndexField.IndexObj->CommonField.Node),
479                AcpiUtGetNodeName (ObjDesc->IndexField.DataObj->CommonField.Node));
480            break;
481
482
483        case ACPI_TYPE_LOCAL_ALIAS:
484        case ACPI_TYPE_LOCAL_METHOD_ALIAS:
485
486            AcpiOsPrintf ("Target %4.4s (%p)\n",
487                AcpiUtGetNodeName (ObjDesc), ObjDesc);
488            break;
489
490        default:
491
492            AcpiOsPrintf ("Object %p\n", ObjDesc);
493            break;
494        }
495
496        /* Common field handling */
497
498        switch (Type)
499        {
500        case ACPI_TYPE_BUFFER_FIELD:
501        case ACPI_TYPE_LOCAL_REGION_FIELD:
502        case ACPI_TYPE_LOCAL_BANK_FIELD:
503        case ACPI_TYPE_LOCAL_INDEX_FIELD:
504
505            AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
506                (ObjDesc->CommonField.BaseByteOffset * 8)
507                    + ObjDesc->CommonField.StartFieldBitOffset,
508                ObjDesc->CommonField.BitLength,
509                ObjDesc->CommonField.AccessByteWidth);
510            break;
511
512        default:
513            break;
514        }
515        break;
516
517
518    case ACPI_DISPLAY_OBJECTS:
519
520        AcpiOsPrintf ("O:%p", ObjDesc);
521        if (!ObjDesc)
522        {
523            /* No attached object, we are done */
524
525            AcpiOsPrintf ("\n");
526            return (AE_OK);
527        }
528
529        AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount);
530
531        switch (Type)
532        {
533        case ACPI_TYPE_METHOD:
534
535            /* Name is a Method and its AML offset/length are set */
536
537            AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
538                                        ObjDesc->Method.AmlLength);
539            break;
540
541        case ACPI_TYPE_INTEGER:
542
543            AcpiOsPrintf (" I:%8.8X8.8%X\n",
544                    ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
545            break;
546
547        case ACPI_TYPE_STRING:
548
549            AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
550                                        ObjDesc->String.Length);
551            break;
552
553        case ACPI_TYPE_BUFFER:
554
555            AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
556                                        ObjDesc->Buffer.Length);
557            break;
558
559        default:
560
561            AcpiOsPrintf ("\n");
562            break;
563        }
564        break;
565
566
567    default:
568        AcpiOsPrintf ("\n");
569        break;
570    }
571
572    /* If debug turned off, done */
573
574    if (!(AcpiDbgLevel & ACPI_LV_VALUES))
575    {
576        return (AE_OK);
577    }
578
579
580    /* If there is an attached object, display it */
581
582    DbgLevel     = AcpiDbgLevel;
583    AcpiDbgLevel = 0;
584    ObjDesc      = AcpiNsGetAttachedObject (ThisNode);
585    AcpiDbgLevel = DbgLevel;
586
587    /* Dump attached objects */
588
589    while (ObjDesc)
590    {
591        ObjType = ACPI_TYPE_INVALID;
592        AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
593
594        /* Decode the type of attached object and dump the contents */
595
596        switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
597        {
598        case ACPI_DESC_TYPE_NAMED:
599
600            AcpiOsPrintf ("(Ptr to Node)\n");
601            BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
602            ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
603            break;
604
605        case ACPI_DESC_TYPE_OPERAND:
606
607            ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc);
608
609            if (ObjType > ACPI_TYPE_LOCAL_MAX)
610            {
611                AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n",
612                    ObjType);
613                BytesToDump = 32;
614            }
615            else
616            {
617                AcpiOsPrintf ("(Ptr to ACPI Object type %X [%s])\n",
618                    ObjType, AcpiUtGetTypeName (ObjType));
619                BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
620            }
621
622            ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
623            break;
624
625        default:
626
627            break;
628        }
629
630        /* If value is NOT an internal object, we are done */
631
632        if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
633        {
634            goto Cleanup;
635        }
636
637        /*
638         * Valid object, get the pointer to next level, if any
639         */
640        switch (ObjType)
641        {
642        case ACPI_TYPE_BUFFER:
643        case ACPI_TYPE_STRING:
644            /*
645             * NOTE: takes advantage of common fields between string/buffer
646             */
647            BytesToDump = ObjDesc->String.Length;
648            ObjDesc = (void *) ObjDesc->String.Pointer;
649            AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
650                ObjDesc, BytesToDump);
651            ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
652            goto Cleanup;
653
654        case ACPI_TYPE_BUFFER_FIELD:
655            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
656            break;
657
658        case ACPI_TYPE_PACKAGE:
659            ObjDesc = (void *) ObjDesc->Package.Elements;
660            break;
661
662        case ACPI_TYPE_METHOD:
663            ObjDesc = (void *) ObjDesc->Method.AmlStart;
664            break;
665
666        case ACPI_TYPE_LOCAL_REGION_FIELD:
667            ObjDesc = (void *) ObjDesc->Field.RegionObj;
668            break;
669
670        case ACPI_TYPE_LOCAL_BANK_FIELD:
671            ObjDesc = (void *) ObjDesc->BankField.RegionObj;
672            break;
673
674        case ACPI_TYPE_LOCAL_INDEX_FIELD:
675            ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
676            break;
677
678        default:
679            goto Cleanup;
680        }
681
682        ObjType = ACPI_TYPE_INVALID;   /* Terminate loop after next pass */
683    }
684
685Cleanup:
686    AcpiOsPrintf ("\n");
687    return (AE_OK);
688}
689
690
691/*******************************************************************************
692 *
693 * FUNCTION:    AcpiNsDumpObjects
694 *
695 * PARAMETERS:  Type                - Object type to be dumped
696 *              DisplayType         - 0 or ACPI_DISPLAY_SUMMARY
697 *              MaxDepth            - Maximum depth of dump. Use ACPI_UINT32_MAX
698 *                                    for an effectively unlimited depth.
699 *              OwnerId             - Dump only objects owned by this ID.  Use
700 *                                    ACPI_UINT32_MAX to match all owners.
701 *              StartHandle         - Where in namespace to start/end search
702 *
703 * RETURN:      None
704 *
705 * DESCRIPTION: Dump typed objects within the loaded namespace.
706 *              Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
707 *
708 ******************************************************************************/
709
710void
711AcpiNsDumpObjects (
712    ACPI_OBJECT_TYPE        Type,
713    UINT8                   DisplayType,
714    UINT32                  MaxDepth,
715    ACPI_OWNER_ID           OwnerId,
716    ACPI_HANDLE             StartHandle)
717{
718    ACPI_WALK_INFO          Info;
719
720
721    ACPI_FUNCTION_ENTRY ();
722
723
724    Info.DebugLevel = ACPI_LV_TABLES;
725    Info.OwnerId = OwnerId;
726    Info.DisplayType = DisplayType;
727
728    (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
729                ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
730                (void *) &Info, NULL);
731}
732
733
734/*******************************************************************************
735 *
736 * FUNCTION:    AcpiNsDumpEntry
737 *
738 * PARAMETERS:  Handle              - Node to be dumped
739 *              DebugLevel          - Output level
740 *
741 * RETURN:      None
742 *
743 * DESCRIPTION: Dump a single Node
744 *
745 ******************************************************************************/
746
747void
748AcpiNsDumpEntry (
749    ACPI_HANDLE             Handle,
750    UINT32                  DebugLevel)
751{
752    ACPI_WALK_INFO          Info;
753
754
755    ACPI_FUNCTION_ENTRY ();
756
757
758    Info.DebugLevel = DebugLevel;
759    Info.OwnerId = ACPI_OWNER_ID_MAX;
760    Info.DisplayType = ACPI_DISPLAY_SUMMARY;
761
762    (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
763}
764
765
766#ifdef ACPI_ASL_COMPILER
767/*******************************************************************************
768 *
769 * FUNCTION:    AcpiNsDumpTables
770 *
771 * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
772 *                                    NS_ALL to dump the entire namespace
773 *              MaxDepth            - Maximum depth of dump.  Use INT_MAX
774 *                                    for an effectively unlimited depth.
775 *
776 * RETURN:      None
777 *
778 * DESCRIPTION: Dump the name space, or a portion of it.
779 *
780 ******************************************************************************/
781
782void
783AcpiNsDumpTables (
784    ACPI_HANDLE             SearchBase,
785    UINT32                  MaxDepth)
786{
787    ACPI_HANDLE             SearchHandle = SearchBase;
788
789
790    ACPI_FUNCTION_TRACE ("NsDumpTables");
791
792
793    if (!AcpiGbl_RootNode)
794    {
795        /*
796         * If the name space has not been initialized,
797         * there is nothing to dump.
798         */
799        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
800        return_VOID;
801    }
802
803    if (ACPI_NS_ALL == SearchBase)
804    {
805        /* Entire namespace */
806
807        SearchHandle = AcpiGbl_RootNode;
808        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
809    }
810
811    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
812            ACPI_OWNER_ID_MAX, SearchHandle);
813    return_VOID;
814}
815#endif
816#endif
817
818