ReactOS 0.4.15-dev-7928-g68a8619
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 - 2022, 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 MERCHANTABILITY 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
75extern const UINT8 AcpiGbl_ShortOpIndex[];
76extern const UINT8 AcpiGbl_LongOpIndex[];
77
78
79/*
80 * psxface - Parser external interfaces
81 */
85
89
90
91/*
92 * psargs - Parse AML opcode arguments
93 */
94UINT8 *
96 ACPI_PARSE_STATE *ParserState);
97
98char *
100 ACPI_PARSE_STATE *ParserState);
101
102void
104 ACPI_PARSE_STATE *ParserState,
105 UINT32 ArgType,
106 ACPI_PARSE_OBJECT *Arg);
107
110 ACPI_WALK_STATE *WalkState,
111 ACPI_PARSE_STATE *ParserState,
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
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,
163
166 ACPI_WALK_STATE *WalkState,
169
170
171/*
172 * psopinfo - AML Opcode information
173 */
174const ACPI_OPCODE_INFO *
176 UINT16 Opcode);
177
178const char *
180 UINT16 Opcode);
181
182UINT8
184 UINT32 OpType);
185
186
187/*
188 * psparse - top level parsing routines
189 */
192 ACPI_WALK_STATE *WalkState);
193
194UINT32
196 UINT32 Opcode);
197
198UINT16
201
204 ACPI_WALK_STATE *WalkState,
206
209 ACPI_WALK_STATE *WalkState,
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
236 ACPI_PARSE_STATE *ParserState);
237
238void
240 ACPI_PARSE_STATE *ParserState,
242 UINT32 *ArgList,
243 UINT32 *ArgCount);
244
247 ACPI_PARSE_STATE *ParserState,
249 UINT32 RemainingArgs,
250 UINT32 ArgCount);
251
252void
255
256
257/*
258 * pstree - parse tree manipulation routines
259 */
260void
264
267 ACPI_PARSE_OBJECT *Scope,
268 char *Path,
270 UINT32 Create);
271
275 UINT32 argn);
276
279 ACPI_PARSE_OBJECT *Origin,
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,
293 ACPI_OPERAND_OBJECT **CallerReturnDesc,
297
300 ACPI_WALK_STATE *WalkState,
303
306 ACPI_WALK_STATE *WalkState);
307
308void
311
312
313/*
314 * psutils - parser utilities
315 */
318 UINT8 *Aml);
319
320void
323 UINT16 opcode);
324
328 UINT8 *Aml);
329
330void
333
336 UINT32 c);
337
338UINT32
341
342void
345 UINT32 name);
346
347
348/*
349 * psdump - display parser tree
350 */
351UINT32
353 char *BufferStart,
356
357UINT32
359 char *BufferStart,
362
363void
366
367
368#endif /* __ACPARSER_H__ */
unsigned short UINT16
unsigned char BOOLEAN
unsigned char UINT8
unsigned int UINT32
PRTL_UNICODE_STRING_BUFFER Path
ACPI_STATUS(* ACPI_PARSE_DOWNWARDS)(struct acpi_walk_state *WalkState, union acpi_parse_object **OutOp)
Definition: aclocal.h:785
ACPI_STATUS(* ACPI_PARSE_UPWARDS)(struct acpi_walk_state *WalkState)
Definition: aclocal.h:790
UINT16 AcpiPsPeekOpcode(ACPI_PARSE_STATE *state)
Definition: psparse.c:108
ACPI_PARSE_OBJECT * AcpiPsGetDepthNext(ACPI_PARSE_OBJECT *Origin, ACPI_PARSE_OBJECT *Op)
Definition: pstree.c:224
ACPI_STATUS AcpiPsExecuteTable(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:297
UINT32 AcpiPsGetName(ACPI_PARSE_OBJECT *op)
Definition: psutils.c:260
void AcpiPsGetNextSimpleArg(ACPI_PARSE_STATE *ParserState, UINT32 ArgType, ACPI_PARSE_OBJECT *Arg)
Definition: psargs.c:428
void AcpiPsInitOp(ACPI_PARSE_OBJECT *op, UINT16 opcode)
Definition: psutils.c:98
const char * AcpiPsGetOpcodeName(UINT16 Opcode)
Definition: psopinfo.c:169
ACPI_STATUS AcpiPsBuildNamedOp(ACPI_WALK_STATE *WalkState, UINT8 *AmlOpStart, ACPI_PARSE_OBJECT *UnnamedOp, ACPI_PARSE_OBJECT **Op)
Definition: psobject.c:193
ACPI_STATUS AcpiPsInitScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Root)
Definition: psscope.c:112
ACPI_STATUS AcpiPsCompleteThisOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op)
Definition: psparse.c:144
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)
UINT32 AcpiPsSprintPath(char *BufferStart, UINT32 BufferSize, ACPI_PARSE_OBJECT *Op)
ACPI_PARSE_OBJECT * AcpiPsGetParent(ACPI_PARSE_OBJECT *Op)
ACPI_PARSE_OBJECT * AcpiPsGetArg(ACPI_PARSE_OBJECT *op, UINT32 argn)
Definition: pstree.c:76
ACPI_STATUS AcpiPsCompleteOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT **Op, ACPI_STATUS Status)
Definition: psobject.c:495
ACPI_STATUS AcpiPsCreateOp(ACPI_WALK_STATE *WalkState, UINT8 *AmlOpStart, ACPI_PARSE_OBJECT **NewOp)
Definition: psobject.c:344
BOOLEAN AcpiPsIsLeadingChar(UINT32 c)
Definition: psutils.c:249
ACPI_STATUS AcpiPsExecuteMethod(ACPI_EVALUATE_INFO *Info)
Definition: psxface.c:131
void AcpiPsCleanupScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:277
UINT8 AcpiPsGetArgumentCount(UINT32 OpType)
Definition: psopinfo.c:203
ACPI_STATUS AcpiPsGetNextArg(ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, UINT32 ArgType, ACPI_PARSE_OBJECT **ReturnArg)
Definition: psargs.c:785
char * AcpiPsGetNextNamestring(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:172
void AcpiPsSetName(ACPI_PARSE_OBJECT *op, UINT32 name)
Definition: psutils.c:281
ACPI_STATUS AcpiPsGetNextWalkOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_PARSE_UPWARDS AscendingCallback)
ACPI_STATUS AcpiPsNextParseState(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_STATUS CallbackStatus)
Definition: psparse.c:337
ACPI_PARSE_OBJECT * AcpiPsFindName(ACPI_PARSE_OBJECT *Scope, UINT32 Name, UINT32 Opcode)
ACPI_STATUS AcpiPsPushScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Op, UINT32 RemainingArgs, UINT32 ArgCount)
Definition: psscope.c:157
void AcpiPsDeleteParseTree(ACPI_PARSE_OBJECT *root)
Definition: pswalk.c:67
void AcpiPsPopScope(ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT **Op, UINT32 *ArgList, UINT32 *ArgCount)
Definition: psscope.c:219
ACPI_STATUS AcpiPsParseLoop(ACPI_WALK_STATE *WalkState)
Definition: psloop.c:259
const UINT8 AcpiGbl_ShortOpIndex[]
Definition: psopinfo.c:220
ACPI_STATUS AcpiPsGetNextNamepath(ACPI_WALK_STATE *WalkState, ACPI_PARSE_STATE *ParserState, ACPI_PARSE_OBJECT *Arg, BOOLEAN PossibleMethodCall)
Definition: psargs.c:254
ACPI_PARSE_OBJECT * AcpiPsFind(ACPI_PARSE_OBJECT *Scope, char *Path, UINT16 Opcode, UINT32 Create)
void AcpiPsShow(ACPI_PARSE_OBJECT *op)
void AcpiPsFreeOp(ACPI_PARSE_OBJECT *Op)
Definition: psutils.c:212
ACPI_STATUS AcpiPsParseAml(ACPI_WALK_STATE *WalkState)
Definition: psparse.c:453
ACPI_PARSE_OBJECT * AcpiPsCreateScopeOp(UINT8 *Aml)
Definition: psutils.c:67
void AcpiPsAppendArg(ACPI_PARSE_OBJECT *op, ACPI_PARSE_OBJECT *arg)
Definition: pstree.c:138
const ACPI_OPCODE_INFO * AcpiPsGetOpcodeInfo(UINT16 Opcode)
Definition: psopinfo.c:72
BOOLEAN AcpiPsHasCompletedScope(ACPI_PARSE_STATE *ParserState)
Definition: psscope.c:88
const UINT8 AcpiGbl_LongOpIndex[]
Definition: psopinfo.c:262
ACPI_STATUS AcpiPsDeleteCompletedOp(ACPI_WALK_STATE *WalkState)
UINT8 * AcpiPsGetNextPackageEnd(ACPI_PARSE_STATE *ParserState)
Definition: psargs.c:138
UINT32 AcpiPsGetOpcodeSize(UINT32 Opcode)
Definition: psparse.c:78
ACPI_STATUS AcpiPsCompleteFinalOp(ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, ACPI_STATUS Status)
Definition: psobject.c:705
UINT32 AcpiPsSprintOp(char *BufferStart, UINT32 BufferSize, ACPI_PARSE_OBJECT *Op)
ACPI_PARSE_OBJECT * AcpiPsGetParentScope(ACPI_PARSE_STATE *state)
Definition: psscope.c:65
ACPI_PARSE_OBJECT * AcpiPsAllocOp(UINT16 Opcode, UINT8 *Aml)
Definition: psutils.c:130
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK DescendingCallback
Definition: acpixf.h:641
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK AscendingCallback
Definition: acpixf.h:642
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:1302
UINT32 ACPI_STATUS
Definition: actypes.h:460
UINT16 ACPI_OWNER_ID
Definition: actypes.h:486
static int state
Definition: maze.c:121
@ Create
Definition: registry.c:563
UINT op
Definition: effect.c:236
_In_ FLT_PREOP_CALLBACK_STATUS CallbackStatus
Definition: fltkernel.h:1020
_Must_inspect_result_ _In_opt_ PVOID OwnerId
Definition: fsrtlfuncs.h:907
Status
Definition: gdiplustypes.h:25
const GLubyte * c
Definition: glext.h:8905
_In_ PVOID _In_ ULONG Opcode
Definition: hubbusif.h:331
OpType
Definition: simd.h:223
root entry for file system trees
Definition: entries.h:148
Definition: name.c:39
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_In_ WDFIOTARGET _In_ PWDF_REQUEST_COMPLETION_PARAMS Params
Definition: wdfrequest.h:308