dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / arch / x86 / include / sys / acpi / acparser.h
blobdd2782199d008d9bf93f6a2394dda62cf448082e
1 /******************************************************************************
3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
5 *****************************************************************************/
7 /*
8 * Copyright (C) 2000 - 2016, Intel Corp.
9 * All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
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.
30 * NO WARRANTY
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 /******************************************************************************
71 * Parser interfaces
73 *****************************************************************************/
75 extern const UINT8 AcpiGbl_ShortOpIndex[];
76 extern const UINT8 AcpiGbl_LongOpIndex[];
80 * psxface - Parser external interfaces
82 ACPI_STATUS
83 AcpiPsExecuteMethod (
84 ACPI_EVALUATE_INFO *Info);
88 * psargs - Parse AML opcode arguments
90 UINT8 *
91 AcpiPsGetNextPackageEnd (
92 ACPI_PARSE_STATE *ParserState);
94 char *
95 AcpiPsGetNextNamestring (
96 ACPI_PARSE_STATE *ParserState);
98 void
99 AcpiPsGetNextSimpleArg (
100 ACPI_PARSE_STATE *ParserState,
101 UINT32 ArgType,
102 ACPI_PARSE_OBJECT *Arg);
104 ACPI_STATUS
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
116 ACPI_STATUS
117 AcpiPsGetNextArg (
118 ACPI_WALK_STATE *WalkState,
119 ACPI_PARSE_STATE *ParserState,
120 UINT32 ArgType,
121 ACPI_PARSE_OBJECT **ReturnArg);
125 * psfind
127 ACPI_PARSE_OBJECT *
128 AcpiPsFindName (
129 ACPI_PARSE_OBJECT *Scope,
130 UINT32 Name,
131 UINT32 Opcode);
133 ACPI_PARSE_OBJECT*
134 AcpiPsGetParent (
135 ACPI_PARSE_OBJECT *Op);
139 * psobject - support for parse object processing
141 ACPI_STATUS
142 AcpiPsBuildNamedOp (
143 ACPI_WALK_STATE *WalkState,
144 UINT8 *AmlOpStart,
145 ACPI_PARSE_OBJECT *UnnamedOp,
146 ACPI_PARSE_OBJECT **Op);
148 ACPI_STATUS
149 AcpiPsCreateOp (
150 ACPI_WALK_STATE *WalkState,
151 UINT8 *AmlOpStart,
152 ACPI_PARSE_OBJECT **NewOp);
154 ACPI_STATUS
155 AcpiPsCompleteOp (
156 ACPI_WALK_STATE *WalkState,
157 ACPI_PARSE_OBJECT **Op,
158 ACPI_STATUS Status);
160 ACPI_STATUS
161 AcpiPsCompleteFinalOp (
162 ACPI_WALK_STATE *WalkState,
163 ACPI_PARSE_OBJECT *Op,
164 ACPI_STATUS Status);
168 * psopinfo - AML Opcode information
170 const ACPI_OPCODE_INFO *
171 AcpiPsGetOpcodeInfo (
172 UINT16 Opcode);
174 const char *
175 AcpiPsGetOpcodeName (
176 UINT16 Opcode);
178 UINT8
179 AcpiPsGetArgumentCount (
180 UINT32 OpType);
184 * psparse - top level parsing routines
186 ACPI_STATUS
187 AcpiPsParseAml (
188 ACPI_WALK_STATE *WalkState);
190 UINT32
191 AcpiPsGetOpcodeSize (
192 UINT32 Opcode);
194 UINT16
195 AcpiPsPeekOpcode (
196 ACPI_PARSE_STATE *state);
198 ACPI_STATUS
199 AcpiPsCompleteThisOp (
200 ACPI_WALK_STATE *WalkState,
201 ACPI_PARSE_OBJECT *Op);
203 ACPI_STATUS
204 AcpiPsNextParseState (
205 ACPI_WALK_STATE *WalkState,
206 ACPI_PARSE_OBJECT *Op,
207 ACPI_STATUS CallbackStatus);
211 * psloop - main parse loop
213 ACPI_STATUS
214 AcpiPsParseLoop (
215 ACPI_WALK_STATE *WalkState);
219 * psscope - Scope stack management routines
221 ACPI_STATUS
222 AcpiPsInitScope (
223 ACPI_PARSE_STATE *ParserState,
224 ACPI_PARSE_OBJECT *Root);
226 ACPI_PARSE_OBJECT *
227 AcpiPsGetParentScope (
228 ACPI_PARSE_STATE *state);
230 BOOLEAN
231 AcpiPsHasCompletedScope (
232 ACPI_PARSE_STATE *ParserState);
234 void
235 AcpiPsPopScope (
236 ACPI_PARSE_STATE *ParserState,
237 ACPI_PARSE_OBJECT **Op,
238 UINT32 *ArgList,
239 UINT32 *ArgCount);
241 ACPI_STATUS
242 AcpiPsPushScope (
243 ACPI_PARSE_STATE *ParserState,
244 ACPI_PARSE_OBJECT *Op,
245 UINT32 RemainingArgs,
246 UINT32 ArgCount);
248 void
249 AcpiPsCleanupScope (
250 ACPI_PARSE_STATE *state);
254 * pstree - parse tree manipulation routines
256 void
257 AcpiPsAppendArg(
258 ACPI_PARSE_OBJECT *op,
259 ACPI_PARSE_OBJECT *arg);
261 ACPI_PARSE_OBJECT*
262 AcpiPsFind (
263 ACPI_PARSE_OBJECT *Scope,
264 char *Path,
265 UINT16 Opcode,
266 UINT32 Create);
268 ACPI_PARSE_OBJECT *
269 AcpiPsGetArg(
270 ACPI_PARSE_OBJECT *op,
271 UINT32 argn);
273 ACPI_PARSE_OBJECT *
274 AcpiPsGetDepthNext (
275 ACPI_PARSE_OBJECT *Origin,
276 ACPI_PARSE_OBJECT *Op);
280 * pswalk - parse tree walk routines
282 ACPI_STATUS
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);
294 ACPI_STATUS
295 AcpiPsGetNextWalkOp (
296 ACPI_WALK_STATE *WalkState,
297 ACPI_PARSE_OBJECT *Op,
298 ACPI_PARSE_UPWARDS AscendingCallback);
300 ACPI_STATUS
301 AcpiPsDeleteCompletedOp (
302 ACPI_WALK_STATE *WalkState);
304 void
305 AcpiPsDeleteParseTree (
306 ACPI_PARSE_OBJECT *root);
310 * psutils - parser utilities
312 ACPI_PARSE_OBJECT *
313 AcpiPsCreateScopeOp (
314 UINT8 *Aml);
316 void
317 AcpiPsInitOp (
318 ACPI_PARSE_OBJECT *op,
319 UINT16 opcode);
321 ACPI_PARSE_OBJECT *
322 AcpiPsAllocOp (
323 UINT16 Opcode,
324 UINT8 *Aml);
326 void
327 AcpiPsFreeOp (
328 ACPI_PARSE_OBJECT *Op);
330 BOOLEAN
331 AcpiPsIsLeadingChar (
332 UINT32 c);
334 UINT32
335 AcpiPsGetName(
336 ACPI_PARSE_OBJECT *op);
338 void
339 AcpiPsSetName(
340 ACPI_PARSE_OBJECT *op,
341 UINT32 name);
345 * psdump - display parser tree
347 UINT32
348 AcpiPsSprintPath (
349 char *BufferStart,
350 UINT32 BufferSize,
351 ACPI_PARSE_OBJECT *Op);
353 UINT32
354 AcpiPsSprintOp (
355 char *BufferStart,
356 UINT32 BufferSize,
357 ACPI_PARSE_OBJECT *Op);
359 void
360 AcpiPsShow (
361 ACPI_PARSE_OBJECT *op);
364 #endif /* __ACPARSER_H__ */