1 /******************************************************************************
3 * Module Name: nsdump - table dumping routines for debug
5 *****************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2019, Intel Corp.
12 * All rights reserved.
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
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,
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
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;
38 * The above copyright and patent license is granted only if the following
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.
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
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
73 * 3.4. Intel retains all right, title, and interest in and to the Original
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.
81 * 4. Disclaimer and Export Compliance
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
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
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.
115 *****************************************************************************
117 * Alternatively, you may choose to be licensed under the terms of the
120 * Redistribution and use in source and binary forms, with or without
121 * modification, are permitted provided that the following conditions
123 * 1. Redistributions of source code must retain the above copyright
124 * notice, this list of conditions, and the following disclaimer,
125 * without modification.
126 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
127 * substantially similar to the "NO WARRANTY" disclaimer below
128 * ("Disclaimer") and any redistribution must be conditioned upon
129 * including a substantially similar Disclaimer requirement for further
130 * binary redistribution.
131 * 3. Neither the names of the above-listed copyright holders nor the names
132 * of any contributors may be used to endorse or promote products derived
133 * from this software without specific prior written permission.
135 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
136 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
137 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
138 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
139 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
140 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
141 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
142 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
143 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
144 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
145 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
147 * Alternatively, you may choose to be licensed under the terms of the
148 * GNU General Public License ("GPL") version 2 as published by the Free
149 * Software Foundation.
151 *****************************************************************************/
153 #include <contrib/dev/acpica/include/acpi.h>
154 #include <contrib/dev/acpica/include/accommon.h>
155 #include <contrib/dev/acpica/include/acnamesp.h>
156 #include <contrib/dev/acpica/include/acoutput.h>
159 #define _COMPONENT ACPI_NAMESPACE
160 ACPI_MODULE_NAME ("nsdump")
162 /* Local prototypes */
164 #ifdef ACPI_OBSOLETE_FUNCTIONS
166 AcpiNsDumpRootDevices (
170 AcpiNsDumpOneDevice (
171 ACPI_HANDLE ObjHandle,
178 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
181 AcpiNsDumpOneObjectPath (
182 ACPI_HANDLE ObjHandle,
189 ACPI_HANDLE ObjHandle,
195 /*******************************************************************************
197 * FUNCTION: AcpiNsPrintPathname
199 * PARAMETERS: NumSegments - Number of ACPI name segments
200 * Pathname - The compressed (internal) path
204 * DESCRIPTION: Print an object's full namespace pathname
206 ******************************************************************************/
209 AcpiNsPrintPathname (
211 const char *Pathname)
216 ACPI_FUNCTION_NAME (NsPrintPathname);
219 /* Check if debug output enabled */
221 if (!ACPI_IS_DEBUG_ENABLED (ACPI_LV_NAMES, ACPI_NAMESPACE))
226 /* Print the entire name */
228 ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "["));
232 for (i = 0; i < 4; i++)
234 isprint ((int) Pathname[i]) ?
235 AcpiOsPrintf ("%c", Pathname[i]) :
239 Pathname += ACPI_NAMESEG_SIZE;
247 AcpiOsPrintf ("]\n");
251 #ifdef ACPI_OBSOLETE_FUNCTIONS
252 /* Not used at this time, perhaps later */
254 /*******************************************************************************
256 * FUNCTION: AcpiNsDumpPathname
258 * PARAMETERS: Handle - Object
259 * Msg - Prefix message
260 * Level - Desired debug level
261 * Component - Caller's component ID
265 * DESCRIPTION: Print an object's full namespace pathname
266 * Manages allocation/freeing of a pathname buffer
268 ******************************************************************************/
278 ACPI_FUNCTION_TRACE (NsDumpPathname);
281 /* Do this only if the requested debug level and component are enabled */
283 if (!ACPI_IS_DEBUG_ENABLED (Level, Component))
288 /* Convert handle to a full pathname and print it (with supplied message) */
290 AcpiNsPrintNodePathname (Handle, Msg);
297 /*******************************************************************************
299 * FUNCTION: AcpiNsDumpOneObject
301 * PARAMETERS: ObjHandle - Node to be dumped
302 * Level - Nesting level of the handle
303 * Context - Passed into WalkNamespace
304 * ReturnValue - Not used
308 * DESCRIPTION: Dump a single Node
309 * This procedure is a UserFunction called by AcpiNsWalkNamespace.
311 ******************************************************************************/
314 AcpiNsDumpOneObject (
315 ACPI_HANDLE ObjHandle,
320 ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
321 ACPI_NAMESPACE_NODE *ThisNode;
322 ACPI_OPERAND_OBJECT *ObjDesc = NULL;
323 ACPI_OBJECT_TYPE ObjType;
324 ACPI_OBJECT_TYPE Type;
330 ACPI_FUNCTION_NAME (NsDumpOneObject);
333 /* Is output enabled? */
335 if (!(AcpiDbgLevel & Info->DebugLevel))
342 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Null object handle\n"));
346 ThisNode = AcpiNsValidateHandle (ObjHandle);
349 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Invalid object handle %p\n",
354 Type = ThisNode->Type;
357 /* Check if the owner matches */
359 if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
360 (Info->OwnerId != ThisNode->OwnerId))
365 if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
367 /* Indent the object according to the level */
369 AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
371 /* Check the node type and name */
373 if (Type > ACPI_TYPE_LOCAL_MAX)
375 ACPI_WARNING ((AE_INFO,
376 "Invalid ACPI Object Type 0x%08X", Type));
379 AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
382 /* Now we can print out the pertinent information */
384 AcpiOsPrintf (" %-12s %p %3.3X ",
385 AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
387 DbgLevel = AcpiDbgLevel;
389 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
390 AcpiDbgLevel = DbgLevel;
392 /* Temp nodes are those nodes created by a control method */
394 if (ThisNode->Flags & ANOBJ_TEMPORARY)
396 AcpiOsPrintf ("(T) ");
399 switch (Info->DisplayType & ACPI_DISPLAY_MASK)
401 case ACPI_DISPLAY_SUMMARY:
405 /* No attached object. Some types should always have an object */
409 case ACPI_TYPE_INTEGER:
410 case ACPI_TYPE_PACKAGE:
411 case ACPI_TYPE_BUFFER:
412 case ACPI_TYPE_STRING:
413 case ACPI_TYPE_METHOD:
415 AcpiOsPrintf ("<No attached object>");
429 case ACPI_TYPE_PROCESSOR:
431 AcpiOsPrintf ("ID %02X Len %02X Addr %8.8X%8.8X\n",
432 ObjDesc->Processor.ProcId, ObjDesc->Processor.Length,
433 ACPI_FORMAT_UINT64 (ObjDesc->Processor.Address));
436 case ACPI_TYPE_DEVICE:
438 AcpiOsPrintf ("Notify Object: %p\n", ObjDesc);
441 case ACPI_TYPE_METHOD:
443 AcpiOsPrintf ("Args %X Len %.4X Aml %p\n",
444 (UINT32) ObjDesc->Method.ParamCount,
445 ObjDesc->Method.AmlLength, ObjDesc->Method.AmlStart);
448 case ACPI_TYPE_INTEGER:
450 AcpiOsPrintf ("= %8.8X%8.8X\n",
451 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
454 case ACPI_TYPE_PACKAGE:
456 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
458 AcpiOsPrintf ("Elements %.2X\n",
459 ObjDesc->Package.Count);
463 AcpiOsPrintf ("[Length not yet evaluated]\n");
467 case ACPI_TYPE_BUFFER:
469 if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
471 AcpiOsPrintf ("Len %.2X",
472 ObjDesc->Buffer.Length);
474 /* Dump some of the buffer */
476 if (ObjDesc->Buffer.Length > 0)
479 for (i = 0; (i < ObjDesc->Buffer.Length && i < 12); i++)
481 AcpiOsPrintf (" %2.2X", ObjDesc->Buffer.Pointer[i]);
488 AcpiOsPrintf ("[Length not yet evaluated]\n");
492 case ACPI_TYPE_STRING:
494 AcpiOsPrintf ("Len %.2X ", ObjDesc->String.Length);
495 AcpiUtPrintString (ObjDesc->String.Pointer, 80);
499 case ACPI_TYPE_REGION:
501 AcpiOsPrintf ("[%s]",
502 AcpiUtGetRegionName (ObjDesc->Region.SpaceId));
503 if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
505 AcpiOsPrintf (" Addr %8.8X%8.8X Len %.4X\n",
506 ACPI_FORMAT_UINT64 (ObjDesc->Region.Address),
507 ObjDesc->Region.Length);
511 AcpiOsPrintf (" [Address/Length not yet evaluated]\n");
515 case ACPI_TYPE_LOCAL_REFERENCE:
517 AcpiOsPrintf ("[%s]\n", AcpiUtGetReferenceName (ObjDesc));
520 case ACPI_TYPE_BUFFER_FIELD:
522 if (ObjDesc->BufferField.BufferObj &&
523 ObjDesc->BufferField.BufferObj->Buffer.Node)
525 AcpiOsPrintf ("Buf [%4.4s]",
527 ObjDesc->BufferField.BufferObj->Buffer.Node));
531 case ACPI_TYPE_LOCAL_REGION_FIELD:
533 AcpiOsPrintf ("Rgn [%4.4s]",
535 ObjDesc->CommonField.RegionObj->Region.Node));
538 case ACPI_TYPE_LOCAL_BANK_FIELD:
540 AcpiOsPrintf ("Rgn [%4.4s] Bnk [%4.4s]",
542 ObjDesc->CommonField.RegionObj->Region.Node),
544 ObjDesc->BankField.BankObj->CommonField.Node));
547 case ACPI_TYPE_LOCAL_INDEX_FIELD:
549 AcpiOsPrintf ("Idx [%4.4s] Dat [%4.4s]",
551 ObjDesc->IndexField.IndexObj->CommonField.Node),
553 ObjDesc->IndexField.DataObj->CommonField.Node));
556 case ACPI_TYPE_LOCAL_ALIAS:
557 case ACPI_TYPE_LOCAL_METHOD_ALIAS:
559 AcpiOsPrintf ("Target %4.4s (%p)\n",
560 AcpiUtGetNodeName (ObjDesc), ObjDesc);
565 AcpiOsPrintf ("Object %p\n", ObjDesc);
569 /* Common field handling */
573 case ACPI_TYPE_BUFFER_FIELD:
574 case ACPI_TYPE_LOCAL_REGION_FIELD:
575 case ACPI_TYPE_LOCAL_BANK_FIELD:
576 case ACPI_TYPE_LOCAL_INDEX_FIELD:
578 AcpiOsPrintf (" Off %.3X Len %.2X Acc %.2X\n",
579 (ObjDesc->CommonField.BaseByteOffset * 8)
580 + ObjDesc->CommonField.StartFieldBitOffset,
581 ObjDesc->CommonField.BitLength,
582 ObjDesc->CommonField.AccessByteWidth);
591 case ACPI_DISPLAY_OBJECTS:
593 AcpiOsPrintf ("O:%p", ObjDesc);
596 /* No attached object, we are done */
602 AcpiOsPrintf ("(R%u)", ObjDesc->Common.ReferenceCount);
606 case ACPI_TYPE_METHOD:
608 /* Name is a Method and its AML offset/length are set */
610 AcpiOsPrintf (" M:%p-%X\n", ObjDesc->Method.AmlStart,
611 ObjDesc->Method.AmlLength);
614 case ACPI_TYPE_INTEGER:
616 AcpiOsPrintf (" I:%8.8X8.8%X\n",
617 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
620 case ACPI_TYPE_STRING:
622 AcpiOsPrintf (" S:%p-%X\n", ObjDesc->String.Pointer,
623 ObjDesc->String.Length);
626 case ACPI_TYPE_BUFFER:
628 AcpiOsPrintf (" B:%p-%X\n", ObjDesc->Buffer.Pointer,
629 ObjDesc->Buffer.Length);
644 /* If debug turned off, done */
646 if (!(AcpiDbgLevel & ACPI_LV_VALUES))
651 /* If there is an attached object, display it */
653 DbgLevel = AcpiDbgLevel;
655 ObjDesc = AcpiNsGetAttachedObject (ThisNode);
656 AcpiDbgLevel = DbgLevel;
658 /* Dump attached objects */
662 ObjType = ACPI_TYPE_INVALID;
663 AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
665 /* Decode the type of attached object and dump the contents */
667 switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
669 case ACPI_DESC_TYPE_NAMED:
671 AcpiOsPrintf ("(Ptr to Node)\n");
672 BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
673 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
676 case ACPI_DESC_TYPE_OPERAND:
678 ObjType = ObjDesc->Common.Type;
680 if (ObjType > ACPI_TYPE_LOCAL_MAX)
683 "(Pointer to ACPI Object type %.2X [UNKNOWN])\n",
691 "(Pointer to ACPI Object type %.2X [%s])\n",
692 ObjType, AcpiUtGetTypeName (ObjType));
694 BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
697 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
705 /* If value is NOT an internal object, we are done */
707 if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
712 /* Valid object, get the pointer to next level, if any */
716 case ACPI_TYPE_BUFFER:
717 case ACPI_TYPE_STRING:
719 * NOTE: takes advantage of common fields between string/buffer
721 BytesToDump = ObjDesc->String.Length;
722 ObjDesc = (void *) ObjDesc->String.Pointer;
724 AcpiOsPrintf ("(Buffer/String pointer %p length %X)\n",
725 ObjDesc, BytesToDump);
726 ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
729 case ACPI_TYPE_BUFFER_FIELD:
731 ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
734 case ACPI_TYPE_PACKAGE:
736 ObjDesc = (void *) ObjDesc->Package.Elements;
739 case ACPI_TYPE_METHOD:
741 ObjDesc = (void *) ObjDesc->Method.AmlStart;
744 case ACPI_TYPE_LOCAL_REGION_FIELD:
746 ObjDesc = (void *) ObjDesc->Field.RegionObj;
749 case ACPI_TYPE_LOCAL_BANK_FIELD:
751 ObjDesc = (void *) ObjDesc->BankField.RegionObj;
754 case ACPI_TYPE_LOCAL_INDEX_FIELD:
756 ObjDesc = (void *) ObjDesc->IndexField.IndexObj;
771 /*******************************************************************************
773 * FUNCTION: AcpiNsDumpObjects
775 * PARAMETERS: Type - Object type to be dumped
776 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
777 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
778 * for an effectively unlimited depth.
779 * OwnerId - Dump only objects owned by this ID. Use
780 * ACPI_UINT32_MAX to match all owners.
781 * StartHandle - Where in namespace to start/end search
785 * DESCRIPTION: Dump typed objects within the loaded namespace. Uses
786 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
788 ******************************************************************************/
792 ACPI_OBJECT_TYPE Type,
795 ACPI_OWNER_ID OwnerId,
796 ACPI_HANDLE StartHandle)
802 ACPI_FUNCTION_ENTRY ();
806 * Just lock the entire namespace for the duration of the dump.
807 * We don't want any changes to the namespace during this time,
808 * especially the temporary nodes since we are going to display
811 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
812 if (ACPI_FAILURE (Status))
814 AcpiOsPrintf ("Could not acquire namespace mutex\n");
819 Info.DebugLevel = ACPI_LV_TABLES;
820 Info.OwnerId = OwnerId;
821 Info.DisplayType = DisplayType;
823 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
824 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
825 AcpiNsDumpOneObject, NULL, (void *) &Info, NULL);
827 AcpiOsPrintf ("\nNamespace node count: %u\n\n", Info.Count);
828 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
832 /*******************************************************************************
834 * FUNCTION: AcpiNsDumpOneObjectPath, AcpiNsGetMaxDepth
836 * PARAMETERS: ObjHandle - Node to be dumped
837 * Level - Nesting level of the handle
838 * Context - Passed into WalkNamespace
839 * ReturnValue - Not used
843 * DESCRIPTION: Dump the full pathname to a namespace object. AcpNsGetMaxDepth
844 * computes the maximum nesting depth in the namespace tree, in
845 * order to simplify formatting in AcpiNsDumpOneObjectPath.
846 * These procedures are UserFunctions called by AcpiNsWalkNamespace.
848 ******************************************************************************/
851 AcpiNsDumpOneObjectPath (
852 ACPI_HANDLE ObjHandle,
857 UINT32 MaxLevel = *((UINT32 *) Context);
859 ACPI_NAMESPACE_NODE *Node;
868 Node = AcpiNsValidateHandle (ObjHandle);
871 /* Ignore bad node during namespace walk */
876 Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
879 if (Level <= MaxLevel)
881 PathIndent = MaxLevel - Level + 1;
884 AcpiOsPrintf ("%2d%*s%-12s%*s",
885 Level, Level, " ", AcpiUtGetTypeName (Node->Type),
888 AcpiOsPrintf ("%s\n", &Pathname[1]);
889 ACPI_FREE (Pathname);
896 ACPI_HANDLE ObjHandle,
901 UINT32 *MaxLevel = (UINT32 *) Context;
904 if (Level > *MaxLevel)
912 /*******************************************************************************
914 * FUNCTION: AcpiNsDumpObjectPaths
916 * PARAMETERS: Type - Object type to be dumped
917 * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
918 * MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
919 * for an effectively unlimited depth.
920 * OwnerId - Dump only objects owned by this ID. Use
921 * ACPI_UINT32_MAX to match all owners.
922 * StartHandle - Where in namespace to start/end search
926 * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses
927 * AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObjectPath.
929 ******************************************************************************/
932 AcpiNsDumpObjectPaths (
933 ACPI_OBJECT_TYPE Type,
936 ACPI_OWNER_ID OwnerId,
937 ACPI_HANDLE StartHandle)
943 ACPI_FUNCTION_ENTRY ();
947 * Just lock the entire namespace for the duration of the dump.
948 * We don't want any changes to the namespace during this time,
949 * especially the temporary nodes since we are going to display
952 Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
953 if (ACPI_FAILURE (Status))
955 AcpiOsPrintf ("Could not acquire namespace mutex\n");
959 /* Get the max depth of the namespace tree, for formatting later */
961 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
962 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
963 AcpiNsGetMaxDepth, NULL, (void *) &MaxLevel, NULL);
965 /* Now dump the entire namespace */
967 (void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
968 ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
969 AcpiNsDumpOneObjectPath, NULL, (void *) &MaxLevel, NULL);
971 (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
975 /*******************************************************************************
977 * FUNCTION: AcpiNsDumpEntry
979 * PARAMETERS: Handle - Node to be dumped
980 * DebugLevel - Output level
984 * DESCRIPTION: Dump a single Node
986 ******************************************************************************/
996 ACPI_FUNCTION_ENTRY ();
999 Info.DebugLevel = DebugLevel;
1000 Info.OwnerId = ACPI_OWNER_ID_MAX;
1001 Info.DisplayType = ACPI_DISPLAY_SUMMARY;
1003 (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
1007 #ifdef ACPI_ASL_COMPILER
1008 /*******************************************************************************
1010 * FUNCTION: AcpiNsDumpTables
1012 * PARAMETERS: SearchBase - Root of subtree to be dumped, or
1013 * NS_ALL to dump the entire namespace
1014 * MaxDepth - Maximum depth of dump. Use INT_MAX
1015 * for an effectively unlimited depth.
1019 * DESCRIPTION: Dump the name space, or a portion of it.
1021 ******************************************************************************/
1025 ACPI_HANDLE SearchBase,
1028 ACPI_HANDLE SearchHandle = SearchBase;
1031 ACPI_FUNCTION_TRACE (NsDumpTables);
1034 if (!AcpiGbl_RootNode)
1037 * If the name space has not been initialized,
1038 * there is nothing to dump.
1040 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES,
1041 "namespace not initialized!\n"));
1045 if (ACPI_NS_ALL == SearchBase)
1047 /* Entire namespace */
1049 SearchHandle = AcpiGbl_RootNode;
1050 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
1053 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
1054 ACPI_OWNER_ID_MAX, SearchHandle);