1 /******************************************************************************
3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2016, 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.
44 #ifndef __ACPARSER_H__
45 #define __ACPARSER_H__
48 #define OP_HAS_RETURN_VALUE 1
50 /* Variable number of arguments. This field must be 32 bits */
52 #define ACPI_VAR_ARGS ACPI_UINT32_MAX
55 #define ACPI_PARSE_DELETE_TREE 0x0001
56 #define ACPI_PARSE_NO_TREE_DELETE 0x0000
57 #define ACPI_PARSE_TREE_MASK 0x0001
59 #define ACPI_PARSE_LOAD_PASS1 0x0010
60 #define ACPI_PARSE_LOAD_PASS2 0x0020
61 #define ACPI_PARSE_EXECUTE 0x0030
62 #define ACPI_PARSE_MODE_MASK 0x0030
64 #define ACPI_PARSE_DEFERRED_OP 0x0100
65 #define ACPI_PARSE_DISASSEMBLE 0x0200
67 #define ACPI_PARSE_MODULE_LEVEL 0x0400
69 /******************************************************************************
73 *****************************************************************************/
75 extern const UINT8 AcpiGbl_ShortOpIndex
[];
76 extern const UINT8 AcpiGbl_LongOpIndex
[];
80 * psxface - Parser external interfaces
84 ACPI_EVALUATE_INFO
*Info
);
88 * psargs - Parse AML opcode arguments
91 AcpiPsGetNextPackageEnd (
92 ACPI_PARSE_STATE
*ParserState
);
95 AcpiPsGetNextNamestring (
96 ACPI_PARSE_STATE
*ParserState
);
99 AcpiPsGetNextSimpleArg (
100 ACPI_PARSE_STATE
*ParserState
,
102 ACPI_PARSE_OBJECT
*Arg
);
105 AcpiPsGetNextNamepath (
106 ACPI_WALK_STATE
*WalkState
,
107 ACPI_PARSE_STATE
*ParserState
,
108 ACPI_PARSE_OBJECT
*Arg
,
109 BOOLEAN PossibleMethodCall
);
111 /* Values for BOOLEAN above */
113 #define ACPI_NOT_METHOD_CALL FALSE
114 #define ACPI_POSSIBLE_METHOD_CALL TRUE
118 ACPI_WALK_STATE
*WalkState
,
119 ACPI_PARSE_STATE
*ParserState
,
121 ACPI_PARSE_OBJECT
**ReturnArg
);
129 ACPI_PARSE_OBJECT
*Scope
,
135 ACPI_PARSE_OBJECT
*Op
);
139 * psobject - support for parse object processing
143 ACPI_WALK_STATE
*WalkState
,
145 ACPI_PARSE_OBJECT
*UnnamedOp
,
146 ACPI_PARSE_OBJECT
**Op
);
150 ACPI_WALK_STATE
*WalkState
,
152 ACPI_PARSE_OBJECT
**NewOp
);
156 ACPI_WALK_STATE
*WalkState
,
157 ACPI_PARSE_OBJECT
**Op
,
161 AcpiPsCompleteFinalOp (
162 ACPI_WALK_STATE
*WalkState
,
163 ACPI_PARSE_OBJECT
*Op
,
168 * psopinfo - AML Opcode information
170 const ACPI_OPCODE_INFO
*
171 AcpiPsGetOpcodeInfo (
175 AcpiPsGetOpcodeName (
179 AcpiPsGetArgumentCount (
184 * psparse - top level parsing routines
188 ACPI_WALK_STATE
*WalkState
);
191 AcpiPsGetOpcodeSize (
196 ACPI_PARSE_STATE
*state
);
199 AcpiPsCompleteThisOp (
200 ACPI_WALK_STATE
*WalkState
,
201 ACPI_PARSE_OBJECT
*Op
);
204 AcpiPsNextParseState (
205 ACPI_WALK_STATE
*WalkState
,
206 ACPI_PARSE_OBJECT
*Op
,
207 ACPI_STATUS CallbackStatus
);
211 * psloop - main parse loop
215 ACPI_WALK_STATE
*WalkState
);
219 * psscope - Scope stack management routines
223 ACPI_PARSE_STATE
*ParserState
,
224 ACPI_PARSE_OBJECT
*Root
);
227 AcpiPsGetParentScope (
228 ACPI_PARSE_STATE
*state
);
231 AcpiPsHasCompletedScope (
232 ACPI_PARSE_STATE
*ParserState
);
236 ACPI_PARSE_STATE
*ParserState
,
237 ACPI_PARSE_OBJECT
**Op
,
243 ACPI_PARSE_STATE
*ParserState
,
244 ACPI_PARSE_OBJECT
*Op
,
245 UINT32 RemainingArgs
,
250 ACPI_PARSE_STATE
*state
);
254 * pstree - parse tree manipulation routines
258 ACPI_PARSE_OBJECT
*op
,
259 ACPI_PARSE_OBJECT
*arg
);
263 ACPI_PARSE_OBJECT
*Scope
,
270 ACPI_PARSE_OBJECT
*op
,
275 ACPI_PARSE_OBJECT
*Origin
,
276 ACPI_PARSE_OBJECT
*Op
);
280 * pswalk - parse tree walk routines
283 AcpiPsWalkParsedAml (
284 ACPI_PARSE_OBJECT
*StartOp
,
285 ACPI_PARSE_OBJECT
*EndOp
,
286 ACPI_OPERAND_OBJECT
*MthDesc
,
287 ACPI_NAMESPACE_NODE
*StartNode
,
288 ACPI_OPERAND_OBJECT
**Params
,
289 ACPI_OPERAND_OBJECT
**CallerReturnDesc
,
290 ACPI_OWNER_ID OwnerId
,
291 ACPI_PARSE_DOWNWARDS DescendingCallback
,
292 ACPI_PARSE_UPWARDS AscendingCallback
);
295 AcpiPsGetNextWalkOp (
296 ACPI_WALK_STATE
*WalkState
,
297 ACPI_PARSE_OBJECT
*Op
,
298 ACPI_PARSE_UPWARDS AscendingCallback
);
301 AcpiPsDeleteCompletedOp (
302 ACPI_WALK_STATE
*WalkState
);
305 AcpiPsDeleteParseTree (
306 ACPI_PARSE_OBJECT
*root
);
310 * psutils - parser utilities
313 AcpiPsCreateScopeOp (
318 ACPI_PARSE_OBJECT
*op
,
328 ACPI_PARSE_OBJECT
*Op
);
331 AcpiPsIsLeadingChar (
336 ACPI_PARSE_OBJECT
*op
);
340 ACPI_PARSE_OBJECT
*op
,
345 * psdump - display parser tree
351 ACPI_PARSE_OBJECT
*Op
);
357 ACPI_PARSE_OBJECT
*Op
);
361 ACPI_PARSE_OBJECT
*op
);
364 #endif /* __ACPARSER_H__ */