ReactOS  0.4.14-dev-358-gbef841c
acparser.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2019, Intel Corp.
9  * All rights reserved.
10  *
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.
25  *
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.
29  *
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.
42  */
43 
44 #ifndef __ACPARSER_H__
45 #define __ACPARSER_H__
46 
47 
48 #define OP_HAS_RETURN_VALUE 1
49 
50 /* Variable number of arguments. This field must be 32 bits */
51 
52 #define ACPI_VAR_ARGS ACPI_UINT32_MAX
53 
54 
55 #define ACPI_PARSE_DELETE_TREE 0x0001
56 #define ACPI_PARSE_NO_TREE_DELETE 0x0000
57 #define ACPI_PARSE_TREE_MASK 0x0001
58 
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
63 
64 #define ACPI_PARSE_DEFERRED_OP 0x0100
65 #define ACPI_PARSE_DISASSEMBLE 0x0200
66 
67 #define ACPI_PARSE_MODULE_LEVEL 0x0400
68 
69 /******************************************************************************
70  *
71  * Parser interfaces
72  *
73  *****************************************************************************/
74 
75 extern const UINT8 AcpiGbl_ShortOpIndex[];
76 extern const UINT8 AcpiGbl_LongOpIndex[];
77 
78 
79 /*
80  * psxface - Parser external interfaces
81  */
85 
89 
90 
91 /*
92  * psargs - Parse AML opcode arguments
93  */
94 UINT8 *
96  ACPI_PARSE_STATE *ParserState);
97 
98 char *
100  ACPI_PARSE_STATE *ParserState);
101 
102 void
104  ACPI_PARSE_STATE *ParserState,
105  UINT32 ArgType,
106  ACPI_PARSE_OBJECT *Arg);
107 
110  ACPI_WALK_STATE *WalkState,
111  ACPI_PARSE_STATE *ParserState,
112  ACPI_PARSE_OBJECT *Arg,
113  BOOLEAN PossibleMethodCall);
114 
115 /* Values for BOOLEAN above */
116 
117 #define ACPI_NOT_METHOD_CALL FALSE
118 #define ACPI_POSSIBLE_METHOD_CALL TRUE
119 
122  ACPI_WALK_STATE *WalkState,
123  ACPI_PARSE_STATE *ParserState,
124  UINT32 ArgType,
125  ACPI_PARSE_OBJECT **ReturnArg);
126 
127 
128 /*
129  * psfind
130  */
133  ACPI_PARSE_OBJECT *Scope,
134  UINT32 Name,
135  UINT32 Opcode);
136 
139  ACPI_PARSE_OBJECT *Op);
140 
141 
142 /*
143  * psobject - support for parse object processing
144  */
147  ACPI_WALK_STATE *WalkState,
148  UINT8 *AmlOpStart,
149  ACPI_PARSE_OBJECT *UnnamedOp,
150  ACPI_PARSE_OBJECT **Op);
151 
154  ACPI_WALK_STATE *WalkState,
155  UINT8 *AmlOpStart,
156  ACPI_PARSE_OBJECT **NewOp);
157 
160  ACPI_WALK_STATE *WalkState,
161  ACPI_PARSE_OBJECT **Op,
163 
166  ACPI_WALK_STATE *WalkState,
167  ACPI_PARSE_OBJECT *Op,
169 
170 
171 /*
172  * psopinfo - AML Opcode information
173  */
174 const ACPI_OPCODE_INFO *
176  UINT16 Opcode);
177 
178 const char *
180  UINT16 Opcode);
181 
182 UINT8
184  UINT32 OpType);
185 
186 
187 /*
188  * psparse - top level parsing routines
189  */
192  ACPI_WALK_STATE *WalkState);
193 
194 UINT32
196  UINT32 Opcode);
197 
198 UINT16
201 
204  ACPI_WALK_STATE *WalkState,
205  ACPI_PARSE_OBJECT *Op);
206 
209  ACPI_WALK_STATE *WalkState,
210  ACPI_PARSE_OBJECT *Op,
212 
213 
214 /*
215  * psloop - main parse loop
216  */
219  ACPI_WALK_STATE *WalkState);
220 
221 
222 /*
223  * psscope - Scope stack management routines
224  */
227  ACPI_PARSE_STATE *ParserState,
229 
233 
234 BOOLEAN
236  ACPI_PARSE_STATE *ParserState);
237 
238 void
240  ACPI_PARSE_STATE *ParserState,
241  ACPI_PARSE_OBJECT **Op,
242  UINT32 *ArgList,
243  UINT32 *ArgCount);
244 
247  ACPI_PARSE_STATE *ParserState,
248  ACPI_PARSE_OBJECT *Op,
249  UINT32 RemainingArgs,
250  UINT32 ArgCount);
251 
252 void
255 
256 
257 /*
258  * pstree - parse tree manipulation routines
259  */
260 void
264 
266 AcpiPsFind (
267  ACPI_PARSE_OBJECT *Scope,
268  char *Path,
269  UINT16 Opcode,
270  UINT32 Create);
271 
275  UINT32 argn);
276 
279  ACPI_PARSE_OBJECT *Origin,
280  ACPI_PARSE_OBJECT *Op);
281 
282 
283 /*
284  * pswalk - parse tree walk routines
285  */
288  ACPI_PARSE_OBJECT *StartOp,
289  ACPI_PARSE_OBJECT *EndOp,
290  ACPI_OPERAND_OBJECT *MthDesc,
291  ACPI_NAMESPACE_NODE *StartNode,
292  ACPI_OPERAND_OBJECT **Params,
293  ACPI_OPERAND_OBJECT **CallerReturnDesc,
297 
300  ACPI_WALK_STATE *WalkState,
301  ACPI_PARSE_OBJECT *Op,
303 
306  ACPI_WALK_STATE *WalkState);
307 
308 void
311 
312 
313 /*
314  * psutils - parser utilities
315  */
318  UINT8 *Aml);
319 
320 void
321 AcpiPsInitOp (
323  UINT16 opcode);
324 
327  UINT16 Opcode,
328  UINT8 *Aml);
329 
330 void
331 AcpiPsFreeOp (
332  ACPI_PARSE_OBJECT *Op);
333 
334 BOOLEAN
336  UINT32 c);
337 
338 UINT32
341 
342 void
345  UINT32 name);
346 
347 
348 /*
349  * psdump - display parser tree
350  */
351 UINT32
353  char *BufferStart,
355  ACPI_PARSE_OBJECT *Op);
356 
357 UINT32
359  char *BufferStart,
361  ACPI_PARSE_OBJECT *Op);
362 
363 void
364 AcpiPsShow (
366 
367 
368 #endif /* __ACPARSER_H__ */
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK AscendingCallback
Definition: acpixf.h:635
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK DescendingCallback
Definition: acpixf.h:635
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:330
void AcpiPsInitOp(ACPI_PARSE_OBJECT *op, UINT16 opcode)
Definition: psutils.c:98
_In_ BOOLEAN Create
Definition: pstypes.h:511
ACPI_STATUS AcpiPsBuildNamedOp(ACPI_WALK_STATE *WalkState, UINT8 *AmlOpStart, ACPI_PARSE_OBJECT *UnnamedOp, ACPI_PARSE_OBJECT **Op)
Definition: psobject.c:193
ACPI_STATUS AcpiPsGetNextArg(ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, UINT32 ArgType, ACPI_PARSE_OBJECT **ReturnArg)
Definition: psargs.c:785
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
ACPI_PARSE_OBJECT * AcpiPsGetParentScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:65
ACPI_STATUS AcpiPsWalkParsedAml(ACPI_PARSE_OBJECT *StartOp, ACPI_PARSE_OBJECT *EndOp, ACPI_OPERAND_OBJECT *MthDesc, ACPI_NAMESPACE_NODE *StartNode, ACPI_OPERAND_OBJECT **Params, ACPI_OPERAND_OBJECT **CallerReturnDesc, ACPI_OWNER_ID OwnerId, ACPI_PARSE_DOWNWARDS DescendingCallback, ACPI_PARSE_UPWARDS AscendingCallback)
ACPI_PARSE_OBJECT * AcpiPsAllocOp(UINT16 Opcode, UINT8 *Aml)
Definition: psutils.c:130
UINT8 AcpiPsGetArgumentCount(UINT32 OpType)
Definition: psopinfo.c:203
UINT32 ACPI_STATUS
Definition: actypes.h:460
void AcpiPsCleanupScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:277
struct TraceInfo Info
ACPI_STATUS AcpiPsExecuteTable(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:297
void AcpiPsPopScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT **Op, UINT32 *ArgList, UINT32 *ArgCount)
Definition: psscope.c:219
char * AcpiPsGetNextNamestring(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:172
unsigned int UINT32
ACPI_PARSE_OBJECT * AcpiPsFindName(ACPI_PARSE_OBJECT *Scope, UINT32 Name, UINT32 Opcode)
void AcpiPsShow(ACPI_PARSE_OBJECT *op)
ACPI_STATUS AcpiPsExecuteMethod(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:131
ACPI_PARSE_OBJECT * AcpiPsGetParent(ACPI_PARSE_OBJECT *Op)
unsigned char BOOLEAN
ACPI_STATUS AcpiPsNextParseState(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_STATUS CallbackStatus)
Definition: psparse.c:337
ACPI_STATUS AcpiPsInitScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Root)
Definition: psscope.c:112
UINT32 AcpiPsGetName(ACPI_PARSE_OBJECT *op)
Definition: psutils.c:260
ACPI_STATUS AcpiPsPushScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Op, UINT32 RemainingArgs, UINT32 ArgCount)
Definition: psscope.c:157
ACPI_STATUS AcpiPsCompleteThisOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: psparse.c:144
UINT16 AcpiPsPeekOpcode(ACPI_PARSE_STATE *state)
Definition: psparse.c:108
const UINT8 AcpiGbl_LongOpIndex[]
Definition: psopinfo.c:262
root entry for file system trees
Definition: entries.h:148
void AcpiPsGetNextSimpleArg(ACPI_PARSE_STATE *ParserState, UINT32 ArgType, ACPI_PARSE_OBJECT *Arg)
Definition: psargs.c:428
BOOLEAN AcpiPsHasCompletedScope(ACPI_PARSE_STATE *ParserState)
Definition: psscope.c:88
ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp(UINT8 *Aml)
Definition: psutils.c:67
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
const GLubyte * c
Definition: glext.h:8905
#define BufferSize
Definition: classpnp.h:419
ACPI_STATUS AcpiPsCreateOp(ACPI_WALK_STATE *WalkState, UINT8 *AmlOpStart, ACPI_PARSE_OBJECT **NewOp)
Definition: psobject.c:344
UINT8 * AcpiPsGetNextPackageEnd(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:138
void AcpiPsSetName(ACPI_PARSE_OBJECT *op, UINT32 name)
Definition: psutils.c:281
const UINT8 AcpiGbl_ShortOpIndex[]
Definition: psopinfo.c:220
void AcpiPsAppendArg(ACPI_PARSE_OBJECT *op, ACPI_PARSE_OBJECT *arg)
Definition: pstree.c:138
_In_ FLT_PREOP_CALLBACK_STATUS CallbackStatus
Definition: fltkernel.h:1020
static int state
Definition: maze.c:121
ACPI_PARSE_OBJECT * AcpiPsFind(ACPI_PARSE_OBJECT *Scope, char *Path, UINT16 Opcode, UINT32 Create)
Status
Definition: gdiplustypes.h:24
ACPI_STATUS AcpiPsGetNextWalkOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_PARSE_UPWARDS AscendingCallback)
ACPI_STATUS(* ACPI_PARSE_DOWNWARDS)(struct acpi_walk_state *WalkState, union acpi_parse_object **OutOp)
Definition: aclocal.h:785
PRTL_UNICODE_STRING_BUFFER Path
ACPI_PARSE_OBJECT * AcpiPsGetDepthNext(ACPI_PARSE_OBJECT *Origin, ACPI_PARSE_OBJECT *Op)
Definition: pstree.c:224
unsigned short UINT16
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
UINT32 AcpiPsSprintPath(char *BufferStart, UINT32 BufferSize, ACPI_PARSE_OBJECT *Op)
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
Definition: name.c:36
UINT op
Definition: effect.c:223
UINT32 AcpiPsSprintOp(char *BufferStart, UINT32 BufferSize, ACPI_PARSE_OBJECT *Op)
ACPI_STATUS AcpiPsCompleteOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **Op, ACPI_STATUS Status)
Definition: psobject.c:495
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
ACPI_STATUS AcpiPsGetNextNamepath(ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Arg, BOOLEAN PossibleMethodCall)
Definition: psargs.c:254
unsigned char UINT8
ACPI_STATUS AcpiPsParseLoop(ACPI_WALK_STATE *WalkState)
Definition: psloop.c:259
ACPI_STATUS AcpiPsCompleteFinalOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_STATUS Status)
Definition: psobject.c:705
BOOLEAN AcpiPsIsLeadingChar(UINT32 c)
Definition: psutils.c:249
UINT32 AcpiPsGetOpcodeSize(UINT32 Opcode)
Definition: psparse.c:78
ACPI_STATUS(* ACPI_PARSE_UPWARDS)(struct acpi_walk_state *WalkState)
Definition: aclocal.h:790
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 const char BOOLEAN UINT8 * Aml
Definition: acpixf.h:1293
ACPI_STATUS AcpiPsDeleteCompletedOp(ACPI_WALK_STATE *WalkState)