acparser.h revision 941:49d0d4c2eea8
155714Skris/****************************************************************************** 255714Skris * 355714Skris * Module Name: acparser.h - AML Parser subcomponent prototypes and defines 455714Skris * $Revision: 1.77 $ 555714Skris * 655714Skris *****************************************************************************/ 755714Skris 8280297Sjkim/****************************************************************************** 955714Skris * 1055714Skris * 1. Copyright Notice 1155714Skris * 1255714Skris * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp. 1355714Skris * All rights reserved. 1455714Skris * 15280297Sjkim * 2. License 1655714Skris * 1755714Skris * 2.1. This is your license from Intel Corp. under its intellectual property 1855714Skris * rights. You may have additional license terms from the party that provided 1955714Skris * you this software, covering your right to use that party's intellectual 2055714Skris * property rights. 2155714Skris * 22280297Sjkim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 2355714Skris * copy of the source code appearing in this file ("Covered Code") an 2455714Skris * irrevocable, perpetual, worldwide license under Intel's copyrights in the 2555714Skris * base code distributed originally by Intel ("Original Intel Code") to copy, 2655714Skris * make derivatives, distribute, use and display any portion of the Covered 2755714Skris * Code in any form, with the right to sublicense such rights; and 2855714Skris * 2955714Skris * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 3055714Skris * license (with the right to sublicense), under only those claims of Intel 3155714Skris * patents that are infringed by the Original Intel Code, to make, use, sell, 3255714Skris * offer to sell, and import the Covered Code and derivative works thereof 3355714Skris * solely to the minimum extent necessary to exercise the above copyright 3455714Skris * license, and in no event shall the patent license extend to any additions 3555714Skris * to or modifications of the Original Intel Code. No other license or right 3655714Skris * is granted directly or by implication, estoppel or otherwise; 37280297Sjkim * 3855714Skris * The above copyright and patent license is granted only if the following 3955714Skris * conditions are met: 40280297Sjkim * 4155714Skris * 3. Conditions 4255714Skris * 4355714Skris * 3.1. Redistribution of Source with Rights to Further Distribute Source. 4455714Skris * Redistribution of source code of any substantial portion of the Covered 4555714Skris * Code or modification with rights to further distribute source must include 4655714Skris * the above Copyright Notice, the above License, this list of Conditions, 4755714Skris * and the following Disclaimer and Export Compliance provision. In addition, 4855714Skris * Licensee must cause all Covered Code to which Licensee contributes to 4955714Skris * contain a file documenting the changes Licensee made to create that Covered 5055714Skris * Code and the date of any change. Licensee must include in that file the 5155714Skris * documentation of any changes made by any predecessor Licensee. Licensee 52280297Sjkim * must include a prominent statement that the modification is derived, 5355714Skris * directly or indirectly, from Original Intel Code. 5455714Skris * 5555714Skris * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 5655714Skris * Redistribution of source code of any substantial portion of the Covered 5755714Skris * Code or modification without rights to further distribute source must 58109998Smarkm * include the following Disclaimer and Export Compliance provision in the 59109998Smarkm * documentation and/or other materials provided with distribution. In 60109998Smarkm * addition, Licensee may not authorize further sublicense of source of any 61109998Smarkm * portion of the Covered Code, and must include terms to the effect that the 62109998Smarkm * license from Licensee to its licensee is limited to the intellectual 63109998Smarkm * property embodied in the software Licensee provides to its licensee, and 64109998Smarkm * not to intellectual property embodied in modifications its licensee may 65109998Smarkm * make. 66280297Sjkim * 67109998Smarkm * 3.3. Redistribution of Executable. Redistribution in executable form of any 68109998Smarkm * substantial portion of the Covered Code or modification must reproduce the 69109998Smarkm * above Copyright Notice, and the following Disclaimer and Export Compliance 70109998Smarkm * provision in the documentation and/or other materials provided with the 71109998Smarkm * distribution. 72109998Smarkm * 73109998Smarkm * 3.4. Intel retains all right, title, and interest in and to the Original 74109998Smarkm * Intel Code. 75109998Smarkm * 76109998Smarkm * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77109998Smarkm * Intel shall be used in advertising or otherwise to promote the sale, use or 78109998Smarkm * other dealings in products derived from or relating to the Covered Code 79109998Smarkm * without prior written authorization from Intel. 80109998Smarkm * 81109998Smarkm * 4. Disclaimer and Export Compliance 82109998Smarkm * 83109998Smarkm * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84109998Smarkm * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85109998Smarkm * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86109998Smarkm * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87109998Smarkm * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88109998Smarkm * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89109998Smarkm * PARTICULAR PURPOSE. 90109998Smarkm * 91109998Smarkm * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92109998Smarkm * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93109998Smarkm * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94109998Smarkm * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95109998Smarkm * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96109998Smarkm * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97109998Smarkm * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98109998Smarkm * LIMITED REMEDY. 99109998Smarkm * 100109998Smarkm * 4.3. Licensee shall not export, either directly or indirectly, any of this 101109998Smarkm * software or system incorporating such software without first obtaining any 102109998Smarkm * required license or other approval from the U. S. Department of Commerce or 103109998Smarkm * any other agency or department of the United States Government. In the 104109998Smarkm * event Licensee exports any such software from the United States or 105109998Smarkm * re-exports any such software from a foreign destination, Licensee shall 106109998Smarkm * ensure that the distribution and export/re-export of the software is in 107109998Smarkm * compliance with all laws, regulations, orders, or other restrictions of the 108109998Smarkm * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109109998Smarkm * any of its subsidiaries will export/re-export any technical data, process, 110109998Smarkm * software, or service, directly or indirectly, to any country for which the 111160814Ssimon * United States government or any agency thereof requires an export license, 112160814Ssimon * other governmental approval, or letter of assurance, without first obtaining 113280297Sjkim * such license, approval or letter. 114160814Ssimon * 115160814Ssimon *****************************************************************************/ 116238405Sjkim 117238405Sjkim 118238405Sjkim#ifndef __ACPARSER_H__ 119238405Sjkim#define __ACPARSER_H__ 120238405Sjkim 121238405Sjkim 122238405Sjkim#define OP_HAS_RETURN_VALUE 1 123238405Sjkim 124238405Sjkim/* variable # arguments */ 125238405Sjkim 126238405Sjkim#define ACPI_VAR_ARGS ACPI_UINT32_MAX 127238405Sjkim 128238405Sjkim 129238405Sjkim#define ACPI_PARSE_DELETE_TREE 0x0001 130238405Sjkim#define ACPI_PARSE_NO_TREE_DELETE 0x0000 131238405Sjkim#define ACPI_PARSE_TREE_MASK 0x0001 132238405Sjkim 133238405Sjkim#define ACPI_PARSE_LOAD_PASS1 0x0010 134238405Sjkim#define ACPI_PARSE_LOAD_PASS2 0x0020 135238405Sjkim#define ACPI_PARSE_EXECUTE 0x0030 136238405Sjkim#define ACPI_PARSE_MODE_MASK 0x0030 137238405Sjkim 138238405Sjkim#define ACPI_PARSE_DEFERRED_OP 0x0100 139238405Sjkim#define ACPI_PARSE_DISASSEMBLE 0x0200 140238405Sjkim 141238405Sjkim 14255714Skris/****************************************************************************** 143280297Sjkim * 144280297Sjkim * Parser interfaces 145291719Sjkim * 146109998Smarkm *****************************************************************************/ 14759191Skris 14859191Skris 14959191Skris/* 15055714Skris * psxface - Parser external interfaces 15155714Skris */ 15255714SkrisACPI_STATUS 15359191SkrisAcpiPsExecuteMethod ( 15455714Skris ACPI_PARAMETER_INFO *Info); 155109998Smarkm 156109998Smarkm 15755714Skris/* 158238405Sjkim * psargs - Parse AML opcode arguments 159280297Sjkim */ 160280297SjkimUINT8 * 161280297SjkimAcpiPsGetNextPackageEnd ( 162280297Sjkim ACPI_PARSE_STATE *ParserState); 163238405Sjkim 164238405Sjkimchar * 165160814SsimonAcpiPsGetNextNamestring ( 166160814Ssimon ACPI_PARSE_STATE *ParserState); 16755714Skris 16855714Skrisvoid 16959191SkrisAcpiPsGetNextSimpleArg ( 17055714Skris ACPI_PARSE_STATE *ParserState, 171160814Ssimon UINT32 ArgType, 17255714Skris ACPI_PARSE_OBJECT *Arg); 173111147Snectar 174280297SjkimACPI_STATUS 175111147SnectarAcpiPsGetNextNamepath ( 17655714Skris ACPI_WALK_STATE *WalkState, 17759191Skris ACPI_PARSE_STATE *ParserState, 178160814Ssimon ACPI_PARSE_OBJECT *Arg, 179280297Sjkim BOOLEAN MethodCall); 180160814Ssimon 181160814SsimonACPI_STATUS 182280297SjkimAcpiPsGetNextArg ( 183160814Ssimon ACPI_WALK_STATE *WalkState, 184160814Ssimon ACPI_PARSE_STATE *ParserState, 185280297Sjkim UINT32 ArgType, 186160814Ssimon ACPI_PARSE_OBJECT **ReturnArg); 187238405Sjkim 188280297Sjkim 189238405Sjkim/* 190160814Ssimon * psfind 191109998Smarkm */ 192280297SjkimACPI_PARSE_OBJECT * 193280297SjkimAcpiPsFindName ( 194280297Sjkim ACPI_PARSE_OBJECT *Scope, 195280297Sjkim UINT32 Name, 196280297Sjkim UINT32 Opcode); 197280297Sjkim 198280297SjkimACPI_PARSE_OBJECT* 199109998SmarkmAcpiPsGetParent ( 200109998Smarkm ACPI_PARSE_OBJECT *Op); 201280297Sjkim 202109998Smarkm 203280297Sjkim/* 20455714Skris * psopcode - AML Opcode information 20555714Skris */ 206109998Smarkmconst ACPI_OPCODE_INFO * 207280297SjkimAcpiPsGetOpcodeInfo ( 208280297Sjkim UINT16 Opcode); 209109998Smarkm 210280297Sjkimchar * 211280297SjkimAcpiPsGetOpcodeName ( 212160814Ssimon UINT16 Opcode); 213280297Sjkim 214280297Sjkim 21555714Skris/* 216280297Sjkim * psparse - top level parsing routines 217280297Sjkim */ 21855714SkrisACPI_STATUS 21955714SkrisAcpiPsParseAml ( 220298998Sjkim ACPI_WALK_STATE *WalkState); 221298998Sjkim 222298998SjkimUINT32 223280297SjkimAcpiPsGetOpcodeSize ( 224280297Sjkim UINT32 Opcode); 225280297Sjkim 226280297SjkimUINT16 227280297SjkimAcpiPsPeekOpcode ( 228280297Sjkim ACPI_PARSE_STATE *state); 229109998Smarkm 23059191SkrisACPI_STATUS 231109998SmarkmAcpiPsCompleteThisOp ( 232280297Sjkim ACPI_WALK_STATE *WalkState, 23368651Skris ACPI_PARSE_OBJECT *Op); 23455714Skris 235109998SmarkmACPI_STATUS 236160814SsimonAcpiPsNextParseState ( 237280297Sjkim ACPI_WALK_STATE *WalkState, 238280297Sjkim ACPI_PARSE_OBJECT *Op, 239280297Sjkim ACPI_STATUS CallbackStatus); 240280297Sjkim 241280297Sjkim 242280297Sjkim/* 243280297Sjkim * psloop - main parse loop 244109998Smarkm */ 245109998SmarkmACPI_STATUS 24655714SkrisAcpiPsParseLoop ( 24759191Skris ACPI_WALK_STATE *WalkState); 24859191Skris 24955714Skris 25055714Skris/* 251280297Sjkim * psscope - Scope stack management routines 252238405Sjkim */ 253280297SjkimACPI_STATUS 254280297SjkimAcpiPsInitScope ( 255280297Sjkim ACPI_PARSE_STATE *ParserState, 256280297Sjkim ACPI_PARSE_OBJECT *Root); 257280297Sjkim 258280297SjkimACPI_PARSE_OBJECT * 259280297SjkimAcpiPsGetParentScope ( 260280297Sjkim ACPI_PARSE_STATE *state); 261238405Sjkim 262238405SjkimBOOLEAN 263238405SjkimAcpiPsHasCompletedScope ( 264238405Sjkim ACPI_PARSE_STATE *ParserState); 265238405Sjkim 266280297Sjkimvoid 267280297SjkimAcpiPsPopScope ( 268280297Sjkim ACPI_PARSE_STATE *ParserState, 269280297Sjkim ACPI_PARSE_OBJECT **Op, 270238405Sjkim UINT32 *ArgList, 271280297Sjkim UINT32 *ArgCount); 272238405Sjkim 273280297SjkimACPI_STATUS 274280297SjkimAcpiPsPushScope ( 275280297Sjkim ACPI_PARSE_STATE *ParserState, 276280297Sjkim ACPI_PARSE_OBJECT *Op, 277280297Sjkim UINT32 RemainingArgs, 278238405Sjkim UINT32 ArgCount); 279238405Sjkim 280238405Sjkimvoid 281280297SjkimAcpiPsCleanupScope ( 282280297Sjkim ACPI_PARSE_STATE *state); 283280297Sjkim 284280297Sjkim 285238405Sjkim/* 286238405Sjkim * pstree - parse tree manipulation routines 287280297Sjkim */ 288280297Sjkimvoid 289238405SjkimAcpiPsAppendArg( 290280297Sjkim ACPI_PARSE_OBJECT *op, 291280297Sjkim ACPI_PARSE_OBJECT *arg); 292280297Sjkim 293280297SjkimACPI_PARSE_OBJECT* 294280297SjkimAcpiPsFind ( 295280297Sjkim ACPI_PARSE_OBJECT *Scope, 296280297Sjkim char *Path, 297280297Sjkim UINT16 Opcode, 298280297Sjkim UINT32 Create); 299280297Sjkim 300238405SjkimACPI_PARSE_OBJECT * 301238405SjkimAcpiPsGetArg( 302280297Sjkim ACPI_PARSE_OBJECT *op, 303280297Sjkim UINT32 argn); 30459191Skris 305290207SjkimACPI_PARSE_OBJECT * 306298998SjkimAcpiPsGetDepthNext ( 307298998Sjkim ACPI_PARSE_OBJECT *Origin, 308290207Sjkim ACPI_PARSE_OBJECT *Op); 309290207Sjkim 310298998Sjkim 311298998Sjkim/* 312298998Sjkim * pswalk - parse tree walk routines 313298998Sjkim */ 314290207SjkimACPI_STATUS 315298998SjkimAcpiPsWalkParsedAml ( 316298998Sjkim ACPI_PARSE_OBJECT *StartOp, 317298998Sjkim ACPI_PARSE_OBJECT *EndOp, 318298998Sjkim ACPI_OPERAND_OBJECT *MthDesc, 319298998Sjkim ACPI_NAMESPACE_NODE *StartNode, 320298998Sjkim ACPI_OPERAND_OBJECT **Params, 321298998Sjkim ACPI_OPERAND_OBJECT **CallerReturnDesc, 322298998Sjkim ACPI_OWNER_ID OwnerId, 323298998Sjkim ACPI_PARSE_DOWNWARDS DescendingCallback, 324298998Sjkim ACPI_PARSE_UPWARDS AscendingCallback); 325298998Sjkim 326298998SjkimACPI_STATUS 327298998SjkimAcpiPsGetNextWalkOp ( 328298998Sjkim ACPI_WALK_STATE *WalkState, 329298998Sjkim ACPI_PARSE_OBJECT *Op, 330298998Sjkim ACPI_PARSE_UPWARDS AscendingCallback); 331298998Sjkim 332298998SjkimACPI_STATUS 333298998SjkimAcpiPsDeleteCompletedOp ( 334298998Sjkim ACPI_WALK_STATE *WalkState); 335298998Sjkim 336298998Sjkimvoid 337298998SjkimAcpiPsDeleteParseTree ( 338298998Sjkim ACPI_PARSE_OBJECT *root); 339298998Sjkim 340298998Sjkim 341298998Sjkim/* 342298998Sjkim * psutils - parser utilities 343298998Sjkim */ 344298998SjkimACPI_PARSE_OBJECT * 345298998SjkimAcpiPsCreateScopeOp ( 346298998Sjkim void); 347298998Sjkim 348298998Sjkimvoid 349298998SjkimAcpiPsInitOp ( 350298998Sjkim ACPI_PARSE_OBJECT *op, 351298998Sjkim UINT16 opcode); 352290207Sjkim 353290207SjkimACPI_PARSE_OBJECT * 354290207SjkimAcpiPsAllocOp ( 355290207Sjkim UINT16 opcode); 356290207Sjkim 357290207Sjkimvoid 358290207SjkimAcpiPsFreeOp ( 359290207Sjkim ACPI_PARSE_OBJECT *Op); 360290207Sjkim 361290207SjkimBOOLEAN 362290207SjkimAcpiPsIsLeadingChar ( 363290207Sjkim UINT32 c); 364290207Sjkim 365290207SjkimBOOLEAN 366290207SjkimAcpiPsIsPrefixChar ( 367290207Sjkim UINT32 c); 368290207Sjkim 369290207SjkimUINT32 370290207SjkimAcpiPsGetName( 371290207Sjkim ACPI_PARSE_OBJECT *op); 372290207Sjkim 373290207Sjkimvoid 374290207SjkimAcpiPsSetName( 375290207Sjkim ACPI_PARSE_OBJECT *op, 376290207Sjkim UINT32 name); 377290207Sjkim 378290207Sjkim 379290207Sjkim/* 380290207Sjkim * psdump - display parser tree 381290207Sjkim */ 382290207SjkimUINT32 383290207SjkimAcpiPsSprintPath ( 384290207Sjkim char *BufferStart, 385290207Sjkim UINT32 BufferSize, 386290207Sjkim ACPI_PARSE_OBJECT *Op); 387290207Sjkim 388290207SjkimUINT32 389290207SjkimAcpiPsSprintOp ( 390290207Sjkim char *BufferStart, 391290207Sjkim UINT32 BufferSize, 392290207Sjkim ACPI_PARSE_OBJECT *Op); 393290207Sjkim 394290207Sjkimvoid 395290207SjkimAcpiPsShow ( 396290207Sjkim ACPI_PARSE_OBJECT *op); 397290207Sjkim 398298998Sjkim 399290207Sjkim#endif /* __ACPARSER_H__ */ 400298998Sjkim