1 /******************************************************************************
3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2013, Intel Corp.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions, and the following disclaimer,
16 * without modification.
17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 * substantially similar to the "NO WARRANTY" disclaimer below
19 * ("Disclaimer") and any redistribution must be conditioned upon
20 * including a substantially similar Disclaimer requirement for further
21 * binary redistribution.
22 * 3. Neither the names of the above-listed copyright holders nor the names
23 * of any contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
26 * Alternatively, this software may be distributed under the terms of the
27 * GNU General Public License ("GPL") version 2 as published by the Free
28 * Software Foundation.
31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGES.
45 #ifndef __ACPARSER_H__
46 #define __ACPARSER_H__
49 #define OP_HAS_RETURN_VALUE 1
51 /* Variable number of arguments. This field must be 32 bits */
53 #define ACPI_VAR_ARGS ACPI_UINT32_MAX
56 #define ACPI_PARSE_DELETE_TREE 0x0001
57 #define ACPI_PARSE_NO_TREE_DELETE 0x0000
58 #define ACPI_PARSE_TREE_MASK 0x0001
60 #define ACPI_PARSE_LOAD_PASS1 0x0010
61 #define ACPI_PARSE_LOAD_PASS2 0x0020
62 #define ACPI_PARSE_EXECUTE 0x0030
63 #define ACPI_PARSE_MODE_MASK 0x0030
65 #define ACPI_PARSE_DEFERRED_OP 0x0100
66 #define ACPI_PARSE_DISASSEMBLE 0x0200
68 #define ACPI_PARSE_MODULE_LEVEL 0x0400
70 /******************************************************************************
74 *****************************************************************************/
78 * psxface - Parser external interfaces
82 ACPI_EVALUATE_INFO
*Info
);
86 * psargs - Parse AML opcode arguments
89 AcpiPsGetNextPackageEnd (
90 ACPI_PARSE_STATE
*ParserState
);
93 AcpiPsGetNextNamestring (
94 ACPI_PARSE_STATE
*ParserState
);
97 AcpiPsGetNextSimpleArg (
98 ACPI_PARSE_STATE
*ParserState
,
100 ACPI_PARSE_OBJECT
*Arg
);
103 AcpiPsGetNextNamepath (
104 ACPI_WALK_STATE
*WalkState
,
105 ACPI_PARSE_STATE
*ParserState
,
106 ACPI_PARSE_OBJECT
*Arg
,
111 ACPI_WALK_STATE
*WalkState
,
112 ACPI_PARSE_STATE
*ParserState
,
114 ACPI_PARSE_OBJECT
**ReturnArg
);
122 ACPI_PARSE_OBJECT
*Scope
,
128 ACPI_PARSE_OBJECT
*Op
);
132 * psobject - support for parse object processing
136 ACPI_WALK_STATE
*WalkState
,
138 ACPI_PARSE_OBJECT
*UnnamedOp
,
139 ACPI_PARSE_OBJECT
**Op
);
143 ACPI_WALK_STATE
*WalkState
,
145 ACPI_PARSE_OBJECT
**NewOp
);
149 ACPI_WALK_STATE
*WalkState
,
150 ACPI_PARSE_OBJECT
**Op
,
154 AcpiPsCompleteFinalOp (
155 ACPI_WALK_STATE
*WalkState
,
156 ACPI_PARSE_OBJECT
*Op
,
161 * psopinfo - AML Opcode information
163 const ACPI_OPCODE_INFO
*
164 AcpiPsGetOpcodeInfo (
168 AcpiPsGetOpcodeName (
172 AcpiPsGetArgumentCount (
177 * psparse - top level parsing routines
181 ACPI_WALK_STATE
*WalkState
);
184 AcpiPsGetOpcodeSize (
189 ACPI_PARSE_STATE
*state
);
192 AcpiPsCompleteThisOp (
193 ACPI_WALK_STATE
*WalkState
,
194 ACPI_PARSE_OBJECT
*Op
);
197 AcpiPsNextParseState (
198 ACPI_WALK_STATE
*WalkState
,
199 ACPI_PARSE_OBJECT
*Op
,
200 ACPI_STATUS CallbackStatus
);
204 * psloop - main parse loop
208 ACPI_WALK_STATE
*WalkState
);
212 * psscope - Scope stack management routines
216 ACPI_PARSE_STATE
*ParserState
,
217 ACPI_PARSE_OBJECT
*Root
);
220 AcpiPsGetParentScope (
221 ACPI_PARSE_STATE
*state
);
224 AcpiPsHasCompletedScope (
225 ACPI_PARSE_STATE
*ParserState
);
229 ACPI_PARSE_STATE
*ParserState
,
230 ACPI_PARSE_OBJECT
**Op
,
236 ACPI_PARSE_STATE
*ParserState
,
237 ACPI_PARSE_OBJECT
*Op
,
238 UINT32 RemainingArgs
,
243 ACPI_PARSE_STATE
*state
);
247 * pstree - parse tree manipulation routines
251 ACPI_PARSE_OBJECT
*op
,
252 ACPI_PARSE_OBJECT
*arg
);
256 ACPI_PARSE_OBJECT
*Scope
,
263 ACPI_PARSE_OBJECT
*op
,
268 ACPI_PARSE_OBJECT
*Origin
,
269 ACPI_PARSE_OBJECT
*Op
);
273 * pswalk - parse tree walk routines
276 AcpiPsWalkParsedAml (
277 ACPI_PARSE_OBJECT
*StartOp
,
278 ACPI_PARSE_OBJECT
*EndOp
,
279 ACPI_OPERAND_OBJECT
*MthDesc
,
280 ACPI_NAMESPACE_NODE
*StartNode
,
281 ACPI_OPERAND_OBJECT
**Params
,
282 ACPI_OPERAND_OBJECT
**CallerReturnDesc
,
283 ACPI_OWNER_ID OwnerId
,
284 ACPI_PARSE_DOWNWARDS DescendingCallback
,
285 ACPI_PARSE_UPWARDS AscendingCallback
);
288 AcpiPsGetNextWalkOp (
289 ACPI_WALK_STATE
*WalkState
,
290 ACPI_PARSE_OBJECT
*Op
,
291 ACPI_PARSE_UPWARDS AscendingCallback
);
294 AcpiPsDeleteCompletedOp (
295 ACPI_WALK_STATE
*WalkState
);
298 AcpiPsDeleteParseTree (
299 ACPI_PARSE_OBJECT
*root
);
303 * psutils - parser utilities
306 AcpiPsCreateScopeOp (
311 ACPI_PARSE_OBJECT
*op
,
320 ACPI_PARSE_OBJECT
*Op
);
323 AcpiPsIsLeadingChar (
328 ACPI_PARSE_OBJECT
*op
);
332 ACPI_PARSE_OBJECT
*op
,
337 * psdump - display parser tree
343 ACPI_PARSE_OBJECT
*Op
);
349 ACPI_PARSE_OBJECT
*Op
);
353 ACPI_PARSE_OBJECT
*op
);
356 #endif /* __ACPARSER_H__ */