13446Smrj /******************************************************************************* 23446Smrj * 33446Smrj * Module Name: dbutils - AML debugger utilities 4*7851SDana.Myers@Sun.COM * $Revision: 1.87 $ 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 "acnamesp.h" 1203446Smrj #include "acdebug.h" 1213446Smrj #include "acdisasm.h" 1223446Smrj 1233446Smrj 1243446Smrj #ifdef ACPI_DEBUGGER 1253446Smrj 1263446Smrj #define _COMPONENT ACPI_CA_DEBUGGER 1273446Smrj ACPI_MODULE_NAME ("dbutils") 1283446Smrj 1293446Smrj /* Local prototypes */ 1303446Smrj 1313446Smrj #ifdef ACPI_OBSOLETE_FUNCTIONS 1323446Smrj ACPI_STATUS 1333446Smrj AcpiDbSecondPassParse ( 1343446Smrj ACPI_PARSE_OBJECT *Root); 1353446Smrj 1363446Smrj void 1373446Smrj AcpiDbDumpBuffer ( 1383446Smrj UINT32 Address); 1393446Smrj #endif 1403446Smrj 141*7851SDana.Myers@Sun.COM static char *Converter = "0123456789ABCDEF"; 142*7851SDana.Myers@Sun.COM 1433446Smrj 1443446Smrj /******************************************************************************* 1453446Smrj * 1463446Smrj * FUNCTION: AcpiDbMatchArgument 1473446Smrj * 1483446Smrj * PARAMETERS: UserArgument - User command line 1493446Smrj * Arguments - Array of commands to match against 1503446Smrj * 1513446Smrj * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found 1523446Smrj * 1533446Smrj * DESCRIPTION: Search command array for a command match 1543446Smrj * 1553446Smrj ******************************************************************************/ 1563446Smrj 1573446Smrj ACPI_OBJECT_TYPE 1583446Smrj AcpiDbMatchArgument ( 1593446Smrj char *UserArgument, 1603446Smrj ARGUMENT_INFO *Arguments) 1613446Smrj { 1623446Smrj UINT32 i; 1633446Smrj 1643446Smrj 1653446Smrj if (!UserArgument || UserArgument[0] == 0) 1663446Smrj { 1673446Smrj return (ACPI_TYPE_NOT_FOUND); 1683446Smrj } 1693446Smrj 1703446Smrj for (i = 0; Arguments[i].Name; i++) 1713446Smrj { 1723446Smrj if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name) 1733446Smrj { 1743446Smrj return (i); 1753446Smrj } 1763446Smrj } 1773446Smrj 1783446Smrj /* Argument not recognized */ 1793446Smrj 1803446Smrj return (ACPI_TYPE_NOT_FOUND); 1813446Smrj } 1823446Smrj 1833446Smrj 1843446Smrj /******************************************************************************* 1853446Smrj * 1863446Smrj * FUNCTION: AcpiDbSetOutputDestination 1873446Smrj * 1883446Smrj * PARAMETERS: OutputFlags - Current flags word 1893446Smrj * 1903446Smrj * RETURN: None 1913446Smrj * 1923446Smrj * DESCRIPTION: Set the current destination for debugger output. Also sets 1933446Smrj * the debug output level accordingly. 1943446Smrj * 1953446Smrj ******************************************************************************/ 1963446Smrj 1973446Smrj void 1983446Smrj AcpiDbSetOutputDestination ( 1993446Smrj UINT32 OutputFlags) 2003446Smrj { 2013446Smrj 2023446Smrj AcpiGbl_DbOutputFlags = (UINT8) OutputFlags; 2033446Smrj 2043446Smrj if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && AcpiGbl_DbOutputToFile) 2053446Smrj { 2063446Smrj AcpiDbgLevel = AcpiGbl_DbDebugLevel; 2073446Smrj } 2083446Smrj else 2093446Smrj { 2103446Smrj AcpiDbgLevel = AcpiGbl_DbConsoleDebugLevel; 2113446Smrj } 2123446Smrj } 2133446Smrj 2143446Smrj 2153446Smrj /******************************************************************************* 2163446Smrj * 2173446Smrj * FUNCTION: AcpiDbDumpExternalObject 2183446Smrj * 2193446Smrj * PARAMETERS: ObjDesc - External ACPI object to dump 2203446Smrj * Level - Nesting level. 2213446Smrj * 2223446Smrj * RETURN: None 2233446Smrj * 2243446Smrj * DESCRIPTION: Dump the contents of an ACPI external object 2253446Smrj * 2263446Smrj ******************************************************************************/ 2273446Smrj 2283446Smrj void 2293446Smrj AcpiDbDumpExternalObject ( 2303446Smrj ACPI_OBJECT *ObjDesc, 2313446Smrj UINT32 Level) 2323446Smrj { 2333446Smrj UINT32 i; 2343446Smrj 2353446Smrj 2363446Smrj if (!ObjDesc) 2373446Smrj { 2383446Smrj AcpiOsPrintf ("[Null Object]\n"); 2393446Smrj return; 2403446Smrj } 2413446Smrj 2423446Smrj for (i = 0; i < Level; i++) 2433446Smrj { 2443446Smrj AcpiOsPrintf (" "); 2453446Smrj } 2463446Smrj 2473446Smrj switch (ObjDesc->Type) 2483446Smrj { 2493446Smrj case ACPI_TYPE_ANY: 2503446Smrj 251*7851SDana.Myers@Sun.COM AcpiOsPrintf ("[Null Object] (Type=0)\n"); 2523446Smrj break; 2533446Smrj 2543446Smrj 2553446Smrj case ACPI_TYPE_INTEGER: 2563446Smrj 2573446Smrj AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", 2583446Smrj ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); 2593446Smrj break; 2603446Smrj 2613446Smrj 2623446Smrj case ACPI_TYPE_STRING: 2633446Smrj 2643446Smrj AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length); 2653446Smrj for (i = 0; i < ObjDesc->String.Length; i++) 2663446Smrj { 2673446Smrj AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]); 2683446Smrj } 2693446Smrj AcpiOsPrintf ("\n"); 2703446Smrj break; 2713446Smrj 2723446Smrj 2733446Smrj case ACPI_TYPE_BUFFER: 2743446Smrj 2753446Smrj AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); 2763446Smrj if (ObjDesc->Buffer.Length) 2773446Smrj { 2783446Smrj AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), 2793446Smrj ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); 2803446Smrj } 2813446Smrj else 2823446Smrj { 2833446Smrj AcpiOsPrintf ("\n"); 2843446Smrj } 2853446Smrj break; 2863446Smrj 2873446Smrj 2883446Smrj case ACPI_TYPE_PACKAGE: 2893446Smrj 2903446Smrj AcpiOsPrintf ("[Package] Contains %d Elements:\n", 2913446Smrj ObjDesc->Package.Count); 2923446Smrj 2933446Smrj for (i = 0; i < ObjDesc->Package.Count; i++) 2943446Smrj { 2953446Smrj AcpiDbDumpExternalObject (&ObjDesc->Package.Elements[i], Level+1); 2963446Smrj } 2973446Smrj break; 2983446Smrj 2993446Smrj 3003446Smrj case ACPI_TYPE_LOCAL_REFERENCE: 3013446Smrj 302*7851SDana.Myers@Sun.COM AcpiOsPrintf ("[Object Reference] = "); 3033446Smrj AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL); 3043446Smrj break; 3053446Smrj 3063446Smrj 3073446Smrj case ACPI_TYPE_PROCESSOR: 3083446Smrj 3093446Smrj AcpiOsPrintf ("[Processor]\n"); 3103446Smrj break; 3113446Smrj 3123446Smrj 3133446Smrj case ACPI_TYPE_POWER: 3143446Smrj 3153446Smrj AcpiOsPrintf ("[Power Resource]\n"); 3163446Smrj break; 3173446Smrj 3183446Smrj 3193446Smrj default: 3203446Smrj 3213446Smrj AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Type); 3223446Smrj break; 3233446Smrj } 3243446Smrj } 3253446Smrj 3263446Smrj 3273446Smrj /******************************************************************************* 3283446Smrj * 3293446Smrj * FUNCTION: AcpiDbPrepNamestring 3303446Smrj * 3313446Smrj * PARAMETERS: Name - String to prepare 3323446Smrj * 3333446Smrj * RETURN: None 3343446Smrj * 3353446Smrj * DESCRIPTION: Translate all forward slashes and dots to backslashes. 3363446Smrj * 3373446Smrj ******************************************************************************/ 3383446Smrj 3393446Smrj void 3403446Smrj AcpiDbPrepNamestring ( 3413446Smrj char *Name) 3423446Smrj { 3433446Smrj 3443446Smrj if (!Name) 3453446Smrj { 3463446Smrj return; 3473446Smrj } 3483446Smrj 3493446Smrj AcpiUtStrupr (Name); 3503446Smrj 3513446Smrj /* Convert a leading forward slash to a backslash */ 3523446Smrj 3533446Smrj if (*Name == '/') 3543446Smrj { 3553446Smrj *Name = '\\'; 3563446Smrj } 3573446Smrj 3583446Smrj /* Ignore a leading backslash, this is the root prefix */ 3593446Smrj 3603446Smrj if (*Name == '\\') 3613446Smrj { 3623446Smrj Name++; 3633446Smrj } 3643446Smrj 3653446Smrj /* Convert all slash path separators to dots */ 3663446Smrj 3673446Smrj while (*Name) 3683446Smrj { 3693446Smrj if ((*Name == '/') || 3703446Smrj (*Name == '\\')) 3713446Smrj { 3723446Smrj *Name = '.'; 3733446Smrj } 3743446Smrj 3753446Smrj Name++; 3763446Smrj } 3773446Smrj } 3783446Smrj 3793446Smrj 3803446Smrj /******************************************************************************* 3813446Smrj * 3823446Smrj * FUNCTION: AcpiDbLocalNsLookup 3833446Smrj * 3843446Smrj * PARAMETERS: Name - Name to lookup 3853446Smrj * 3863446Smrj * RETURN: Pointer to a namespace node, null on failure 3873446Smrj * 3883446Smrj * DESCRIPTION: Lookup a name in the ACPI namespace 3893446Smrj * 3903446Smrj * Note: Currently begins search from the root. Could be enhanced to use 3913446Smrj * the current prefix (scope) node as the search beginning point. 3923446Smrj * 3933446Smrj ******************************************************************************/ 3943446Smrj 3953446Smrj ACPI_NAMESPACE_NODE * 3963446Smrj AcpiDbLocalNsLookup ( 3973446Smrj char *Name) 3983446Smrj { 3993446Smrj char *InternalPath; 4003446Smrj ACPI_STATUS Status; 4013446Smrj ACPI_NAMESPACE_NODE *Node = NULL; 4023446Smrj 4033446Smrj 4043446Smrj AcpiDbPrepNamestring (Name); 4053446Smrj 4063446Smrj /* Build an internal namestring */ 4073446Smrj 4083446Smrj Status = AcpiNsInternalizeName (Name, &InternalPath); 4093446Smrj if (ACPI_FAILURE (Status)) 4103446Smrj { 4113446Smrj AcpiOsPrintf ("Invalid namestring: %s\n", Name); 4123446Smrj return (NULL); 4133446Smrj } 4143446Smrj 4153446Smrj /* 4163446Smrj * Lookup the name. 4173446Smrj * (Uses root node as the search starting point) 4183446Smrj */ 4193446Smrj Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 4203446Smrj ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); 4213446Smrj if (ACPI_FAILURE (Status)) 4223446Smrj { 4233446Smrj AcpiOsPrintf ("Could not locate name: %s, %s\n", 4243446Smrj Name, AcpiFormatException (Status)); 4253446Smrj } 4263446Smrj 4273446Smrj ACPI_FREE (InternalPath); 4283446Smrj return (Node); 4293446Smrj } 4303446Smrj 4313446Smrj 432*7851SDana.Myers@Sun.COM /******************************************************************************* 433*7851SDana.Myers@Sun.COM * 434*7851SDana.Myers@Sun.COM * FUNCTION: AcpiDbUInt32ToHexString 435*7851SDana.Myers@Sun.COM * 436*7851SDana.Myers@Sun.COM * PARAMETERS: Value - The value to be converted to string 437*7851SDana.Myers@Sun.COM * Buffer - Buffer for result (not less than 11 bytes) 438*7851SDana.Myers@Sun.COM * 439*7851SDana.Myers@Sun.COM * RETURN: None 440*7851SDana.Myers@Sun.COM * 441*7851SDana.Myers@Sun.COM * DESCRIPTION: Convert the unsigned 32-bit value to the hexadecimal image 442*7851SDana.Myers@Sun.COM * 443*7851SDana.Myers@Sun.COM * NOTE: It is the caller's responsibility to ensure that the length of buffer 444*7851SDana.Myers@Sun.COM * is sufficient. 445*7851SDana.Myers@Sun.COM * 446*7851SDana.Myers@Sun.COM ******************************************************************************/ 447*7851SDana.Myers@Sun.COM 448*7851SDana.Myers@Sun.COM void 449*7851SDana.Myers@Sun.COM AcpiDbUInt32ToHexString ( 450*7851SDana.Myers@Sun.COM UINT32 Value, 451*7851SDana.Myers@Sun.COM char *Buffer) 452*7851SDana.Myers@Sun.COM { 453*7851SDana.Myers@Sun.COM UINT8 i; 454*7851SDana.Myers@Sun.COM 455*7851SDana.Myers@Sun.COM 456*7851SDana.Myers@Sun.COM if (Value == 0) 457*7851SDana.Myers@Sun.COM { 458*7851SDana.Myers@Sun.COM ACPI_STRCPY (Buffer, "0"); 459*7851SDana.Myers@Sun.COM return; 460*7851SDana.Myers@Sun.COM } 461*7851SDana.Myers@Sun.COM 462*7851SDana.Myers@Sun.COM ACPI_STRCPY (Buffer, "0x"); 463*7851SDana.Myers@Sun.COM Buffer[10] = '\0'; 464*7851SDana.Myers@Sun.COM 465*7851SDana.Myers@Sun.COM for (i = 9; i > 1; i--) 466*7851SDana.Myers@Sun.COM { 467*7851SDana.Myers@Sun.COM Buffer[i] = Converter [Value & 0x0F]; 468*7851SDana.Myers@Sun.COM Value = Value >> 4; 469*7851SDana.Myers@Sun.COM } 470*7851SDana.Myers@Sun.COM } 471*7851SDana.Myers@Sun.COM 472*7851SDana.Myers@Sun.COM 4733446Smrj #ifdef ACPI_OBSOLETE_FUNCTIONS 4743446Smrj /******************************************************************************* 4753446Smrj * 4763446Smrj * FUNCTION: AcpiDbSecondPassParse 4773446Smrj * 4783446Smrj * PARAMETERS: Root - Root of the parse tree 4793446Smrj * 4803446Smrj * RETURN: Status 4813446Smrj * 4823446Smrj * DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until 4833446Smrj * second pass to parse the control methods 4843446Smrj * 4853446Smrj ******************************************************************************/ 4863446Smrj 4873446Smrj ACPI_STATUS 4883446Smrj AcpiDbSecondPassParse ( 4893446Smrj ACPI_PARSE_OBJECT *Root) 4903446Smrj { 4913446Smrj ACPI_PARSE_OBJECT *Op = Root; 4923446Smrj ACPI_PARSE_OBJECT *Method; 4933446Smrj ACPI_PARSE_OBJECT *SearchOp; 4943446Smrj ACPI_PARSE_OBJECT *StartOp; 4953446Smrj ACPI_STATUS Status = AE_OK; 4963446Smrj UINT32 BaseAmlOffset; 4973446Smrj ACPI_WALK_STATE *WalkState; 4983446Smrj 4993446Smrj 5003446Smrj ACPI_FUNCTION_ENTRY (); 5013446Smrj 5023446Smrj 5033446Smrj AcpiOsPrintf ("Pass two parse ....\n"); 5043446Smrj 5053446Smrj while (Op) 5063446Smrj { 5073446Smrj if (Op->Common.AmlOpcode == AML_METHOD_OP) 5083446Smrj { 5093446Smrj Method = Op; 5103446Smrj 5113446Smrj /* Create a new walk state for the parse */ 5123446Smrj 5133446Smrj WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); 5143446Smrj if (!WalkState) 5153446Smrj { 5163446Smrj return (AE_NO_MEMORY); 5173446Smrj } 5183446Smrj 5193446Smrj /* Init the Walk State */ 5203446Smrj 5213446Smrj WalkState->ParserState.Aml = 5223446Smrj WalkState->ParserState.AmlStart = Method->Named.Data; 5233446Smrj WalkState->ParserState.AmlEnd = 5243446Smrj WalkState->ParserState.PkgEnd = Method->Named.Data + 5253446Smrj Method->Named.Length; 5263446Smrj WalkState->ParserState.StartScope = Op; 5273446Smrj 5283446Smrj WalkState->DescendingCallback = AcpiDsLoad1BeginOp; 5293446Smrj WalkState->AscendingCallback = AcpiDsLoad1EndOp; 5303446Smrj 5313446Smrj /* Perform the AML parse */ 5323446Smrj 5333446Smrj Status = AcpiPsParseAml (WalkState); 5343446Smrj 5353446Smrj BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1; 5363446Smrj StartOp = (Method->Common.Value.Arg)->Common.Next; 5373446Smrj SearchOp = StartOp; 5383446Smrj 5393446Smrj while (SearchOp) 5403446Smrj { 5413446Smrj SearchOp->Common.AmlOffset += BaseAmlOffset; 5423446Smrj SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); 5433446Smrj } 5443446Smrj } 5453446Smrj 5463446Smrj if (Op->Common.AmlOpcode == AML_REGION_OP) 5473446Smrj { 5483446Smrj /* TBD: [Investigate] this isn't quite the right thing to do! */ 5493446Smrj /* 5503446Smrj * 5513446Smrj * Method = (ACPI_DEFERRED_OP *) Op; 5523446Smrj * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength); 5533446Smrj */ 5543446Smrj } 5553446Smrj 5563446Smrj if (ACPI_FAILURE (Status)) 5573446Smrj { 5583446Smrj break; 5593446Smrj } 5603446Smrj 5613446Smrj Op = AcpiPsGetDepthNext (Root, Op); 5623446Smrj } 5633446Smrj 5643446Smrj return (Status); 5653446Smrj } 5663446Smrj 5673446Smrj 5683446Smrj /******************************************************************************* 5693446Smrj * 5703446Smrj * FUNCTION: AcpiDbDumpBuffer 5713446Smrj * 5723446Smrj * PARAMETERS: Address - Pointer to the buffer 5733446Smrj * 5743446Smrj * RETURN: None 5753446Smrj * 5763446Smrj * DESCRIPTION: Print a portion of a buffer 5773446Smrj * 5783446Smrj ******************************************************************************/ 5793446Smrj 5803446Smrj void 5813446Smrj AcpiDbDumpBuffer ( 5823446Smrj UINT32 Address) 5833446Smrj { 5843446Smrj 5853446Smrj AcpiOsPrintf ("\nLocation %X:\n", Address); 5863446Smrj 5873446Smrj AcpiDbgLevel |= ACPI_LV_TABLES; 5883446Smrj AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY, 5893446Smrj ACPI_UINT32_MAX); 5903446Smrj } 5913446Smrj #endif 5923446Smrj 5933446Smrj #endif /* ACPI_DEBUGGER */ 5943446Smrj 5953446Smrj 596