1 /*******************************************************************************
3 * Module Name: dbnames - Debugger commands for the acpi namespace
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2018, 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,
25 * make derivatives, distribute, use and display any portion of the Covered
26 * Code in any form, with the right to sublicense such rights; and
28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29 * license (with the right to sublicense), under only those claims of Intel
30 * patents that are infringed by the Original Intel Code, to make, use, sell,
31 * offer to sell, and import the Covered Code and derivative works thereof
32 * solely to the minimum extent necessary to exercise the above copyright
33 * license, and in no event shall the patent license extend to any additions
34 * to or modifications of the Original Intel Code. No other license or right
35 * is granted directly or by implication, estoppel or otherwise;
37 * The above copyright and patent license is granted only if the following
42 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43 * Redistribution of source code of any substantial portion of the Covered
44 * Code or modification with rights to further distribute source must include
45 * the above Copyright Notice, the above License, this list of Conditions,
46 * and the following Disclaimer and Export Compliance provision. In addition,
47 * Licensee must cause all Covered Code to which Licensee contributes to
48 * contain a file documenting the changes Licensee made to create that Covered
49 * Code and the date of any change. Licensee must include in that file the
50 * documentation of any changes made by any predecessor Licensee. Licensee
51 * must include a prominent statement that the modification is derived,
52 * directly or indirectly, from Original Intel Code.
54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55 * Redistribution of source code of any substantial portion of the Covered
56 * Code or modification without rights to further distribute source must
57 * include the following Disclaimer and Export Compliance provision in the
58 * documentation and/or other materials provided with distribution. In
59 * addition, Licensee may not authorize further sublicense of source of any
60 * portion of the Covered Code, and must include terms to the effect that the
61 * license from Licensee to its licensee is limited to the intellectual
62 * property embodied in the software Licensee provides to its licensee, and
63 * not to intellectual property embodied in modifications its licensee may
66 * 3.3. Redistribution of Executable. Redistribution in executable form of any
67 * substantial portion of the Covered Code or modification must reproduce the
68 * above Copyright Notice, and the following Disclaimer and Export Compliance
69 * provision in the documentation and/or other materials provided with the
72 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76 * Intel shall be used in advertising or otherwise to promote the sale, use or
77 * other dealings in products derived from or relating to the Covered Code
78 * without prior written authorization from Intel.
80 * 4. Disclaimer and Export Compliance
82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99 * 4.3. Licensee shall not export, either directly or indirectly, any of this
100 * software or system incorporating such software without first obtaining any
101 * required license or other approval from the U. S. Department of Commerce or
102 * any other agency or department of the United States Government. In the
103 * event Licensee exports any such software from the United States or
104 * re-exports any such software from a foreign destination, Licensee shall
105 * ensure that the distribution and export/re-export of the software is in
106 * compliance with all laws, regulations, orders, or other restrictions of the
107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108 * any of its subsidiaries will export/re-export any technical data, process,
109 * software, or service, directly or indirectly, to any country for which the
110 * United States government or any agency thereof requires an export license,
111 * other governmental approval, or letter of assurance, without first obtaining
112 * such license, approval or letter.
114 *****************************************************************************
116 * Alternatively, you may choose to be licensed under the terms of the
119 * Redistribution and use in source and binary forms, with or without
120 * modification, are permitted provided that the following conditions
122 * 1. Redistributions of source code must retain the above copyright
123 * notice, this list of conditions, and the following disclaimer,
124 * without modification.
125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
126 * substantially similar to the "NO WARRANTY" disclaimer below
127 * ("Disclaimer") and any redistribution must be conditioned upon
128 * including a substantially similar Disclaimer requirement for further
129 * binary redistribution.
130 * 3. Neither the names of the above-listed copyright holders nor the names
131 * of any contributors may be used to endorse or promote products derived
132 * from this software without specific prior written permission.
134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146 * Alternatively, you may choose to be licensed under the terms of the
147 * GNU General Public License ("GPL") version 2 as published by the Free
148 * Software Foundation.
150 *****************************************************************************/
152 #include <contrib/dev/acpica/include/acpi.h>
153 #include <contrib/dev/acpica/include/accommon.h>
154 #include <contrib/dev/acpica/include/acnamesp.h>
155 #include <contrib/dev/acpica/include/acdebug.h>
156 #include <contrib/dev/acpica/include/acpredef.h>
159 #define _COMPONENT ACPI_CA_DEBUGGER
160 ACPI_MODULE_NAME ("dbnames")
163 /* Local prototypes */
166 AcpiDbWalkAndMatchName (
167 ACPI_HANDLE ObjHandle,
173 AcpiDbWalkForPredefinedNames (
174 ACPI_HANDLE ObjHandle,
180 AcpiDbWalkForSpecificObjects (
181 ACPI_HANDLE ObjHandle,
187 AcpiDbWalkForObjectCounts (
188 ACPI_HANDLE ObjHandle,
194 AcpiDbIntegrityWalk (
195 ACPI_HANDLE ObjHandle,
201 AcpiDbWalkForReferences (
202 ACPI_HANDLE ObjHandle,
209 ACPI_HANDLE ObjHandle,
215 * Arguments for the Objects command
216 * These object types map directly to the ACPI_TYPES
218 static ACPI_DB_ARGUMENT_INFO AcpiDbObjectTypes [] =
248 {NULL} /* Must be null terminated */
252 /*******************************************************************************
254 * FUNCTION: AcpiDbSetScope
256 * PARAMETERS: Name - New scope path
260 * DESCRIPTION: Set the "current scope" as maintained by this utility.
261 * The scope is used as a prefix to ACPI paths.
263 ******************************************************************************/
270 ACPI_NAMESPACE_NODE *Node;
273 if (!Name || Name[0] == 0)
275 AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
279 AcpiDbPrepNamestring (Name);
281 if (ACPI_IS_ROOT_PREFIX (Name[0]))
283 /* Validate new scope from the root */
285 Status = AcpiNsGetNode (AcpiGbl_RootNode, Name,
286 ACPI_NS_NO_UPSEARCH, &Node);
287 if (ACPI_FAILURE (Status))
292 AcpiGbl_DbScopeBuf[0] = 0;
296 /* Validate new scope relative to old scope */
298 Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name,
299 ACPI_NS_NO_UPSEARCH, &Node);
300 if (ACPI_FAILURE (Status))
306 /* Build the final pathname */
308 if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
311 Status = AE_BUFFER_OVERFLOW;
315 if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
318 Status = AE_BUFFER_OVERFLOW;
322 AcpiGbl_DbScopeNode = Node;
323 AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
328 AcpiOsPrintf ("Could not attach scope: %s, %s\n",
329 Name, AcpiFormatException (Status));
333 /*******************************************************************************
335 * FUNCTION: AcpiDbDumpNamespace
337 * PARAMETERS: StartArg - Node to begin namespace dump
338 * DepthArg - Maximum tree depth to be dumped
342 * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
343 * with type and other information.
345 ******************************************************************************/
348 AcpiDbDumpNamespace (
352 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
353 UINT32 MaxDepth = ACPI_UINT32_MAX;
356 /* No argument given, just start at the root and dump entire namespace */
360 SubtreeEntry = AcpiDbConvertToNode (StartArg);
366 /* Now we can check for the depth argument */
370 MaxDepth = strtoul (DepthArg, NULL, 0);
374 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
375 AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
376 ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
378 /* Display the subtree */
380 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
381 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
382 ACPI_OWNER_ID_MAX, SubtreeEntry);
383 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
387 /*******************************************************************************
389 * FUNCTION: AcpiDbDumpNamespacePaths
395 * DESCRIPTION: Dump entire namespace with full object pathnames and object
396 * type information. Alternative to "namespace" command.
398 ******************************************************************************/
401 AcpiDbDumpNamespacePaths (
405 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
406 AcpiOsPrintf ("ACPI Namespace (from root):\n");
408 /* Display the entire namespace */
410 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
411 AcpiNsDumpObjectPaths (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY,
412 ACPI_UINT32_MAX, ACPI_OWNER_ID_MAX, AcpiGbl_RootNode);
414 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
418 /*******************************************************************************
420 * FUNCTION: AcpiDbDumpNamespaceByOwner
422 * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
423 * DepthArg - Maximum tree depth to be dumped
427 * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
429 ******************************************************************************/
432 AcpiDbDumpNamespaceByOwner (
436 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
437 UINT32 MaxDepth = ACPI_UINT32_MAX;
438 ACPI_OWNER_ID OwnerId;
441 OwnerId = (ACPI_OWNER_ID) strtoul (OwnerArg, NULL, 0);
443 /* Now we can check for the depth argument */
447 MaxDepth = strtoul (DepthArg, NULL, 0);
450 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
451 AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
453 /* Display the subtree */
455 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
456 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
457 OwnerId, SubtreeEntry);
458 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
462 /*******************************************************************************
464 * FUNCTION: AcpiDbWalkAndMatchName
466 * PARAMETERS: Callback from WalkNamespace
470 * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
471 * are supported -- '?' matches any character.
473 ******************************************************************************/
476 AcpiDbWalkAndMatchName (
477 ACPI_HANDLE ObjHandle,
483 char *RequestedName = (char *) Context;
489 /* Check for a name match */
491 for (i = 0; i < 4; i++)
493 /* Wildcard support */
495 if ((RequestedName[i] != '?') &&
496 (RequestedName[i] != ((ACPI_NAMESPACE_NODE *)
497 ObjHandle)->Name.Ascii[i]))
499 /* No match, just exit */
505 /* Get the full pathname to this object */
507 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
508 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
509 if (ACPI_FAILURE (Status))
511 AcpiOsPrintf ("Could Not get pathname for object %p\n",
516 Info.OwnerId = ACPI_OWNER_ID_MAX;
517 Info.DebugLevel = ACPI_UINT32_MAX;
518 Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
520 AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
521 (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
522 ACPI_FREE (Buffer.Pointer);
529 /*******************************************************************************
531 * FUNCTION: AcpiDbFindNameInNamespace
533 * PARAMETERS: NameArg - The 4-character ACPI name to find.
534 * wildcards are supported.
538 * DESCRIPTION: Search the namespace for a given name (with wildcards)
540 ******************************************************************************/
543 AcpiDbFindNameInNamespace (
546 char AcpiName[5] = "____";
547 char *AcpiNamePtr = AcpiName;
550 if (strlen (NameArg) > ACPI_NAME_SIZE)
552 AcpiOsPrintf ("Name must be no longer than 4 characters\n");
556 /* Pad out name with underscores as necessary to create a 4-char name */
558 AcpiUtStrupr (NameArg);
561 *AcpiNamePtr = *NameArg;
566 /* Walk the namespace from the root */
568 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
569 ACPI_UINT32_MAX, AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
571 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
576 /*******************************************************************************
578 * FUNCTION: AcpiDbWalkForPredefinedNames
580 * PARAMETERS: Callback from WalkNamespace
584 * DESCRIPTION: Detect and display predefined ACPI names (names that start with
587 ******************************************************************************/
590 AcpiDbWalkForPredefinedNames (
591 ACPI_HANDLE ObjHandle,
596 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
597 UINT32 *Count = (UINT32 *) Context;
598 const ACPI_PREDEFINED_INFO *Predefined;
599 const ACPI_PREDEFINED_INFO *Package = NULL;
601 char StringBuffer[48];
604 Predefined = AcpiUtMatchPredefinedMethod (Node->Name.Ascii);
610 Pathname = AcpiNsGetNormalizedPathname (Node, TRUE);
616 /* If method returns a package, the info is in the next table entry */
618 if (Predefined->Info.ExpectedBtypes & ACPI_RTYPE_PACKAGE)
620 Package = Predefined + 1;
623 AcpiUtGetExpectedReturnTypes (StringBuffer,
624 Predefined->Info.ExpectedBtypes);
626 AcpiOsPrintf ("%-32s Arguments %X, Return Types: %s", Pathname,
627 METHOD_GET_ARG_COUNT (Predefined->Info.ArgumentList),
632 AcpiOsPrintf (" (PkgType %2.2X, ObjType %2.2X, Count %2.2X)",
633 Package->RetInfo.Type, Package->RetInfo.ObjectType1,
634 Package->RetInfo.Count1);
639 /* Check that the declared argument count matches the ACPI spec */
641 AcpiNsCheckAcpiCompliance (Pathname, Node, Predefined);
643 ACPI_FREE (Pathname);
649 /*******************************************************************************
651 * FUNCTION: AcpiDbCheckPredefinedNames
657 * DESCRIPTION: Validate all predefined names in the namespace
659 ******************************************************************************/
662 AcpiDbCheckPredefinedNames (
668 /* Search all nodes in namespace */
670 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
671 ACPI_UINT32_MAX, AcpiDbWalkForPredefinedNames,
672 NULL, (void *) &Count, NULL);
674 AcpiOsPrintf ("Found %u predefined names in the namespace\n", Count);
678 /*******************************************************************************
680 * FUNCTION: AcpiDbWalkForObjectCounts
682 * PARAMETERS: Callback from WalkNamespace
686 * DESCRIPTION: Display short info about objects in the namespace
688 ******************************************************************************/
691 AcpiDbWalkForObjectCounts (
692 ACPI_HANDLE ObjHandle,
697 ACPI_OBJECT_INFO *Info = (ACPI_OBJECT_INFO *) Context;
698 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
701 if (Node->Type > ACPI_TYPE_NS_NODE_MAX)
703 AcpiOsPrintf ("[%4.4s]: Unknown object type %X\n",
704 Node->Name.Ascii, Node->Type);
708 Info->Types[Node->Type]++;
715 /*******************************************************************************
717 * FUNCTION: AcpiDbWalkForSpecificObjects
719 * PARAMETERS: Callback from WalkNamespace
723 * DESCRIPTION: Display short info about objects in the namespace
725 ******************************************************************************/
728 AcpiDbWalkForSpecificObjects (
729 ACPI_HANDLE ObjHandle,
734 ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
741 /* Get and display the full pathname to this object */
743 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
744 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
745 if (ACPI_FAILURE (Status))
747 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
751 AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
752 ACPI_FREE (Buffer.Pointer);
754 /* Dump short info about the object */
756 (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
761 /*******************************************************************************
763 * FUNCTION: AcpiDbDisplayObjects
765 * PARAMETERS: ObjTypeArg - Type of object to display
766 * DisplayCountArg - Max depth to display
770 * DESCRIPTION: Display objects in the namespace of the requested type
772 ******************************************************************************/
775 AcpiDbDisplayObjects (
777 char *DisplayCountArg)
780 ACPI_OBJECT_TYPE Type;
781 ACPI_OBJECT_INFO *ObjectInfo;
783 UINT32 TotalObjects = 0;
786 /* No argument means display summary/count of all object types */
790 ObjectInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_OBJECT_INFO));
792 /* Walk the namespace from the root */
794 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
795 ACPI_UINT32_MAX, AcpiDbWalkForObjectCounts, NULL,
796 (void *) ObjectInfo, NULL);
798 AcpiOsPrintf ("\nSummary of namespace objects:\n\n");
800 for (i = 0; i < ACPI_TOTAL_TYPES; i++)
802 AcpiOsPrintf ("%8u %s\n", ObjectInfo->Types[i],
803 AcpiUtGetTypeName (i));
805 TotalObjects += ObjectInfo->Types[i];
808 AcpiOsPrintf ("\n%8u Total namespace objects\n\n",
811 ACPI_FREE (ObjectInfo);
815 /* Get the object type */
817 Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
818 if (Type == ACPI_TYPE_NOT_FOUND)
820 AcpiOsPrintf ("Invalid or unsupported argument\n");
824 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
826 "Objects of type [%s] defined in the current ACPI Namespace:\n",
827 AcpiUtGetTypeName (Type));
829 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
832 Info.OwnerId = ACPI_OWNER_ID_MAX;
833 Info.DebugLevel = ACPI_UINT32_MAX;
834 Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
836 /* Walk the namespace from the root */
838 (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
839 AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
842 "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
843 Info.Count, AcpiUtGetTypeName (Type));
845 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
850 /*******************************************************************************
852 * FUNCTION: AcpiDbIntegrityWalk
854 * PARAMETERS: Callback from WalkNamespace
858 * DESCRIPTION: Examine one NS node for valid values.
860 ******************************************************************************/
863 AcpiDbIntegrityWalk (
864 ACPI_HANDLE ObjHandle,
869 ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
870 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
871 ACPI_OPERAND_OBJECT *Object;
872 BOOLEAN Alias = TRUE;
877 /* Verify the NS node, and dereference aliases */
881 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
884 "Invalid Descriptor Type for Node %p [%s] - "
885 "is %2.2X should be %2.2X\n",
886 Node, AcpiUtGetDescriptorName (Node),
887 ACPI_GET_DESCRIPTOR_TYPE (Node), ACPI_DESC_TYPE_NAMED);
891 if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) ||
892 (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
894 Node = (ACPI_NAMESPACE_NODE *) Node->Object;
902 if (Node->Type > ACPI_TYPE_LOCAL_MAX)
904 AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
909 if (!AcpiUtValidNameseg (Node->Name.Ascii))
911 AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
915 Object = AcpiNsGetAttachedObject (Node);
919 if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
921 AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
922 Object, AcpiUtGetDescriptorName (Object));
930 /*******************************************************************************
932 * FUNCTION: AcpiDbCheckIntegrity
938 * DESCRIPTION: Check entire namespace for data structure integrity
940 ******************************************************************************/
943 AcpiDbCheckIntegrity (
946 ACPI_INTEGRITY_INFO Info = {0,0};
948 /* Search all nodes in namespace */
950 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
951 ACPI_UINT32_MAX, AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
953 AcpiOsPrintf ("Verified %u namespace nodes with %u Objects\n",
954 Info.Nodes, Info.Objects);
958 /*******************************************************************************
960 * FUNCTION: AcpiDbWalkForReferences
962 * PARAMETERS: Callback from WalkNamespace
966 * DESCRIPTION: Check if this namespace object refers to the target object
967 * that is passed in as the context value.
969 * Note: Currently doesn't check subobjects within the Node's object
971 ******************************************************************************/
974 AcpiDbWalkForReferences (
975 ACPI_HANDLE ObjHandle,
980 ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
981 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
984 /* Check for match against the namespace node itself */
986 if (Node == (void *) ObjDesc)
988 AcpiOsPrintf ("Object is a Node [%4.4s]\n",
989 AcpiUtGetNodeName (Node));
992 /* Check for match against the object attached to the node */
994 if (AcpiNsGetAttachedObject (Node) == ObjDesc)
996 AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
997 Node, AcpiUtGetNodeName (Node));
1004 /*******************************************************************************
1006 * FUNCTION: AcpiDbFindReferences
1008 * PARAMETERS: ObjectArg - String with hex value of the object
1012 * DESCRIPTION: Search namespace for all references to the input object
1014 ******************************************************************************/
1017 AcpiDbFindReferences (
1020 ACPI_OPERAND_OBJECT *ObjDesc;
1024 /* Convert string to object pointer */
1026 Address = strtoul (ObjectArg, NULL, 16);
1027 ObjDesc = ACPI_TO_POINTER (Address);
1029 /* Search all nodes in namespace */
1031 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
1032 ACPI_UINT32_MAX, AcpiDbWalkForReferences, NULL,
1033 (void *) ObjDesc, NULL);
1037 /*******************************************************************************
1039 * FUNCTION: AcpiDbBusWalk
1041 * PARAMETERS: Callback from WalkNamespace
1045 * DESCRIPTION: Display info about device objects that have a corresponding
1048 ******************************************************************************/
1052 ACPI_HANDLE ObjHandle,
1053 UINT32 NestingLevel,
1057 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
1060 ACPI_NAMESPACE_NODE *TempNode;
1061 ACPI_DEVICE_INFO *Info;
1065 if ((Node->Type != ACPI_TYPE_DEVICE) &&
1066 (Node->Type != ACPI_TYPE_PROCESSOR))
1071 /* Exit if there is no _PRT under this device */
1073 Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
1074 ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
1075 if (ACPI_FAILURE (Status))
1080 /* Get the full path to this device object */
1082 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1083 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer, TRUE);
1084 if (ACPI_FAILURE (Status))
1086 AcpiOsPrintf ("Could Not get pathname for object %p\n",
1091 Status = AcpiGetObjectInfo (ObjHandle, &Info);
1092 if (ACPI_FAILURE (Status))
1097 /* Display the full path */
1099 AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
1100 ACPI_FREE (Buffer.Pointer);
1102 if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
1104 AcpiOsPrintf (" - Is PCI Root Bridge");
1106 AcpiOsPrintf ("\n");
1110 AcpiOsPrintf ("_PRT: %p\n", TempNode);
1112 /* Dump _ADR, _HID, _UID, _CID */
1114 if (Info->Valid & ACPI_VALID_ADR)
1116 AcpiOsPrintf ("_ADR: %8.8X%8.8X\n",
1117 ACPI_FORMAT_UINT64 (Info->Address));
1121 AcpiOsPrintf ("_ADR: <Not Present>\n");
1124 if (Info->Valid & ACPI_VALID_HID)
1126 AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
1130 AcpiOsPrintf ("_HID: <Not Present>\n");
1133 if (Info->Valid & ACPI_VALID_UID)
1135 AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
1139 AcpiOsPrintf ("_UID: <Not Present>\n");
1142 if (Info->Valid & ACPI_VALID_CID)
1144 for (i = 0; i < Info->CompatibleIdList.Count; i++)
1146 AcpiOsPrintf ("_CID: %s\n",
1147 Info->CompatibleIdList.Ids[i].String);
1152 AcpiOsPrintf ("_CID: <Not Present>\n");
1160 /*******************************************************************************
1162 * FUNCTION: AcpiDbGetBusInfo
1168 * DESCRIPTION: Display info about system busses.
1170 ******************************************************************************/
1176 /* Search all nodes in namespace */
1178 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
1179 ACPI_UINT32_MAX, AcpiDbBusWalk, NULL, NULL, NULL);