acparser.h revision 167802
1218887Sdim/****************************************************************************** 2218887Sdim * 3218887Sdim * Module Name: acparser.h - AML Parser subcomponent prototypes and defines 4218887Sdim * $Revision: 1.83 $ 5218887Sdim * 6218887Sdim *****************************************************************************/ 7218887Sdim 8218887Sdim/****************************************************************************** 9218887Sdim * 10218887Sdim * 1. Copyright Notice 11218887Sdim * 12218887Sdim * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. 13218887Sdim * All rights reserved. 14218887Sdim * 15218887Sdim * 2. License 16218887Sdim * 17218887Sdim * 2.1. This is your license from Intel Corp. under its intellectual property 18218887Sdim * rights. You may have additional license terms from the party that provided 19218887Sdim * you this software, covering your right to use that party's intellectual 20218887Sdim * property rights. 21226633Sdim * 22226633Sdim * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 23249423Sdim * copy of the source code appearing in this file ("Covered Code") an 24249423Sdim * irrevocable, perpetual, worldwide license under Intel's copyrights in the 25249423Sdim * base code distributed originally by Intel ("Original Intel Code") to copy, 26218887Sdim * make derivatives, distribute, use and display any portion of the Covered 27218887Sdim * Code in any form, with the right to sublicense such rights; and 28218887Sdim * 29218887Sdim * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 30218887Sdim * license (with the right to sublicense), under only those claims of Intel 31218887Sdim * patents that are infringed by the Original Intel Code, to make, use, sell, 32218887Sdim * offer to sell, and import the Covered Code and derivative works thereof 33218887Sdim * solely to the minimum extent necessary to exercise the above copyright 34218887Sdim * license, and in no event shall the patent license extend to any additions 35218887Sdim * to or modifications of the Original Intel Code. No other license or right 36218887Sdim * is granted directly or by implication, estoppel or otherwise; 37218887Sdim * 38218887Sdim * The above copyright and patent license is granted only if the following 39218887Sdim * conditions are met: 40226633Sdim * 41218887Sdim * 3. Conditions 42218887Sdim * 43234353Sdim * 3.1. Redistribution of Source with Rights to Further Distribute Source. 44234353Sdim * Redistribution of source code of any substantial portion of the Covered 45218887Sdim * Code or modification with rights to further distribute source must include 46234353Sdim * the above Copyright Notice, the above License, this list of Conditions, 47218887Sdim * and the following Disclaimer and Export Compliance provision. In addition, 48226633Sdim * Licensee must cause all Covered Code to which Licensee contributes to 49218887Sdim * contain a file documenting the changes Licensee made to create that Covered 50226633Sdim * Code and the date of any change. Licensee must include in that file the 51226633Sdim * documentation of any changes made by any predecessor Licensee. Licensee 52234353Sdim * must include a prominent statement that the modification is derived, 53218887Sdim * directly or indirectly, from Original Intel Code. 54218887Sdim * 55218887Sdim * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 56218887Sdim * Redistribution of source code of any substantial portion of the Covered 57218887Sdim * Code or modification without rights to further distribute source must 58218887Sdim * include the following Disclaimer and Export Compliance provision in the 59218887Sdim * documentation and/or other materials provided with distribution. In 60218887Sdim * addition, Licensee may not authorize further sublicense of source of any 61218887Sdim * portion of the Covered Code, and must include terms to the effect that the 62218887Sdim * license from Licensee to its licensee is limited to the intellectual 63218887Sdim * property embodied in the software Licensee provides to its licensee, and 64234353Sdim * not to intellectual property embodied in modifications its licensee may 65218887Sdim * make. 66234353Sdim * 67218887Sdim * 3.3. Redistribution of Executable. Redistribution in executable form of any 68243830Sdim * substantial portion of the Covered Code or modification must reproduce the 69218887Sdim * above Copyright Notice, and the following Disclaimer and Export Compliance 70218887Sdim * provision in the documentation and/or other materials provided with the 71234353Sdim * distribution. 72234353Sdim * 73234353Sdim * 3.4. Intel retains all right, title, and interest in and to the Original 74234353Sdim * Intel Code. 75234353Sdim * 76234353Sdim * 3.5. Neither the name Intel nor any other trademark owned or controlled by 77234353Sdim * Intel shall be used in advertising or otherwise to promote the sale, use or 78234353Sdim * other dealings in products derived from or relating to the Covered Code 79234353Sdim * without prior written authorization from Intel. 80234353Sdim * 81234353Sdim * 4. Disclaimer and Export Compliance 82234353Sdim * 83234353Sdim * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 84234353Sdim * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 85234353Sdim * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 86234353Sdim * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 87234353Sdim * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 88234353Sdim * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 89234353Sdim * PARTICULAR PURPOSE. 90234353Sdim * 91234353Sdim * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 92234353Sdim * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 93234353Sdim * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 94239462Sdim * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 95239462Sdim * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 96218887Sdim * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 97218887Sdim * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 98234353Sdim * LIMITED REMEDY. 99249423Sdim * 100234353Sdim * 4.3. Licensee shall not export, either directly or indirectly, any of this 101218887Sdim * software or system incorporating such software without first obtaining any 102234353Sdim * required license or other approval from the U. S. Department of Commerce or 103234353Sdim * any other agency or department of the United States Government. In the 104218887Sdim * event Licensee exports any such software from the United States or 105234353Sdim * re-exports any such software from a foreign destination, Licensee shall 106218887Sdim * ensure that the distribution and export/re-export of the software is in 107218887Sdim * compliance with all laws, regulations, orders, or other restrictions of the 108218887Sdim * U.S. Export Administration Regulations. Licensee agrees that neither it nor 109218887Sdim * any of its subsidiaries will export/re-export any technical data, process, 110218887Sdim * software, or service, directly or indirectly, to any country for which the 111218887Sdim * United States government or any agency thereof requires an export license, 112218887Sdim * other governmental approval, or letter of assurance, without first obtaining 113218887Sdim * such license, approval or letter. 114218887Sdim * 115218887Sdim *****************************************************************************/ 116218887Sdim 117226633Sdim 118218887Sdim#ifndef __ACPARSER_H__ 119226633Sdim#define __ACPARSER_H__ 120218887Sdim 121218887Sdim 122218887Sdim#define OP_HAS_RETURN_VALUE 1 123234353Sdim 124218887Sdim/* Variable number of arguments. This field must be 32 bits */ 125226633Sdim 126218887Sdim#define ACPI_VAR_ARGS ACPI_UINT32_MAX 127218887Sdim 128226633Sdim 129218887Sdim#define ACPI_PARSE_DELETE_TREE 0x0001 130218887Sdim#define ACPI_PARSE_NO_TREE_DELETE 0x0000 131226633Sdim#define ACPI_PARSE_TREE_MASK 0x0001 132218887Sdim 133226633Sdim#define ACPI_PARSE_LOAD_PASS1 0x0010 134218887Sdim#define ACPI_PARSE_LOAD_PASS2 0x0020 135218887Sdim#define ACPI_PARSE_EXECUTE 0x0030 136218887Sdim#define ACPI_PARSE_MODE_MASK 0x0030 137218887Sdim 138218887Sdim#define ACPI_PARSE_DEFERRED_OP 0x0100 139218887Sdim#define ACPI_PARSE_DISASSEMBLE 0x0200 140218887Sdim 141218887Sdim 142234353Sdim/****************************************************************************** 143218887Sdim * 144243830Sdim * Parser interfaces 145218887Sdim * 146218887Sdim *****************************************************************************/ 147226633Sdim 148218887Sdim 149218887Sdim/* 150218887Sdim * psxface - Parser external interfaces 151218887Sdim */ 152234353SdimACPI_STATUS 153234353SdimAcpiPsExecuteMethod ( 154218887Sdim ACPI_EVALUATE_INFO *Info); 155226633Sdim 156218887Sdim 157218887Sdim/* 158234353Sdim * psargs - Parse AML opcode arguments 159226633Sdim */ 160218887SdimUINT8 * 161218887SdimAcpiPsGetNextPackageEnd ( 162234353Sdim ACPI_PARSE_STATE *ParserState); 163234353Sdim 164226633Sdimchar * 165218887SdimAcpiPsGetNextNamestring ( 166234353Sdim ACPI_PARSE_STATE *ParserState); 167218887Sdim 168218887Sdimvoid 169226633SdimAcpiPsGetNextSimpleArg ( 170218887Sdim ACPI_PARSE_STATE *ParserState, 171226633Sdim UINT32 ArgType, 172218887Sdim ACPI_PARSE_OBJECT *Arg); 173243830Sdim 174218887SdimACPI_STATUS 175234353SdimAcpiPsGetNextNamepath ( 176218887Sdim ACPI_WALK_STATE *WalkState, 177226633Sdim ACPI_PARSE_STATE *ParserState, 178234353Sdim ACPI_PARSE_OBJECT *Arg, 179234353Sdim BOOLEAN MethodCall); 180218887Sdim 181218887SdimACPI_STATUS 182234353SdimAcpiPsGetNextArg ( 183218887Sdim ACPI_WALK_STATE *WalkState, 184218887Sdim ACPI_PARSE_STATE *ParserState, 185218887Sdim UINT32 ArgType, 186218887Sdim ACPI_PARSE_OBJECT **ReturnArg); 187218887Sdim 188218887Sdim 189234353Sdim/* 190218887Sdim * psfind 191218887Sdim */ 192218887SdimACPI_PARSE_OBJECT * 193226633SdimAcpiPsFindName ( 194218887Sdim ACPI_PARSE_OBJECT *Scope, 195218887Sdim UINT32 Name, 196218887Sdim UINT32 Opcode); 197218887Sdim 198226633SdimACPI_PARSE_OBJECT* 199226633SdimAcpiPsGetParent ( 200218887Sdim ACPI_PARSE_OBJECT *Op); 201218887Sdim 202226633Sdim 203218887Sdim/* 204218887Sdim * psopcode - AML Opcode information 205226633Sdim */ 206218887Sdimconst ACPI_OPCODE_INFO * 207218887SdimAcpiPsGetOpcodeInfo ( 208218887Sdim UINT16 Opcode); 209226633Sdim 210218887Sdimchar * 211243830SdimAcpiPsGetOpcodeName ( 212218887Sdim UINT16 Opcode); 213234353Sdim 214218887SdimUINT8 215218887SdimAcpiPsGetArgumentCount ( 216226633Sdim UINT32 OpType); 217218887Sdim 218218887Sdim 219218887Sdim/* 220218887Sdim * psparse - top level parsing routines 221218887Sdim */ 222218887SdimACPI_STATUS 223218887SdimAcpiPsParseAml ( 224218887Sdim ACPI_WALK_STATE *WalkState); 225218887Sdim 226218887SdimUINT32 227226633SdimAcpiPsGetOpcodeSize ( 228218887Sdim UINT32 Opcode); 229218887Sdim 230218887SdimUINT16 231218887SdimAcpiPsPeekOpcode ( 232218887Sdim ACPI_PARSE_STATE *state); 233218887Sdim 234218887SdimACPI_STATUS 235218887SdimAcpiPsCompleteThisOp ( 236218887Sdim ACPI_WALK_STATE *WalkState, 237218887Sdim ACPI_PARSE_OBJECT *Op); 238218887Sdim 239218887SdimACPI_STATUS 240218887SdimAcpiPsNextParseState ( 241218887Sdim ACPI_WALK_STATE *WalkState, 242218887Sdim ACPI_PARSE_OBJECT *Op, 243218887Sdim ACPI_STATUS CallbackStatus); 244243830Sdim 245218887Sdim 246234353Sdim/* 247218887Sdim * psloop - main parse loop 248218887Sdim */ 249218887SdimACPI_STATUS 250218887SdimAcpiPsParseLoop ( 251218887Sdim ACPI_WALK_STATE *WalkState); 252218887Sdim 253218887Sdim 254218887Sdim/* 255218887Sdim * psscope - Scope stack management routines 256218887Sdim */ 257218887SdimACPI_STATUS 258226633SdimAcpiPsInitScope ( 259218887Sdim ACPI_PARSE_STATE *ParserState, 260218887Sdim ACPI_PARSE_OBJECT *Root); 261218887Sdim 262218887SdimACPI_PARSE_OBJECT * 263218887SdimAcpiPsGetParentScope ( 264218887Sdim ACPI_PARSE_STATE *state); 265218887Sdim 266218887SdimBOOLEAN 267218887SdimAcpiPsHasCompletedScope ( 268218887Sdim ACPI_PARSE_STATE *ParserState); 269226633Sdim 270218887Sdimvoid 271218887SdimAcpiPsPopScope ( 272226633Sdim ACPI_PARSE_STATE *ParserState, 273218887Sdim ACPI_PARSE_OBJECT **Op, 274226633Sdim UINT32 *ArgList, 275226633Sdim UINT32 *ArgCount); 276218887Sdim 277218887SdimACPI_STATUS 278218887SdimAcpiPsPushScope ( 279226633Sdim ACPI_PARSE_STATE *ParserState, 280218887Sdim ACPI_PARSE_OBJECT *Op, 281226633Sdim UINT32 RemainingArgs, 282218887Sdim UINT32 ArgCount); 283243830Sdim 284218887Sdimvoid 285234353SdimAcpiPsCleanupScope ( 286218887Sdim ACPI_PARSE_STATE *state); 287218887Sdim 288218887Sdim 289218887Sdim/* 290218887Sdim * pstree - parse tree manipulation routines 291218887Sdim */ 292218887Sdimvoid 293218887SdimAcpiPsAppendArg( 294218887Sdim ACPI_PARSE_OBJECT *op, 295218887Sdim ACPI_PARSE_OBJECT *arg); 296218887Sdim 297218887SdimACPI_PARSE_OBJECT* 298218887SdimAcpiPsFind ( 299218887Sdim ACPI_PARSE_OBJECT *Scope, 300218887Sdim char *Path, 301218887Sdim UINT16 Opcode, 302218887Sdim UINT32 Create); 303226633Sdim 304218887SdimACPI_PARSE_OBJECT * 305218887SdimAcpiPsGetArg( 306218887Sdim ACPI_PARSE_OBJECT *op, 307218887Sdim UINT32 argn); 308234353Sdim 309234353SdimACPI_PARSE_OBJECT * 310234353SdimAcpiPsGetDepthNext ( 311234353Sdim ACPI_PARSE_OBJECT *Origin, 312234353Sdim ACPI_PARSE_OBJECT *Op); 313234353Sdim 314234353Sdim 315234353Sdim/* 316234353Sdim * pswalk - parse tree walk routines 317234353Sdim */ 318234353SdimACPI_STATUS 319234353SdimAcpiPsWalkParsedAml ( 320243830Sdim ACPI_PARSE_OBJECT *StartOp, 321234353Sdim ACPI_PARSE_OBJECT *EndOp, 322234353Sdim ACPI_OPERAND_OBJECT *MthDesc, 323234353Sdim ACPI_NAMESPACE_NODE *StartNode, 324234353Sdim ACPI_OPERAND_OBJECT **Params, 325234353Sdim ACPI_OPERAND_OBJECT **CallerReturnDesc, 326234353Sdim ACPI_OWNER_ID OwnerId, 327234353Sdim ACPI_PARSE_DOWNWARDS DescendingCallback, 328234353Sdim ACPI_PARSE_UPWARDS AscendingCallback); 329234353Sdim 330234353SdimACPI_STATUS 331234353SdimAcpiPsGetNextWalkOp ( 332234353Sdim ACPI_WALK_STATE *WalkState, 333234353Sdim ACPI_PARSE_OBJECT *Op, 334234353Sdim ACPI_PARSE_UPWARDS AscendingCallback); 335234353Sdim 336234353SdimACPI_STATUS 337234353SdimAcpiPsDeleteCompletedOp ( 338234353Sdim ACPI_WALK_STATE *WalkState); 339234353Sdim 340234353Sdimvoid 341234353SdimAcpiPsDeleteParseTree ( 342234353Sdim ACPI_PARSE_OBJECT *root); 343234353Sdim 344226633Sdim 345218887Sdim/* 346218887Sdim * psutils - parser utilities 347218887Sdim */ 348218887SdimACPI_PARSE_OBJECT * 349218887SdimAcpiPsCreateScopeOp ( 350218887Sdim void); 351218887Sdim 352218887Sdimvoid 353218887SdimAcpiPsInitOp ( 354218887Sdim ACPI_PARSE_OBJECT *op, 355218887Sdim UINT16 opcode); 356218887Sdim 357218887SdimACPI_PARSE_OBJECT * 358243830SdimAcpiPsAllocOp ( 359218887Sdim UINT16 opcode); 360218887Sdim 361218887Sdimvoid 362234353SdimAcpiPsFreeOp ( 363218887Sdim ACPI_PARSE_OBJECT *Op); 364218887Sdim 365218887SdimBOOLEAN 366218887SdimAcpiPsIsLeadingChar ( 367218887Sdim UINT32 c); 368218887Sdim 369218887SdimBOOLEAN 370218887SdimAcpiPsIsPrefixChar ( 371218887Sdim UINT32 c); 372218887Sdim 373218887SdimUINT32 374218887SdimAcpiPsGetName( 375218887Sdim ACPI_PARSE_OBJECT *op); 376218887Sdim 377218887Sdimvoid 378218887SdimAcpiPsSetName( 379218887Sdim ACPI_PARSE_OBJECT *op, 380218887Sdim UINT32 name); 381218887Sdim 382226633Sdim 383218887Sdim/* 384218887Sdim * psdump - display parser tree 385218887Sdim */ 386218887SdimUINT32 387234353SdimAcpiPsSprintPath ( 388234353Sdim char *BufferStart, 389234353Sdim UINT32 BufferSize, 390234353Sdim ACPI_PARSE_OBJECT *Op); 391234353Sdim 392234353SdimUINT32 393234353SdimAcpiPsSprintOp ( 394234353Sdim char *BufferStart, 395234353Sdim UINT32 BufferSize, 396234353Sdim ACPI_PARSE_OBJECT *Op); 397234353Sdim 398234353Sdimvoid 399243830SdimAcpiPsShow ( 400234353Sdim ACPI_PARSE_OBJECT *op); 401234353Sdim 402234353Sdim 403234353Sdim#endif /* __ACPARSER_H__ */ 404234353Sdim