dbutils.c revision 114237
167754Smsmith/******************************************************************************* 267754Smsmith * 367754Smsmith * Module Name: dbutils - AML debugger utilities 4114237Snjl * $Revision: 61 $ 567754Smsmith * 667754Smsmith ******************************************************************************/ 767754Smsmith 867754Smsmith/****************************************************************************** 967754Smsmith * 1067754Smsmith * 1. Copyright Notice 1167754Smsmith * 12114237Snjl * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp. 1370243Smsmith * All rights reserved. 1467754Smsmith * 1567754Smsmith * 2. License 1667754Smsmith * 1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property 1867754Smsmith * rights. You may have additional license terms from the party that provided 1967754Smsmith * you this software, covering your right to use that party's intellectual 2067754Smsmith * property rights. 2167754Smsmith * 2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an 2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy, 2667754Smsmith * make derivatives, distribute, use and display any portion of the Covered 2767754Smsmith * Code in any form, with the right to sublicense such rights; and 2867754Smsmith * 2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3067754Smsmith * license (with the right to sublicense), under only those claims of Intel 3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell, 3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof 3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright 3467754Smsmith * license, and in no event shall the patent license extend to any additions 3567754Smsmith * to or modifications of the Original Intel Code. No other license or right 3667754Smsmith * is granted directly or by implication, estoppel or otherwise; 3767754Smsmith * 3867754Smsmith * The above copyright and patent license is granted only if the following 3967754Smsmith * conditions are met: 4067754Smsmith * 4167754Smsmith * 3. Conditions 4267754Smsmith * 4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4467754Smsmith * Redistribution of source code of any substantial portion of the Covered 4567754Smsmith * Code or modification with rights to further distribute source must include 4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions, 4767754Smsmith * and the following Disclaimer and Export Compliance provision. In addition, 4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to 4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered 5067754Smsmith * Code and the date of any change. Licensee must include in that file the 5167754Smsmith * documentation of any changes made by any predecessor Licensee. Licensee 5267754Smsmith * must include a prominent statement that the modification is derived, 5367754Smsmith * directly or indirectly, from Original Intel Code. 5467754Smsmith * 5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5667754Smsmith * Redistribution of source code of any substantial portion of the Covered 5767754Smsmith * Code or modification without rights to further distribute source must 5867754Smsmith * include the following Disclaimer and Export Compliance provision in the 5967754Smsmith * documentation and/or other materials provided with distribution. In 6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any 6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the 6267754Smsmith * license from Licensee to its licensee is limited to the intellectual 6367754Smsmith * property embodied in the software Licensee provides to its licensee, and 6467754Smsmith * not to intellectual property embodied in modifications its licensee may 6567754Smsmith * make. 6667754Smsmith * 6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any 6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the 6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance 7067754Smsmith * provision in the documentation and/or other materials provided with the 7167754Smsmith * distribution. 7267754Smsmith * 7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original 7467754Smsmith * Intel Code. 7567754Smsmith * 7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by 7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or 7867754Smsmith * other dealings in products derived from or relating to the Covered Code 7967754Smsmith * without prior written authorization from Intel. 8067754Smsmith * 8167754Smsmith * 4. Disclaimer and Export Compliance 8267754Smsmith * 8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 8467754Smsmith * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 8967754Smsmith * PARTICULAR PURPOSE. 9067754Smsmith * 9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 9867754Smsmith * LIMITED REMEDY. 9967754Smsmith * 10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this 10167754Smsmith * software or system incorporating such software without first obtaining any 10267754Smsmith * required license or other approval from the U. S. Department of Commerce or 10367754Smsmith * any other agency or department of the United States Government. In the 10467754Smsmith * event Licensee exports any such software from the United States or 10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall 10667754Smsmith * ensure that the distribution and export/re-export of the software is in 10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the 10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor 10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process, 11067754Smsmith * software, or service, directly or indirectly, to any country for which the 11167754Smsmith * United States government or any agency thereof requires an export license, 11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining 11367754Smsmith * such license, approval or letter. 11467754Smsmith * 11567754Smsmith *****************************************************************************/ 11667754Smsmith 11767754Smsmith 11867754Smsmith#include "acpi.h" 11967754Smsmith#include "acparser.h" 12067754Smsmith#include "amlcode.h" 12167754Smsmith#include "acnamesp.h" 12267754Smsmith#include "acdebug.h" 12367754Smsmith#include "acdispat.h" 12467754Smsmith 12567754Smsmith 126102550Siwasaki#ifdef ACPI_DEBUGGER 12767754Smsmith 128102550Siwasaki#define _COMPONENT ACPI_CA_DEBUGGER 12991116Smsmith ACPI_MODULE_NAME ("dbutils") 13067754Smsmith 13167754Smsmith 13267754Smsmith/******************************************************************************* 13367754Smsmith * 134114237Snjl * FUNCTION: AcpiDbMatchArgument 135114237Snjl * 136114237Snjl * PARAMETERS: UserArgument - User command line 137114237Snjl * Arguments - Array of commands to match against 138114237Snjl * 139114237Snjl * RETURN: Index into command array or ACPI_TYPE_NOT_FOUND if not found 140114237Snjl * 141114237Snjl * DESCRIPTION: Search command array for a command match 142114237Snjl * 143114237Snjl ******************************************************************************/ 144114237Snjl 145114237SnjlACPI_OBJECT_TYPE 146114237SnjlAcpiDbMatchArgument ( 147114237Snjl char *UserArgument, 148114237Snjl ARGUMENT_INFO *Arguments) 149114237Snjl{ 150114237Snjl UINT32 i; 151114237Snjl 152114237Snjl 153114237Snjl if (!UserArgument || UserArgument[0] == 0) 154114237Snjl { 155114237Snjl return (ACPI_TYPE_NOT_FOUND); 156114237Snjl } 157114237Snjl 158114237Snjl for (i = 0; Arguments[i].Name; i++) 159114237Snjl { 160114237Snjl if (ACPI_STRSTR (Arguments[i].Name, UserArgument) == Arguments[i].Name) 161114237Snjl { 162114237Snjl return (i); 163114237Snjl } 164114237Snjl } 165114237Snjl 166114237Snjl /* Argument not recognized */ 167114237Snjl 168114237Snjl return (ACPI_TYPE_NOT_FOUND); 169114237Snjl} 170114237Snjl 171114237Snjl 172114237Snjl/******************************************************************************* 173114237Snjl * 17467754Smsmith * FUNCTION: AcpiDbSetOutputDestination 17567754Smsmith * 17667754Smsmith * PARAMETERS: OutputFlags - Current flags word 17767754Smsmith * 17867754Smsmith * RETURN: None 17967754Smsmith * 18067754Smsmith * DESCRIPTION: Set the current destination for debugger output. Alos sets 18167754Smsmith * the debug output level accordingly. 18267754Smsmith * 18367754Smsmith ******************************************************************************/ 18467754Smsmith 18567754Smsmithvoid 18667754SmsmithAcpiDbSetOutputDestination ( 18767754Smsmith UINT32 OutputFlags) 18867754Smsmith{ 18967754Smsmith 19067754Smsmith AcpiGbl_DbOutputFlags = (UINT8) OutputFlags; 19167754Smsmith 19291116Smsmith if ((OutputFlags & ACPI_DB_REDIRECTABLE_OUTPUT) && AcpiGbl_DbOutputToFile) 19367754Smsmith { 19491116Smsmith AcpiDbgLevel = AcpiGbl_DbDebugLevel; 19567754Smsmith } 19667754Smsmith else 19767754Smsmith { 19867754Smsmith AcpiDbgLevel = AcpiGbl_DbConsoleDebugLevel; 19967754Smsmith } 20067754Smsmith} 20167754Smsmith 20267754Smsmith 20367754Smsmith/******************************************************************************* 20467754Smsmith * 20567754Smsmith * FUNCTION: AcpiDbDumpBuffer 20667754Smsmith * 20767754Smsmith * PARAMETERS: Address - Pointer to the buffer 20867754Smsmith * 20967754Smsmith * RETURN: None 21067754Smsmith * 21167754Smsmith * DESCRIPTION: Print a portion of a buffer 21267754Smsmith * 21367754Smsmith ******************************************************************************/ 21467754Smsmith 21567754Smsmithvoid 21667754SmsmithAcpiDbDumpBuffer ( 21767754Smsmith UINT32 Address) 21867754Smsmith{ 21967754Smsmith 22069746Smsmith AcpiOsPrintf ("\nLocation %X:\n", Address); 22167754Smsmith 22282367Smsmith AcpiDbgLevel |= ACPI_LV_TABLES; 22391116Smsmith AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY, ACPI_UINT32_MAX); 22467754Smsmith} 22567754Smsmith 22667754Smsmith 22767754Smsmith/******************************************************************************* 22867754Smsmith * 22967754Smsmith * FUNCTION: AcpiDbDumpObject 23067754Smsmith * 23167754Smsmith * PARAMETERS: ObjDesc - External ACPI object to dump 23267754Smsmith * Level - Nesting level. 23367754Smsmith * 23467754Smsmith * RETURN: None 23567754Smsmith * 23667754Smsmith * DESCRIPTION: Dump the contents of an ACPI external object 23767754Smsmith * 23867754Smsmith ******************************************************************************/ 23967754Smsmith 24067754Smsmithvoid 24167754SmsmithAcpiDbDumpObject ( 24267754Smsmith ACPI_OBJECT *ObjDesc, 24367754Smsmith UINT32 Level) 24467754Smsmith{ 24567754Smsmith UINT32 i; 24667754Smsmith 24767754Smsmith 24867754Smsmith if (!ObjDesc) 24967754Smsmith { 25067754Smsmith AcpiOsPrintf ("[Null Object]\n"); 25167754Smsmith return; 25267754Smsmith } 25367754Smsmith 25467754Smsmith for (i = 0; i < Level; i++) 25567754Smsmith { 25667754Smsmith AcpiOsPrintf (" "); 25767754Smsmith } 25867754Smsmith 25967754Smsmith switch (ObjDesc->Type) 26067754Smsmith { 26167754Smsmith case ACPI_TYPE_ANY: 26267754Smsmith 26382367Smsmith AcpiOsPrintf ("[Object Reference] = %p\n", ObjDesc->Reference.Handle); 26467754Smsmith break; 26567754Smsmith 26667754Smsmith 26771867Smsmith case ACPI_TYPE_INTEGER: 26882367Smsmith 26991116Smsmith AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", 27091116Smsmith ACPI_HIDWORD (ObjDesc->Integer.Value), 27191116Smsmith ACPI_LODWORD (ObjDesc->Integer.Value)); 27267754Smsmith break; 27367754Smsmith 27467754Smsmith 27567754Smsmith case ACPI_TYPE_STRING: 27667754Smsmith 27767754Smsmith AcpiOsPrintf ("[String] Value: "); 27867754Smsmith for (i = 0; i < ObjDesc->String.Length; i++) 27967754Smsmith { 28067754Smsmith AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]); 28167754Smsmith } 28267754Smsmith AcpiOsPrintf ("\n"); 28367754Smsmith break; 28467754Smsmith 28567754Smsmith 28667754Smsmith case ACPI_TYPE_BUFFER: 28767754Smsmith 28899146Siwasaki AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length); 289114237Snjl if (ObjDesc->Buffer.Length) 290114237Snjl { 291114237Snjl AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); 292114237Snjl } 293114237Snjl else 294114237Snjl { 295114237Snjl AcpiOsPrintf ("\n"); 296114237Snjl } 29767754Smsmith break; 29867754Smsmith 29967754Smsmith 30067754Smsmith case ACPI_TYPE_PACKAGE: 30167754Smsmith 30267754Smsmith AcpiOsPrintf ("[Package] Contains %d Elements: \n", ObjDesc->Package.Count); 30367754Smsmith 30467754Smsmith for (i = 0; i < ObjDesc->Package.Count; i++) 30567754Smsmith { 30667754Smsmith AcpiDbDumpObject (&ObjDesc->Package.Elements[i], Level+1); 30767754Smsmith } 30867754Smsmith break; 30967754Smsmith 31067754Smsmith 311107325Siwasaki case ACPI_TYPE_LOCAL_REFERENCE: 31282367Smsmith 31382367Smsmith AcpiOsPrintf ("[Object Reference] = %p\n", ObjDesc->Reference.Handle); 31467754Smsmith break; 31567754Smsmith 31682367Smsmith 31767754Smsmith case ACPI_TYPE_PROCESSOR: 31882367Smsmith 31967754Smsmith AcpiOsPrintf ("[Processor]\n"); 32067754Smsmith break; 32167754Smsmith 32282367Smsmith 32367754Smsmith case ACPI_TYPE_POWER: 32482367Smsmith 32567754Smsmith AcpiOsPrintf ("[Power Resource]\n"); 32667754Smsmith break; 32767754Smsmith 32882367Smsmith 32967754Smsmith default: 33067754Smsmith 33169746Smsmith AcpiOsPrintf ("[Unknown Type] %X \n", ObjDesc->Type); 33267754Smsmith break; 33367754Smsmith } 33467754Smsmith} 33567754Smsmith 33667754Smsmith 33767754Smsmith/******************************************************************************* 33867754Smsmith * 33967754Smsmith * FUNCTION: AcpiDbPrepNamestring 34067754Smsmith * 34167754Smsmith * PARAMETERS: Name - String to prepare 34267754Smsmith * 34367754Smsmith * RETURN: None 34467754Smsmith * 34567754Smsmith * DESCRIPTION: Translate all forward slashes and dots to backslashes. 34667754Smsmith * 34767754Smsmith ******************************************************************************/ 34867754Smsmith 34967754Smsmithvoid 35067754SmsmithAcpiDbPrepNamestring ( 351114237Snjl char *Name) 35267754Smsmith{ 35367754Smsmith 35467754Smsmith 35567754Smsmith if (!Name) 35667754Smsmith { 35767754Smsmith return; 35867754Smsmith } 35967754Smsmith 36091116Smsmith ACPI_STRUPR (Name); 36167754Smsmith 36267754Smsmith /* Convert a leading forward slash to a backslash */ 36367754Smsmith 36467754Smsmith if (*Name == '/') 36567754Smsmith { 36667754Smsmith *Name = '\\'; 36767754Smsmith } 36867754Smsmith 36967754Smsmith /* Ignore a leading backslash, this is the root prefix */ 37067754Smsmith 37167754Smsmith if (*Name == '\\') 37267754Smsmith { 37367754Smsmith Name++; 37467754Smsmith } 37567754Smsmith 37667754Smsmith /* Convert all slash path separators to dots */ 37767754Smsmith 37867754Smsmith while (*Name) 37967754Smsmith { 38067754Smsmith if ((*Name == '/') || 38167754Smsmith (*Name == '\\')) 38267754Smsmith { 38367754Smsmith *Name = '.'; 38467754Smsmith } 38567754Smsmith 38667754Smsmith Name++; 38767754Smsmith } 38867754Smsmith} 38967754Smsmith 39067754Smsmith 39167754Smsmith/******************************************************************************* 39267754Smsmith * 39367754Smsmith * FUNCTION: AcpiDbSecondPassParse 39467754Smsmith * 39567754Smsmith * PARAMETERS: Root - Root of the parse tree 39667754Smsmith * 39767754Smsmith * RETURN: Status 39867754Smsmith * 39967754Smsmith * DESCRIPTION: Second pass parse of the ACPI tables. We need to wait until 40067754Smsmith * second pass to parse the control methods 40167754Smsmith * 40267754Smsmith ******************************************************************************/ 40367754Smsmith 40467754SmsmithACPI_STATUS 40567754SmsmithAcpiDbSecondPassParse ( 40667754Smsmith ACPI_PARSE_OBJECT *Root) 40767754Smsmith{ 40867754Smsmith ACPI_PARSE_OBJECT *Op = Root; 40999679Siwasaki ACPI_PARSE_OBJECT *Method; 41067754Smsmith ACPI_PARSE_OBJECT *SearchOp; 41167754Smsmith ACPI_PARSE_OBJECT *StartOp; 41267754Smsmith ACPI_STATUS Status = AE_OK; 41367754Smsmith UINT32 BaseAmlOffset; 41484491Smsmith ACPI_WALK_STATE *WalkState; 41567754Smsmith 41667754Smsmith 41791116Smsmith ACPI_FUNCTION_ENTRY (); 41884491Smsmith 41984491Smsmith 42067754Smsmith AcpiOsPrintf ("Pass two parse ....\n"); 42167754Smsmith 42267754Smsmith while (Op) 42367754Smsmith { 42499679Siwasaki if (Op->Common.AmlOpcode == AML_METHOD_OP) 42567754Smsmith { 42699679Siwasaki Method = Op; 42767754Smsmith 42899679Siwasaki /* Create a new walk state for the parse */ 42999679Siwasaki 43084491Smsmith WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, 43184491Smsmith NULL, NULL, NULL); 43284491Smsmith if (!WalkState) 43384491Smsmith { 43484491Smsmith return (AE_NO_MEMORY); 43584491Smsmith } 43667754Smsmith 43799679Siwasaki /* Init the Walk State */ 43884491Smsmith 43984491Smsmith WalkState->ParserState.Aml = 44099679Siwasaki WalkState->ParserState.AmlStart = Method->Named.Data; 44184491Smsmith WalkState->ParserState.AmlEnd = 44299679Siwasaki WalkState->ParserState.PkgEnd = Method->Named.Data + Method->Named.Length; 44384491Smsmith WalkState->ParserState.StartScope = Op; 44484491Smsmith 44584491Smsmith WalkState->DescendingCallback = AcpiDsLoad1BeginOp; 44684491Smsmith WalkState->AscendingCallback = AcpiDsLoad1EndOp; 44784491Smsmith 44899679Siwasaki /* Perform the AML parse */ 44984491Smsmith 45084491Smsmith Status = AcpiPsParseAml (WalkState); 45184491Smsmith 45299679Siwasaki BaseAmlOffset = (Method->Common.Value.Arg)->Common.AmlOffset + 1; 45399679Siwasaki StartOp = (Method->Common.Value.Arg)->Common.Next; 45467754Smsmith SearchOp = StartOp; 45567754Smsmith 45667754Smsmith while (SearchOp) 45767754Smsmith { 45899679Siwasaki SearchOp->Common.AmlOffset += BaseAmlOffset; 45967754Smsmith SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); 46067754Smsmith } 46167754Smsmith } 46267754Smsmith 46399679Siwasaki if (Op->Common.AmlOpcode == AML_REGION_OP) 46467754Smsmith { 46567754Smsmith /* TBD: [Investigate] this isn't quite the right thing to do! */ 46667754Smsmith /* 46767754Smsmith * 46867754Smsmith * Method = (ACPI_DEFERRED_OP *) Op; 46967754Smsmith * Status = AcpiPsParseAml (Op, Method->Body, Method->BodyLength); 47067754Smsmith */ 47167754Smsmith } 47267754Smsmith 47367754Smsmith if (ACPI_FAILURE (Status)) 47467754Smsmith { 47584491Smsmith break; 47667754Smsmith } 47767754Smsmith 47867754Smsmith Op = AcpiPsGetDepthNext (Root, Op); 47967754Smsmith } 48067754Smsmith 48167754Smsmith return (Status); 48267754Smsmith} 48367754Smsmith 48467754Smsmith 48567754Smsmith/******************************************************************************* 48667754Smsmith * 48767754Smsmith * FUNCTION: AcpiDbLocalNsLookup 48867754Smsmith * 48967754Smsmith * PARAMETERS: Name - Name to lookup 49067754Smsmith * 49167754Smsmith * RETURN: Pointer to a namespace node 49267754Smsmith * 49367754Smsmith * DESCRIPTION: Lookup a name in the ACPI namespace 49467754Smsmith * 49591116Smsmith * Note: Currently begins search from the root. Could be enhanced to use 49691116Smsmith * the current prefix (scope) node as the search beginning point. 49791116Smsmith * 49867754Smsmith ******************************************************************************/ 49967754Smsmith 50067754SmsmithACPI_NAMESPACE_NODE * 50167754SmsmithAcpiDbLocalNsLookup ( 502114237Snjl char *Name) 50367754Smsmith{ 504114237Snjl char *InternalPath; 50567754Smsmith ACPI_STATUS Status; 50667754Smsmith ACPI_NAMESPACE_NODE *Node = NULL; 50767754Smsmith 50867754Smsmith 50967754Smsmith AcpiDbPrepNamestring (Name); 51067754Smsmith 51167754Smsmith /* Build an internal namestring */ 51267754Smsmith 51367754Smsmith Status = AcpiNsInternalizeName (Name, &InternalPath); 51467754Smsmith if (ACPI_FAILURE (Status)) 51567754Smsmith { 51667754Smsmith AcpiOsPrintf ("Invalid namestring: %s\n", Name); 51767754Smsmith return (NULL); 51867754Smsmith } 51967754Smsmith 52091116Smsmith /* 52191116Smsmith * Lookup the name. 52291116Smsmith * (Uses root node as the search starting point) 52391116Smsmith */ 52491116Smsmith Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 52591116Smsmith ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node); 52667754Smsmith if (ACPI_FAILURE (Status)) 52767754Smsmith { 52880062Smsmith AcpiOsPrintf ("Could not locate name: %s %s\n", Name, AcpiFormatException (Status)); 52967754Smsmith } 53067754Smsmith 53180062Smsmith ACPI_MEM_FREE (InternalPath); 53267754Smsmith return (Node); 53367754Smsmith} 53467754Smsmith 53567754Smsmith 536102550Siwasaki#endif /* ACPI_DEBUGGER */ 53767754Smsmith 53867754Smsmith 539