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