1 /*******************************************************************************
3 * Module Name: dbcmds - debug commands and output routines
5 ******************************************************************************/
7 /******************************************************************************
11 * Some or all of this work - Copyright (c) 1999 - 2009, 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 *****************************************************************************/
118 #include "accommon.h"
119 #include "acdispat.h"
120 #include "acnamesp.h"
121 #include "acevents.h"
124 #include "acdisasm.h"
125 #include "actables.h"
126 #include "acparser.h"
130 #define _COMPONENT ACPI_CA_DEBUGGER
131 ACPI_MODULE_NAME ("dbcmds")
133 /* Local prototypes */
136 AcpiDbIntegrityWalk (
137 ACPI_HANDLE ObjHandle
,
143 AcpiDbWalkAndMatchName (
144 ACPI_HANDLE ObjHandle
,
150 AcpiDbWalkForReferences (
151 ACPI_HANDLE ObjHandle
,
157 AcpiDbWalkForSpecificObjects (
158 ACPI_HANDLE ObjHandle
,
163 static ACPI_NAMESPACE_NODE
*
164 AcpiDbConvertToNode (
168 AcpiDmCompareAmlResources (
170 ACPI_RSDESC_SIZE Aml1BufferLength
,
172 ACPI_RSDESC_SIZE Aml2BufferLength
);
175 AcpiDmTestResourceConversion (
176 ACPI_NAMESPACE_NODE
*Node
,
181 * Arguments for the Objects command
182 * These object types map directly to the ACPI_TYPES
184 static ARGUMENT_INFO AcpiDbObjectTypes
[] =
208 {NULL
} /* Must be null terminated */
212 /*******************************************************************************
214 * FUNCTION: AcpiDbConvertToNode
216 * PARAMETERS: InString - String to convert
218 * RETURN: Pointer to a NS node
220 * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
223 ******************************************************************************/
225 static ACPI_NAMESPACE_NODE
*
226 AcpiDbConvertToNode (
229 ACPI_NAMESPACE_NODE
*Node
;
232 if ((*InString
>= 0x30) && (*InString
<= 0x39))
234 /* Numeric argument, convert */
236 Node
= ACPI_TO_POINTER (ACPI_STRTOUL (InString
, NULL
, 16));
237 if (!AcpiOsReadable (Node
, sizeof (ACPI_NAMESPACE_NODE
)))
239 AcpiOsPrintf ("Address %p is invalid in this address space\n",
244 /* Make sure pointer is valid NS node */
246 if (ACPI_GET_DESCRIPTOR_TYPE (Node
) != ACPI_DESC_TYPE_NAMED
)
248 AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
249 Node
, AcpiUtGetDescriptorName (Node
));
256 /* The parameter is a name string that must be resolved to a
259 Node
= AcpiDbLocalNsLookup (InString
);
262 Node
= AcpiGbl_RootNode
;
270 /*******************************************************************************
272 * FUNCTION: AcpiDbSleep
274 * PARAMETERS: ObjectArg - Desired sleep state (0-5)
278 * DESCRIPTION: Simulate a sleep/wake sequence
280 ******************************************************************************/
290 SleepState
= (UINT8
) ACPI_STRTOUL (ObjectArg
, NULL
, 0);
292 AcpiOsPrintf ("**** Prepare to sleep ****\n");
293 Status
= AcpiEnterSleepStatePrep (SleepState
);
294 if (ACPI_FAILURE (Status
))
299 AcpiOsPrintf ("**** Going to sleep ****\n");
300 Status
= AcpiEnterSleepState (SleepState
);
301 if (ACPI_FAILURE (Status
))
306 AcpiOsPrintf ("**** returning from sleep ****\n");
307 Status
= AcpiLeaveSleepState (SleepState
);
313 /*******************************************************************************
315 * FUNCTION: AcpiDbWalkForReferences
317 * PARAMETERS: Callback from WalkNamespace
321 * DESCRIPTION: Check if this namespace object refers to the target object
322 * that is passed in as the context value.
324 * Note: Currently doesn't check subobjects within the Node's object
326 ******************************************************************************/
329 AcpiDbWalkForReferences (
330 ACPI_HANDLE ObjHandle
,
335 ACPI_OPERAND_OBJECT
*ObjDesc
= (ACPI_OPERAND_OBJECT
*) Context
;
336 ACPI_NAMESPACE_NODE
*Node
= (ACPI_NAMESPACE_NODE
*) ObjHandle
;
339 /* Check for match against the namespace node itself */
341 if (Node
== (void *) ObjDesc
)
343 AcpiOsPrintf ("Object is a Node [%4.4s]\n",
344 AcpiUtGetNodeName (Node
));
347 /* Check for match against the object attached to the node */
349 if (AcpiNsGetAttachedObject (Node
) == ObjDesc
)
351 AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n",
352 Node
, AcpiUtGetNodeName (Node
));
359 /*******************************************************************************
361 * FUNCTION: AcpiDbFindReferences
363 * PARAMETERS: ObjectArg - String with hex value of the object
367 * DESCRIPTION: Search namespace for all references to the input object
369 ******************************************************************************/
372 AcpiDbFindReferences (
375 ACPI_OPERAND_OBJECT
*ObjDesc
;
378 /* Convert string to object pointer */
380 ObjDesc
= ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg
, NULL
, 16));
382 /* Search all nodes in namespace */
384 (void) AcpiWalkNamespace (ACPI_TYPE_ANY
, ACPI_ROOT_OBJECT
, ACPI_UINT32_MAX
,
385 AcpiDbWalkForReferences
, (void *) ObjDesc
, NULL
);
389 /*******************************************************************************
391 * FUNCTION: AcpiDbWalkForPredefinedNames
393 * PARAMETERS: Callback from WalkNamespace
397 * DESCRIPTION: Detect and display predefined ACPI names (names that start with
400 ******************************************************************************/
403 AcpiDbWalkForPredefinedNames (
404 ACPI_HANDLE ObjHandle
,
409 ACPI_NAMESPACE_NODE
*Node
= (ACPI_NAMESPACE_NODE
*) ObjHandle
;
410 UINT32
*Count
= (UINT32
*) Context
;
411 const ACPI_PREDEFINED_INFO
*Predefined
;
412 const ACPI_PREDEFINED_INFO
*Package
= NULL
;
416 Predefined
= AcpiNsCheckForPredefinedName (Node
);
422 Pathname
= AcpiNsGetExternalPathname (Node
);
428 /* If method returns a package, the info is in the next table entry */
430 if (Predefined
->Info
.ExpectedBtypes
& ACPI_BTYPE_PACKAGE
)
432 Package
= Predefined
+ 1;
435 AcpiOsPrintf ("%-32s arg %X ret %2.2X", Pathname
,
436 Predefined
->Info
.ParamCount
, Predefined
->Info
.ExpectedBtypes
);
440 AcpiOsPrintf (" PkgType %2.2X ObjType %2.2X Count %2.2X",
441 Package
->RetInfo
.Type
, Package
->RetInfo
.ObjectType1
,
442 Package
->RetInfo
.Count1
);
447 AcpiNsCheckParameterCount (Pathname
, Node
, ACPI_UINT32_MAX
, Predefined
);
448 ACPI_FREE (Pathname
);
455 /*******************************************************************************
457 * FUNCTION: AcpiDbCheckPredefinedNames
463 * DESCRIPTION: Validate all predefined names in the namespace
465 ******************************************************************************/
468 AcpiDbCheckPredefinedNames (
474 /* Search all nodes in namespace */
476 (void) AcpiWalkNamespace (ACPI_TYPE_ANY
, ACPI_ROOT_OBJECT
, ACPI_UINT32_MAX
,
477 AcpiDbWalkForPredefinedNames
, (void *) &Count
, NULL
);
479 AcpiOsPrintf ("Found %d predefined names in the namespace\n", Count
);
483 /*******************************************************************************
485 * FUNCTION: AcpiDbWalkForExecute
487 * PARAMETERS: Callback from WalkNamespace
491 * DESCRIPTION: Batch execution module. Currently only executes predefined
494 ******************************************************************************/
497 AcpiDbWalkForExecute (
498 ACPI_HANDLE ObjHandle
,
503 ACPI_NAMESPACE_NODE
*Node
= (ACPI_NAMESPACE_NODE
*) ObjHandle
;
504 UINT32
*Count
= (UINT32
*) Context
;
505 ACPI_BUFFER ReturnObj
;
509 ACPI_DEVICE_INFO
*ObjInfo
;
510 ACPI_OBJECT_LIST ParamObjects
;
511 ACPI_OBJECT Params
[ACPI_METHOD_NUM_ARGS
];
512 const ACPI_PREDEFINED_INFO
*Predefined
;
515 Predefined
= AcpiNsCheckForPredefinedName (Node
);
521 if (Node
->Type
== ACPI_TYPE_LOCAL_SCOPE
)
526 Pathname
= AcpiNsGetExternalPathname (Node
);
532 /* Get the object info for number of method parameters */
534 Status
= AcpiGetObjectInfo (ObjHandle
, &ObjInfo
);
535 if (ACPI_FAILURE (Status
))
540 ParamObjects
.Pointer
= NULL
;
541 ParamObjects
.Count
= 0;
543 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
;
560 ReturnObj
.Pointer
= NULL
;
561 ReturnObj
.Length
= ACPI_ALLOCATE_BUFFER
;
564 /* Do the actual method execution */
566 AcpiGbl_MethodExecuting
= TRUE
;
568 Status
= AcpiEvaluateObject (Node
, NULL
, &ParamObjects
, &ReturnObj
);
570 AcpiOsPrintf ("%-32s returned %s\n", Pathname
, AcpiFormatException (Status
));
571 AcpiGbl_MethodExecuting
= FALSE
;
573 ACPI_FREE (Pathname
);
580 /*******************************************************************************
582 * FUNCTION: AcpiDbBatchExecute
588 * DESCRIPTION: Namespace batch execution.
590 ******************************************************************************/
599 /* Search all nodes in namespace */
601 (void) AcpiWalkNamespace (ACPI_TYPE_ANY
, ACPI_ROOT_OBJECT
, ACPI_UINT32_MAX
,
602 AcpiDbWalkForExecute
, (void *) &Count
, NULL
);
604 AcpiOsPrintf ("Executed %d predefined names in the namespace\n", Count
);
608 /*******************************************************************************
610 * FUNCTION: AcpiDbDisplayLocks
616 * DESCRIPTION: Display information about internal mutexes.
618 ******************************************************************************/
627 for (i
= 0; i
< ACPI_MAX_MUTEX
; i
++)
629 AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i
),
630 AcpiGbl_MutexInfo
[i
].ThreadId
== ACPI_MUTEX_NOT_ACQUIRED
631 ? "Locked" : "Unlocked");
636 /*******************************************************************************
638 * FUNCTION: AcpiDbDisplayTableInfo
640 * PARAMETERS: TableArg - String with name of table to be displayed
644 * DESCRIPTION: Display information about loaded tables. Current
645 * implementation displays all loaded tables.
647 ******************************************************************************/
650 AcpiDbDisplayTableInfo (
654 ACPI_TABLE_DESC
*TableDesc
;
658 /* Walk the entire root table list */
660 for (i
= 0; i
< AcpiGbl_RootTableList
.Count
; i
++)
662 TableDesc
= &AcpiGbl_RootTableList
.Tables
[i
];
663 AcpiOsPrintf ("%d ", i
);
665 /* Make sure that the table is mapped */
667 Status
= AcpiTbVerifyTable (TableDesc
);
668 if (ACPI_FAILURE (Status
))
673 /* Dump the table header */
675 if (TableDesc
->Pointer
)
677 AcpiTbPrintTableHeader (TableDesc
->Address
, TableDesc
->Pointer
);
681 /* If the pointer is null, the table has been unloaded */
683 ACPI_INFO ((AE_INFO
, "%4.4s - Table has been unloaded",
684 TableDesc
->Signature
.Ascii
));
690 /*******************************************************************************
692 * FUNCTION: AcpiDbUnloadAcpiTable
694 * PARAMETERS: TableArg - Name of the table to be unloaded
695 * InstanceArg - Which instance of the table to unload (if
696 * there are multiple tables of the same type)
700 * DESCRIPTION: Unload an ACPI table.
701 * Instance is not implemented
703 ******************************************************************************/
706 AcpiDbUnloadAcpiTable (
710 /* TBD: Need to reimplement for new data structures */
717 /* Search all tables for the target type */
719 for (i
= 0; i
< (ACPI_TABLE_ID_MAX
+1); i
++)
721 if (!ACPI_STRNCMP (TableArg
, AcpiGbl_TableData
[i
].Signature
,
722 AcpiGbl_TableData
[i
].SigLength
))
724 /* Found the table, unload it */
726 Status
= AcpiUnloadTable (i
);
727 if (ACPI_SUCCESS (Status
))
729 AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg
);
733 AcpiOsPrintf ("%s, while unloading [%s]\n",
734 AcpiFormatException (Status
), TableArg
);
741 AcpiOsPrintf ("Unknown table type [%s]\n", TableArg
);
746 /*******************************************************************************
748 * FUNCTION: AcpiDbSetMethodBreakpoint
750 * PARAMETERS: Location - AML offset of breakpoint
751 * WalkState - Current walk info
752 * Op - Current Op (from parse walk)
756 * DESCRIPTION: Set a breakpoint in a control method at the specified
759 ******************************************************************************/
762 AcpiDbSetMethodBreakpoint (
764 ACPI_WALK_STATE
*WalkState
,
765 ACPI_PARSE_OBJECT
*Op
)
772 AcpiOsPrintf ("There is no method currently executing\n");
776 /* Get and verify the breakpoint address */
778 Address
= ACPI_STRTOUL (Location
, NULL
, 16);
779 if (Address
<= Op
->Common
.AmlOffset
)
781 AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
782 Address
, Op
->Common
.AmlOffset
);
785 /* Save breakpoint in current walk */
787 WalkState
->UserBreakpoint
= Address
;
788 AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address
);
792 /*******************************************************************************
794 * FUNCTION: AcpiDbSetMethodCallBreakpoint
796 * PARAMETERS: Op - Current Op (from parse walk)
800 * DESCRIPTION: Set a breakpoint in a control method at the specified
803 ******************************************************************************/
806 AcpiDbSetMethodCallBreakpoint (
807 ACPI_PARSE_OBJECT
*Op
)
813 AcpiOsPrintf ("There is no method currently executing\n");
817 AcpiGbl_StepToNextCall
= TRUE
;
821 /*******************************************************************************
823 * FUNCTION: AcpiDbDisassembleAml
825 * PARAMETERS: Statements - Number of statements to disassemble
826 * Op - Current Op (from parse walk)
830 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
831 * of statements specified.
833 ******************************************************************************/
836 AcpiDbDisassembleAml (
838 ACPI_PARSE_OBJECT
*Op
)
840 UINT32 NumStatements
= 8;
845 AcpiOsPrintf ("There is no method currently executing\n");
851 NumStatements
= ACPI_STRTOUL (Statements
, NULL
, 0);
854 AcpiDmDisassemble (NULL
, Op
, NumStatements
);
858 /*******************************************************************************
860 * FUNCTION: AcpiDbDisassembleMethod
862 * PARAMETERS: Name - Name of control method
866 * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number
867 * of statements specified.
869 ******************************************************************************/
872 AcpiDbDisassembleMethod (
876 ACPI_PARSE_OBJECT
*Op
;
877 ACPI_WALK_STATE
*WalkState
;
878 ACPI_OPERAND_OBJECT
*ObjDesc
;
879 ACPI_NAMESPACE_NODE
*Method
;
882 Method
= AcpiDbConvertToNode (Name
);
885 return (AE_BAD_PARAMETER
);
888 ObjDesc
= Method
->Object
;
890 Op
= AcpiPsCreateScopeOp ();
893 return (AE_NO_MEMORY
);
896 /* Create and initialize a new walk state */
898 WalkState
= AcpiDsCreateWalkState (0, Op
, NULL
, NULL
);
901 return (AE_NO_MEMORY
);
904 Status
= AcpiDsInitAmlWalk (WalkState
, Op
, NULL
,
905 ObjDesc
->Method
.AmlStart
,
906 ObjDesc
->Method
.AmlLength
, NULL
, ACPI_IMODE_LOAD_PASS1
);
907 if (ACPI_FAILURE (Status
))
914 WalkState
->ParseFlags
&= ~ACPI_PARSE_DELETE_TREE
;
915 WalkState
->ParseFlags
|= ACPI_PARSE_DISASSEMBLE
;
916 Status
= AcpiPsParseAml (WalkState
);
918 AcpiDmDisassemble (NULL
, Op
, 0);
919 AcpiPsDeleteParseTree (Op
);
924 /*******************************************************************************
926 * FUNCTION: AcpiDbDumpNamespace
928 * PARAMETERS: StartArg - Node to begin namespace dump
929 * DepthArg - Maximum tree depth to be dumped
933 * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed
934 * with type and other information.
936 ******************************************************************************/
939 AcpiDbDumpNamespace (
943 ACPI_HANDLE SubtreeEntry
= AcpiGbl_RootNode
;
944 UINT32 MaxDepth
= ACPI_UINT32_MAX
;
947 /* No argument given, just start at the root and dump entire namespace */
951 SubtreeEntry
= AcpiDbConvertToNode (StartArg
);
957 /* Now we can check for the depth argument */
961 MaxDepth
= ACPI_STRTOUL (DepthArg
, NULL
, 0);
965 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT
);
966 AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
967 ((ACPI_NAMESPACE_NODE
*) SubtreeEntry
)->Name
.Ascii
, SubtreeEntry
);
969 /* Display the subtree */
971 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT
);
972 AcpiNsDumpObjects (ACPI_TYPE_ANY
, ACPI_DISPLAY_SUMMARY
, MaxDepth
,
973 ACPI_OWNER_ID_MAX
, SubtreeEntry
);
974 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT
);
978 /*******************************************************************************
980 * FUNCTION: AcpiDbDumpNamespaceByOwner
982 * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed
983 * DepthArg - Maximum tree depth to be dumped
987 * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId.
989 ******************************************************************************/
992 AcpiDbDumpNamespaceByOwner (
996 ACPI_HANDLE SubtreeEntry
= AcpiGbl_RootNode
;
997 UINT32 MaxDepth
= ACPI_UINT32_MAX
;
998 ACPI_OWNER_ID OwnerId
;
1001 OwnerId
= (ACPI_OWNER_ID
) ACPI_STRTOUL (OwnerArg
, NULL
, 0);
1003 /* Now we can check for the depth argument */
1007 MaxDepth
= ACPI_STRTOUL (DepthArg
, NULL
, 0);
1010 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT
);
1011 AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId
);
1013 /* Display the subtree */
1015 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT
);
1016 AcpiNsDumpObjects (ACPI_TYPE_ANY
, ACPI_DISPLAY_SUMMARY
, MaxDepth
, OwnerId
,
1018 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT
);
1022 /*******************************************************************************
1024 * FUNCTION: AcpiDbSendNotify
1026 * PARAMETERS: Name - Name of ACPI object to send the notify to
1027 * Value - Value of the notify to send.
1031 * DESCRIPTION: Send an ACPI notification. The value specified is sent to the
1032 * named object as an ACPI notify.
1034 ******************************************************************************/
1041 ACPI_NAMESPACE_NODE
*Node
;
1045 /* Translate name to an Named object */
1047 Node
= AcpiDbConvertToNode (Name
);
1053 /* Decode Named object type */
1057 case ACPI_TYPE_DEVICE
:
1058 case ACPI_TYPE_THERMAL
:
1060 /* Send the notify */
1062 Status
= AcpiEvQueueNotifyRequest (Node
, Value
);
1063 if (ACPI_FAILURE (Status
))
1065 AcpiOsPrintf ("Could not queue notify\n");
1070 AcpiOsPrintf ("Named object is not a device or a thermal object\n");
1076 /*******************************************************************************
1078 * FUNCTION: AcpiDbSetMethodData
1080 * PARAMETERS: TypeArg - L for local, A for argument
1081 * IndexArg - which one
1082 * ValueArg - Value to set.
1086 * DESCRIPTION: Set a local or argument for the running control method.
1087 * NOTE: only object supported is Number.
1089 ******************************************************************************/
1092 AcpiDbSetMethodData (
1100 ACPI_WALK_STATE
*WalkState
;
1101 ACPI_OPERAND_OBJECT
*ObjDesc
;
1103 ACPI_NAMESPACE_NODE
*Node
;
1106 /* Validate TypeArg */
1108 AcpiUtStrupr (TypeArg
);
1110 if ((Type
!= 'L') &&
1114 AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg
);
1118 Value
= ACPI_STRTOUL (ValueArg
, NULL
, 16);
1122 Node
= AcpiDbConvertToNode (IndexArg
);
1123 if (Node
->Type
!= ACPI_TYPE_INTEGER
)
1125 AcpiOsPrintf ("Can only set Integer nodes\n");
1128 ObjDesc
= Node
->Object
;
1129 ObjDesc
->Integer
.Value
= Value
;
1133 /* Get the index and value */
1135 Index
= ACPI_STRTOUL (IndexArg
, NULL
, 16);
1137 WalkState
= AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList
);
1140 AcpiOsPrintf ("There is no method currently executing\n");
1144 /* Create and initialize the new object */
1146 ObjDesc
= AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER
);
1149 AcpiOsPrintf ("Could not create an internal object\n");
1153 ObjDesc
->Integer
.Value
= Value
;
1155 /* Store the new object into the target */
1161 /* Set a method argument */
1163 if (Index
> ACPI_METHOD_MAX_ARG
)
1165 AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index
);
1169 Status
= AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG
, Index
, ObjDesc
,
1171 if (ACPI_FAILURE (Status
))
1176 ObjDesc
= WalkState
->Arguments
[Index
].Object
;
1178 AcpiOsPrintf ("Arg%d: ", Index
);
1179 AcpiDmDisplayInternalObject (ObjDesc
, WalkState
);
1184 /* Set a method local */
1186 if (Index
> ACPI_METHOD_MAX_LOCAL
)
1188 AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index
);
1192 Status
= AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL
, Index
, ObjDesc
,
1194 if (ACPI_FAILURE (Status
))
1199 ObjDesc
= WalkState
->LocalVariables
[Index
].Object
;
1201 AcpiOsPrintf ("Local%d: ", Index
);
1202 AcpiDmDisplayInternalObject (ObjDesc
, WalkState
);
1210 AcpiUtRemoveReference (ObjDesc
);
1214 /*******************************************************************************
1216 * FUNCTION: AcpiDbWalkForSpecificObjects
1218 * PARAMETERS: Callback from WalkNamespace
1222 * DESCRIPTION: Display short info about objects in the namespace
1224 ******************************************************************************/
1227 AcpiDbWalkForSpecificObjects (
1228 ACPI_HANDLE ObjHandle
,
1229 UINT32 NestingLevel
,
1233 ACPI_WALK_INFO
*Info
= (ACPI_WALK_INFO
*) Context
;
1240 /* Get and display the full pathname to this object */
1242 Buffer
.Length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
1243 Status
= AcpiNsHandleToPathname (ObjHandle
, &Buffer
);
1244 if (ACPI_FAILURE (Status
))
1246 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle
);
1250 AcpiOsPrintf ("%32s", (char *) Buffer
.Pointer
);
1251 ACPI_FREE (Buffer
.Pointer
);
1253 /* Dump short info about the object */
1255 (void) AcpiNsDumpOneObject (ObjHandle
, NestingLevel
, Info
, NULL
);
1260 /*******************************************************************************
1262 * FUNCTION: AcpiDbDisplayObjects
1264 * PARAMETERS: ObjTypeArg - Type of object to display
1265 * DisplayCountArg - Max depth to display
1269 * DESCRIPTION: Display objects in the namespace of the requested type
1271 ******************************************************************************/
1274 AcpiDbDisplayObjects (
1276 char *DisplayCountArg
)
1278 ACPI_WALK_INFO Info
;
1279 ACPI_OBJECT_TYPE Type
;
1282 /* Get the object type */
1284 Type
= AcpiDbMatchArgument (ObjTypeArg
, AcpiDbObjectTypes
);
1285 if (Type
== ACPI_TYPE_NOT_FOUND
)
1287 AcpiOsPrintf ("Invalid or unsupported argument\n");
1291 AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT
);
1293 "Objects of type [%s] defined in the current ACPI Namespace:\n",
1294 AcpiUtGetTypeName (Type
));
1296 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT
);
1299 Info
.OwnerId
= ACPI_OWNER_ID_MAX
;
1300 Info
.DebugLevel
= ACPI_UINT32_MAX
;
1301 Info
.DisplayType
= ACPI_DISPLAY_SUMMARY
| ACPI_DISPLAY_SHORT
;
1303 /* Walk the namespace from the root */
1305 (void) AcpiWalkNamespace (Type
, ACPI_ROOT_OBJECT
, ACPI_UINT32_MAX
,
1306 AcpiDbWalkForSpecificObjects
, (void *) &Info
, NULL
);
1309 "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
1310 Info
.Count
, AcpiUtGetTypeName (Type
));
1312 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT
);
1317 /*******************************************************************************
1319 * FUNCTION: AcpiDbWalkAndMatchName
1321 * PARAMETERS: Callback from WalkNamespace
1325 * DESCRIPTION: Find a particular name/names within the namespace. Wildcards
1326 * are supported -- '?' matches any character.
1328 ******************************************************************************/
1331 AcpiDbWalkAndMatchName (
1332 ACPI_HANDLE ObjHandle
,
1333 UINT32 NestingLevel
,
1338 char *RequestedName
= (char *) Context
;
1341 ACPI_WALK_INFO Info
;
1344 /* Check for a name match */
1346 for (i
= 0; i
< 4; i
++)
1348 /* Wildcard support */
1350 if ((RequestedName
[i
] != '?') &&
1351 (RequestedName
[i
] != ((ACPI_NAMESPACE_NODE
*) ObjHandle
)->Name
.Ascii
[i
]))
1353 /* No match, just exit */
1359 /* Get the full pathname to this object */
1361 Buffer
.Length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
1362 Status
= AcpiNsHandleToPathname (ObjHandle
, &Buffer
);
1363 if (ACPI_FAILURE (Status
))
1365 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle
);
1369 Info
.OwnerId
= ACPI_OWNER_ID_MAX
;
1370 Info
.DebugLevel
= ACPI_UINT32_MAX
;
1371 Info
.DisplayType
= ACPI_DISPLAY_SUMMARY
| ACPI_DISPLAY_SHORT
;
1373 AcpiOsPrintf ("%32s", (char *) Buffer
.Pointer
);
1374 (void) AcpiNsDumpOneObject (ObjHandle
, NestingLevel
, &Info
, NULL
);
1375 ACPI_FREE (Buffer
.Pointer
);
1382 /*******************************************************************************
1384 * FUNCTION: AcpiDbFindNameInNamespace
1386 * PARAMETERS: NameArg - The 4-character ACPI name to find.
1387 * wildcards are supported.
1391 * DESCRIPTION: Search the namespace for a given name (with wildcards)
1393 ******************************************************************************/
1396 AcpiDbFindNameInNamespace (
1399 char AcpiName
[5] = "____";
1400 char *AcpiNamePtr
= AcpiName
;
1403 if (ACPI_STRLEN (NameArg
) > 4)
1405 AcpiOsPrintf ("Name must be no longer than 4 characters\n");
1409 /* Pad out name with underscores as necessary to create a 4-char name */
1411 AcpiUtStrupr (NameArg
);
1414 *AcpiNamePtr
= *NameArg
;
1419 /* Walk the namespace from the root */
1421 (void) AcpiWalkNamespace (ACPI_TYPE_ANY
, ACPI_ROOT_OBJECT
, ACPI_UINT32_MAX
,
1422 AcpiDbWalkAndMatchName
, AcpiName
, NULL
);
1424 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT
);
1429 /*******************************************************************************
1431 * FUNCTION: AcpiDbSetScope
1433 * PARAMETERS: Name - New scope path
1437 * DESCRIPTION: Set the "current scope" as maintained by this utility.
1438 * The scope is used as a prefix to ACPI paths.
1440 ******************************************************************************/
1447 ACPI_NAMESPACE_NODE
*Node
;
1450 if (!Name
|| Name
[0] == 0)
1452 AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf
);
1456 AcpiDbPrepNamestring (Name
);
1458 if (Name
[0] == '\\')
1460 /* Validate new scope from the root */
1462 Status
= AcpiNsGetNode (AcpiGbl_RootNode
, Name
, ACPI_NS_NO_UPSEARCH
,
1464 if (ACPI_FAILURE (Status
))
1469 ACPI_STRCPY (AcpiGbl_DbScopeBuf
, Name
);
1470 ACPI_STRCAT (AcpiGbl_DbScopeBuf
, "\\");
1474 /* Validate new scope relative to old scope */
1476 Status
= AcpiNsGetNode (AcpiGbl_DbScopeNode
, Name
, ACPI_NS_NO_UPSEARCH
,
1478 if (ACPI_FAILURE (Status
))
1483 ACPI_STRCAT (AcpiGbl_DbScopeBuf
, Name
);
1484 ACPI_STRCAT (AcpiGbl_DbScopeBuf
, "\\");
1487 AcpiGbl_DbScopeNode
= Node
;
1488 AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf
);
1493 AcpiOsPrintf ("Could not attach scope: %s, %s\n",
1494 Name
, AcpiFormatException (Status
));
1498 /*******************************************************************************
1500 * FUNCTION: AcpiDmCompareAmlResources
1502 * PARAMETERS: Aml1Buffer - Contains first resource list
1503 * Aml1BufferLength - Length of first resource list
1504 * Aml2Buffer - Contains second resource list
1505 * Aml2BufferLength - Length of second resource list
1509 * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in
1510 * order to isolate a miscompare to an individual resource)
1512 ******************************************************************************/
1515 AcpiDmCompareAmlResources (
1517 ACPI_RSDESC_SIZE Aml1BufferLength
,
1519 ACPI_RSDESC_SIZE Aml2BufferLength
)
1523 ACPI_RSDESC_SIZE Aml1Length
;
1524 ACPI_RSDESC_SIZE Aml2Length
;
1525 ACPI_RSDESC_SIZE Offset
= 0;
1530 /* Compare overall buffer sizes (may be different due to size rounding) */
1532 if (Aml1BufferLength
!= Aml2BufferLength
)
1535 "**** Buffer length mismatch in converted AML: original %X new %X ****\n",
1536 Aml1BufferLength
, Aml2BufferLength
);
1542 /* Walk the descriptor lists, comparing each descriptor */
1544 while (Aml1
< (Aml1Buffer
+ Aml1BufferLength
))
1546 /* Get the lengths of each descriptor */
1548 Aml1Length
= AcpiUtGetDescriptorLength (Aml1
);
1549 Aml2Length
= AcpiUtGetDescriptorLength (Aml2
);
1550 ResourceType
= AcpiUtGetResourceType (Aml1
);
1552 /* Check for descriptor length match */
1554 if (Aml1Length
!= Aml2Length
)
1557 "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n",
1558 Count
, ResourceType
, Offset
, Aml1Length
, Aml2Length
);
1561 /* Check for descriptor byte match */
1563 else if (ACPI_MEMCMP (Aml1
, Aml2
, Aml1Length
))
1566 "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
1567 Count
, ResourceType
, Offset
);
1570 /* Exit on EndTag descriptor */
1572 if (ResourceType
== ACPI_RESOURCE_NAME_END_TAG
)
1577 /* Point to next descriptor in each buffer */
1580 Offset
+= Aml1Length
;
1587 /*******************************************************************************
1589 * FUNCTION: AcpiDmTestResourceConversion
1591 * PARAMETERS: Node - Parent device node
1592 * Name - resource method name (_CRS)
1596 * DESCRIPTION: Compare the original AML with a conversion of the AML to
1597 * internal resource list, then back to AML.
1599 ******************************************************************************/
1602 AcpiDmTestResourceConversion (
1603 ACPI_NAMESPACE_NODE
*Node
,
1607 ACPI_BUFFER ReturnObj
;
1608 ACPI_BUFFER ResourceObj
;
1610 ACPI_OBJECT
*OriginalAml
;
1613 AcpiOsPrintf ("Resource Conversion Comparison:\n");
1615 NewAml
.Length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
1616 ReturnObj
.Length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
1617 ResourceObj
.Length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
1619 /* Get the original _CRS AML resource template */
1621 Status
= AcpiEvaluateObject (Node
, Name
, NULL
, &ReturnObj
);
1622 if (ACPI_FAILURE (Status
))
1624 AcpiOsPrintf ("Could not obtain %s: %s\n",
1625 Name
, AcpiFormatException (Status
));
1629 /* Get the AML resource template, converted to internal resource structs */
1631 Status
= AcpiGetCurrentResources (Node
, &ResourceObj
);
1632 if (ACPI_FAILURE (Status
))
1634 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
1635 AcpiFormatException (Status
));
1639 /* Convert internal resource list to external AML resource template */
1641 Status
= AcpiRsCreateAmlResources (ResourceObj
.Pointer
, &NewAml
);
1642 if (ACPI_FAILURE (Status
))
1644 AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n",
1645 AcpiFormatException (Status
));
1649 /* Compare original AML to the newly created AML resource list */
1651 OriginalAml
= ReturnObj
.Pointer
;
1653 AcpiDmCompareAmlResources (
1654 OriginalAml
->Buffer
.Pointer
, (ACPI_RSDESC_SIZE
) OriginalAml
->Buffer
.Length
,
1655 NewAml
.Pointer
, (ACPI_RSDESC_SIZE
) NewAml
.Length
);
1657 /* Cleanup and exit */
1659 ACPI_FREE (NewAml
.Pointer
);
1661 ACPI_FREE (ResourceObj
.Pointer
);
1663 ACPI_FREE (ReturnObj
.Pointer
);
1668 /*******************************************************************************
1670 * FUNCTION: AcpiDbDisplayResources
1672 * PARAMETERS: ObjectArg - String with hex value of the object
1676 * DESCRIPTION: Display the resource objects associated with a device.
1678 ******************************************************************************/
1681 AcpiDbDisplayResources (
1684 ACPI_NAMESPACE_NODE
*Node
;
1686 ACPI_BUFFER ReturnObj
;
1689 AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT
);
1690 AcpiDbgLevel
|= ACPI_LV_RESOURCES
;
1692 /* Convert string to object pointer */
1694 Node
= AcpiDbConvertToNode (ObjectArg
);
1700 /* Prepare for a return object of arbitrary size */
1702 ReturnObj
.Pointer
= AcpiGbl_DbBuffer
;
1703 ReturnObj
.Length
= ACPI_DEBUG_BUFFER_SIZE
;
1707 AcpiOsPrintf ("Evaluating _PRT\n");
1709 /* Check if _PRT exists */
1711 Status
= AcpiEvaluateObject (Node
, METHOD_NAME__PRT
, NULL
, &ReturnObj
);
1712 if (ACPI_FAILURE (Status
))
1714 AcpiOsPrintf ("Could not obtain _PRT: %s\n",
1715 AcpiFormatException (Status
));
1719 ReturnObj
.Pointer
= AcpiGbl_DbBuffer
;
1720 ReturnObj
.Length
= ACPI_DEBUG_BUFFER_SIZE
;
1722 Status
= AcpiGetIrqRoutingTable (Node
, &ReturnObj
);
1723 if (ACPI_FAILURE (Status
))
1725 AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
1726 AcpiFormatException (Status
));
1730 AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8
, AcpiGbl_DbBuffer
));
1736 AcpiOsPrintf ("Evaluating _CRS\n");
1738 ReturnObj
.Pointer
= AcpiGbl_DbBuffer
;
1739 ReturnObj
.Length
= ACPI_DEBUG_BUFFER_SIZE
;
1741 /* Check if _CRS exists */
1743 Status
= AcpiEvaluateObject (Node
, METHOD_NAME__CRS
, NULL
, &ReturnObj
);
1744 if (ACPI_FAILURE (Status
))
1746 AcpiOsPrintf ("Could not obtain _CRS: %s\n",
1747 AcpiFormatException (Status
));
1751 /* Get the _CRS resource list */
1753 ReturnObj
.Pointer
= AcpiGbl_DbBuffer
;
1754 ReturnObj
.Length
= ACPI_DEBUG_BUFFER_SIZE
;
1756 Status
= AcpiGetCurrentResources (Node
, &ReturnObj
);
1757 if (ACPI_FAILURE (Status
))
1759 AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
1760 AcpiFormatException (Status
));
1764 /* Dump the _CRS resource list */
1766 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE
,
1767 ReturnObj
.Pointer
));
1770 * Perform comparison of original AML to newly created AML. This tests both
1771 * the AML->Resource conversion and the Resource->Aml conversion.
1773 Status
= AcpiDmTestResourceConversion (Node
, __UNCONST(METHOD_NAME__CRS
));
1775 /* Execute _SRS with the resource list */
1777 Status
= AcpiSetCurrentResources (Node
, &ReturnObj
);
1778 if (ACPI_FAILURE (Status
))
1780 AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
1781 AcpiFormatException (Status
));
1789 AcpiOsPrintf ("Evaluating _PRS\n");
1791 ReturnObj
.Pointer
= AcpiGbl_DbBuffer
;
1792 ReturnObj
.Length
= ACPI_DEBUG_BUFFER_SIZE
;
1794 /* Check if _PRS exists */
1796 Status
= AcpiEvaluateObject (Node
, METHOD_NAME__PRS
, NULL
, &ReturnObj
);
1797 if (ACPI_FAILURE (Status
))
1799 AcpiOsPrintf ("Could not obtain _PRS: %s\n",
1800 AcpiFormatException (Status
));
1804 ReturnObj
.Pointer
= AcpiGbl_DbBuffer
;
1805 ReturnObj
.Length
= ACPI_DEBUG_BUFFER_SIZE
;
1807 Status
= AcpiGetPossibleResources (Node
, &ReturnObj
);
1808 if (ACPI_FAILURE (Status
))
1810 AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
1811 AcpiFormatException (Status
));
1815 AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE
, AcpiGbl_DbBuffer
));
1819 AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT
);
1824 /*******************************************************************************
1826 * FUNCTION: AcpiDbIntegrityWalk
1828 * PARAMETERS: Callback from WalkNamespace
1832 * DESCRIPTION: Examine one NS node for valid values.
1834 ******************************************************************************/
1837 AcpiDbIntegrityWalk (
1838 ACPI_HANDLE ObjHandle
,
1839 UINT32 NestingLevel
,
1843 ACPI_INTEGRITY_INFO
*Info
= (ACPI_INTEGRITY_INFO
*) Context
;
1844 ACPI_NAMESPACE_NODE
*Node
= (ACPI_NAMESPACE_NODE
*) ObjHandle
;
1845 ACPI_OPERAND_OBJECT
*Object
;
1846 BOOLEAN Alias
= TRUE
;
1851 /* Verify the NS node, and dereference aliases */
1855 if (ACPI_GET_DESCRIPTOR_TYPE (Node
) != ACPI_DESC_TYPE_NAMED
)
1857 AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n",
1858 Node
, AcpiUtGetDescriptorName (Node
), ACPI_GET_DESCRIPTOR_TYPE (Node
),
1859 ACPI_DESC_TYPE_NAMED
);
1863 if ((Node
->Type
== ACPI_TYPE_LOCAL_ALIAS
) ||
1864 (Node
->Type
== ACPI_TYPE_LOCAL_METHOD_ALIAS
))
1866 Node
= (ACPI_NAMESPACE_NODE
*) Node
->Object
;
1874 if (Node
->Type
> ACPI_TYPE_LOCAL_MAX
)
1876 AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n",
1881 if (!AcpiUtValidAcpiName (Node
->Name
.Integer
))
1883 AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node
);
1887 Object
= AcpiNsGetAttachedObject (Node
);
1891 if (ACPI_GET_DESCRIPTOR_TYPE (Object
) != ACPI_DESC_TYPE_OPERAND
)
1893 AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n",
1894 Object
, AcpiUtGetDescriptorName (Object
));
1902 /*******************************************************************************
1904 * FUNCTION: AcpiDbCheckIntegrity
1910 * DESCRIPTION: Check entire namespace for data structure integrity
1912 ******************************************************************************/
1915 AcpiDbCheckIntegrity (
1918 ACPI_INTEGRITY_INFO Info
= {0,0};
1920 /* Search all nodes in namespace */
1922 (void) AcpiWalkNamespace (ACPI_TYPE_ANY
, ACPI_ROOT_OBJECT
, ACPI_UINT32_MAX
,
1923 AcpiDbIntegrityWalk
, (void *) &Info
, NULL
);
1925 AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n",
1926 Info
.Nodes
, Info
.Objects
);
1930 /*******************************************************************************
1932 * FUNCTION: AcpiDbGenerateGpe
1934 * PARAMETERS: GpeArg - Raw GPE number, ascii string
1935 * BlockArg - GPE block number, ascii string
1936 * 0 or 1 for FADT GPE blocks
1940 * DESCRIPTION: Generate a GPE
1942 ******************************************************************************/
1951 ACPI_GPE_EVENT_INFO
*GpeEventInfo
;
1954 GpeNumber
= ACPI_STRTOUL (GpeArg
, NULL
, 0);
1955 BlockNumber
= ACPI_STRTOUL (BlockArg
, NULL
, 0);
1958 GpeEventInfo
= AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber
),
1962 AcpiOsPrintf ("Invalid GPE\n");
1966 (void) AcpiEvGpeDispatch (GpeEventInfo
, GpeNumber
);
1970 /*******************************************************************************
1972 * FUNCTION: AcpiDbBusWalk
1974 * PARAMETERS: Callback from WalkNamespace
1978 * DESCRIPTION: Display info about device objects that have a corresponding
1981 ******************************************************************************/
1985 ACPI_HANDLE ObjHandle
,
1986 UINT32 NestingLevel
,
1990 ACPI_NAMESPACE_NODE
*Node
= (ACPI_NAMESPACE_NODE
*) ObjHandle
;
1993 ACPI_NAMESPACE_NODE
*TempNode
;
1994 ACPI_DEVICE_INFO
*Info
;
1998 if ((Node
->Type
!= ACPI_TYPE_DEVICE
) &&
1999 (Node
->Type
!= ACPI_TYPE_PROCESSOR
))
2004 /* Exit if there is no _PRT under this device */
2006 Status
= AcpiGetHandle (Node
, METHOD_NAME__PRT
,
2007 ACPI_CAST_PTR (ACPI_HANDLE
, &TempNode
));
2008 if (ACPI_FAILURE (Status
))
2013 /* Get the full path to this device object */
2015 Buffer
.Length
= ACPI_ALLOCATE_LOCAL_BUFFER
;
2016 Status
= AcpiNsHandleToPathname (ObjHandle
, &Buffer
);
2017 if (ACPI_FAILURE (Status
))
2019 AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle
);
2023 Status
= AcpiGetObjectInfo (ObjHandle
, &Info
);
2024 if (ACPI_FAILURE (Status
))
2029 /* Display the full path */
2031 AcpiOsPrintf ("%-32s Type %X", (char *) Buffer
.Pointer
, Node
->Type
);
2032 ACPI_FREE (Buffer
.Pointer
);
2034 if (Info
->Flags
& ACPI_PCI_ROOT_BRIDGE
)
2036 AcpiOsPrintf (" - Is PCI Root Bridge");
2038 AcpiOsPrintf ("\n");
2042 AcpiOsPrintf ("_PRT: %p\n", TempNode
);
2044 /* Dump _ADR, _HID, _UID, _CID */
2046 if (Info
->Valid
& ACPI_VALID_ADR
)
2048 AcpiOsPrintf ("_ADR: %8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Info
->Address
));
2052 AcpiOsPrintf ("_ADR: <Not Present>\n");
2055 if (Info
->Valid
& ACPI_VALID_HID
)
2057 AcpiOsPrintf ("_HID: %s\n", Info
->HardwareId
.String
);
2061 AcpiOsPrintf ("_HID: <Not Present>\n");
2064 if (Info
->Valid
& ACPI_VALID_UID
)
2066 AcpiOsPrintf ("_UID: %s\n", Info
->UniqueId
.String
);
2070 AcpiOsPrintf ("_UID: <Not Present>\n");
2073 if (Info
->Valid
& ACPI_VALID_CID
)
2075 for (i
= 0; i
< Info
->CompatibleIdList
.Count
; i
++)
2077 AcpiOsPrintf ("_CID: %s\n",
2078 Info
->CompatibleIdList
.Ids
[i
].String
);
2083 AcpiOsPrintf ("_CID: <Not Present>\n");
2091 /*******************************************************************************
2093 * FUNCTION: AcpiDbGetBusInfo
2099 * DESCRIPTION: Display info about system busses.
2101 ******************************************************************************/
2107 /* Search all nodes in namespace */
2109 (void) AcpiWalkNamespace (ACPI_TYPE_ANY
, ACPI_ROOT_OBJECT
, ACPI_UINT32_MAX
,
2110 AcpiDbBusWalk
, NULL
, NULL
);
2113 #endif /* ACPI_DEBUGGER */