13446Smrj /******************************************************************************* 23446Smrj * 33446Smrj * Module Name: dbcmds - debug commands and output routines 4*7851SDana.Myers@Sun.COM * $Revision: 1.157 $ 53446Smrj * 63446Smrj ******************************************************************************/ 73446Smrj 83446Smrj /****************************************************************************** 93446Smrj * 103446Smrj * 1. Copyright Notice 113446Smrj * 12*7851SDana.Myers@Sun.COM * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. 133446Smrj * All rights reserved. 143446Smrj * 153446Smrj * 2. License 163446Smrj * 173446Smrj * 2.1. This is your license from Intel Corp. under its intellectual property 183446Smrj * rights. You may have additional license terms from the party that provided 193446Smrj * you this software, covering your right to use that party's intellectual 203446Smrj * property rights. 213446Smrj * 223446Smrj * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 233446Smrj * copy of the source code appearing in this file ("Covered Code") an 243446Smrj * irrevocable, perpetual, worldwide license under Intel's copyrights in the 253446Smrj * base code distributed originally by Intel ("Original Intel Code") to copy, 263446Smrj * make derivatives, distribute, use and display any portion of the Covered 273446Smrj * Code in any form, with the right to sublicense such rights; and 283446Smrj * 293446Smrj * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 303446Smrj * license (with the right to sublicense), under only those claims of Intel 313446Smrj * patents that are infringed by the Original Intel Code, to make, use, sell, 323446Smrj * offer to sell, and import the Covered Code and derivative works thereof 333446Smrj * solely to the minimum extent necessary to exercise the above copyright 343446Smrj * license, and in no event shall the patent license extend to any additions 353446Smrj * to or modifications of the Original Intel Code. No other license or right 363446Smrj * is granted directly or by implication, estoppel or otherwise; 373446Smrj * 383446Smrj * The above copyright and patent license is granted only if the following 393446Smrj * conditions are met: 403446Smrj * 413446Smrj * 3. Conditions 423446Smrj * 433446Smrj * 3.1. Redistribution of Source with Rights to Further Distribute Source. 443446Smrj * Redistribution of source code of any substantial portion of the Covered 453446Smrj * Code or modification with rights to further distribute source must include 463446Smrj * the above Copyright Notice, the above License, this list of Conditions, 473446Smrj * and the following Disclaimer and Export Compliance provision. In addition, 483446Smrj * Licensee must cause all Covered Code to which Licensee contributes to 493446Smrj * contain a file documenting the changes Licensee made to create that Covered 503446Smrj * Code and the date of any change. Licensee must include in that file the 513446Smrj * documentation of any changes made by any predecessor Licensee. Licensee 523446Smrj * must include a prominent statement that the modification is derived, 533446Smrj * directly or indirectly, from Original Intel Code. 543446Smrj * 553446Smrj * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 563446Smrj * Redistribution of source code of any substantial portion of the Covered 573446Smrj * Code or modification without rights to further distribute source must 583446Smrj * include the following Disclaimer and Export Compliance provision in the 593446Smrj * documentation and/or other materials provided with distribution. In 603446Smrj * addition, Licensee may not authorize further sublicense of source of any 613446Smrj * portion of the Covered Code, and must include terms to the effect that the 623446Smrj * license from Licensee to its licensee is limited to the intellectual 633446Smrj * property embodied in the software Licensee provides to its licensee, and 643446Smrj * not to intellectual property embodied in modifications its licensee may 653446Smrj * make. 663446Smrj * 673446Smrj * 3.3. Redistribution of Executable. Redistribution in executable form of any 683446Smrj * substantial portion of the Covered Code or modification must reproduce the 693446Smrj * above Copyright Notice, and the following Disclaimer and Export Compliance 703446Smrj * provision in the documentation and/or other materials provided with the 713446Smrj * distribution. 723446Smrj * 733446Smrj * 3.4. Intel retains all right, title, and interest in and to the Original 743446Smrj * Intel Code. 753446Smrj * 763446Smrj * 3.5. Neither the name Intel nor any other trademark owned or controlled by 773446Smrj * Intel shall be used in advertising or otherwise to promote the sale, use or 783446Smrj * other dealings in products derived from or relating to the Covered Code 793446Smrj * without prior written authorization from Intel. 803446Smrj * 813446Smrj * 4. Disclaimer and Export Compliance 823446Smrj * 833446Smrj * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 843446Smrj * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 853446Smrj * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 863446Smrj * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 873446Smrj * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 883446Smrj * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 893446Smrj * PARTICULAR PURPOSE. 903446Smrj * 913446Smrj * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 923446Smrj * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 933446Smrj * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 943446Smrj * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 953446Smrj * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 963446Smrj * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 973446Smrj * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 983446Smrj * LIMITED REMEDY. 993446Smrj * 1003446Smrj * 4.3. Licensee shall not export, either directly or indirectly, any of this 1013446Smrj * software or system incorporating such software without first obtaining any 1023446Smrj * required license or other approval from the U. S. Department of Commerce or 1033446Smrj * any other agency or department of the United States Government. In the 1043446Smrj * event Licensee exports any such software from the United States or 1053446Smrj * re-exports any such software from a foreign destination, Licensee shall 1063446Smrj * ensure that the distribution and export/re-export of the software is in 1073446Smrj * compliance with all laws, regulations, orders, or other restrictions of the 1083446Smrj * U.S. Export Administration Regulations. Licensee agrees that neither it nor 1093446Smrj * any of its subsidiaries will export/re-export any technical data, process, 1103446Smrj * software, or service, directly or indirectly, to any country for which the 1113446Smrj * United States government or any agency thereof requires an export license, 1123446Smrj * other governmental approval, or letter of assurance, without first obtaining 1133446Smrj * such license, approval or letter. 1143446Smrj * 1153446Smrj *****************************************************************************/ 1163446Smrj 1173446Smrj 1183446Smrj #include "acpi.h" 1193446Smrj #include "acdispat.h" 1203446Smrj #include "acnamesp.h" 1213446Smrj #include "acevents.h" 1223446Smrj #include "acdebug.h" 1233446Smrj #include "acresrc.h" 1243446Smrj #include "acdisasm.h" 125*7851SDana.Myers@Sun.COM #include "actables.h" 1263446Smrj #include "acparser.h" 1273446Smrj 1283446Smrj #ifdef ACPI_DEBUGGER 1293446Smrj 1303446Smrj #define _COMPONENT ACPI_CA_DEBUGGER 1313446Smrj ACPI_MODULE_NAME ("dbcmds") 1323446Smrj 1333446Smrj /* Local prototypes */ 1343446Smrj 1353446Smrj static ACPI_STATUS 1363446Smrj AcpiDbIntegrityWalk ( 1373446Smrj ACPI_HANDLE ObjHandle, 1383446Smrj UINT32 NestingLevel, 1393446Smrj void *Context, 1403446Smrj void **ReturnValue); 1413446Smrj 1423446Smrj static ACPI_STATUS 1433446Smrj AcpiDbWalkAndMatchName ( 1443446Smrj ACPI_HANDLE ObjHandle, 1453446Smrj UINT32 NestingLevel, 1463446Smrj void *Context, 1473446Smrj void **ReturnValue); 1483446Smrj 1493446Smrj static ACPI_STATUS 1503446Smrj AcpiDbWalkForReferences ( 1513446Smrj ACPI_HANDLE ObjHandle, 1523446Smrj UINT32 NestingLevel, 1533446Smrj void *Context, 1543446Smrj void **ReturnValue); 1553446Smrj 1563446Smrj static ACPI_STATUS 1573446Smrj AcpiDbWalkForSpecificObjects ( 1583446Smrj ACPI_HANDLE ObjHandle, 1593446Smrj UINT32 NestingLevel, 1603446Smrj void *Context, 1613446Smrj void **ReturnValue); 1623446Smrj 1633446Smrj static ACPI_NAMESPACE_NODE * 1643446Smrj AcpiDbConvertToNode ( 1653446Smrj char *InString); 1663446Smrj 1673446Smrj static void 1683446Smrj AcpiDmCompareAmlResources ( 1693446Smrj UINT8 *Aml1Buffer, 1703446Smrj ACPI_RSDESC_SIZE Aml1BufferLength, 1713446Smrj UINT8 *Aml2Buffer, 1723446Smrj ACPI_RSDESC_SIZE Aml2BufferLength); 1733446Smrj 1743446Smrj static ACPI_STATUS 1753446Smrj AcpiDmTestResourceConversion ( 1763446Smrj ACPI_NAMESPACE_NODE *Node, 1773446Smrj char *Name); 1783446Smrj 1793446Smrj 1803446Smrj /* 1813446Smrj * Arguments for the Objects command 1823446Smrj * These object types map directly to the ACPI_TYPES 1833446Smrj */ 1843446Smrj static ARGUMENT_INFO AcpiDbObjectTypes [] = 1853446Smrj { 1863446Smrj {"ANY"}, 1873446Smrj {"INTEGERS"}, 1883446Smrj {"STRINGS"}, 1893446Smrj {"BUFFERS"}, 1903446Smrj {"PACKAGES"}, 1913446Smrj {"FIELDS"}, 1923446Smrj {"DEVICES"}, 1933446Smrj {"EVENTS"}, 1943446Smrj {"METHODS"}, 1953446Smrj {"MUTEXES"}, 1963446Smrj {"REGIONS"}, 1973446Smrj {"POWERRESOURCES"}, 1983446Smrj {"PROCESSORS"}, 1993446Smrj {"THERMALZONES"}, 2003446Smrj {"BUFFERFIELDS"}, 2013446Smrj {"DDBHANDLES"}, 2023446Smrj {"DEBUG"}, 2033446Smrj {"REGIONFIELDS"}, 2043446Smrj {"BANKFIELDS"}, 2053446Smrj {"INDEXFIELDS"}, 2063446Smrj {"REFERENCES"}, 2073446Smrj {"ALIAS"}, 2083446Smrj {NULL} /* Must be null terminated */ 2093446Smrj }; 2103446Smrj 2113446Smrj 2123446Smrj /******************************************************************************* 2133446Smrj * 2143446Smrj * FUNCTION: AcpiDbConvertToNode 2153446Smrj * 2163446Smrj * PARAMETERS: InString - String to convert 2173446Smrj * 2183446Smrj * RETURN: Pointer to a NS node 2193446Smrj * 2203446Smrj * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or 2213446Smrj * alpha strings. 2223446Smrj * 2233446Smrj ******************************************************************************/ 2243446Smrj 2253446Smrj static ACPI_NAMESPACE_NODE * 2263446Smrj AcpiDbConvertToNode ( 2273446Smrj char *InString) 2283446Smrj { 2293446Smrj ACPI_NAMESPACE_NODE *Node; 2303446Smrj 2313446Smrj 2323446Smrj if ((*InString >= 0x30) && (*InString <= 0x39)) 2333446Smrj { 2343446Smrj /* Numeric argument, convert */ 2353446Smrj 2363446Smrj Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16)); 2373446Smrj if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE))) 2383446Smrj { 2393446Smrj AcpiOsPrintf ("Address %p is invalid in this address space\n", 2403446Smrj Node); 2413446Smrj return (NULL); 2423446Smrj } 2433446Smrj 2443446Smrj /* Make sure pointer is valid NS node */ 2453446Smrj 2463446Smrj if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) 2473446Smrj { 2483446Smrj AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n", 2493446Smrj Node, AcpiUtGetDescriptorName (Node)); 2503446Smrj return (NULL); 2513446Smrj } 2523446Smrj } 2533446Smrj else 2543446Smrj { 2553446Smrj /* Alpha argument */ 2563446Smrj /* The parameter is a name string that must be resolved to a 2573446Smrj * Named obj 2583446Smrj */ 2593446Smrj Node = AcpiDbLocalNsLookup (InString); 2603446Smrj if (!Node) 2613446Smrj { 2623446Smrj Node = AcpiGbl_RootNode; 2633446Smrj } 2643446Smrj } 2653446Smrj 2663446Smrj return (Node); 2673446Smrj } 2683446Smrj 2693446Smrj 2703446Smrj /******************************************************************************* 2713446Smrj * 2723446Smrj * FUNCTION: AcpiDbSleep 2733446Smrj * 2743446Smrj * PARAMETERS: ObjectArg - Desired sleep state (0-5) 2753446Smrj * 2763446Smrj * RETURN: Status 2773446Smrj * 2783446Smrj * DESCRIPTION: Simulate a sleep/wake sequence 2793446Smrj * 2803446Smrj ******************************************************************************/ 2813446Smrj 2823446Smrj ACPI_STATUS 2833446Smrj AcpiDbSleep ( 2843446Smrj char *ObjectArg) 2853446Smrj { 2863446Smrj ACPI_STATUS Status; 2873446Smrj UINT8 SleepState; 2883446Smrj 2893446Smrj 2903446Smrj SleepState = (UINT8) ACPI_STRTOUL (ObjectArg, NULL, 0); 2913446Smrj 2923446Smrj AcpiOsPrintf ("**** Prepare to sleep ****\n"); 2933446Smrj Status = AcpiEnterSleepStatePrep (SleepState); 2943446Smrj if (ACPI_FAILURE (Status)) 2953446Smrj { 2963446Smrj return (Status); 2973446Smrj } 2983446Smrj 2993446Smrj AcpiOsPrintf ("**** Going to sleep ****\n"); 3003446Smrj Status = AcpiEnterSleepState (SleepState); 3013446Smrj if (ACPI_FAILURE (Status)) 3023446Smrj { 3033446Smrj return (Status); 3043446Smrj } 3053446Smrj 3063446Smrj AcpiOsPrintf ("**** returning from sleep ****\n"); 3073446Smrj Status = AcpiLeaveSleepState (SleepState); 3083446Smrj 3093446Smrj return (Status); 3103446Smrj } 3113446Smrj 3123446Smrj 3133446Smrj /******************************************************************************* 3143446Smrj * 3153446Smrj * FUNCTION: AcpiDbWalkForReferences 3163446Smrj * 3173446Smrj * PARAMETERS: Callback from WalkNamespace 3183446Smrj * 3193446Smrj * RETURN: Status 3203446Smrj * 3213446Smrj * DESCRIPTION: Check if this namespace object refers to the target object 3223446Smrj * that is passed in as the context value. 3233446Smrj * 3243446Smrj * Note: Currently doesn't check subobjects within the Node's object 3253446Smrj * 3263446Smrj ******************************************************************************/ 3273446Smrj 3283446Smrj static ACPI_STATUS 3293446Smrj AcpiDbWalkForReferences ( 3303446Smrj ACPI_HANDLE ObjHandle, 3313446Smrj UINT32 NestingLevel, 3323446Smrj void *Context, 3333446Smrj void **ReturnValue) 3343446Smrj { 3353446Smrj ACPI_OPERAND_OBJECT *ObjDesc = (ACPI_OPERAND_OBJECT *) Context; 3363446Smrj ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; 3373446Smrj 3383446Smrj 3393446Smrj /* Check for match against the namespace node itself */ 3403446Smrj 3413446Smrj if (Node == (void *) ObjDesc) 3423446Smrj { 3433446Smrj AcpiOsPrintf ("Object is a Node [%4.4s]\n", 3443446Smrj AcpiUtGetNodeName (Node)); 3453446Smrj } 3463446Smrj 3473446Smrj /* Check for match against the object attached to the node */ 3483446Smrj 3493446Smrj if (AcpiNsGetAttachedObject (Node) == ObjDesc) 3503446Smrj { 3513446Smrj AcpiOsPrintf ("Reference at Node->Object %p [%4.4s]\n", 3523446Smrj Node, AcpiUtGetNodeName (Node)); 3533446Smrj } 3543446Smrj 3553446Smrj return (AE_OK); 3563446Smrj } 3573446Smrj 3583446Smrj 3593446Smrj /******************************************************************************* 3603446Smrj * 3613446Smrj * FUNCTION: AcpiDbFindReferences 3623446Smrj * 3633446Smrj * PARAMETERS: ObjectArg - String with hex value of the object 3643446Smrj * 3653446Smrj * RETURN: None 3663446Smrj * 3673446Smrj * DESCRIPTION: Search namespace for all references to the input object 3683446Smrj * 3693446Smrj ******************************************************************************/ 3703446Smrj 3713446Smrj void 3723446Smrj AcpiDbFindReferences ( 3733446Smrj char *ObjectArg) 3743446Smrj { 3753446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 3763446Smrj 3773446Smrj 3783446Smrj /* Convert string to object pointer */ 3793446Smrj 3803446Smrj ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16)); 3813446Smrj 3823446Smrj /* Search all nodes in namespace */ 3833446Smrj 3843446Smrj (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, 3853446Smrj AcpiDbWalkForReferences, (void *) ObjDesc, NULL); 3863446Smrj } 3873446Smrj 3883446Smrj 3893446Smrj /******************************************************************************* 3903446Smrj * 3913446Smrj * FUNCTION: AcpiDbDisplayLocks 3923446Smrj * 3933446Smrj * PARAMETERS: None 3943446Smrj * 3953446Smrj * RETURN: None 3963446Smrj * 3973446Smrj * DESCRIPTION: Display information about internal mutexes. 3983446Smrj * 3993446Smrj ******************************************************************************/ 4003446Smrj 4013446Smrj void 4023446Smrj AcpiDbDisplayLocks ( 4033446Smrj void) 4043446Smrj { 4053446Smrj UINT32 i; 4063446Smrj 4073446Smrj 4083446Smrj for (i = 0; i < ACPI_MAX_MUTEX; i++) 4093446Smrj { 4103446Smrj AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i), 4113446Smrj AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED 4123446Smrj ? "Locked" : "Unlocked"); 4133446Smrj } 4143446Smrj } 4153446Smrj 4163446Smrj 4173446Smrj /******************************************************************************* 4183446Smrj * 4193446Smrj * FUNCTION: AcpiDbDisplayTableInfo 4203446Smrj * 4213446Smrj * PARAMETERS: TableArg - String with name of table to be displayed 4223446Smrj * 4233446Smrj * RETURN: None 4243446Smrj * 4253446Smrj * DESCRIPTION: Display information about loaded tables. Current 4263446Smrj * implementation displays all loaded tables. 4273446Smrj * 4283446Smrj ******************************************************************************/ 4293446Smrj 4303446Smrj void 4313446Smrj AcpiDbDisplayTableInfo ( 4323446Smrj char *TableArg) 4333446Smrj { 4343446Smrj UINT32 i; 4353446Smrj ACPI_TABLE_DESC *TableDesc; 4363446Smrj 4373446Smrj 438*7851SDana.Myers@Sun.COM /* Walk the entire root table list */ 439*7851SDana.Myers@Sun.COM 440*7851SDana.Myers@Sun.COM for (i = 0; i < AcpiGbl_RootTableList.Count; i++) 4413446Smrj { 442*7851SDana.Myers@Sun.COM TableDesc = &AcpiGbl_RootTableList.Tables[i]; 443*7851SDana.Myers@Sun.COM AcpiOsPrintf ("%d ", i); 444*7851SDana.Myers@Sun.COM 445*7851SDana.Myers@Sun.COM /* Make sure that the table is mapped */ 446*7851SDana.Myers@Sun.COM 447*7851SDana.Myers@Sun.COM AcpiTbVerifyTable (TableDesc); 4483446Smrj 449*7851SDana.Myers@Sun.COM /* Dump the table header */ 4503446Smrj 451*7851SDana.Myers@Sun.COM if (TableDesc->Pointer) 452*7851SDana.Myers@Sun.COM { 453*7851SDana.Myers@Sun.COM AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer); 454*7851SDana.Myers@Sun.COM } 455*7851SDana.Myers@Sun.COM else 456*7851SDana.Myers@Sun.COM { 457*7851SDana.Myers@Sun.COM /* If the pointer is null, the table has been unloaded */ 458*7851SDana.Myers@Sun.COM 459*7851SDana.Myers@Sun.COM ACPI_INFO ((AE_INFO, "%4.4s - Table has been unloaded", 460*7851SDana.Myers@Sun.COM TableDesc->Signature.Ascii)); 4613446Smrj } 4623446Smrj } 4633446Smrj } 4643446Smrj 4653446Smrj 4663446Smrj /******************************************************************************* 4673446Smrj * 4683446Smrj * FUNCTION: AcpiDbUnloadAcpiTable 4693446Smrj * 4703446Smrj * PARAMETERS: TableArg - Name of the table to be unloaded 4713446Smrj * InstanceArg - Which instance of the table to unload (if 4723446Smrj * there are multiple tables of the same type) 4733446Smrj * 4743446Smrj * RETURN: Nonde 4753446Smrj * 4763446Smrj * DESCRIPTION: Unload an ACPI table. 4773446Smrj * Instance is not implemented 4783446Smrj * 4793446Smrj ******************************************************************************/ 4803446Smrj 4813446Smrj void 4823446Smrj AcpiDbUnloadAcpiTable ( 4833446Smrj char *TableArg, 4843446Smrj char *InstanceArg) 4853446Smrj { 486*7851SDana.Myers@Sun.COM /* TBD: Need to reimplement for new data structures */ 487*7851SDana.Myers@Sun.COM 488*7851SDana.Myers@Sun.COM #if 0 4893446Smrj UINT32 i; 4903446Smrj ACPI_STATUS Status; 4913446Smrj 4923446Smrj 4933446Smrj /* Search all tables for the target type */ 4943446Smrj 4953446Smrj for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++) 4963446Smrj { 4973446Smrj if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature, 4983446Smrj AcpiGbl_TableData[i].SigLength)) 4993446Smrj { 5003446Smrj /* Found the table, unload it */ 5013446Smrj 5023446Smrj Status = AcpiUnloadTable (i); 5033446Smrj if (ACPI_SUCCESS (Status)) 5043446Smrj { 5053446Smrj AcpiOsPrintf ("[%s] unloaded and uninstalled\n", TableArg); 5063446Smrj } 5073446Smrj else 5083446Smrj { 5093446Smrj AcpiOsPrintf ("%s, while unloading [%s]\n", 5103446Smrj AcpiFormatException (Status), TableArg); 5113446Smrj } 5123446Smrj 5133446Smrj return; 5143446Smrj } 5153446Smrj } 5163446Smrj 5173446Smrj AcpiOsPrintf ("Unknown table type [%s]\n", TableArg); 518*7851SDana.Myers@Sun.COM #endif 5193446Smrj } 5203446Smrj 5213446Smrj 5223446Smrj /******************************************************************************* 5233446Smrj * 5243446Smrj * FUNCTION: AcpiDbSetMethodBreakpoint 5253446Smrj * 5263446Smrj * PARAMETERS: Location - AML offset of breakpoint 5273446Smrj * WalkState - Current walk info 5283446Smrj * Op - Current Op (from parse walk) 5293446Smrj * 5303446Smrj * RETURN: None 5313446Smrj * 5323446Smrj * DESCRIPTION: Set a breakpoint in a control method at the specified 5333446Smrj * AML offset 5343446Smrj * 5353446Smrj ******************************************************************************/ 5363446Smrj 5373446Smrj void 5383446Smrj AcpiDbSetMethodBreakpoint ( 5393446Smrj char *Location, 5403446Smrj ACPI_WALK_STATE *WalkState, 5413446Smrj ACPI_PARSE_OBJECT *Op) 5423446Smrj { 5433446Smrj UINT32 Address; 5443446Smrj 5453446Smrj 5463446Smrj if (!Op) 5473446Smrj { 5483446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 5493446Smrj return; 5503446Smrj } 5513446Smrj 5523446Smrj /* Get and verify the breakpoint address */ 5533446Smrj 5543446Smrj Address = ACPI_STRTOUL (Location, NULL, 16); 5553446Smrj if (Address <= Op->Common.AmlOffset) 5563446Smrj { 5573446Smrj AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", 5583446Smrj Address, Op->Common.AmlOffset); 5593446Smrj } 5603446Smrj 5613446Smrj /* Save breakpoint in current walk */ 5623446Smrj 5633446Smrj WalkState->UserBreakpoint = Address; 5643446Smrj AcpiOsPrintf ("Breakpoint set at AML offset %X\n", Address); 5653446Smrj } 5663446Smrj 5673446Smrj 5683446Smrj /******************************************************************************* 5693446Smrj * 5703446Smrj * FUNCTION: AcpiDbSetMethodCallBreakpoint 5713446Smrj * 5723446Smrj * PARAMETERS: Op - Current Op (from parse walk) 5733446Smrj * 5743446Smrj * RETURN: None 5753446Smrj * 5763446Smrj * DESCRIPTION: Set a breakpoint in a control method at the specified 5773446Smrj * AML offset 5783446Smrj * 5793446Smrj ******************************************************************************/ 5803446Smrj 5813446Smrj void 5823446Smrj AcpiDbSetMethodCallBreakpoint ( 5833446Smrj ACPI_PARSE_OBJECT *Op) 5843446Smrj { 5853446Smrj 5863446Smrj 5873446Smrj if (!Op) 5883446Smrj { 5893446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 5903446Smrj return; 5913446Smrj } 5923446Smrj 5933446Smrj AcpiGbl_StepToNextCall = TRUE; 5943446Smrj } 5953446Smrj 5963446Smrj 5973446Smrj /******************************************************************************* 5983446Smrj * 5993446Smrj * FUNCTION: AcpiDbDisassembleAml 6003446Smrj * 6013446Smrj * PARAMETERS: Statements - Number of statements to disassemble 6023446Smrj * Op - Current Op (from parse walk) 6033446Smrj * 6043446Smrj * RETURN: None 6053446Smrj * 6063446Smrj * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number 6073446Smrj * of statements specified. 6083446Smrj * 6093446Smrj ******************************************************************************/ 6103446Smrj 6113446Smrj void 6123446Smrj AcpiDbDisassembleAml ( 6133446Smrj char *Statements, 6143446Smrj ACPI_PARSE_OBJECT *Op) 6153446Smrj { 6163446Smrj UINT32 NumStatements = 8; 6173446Smrj 6183446Smrj 6193446Smrj if (!Op) 6203446Smrj { 6213446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 6223446Smrj return; 6233446Smrj } 6243446Smrj 6253446Smrj if (Statements) 6263446Smrj { 6273446Smrj NumStatements = ACPI_STRTOUL (Statements, NULL, 0); 6283446Smrj } 6293446Smrj 6303446Smrj AcpiDmDisassemble (NULL, Op, NumStatements); 6313446Smrj } 6323446Smrj 6333446Smrj 6343446Smrj /******************************************************************************* 6353446Smrj * 6363446Smrj * FUNCTION: AcpiDbDisassembleMethod 6373446Smrj * 6383446Smrj * PARAMETERS: Name - Name of control method 6393446Smrj * 6403446Smrj * RETURN: None 6413446Smrj * 6423446Smrj * DESCRIPTION: Display disassembled AML (ASL) starting from Op for the number 6433446Smrj * of statements specified. 6443446Smrj * 6453446Smrj ******************************************************************************/ 6463446Smrj 6473446Smrj ACPI_STATUS 6483446Smrj AcpiDbDisassembleMethod ( 6493446Smrj char *Name) 6503446Smrj { 6513446Smrj ACPI_STATUS Status; 6523446Smrj ACPI_PARSE_OBJECT *Op; 6533446Smrj ACPI_WALK_STATE *WalkState; 6543446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 6553446Smrj ACPI_NAMESPACE_NODE *Method; 6563446Smrj 6573446Smrj 6583446Smrj Method = AcpiDbConvertToNode (Name); 6593446Smrj if (!Method) 6603446Smrj { 6613446Smrj return (AE_BAD_PARAMETER); 6623446Smrj } 6633446Smrj 6643446Smrj ObjDesc = Method->Object; 6653446Smrj 6663446Smrj Op = AcpiPsCreateScopeOp (); 6673446Smrj if (!Op) 6683446Smrj { 6693446Smrj return (AE_NO_MEMORY); 6703446Smrj } 6713446Smrj 6723446Smrj /* Create and initialize a new walk state */ 6733446Smrj 6743446Smrj WalkState = AcpiDsCreateWalkState (0, Op, NULL, NULL); 6753446Smrj if (!WalkState) 6763446Smrj { 6773446Smrj return (AE_NO_MEMORY); 6783446Smrj } 6793446Smrj 6803446Smrj Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, 6813446Smrj ObjDesc->Method.AmlStart, 682*7851SDana.Myers@Sun.COM ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1); 6833446Smrj if (ACPI_FAILURE (Status)) 6843446Smrj { 6853446Smrj return (Status); 6863446Smrj } 6873446Smrj 6883446Smrj /* Parse the AML */ 6893446Smrj 6903446Smrj WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; 6913446Smrj WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE; 6923446Smrj Status = AcpiPsParseAml (WalkState); 6933446Smrj 6943446Smrj AcpiDmDisassemble (NULL, Op, 0); 6953446Smrj AcpiPsDeleteParseTree (Op); 6963446Smrj return (AE_OK); 6973446Smrj } 6983446Smrj 6993446Smrj 7003446Smrj /******************************************************************************* 7013446Smrj * 7023446Smrj * FUNCTION: AcpiDbDumpNamespace 7033446Smrj * 7043446Smrj * PARAMETERS: StartArg - Node to begin namespace dump 7053446Smrj * DepthArg - Maximum tree depth to be dumped 7063446Smrj * 7073446Smrj * RETURN: None 7083446Smrj * 7093446Smrj * DESCRIPTION: Dump entire namespace or a subtree. Each node is displayed 7103446Smrj * with type and other information. 7113446Smrj * 7123446Smrj ******************************************************************************/ 7133446Smrj 7143446Smrj void 7153446Smrj AcpiDbDumpNamespace ( 7163446Smrj char *StartArg, 7173446Smrj char *DepthArg) 7183446Smrj { 7193446Smrj ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode; 7203446Smrj UINT32 MaxDepth = ACPI_UINT32_MAX; 7213446Smrj 7223446Smrj 7233446Smrj /* No argument given, just start at the root and dump entire namespace */ 7243446Smrj 7253446Smrj if (StartArg) 7263446Smrj { 7273446Smrj SubtreeEntry = AcpiDbConvertToNode (StartArg); 7283446Smrj if (!SubtreeEntry) 7293446Smrj { 7303446Smrj return; 7313446Smrj } 7323446Smrj 7333446Smrj /* Now we can check for the depth argument */ 7343446Smrj 7353446Smrj if (DepthArg) 7363446Smrj { 7373446Smrj MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); 7383446Smrj } 7393446Smrj } 7403446Smrj 7413446Smrj AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); 7423446Smrj AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n", 7433446Smrj ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry); 7443446Smrj 7453446Smrj /* Display the subtree */ 7463446Smrj 7473446Smrj AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); 7483446Smrj AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, 7493446Smrj ACPI_OWNER_ID_MAX, SubtreeEntry); 7503446Smrj AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); 7513446Smrj } 7523446Smrj 7533446Smrj 7543446Smrj /******************************************************************************* 7553446Smrj * 7563446Smrj * FUNCTION: AcpiDbDumpNamespaceByOwner 7573446Smrj * 7583446Smrj * PARAMETERS: OwnerArg - Owner ID whose nodes will be displayed 7593446Smrj * DepthArg - Maximum tree depth to be dumped 7603446Smrj * 7613446Smrj * RETURN: None 7623446Smrj * 7633446Smrj * DESCRIPTION: Dump elements of the namespace that are owned by the OwnerId. 7643446Smrj * 7653446Smrj ******************************************************************************/ 7663446Smrj 7673446Smrj void 7683446Smrj AcpiDbDumpNamespaceByOwner ( 7693446Smrj char *OwnerArg, 7703446Smrj char *DepthArg) 7713446Smrj { 7723446Smrj ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode; 7733446Smrj UINT32 MaxDepth = ACPI_UINT32_MAX; 7743446Smrj ACPI_OWNER_ID OwnerId; 7753446Smrj 7763446Smrj 7773446Smrj OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0); 7783446Smrj 7793446Smrj /* Now we can check for the depth argument */ 7803446Smrj 7813446Smrj if (DepthArg) 7823446Smrj { 7833446Smrj MaxDepth = ACPI_STRTOUL (DepthArg, NULL, 0); 7843446Smrj } 7853446Smrj 7863446Smrj AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); 7873446Smrj AcpiOsPrintf ("ACPI Namespace by owner %X:\n", OwnerId); 7883446Smrj 7893446Smrj /* Display the subtree */ 7903446Smrj 7913446Smrj AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); 7923446Smrj AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, 7933446Smrj SubtreeEntry); 7943446Smrj AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); 7953446Smrj } 7963446Smrj 7973446Smrj 7983446Smrj /******************************************************************************* 7993446Smrj * 8003446Smrj * FUNCTION: AcpiDbSendNotify 8013446Smrj * 8023446Smrj * PARAMETERS: Name - Name of ACPI object to send the notify to 8033446Smrj * Value - Value of the notify to send. 8043446Smrj * 8053446Smrj * RETURN: None 8063446Smrj * 8073446Smrj * DESCRIPTION: Send an ACPI notification. The value specified is sent to the 8083446Smrj * named object as an ACPI notify. 8093446Smrj * 8103446Smrj ******************************************************************************/ 8113446Smrj 8123446Smrj void 8133446Smrj AcpiDbSendNotify ( 8143446Smrj char *Name, 8153446Smrj UINT32 Value) 8163446Smrj { 8173446Smrj ACPI_NAMESPACE_NODE *Node; 8183446Smrj ACPI_STATUS Status; 8193446Smrj 8203446Smrj 8213446Smrj /* Translate name to an Named object */ 8223446Smrj 8233446Smrj Node = AcpiDbConvertToNode (Name); 8243446Smrj if (!Node) 8253446Smrj { 8263446Smrj return; 8273446Smrj } 8283446Smrj 8293446Smrj /* Decode Named object type */ 8303446Smrj 8313446Smrj switch (Node->Type) 8323446Smrj { 8333446Smrj case ACPI_TYPE_DEVICE: 8343446Smrj case ACPI_TYPE_THERMAL: 8353446Smrj 8363446Smrj /* Send the notify */ 8373446Smrj 8383446Smrj Status = AcpiEvQueueNotifyRequest (Node, Value); 8393446Smrj if (ACPI_FAILURE (Status)) 8403446Smrj { 8413446Smrj AcpiOsPrintf ("Could not queue notify\n"); 8423446Smrj } 8433446Smrj break; 8443446Smrj 8453446Smrj default: 8463446Smrj AcpiOsPrintf ("Named object is not a device or a thermal object\n"); 8473446Smrj break; 8483446Smrj } 8493446Smrj } 8503446Smrj 8513446Smrj 8523446Smrj /******************************************************************************* 8533446Smrj * 8543446Smrj * FUNCTION: AcpiDbSetMethodData 8553446Smrj * 8563446Smrj * PARAMETERS: TypeArg - L for local, A for argument 8573446Smrj * IndexArg - which one 8583446Smrj * ValueArg - Value to set. 8593446Smrj * 8603446Smrj * RETURN: None 8613446Smrj * 8623446Smrj * DESCRIPTION: Set a local or argument for the running control method. 8633446Smrj * NOTE: only object supported is Number. 8643446Smrj * 8653446Smrj ******************************************************************************/ 8663446Smrj 8673446Smrj void 8683446Smrj AcpiDbSetMethodData ( 8693446Smrj char *TypeArg, 8703446Smrj char *IndexArg, 8713446Smrj char *ValueArg) 8723446Smrj { 8733446Smrj char Type; 8743446Smrj UINT32 Index; 8753446Smrj UINT32 Value; 8763446Smrj ACPI_WALK_STATE *WalkState; 8773446Smrj ACPI_OPERAND_OBJECT *ObjDesc; 8783446Smrj ACPI_STATUS Status; 8793446Smrj ACPI_NAMESPACE_NODE *Node; 8803446Smrj 8813446Smrj 8823446Smrj /* Validate TypeArg */ 8833446Smrj 8843446Smrj AcpiUtStrupr (TypeArg); 8853446Smrj Type = TypeArg[0]; 8863446Smrj if ((Type != 'L') && 8873446Smrj (Type != 'A') && 8883446Smrj (Type != 'N')) 8893446Smrj { 8903446Smrj AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg); 8913446Smrj return; 8923446Smrj } 8933446Smrj 8943446Smrj Value = ACPI_STRTOUL (ValueArg, NULL, 16); 8953446Smrj 8963446Smrj if (Type == 'N') 8973446Smrj { 8983446Smrj Node = AcpiDbConvertToNode (IndexArg); 8993446Smrj if (Node->Type != ACPI_TYPE_INTEGER) 9003446Smrj { 9013446Smrj AcpiOsPrintf ("Can only set Integer nodes\n"); 9023446Smrj return; 9033446Smrj } 9043446Smrj ObjDesc = Node->Object; 9053446Smrj ObjDesc->Integer.Value = Value; 9063446Smrj return; 9073446Smrj } 9083446Smrj 9093446Smrj /* Get the index and value */ 9103446Smrj 9113446Smrj Index = ACPI_STRTOUL (IndexArg, NULL, 16); 9123446Smrj 9133446Smrj WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList); 9143446Smrj if (!WalkState) 9153446Smrj { 9163446Smrj AcpiOsPrintf ("There is no method currently executing\n"); 9173446Smrj return; 9183446Smrj } 9193446Smrj 9203446Smrj /* Create and initialize the new object */ 9213446Smrj 9223446Smrj ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER); 9233446Smrj if (!ObjDesc) 9243446Smrj { 9253446Smrj AcpiOsPrintf ("Could not create an internal object\n"); 9263446Smrj return; 9273446Smrj } 9283446Smrj 9293446Smrj ObjDesc->Integer.Value = Value; 9303446Smrj 9313446Smrj /* Store the new object into the target */ 9323446Smrj 9333446Smrj switch (Type) 9343446Smrj { 9353446Smrj case 'A': 9363446Smrj 9373446Smrj /* Set a method argument */ 9383446Smrj 9393446Smrj if (Index > ACPI_METHOD_MAX_ARG) 9403446Smrj { 9413446Smrj AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index); 9423446Smrj goto Cleanup; 9433446Smrj } 9443446Smrj 945*7851SDana.Myers@Sun.COM Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_ARG, Index, ObjDesc, 9463446Smrj WalkState); 9473446Smrj if (ACPI_FAILURE (Status)) 9483446Smrj { 9493446Smrj goto Cleanup; 9503446Smrj } 9513446Smrj 9523446Smrj ObjDesc = WalkState->Arguments[Index].Object; 9533446Smrj 9543446Smrj AcpiOsPrintf ("Arg%d: ", Index); 9553446Smrj AcpiDmDisplayInternalObject (ObjDesc, WalkState); 9563446Smrj break; 9573446Smrj 9583446Smrj case 'L': 9593446Smrj 9603446Smrj /* Set a method local */ 9613446Smrj 9623446Smrj if (Index > ACPI_METHOD_MAX_LOCAL) 9633446Smrj { 9643446Smrj AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index); 9653446Smrj goto Cleanup; 9663446Smrj } 9673446Smrj 968*7851SDana.Myers@Sun.COM Status = AcpiDsStoreObjectToLocal (ACPI_REFCLASS_LOCAL, Index, ObjDesc, 9693446Smrj WalkState); 9703446Smrj if (ACPI_FAILURE (Status)) 9713446Smrj { 9723446Smrj goto Cleanup; 9733446Smrj } 9743446Smrj 9753446Smrj ObjDesc = WalkState->LocalVariables[Index].Object; 9763446Smrj 9773446Smrj AcpiOsPrintf ("Local%d: ", Index); 9783446Smrj AcpiDmDisplayInternalObject (ObjDesc, WalkState); 9793446Smrj break; 9803446Smrj 9813446Smrj default: 9823446Smrj break; 9833446Smrj } 9843446Smrj 9853446Smrj Cleanup: 9863446Smrj AcpiUtRemoveReference (ObjDesc); 9873446Smrj } 9883446Smrj 9893446Smrj 9903446Smrj /******************************************************************************* 9913446Smrj * 9923446Smrj * FUNCTION: AcpiDbWalkForSpecificObjects 9933446Smrj * 9943446Smrj * PARAMETERS: Callback from WalkNamespace 9953446Smrj * 9963446Smrj * RETURN: Status 9973446Smrj * 9983446Smrj * DESCRIPTION: Display short info about objects in the namespace 9993446Smrj * 10003446Smrj ******************************************************************************/ 10013446Smrj 10023446Smrj static ACPI_STATUS 10033446Smrj AcpiDbWalkForSpecificObjects ( 10043446Smrj ACPI_HANDLE ObjHandle, 10053446Smrj UINT32 NestingLevel, 10063446Smrj void *Context, 10073446Smrj void **ReturnValue) 10083446Smrj { 10093446Smrj ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context; 10103446Smrj ACPI_BUFFER Buffer; 10113446Smrj ACPI_STATUS Status; 10123446Smrj 10133446Smrj 10143446Smrj Info->Count++; 10153446Smrj 10163446Smrj /* Get and display the full pathname to this object */ 10173446Smrj 10183446Smrj Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 10193446Smrj Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); 10203446Smrj if (ACPI_FAILURE (Status)) 10213446Smrj { 10223446Smrj AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); 10233446Smrj return (AE_OK); 10243446Smrj } 10253446Smrj 10263446Smrj AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); 10273446Smrj ACPI_FREE (Buffer.Pointer); 10283446Smrj 10293446Smrj /* Dump short info about the object */ 10303446Smrj 10313446Smrj (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL); 10323446Smrj return (AE_OK); 10333446Smrj } 10343446Smrj 10353446Smrj 10363446Smrj /******************************************************************************* 10373446Smrj * 10383446Smrj * FUNCTION: AcpiDbDisplayObjects 10393446Smrj * 10403446Smrj * PARAMETERS: ObjTypeArg - Type of object to display 10413446Smrj * DisplayCountArg - Max depth to display 10423446Smrj * 10433446Smrj * RETURN: None 10443446Smrj * 10453446Smrj * DESCRIPTION: Display objects in the namespace of the requested type 10463446Smrj * 10473446Smrj ******************************************************************************/ 10483446Smrj 10493446Smrj ACPI_STATUS 10503446Smrj AcpiDbDisplayObjects ( 10513446Smrj char *ObjTypeArg, 10523446Smrj char *DisplayCountArg) 10533446Smrj { 10543446Smrj ACPI_WALK_INFO Info; 10553446Smrj ACPI_OBJECT_TYPE Type; 10563446Smrj 10573446Smrj 10583446Smrj /* Get the object type */ 10593446Smrj 10603446Smrj Type = AcpiDbMatchArgument (ObjTypeArg, AcpiDbObjectTypes); 10613446Smrj if (Type == ACPI_TYPE_NOT_FOUND) 10623446Smrj { 10633446Smrj AcpiOsPrintf ("Invalid or unsupported argument\n"); 10643446Smrj return (AE_OK); 10653446Smrj } 10663446Smrj 10673446Smrj AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT); 10683446Smrj AcpiOsPrintf ( 10693446Smrj "Objects of type [%s] defined in the current ACPI Namespace:\n", 10703446Smrj AcpiUtGetTypeName (Type)); 10713446Smrj 10723446Smrj AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); 10733446Smrj 10743446Smrj Info.Count = 0; 10753446Smrj Info.OwnerId = ACPI_OWNER_ID_MAX; 10763446Smrj Info.DebugLevel = ACPI_UINT32_MAX; 10773446Smrj Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; 10783446Smrj 10793446Smrj /* Walk the namespace from the root */ 10803446Smrj 10813446Smrj (void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, 10823446Smrj AcpiDbWalkForSpecificObjects, (void *) &Info, NULL); 10833446Smrj 10843446Smrj AcpiOsPrintf ( 10853446Smrj "\nFound %u objects of type [%s] in the current ACPI Namespace\n", 10863446Smrj Info.Count, AcpiUtGetTypeName (Type)); 10873446Smrj 10883446Smrj AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); 10893446Smrj return (AE_OK); 10903446Smrj } 10913446Smrj 10923446Smrj 10933446Smrj /******************************************************************************* 10943446Smrj * 10953446Smrj * FUNCTION: AcpiDbWalkAndMatchName 10963446Smrj * 10973446Smrj * PARAMETERS: Callback from WalkNamespace 10983446Smrj * 10993446Smrj * RETURN: Status 11003446Smrj * 11013446Smrj * DESCRIPTION: Find a particular name/names within the namespace. Wildcards 11023446Smrj * are supported -- '?' matches any character. 11033446Smrj * 11043446Smrj ******************************************************************************/ 11053446Smrj 11063446Smrj static ACPI_STATUS 11073446Smrj AcpiDbWalkAndMatchName ( 11083446Smrj ACPI_HANDLE ObjHandle, 11093446Smrj UINT32 NestingLevel, 11103446Smrj void *Context, 11113446Smrj void **ReturnValue) 11123446Smrj { 11133446Smrj ACPI_STATUS Status; 11143446Smrj char *RequestedName = (char *) Context; 11153446Smrj UINT32 i; 11163446Smrj ACPI_BUFFER Buffer; 11173446Smrj ACPI_WALK_INFO Info; 11183446Smrj 11193446Smrj 11203446Smrj /* Check for a name match */ 11213446Smrj 11223446Smrj for (i = 0; i < 4; i++) 11233446Smrj { 11243446Smrj /* Wildcard support */ 11253446Smrj 11263446Smrj if ((RequestedName[i] != '?') && 11273446Smrj (RequestedName[i] != ((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Ascii[i])) 11283446Smrj { 11293446Smrj /* No match, just exit */ 11303446Smrj 11313446Smrj return (AE_OK); 11323446Smrj } 11333446Smrj } 11343446Smrj 11353446Smrj /* Get the full pathname to this object */ 11363446Smrj 11373446Smrj Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 11383446Smrj Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); 11393446Smrj if (ACPI_FAILURE (Status)) 11403446Smrj { 11413446Smrj AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); 11423446Smrj } 11433446Smrj else 11443446Smrj { 11453446Smrj Info.OwnerId = ACPI_OWNER_ID_MAX; 11463446Smrj Info.DebugLevel = ACPI_UINT32_MAX; 11473446Smrj Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT; 11483446Smrj 11493446Smrj AcpiOsPrintf ("%32s", (char *) Buffer.Pointer); 11503446Smrj (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL); 11513446Smrj ACPI_FREE (Buffer.Pointer); 11523446Smrj } 11533446Smrj 11543446Smrj return (AE_OK); 11553446Smrj } 11563446Smrj 11573446Smrj 11583446Smrj /******************************************************************************* 11593446Smrj * 11603446Smrj * FUNCTION: AcpiDbFindNameInNamespace 11613446Smrj * 11623446Smrj * PARAMETERS: NameArg - The 4-character ACPI name to find. 11633446Smrj * wildcards are supported. 11643446Smrj * 11653446Smrj * RETURN: None 11663446Smrj * 11673446Smrj * DESCRIPTION: Search the namespace for a given name (with wildcards) 11683446Smrj * 11693446Smrj ******************************************************************************/ 11703446Smrj 11713446Smrj ACPI_STATUS 11723446Smrj AcpiDbFindNameInNamespace ( 11733446Smrj char *NameArg) 11743446Smrj { 11753446Smrj 11763446Smrj if (ACPI_STRLEN (NameArg) > 4) 11773446Smrj { 11783446Smrj AcpiOsPrintf ("Name must be no longer than 4 characters\n"); 11793446Smrj return (AE_OK); 11803446Smrj } 11813446Smrj 11823446Smrj /* Walk the namespace from the root */ 11833446Smrj 11843446Smrj AcpiUtStrupr (NameArg); 11853446Smrj (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, 11863446Smrj AcpiDbWalkAndMatchName, NameArg, NULL); 11873446Smrj 11883446Smrj AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); 11893446Smrj return (AE_OK); 11903446Smrj } 11913446Smrj 11923446Smrj 11933446Smrj /******************************************************************************* 11943446Smrj * 11953446Smrj * FUNCTION: AcpiDbSetScope 11963446Smrj * 11973446Smrj * PARAMETERS: Name - New scope path 11983446Smrj * 11993446Smrj * RETURN: Status 12003446Smrj * 12013446Smrj * DESCRIPTION: Set the "current scope" as maintained by this utility. 12023446Smrj * The scope is used as a prefix to ACPI paths. 12033446Smrj * 12043446Smrj ******************************************************************************/ 12053446Smrj 12063446Smrj void 12073446Smrj AcpiDbSetScope ( 12083446Smrj char *Name) 12093446Smrj { 12103446Smrj ACPI_STATUS Status; 12113446Smrj ACPI_NAMESPACE_NODE *Node; 12123446Smrj 12133446Smrj 12143446Smrj if (!Name || Name[0] == 0) 12153446Smrj { 12163446Smrj AcpiOsPrintf ("Current scope: %s\n", AcpiGbl_DbScopeBuf); 12173446Smrj return; 12183446Smrj } 12193446Smrj 12203446Smrj AcpiDbPrepNamestring (Name); 12213446Smrj 12223446Smrj if (Name[0] == '\\') 12233446Smrj { 12243446Smrj /* Validate new scope from the root */ 12253446Smrj 12263446Smrj Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH, 12273446Smrj &Node); 12283446Smrj if (ACPI_FAILURE (Status)) 12293446Smrj { 12303446Smrj goto ErrorExit; 12313446Smrj } 12323446Smrj 12333446Smrj ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name); 12343446Smrj ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\"); 12353446Smrj } 12363446Smrj else 12373446Smrj { 12383446Smrj /* Validate new scope relative to old scope */ 12393446Smrj 12403446Smrj Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH, 12413446Smrj &Node); 12423446Smrj if (ACPI_FAILURE (Status)) 12433446Smrj { 12443446Smrj goto ErrorExit; 12453446Smrj } 12463446Smrj 12473446Smrj ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name); 12483446Smrj ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\"); 12493446Smrj } 12503446Smrj 12513446Smrj AcpiGbl_DbScopeNode = Node; 12523446Smrj AcpiOsPrintf ("New scope: %s\n", AcpiGbl_DbScopeBuf); 12533446Smrj return; 12543446Smrj 12553446Smrj ErrorExit: 12563446Smrj 12573446Smrj AcpiOsPrintf ("Could not attach scope: %s, %s\n", 12583446Smrj Name, AcpiFormatException (Status)); 12593446Smrj } 12603446Smrj 12613446Smrj 12623446Smrj /******************************************************************************* 12633446Smrj * 12643446Smrj * FUNCTION: AcpiDmCompareAmlResources 12653446Smrj * 12663446Smrj * PARAMETERS: Aml1Buffer - Contains first resource list 12673446Smrj * Aml1BufferLength - Length of first resource list 12683446Smrj * Aml2Buffer - Contains second resource list 12693446Smrj * Aml2BufferLength - Length of second resource list 12703446Smrj * 12713446Smrj * RETURN: None 12723446Smrj * 12733446Smrj * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in 12743446Smrj * order to isolate a miscompare to an individual resource) 12753446Smrj * 12763446Smrj ******************************************************************************/ 12773446Smrj 12783446Smrj static void 12793446Smrj AcpiDmCompareAmlResources ( 12803446Smrj UINT8 *Aml1Buffer, 12813446Smrj ACPI_RSDESC_SIZE Aml1BufferLength, 12823446Smrj UINT8 *Aml2Buffer, 12833446Smrj ACPI_RSDESC_SIZE Aml2BufferLength) 12843446Smrj { 12853446Smrj UINT8 *Aml1; 12863446Smrj UINT8 *Aml2; 12873446Smrj ACPI_RSDESC_SIZE Aml1Length; 12883446Smrj ACPI_RSDESC_SIZE Aml2Length; 12893446Smrj ACPI_RSDESC_SIZE Offset = 0; 12903446Smrj UINT8 ResourceType; 12913446Smrj UINT32 Count = 0; 12923446Smrj 12933446Smrj 12943446Smrj /* Compare overall buffer sizes (may be different due to size rounding) */ 12953446Smrj 12963446Smrj if (Aml1BufferLength != Aml2BufferLength) 12973446Smrj { 12983446Smrj AcpiOsPrintf ( 12993446Smrj "**** Buffer length mismatch in converted AML: original %X new %X ****\n", 13003446Smrj Aml1BufferLength, Aml2BufferLength); 13013446Smrj } 13023446Smrj 13033446Smrj Aml1 = Aml1Buffer; 13043446Smrj Aml2 = Aml2Buffer; 13053446Smrj 13063446Smrj /* Walk the descriptor lists, comparing each descriptor */ 13073446Smrj 13083446Smrj while (Aml1 < (Aml1Buffer + Aml1BufferLength)) 13093446Smrj { 13103446Smrj /* Get the lengths of each descriptor */ 13113446Smrj 13123446Smrj Aml1Length = AcpiUtGetDescriptorLength (Aml1); 13133446Smrj Aml2Length = AcpiUtGetDescriptorLength (Aml2); 13143446Smrj ResourceType = AcpiUtGetResourceType (Aml1); 13153446Smrj 13163446Smrj /* Check for descriptor length match */ 13173446Smrj 13183446Smrj if (Aml1Length != Aml2Length) 13193446Smrj { 13203446Smrj AcpiOsPrintf ( 13213446Smrj "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n", 13223446Smrj Count, ResourceType, Offset, Aml1Length, Aml2Length); 13233446Smrj } 13243446Smrj 13253446Smrj /* Check for descriptor byte match */ 13263446Smrj 13273446Smrj else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length)) 13283446Smrj { 13293446Smrj AcpiOsPrintf ( 13303446Smrj "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n", 13313446Smrj Count, ResourceType, Offset); 13323446Smrj } 13333446Smrj 13343446Smrj /* Exit on EndTag descriptor */ 13353446Smrj 13363446Smrj if (ResourceType == ACPI_RESOURCE_NAME_END_TAG) 13373446Smrj { 13383446Smrj return; 13393446Smrj } 13403446Smrj 13413446Smrj /* Point to next descriptor in each buffer */ 13423446Smrj 13433446Smrj Count++; 13443446Smrj Offset += Aml1Length; 13453446Smrj Aml1 += Aml1Length; 13463446Smrj Aml2 += Aml2Length; 13473446Smrj } 13483446Smrj } 13493446Smrj 13503446Smrj 13513446Smrj /******************************************************************************* 13523446Smrj * 13533446Smrj * FUNCTION: AcpiDmTestResourceConversion 13543446Smrj * 13553446Smrj * PARAMETERS: Node - Parent device node 13563446Smrj * Name - resource method name (_CRS) 13573446Smrj * 13583446Smrj * RETURN: Status 13593446Smrj * 13603446Smrj * DESCRIPTION: Compare the original AML with a conversion of the AML to 13613446Smrj * internal resource list, then back to AML. 13623446Smrj * 13633446Smrj ******************************************************************************/ 13643446Smrj 13653446Smrj static ACPI_STATUS 13663446Smrj AcpiDmTestResourceConversion ( 13673446Smrj ACPI_NAMESPACE_NODE *Node, 13683446Smrj char *Name) 13693446Smrj { 13703446Smrj ACPI_STATUS Status; 13713446Smrj ACPI_BUFFER ReturnObj; 13723446Smrj ACPI_BUFFER ResourceObj; 13733446Smrj ACPI_BUFFER NewAml; 13743446Smrj ACPI_OBJECT *OriginalAml; 13753446Smrj 13763446Smrj 13773446Smrj AcpiOsPrintf ("Resource Conversion Comparison:\n"); 13783446Smrj 13793446Smrj NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 13803446Smrj ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 13813446Smrj ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 13823446Smrj 13833446Smrj /* Get the original _CRS AML resource template */ 13843446Smrj 13853446Smrj Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj); 13863446Smrj if (ACPI_FAILURE (Status)) 13873446Smrj { 13883446Smrj AcpiOsPrintf ("Could not obtain %s: %s\n", 13893446Smrj Name, AcpiFormatException (Status)); 13903446Smrj return (Status); 13913446Smrj } 13923446Smrj 13933446Smrj /* Get the AML resource template, converted to internal resource structs */ 13943446Smrj 13953446Smrj Status = AcpiGetCurrentResources (Node, &ResourceObj); 13963446Smrj if (ACPI_FAILURE (Status)) 13973446Smrj { 13983446Smrj AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", 13993446Smrj AcpiFormatException (Status)); 14003446Smrj goto Exit1; 14013446Smrj } 14023446Smrj 14033446Smrj /* Convert internal resource list to external AML resource template */ 14043446Smrj 14053446Smrj Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml); 14063446Smrj if (ACPI_FAILURE (Status)) 14073446Smrj { 14083446Smrj AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n", 14093446Smrj AcpiFormatException (Status)); 14103446Smrj goto Exit2; 14113446Smrj } 14123446Smrj 14133446Smrj /* Compare original AML to the newly created AML resource list */ 14143446Smrj 14153446Smrj OriginalAml = ReturnObj.Pointer; 14163446Smrj 14173446Smrj AcpiDmCompareAmlResources ( 1418*7851SDana.Myers@Sun.COM OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, 1419*7851SDana.Myers@Sun.COM NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length); 14203446Smrj 14213446Smrj /* Cleanup and exit */ 14223446Smrj 14233446Smrj ACPI_FREE (NewAml.Pointer); 14243446Smrj Exit2: 14253446Smrj ACPI_FREE (ResourceObj.Pointer); 14263446Smrj Exit1: 14273446Smrj ACPI_FREE (ReturnObj.Pointer); 14283446Smrj return (Status); 14293446Smrj } 14303446Smrj 14313446Smrj 14323446Smrj /******************************************************************************* 14333446Smrj * 14343446Smrj * FUNCTION: AcpiDbDisplayResources 14353446Smrj * 14363446Smrj * PARAMETERS: ObjectArg - String with hex value of the object 14373446Smrj * 14383446Smrj * RETURN: None 14393446Smrj * 14403446Smrj * DESCRIPTION: Display the resource objects associated with a device. 14413446Smrj * 14423446Smrj ******************************************************************************/ 14433446Smrj 14443446Smrj void 14453446Smrj AcpiDbDisplayResources ( 14463446Smrj char *ObjectArg) 14473446Smrj { 14483446Smrj ACPI_NAMESPACE_NODE *Node; 14493446Smrj ACPI_STATUS Status; 14503446Smrj ACPI_BUFFER ReturnObj; 14513446Smrj 14523446Smrj 14533446Smrj AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT); 14543446Smrj AcpiDbgLevel |= ACPI_LV_RESOURCES; 14553446Smrj 14563446Smrj /* Convert string to object pointer */ 14573446Smrj 14583446Smrj Node = AcpiDbConvertToNode (ObjectArg); 14593446Smrj if (!Node) 14603446Smrj { 14613446Smrj return; 14623446Smrj } 14633446Smrj 14643446Smrj /* Prepare for a return object of arbitrary size */ 14653446Smrj 14663446Smrj ReturnObj.Pointer = AcpiGbl_DbBuffer; 14673446Smrj ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 14683446Smrj 14693446Smrj /* _PRT */ 14703446Smrj 14713446Smrj AcpiOsPrintf ("Evaluating _PRT\n"); 14723446Smrj 14733446Smrj /* Check if _PRT exists */ 14743446Smrj 14753446Smrj Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj); 14763446Smrj if (ACPI_FAILURE (Status)) 14773446Smrj { 14783446Smrj AcpiOsPrintf ("Could not obtain _PRT: %s\n", 14793446Smrj AcpiFormatException (Status)); 14803446Smrj goto GetCrs; 14813446Smrj } 14823446Smrj 14833446Smrj ReturnObj.Pointer = AcpiGbl_DbBuffer; 14843446Smrj ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 14853446Smrj 14863446Smrj Status = AcpiGetIrqRoutingTable (Node, &ReturnObj); 14873446Smrj if (ACPI_FAILURE (Status)) 14883446Smrj { 14893446Smrj AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", 14903446Smrj AcpiFormatException (Status)); 14913446Smrj goto GetCrs; 14923446Smrj } 14933446Smrj 14943446Smrj AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer)); 14953446Smrj 14963446Smrj 14973446Smrj /* _CRS */ 14983446Smrj 14993446Smrj GetCrs: 15003446Smrj AcpiOsPrintf ("Evaluating _CRS\n"); 15013446Smrj 15023446Smrj ReturnObj.Pointer = AcpiGbl_DbBuffer; 15033446Smrj ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 15043446Smrj 15053446Smrj /* Check if _CRS exists */ 15063446Smrj 15073446Smrj Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj); 15083446Smrj if (ACPI_FAILURE (Status)) 15093446Smrj { 15103446Smrj AcpiOsPrintf ("Could not obtain _CRS: %s\n", 15113446Smrj AcpiFormatException (Status)); 15123446Smrj goto GetPrs; 15133446Smrj } 15143446Smrj 15153446Smrj /* Get the _CRS resource list */ 15163446Smrj 15173446Smrj ReturnObj.Pointer = AcpiGbl_DbBuffer; 15183446Smrj ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 15193446Smrj 15203446Smrj Status = AcpiGetCurrentResources (Node, &ReturnObj); 15213446Smrj if (ACPI_FAILURE (Status)) 15223446Smrj { 15233446Smrj AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", 15243446Smrj AcpiFormatException (Status)); 15253446Smrj goto GetPrs; 15263446Smrj } 15273446Smrj 15283446Smrj /* Dump the _CRS resource list */ 15293446Smrj 15303446Smrj AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, 15313446Smrj ReturnObj.Pointer)); 15323446Smrj 15333446Smrj /* 15343446Smrj * Perform comparison of original AML to newly created AML. This tests both 15353446Smrj * the AML->Resource conversion and the Resource->Aml conversion. 15363446Smrj */ 15373446Smrj Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS); 15383446Smrj 15393446Smrj /* Execute _SRS with the resource list */ 15403446Smrj 15413446Smrj Status = AcpiSetCurrentResources (Node, &ReturnObj); 15423446Smrj if (ACPI_FAILURE (Status)) 15433446Smrj { 15443446Smrj AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", 15453446Smrj AcpiFormatException (Status)); 15463446Smrj goto GetPrs; 15473446Smrj } 15483446Smrj 15493446Smrj 15503446Smrj /* _PRS */ 15513446Smrj 15523446Smrj GetPrs: 15533446Smrj AcpiOsPrintf ("Evaluating _PRS\n"); 15543446Smrj 15553446Smrj ReturnObj.Pointer = AcpiGbl_DbBuffer; 15563446Smrj ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 15573446Smrj 15583446Smrj /* Check if _PRS exists */ 15593446Smrj 15603446Smrj Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj); 15613446Smrj if (ACPI_FAILURE (Status)) 15623446Smrj { 15633446Smrj AcpiOsPrintf ("Could not obtain _PRS: %s\n", 15643446Smrj AcpiFormatException (Status)); 15653446Smrj goto Cleanup; 15663446Smrj } 15673446Smrj 15683446Smrj ReturnObj.Pointer = AcpiGbl_DbBuffer; 15693446Smrj ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE; 15703446Smrj 15713446Smrj Status = AcpiGetPossibleResources (Node, &ReturnObj); 15723446Smrj if (ACPI_FAILURE (Status)) 15733446Smrj { 15743446Smrj AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", 15753446Smrj AcpiFormatException (Status)); 15763446Smrj goto Cleanup; 15773446Smrj } 15783446Smrj 15793446Smrj AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer)); 15803446Smrj 15813446Smrj Cleanup: 15823446Smrj 15833446Smrj AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT); 15843446Smrj return; 15853446Smrj } 15863446Smrj 15873446Smrj 15883446Smrj /******************************************************************************* 15893446Smrj * 15903446Smrj * FUNCTION: AcpiDbIntegrityWalk 15913446Smrj * 15923446Smrj * PARAMETERS: Callback from WalkNamespace 15933446Smrj * 15943446Smrj * RETURN: Status 15953446Smrj * 15963446Smrj * DESCRIPTION: Examine one NS node for valid values. 15973446Smrj * 15983446Smrj ******************************************************************************/ 15993446Smrj 16003446Smrj static ACPI_STATUS 16013446Smrj AcpiDbIntegrityWalk ( 16023446Smrj ACPI_HANDLE ObjHandle, 16033446Smrj UINT32 NestingLevel, 16043446Smrj void *Context, 16053446Smrj void **ReturnValue) 16063446Smrj { 16073446Smrj ACPI_INTEGRITY_INFO *Info = (ACPI_INTEGRITY_INFO *) Context; 16083446Smrj ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; 16093446Smrj ACPI_OPERAND_OBJECT *Object; 1610*7851SDana.Myers@Sun.COM BOOLEAN Alias = TRUE; 16113446Smrj 16123446Smrj 16133446Smrj Info->Nodes++; 1614*7851SDana.Myers@Sun.COM 1615*7851SDana.Myers@Sun.COM /* Verify the NS node, and dereference aliases */ 1616*7851SDana.Myers@Sun.COM 1617*7851SDana.Myers@Sun.COM while (Alias) 16183446Smrj { 1619*7851SDana.Myers@Sun.COM if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED) 1620*7851SDana.Myers@Sun.COM { 1621*7851SDana.Myers@Sun.COM AcpiOsPrintf ("Invalid Descriptor Type for Node %p [%s] - is %2.2X should be %2.2X\n", 1622*7851SDana.Myers@Sun.COM Node, AcpiUtGetDescriptorName (Node), ACPI_GET_DESCRIPTOR_TYPE (Node), 1623*7851SDana.Myers@Sun.COM ACPI_DESC_TYPE_NAMED); 1624*7851SDana.Myers@Sun.COM return (AE_OK); 1625*7851SDana.Myers@Sun.COM } 1626*7851SDana.Myers@Sun.COM 1627*7851SDana.Myers@Sun.COM if ((Node->Type == ACPI_TYPE_LOCAL_ALIAS) || 1628*7851SDana.Myers@Sun.COM (Node->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS)) 1629*7851SDana.Myers@Sun.COM { 1630*7851SDana.Myers@Sun.COM Node = (ACPI_NAMESPACE_NODE *) Node->Object; 1631*7851SDana.Myers@Sun.COM } 1632*7851SDana.Myers@Sun.COM else 1633*7851SDana.Myers@Sun.COM { 1634*7851SDana.Myers@Sun.COM Alias = FALSE; 1635*7851SDana.Myers@Sun.COM } 16363446Smrj } 16373446Smrj 16383446Smrj if (Node->Type > ACPI_TYPE_LOCAL_MAX) 16393446Smrj { 16403446Smrj AcpiOsPrintf ("Invalid Object Type for Node %p, Type = %X\n", 16413446Smrj Node, Node->Type); 1642*7851SDana.Myers@Sun.COM return (AE_OK); 16433446Smrj } 16443446Smrj 16453446Smrj if (!AcpiUtValidAcpiName (Node->Name.Integer)) 16463446Smrj { 16473446Smrj AcpiOsPrintf ("Invalid AcpiName for Node %p\n", Node); 1648*7851SDana.Myers@Sun.COM return (AE_OK); 16493446Smrj } 16503446Smrj 16513446Smrj Object = AcpiNsGetAttachedObject (Node); 16523446Smrj if (Object) 16533446Smrj { 16543446Smrj Info->Objects++; 16553446Smrj if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND) 16563446Smrj { 16573446Smrj AcpiOsPrintf ("Invalid Descriptor Type for Object %p [%s]\n", 16583446Smrj Object, AcpiUtGetDescriptorName (Object)); 16593446Smrj } 16603446Smrj } 16613446Smrj 16623446Smrj return (AE_OK); 16633446Smrj } 16643446Smrj 16653446Smrj 16663446Smrj /******************************************************************************* 16673446Smrj * 16683446Smrj * FUNCTION: AcpiDbCheckIntegrity 16693446Smrj * 16703446Smrj * PARAMETERS: None 16713446Smrj * 16723446Smrj * RETURN: None 16733446Smrj * 16743446Smrj * DESCRIPTION: Check entire namespace for data structure integrity 16753446Smrj * 16763446Smrj ******************************************************************************/ 16773446Smrj 16783446Smrj void 16793446Smrj AcpiDbCheckIntegrity ( 16803446Smrj void) 16813446Smrj { 16823446Smrj ACPI_INTEGRITY_INFO Info = {0,0}; 16833446Smrj 16843446Smrj /* Search all nodes in namespace */ 16853446Smrj 16863446Smrj (void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, 16873446Smrj AcpiDbIntegrityWalk, (void *) &Info, NULL); 16883446Smrj 16893446Smrj AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", 16903446Smrj Info.Nodes, Info.Objects); 16913446Smrj } 16923446Smrj 16933446Smrj 16943446Smrj /******************************************************************************* 16953446Smrj * 16963446Smrj * FUNCTION: AcpiDbGenerateGpe 16973446Smrj * 16983446Smrj * PARAMETERS: GpeArg - Raw GPE number, ascii string 16993446Smrj * BlockArg - GPE block number, ascii string 17003446Smrj * 0 or 1 for FADT GPE blocks 17013446Smrj * 17023446Smrj * RETURN: None 17033446Smrj * 17043446Smrj * DESCRIPTION: Generate a GPE 17053446Smrj * 17063446Smrj ******************************************************************************/ 17073446Smrj 17083446Smrj void 17093446Smrj AcpiDbGenerateGpe ( 17103446Smrj char *GpeArg, 17113446Smrj char *BlockArg) 17123446Smrj { 17133446Smrj UINT32 BlockNumber; 17143446Smrj UINT32 GpeNumber; 17153446Smrj ACPI_GPE_EVENT_INFO *GpeEventInfo; 17163446Smrj 17173446Smrj 17183446Smrj GpeNumber = ACPI_STRTOUL (GpeArg, NULL, 0); 17193446Smrj BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0); 17203446Smrj 17213446Smrj 17223446Smrj GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), 17233446Smrj GpeNumber); 17243446Smrj if (!GpeEventInfo) 17253446Smrj { 17263446Smrj AcpiOsPrintf ("Invalid GPE\n"); 17273446Smrj return; 17283446Smrj } 17293446Smrj 17303446Smrj (void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber); 17313446Smrj } 17323446Smrj 17333446Smrj 17343446Smrj /******************************************************************************* 17353446Smrj * 17363446Smrj * FUNCTION: AcpiDbBusWalk 17373446Smrj * 17383446Smrj * PARAMETERS: Callback from WalkNamespace 17393446Smrj * 17403446Smrj * RETURN: Status 17413446Smrj * 17423446Smrj * DESCRIPTION: Display info about device objects that have a corresponding 17433446Smrj * _PRT method. 17443446Smrj * 17453446Smrj ******************************************************************************/ 17463446Smrj 17473446Smrj static ACPI_STATUS 17483446Smrj AcpiDbBusWalk ( 17493446Smrj ACPI_HANDLE ObjHandle, 17503446Smrj UINT32 NestingLevel, 17513446Smrj void *Context, 17523446Smrj void **ReturnValue) 17533446Smrj { 17543446Smrj ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; 17553446Smrj ACPI_STATUS Status; 17563446Smrj ACPI_BUFFER Buffer; 17573446Smrj ACPI_INTEGER ADR; 17583446Smrj ACPI_DEVICE_ID Id; 17593446Smrj ACPI_COMPATIBLE_ID_LIST *Cid; 17603446Smrj ACPI_NAMESPACE_NODE *TempNode; 17613446Smrj 17623446Smrj 17633446Smrj /* Exit if there is no _PRT under this device */ 17643446Smrj 17653446Smrj Status = AcpiGetHandle (Node, METHOD_NAME__PRT, 17663446Smrj ACPI_CAST_PTR (ACPI_HANDLE, &TempNode)); 17673446Smrj if (ACPI_FAILURE (Status)) 17683446Smrj { 17693446Smrj return (AE_OK); 17703446Smrj } 17713446Smrj 17723446Smrj /* Get the full path to this device object */ 17733446Smrj 17743446Smrj Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; 17753446Smrj Status = AcpiNsHandleToPathname (ObjHandle, &Buffer); 17763446Smrj if (ACPI_FAILURE (Status)) 17773446Smrj { 17783446Smrj AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle); 17793446Smrj return (AE_OK); 17803446Smrj } 17813446Smrj 17823446Smrj /* Display the full path */ 17833446Smrj 17843446Smrj AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer); 17853446Smrj ACPI_FREE (Buffer.Pointer); 17863446Smrj 17873446Smrj /* _PRT info */ 17883446Smrj 17893446Smrj AcpiOsPrintf ("_PRT=%p", TempNode); 17903446Smrj 17913446Smrj /* Get the _ADR value */ 17923446Smrj 17933446Smrj Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &ADR); 17943446Smrj if (ACPI_FAILURE (Status)) 17953446Smrj { 17963446Smrj AcpiOsPrintf (" No _ADR "); 17973446Smrj } 17983446Smrj else 17993446Smrj { 18003446Smrj AcpiOsPrintf (" _ADR=%8.8X", (UINT32) ADR); 18013446Smrj } 18023446Smrj 18033446Smrj /* Get the _HID if present */ 18043446Smrj 18053446Smrj Status = AcpiUtExecute_HID (Node, &Id); 18063446Smrj if (ACPI_SUCCESS (Status)) 18073446Smrj { 18083446Smrj AcpiOsPrintf (" _HID=%s", Id.Value); 18093446Smrj } 18103446Smrj else 18113446Smrj { 18123446Smrj AcpiOsPrintf (" "); 18133446Smrj } 18143446Smrj 18153446Smrj /* Get the _UID if present */ 18163446Smrj 18173446Smrj Status = AcpiUtExecute_UID (Node, &Id); 18183446Smrj if (ACPI_SUCCESS (Status)) 18193446Smrj { 18203446Smrj AcpiOsPrintf (" _UID=%s", Id.Value); 18213446Smrj } 18223446Smrj 18233446Smrj /* Get the _CID if present */ 18243446Smrj 18253446Smrj Status = AcpiUtExecute_CID (Node, &Cid); 18263446Smrj if (ACPI_SUCCESS (Status)) 18273446Smrj { 18283446Smrj AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value); 18293446Smrj ACPI_FREE (Cid); 18303446Smrj } 18313446Smrj 18323446Smrj AcpiOsPrintf ("\n"); 18333446Smrj return (AE_OK); 18343446Smrj } 18353446Smrj 18363446Smrj 18373446Smrj /******************************************************************************* 18383446Smrj * 18393446Smrj * FUNCTION: AcpiDbGetBusInfo 18403446Smrj * 18413446Smrj * PARAMETERS: None 18423446Smrj * 18433446Smrj * RETURN: None 18443446Smrj * 18453446Smrj * DESCRIPTION: Display info about system busses. 18463446Smrj * 18473446Smrj ******************************************************************************/ 18483446Smrj 18493446Smrj void 18503446Smrj AcpiDbGetBusInfo ( 18513446Smrj void) 18523446Smrj { 18533446Smrj /* Search all nodes in namespace */ 18543446Smrj 18553446Smrj (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, 18563446Smrj AcpiDbBusWalk, NULL, NULL); 18573446Smrj } 18583446Smrj 18593446Smrj #endif /* ACPI_DEBUGGER */ 1860