Fixed compatibility of output.
[AROS.git] / arch / all-pc / acpica / source / components / namespace / nsdump.c
blob4f6a7f99467f5aa77956afa2d3740fb2e79dd28a
1 /******************************************************************************
3 * Module Name: nsdump - table dumping routines for debug
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2013, Intel Corp.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
30 * NO WARRANTY
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
44 #define __NSDUMP_C__
46 #include "acpi.h"
47 #include "accommon.h"
48 #include "acnamesp.h"
49 #include "acoutput.h"
52 #define _COMPONENT ACPI_NAMESPACE
53 ACPI_MODULE_NAME ("nsdump")
55 /* Local prototypes */
57 #ifdef ACPI_OBSOLETE_FUNCTIONS
58 void
59 AcpiNsDumpRootDevices (
60 void);
62 static ACPI_STATUS
63 AcpiNsDumpOneDevice (
64 ACPI_HANDLE ObjHandle,
65 UINT32 Level,
66 void *Context,
67 void **ReturnValue);
68 #endif
71 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
73 static ACPI_STATUS
74 AcpiNsDumpOneObjectPath (
75 ACPI_HANDLE ObjHandle,
76 UINT32 Level,
77 void *Context,
78 void **ReturnValue);
80 static ACPI_STATUS
81 AcpiNsGetMaxDepth (
82 ACPI_HANDLE ObjHandle,
83 UINT32 Level,
84 void *Context,
85 void **ReturnValue);
88 /*******************************************************************************
90 * FUNCTION: AcpiNsPrintPathname
92 * PARAMETERS: NumSegments - Number of ACPI name segments
93 * Pathname - The compressed (internal) path
95 * RETURN: None
97 * DESCRIPTION: Print an object's full namespace pathname
99 ******************************************************************************/
101 void
102 AcpiNsPrintPathname (
103 UINT32 NumSegments,
104 char *Pathname)
106 UINT32 i;
109 ACPI_FUNCTION_NAME (NsPrintPathname);
112 /* Check if debug output enabled */
114 if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
116 return;
119 /* Print the entire name */
121 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
123 while (NumSegments)
125 for (i = 0; i < 4; i++)
127 ACPI_IS_PRINT (Pathname[i]) ?
128 AcpiOsPrintf ("%c", Pathname[i]) :
129 AcpiOsPrintf ("?");
132 Pathname += ACPI_NAME_SIZE;
133 NumSegments--;
134 if (NumSegments)
136 AcpiOsPrintf (".");
140 AcpiOsPrintf ("]\n");
144 /*******************************************************************************
146 * FUNCTION: AcpiNsDumpPathname
148 * PARAMETERS: Handle - Object
149 * Msg - Prefix message
150 * Level - Desired debug level
151 * Component - Caller's component ID
153 * RETURN: None
155 * DESCRIPTION: Print an object's full namespace pathname
156 * Manages allocation/freeing of a pathname buffer
158 ******************************************************************************/
160 void
161 AcpiNsDumpPathname (
162 ACPI_HANDLE Handle,
163 char *Msg,
164 UINT32 Level,
165 UINT32 Component)
168 ACPI_FUNCTION_TRACE (NsDumpPathname);
171 /* Do this only if the requested debug level and component are enabled */
173 if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
175 return_VOID;
178 /* Convert handle to a full pathname and print it (with supplied message) */
180 AcpiNsPrintNodePathname (Handle, Msg);
181 AcpiOsPrintf ("\n");
182 return_VOID;
186 /*******************************************************************************
188 * FUNCTION: AcpiNsDumpOneObject
190 * PARAMETERS: ObjHandle - Node to be dumped
191 * Level - Nesting level of the handle
192 * Context - Passed into WalkNamespace
193 * ReturnValue - Not used
195 * RETURN: Status
197 * DESCRIPTION: Dump a single Node
198 * This procedure is a UserFunction called by AcpiNsWalkNamespace.
200 ******************************************************************************/
202 ACPI_STATUS
203 AcpiNsDumpOneObject (
204 ACPI_HANDLE ObjHandle,
205 UINT32 Level,
206 void *Context,
207 void **ReturnValue)
209 ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
210 ACPI_NAMESPACE_NODE *ThisNode;
211 ACPI_OPERAND_OBJECT *ObjDesc = NULL;
212 ACPI_OBJECT_TYPE ObjType;
213 ACPI_OBJECT_TYPE Type;
214 UINT32 BytesToDump;
215 UINT32 DbgLevel;
216 UINT32 i;
219 ACPI_FUNCTION_NAME (NsDumpOneObject);
222 /* Is output enabled? */
224 if (!(AcpiDbgLevel & Info->DebugLevel))
226 return (AE_OK);
229 if (!ObjHandle)
231 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
232 return (AE_OK);
235 ThisNode = AcpiNsValidateHandle (ObjHandle);
236 if (!ThisNode)
238 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
239 ObjHandle));
240 return (AE_OK);
243 Type = ThisNode->Type;
245 /* Check if the owner matches */
247 if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
248 (Info->OwnerId != ThisNode->OwnerId))
250 return (AE_OK);
253 if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
255 /* Indent the object according to the level */
257 AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
259 /* Check the node type and name */
261 if (Type > ACPI_TYPE_LOCAL_MAX)
263 ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type 0x%08X", Type));
266 AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
269 /* Now we can print out the pertinent information */
271 AcpiOsPrintf (" %-12s %p %2.2X ",
272 AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
274 DbgLevel = AcpiDbgLevel;
275 AcpiDbgLevel = 0;
276 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
277 AcpiDbgLevel = DbgLevel;
279 /* Temp nodes are those nodes created by a control method */
281 if (ThisNode->Flags & ANOBJ_TEMPORARY)
283 AcpiOsPrintf ("(T) ");
286 switch (Info->DisplayType & ACPI_DISPLAY_MASK)
288 case ACPI_DISPLAY_SUMMARY:
290 if (!ObjDesc)
292 /* No attached object. Some types should always have an object */
294 switch (Type)
296 case ACPI_TYPE_INTEGER:
297 case ACPI_TYPE_PACKAGE:
298 case ACPI_TYPE_BUFFER:
299 case ACPI_TYPE_STRING:
300 case ACPI_TYPE_METHOD:
302 AcpiOsPrintf ("<No attached object>");
303 break;
305 default:
307 break;
310 AcpiOsPrintf ("\n");
311 return (AE_OK);
314 switch (Type)
316 case ACPI_TYPE_PROCESSOR:
318 AcpiOsPrintf ("ID %02X Len %02X Addr %p\n",
319 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
320 ACPI_CAST_PTR (void, ObjDesc->Processor.Address));
321 break;
323 case ACPI_TYPE_DEVICE:
325 AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
326 break;
328 case ACPI_TYPE_METHOD:
330 AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
331 (UINT32) ObjDesc->Method.ParamCount,
332 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
333 break;
335 case ACPI_TYPE_INTEGER:
337 AcpiOsPrintf ("= %8.8X%8.8X\n",
338 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
339 break;
341 case ACPI_TYPE_PACKAGE:
343 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
345 AcpiOsPrintf ("Elements %.2X\n",
346 ObjDesc->Package.Count);
348 else
350 AcpiOsPrintf ("[Length not yet evaluated]\n");
352 break;
354 case ACPI_TYPE_BUFFER:
356 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
358 AcpiOsPrintf ("Len %.2X",
359 ObjDesc->Buffer.Length);
361 /* Dump some of the buffer */
363 if (ObjDesc->Buffer.Length > 0)
365 AcpiOsPrintf (" =");
366 for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
368 AcpiOsPrintf (" %.2hX", ObjDesc->Buffer.Pointer[i]);
371 AcpiOsPrintf ("\n");
373 else
375 AcpiOsPrintf ("[Length not yet evaluated]\n");
377 break;
379 case ACPI_TYPE_STRING:
381 AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
382 AcpiUtPrintString (ObjDesc->String.Pointer, 32);
383 AcpiOsPrintf ("\n");
384 break;
386 case ACPI_TYPE_REGION:
388 AcpiOsPrintf ("[%s]",
389 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
390 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
392 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
393 ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address),
394 ObjDesc->Region.Length);
396 else
398 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
400 break;
402 case ACPI_TYPE_LOCAL_REFERENCE:
404 AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
405 break;
407 case ACPI_TYPE_BUFFER_FIELD:
409 if (ObjDesc->BufferField.BufferObj &&
410 ObjDesc->BufferField.BufferObj->Buffer.Node)
412 AcpiOsPrintf ("Buf [%4.4s]",
413 AcpiUtGetNodeName (
414 ObjDesc->BufferField.BufferObj->Buffer.Node));
416 break;
418 case ACPI_TYPE_LOCAL_REGION_FIELD:
420 AcpiOsPrintf ("Rgn [%4.4s]",
421 AcpiUtGetNodeName (
422 ObjDesc->CommonField.RegionObj->Region.Node));
423 break;
425 case ACPI_TYPE_LOCAL_BANK_FIELD:
427 AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
428 AcpiUtGetNodeName (
429 ObjDesc->CommonField.RegionObj->Region.Node),
430 AcpiUtGetNodeName (
431 ObjDesc->BankField.BankObj->CommonField.Node));
432 break;
434 case ACPI_TYPE_LOCAL_INDEX_FIELD:
436 AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
437 AcpiUtGetNodeName (
438 ObjDesc->IndexField.IndexObj->CommonField.Node),
439 AcpiUtGetNodeName (
440 ObjDesc->IndexField.DataObj->CommonField.Node));
441 break;
443 case ACPI_TYPE_LOCAL_ALIAS:
444 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
446 AcpiOsPrintf ("Target %4.4s (%p)\n",
447 AcpiUtGetNodeName (ObjDesc), ObjDesc);
448 break;
450 default:
452 AcpiOsPrintf ("Object %p\n", ObjDesc);
453 break;
456 /* Common field handling */
458 switch (Type)
460 case ACPI_TYPE_BUFFER_FIELD:
461 case ACPI_TYPE_LOCAL_REGION_FIELD:
462 case ACPI_TYPE_LOCAL_BANK_FIELD:
463 case ACPI_TYPE_LOCAL_INDEX_FIELD:
465 AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2hd\n",
466 (ObjDesc->CommonField.BaseByteOffset * 8)
467 + ObjDesc->CommonField.StartFieldBitOffset,
468 ObjDesc->CommonField.BitLength,
469 ObjDesc->CommonField.AccessByteWidth);
470 break;
472 default:
474 break;
476 break;
478 case ACPI_DISPLAY_OBJECTS:
480 AcpiOsPrintf ("O:%p", ObjDesc);
481 if (!ObjDesc)
483 /* No attached object, we are done */
485 AcpiOsPrintf ("\n");
486 return (AE_OK);
489 AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
491 switch (Type)
493 case ACPI_TYPE_METHOD:
495 /* Name is a Method and its AML offset/length are set */
497 AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
498 ObjDesc->Method.AmlLength);
499 break;
501 case ACPI_TYPE_INTEGER:
503 AcpiOsPrintf (" I:%8.8X8.8%X\n",
504 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
505 break;
507 case ACPI_TYPE_STRING:
509 AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
510 ObjDesc->String.Length);
511 break;
513 case ACPI_TYPE_BUFFER:
515 AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
516 ObjDesc->Buffer.Length);
517 break;
519 default:
521 AcpiOsPrintf ("\n");
522 break;
524 break;
526 default:
527 AcpiOsPrintf ("\n");
528 break;
531 /* If debug turned off, done */
533 if (!(AcpiDbgLevel & ACPI_LV_VALUES))
535 return (AE_OK);
538 /* If there is an attached object, display it */
540 DbgLevel = AcpiDbgLevel;
541 AcpiDbgLevel = 0;
542 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
543 AcpiDbgLevel = DbgLevel;
545 /* Dump attached objects */
547 while (ObjDesc)
549 ObjType = ACPI_TYPE_INVALID;
550 AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
552 /* Decode the type of attached object and dump the contents */
554 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
556 case ACPI_DESC_TYPE_NAMED:
558 AcpiOsPrintf ("(Ptr to Node)\n");
559 BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
560 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
561 break;
563 case ACPI_DESC_TYPE_OPERAND:
565 ObjType = ObjDesc->Common.Type;
567 if (ObjType > ACPI_TYPE_LOCAL_MAX)
569 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
570 ObjType);
571 BytesToDump = 32;
573 else
575 AcpiOsPrintf ("(Pointer to ACPI Object type %.2X [%s])\n",
576 ObjType, AcpiUtGetTypeName (ObjType));
577 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
580 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
581 break;
583 default:
585 break;
588 /* If value is NOT an internal object, we are done */
590 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
592 goto Cleanup;
595 /* Valid object, get the pointer to next level, if any */
597 switch (ObjType)
599 case ACPI_TYPE_BUFFER:
600 case ACPI_TYPE_STRING:
602 * NOTE: takes advantage of common fields between string/buffer
604 BytesToDump = ObjDesc->String.Length;
605 ObjDesc = (void *) ObjDesc->String.Pointer;
606 AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
607 ObjDesc, BytesToDump);
608 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
609 goto Cleanup;
611 case ACPI_TYPE_BUFFER_FIELD:
613 ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
614 break;
616 case ACPI_TYPE_PACKAGE:
618 ObjDesc = (void *) ObjDesc->Package.Elements;
619 break;
621 case ACPI_TYPE_METHOD:
623 ObjDesc = (void *) ObjDesc->Method.AmlStart;
624 break;
626 case ACPI_TYPE_LOCAL_REGION_FIELD:
628 ObjDesc = (void *) ObjDesc->Field.RegionObj;
629 break;
631 case ACPI_TYPE_LOCAL_BANK_FIELD:
633 ObjDesc = (void *) ObjDesc->BankField.RegionObj;
634 break;
636 case ACPI_TYPE_LOCAL_INDEX_FIELD:
638 ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
639 break;
641 default:
643 goto Cleanup;
646 ObjType = ACPI_TYPE_INVALID; /* Terminate loop after next pass */
649 Cleanup:
650 AcpiOsPrintf ("\n");
651 return (AE_OK);
655 /*******************************************************************************
657 * FUNCTION: AcpiNsDumpObjects
659 * PARAMETERS: Type - Object type to be dumped
660 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
661 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
662 * for an effectively unlimited depth.
663 * OwnerId - Dump only objects owned by this ID. Use
664 * ACPI_UINT32_MAX to match all owners.
665 * StartHandle - Where in namespace to start/end search
667 * RETURN: None
669 * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
670 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
672 ******************************************************************************/
674 void
675 AcpiNsDumpObjects (
676 ACPI_OBJECT_TYPE Type,
677 UINT8 DisplayType,
678 UINT32 MaxDepth,
679 ACPI_OWNER_ID OwnerId,
680 ACPI_HANDLE StartHandle)
682 ACPI_WALK_INFO Info;
683 ACPI_STATUS Status;
686 ACPI_FUNCTION_ENTRY ();
690 * Just lock the entire namespace for the duration of the dump.
691 * We don't want any changes to the namespace during this time,
692 * especially the temporary nodes since we are going to display
693 * them also.
695 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
696 if (ACPI_FAILURE (Status))
698 AcpiOsPrintf ("Could not acquire namespace mutex\n");
699 return;
702 Info.DebugLevel = ACPI_LV_TABLES;
703 Info.OwnerId = OwnerId;
704 Info.DisplayType = DisplayType;
706 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
707 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
708 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
710 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
714 /*******************************************************************************
716 * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
718 * PARAMETERS: ObjHandle - Node to be dumped
719 * Level - Nesting level of the handle
720 * Context - Passed into WalkNamespace
721 * ReturnValue - Not used
723 * RETURN: Status
725 * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
726 * computes the maximum nesting depth in the namespace tree, in
727 * order to simplify formatting in AcpiNsDumpOneObjectPath.
728 * These procedures are UserFunctions called by AcpiNsWalkNamespace.
730 ******************************************************************************/
732 static ACPI_STATUS
733 AcpiNsDumpOneObjectPath (
734 ACPI_HANDLE ObjHandle,
735 UINT32 Level,
736 void *Context,
737 void **ReturnValue)
739 UINT32 MaxLevel = *((UINT32 *) Context);
740 char *Pathname;
741 ACPI_NAMESPACE_NODE *Node;
742 int PathIndent;
745 if (!ObjHandle)
747 return (AE_OK);
750 Node = AcpiNsValidateHandle (ObjHandle);
751 if (!Node)
753 /* Ignore bad node during namespace walk */
755 return (AE_OK);
758 Pathname = AcpiNsGetExternalPathname (Node);
760 PathIndent = 1;
761 if (Level <= MaxLevel)
763 PathIndent = MaxLevel - Level + 1;
766 AcpiOsPrintf ("%2d%*s%-12s%*s",
767 Level, Level, " ", AcpiUtGetTypeName (Node->Type),
768 PathIndent, " ");
770 AcpiOsPrintf ("%s\n", &Pathname[1]);
771 ACPI_FREE (Pathname);
772 return (AE_OK);
776 static ACPI_STATUS
777 AcpiNsGetMaxDepth (
778 ACPI_HANDLE ObjHandle,
779 UINT32 Level,
780 void *Context,
781 void **ReturnValue)
783 UINT32 *MaxLevel = (UINT32 *) Context;
786 if (Level > *MaxLevel)
788 *MaxLevel = Level;
790 return (AE_OK);
794 /*******************************************************************************
796 * FUNCTION: AcpiNsDumpObjectPaths
798 * PARAMETERS: Type - Object type to be dumped
799 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
800 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
801 * for an effectively unlimited depth.
802 * OwnerId - Dump only objects owned by this ID. Use
803 * ACPI_UINT32_MAX to match all owners.
804 * StartHandle - Where in namespace to start/end search
806 * RETURN: None
808 * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
809 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
811 ******************************************************************************/
813 void
814 AcpiNsDumpObjectPaths (
815 ACPI_OBJECT_TYPE Type,
816 UINT8 DisplayType,
817 UINT32 MaxDepth,
818 ACPI_OWNER_ID OwnerId,
819 ACPI_HANDLE StartHandle)
821 ACPI_STATUS Status;
822 UINT32 MaxLevel = 0;
825 ACPI_FUNCTION_ENTRY ();
829 * Just lock the entire namespace for the duration of the dump.
830 * We don't want any changes to the namespace during this time,
831 * especially the temporary nodes since we are going to display
832 * them also.
834 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
835 if (ACPI_FAILURE (Status))
837 AcpiOsPrintf ("Could not acquire namespace mutex\n");
838 return;
841 /* Get the max depth of the namespace tree, for formatting later */
843 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
844 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
845 AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
847 /* Now dump the entire namespace */
849 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
850 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
851 AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
853 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
857 /*******************************************************************************
859 * FUNCTION: AcpiNsDumpEntry
861 * PARAMETERS: Handle - Node to be dumped
862 * DebugLevel - Output level
864 * RETURN: None
866 * DESCRIPTION: Dump a single Node
868 ******************************************************************************/
870 void
871 AcpiNsDumpEntry (
872 ACPI_HANDLE Handle,
873 UINT32 DebugLevel)
875 ACPI_WALK_INFO Info;
878 ACPI_FUNCTION_ENTRY ();
881 Info.DebugLevel = DebugLevel;
882 Info.OwnerId = ACPI_OWNER_ID_MAX;
883 Info.DisplayType = ACPI_DISPLAY_SUMMARY;
885 (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
889 #ifdef ACPI_ASL_COMPILER
890 /*******************************************************************************
892 * FUNCTION: AcpiNsDumpTables
894 * PARAMETERS: SearchBase - Root of subtree to be dumped, or
895 * NS_ALL to dump the entire namespace
896 * MaxDepth - Maximum depth of dump. Use INT_MAX
897 * for an effectively unlimited depth.
899 * RETURN: None
901 * DESCRIPTION: Dump the name space, or a portion of it.
903 ******************************************************************************/
905 void
906 AcpiNsDumpTables (
907 ACPI_HANDLE SearchBase,
908 UINT32 MaxDepth)
910 ACPI_HANDLE SearchHandle = SearchBase;
913 ACPI_FUNCTION_TRACE (NsDumpTables);
916 if (!AcpiGbl_RootNode)
919 * If the name space has not been initialized,
920 * there is nothing to dump.
922 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "namespace not initialized!\n"));
923 return_VOID;
926 if (ACPI_NS_ALL == SearchBase)
928 /* Entire namespace */
930 SearchHandle = AcpiGbl_RootNode;
931 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
934 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
935 ACPI_OWNER_ID_MAX, SearchHandle);
936 return_VOID;
938 #endif
939 #endif