1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
/******************************************************************************
*
* Name: acstruct.h - Internal structs
*
*****************************************************************************/
/*
* Copyright (C) 2000 - 2015, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
* NO WARRANTY
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*/
#ifndef __ACSTRUCT_H__
#define __ACSTRUCT_H__
/* acpisrc:StructDefs -- for acpisrc conversion */
/*****************************************************************************
*
* Tree walking typedefs and structs
*
****************************************************************************/
/*
* Walk state - current state of a parse tree walk. Used for both a leisurely
* stroll through the tree (for whatever reason), and for control method
* execution.
*/
#define ACPI_NEXT_OP_DOWNWARD 1
#define ACPI_NEXT_OP_UPWARD 2
/*
* Groups of definitions for WalkType used for different implementations of
* walkers (never simultaneously) - flags for interpreter:
*/
#define ACPI_WALK_NON_METHOD 0
#define ACPI_WALK_METHOD 0x01
#define ACPI_WALK_METHOD_RESTART 0x02
typedef struct acpi_walk_state
{
struct acpi_walk_state *Next; /* Next WalkState in list */
UINT8 DescriptorType; /* To differentiate various internal objs */
UINT8 WalkType;
UINT16 Opcode; /* Current AML opcode */
UINT8 NextOpInfo; /* Info about NextOp */
UINT8 NumOperands; /* Stack pointer for Operands[] array */
UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */
ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
BOOLEAN LastPredicate; /* Result of last predicate */
UINT8 CurrentResult;
UINT8 ReturnUsed;
UINT8 ScopeDepth;
UINT8 PassNumber; /* Parse pass during table load */
UINT8 ResultSize; /* Total elements for the result stack */
UINT8 ResultCount; /* Current number of occupied elements of result stack */
UINT32 AmlOffset;
UINT32 ArgTypes;
UINT32 MethodBreakpoint; /* For single stepping */
UINT32 UserBreakpoint; /* User AML breakpoint */
UINT32 ParseFlags;
ACPI_PARSE_STATE ParserState; /* Current state of parser */
UINT32 PrevArgTypes;
UINT32 ArgCount; /* push for fixed or var args */
struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
union acpi_operand_object **Params;
UINT8 *AmlLastWhile;
union acpi_operand_object **CallerReturnDesc;
ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */
union acpi_operand_object *ImplicitReturnObj;
struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
struct acpi_namespace_node *MethodNode; /* Method node if running a method. */
ACPI_PARSE_OBJECT *Op; /* Current parser op */
const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
union acpi_operand_object *ResultObj;
ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
union acpi_operand_object *ReturnDesc; /* Return object, if any */
ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
ACPI_THREAD_STATE *Thread;
ACPI_PARSE_DOWNWARDS DescendingCallback;
ACPI_PARSE_UPWARDS AscendingCallback;
} ACPI_WALK_STATE;
/* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */
typedef struct acpi_init_walk_info
{
UINT32 TableIndex;
UINT32 ObjectCount;
UINT32 MethodCount;
UINT32 SerialMethodCount;
UINT32 NonSerialMethodCount;
UINT32 SerializedMethodCount;
UINT32 DeviceCount;
UINT32 OpRegionCount;
UINT32 FieldCount;
UINT32 BufferCount;
UINT32 PackageCount;
UINT32 OpRegionInit;
UINT32 FieldInit;
UINT32 BufferInit;
UINT32 PackageInit;
ACPI_OWNER_ID OwnerId;
} ACPI_INIT_WALK_INFO;
typedef struct acpi_get_devices_info
{
ACPI_WALK_CALLBACK UserFunction;
void *Context;
char *Hid;
} ACPI_GET_DEVICES_INFO;
typedef union acpi_aml_operands
{
ACPI_OPERAND_OBJECT *Operands[7];
struct
{
ACPI_OBJECT_INTEGER *Type;
ACPI_OBJECT_INTEGER *Code;
ACPI_OBJECT_INTEGER *Argument;
} Fatal;
struct
{
ACPI_OPERAND_OBJECT *Source;
ACPI_OBJECT_INTEGER *Index;
ACPI_OPERAND_OBJECT *Target;
} Index;
struct
{
ACPI_OPERAND_OBJECT *Source;
ACPI_OBJECT_INTEGER *Index;
ACPI_OBJECT_INTEGER *Length;
ACPI_OPERAND_OBJECT *Target;
} Mid;
} ACPI_AML_OPERANDS;
/*
* Structure used to pass object evaluation information and parameters.
* Purpose is to reduce CPU stack use.
*/
typedef struct acpi_evaluate_info
{
/* The first 3 elements are passed by the caller to AcpiNsEvaluate */
ACPI_NAMESPACE_NODE *PrefixNode; /* Input: starting node */
char *RelativePathname; /* Input: path relative to PrefixNode */
ACPI_OPERAND_OBJECT **Parameters; /* Input: argument list */
ACPI_NAMESPACE_NODE *Node; /* Resolved node (PrefixNode:RelativePathname) */
ACPI_OPERAND_OBJECT *ObjDesc; /* Object attached to the resolved node */
char *FullPathname; /* Full pathname of the resolved node */
const ACPI_PREDEFINED_INFO *Predefined; /* Used if Node is a predefined name */
ACPI_OPERAND_OBJECT *ReturnObject; /* Object returned from the evaluation */
union acpi_operand_object *ParentPackage; /* Used if return object is a Package */
UINT32 ReturnFlags; /* Used for return value analysis */
UINT32 ReturnBtype; /* Bitmapped type of the returned object */
UINT16 ParamCount; /* Count of the input argument list */
UINT8 PassNumber; /* Parser pass number */
UINT8 ReturnObjectType; /* Object type of the returned object */
UINT8 NodeFlags; /* Same as Node->Flags */
UINT8 Flags; /* General flags */
} ACPI_EVALUATE_INFO;
/* Values for Flags above */
#define ACPI_IGNORE_RETURN_VALUE 1
/* Defines for ReturnFlags field above */
#define ACPI_OBJECT_REPAIRED 1
#define ACPI_OBJECT_WRAPPED 2
/* Info used by AcpiNsInitializeDevices */
typedef struct acpi_device_walk_info
{
ACPI_TABLE_DESC *TableDesc;
ACPI_EVALUATE_INFO *EvaluateInfo;
UINT32 DeviceCount;
UINT32 Num_STA;
UINT32 Num_INI;
} ACPI_DEVICE_WALK_INFO;
/* TBD: [Restructure] Merge with struct above */
typedef struct acpi_walk_info
{
UINT32 DebugLevel;
UINT32 Count;
ACPI_OWNER_ID OwnerId;
UINT8 DisplayType;
} ACPI_WALK_INFO;
/* Display Types */
#define ACPI_DISPLAY_SUMMARY (UINT8) 0
#define ACPI_DISPLAY_OBJECTS (UINT8) 1
#define ACPI_DISPLAY_MASK (UINT8) 1
#define ACPI_DISPLAY_SHORT (UINT8) 2
#endif
|