nsdump.c revision 99146
1/******************************************************************************
2 *
3 * Module Name: nsdump - table dumping routines for debug
4 *              $Revision: 129 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2002, 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 "acinterp.h"
122#include "acnamesp.h"
123#include "actables.h"
124#include "acparser.h"
125
126
127#define _COMPONENT          ACPI_NAMESPACE
128        ACPI_MODULE_NAME    ("nsdump")
129
130#if defined(ACPI_DEBUG) || defined(ENABLE_DEBUGGER)
131
132
133/*******************************************************************************
134 *
135 * FUNCTION:    AcpiNsPrintPathname
136 *
137 * PARAMETERS:  NumSegment          - Number of ACPI name segments
138 *              Pathname            - The compressed (internal) path
139 *
140 * DESCRIPTION: Print an object's full namespace pathname
141 *
142 ******************************************************************************/
143
144void
145AcpiNsPrintPathname (
146    UINT32                  NumSegments,
147    char                    *Pathname)
148{
149    ACPI_FUNCTION_NAME ("NsPrintPathname");
150
151
152    if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
153    {
154        return;
155    }
156
157        /* Print the entire name */
158
159    ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
160
161    while (NumSegments)
162    {
163        AcpiOsPrintf ("%4.4s", Pathname);
164        Pathname += ACPI_NAME_SIZE;
165
166        NumSegments--;
167        if (NumSegments)
168        {
169            AcpiOsPrintf (".");
170        }
171    }
172
173    AcpiOsPrintf ("]\n");
174}
175
176
177/*******************************************************************************
178 *
179 * FUNCTION:    AcpiNsDumpPathname
180 *
181 * PARAMETERS:  Handle              - Object
182 *              Msg                 - Prefix message
183 *              Level               - Desired debug level
184 *              Component           - Caller's component ID
185 *
186 * DESCRIPTION: Print an object's full namespace pathname
187 *              Manages allocation/freeing of a pathname buffer
188 *
189 ******************************************************************************/
190
191ACPI_STATUS
192AcpiNsDumpPathname (
193    ACPI_HANDLE             Handle,
194    NATIVE_CHAR             *Msg,
195    UINT32                  Level,
196    UINT32                  Component)
197{
198    ACPI_BUFFER             Buffer;
199    ACPI_STATUS             Status;
200
201
202    ACPI_FUNCTION_TRACE ("NsDumpPathname");
203
204
205    /* Do this only if the requested debug level and component are enabled */
206
207    if (!(AcpiDbgLevel & Level) || !(AcpiDbgLayer & Component))
208    {
209        return_ACPI_STATUS (AE_OK);
210    }
211
212    /* Convert handle to a full pathname and print it (with supplied message) */
213
214    Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
215
216    Status = AcpiNsHandleToPathname (Handle, &Buffer);
217    if (ACPI_SUCCESS (Status))
218    {
219        AcpiOsPrintf ("%s %s (Node %p)\n", Msg, Buffer.Pointer, Handle);
220        ACPI_MEM_FREE (Buffer.Pointer);
221    }
222
223    return_ACPI_STATUS (Status);
224}
225
226
227/*******************************************************************************
228 *
229 * FUNCTION:    AcpiNsDumpOneObject
230 *
231 * PARAMETERS:  Handle              - Node to be dumped
232 *              Level               - Nesting level of the handle
233 *              Context             - Passed into WalkNamespace
234 *
235 * DESCRIPTION: Dump a single Node
236 *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
237 *
238 ******************************************************************************/
239
240ACPI_STATUS
241AcpiNsDumpOneObject (
242    ACPI_HANDLE             ObjHandle,
243    UINT32                  Level,
244    void                    *Context,
245    void                    **ReturnValue)
246{
247    ACPI_WALK_INFO          *Info = (ACPI_WALK_INFO *) Context;
248    ACPI_NAMESPACE_NODE     *ThisNode;
249    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
250    ACPI_OBJECT_TYPE        ObjType;
251    ACPI_OBJECT_TYPE        Type;
252    UINT32                  BytesToDump;
253    UINT32                  DownstreamSiblingMask = 0;
254    UINT32                  LevelTmp;
255    UINT32                  WhichBit;
256    UINT32                  i;
257    UINT32                  DbgLevel;
258
259
260    ACPI_FUNCTION_NAME ("NsDumpOneObject");
261
262
263    ThisNode = AcpiNsMapHandleToNode (ObjHandle);
264
265    LevelTmp    = Level;
266    Type        = ThisNode->Type;
267    WhichBit    = 1;
268
269
270    if (!(AcpiDbgLevel & Info->DebugLevel))
271    {
272        return (AE_OK);
273    }
274
275    if (!ObjHandle)
276    {
277        ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
278        return (AE_OK);
279    }
280
281    /* Check if the owner matches */
282
283    if ((Info->OwnerId != ACPI_UINT32_MAX) &&
284        (Info->OwnerId != ThisNode->OwnerId))
285    {
286        return (AE_OK);
287    }
288
289    /* Indent the object according to the level */
290
291    while (LevelTmp--)
292    {
293        /* Print appropriate characters to form tree structure */
294
295        if (LevelTmp)
296        {
297            if (DownstreamSiblingMask & WhichBit)
298            {
299                AcpiOsPrintf ("|");
300            }
301            else
302            {
303                AcpiOsPrintf (" ");
304            }
305
306            WhichBit <<= 1;
307        }
308        else
309        {
310            if (AcpiNsExistDownstreamSibling (ThisNode + 1))
311            {
312                DownstreamSiblingMask |= (1 << (Level - 1));
313                AcpiOsPrintf ("+");
314            }
315            else
316            {
317                DownstreamSiblingMask &= ACPI_UINT32_MAX ^ (1 << (Level - 1));
318                AcpiOsPrintf ("+");
319            }
320
321            if (ThisNode->Child == NULL)
322            {
323                AcpiOsPrintf ("-");
324            }
325            else if (AcpiNsExistDownstreamSibling (ThisNode->Child))
326            {
327                AcpiOsPrintf ("+");
328            }
329            else
330            {
331                AcpiOsPrintf ("-");
332            }
333        }
334    }
335
336    /* Check the integrity of our data */
337
338    if (Type > INTERNAL_TYPE_MAX)
339    {
340        Type = INTERNAL_TYPE_DEF_ANY;  /* prints as *ERROR* */
341    }
342
343    if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
344    {
345        ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n", ThisNode->Name));
346    }
347
348    /*
349     * Now we can print out the pertinent information
350     */
351    AcpiOsPrintf (" %4.4s %-12s %p",
352            (char *) &ThisNode->Name, AcpiUtGetTypeName (Type), ThisNode);
353
354    DbgLevel = AcpiDbgLevel;
355    AcpiDbgLevel = 0;
356    ObjDesc = AcpiNsGetAttachedObject (ThisNode);
357    AcpiDbgLevel = DbgLevel;
358
359    switch (Info->DisplayType)
360    {
361    case ACPI_DISPLAY_SUMMARY:
362
363        if (!ObjDesc)
364        {
365            /* No attached object, we are done */
366
367            AcpiOsPrintf ("\n");
368            return (AE_OK);
369        }
370
371        switch (Type)
372        {
373        case ACPI_TYPE_PROCESSOR:
374
375            AcpiOsPrintf (" ID %d Addr %.4X Len %.4X\n",
376                        ObjDesc->Processor.ProcId,
377                        ObjDesc->Processor.Address,
378                        ObjDesc->Processor.Length);
379            break;
380
381
382        case ACPI_TYPE_DEVICE:
383
384            AcpiOsPrintf (" Notification object: %p", ObjDesc);
385            break;
386
387
388        case ACPI_TYPE_METHOD:
389
390            AcpiOsPrintf (" Args %d Len %.4X Aml %p \n",
391                        ObjDesc->Method.ParamCount,
392                        ObjDesc->Method.AmlLength,
393                        ObjDesc->Method.AmlStart);
394            break;
395
396
397        case ACPI_TYPE_INTEGER:
398
399            AcpiOsPrintf (" = %8.8X%8.8X\n",
400                        ACPI_HIDWORD (ObjDesc->Integer.Value),
401                        ACPI_LODWORD (ObjDesc->Integer.Value));
402            break;
403
404
405        case ACPI_TYPE_PACKAGE:
406
407            if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
408            {
409                AcpiOsPrintf (" Elements %.2X\n",
410                            ObjDesc->Package.Count);
411            }
412            else
413            {
414                AcpiOsPrintf (" [Length not yet evaluated]\n");
415            }
416            break;
417
418
419        case ACPI_TYPE_BUFFER:
420
421            if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
422            {
423                AcpiOsPrintf (" Len %.2X",
424                            ObjDesc->Buffer.Length);
425
426                /* Dump some of the buffer */
427
428                if (ObjDesc->Buffer.Length > 0)
429                {
430                    AcpiOsPrintf (" =");
431                    for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
432                    {
433                        AcpiOsPrintf (" %.2X", ObjDesc->Buffer.Pointer[i]);
434                    }
435                }
436                AcpiOsPrintf ("\n");
437            }
438            else
439            {
440                AcpiOsPrintf (" [Length not yet evaluated]\n");
441            }
442            break;
443
444
445        case ACPI_TYPE_STRING:
446
447            AcpiOsPrintf (" Len %.2X", ObjDesc->String.Length);
448
449            if (ObjDesc->String.Length > 0)
450            {
451                AcpiOsPrintf (" = \"%.32s\"", ObjDesc->String.Pointer);
452                if (ObjDesc->String.Length > 32)
453                {
454                    AcpiOsPrintf ("...");
455                }
456            }
457            AcpiOsPrintf ("\n");
458            break;
459
460
461        case ACPI_TYPE_REGION:
462
463            AcpiOsPrintf (" [%s]", AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
464            if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
465            {
466                AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
467                            ACPI_HIDWORD (ObjDesc->Region.Address),
468                            ACPI_LODWORD (ObjDesc->Region.Address),
469                            ObjDesc->Region.Length);
470            }
471            else
472            {
473                AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
474            }
475            break;
476
477
478        case INTERNAL_TYPE_REFERENCE:
479
480            AcpiOsPrintf (" [%s]\n",
481                    AcpiPsGetOpcodeName (ObjDesc->Reference.Opcode));
482            break;
483
484
485        case ACPI_TYPE_BUFFER_FIELD:
486
487            if (ObjDesc->BufferField.BufferObj &&
488                ObjDesc->BufferField.BufferObj->Buffer.Node)
489            {
490                AcpiOsPrintf (" Buf [%4.4s]",
491                        (char *) &ObjDesc->BufferField.BufferObj->Buffer.Node->Name);
492            }
493            break;
494
495
496        case INTERNAL_TYPE_REGION_FIELD:
497
498            AcpiOsPrintf (" Rgn [%4.4s]",
499                    (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name);
500            break;
501
502
503        case INTERNAL_TYPE_BANK_FIELD:
504
505            AcpiOsPrintf (" Rgn [%4.4s] Bnk [%4.4s]",
506                    (char *) &ObjDesc->CommonField.RegionObj->Region.Node->Name,
507                    (char *) &ObjDesc->BankField.BankObj->CommonField.Node->Name);
508            break;
509
510
511        case INTERNAL_TYPE_INDEX_FIELD:
512
513            AcpiOsPrintf (" Idx [%4.4s] Dat [%4.4s]",
514                    (char *) &ObjDesc->IndexField.IndexObj->CommonField.Node->Name,
515                    (char *) &ObjDesc->IndexField.DataObj->CommonField.Node->Name);
516            break;
517
518
519        default:
520
521            AcpiOsPrintf (" Object %p\n", ObjDesc);
522            break;
523        }
524
525        /* Common field handling */
526
527        switch (Type)
528        {
529        case ACPI_TYPE_BUFFER_FIELD:
530        case INTERNAL_TYPE_REGION_FIELD:
531        case INTERNAL_TYPE_BANK_FIELD:
532        case INTERNAL_TYPE_INDEX_FIELD:
533            AcpiOsPrintf (" Off %.2X Len %.2X Acc %.2d\n",
534                    (ObjDesc->CommonField.BaseByteOffset * 8)
535                        + ObjDesc->CommonField.StartFieldBitOffset,
536                    ObjDesc->CommonField.BitLength,
537                    ObjDesc->CommonField.AccessByteWidth);
538            break;
539        }
540
541        break;
542
543
544    case ACPI_DISPLAY_OBJECTS:
545
546        AcpiOsPrintf ("%p O:%p",
547                ThisNode, ObjDesc);
548
549        if (!ObjDesc)
550        {
551            /* No attached object, we are done */
552
553            AcpiOsPrintf ("\n");
554            return (AE_OK);
555        }
556
557        AcpiOsPrintf ("(R%d)",
558                ObjDesc->Common.ReferenceCount);
559
560        switch (Type)
561        {
562        case ACPI_TYPE_METHOD:
563
564            /* Name is a Method and its AML offset/length are set */
565
566            AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
567                                        ObjDesc->Method.AmlLength);
568            break;
569
570        case ACPI_TYPE_INTEGER:
571
572            AcpiOsPrintf (" N:%X%X\n", ACPI_HIDWORD(ObjDesc->Integer.Value),
573                                       ACPI_LODWORD(ObjDesc->Integer.Value));
574            break;
575
576        case ACPI_TYPE_STRING:
577
578            AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
579                                        ObjDesc->String.Length);
580            break;
581
582        case ACPI_TYPE_BUFFER:
583
584            AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
585                                        ObjDesc->Buffer.Length);
586            break;
587
588        default:
589
590            AcpiOsPrintf ("\n");
591            break;
592        }
593        break;
594
595
596    default:
597        AcpiOsPrintf ("\n");
598        break;
599    }
600
601    /* If debug turned off, done */
602
603    if (!(AcpiDbgLevel & ACPI_LV_VALUES))
604    {
605        return (AE_OK);
606    }
607
608
609    /* If there is an attached object, display it */
610
611    DbgLevel = AcpiDbgLevel;
612    AcpiDbgLevel = 0;
613    ObjDesc = AcpiNsGetAttachedObject (ThisNode);
614    AcpiDbgLevel = DbgLevel;
615
616    /* Dump attached objects */
617
618    while (ObjDesc)
619    {
620        ObjType = INTERNAL_TYPE_INVALID;
621        AcpiOsPrintf ("        Attached Object %p: ", ObjDesc);
622
623        /* Decode the type of attached object and dump the contents */
624
625        switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
626        {
627        case ACPI_DESC_TYPE_NAMED:
628
629            AcpiOsPrintf ("(Ptr to Node)\n");
630            BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
631            break;
632
633
634        case ACPI_DESC_TYPE_INTERNAL:
635
636            ObjType = ObjDesc->Common.Type;
637
638            if (ObjType > INTERNAL_TYPE_MAX)
639            {
640                AcpiOsPrintf ("(Ptr to ACPI Object type %X [UNKNOWN])\n", ObjType);
641                BytesToDump = 32;
642            }
643            else
644            {
645                AcpiOsPrintf ("(Ptr to ACPI Object type %2.2X [%s])\n",
646                                    ObjType, AcpiUtGetTypeName (ObjType));
647                BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
648            }
649            break;
650
651
652        default:
653
654            AcpiOsPrintf ("(String or Buffer ptr - not an object descriptor)\n");
655            BytesToDump = 16;
656            break;
657        }
658
659        ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
660
661        /* If value is NOT an internal object, we are done */
662
663        if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_INTERNAL)
664        {
665            goto Cleanup;
666        }
667
668        /*
669         * Valid object, get the pointer to next level, if any
670         */
671        switch (ObjType)
672        {
673        case ACPI_TYPE_STRING:
674            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->String.Pointer;
675            break;
676
677        case ACPI_TYPE_BUFFER:
678            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Buffer.Pointer;
679            break;
680
681        case ACPI_TYPE_BUFFER_FIELD:
682            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
683            break;
684
685        case ACPI_TYPE_PACKAGE:
686            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Package.Elements;
687            break;
688
689        case ACPI_TYPE_METHOD:
690            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Method.AmlStart;
691            break;
692
693        case INTERNAL_TYPE_REGION_FIELD:
694            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->Field.RegionObj;
695            break;
696
697        case INTERNAL_TYPE_BANK_FIELD:
698            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BankField.RegionObj;
699            break;
700
701        case INTERNAL_TYPE_INDEX_FIELD:
702            ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->IndexField.IndexObj;
703            break;
704
705       default:
706            goto Cleanup;
707        }
708
709        ObjType = INTERNAL_TYPE_INVALID;   /* Terminate loop after next pass */
710    }
711
712Cleanup:
713    AcpiOsPrintf ("\n");
714    return (AE_OK);
715}
716
717
718/*******************************************************************************
719 *
720 * FUNCTION:    AcpiNsDumpObjects
721 *
722 * PARAMETERS:  Type                - Object type to be dumped
723 *              MaxDepth            - Maximum depth of dump.  Use ACPI_UINT32_MAX
724 *                                    for an effectively unlimited depth.
725 *              OwnerId             - Dump only objects owned by this ID.  Use
726 *                                    ACPI_UINT32_MAX to match all owners.
727 *              StartHandle         - Where in namespace to start/end search
728 *
729 * DESCRIPTION: Dump typed objects within the loaded namespace.
730 *              Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
731 *
732 ******************************************************************************/
733
734void
735AcpiNsDumpObjects (
736    ACPI_OBJECT_TYPE        Type,
737    UINT8                   DisplayType,
738    UINT32                  MaxDepth,
739    UINT32                  OwnerId,
740    ACPI_HANDLE             StartHandle)
741{
742    ACPI_WALK_INFO          Info;
743
744
745    ACPI_FUNCTION_ENTRY ();
746
747
748    Info.DebugLevel = ACPI_LV_TABLES;
749    Info.OwnerId = OwnerId;
750    Info.DisplayType = DisplayType;
751
752
753    AcpiNsWalkNamespace (Type, StartHandle, MaxDepth, ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
754                        (void *) &Info, NULL);
755}
756
757
758#ifndef _ACPI_ASL_COMPILER
759/*******************************************************************************
760 *
761 * FUNCTION:    AcpiNsDumpOneDevice
762 *
763 * PARAMETERS:  Handle              - Node to be dumped
764 *              Level               - Nesting level of the handle
765 *              Context             - Passed into WalkNamespace
766 *
767 * DESCRIPTION: Dump a single Node that represents a device
768 *              This procedure is a UserFunction called by AcpiNsWalkNamespace.
769 *
770 ******************************************************************************/
771
772ACPI_STATUS
773AcpiNsDumpOneDevice (
774    ACPI_HANDLE             ObjHandle,
775    UINT32                  Level,
776    void                    *Context,
777    void                    **ReturnValue)
778{
779    ACPI_DEVICE_INFO        Info;
780    ACPI_STATUS             Status;
781    UINT32                  i;
782
783
784    ACPI_FUNCTION_NAME ("NsDumpOneDevice");
785
786
787    Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
788
789    Status = AcpiGetObjectInfo (ObjHandle, &Info);
790    if (ACPI_SUCCESS (Status))
791    {
792        for (i = 0; i < Level; i++)
793        {
794            ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, " "));
795        }
796
797        ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES, "    HID: %s, ADR: %8.8X%8.8X, Status: %x\n",
798                        Info.HardwareId,
799                        ACPI_HIDWORD (Info.Address), ACPI_LODWORD (Info.Address),
800                        Info.CurrentStatus));
801    }
802
803    return (Status);
804}
805
806
807/*******************************************************************************
808 *
809 * FUNCTION:    AcpiNsDumpRootDevices
810 *
811 * PARAMETERS:  None
812 *
813 * DESCRIPTION: Dump all objects of type "device"
814 *
815 ******************************************************************************/
816
817void
818AcpiNsDumpRootDevices (void)
819{
820    ACPI_HANDLE             SysBusHandle;
821
822
823    ACPI_FUNCTION_NAME ("NsDumpRootDevices");
824
825
826    /* Only dump the table if tracing is enabled */
827
828    if (!(ACPI_LV_TABLES & AcpiDbgLevel))
829    {
830        return;
831    }
832
833    AcpiGetHandle (0, ACPI_NS_SYSTEM_BUS, &SysBusHandle);
834
835    ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Display of all devices in the namespace:\n"));
836    AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, SysBusHandle, ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
837                        AcpiNsDumpOneDevice, NULL, NULL);
838}
839
840#endif
841
842/*******************************************************************************
843 *
844 * FUNCTION:    AcpiNsDumpTables
845 *
846 * PARAMETERS:  SearchBase          - Root of subtree to be dumped, or
847 *                                    NS_ALL to dump the entire namespace
848 *              MaxDepth            - Maximum depth of dump.  Use INT_MAX
849 *                                    for an effectively unlimited depth.
850 *
851 * DESCRIPTION: Dump the name space, or a portion of it.
852 *
853 ******************************************************************************/
854
855void
856AcpiNsDumpTables (
857    ACPI_HANDLE             SearchBase,
858    UINT32                  MaxDepth)
859{
860    ACPI_HANDLE             SearchHandle = SearchBase;
861
862
863    ACPI_FUNCTION_TRACE ("NsDumpTables");
864
865
866    if (!AcpiGbl_RootNode)
867    {
868        /*
869         * If the name space has not been initialized,
870         * there is nothing to dump.
871         */
872        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "name space not initialized!\n"));
873        return_VOID;
874    }
875
876    if (ACPI_NS_ALL == SearchBase)
877    {
878        /*  entire namespace    */
879
880        SearchHandle = AcpiGbl_RootNode;
881        ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
882    }
883
884
885    AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
886            ACPI_UINT32_MAX, SearchHandle);
887    return_VOID;
888}
889
890
891/*******************************************************************************
892 *
893 * FUNCTION:    AcpiNsDumpEntry
894 *
895 * PARAMETERS:  Handle              - Node to be dumped
896 *              DebugLevel          - Output level
897 *
898 * DESCRIPTION: Dump a single Node
899 *
900 ******************************************************************************/
901
902void
903AcpiNsDumpEntry (
904    ACPI_HANDLE             Handle,
905    UINT32                  DebugLevel)
906{
907    ACPI_WALK_INFO          Info;
908
909
910    ACPI_FUNCTION_ENTRY ();
911
912
913    Info.DebugLevel = DebugLevel;
914    Info.OwnerId = ACPI_UINT32_MAX;
915    Info.DisplayType = ACPI_DISPLAY_SUMMARY;
916
917    AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
918}
919
920#endif
921
922