1 /*******************************************************************************
3 * Module Name: dbcmds - debug commands and output routines
6 ******************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * 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 *****************************************************************************/
119 #include "acdispat.h"
121 #include "acnamesp.h"
122 #include "acevents.h"
125 #include "acdisasm.h"
129 #define _COMPONENT ACPI_CA_DEBUGGER
130 ACPI_MODULE_NAME ("dbcmds")
134 * Arguments for the Objects command
135 * These object types map directly to the ACPI_TYPES
138 static ARGUMENT_INFO AcpiDbObjectTypes [] =
156 {NULL} /* Must be null terminated */
164 #if ACPI_MACHINE_WIDTH == 16
171 SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0);
173 AcpiOsPrintf ("**** Prepare to sleep ****\n");
174 Status = AcpiEnterSleepStatePrep (SleepState);
175 if (ACPI_FAILURE (Status))
180 AcpiOsPrintf ("**** Going to sleep ****\n");
181 Status = AcpiEnterSleepState (SleepState);
182 if (ACPI_FAILURE (Status))
187 AcpiOsPrintf ("**** returning from sleep ****\n");
188 Status = AcpiLeaveSleepState (SleepState);
195 /*******************************************************************************
197 * FUNCTION: AcpiDbWalkForReferences
199 * PARAMETERS: Callback from WalkNamespace
203 * DESCRIPTION: Check if this namespace object refers to the target object
204 * that is passed in as the context value.
206 * Note: Currently doesn't check subobjects within the Node's object
208 ******************************************************************************/
211 AcpiDbWalkForReferences (
212 ACPI_HANDLE ObjHandle,
217 ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context;
218 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
221 /* Check for match against the namespace node itself */
223 if (Node == (void *) ObjDesc)
225 AcpiOsPrintf ("Object is a Node [%4.4s]\n",
226 AcpiUtGetNodeName (Node));
229 /* Check for match against the object attached to the node */
231 if (AcpiNsGetAttachedObject (Node) == ObjDesc)
233 AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
234 Node, AcpiUtGetNodeName (Node));
241 /*******************************************************************************
243 * FUNCTION: AcpiDbFindReferences
245 * PARAMETERS: ObjectArg - String with hex value of the object
249 * DESCRIPTION: Search namespace for all references to the input object
251 ******************************************************************************/
254 AcpiDbFindReferences (
257 ACPI_OPERAND_OBJECT *ObjDesc;
260 /* Convert string to object pointer */
262 ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
264 /* Search all nodes in namespace */
266 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
267 AcpiDbWalkForReferences, (void *) ObjDesc, NULL);
271 /*******************************************************************************
273 * FUNCTION: AcpiDbDisplayLocks
279 * DESCRIPTION: Display information about internal mutexes.
281 ******************************************************************************/
284 AcpiDbDisplayLocks (void)
289 for (i = 0; i < MAX_MUTEX; i++)
291 AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
292 AcpiGbl_MutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED
293 ? "Locked" : "Unlocked");
298 /*******************************************************************************
300 * FUNCTION: AcpiDbDisplayTableInfo
302 * PARAMETERS: TableArg - String with name of table to be displayed
306 * DESCRIPTION: Display information about loaded tables. Current
307 * implementation displays all loaded tables.
309 ******************************************************************************/
312 AcpiDbDisplayTableInfo (
316 ACPI_TABLE_DESC *TableDesc;
319 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
321 TableDesc = AcpiGbl_TableLists[i].Next;
324 AcpiOsPrintf ( "%s at %p length %.5X",
325 AcpiGbl_TableData[i].Name, TableDesc->Pointer,
326 (UINT32) TableDesc->Length);
328 if (i != ACPI_TABLE_FACS)
330 AcpiOsPrintf (" OemID=%6s TableId=%8s OemRevision=%8.8X",
331 TableDesc->Pointer->OemId,
332 TableDesc->Pointer->OemTableId,
333 TableDesc->Pointer->OemRevision);
337 TableDesc = TableDesc->Next;
343 /*******************************************************************************
345 * FUNCTION: AcpiDbUnloadAcpiTable
347 * PARAMETERS: TableArg - Name of the table to be unloaded
348 * InstanceArg - Which instance of the table to unload (if
349 * there are multiple tables of the same type)
353 * DESCRIPTION: Unload an ACPI table.
354 * Instance is not implemented
356 ******************************************************************************/
359 AcpiDbUnloadAcpiTable (
367 /* Search all tables for the target type */
369 for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
371 if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
372 AcpiGbl_TableData[i].SigLength))
374 /* Found the table, unload it */
376 Status = AcpiUnloadTable (i);
377 if (ACPI_SUCCESS (Status))
379 AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg);
383 AcpiOsPrintf ("%s, while unloading [%s]\n",
384 AcpiFormatException (Status), TableArg);
391 AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);
395 /*******************************************************************************
397 * FUNCTION: AcpiDbSetMethodBreakpoint
399 * PARAMETERS: Location - AML offset of breakpoint
400 * WalkState - Current walk info
401 * Op - Current Op (from parse walk)
405 * DESCRIPTION: Set a breakpoint in a control method at the specified
408 ******************************************************************************/
411 AcpiDbSetMethodBreakpoint (
413 ACPI_WALK_STATE *WalkState,
414 ACPI_PARSE_OBJECT *Op)
421 AcpiOsPrintf ("There is no method currently executing\n");
425 /* Get and verify the breakpoint address */
427 Address = ACPI_STRTOUL (Location, NULL, 16);
428 if (Address <= Op->Common.AmlOffset)
430 AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->Common.AmlOffset);
433 /* Save breakpoint in current walk */
435 WalkState->UserBreakpoint = Address;
436 AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address);
440 /*******************************************************************************
442 * FUNCTION: AcpiDbSetMethodCallBreakpoint
444 * PARAMETERS: Op - Current Op (from parse walk)
448 * DESCRIPTION: Set a breakpoint in a control method at the specified
451 ******************************************************************************/
454 AcpiDbSetMethodCallBreakpoint (
455 ACPI_PARSE_OBJECT *Op)
461 AcpiOsPrintf ("There is no method currently executing\n");
465 AcpiGbl_StepToNextCall = TRUE;
469 /*******************************************************************************
471 * FUNCTION: AcpiDbDisassembleAml
473 * PARAMETERS: Statements - Number of statements to disassemble
474 * Op - Current Op (from parse walk)
478 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
479 * of statements specified.
481 ******************************************************************************/
484 AcpiDbDisassembleAml (
486 ACPI_PARSE_OBJECT *Op)
488 UINT32 NumStatements = 8;
493 AcpiOsPrintf ("There is no method currently executing\n");
499 NumStatements = ACPI_STRTOUL (Statements, NULL, 0);
502 AcpiDmDisassemble (NULL, Op, NumStatements);
506 /*******************************************************************************
508 * FUNCTION: AcpiDbDumpNamespace
510 * PARAMETERS: StartArg - Node to begin namespace dump
511 * DepthArg - Maximum tree depth to be dumped
515 * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
516 * with type and other information.
518 ******************************************************************************/
521 AcpiDbDumpNamespace (
525 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
526 UINT32 MaxDepth = ACPI_UINT32_MAX;
529 /* No argument given, just start at the root and dump entire namespace */
533 /* Check if numeric argument, must be a Node */
535 if ((StartArg[0] >= 0x30) && (StartArg[0] <= 0x39))
537 SubtreeEntry = ACPI_TO_POINTER (ACPI_STRTOUL (StartArg, NULL, 16));
538 if (!AcpiOsReadable (SubtreeEntry, sizeof (ACPI_NAMESPACE_NODE)))
540 AcpiOsPrintf ("Address %p is invalid in this address space\n", SubtreeEntry);
544 if (ACPI_GET_DESCRIPTOR_TYPE (SubtreeEntry) != ACPI_DESC_TYPE_NAMED)
546 AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
547 SubtreeEntry, AcpiUtGetDescriptorName (SubtreeEntry));
554 /* The parameter is a name string that must be resolved to a Named obj*/
556 SubtreeEntry = AcpiDbLocalNsLookup (StartArg);
559 SubtreeEntry = AcpiGbl_RootNode;
563 /* Now we can check for the depth argument */
567 MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
571 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
572 AcpiOsPrintf ("ACPI Namespace (from %p subtree):\n", SubtreeEntry);
574 /* Display the subtree */
576 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
577 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, ACPI_UINT32_MAX, SubtreeEntry);
578 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
582 /*******************************************************************************
584 * FUNCTION: AcpiDbDumpNamespaceByOwner
586 * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
587 * DepthArg - Maximum tree depth to be dumped
591 * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
593 ******************************************************************************/
596 AcpiDbDumpNamespaceByOwner (
600 ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
601 UINT32 MaxDepth = ACPI_UINT32_MAX;
605 OwnerId = (UINT16) ACPI_STRTOUL (OwnerArg, NULL, 0);
607 /* Now we can check for the depth argument */
611 MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0);
614 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
615 AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId);
617 /* Display the subtree */
619 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
620 AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, SubtreeEntry);
621 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
625 /*******************************************************************************
627 * FUNCTION: AcpiDbSendNotify
629 * PARAMETERS: Name - Name of ACPI object to send the notify to
630 * Value - Value of the notify to send.
634 * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
635 * named object as an ACPI notify.
637 ******************************************************************************/
644 ACPI_NAMESPACE_NODE *Node;
648 /* Translate name to an Named object */
650 Node = AcpiDbLocalNsLookup (Name);
656 /* Decode Named object type */
660 case ACPI_TYPE_DEVICE:
661 case ACPI_TYPE_THERMAL:
663 /* Send the notify */
665 Status = AcpiEvQueueNotifyRequest (Node, Value);
666 if (ACPI_FAILURE (Status))
668 AcpiOsPrintf ("Could not queue notify\n");
673 AcpiOsPrintf ("Named object is not a device or a thermal object\n");
679 /*******************************************************************************
681 * FUNCTION: AcpiDbSetMethodData
683 * PARAMETERS: TypeArg - L for local, A for argument
684 * IndexArg - which one
685 * ValueArg - Value to set.
689 * DESCRIPTION: Set a local or argument for the running control method.
690 * NOTE: only object supported is Number.
692 ******************************************************************************/
695 AcpiDbSetMethodData (
703 ACPI_WALK_STATE *WalkState;
704 ACPI_OPERAND_OBJECT *ObjDesc;
708 /* Validate TypeArg */
710 ACPI_STRUPR (TypeArg);
715 AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
719 /* Get the index and value */
721 Index = ACPI_STRTOUL (IndexArg, NULL, 16);
722 Value = ACPI_STRTOUL (ValueArg, NULL, 16);
724 WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
727 AcpiOsPrintf ("There is no method currently executing\n");
731 /* Create and initialize the new object */
733 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
736 AcpiOsPrintf ("Could not create an internal object\n");
740 ObjDesc->Integer.Value = Value;
742 /* Store the new object into the target */
748 /* Set a method argument */
750 if (Index > ACPI_METHOD_MAX_ARG)
752 AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index);
756 Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState);
757 if (ACPI_FAILURE (Status))
762 ObjDesc = WalkState->Arguments[Index].Object;
764 AcpiOsPrintf ("Arg%d: ", Index);
765 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
770 /* Set a method local */
772 if (Index > ACPI_METHOD_MAX_LOCAL)
774 AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index);
778 Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState);
779 if (ACPI_FAILURE (Status))
784 ObjDesc = WalkState->LocalVariables[Index].Object;
786 AcpiOsPrintf ("Local%d: ", Index);
787 AcpiDmDisplayInternalObject (ObjDesc, WalkState);
796 /*******************************************************************************
798 * FUNCTION: AcpiDbWalkForSpecificObjects
800 * PARAMETERS: Callback from WalkNamespace
804 * DESCRIPTION: Display short info about objects in the namespace
806 ******************************************************************************/
809 AcpiDbWalkForSpecificObjects (
810 ACPI_HANDLE ObjHandle,
815 ACPI_OPERAND_OBJECT *ObjDesc;
820 ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle);
822 /* Get and display the full pathname to this object */
824 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
825 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
826 if (ACPI_FAILURE (Status))
828 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
832 AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
833 ACPI_MEM_FREE (Buffer.Pointer);
835 /* Display short information about the object */
839 switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
841 case ACPI_TYPE_METHOD:
842 AcpiOsPrintf (" #Args %d Concurrency %X",
843 ObjDesc->Method.ParamCount, ObjDesc->Method.Concurrency);
846 case ACPI_TYPE_INTEGER:
847 AcpiOsPrintf (" Value %8.8X%8.8X",
848 ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
851 case ACPI_TYPE_STRING:
852 AcpiOsPrintf (" \"%s\"", ObjDesc->String.Pointer);
855 case ACPI_TYPE_REGION:
856 AcpiOsPrintf (" SpaceId %X Length %X Address %8.8X%8.8X",
857 ObjDesc->Region.SpaceId,
858 ObjDesc->Region.Length,
859 ACPI_FORMAT_UINT64 (ObjDesc->Region.Address));
862 case ACPI_TYPE_PACKAGE:
863 AcpiOsPrintf (" #Elements %X", ObjDesc->Package.Count);
866 case ACPI_TYPE_BUFFER:
867 AcpiOsPrintf (" Length %X", ObjDesc->Buffer.Length);
871 /* Ignore other object types */
881 /*******************************************************************************
883 * FUNCTION: AcpiDbDisplayObjects
885 * PARAMETERS: ObjTypeArg - Type of object to display
886 * DisplayCountArg - Max depth to display
890 * DESCRIPTION: Display objects in the namespace of the requested type
892 ******************************************************************************/
895 AcpiDbDisplayObjects (
897 char *DisplayCountArg)
899 ACPI_OBJECT_TYPE Type;
902 /* Get the object type */
904 Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes);
905 if (Type == ACPI_TYPE_NOT_FOUND)
907 AcpiOsPrintf ("Invalid or unsupported argument\n");
911 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
912 AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n",
913 AcpiUtGetTypeName (Type));
915 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
917 /* Walk the namespace from the root */
919 (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
920 AcpiDbWalkForSpecificObjects, (void *) &Type, NULL);
922 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
927 /*******************************************************************************
929 * FUNCTION: AcpiDbWalkAndMatchName
931 * PARAMETERS: Callback from WalkNamespace
935 * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
936 * are supported -- '?' matches any character.
938 ******************************************************************************/
941 AcpiDbWalkAndMatchName (
942 ACPI_HANDLE ObjHandle,
948 char *RequestedName = (char *) Context;
953 /* Check for a name match */
955 for (i = 0; i < 4; i++)
957 /* Wildcard support */
959 if ((RequestedName[i] != '?') &&
960 (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i]))
962 /* No match, just exit */
968 /* Get the full pathname to this object */
970 Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
971 Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
972 if (ACPI_FAILURE (Status))
974 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
978 AcpiOsPrintf ("%32s (%p) - %s\n", (char *) Buffer.Pointer, ObjHandle,
979 AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type));
980 ACPI_MEM_FREE (Buffer.Pointer);
987 /*******************************************************************************
989 * FUNCTION: AcpiDbFindNameInNamespace
991 * PARAMETERS: NameArg - The 4-character ACPI name to find.
992 * wildcards are supported.
996 * DESCRIPTION: Search the namespace for a given name (with wildcards)
998 ******************************************************************************/
1001 AcpiDbFindNameInNamespace (
1005 if (ACPI_STRLEN (NameArg) > 4)
1007 AcpiOsPrintf ("Name must be no longer than 4 characters\n");
1011 /* Walk the namespace from the root */
1013 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
1014 AcpiDbWalkAndMatchName, NameArg, NULL);
1016 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1021 /*******************************************************************************
1023 * FUNCTION: AcpiDbSetScope
1025 * PARAMETERS: Name - New scope path
1029 * DESCRIPTION: Set the "current scope" as maintained by this utility.
1030 * The scope is used as a prefix to ACPI paths.
1032 ******************************************************************************/
1039 ACPI_NAMESPACE_NODE *Node;
1042 if (!Name || Name[0] == 0)
1044 AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf);
1048 AcpiDbPrepNamestring (Name);
1050 if (Name[0] == '\\')
1052 /* Validate new scope from the root */
1054 Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode, ACPI_NS_NO_UPSEARCH, &Node);
1055 if (ACPI_FAILURE (Status))
1060 ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
1061 ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
1065 /* Validate new scope relative to old scope */
1067 Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode, ACPI_NS_NO_UPSEARCH, &Node);
1068 if (ACPI_FAILURE (Status))
1073 ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
1074 ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
1077 AcpiGbl_DbScopeNode = Node;
1078 AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf);
1083 AcpiOsPrintf ("Could not attach scope: %s, %s\n", Name, AcpiFormatException (Status));
1087 /*******************************************************************************
1089 * FUNCTION: AcpiDbDisplayResources
1091 * PARAMETERS: ObjectArg - String with hex value of the object
1095 * DESCRIPTION: Display the resource objects associated with a device.
1097 ******************************************************************************/
1100 AcpiDbDisplayResources (
1103 #if ACPI_MACHINE_WIDTH != 16
1105 ACPI_OPERAND_OBJECT *ObjDesc;
1107 ACPI_BUFFER ReturnObj;
1110 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
1111 AcpiDbgLevel |= ACPI_LV_RESOURCES;
1113 /* Convert string to object pointer */
1115 ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
1117 /* Prepare for a return object of arbitrary size */
1119 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1120 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1124 AcpiOsPrintf ("Evaluating _PRT\n");
1126 Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj);
1127 if (ACPI_FAILURE (Status))
1129 AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiFormatException (Status));
1133 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1134 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1136 Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj);
1137 if (ACPI_FAILURE (Status))
1139 AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiFormatException (Status));
1143 AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer);
1150 AcpiOsPrintf ("Evaluating _CRS\n");
1152 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1153 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1155 Status = AcpiEvaluateObject (ObjDesc, "_CRS", NULL, &ReturnObj);
1156 if (ACPI_FAILURE (Status))
1158 AcpiOsPrintf ("Could not obtain _CRS: %s\n", AcpiFormatException (Status));
1162 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1163 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1165 Status = AcpiGetCurrentResources (ObjDesc, &ReturnObj);
1166 if (ACPI_FAILURE (Status))
1168 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status));
1173 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
1176 Status = AcpiSetCurrentResources (ObjDesc, &ReturnObj);
1177 if (ACPI_FAILURE (Status))
1179 AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", AcpiFormatException (Status));
1187 AcpiOsPrintf ("Evaluating _PRS\n");
1189 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1190 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1192 Status = AcpiEvaluateObject (ObjDesc, "_PRS", NULL, &ReturnObj);
1193 if (ACPI_FAILURE (Status))
1195 AcpiOsPrintf ("Could not obtain _PRS: %s\n", AcpiFormatException (Status));
1199 ReturnObj.Pointer = AcpiGbl_DbBuffer;
1200 ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
1202 Status = AcpiGetPossibleResources (ObjDesc, &ReturnObj);
1203 if (ACPI_FAILURE (Status))
1205 AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiFormatException (Status));
1209 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
1214 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
1220 /*******************************************************************************
1222 * FUNCTION: AcpiDbIntegrityWalk
1224 * PARAMETERS: Callback from WalkNamespace
1228 * DESCRIPTION: Examine one NS node for valid values.
1230 ******************************************************************************/
1233 AcpiDbIntegrityWalk (
1234 ACPI_HANDLE ObjHandle,
1235 UINT32 NestingLevel,
1239 ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context;
1240 ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
1241 ACPI_OPERAND_OBJECT *Object;
1245 if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
1247 AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s]\n",
1248 Node, AcpiUtGetDescriptorName (Node));
1251 if (Node->Type > ACPI_TYPE_LOCAL_MAX)
1253 AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
1257 if (!AcpiUtValidAcpiName (Node->Name.Integer))
1259 AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node);
1262 Object = AcpiNsGetAttachedObject (Node);
1266 if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
1268 AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
1269 Object, AcpiUtGetDescriptorName (Object));
1277 /*******************************************************************************
1279 * FUNCTION: AcpiDbCheckIntegrity
1285 * DESCRIPTION: Check entire namespace for data structure integrity
1287 ******************************************************************************/
1290 AcpiDbCheckIntegrity (void)
1292 ACPI_INTEGRITY_INFO Info = {0,0};
1294 /* Search all nodes in namespace */
1296 (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
1297 AcpiDbIntegrityWalk, (void *) &Info, NULL);
1299 AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", Info.Nodes, Info.Objects);
1303 /*******************************************************************************
1305 * FUNCTION: AcpiDbGenerateGpe
1311 * DESCRIPTION: Generate a GPE
1313 ******************************************************************************/
1322 ACPI_GPE_EVENT_INFO *GpeEventInfo;
1325 GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0);
1326 BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
1329 GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), GpeNumber);
1332 AcpiOsPrintf ("Invalid GPE\n");
1336 (void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
1339 #endif /* ACPI_DEBUGGER */