1 /*******************************************************************************
3 * Module Name: dbcmds - debug commands and output routines
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2010, 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 *****************************************************************************/
117 #include <contrib/dev/acpica/include/acpi.h>
118 #include <contrib/dev/acpica/include/accommon.h>
119 #include <contrib/dev/acpica/include/acdispat.h>
120 #include <contrib/dev/acpica/include/acnamesp.h>
121 #include <contrib/dev/acpica/include/acevents.h>
122 #include <contrib/dev/acpica/include/acdebug.h>
123 #include <contrib/dev/acpica/include/acresrc.h>
124 #include <contrib/dev/acpica/include/acdisasm.h>
125 #include <contrib/dev/acpica/include/actables.h>
126 #include <contrib/dev/acpica/include/acparser.h>
130 #define _COMPONENT ACPI_CA_DEBUGGER
131 ACPI_MODULE_NAME ("dbcmds")
134 /* Local prototypes */
137 AcpiDbIntegrityWalk (
138 ACPI_HANDLE ObjHandle,
144 AcpiDbWalkAndMatchName (
145 ACPI_HANDLE ObjHandle,
151 AcpiDbWalkForReferences (
152 ACPI_HANDLE ObjHandle,
158 AcpiDbWalkForSpecificObjects (
159 ACPI_HANDLE ObjHandle,
164 static ACPI_NAMESPACE_NODE *
165 AcpiDbConvertToNode (
169 AcpiDmCompareAmlResources (
171 ACPI_RSDESC_SIZE Aml1BufferLength,
173 ACPI_RSDESC_SIZE Aml2BufferLength);
176 AcpiDmTestResourceConversion (
177 ACPI_NAMESPACE_NODE *Node,
182 * Arguments for the Objects command
183 * These object types map directly to the ACPI_TYPES
185 static ARGUMENT_INFO AcpiDbObjectTypes [] =
209 {NULL} /* Must be null terminated */
213 /*******************************************************************************
215 * FUNCTION: AcpiDbConvertToNode
217 * PARAMETERS: InString - String to convert
219 * RETURN: Pointer to a NS node
221 * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
224 ******************************************************************************/
226 static ACPI_NAMESPACE_NODE *
227 AcpiDbConvertToNode (
230 ACPI_NAMESPACE_NODE *Node;
233 if ((*InString >= 0x30) && (*InString <= 0x39))
235 /* Numeric argument, convert */
237 Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16));
238 if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
240 AcpiOsPrintf ("Address %p is invalid in this address space\n",
245 /* Make sure pointer is valid NS node */
247 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
249 AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
250 Node, AcpiUtGetDescriptorName (Node));
257 /* The parameter is a name string that must be resolved to a
260 Node = AcpiDbLocalNsLookup (InString);
263 Node = AcpiGbl_RootNode;
271 /*******************************************************************************
273 * FUNCTION: AcpiDbSleep
275 * PARAMETERS: ObjectArg - Desired sleep state (0-5)
279 * DESCRIPTION: Simulate a sleep/wake sequence
281 ******************************************************************************/
291 SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
293 AcpiOsPrintf ("**** Prepare to sleep ****\n");
294 Status = AcpiEnterSleepStatePrep (SleepState);
295 if (ACPI_FAILURE (Status))
300 AcpiOsPrintf ("**** Going to sleep ****\n");
301 Status = AcpiEnterSleepState (SleepState);
302 if (ACPI_FAILURE (Status))
307 AcpiOsPrintf ("**** returning from sleep ****\n");
308 Status = AcpiLeaveSleepState (SleepState);
314 /*******************************************************************************
316 * FUNCTION: AcpiDbWalkForReferences
318 * PARAMETERS: Callback from WalkNamespace
322 * DESCRIPTION: Check if this namespace object refers to the target object
323 * that is passed in as the context value.
325 * Note: Currently doesn't check subobjects within the Node's object
327 ******************************************************************************/
330 AcpiDbWalkForReferences (
331 ACPI_HANDLE ObjHandle,
336 ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
337 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
340 /* Check for match against the namespace node itself */
342 if (Node == (void *) ObjDesc)
344 AcpiOsPrintf ("Object is a Node [%4.4s]\n",
345 AcpiUtGetNodeName (Node));
348 /* Check for match against the object attached to the node */
350 if (AcpiNsGetAttachedObject (Node) == ObjDesc)
352 AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
353 Node, AcpiUtGetNodeName (Node));
360 /*******************************************************************************
362 * FUNCTION: AcpiDbFindReferences
364 * PARAMETERS: ObjectArg - String with hex value of the object
368 * DESCRIPTION: Search namespace for all references to the input object
370 ******************************************************************************/
373 AcpiDbFindReferences (
376 ACPI_OPERAND_OBJECT *ObjDesc;
379 /* Convert string to object pointer */
381 ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
383 /* Search all nodes in namespace */
385 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
386 AcpiDbWalkForReferences, NULL, (void *) ObjDesc, NULL);
390 /*******************************************************************************
392 * FUNCTION: AcpiDbWalkForPredefinedNames
394 * PARAMETERS: Callback from WalkNamespace
398 * DESCRIPTION: Detect and display predefined ACPI names (names that start with
401 ******************************************************************************/
404 AcpiDbWalkForPredefinedNames (
405 ACPI_HANDLE ObjHandle,
410 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
411 UINT32 *Count = (UINT32 *) Context;
412 const ACPI_PREDEFINED_INFO *Predefined;
413 const ACPI_PREDEFINED_INFO *Package = NULL;
417 Predefined = AcpiNsCheckForPredefinedName (Node);
423 Pathname = AcpiNsGetExternalPathname (Node);
429 /* If method returns a package, the info is in the next table entry */
431 if (Predefined->Info.ExpectedBtypes & ACPI_BTYPE_PACKAGE)
433 Package = Predefined + 1;
436 AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname,
437 Predefined->Info.ParamCount, Predefined->Info.ExpectedBtypes);
441 AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
442 Package->RetInfo.Type, Package->RetInfo.ObjectType1,
443 Package->RetInfo.Count1);
448 AcpiNsCheckParameterCount (Pathname, Node, ACPI_UINT32_MAX, Predefined);
449 ACPI_FREE (Pathname);
456 /*******************************************************************************
458 * FUNCTION: AcpiDbCheckPredefinedNames
464 * DESCRIPTION: Validate all predefined names in the namespace
466 ******************************************************************************/
469 AcpiDbCheckPredefinedNames (
475 /* Search all nodes in namespace */
477 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
478 AcpiDbWalkForPredefinedNames, NULL, (void *) &Count, NULL);
480 AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count);
484 /*******************************************************************************
486 * FUNCTION: AcpiDbWalkForExecute
488 * PARAMETERS: Callback from WalkNamespace
492 * DESCRIPTION: Batch execution module. Currently only executes predefined
495 ******************************************************************************/
498 AcpiDbWalkForExecute (
499 ACPI_HANDLE ObjHandle,
504 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
505 ACPI_EXECUTE_WALK *Info = (ACPI_EXECUTE_WALK *) Context;
506 ACPI_BUFFER ReturnObj;
510 ACPI_DEVICE_INFO *ObjInfo;
511 ACPI_OBJECT_LIST ParamObjects;
512 ACPI_OBJECT Params[ACPI_METHOD_NUM_ARGS];
513 const ACPI_PREDEFINED_INFO *Predefined;
516 Predefined = AcpiNsCheckForPredefinedName (Node);
522 if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
527 Pathname = AcpiNsGetExternalPathname (Node);
533 /* Get the object info for number of method parameters */
535 Status = AcpiGetObjectInfo (ObjHandle, &ObjInfo);
536 if (ACPI_FAILURE (Status))
541 ParamObjects.Pointer = NULL;
542 ParamObjects.Count = 0;
544 if (ObjInfo->Type == ACPI_TYPE_METHOD)
546 /* Setup default parameters */
548 for (i = 0; i < ObjInfo->ParamCount; i++)
550 Params[i].Type = ACPI_TYPE_INTEGER;
551 Params[i].Integer.Value = 1;
554 ParamObjects.Pointer = Params;
555 ParamObjects.Count = ObjInfo->ParamCount;
559 ReturnObj.Pointer = NULL;
560 ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
562 /* Do the actual method execution */
564 AcpiGbl_MethodExecuting = TRUE;
566 Status = AcpiEvaluateObject (Node, NULL, &ParamObjects, &ReturnObj);
568 AcpiOsPrintf ("%-32s returned %s\n", Pathname, AcpiFormatException (Status));
569 AcpiGbl_MethodExecuting = FALSE;
570 ACPI_FREE (Pathname);
572 /* Ignore status from method execution */
576 /* Update count, check if we have executed enough methods */
579 if (Info->Count >= Info->MaxCount)
581 Status = AE_CTRL_TERMINATE;
588 /*******************************************************************************
590 * FUNCTION: AcpiDbBatchExecute
592 * PARAMETERS: CountArg - Max number of methods to execute
596 * DESCRIPTION: Namespace batch execution. Execute predefined names in the
597 * namespace, up to the max count, if specified.
599 ******************************************************************************/
605 ACPI_EXECUTE_WALK Info;
609 Info.MaxCount = ACPI_UINT32_MAX;
613 Info.MaxCount = ACPI_STRTOUL (CountArg, NULL, 0);
617 /* Search all nodes in namespace */
619 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
620 AcpiDbWalkForExecute, NULL, (void *) &Info, NULL);
622 AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Info.Count);
626 /*******************************************************************************
628 * FUNCTION: AcpiDbDisplayLocks
634 * DESCRIPTION: Display information about internal mutexes.
636 ******************************************************************************/
645 for (i = 0; i < ACPI_MAX_MUTEX; i++)
647 AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
648 AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
649 ? "Locked" : "Unlocked");
654 /*******************************************************************************
656 * FUNCTION: AcpiDbDisplayTableInfo
658 * PARAMETERS: TableArg - String with name of table to be displayed
662 * DESCRIPTION: Display information about loaded tables. Current
663 * implementation displays all loaded tables.
665 ******************************************************************************/
668 AcpiDbDisplayTableInfo (
672 ACPI_TABLE_DESC *TableDesc;
676 /* Walk the entire root table list */
678 for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
680 TableDesc = &AcpiGbl_RootTableList.Tables[i];
681 AcpiOsPrintf ("%d ", i);
683 /* Make sure that the table is mapped */
685 Status = AcpiTbVerifyTable (TableDesc);
686 if (ACPI_FAILURE (Status))
691 /* Dump the table header */
693 if (TableDesc->Pointer)
695 AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
699 /* If the pointer is null, the table has been unloaded */
701 ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded",
702 TableDesc->Signature.Ascii));
708 /*******************************************************************************
710 * FUNCTION: AcpiDbUnloadAcpiTable
712 * PARAMETERS: TableArg - Name of the table to be unloaded
713 * InstanceArg - Which instance of the table to unload (if
714 * there are multiple tables of the same type)
718 * DESCRIPTION: Unload an ACPI table.
719 * Instance is not implemented
721 ******************************************************************************/
724 AcpiDbUnloadAcpiTable (
728 /* TBD: Need to reimplement for new data structures */
735 /* Search all tables for the target type */
737 for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++)
739 if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
740 AcpiGbl_TableData[i].SigLength))
742 /* Found the table, unload it */
744 Status = AcpiUnloadTable (i);
745 if (ACPI_SUCCESS (Status))
747 AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg);
751 AcpiOsPrintf ("%s, while unloading [%s]\n",
752 AcpiFormatException (Status), TableArg);
759 AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);
764 /*******************************************************************************
766 * FUNCTION: AcpiDbSetMethodBreakpoint
768 * PARAMETERS: Location - AML offset of breakpoint
769 * WalkState - Current walk info
770 * Op - Current Op (from parse walk)
774 * DESCRIPTION: Set a breakpoint in a control method at the specified
777 ******************************************************************************/
780 AcpiDbSetMethodBreakpoint (
782 ACPI_WALK_STATE *WalkState,
783 ACPI_PARSE_OBJECT *Op)
790 AcpiOsPrintf ("There is no method currently executing\n");
794 /* Get and verify the breakpoint address */
796 Address = ACPI_STRTOUL (Location, NULL, 16);
797 if (Address <= Op->Common.AmlOffset)
799 AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
800 Address, Op->Common.AmlOffset);
803 /* Save breakpoint in current walk */
805 WalkState->UserBreakpoint = Address;
806 AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
810 /*******************************************************************************
812 * FUNCTION: AcpiDbSetMethodCallBreakpoint
814 * PARAMETERS: Op - Current Op (from parse walk)
818 * DESCRIPTION: Set a breakpoint in a control method at the specified
821 ******************************************************************************/
824 AcpiDbSetMethodCallBreakpoint (
825 ACPI_PARSE_OBJECT *Op)
831 AcpiOsPrintf ("There is no method currently executing\n");
835 AcpiGbl_StepToNextCall = TRUE;
839 /*******************************************************************************
841 * FUNCTION: AcpiDbDisassembleAml
843 * PARAMETERS: Statements - Number of statements to disassemble
844 * Op - Current Op (from parse walk)
848 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
849 * of statements specified.
851 ******************************************************************************/
854 AcpiDbDisassembleAml (
856 ACPI_PARSE_OBJECT *Op)
858 UINT32 NumStatements = 8;
863 AcpiOsPrintf ("There is no method currently executing\n");
869 NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
872 #ifdef ACPI_DISASSEMBLER
873 AcpiDmDisassemble (NULL, Op, NumStatements);
878 /*******************************************************************************
880 * FUNCTION: AcpiDbDisassembleMethod
882 * PARAMETERS: Name - Name of control method
886 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
887 * of statements specified.
889 ******************************************************************************/
892 AcpiDbDisassembleMethod (
896 ACPI_PARSE_OBJECT *Op;
897 ACPI_WALK_STATE *WalkState;
898 ACPI_OPERAND_OBJECT *ObjDesc;
899 ACPI_NAMESPACE_NODE *Method;
902 Method = AcpiDbConvertToNode (Name);
905 return (AE_BAD_PARAMETER);
908 ObjDesc = Method->Object;
910 Op = AcpiPsCreateScopeOp ();
913 return (AE_NO_MEMORY);
916 /* Create and initialize a new walk state */
918 WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL);
921 return (AE_NO_MEMORY);
924 Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
925 ObjDesc->Method.AmlStart,
926 ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
927 if (ACPI_FAILURE (Status))
934 WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
935 WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
936 Status = AcpiPsParseAml (WalkState);
938 #ifdef ACPI_DISASSEMBLER
939 AcpiDmDisassemble (NULL, Op, 0);
941 AcpiPsDeleteParseTree (Op);
946 /*******************************************************************************
948 * FUNCTION: AcpiDbDumpNamespace
950 * PARAMETERS: StartArg - Node to begin namespace dump
951 * DepthArg - Maximum tree depth to be dumped
955 * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
956 * with type and other information.
958 ******************************************************************************/
961 AcpiDbDumpNamespace (
965 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
966 UINT32 MaxDepth = ACPI_UINT32_MAX;
969 /* No argument given, just start at the root and dump entire namespace */
973 SubtreeEntry = AcpiDbConvertToNode (StartArg);
979 /* Now we can check for the depth argument */
983 MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
987 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
988 AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
989 ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
991 /* Display the subtree */
993 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
994 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
995 ACPI_OWNER_ID_MAX, SubtreeEntry);
996 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1000 /*******************************************************************************
1002 * FUNCTION: AcpiDbDumpNamespaceByOwner
1004 * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
1005 * DepthArg - Maximum tree depth to be dumped
1009 * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
1011 ******************************************************************************/
1014 AcpiDbDumpNamespaceByOwner (
1018 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
1019 UINT32 MaxDepth = ACPI_UINT32_MAX;
1020 ACPI_OWNER_ID OwnerId;
1023 OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
1025 /* Now we can check for the depth argument */
1029 MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
1032 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
1033 AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
1035 /* Display the subtree */
1037 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1038 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
1040 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1044 /*******************************************************************************
1046 * FUNCTION: AcpiDbSendNotify
1048 * PARAMETERS: Name - Name of ACPI object to send the notify to
1049 * Value - Value of the notify to send.
1053 * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
1054 * named object as an ACPI notify.
1056 ******************************************************************************/
1063 ACPI_NAMESPACE_NODE *Node;
1067 /* Translate name to an Named object */
1069 Node = AcpiDbConvertToNode (Name);
1075 /* Decode Named object type */
1079 case ACPI_TYPE_DEVICE:
1080 case ACPI_TYPE_THERMAL:
1082 /* Send the notify */
1084 Status = AcpiEvQueueNotifyRequest (Node, Value);
1085 if (ACPI_FAILURE (Status))
1087 AcpiOsPrintf ("Could not queue notify\n");
1092 AcpiOsPrintf ("Named object is not a device or a thermal object\n");
1098 /*******************************************************************************
1100 * FUNCTION: AcpiDbSetMethodData
1102 * PARAMETERS: TypeArg - L for local, A for argument
1103 * IndexArg - which one
1104 * ValueArg - Value to set.
1108 * DESCRIPTION: Set a local or argument for the running control method.
1109 * NOTE: only object supported is Number.
1111 ******************************************************************************/
1114 AcpiDbSetMethodData (
1122 ACPI_WALK_STATE *WalkState;
1123 ACPI_OPERAND_OBJECT *ObjDesc;
1125 ACPI_NAMESPACE_NODE *Node;
1128 /* Validate TypeArg */
1130 AcpiUtStrupr (TypeArg);
1132 if ((Type != 'L') &&
1136 AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
1140 Value = ACPI_STRTOUL (ValueArg, NULL, 16);
1144 Node = AcpiDbConvertToNode (IndexArg);
1145 if (Node->Type != ACPI_TYPE_INTEGER)
1147 AcpiOsPrintf ("Can only set Integer nodes\n");
1150 ObjDesc = Node->Object;
1151 ObjDesc->Integer.Value = Value;
1155 /* Get the index and value */
1157 Index = ACPI_STRTOUL (IndexArg, NULL, 16);
1159 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
1162 AcpiOsPrintf ("There is no method currently executing\n");
1166 /* Create and initialize the new object */
1168 ObjDesc = AcpiUtCreateIntegerObject ((UINT64) Value);
1171 AcpiOsPrintf ("Could not create an internal object\n");
1175 /* Store the new object into the target */
1181 /* Set a method argument */
1183 if (Index > ACPI_METHOD_MAX_ARG)
1185 AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index);
1189 Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc,
1191 if (ACPI_FAILURE (Status))
1196 ObjDesc = WalkState->Arguments[Index].Object;
1198 AcpiOsPrintf ("Arg%d: ", Index);
1199 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
1204 /* Set a method local */
1206 if (Index > ACPI_METHOD_MAX_LOCAL)
1208 AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index);
1212 Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc,
1214 if (ACPI_FAILURE (Status))
1219 ObjDesc = WalkState->LocalVariables[Index].Object;
1221 AcpiOsPrintf ("Local%d: ", Index);
1222 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
1230 AcpiUtRemoveReference (ObjDesc);
1234 /*******************************************************************************
1236 * FUNCTION: AcpiDbWalkForSpecificObjects
1238 * PARAMETERS: Callback from WalkNamespace
1242 * DESCRIPTION: Display short info about objects in the namespace
1244 ******************************************************************************/
1247 AcpiDbWalkForSpecificObjects (
1248 ACPI_HANDLE ObjHandle,
1249 UINT32 NestingLevel,
1253 ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
1260 /* Get and display the full pathname to this object */
1262 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1263 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
1264 if (ACPI_FAILURE (Status))
1266 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
1270 AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
1271 ACPI_FREE (Buffer.Pointer);
1273 /* Dump short info about the object */
1275 (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
1280 /*******************************************************************************
1282 * FUNCTION: AcpiDbDisplayObjects
1284 * PARAMETERS: ObjTypeArg - Type of object to display
1285 * DisplayCountArg - Max depth to display
1289 * DESCRIPTION: Display objects in the namespace of the requested type
1291 ******************************************************************************/
1294 AcpiDbDisplayObjects (
1296 char *DisplayCountArg)
1298 ACPI_WALK_INFO Info;
1299 ACPI_OBJECT_TYPE Type;
1302 /* Get the object type */
1304 Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
1305 if (Type == ACPI_TYPE_NOT_FOUND)
1307 AcpiOsPrintf ("Invalid or unsupported argument\n");
1311 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
1313 "Objects of type [%s] defined in the current ACPI Namespace:\n",
1314 AcpiUtGetTypeName (Type));
1316 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1319 Info.OwnerId = ACPI_OWNER_ID_MAX;
1320 Info.DebugLevel = ACPI_UINT32_MAX;
1321 Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
1323 /* Walk the namespace from the root */
1325 (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
1326 AcpiDbWalkForSpecificObjects, NULL, (void *) &Info, NULL);
1329 "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
1330 Info.Count, AcpiUtGetTypeName (Type));
1332 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1337 /*******************************************************************************
1339 * FUNCTION: AcpiDbWalkAndMatchName
1341 * PARAMETERS: Callback from WalkNamespace
1345 * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
1346 * are supported -- '?' matches any character.
1348 ******************************************************************************/
1351 AcpiDbWalkAndMatchName (
1352 ACPI_HANDLE ObjHandle,
1353 UINT32 NestingLevel,
1358 char *RequestedName = (char *) Context;
1361 ACPI_WALK_INFO Info;
1364 /* Check for a name match */
1366 for (i = 0; i < 4; i++)
1368 /* Wildcard support */
1370 if ((RequestedName[i] != '?') &&
1371 (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
1373 /* No match, just exit */
1379 /* Get the full pathname to this object */
1381 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1382 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
1383 if (ACPI_FAILURE (Status))
1385 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
1389 Info.OwnerId = ACPI_OWNER_ID_MAX;
1390 Info.DebugLevel = ACPI_UINT32_MAX;
1391 Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
1393 AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
1394 (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
1395 ACPI_FREE (Buffer.Pointer);
1402 /*******************************************************************************
1404 * FUNCTION: AcpiDbFindNameInNamespace
1406 * PARAMETERS: NameArg - The 4-character ACPI name to find.
1407 * wildcards are supported.
1411 * DESCRIPTION: Search the namespace for a given name (with wildcards)
1413 ******************************************************************************/
1416 AcpiDbFindNameInNamespace (
1419 char AcpiName[5] = "____";
1420 char *AcpiNamePtr = AcpiName;
1423 if (ACPI_STRLEN (NameArg) > 4)
1425 AcpiOsPrintf ("Name must be no longer than 4 characters\n");
1429 /* Pad out name with underscores as necessary to create a 4-char name */
1431 AcpiUtStrupr (NameArg);
1434 *AcpiNamePtr = *NameArg;
1439 /* Walk the namespace from the root */
1441 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
1442 AcpiDbWalkAndMatchName, NULL, AcpiName, NULL);
1444 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1449 /*******************************************************************************
1451 * FUNCTION: AcpiDbSetScope
1453 * PARAMETERS: Name - New scope path
1457 * DESCRIPTION: Set the "current scope" as maintained by this utility.
1458 * The scope is used as a prefix to ACPI paths.
1460 ******************************************************************************/
1467 ACPI_NAMESPACE_NODE *Node;
1470 if (!Name || Name[0] == 0)
1472 AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
1476 AcpiDbPrepNamestring (Name);
1478 if (Name[0] == '\\')
1480 /* Validate new scope from the root */
1482 Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
1484 if (ACPI_FAILURE (Status))
1489 ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
1490 ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
1494 /* Validate new scope relative to old scope */
1496 Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
1498 if (ACPI_FAILURE (Status))
1503 ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
1504 ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
1507 AcpiGbl_DbScopeNode = Node;
1508 AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
1513 AcpiOsPrintf ("Could not attach scope: %s, %s\n",
1514 Name, AcpiFormatException (Status));
1518 /*******************************************************************************
1520 * FUNCTION: AcpiDmCompareAmlResources
1522 * PARAMETERS: Aml1Buffer - Contains first resource list
1523 * Aml1BufferLength - Length of first resource list
1524 * Aml2Buffer - Contains second resource list
1525 * Aml2BufferLength - Length of second resource list
1529 * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in
1530 * order to isolate a miscompare to an individual resource)
1532 ******************************************************************************/
1535 AcpiDmCompareAmlResources (
1537 ACPI_RSDESC_SIZE Aml1BufferLength,
1539 ACPI_RSDESC_SIZE Aml2BufferLength)
1543 ACPI_RSDESC_SIZE Aml1Length;
1544 ACPI_RSDESC_SIZE Aml2Length;
1545 ACPI_RSDESC_SIZE Offset = 0;
1550 /* Compare overall buffer sizes (may be different due to size rounding) */
1552 if (Aml1BufferLength != Aml2BufferLength)
1555 "**** Buffer length mismatch in converted AML: original %X new %X ****\n",
1556 Aml1BufferLength, Aml2BufferLength);
1562 /* Walk the descriptor lists, comparing each descriptor */
1564 while (Aml1 < (Aml1Buffer + Aml1BufferLength))
1566 /* Get the lengths of each descriptor */
1568 Aml1Length = AcpiUtGetDescriptorLength (Aml1);
1569 Aml2Length = AcpiUtGetDescriptorLength (Aml2);
1570 ResourceType = AcpiUtGetResourceType (Aml1);
1572 /* Check for descriptor length match */
1574 if (Aml1Length != Aml2Length)
1577 "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n",
1578 Count, ResourceType, Offset, Aml1Length, Aml2Length);
1581 /* Check for descriptor byte match */
1583 else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length))
1586 "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
1587 Count, ResourceType, Offset);
1590 /* Exit on EndTag descriptor */
1592 if (ResourceType == ACPI_RESOURCE_NAME_END_TAG)
1597 /* Point to next descriptor in each buffer */
1600 Offset += Aml1Length;
1607 /*******************************************************************************
1609 * FUNCTION: AcpiDmTestResourceConversion
1611 * PARAMETERS: Node - Parent device node
1612 * Name - resource method name (_CRS)
1616 * DESCRIPTION: Compare the original AML with a conversion of the AML to
1617 * internal resource list, then back to AML.
1619 ******************************************************************************/
1622 AcpiDmTestResourceConversion (
1623 ACPI_NAMESPACE_NODE *Node,
1627 ACPI_BUFFER ReturnObj;
1628 ACPI_BUFFER ResourceObj;
1630 ACPI_OBJECT *OriginalAml;
1633 AcpiOsPrintf ("Resource Conversion Comparison:\n");
1635 NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1636 ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1637 ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
1639 /* Get the original _CRS AML resource template */
1641 Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj);
1642 if (ACPI_FAILURE (Status))
1644 AcpiOsPrintf ("Could not obtain %s: %s\n",
1645 Name, AcpiFormatException (Status));
1649 /* Get the AML resource template, converted to internal resource structs */
1651 Status = AcpiGetCurrentResources (Node, &ResourceObj);
1652 if (ACPI_FAILURE (Status))
1654 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
1655 AcpiFormatException (Status));
1659 /* Convert internal resource list to external AML resource template */
1661 Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml);
1662 if (ACPI_FAILURE (Status))
1664 AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n",
1665 AcpiFormatException (Status));
1669 /* Compare original AML to the newly created AML resource list */
1671 OriginalAml = ReturnObj.Pointer;
1673 AcpiDmCompareAmlResources (
1674 OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length,
1675 NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length);
1677 /* Cleanup and exit */
1679 ACPI_FREE (NewAml.Pointer);
1681 ACPI_FREE (ResourceObj.Pointer);
1683 ACPI_FREE (ReturnObj.Pointer);
1688 /*******************************************************************************
1690 * FUNCTION: AcpiDbDisplayResources
1692 * PARAMETERS: ObjectArg - String with hex value of the object
1696 * DESCRIPTION: Display the resource objects associated with a device.
1698 ******************************************************************************/
1701 AcpiDbDisplayResources (
1704 ACPI_NAMESPACE_NODE *Node;
1706 ACPI_BUFFER ReturnObj;
1709 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1710 AcpiDbgLevel |= ACPI_LV_RESOURCES;
1712 /* Convert string to object pointer */
1714 Node = AcpiDbConvertToNode (ObjectArg);
1720 /* Prepare for a return object of arbitrary size */
1722 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1723 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1727 AcpiOsPrintf ("Evaluating _PRT\n");
1729 /* Check if _PRT exists */
1731 Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj);
1732 if (ACPI_FAILURE (Status))
1734 AcpiOsPrintf ("Could not obtain _PRT: %s\n",
1735 AcpiFormatException (Status));
1739 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1740 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1742 Status = AcpiGetIrqRoutingTable (Node, &ReturnObj);
1743 if (ACPI_FAILURE (Status))
1745 AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
1746 AcpiFormatException (Status));
1750 AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
1756 AcpiOsPrintf ("Evaluating _CRS\n");
1758 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1759 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1761 /* Check if _CRS exists */
1763 Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj);
1764 if (ACPI_FAILURE (Status))
1766 AcpiOsPrintf ("Could not obtain _CRS: %s\n",
1767 AcpiFormatException (Status));
1771 /* Get the _CRS resource list */
1773 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1774 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1776 Status = AcpiGetCurrentResources (Node, &ReturnObj);
1777 if (ACPI_FAILURE (Status))
1779 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
1780 AcpiFormatException (Status));
1784 /* Dump the _CRS resource list */
1786 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
1787 ReturnObj.Pointer));
1790 * Perform comparison of original AML to newly created AML. This tests both
1791 * the AML->Resource conversion and the Resource->Aml conversion.
1793 Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
1795 /* Execute _SRS with the resource list */
1797 Status = AcpiSetCurrentResources (Node, &ReturnObj);
1798 if (ACPI_FAILURE (Status))
1800 AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
1801 AcpiFormatException (Status));
1809 AcpiOsPrintf ("Evaluating _PRS\n");
1811 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1812 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1814 /* Check if _PRS exists */
1816 Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj);
1817 if (ACPI_FAILURE (Status))
1819 AcpiOsPrintf ("Could not obtain _PRS: %s\n",
1820 AcpiFormatException (Status));
1824 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1825 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1827 Status = AcpiGetPossibleResources (Node, &ReturnObj);
1828 if (ACPI_FAILURE (Status))
1830 AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
1831 AcpiFormatException (Status));
1835 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
1839 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1844 /*******************************************************************************
1846 * FUNCTION: AcpiDbIntegrityWalk
1848 * PARAMETERS: Callback from WalkNamespace
1852 * DESCRIPTION: Examine one NS node for valid values.
1854 ******************************************************************************/
1857 AcpiDbIntegrityWalk (
1858 ACPI_HANDLE ObjHandle,
1859 UINT32 NestingLevel,
1863 ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
1864 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
1865 ACPI_OPERAND_OBJECT *Object;
1866 BOOLEAN Alias = TRUE;
1871 /* Verify the NS node, and dereference aliases */
1875 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
1877 AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
1878 Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node),
1879 ACPI_DESC_TYPE_NAMED);
1883 if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) ||
1884 (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
1886 Node = (ACPI_NAMESPACE_NODE *) Node->Object;
1894 if (Node->Type > ACPI_TYPE_LOCAL_MAX)
1896 AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
1901 if (!AcpiUtValidAcpiName (Node->Name.Integer))
1903 AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
1907 Object = AcpiNsGetAttachedObject (Node);
1911 if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
1913 AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
1914 Object, AcpiUtGetDescriptorName (Object));
1922 /*******************************************************************************
1924 * FUNCTION: AcpiDbCheckIntegrity
1930 * DESCRIPTION: Check entire namespace for data structure integrity
1932 ******************************************************************************/
1935 AcpiDbCheckIntegrity (
1938 ACPI_INTEGRITY_INFO Info = {0,0};
1940 /* Search all nodes in namespace */
1942 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
1943 AcpiDbIntegrityWalk, NULL, (void *) &Info, NULL);
1945 AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n",
1946 Info.Nodes, Info.Objects);
1950 /*******************************************************************************
1952 * FUNCTION: AcpiDbGenerateGpe
1954 * PARAMETERS: GpeArg - Raw GPE number, ascii string
1955 * BlockArg - GPE block number, ascii string
1956 * 0 or 1 for FADT GPE blocks
1960 * DESCRIPTION: Generate a GPE
1962 ******************************************************************************/
1971 ACPI_GPE_EVENT_INFO *GpeEventInfo;
1974 GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0);
1975 BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
1978 GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber),
1982 AcpiOsPrintf ("Invalid GPE\n");
1986 (void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
1990 /*******************************************************************************
1992 * FUNCTION: AcpiDbBusWalk
1994 * PARAMETERS: Callback from WalkNamespace
1998 * DESCRIPTION: Display info about device objects that have a corresponding
2001 ******************************************************************************/
2005 ACPI_HANDLE ObjHandle,
2006 UINT32 NestingLevel,
2010 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
2013 ACPI_NAMESPACE_NODE *TempNode;
2014 ACPI_DEVICE_INFO *Info;
2018 if ((Node->Type != ACPI_TYPE_DEVICE) &&
2019 (Node->Type != ACPI_TYPE_PROCESSOR))
2024 /* Exit if there is no _PRT under this device */
2026 Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
2027 ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
2028 if (ACPI_FAILURE (Status))
2033 /* Get the full path to this device object */
2035 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
2036 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
2037 if (ACPI_FAILURE (Status))
2039 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
2043 Status = AcpiGetObjectInfo (ObjHandle, &Info);
2044 if (ACPI_FAILURE (Status))
2049 /* Display the full path */
2051 AcpiOsPrintf ("%-32s Type %X", (char *) Buffer.Pointer, Node->Type);
2052 ACPI_FREE (Buffer.Pointer);
2054 if (Info->Flags & ACPI_PCI_ROOT_BRIDGE)
2056 AcpiOsPrintf (" - Is PCI Root Bridge");
2058 AcpiOsPrintf ("\n");
2062 AcpiOsPrintf ("_PRT: %p\n", TempNode);
2064 /* Dump _ADR, _HID, _UID, _CID */
2066 if (Info->Valid & ACPI_VALID_ADR)
2068 AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info->Address));
2072 AcpiOsPrintf ("_ADR: <Not Present>\n");
2075 if (Info->Valid & ACPI_VALID_HID)
2077 AcpiOsPrintf ("_HID: %s\n", Info->HardwareId.String);
2081 AcpiOsPrintf ("_HID: <Not Present>\n");
2084 if (Info->Valid & ACPI_VALID_UID)
2086 AcpiOsPrintf ("_UID: %s\n", Info->UniqueId.String);
2090 AcpiOsPrintf ("_UID: <Not Present>\n");
2093 if (Info->Valid & ACPI_VALID_CID)
2095 for (i = 0; i < Info->CompatibleIdList.Count; i++)
2097 AcpiOsPrintf ("_CID: %s\n",
2098 Info->CompatibleIdList.Ids[i].String);
2103 AcpiOsPrintf ("_CID: <Not Present>\n");
2111 /*******************************************************************************
2113 * FUNCTION: AcpiDbGetBusInfo
2119 * DESCRIPTION: Display info about system busses.
2121 ******************************************************************************/
2127 /* Search all nodes in namespace */
2129 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
2130 AcpiDbBusWalk, NULL, NULL, NULL);
2133 #endif /* ACPI_DEBUGGER */