1 /******************************************************************************
3 * Name: acstruct.h - Internal structs
5 *****************************************************************************/
8 * Copyright (C) 2000 - 2015, 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 __ACSTRUCT_H__
45 #define __ACSTRUCT_H__
47 /* acpisrc:StructDefs -- for acpisrc conversion */
49 /*****************************************************************************
51 * Tree walking typedefs and structs
53 ****************************************************************************/
57 * Walk state - current state of a parse tree walk. Used for both a leisurely
58 * stroll through the tree (for whatever reason), and for control method
61 #define ACPI_NEXT_OP_DOWNWARD 1
62 #define ACPI_NEXT_OP_UPWARD 2
65 * Groups of definitions for WalkType used for different implementations of
66 * walkers (never simultaneously) - flags for interpreter:
68 #define ACPI_WALK_NON_METHOD 0
69 #define ACPI_WALK_METHOD 0x01
70 #define ACPI_WALK_METHOD_RESTART 0x02
73 typedef struct acpi_walk_state
75 struct acpi_walk_state *Next; /* Next WalkState in list */
76 UINT8 DescriptorType; /* To differentiate various internal objs */
78 UINT16 Opcode; /* Current AML opcode */
79 UINT8 NextOpInfo; /* Info about NextOp */
80 UINT8 NumOperands; /* Stack pointer for Operands[] array */
81 UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */
82 ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
83 BOOLEAN LastPredicate; /* Result of last predicate */
87 UINT8 PassNumber; /* Parse pass during table load */
88 UINT8 ResultSize; /* Total elements for the result stack */
89 UINT8 ResultCount; /* Current number of occupied elements of result stack */
92 UINT32 MethodBreakpoint; /* For single stepping */
93 UINT32 UserBreakpoint; /* User AML breakpoint */
96 ACPI_PARSE_STATE ParserState; /* Current state of parser */
98 UINT32 ArgCount; /* push for fixed or var args */
100 struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
101 struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
102 union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
103 union acpi_operand_object **Params;
106 union acpi_operand_object **CallerReturnDesc;
107 ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
108 struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */
109 union acpi_operand_object *ImplicitReturnObj;
110 struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
111 ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
112 union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
113 struct acpi_namespace_node *MethodNode; /* Method node if running a method. */
114 ACPI_PARSE_OBJECT *Op; /* Current parser op */
115 const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
116 ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
117 union acpi_operand_object *ResultObj;
118 ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
119 union acpi_operand_object *ReturnDesc; /* Return object, if any */
120 ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
121 ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
122 ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
123 ACPI_THREAD_STATE *Thread;
124 ACPI_PARSE_DOWNWARDS DescendingCallback;
125 ACPI_PARSE_UPWARDS AscendingCallback;
130 /* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */
132 typedef struct acpi_init_walk_info
137 UINT32 SerialMethodCount;
138 UINT32 NonSerialMethodCount;
139 UINT32 SerializedMethodCount;
141 UINT32 OpRegionCount;
149 ACPI_OWNER_ID OwnerId;
151 } ACPI_INIT_WALK_INFO;
154 typedef struct acpi_get_devices_info
156 ACPI_WALK_CALLBACK UserFunction;
160 } ACPI_GET_DEVICES_INFO;
163 typedef union acpi_aml_operands
165 ACPI_OPERAND_OBJECT *Operands[7];
169 ACPI_OBJECT_INTEGER *Type;
170 ACPI_OBJECT_INTEGER *Code;
171 ACPI_OBJECT_INTEGER *Argument;
177 ACPI_OPERAND_OBJECT *Source;
178 ACPI_OBJECT_INTEGER *Index;
179 ACPI_OPERAND_OBJECT *Target;
185 ACPI_OPERAND_OBJECT *Source;
186 ACPI_OBJECT_INTEGER *Index;
187 ACPI_OBJECT_INTEGER *Length;
188 ACPI_OPERAND_OBJECT *Target;
196 * Structure used to pass object evaluation information and parameters.
197 * Purpose is to reduce CPU stack use.
199 typedef struct acpi_evaluate_info
201 /* The first 3 elements are passed by the caller to AcpiNsEvaluate */
203 ACPI_NAMESPACE_NODE *PrefixNode; /* Input: starting node */
204 char *RelativePathname; /* Input: path relative to PrefixNode */
205 ACPI_OPERAND_OBJECT **Parameters; /* Input: argument list */
207 ACPI_NAMESPACE_NODE *Node; /* Resolved node (PrefixNode:RelativePathname) */
208 ACPI_OPERAND_OBJECT *ObjDesc; /* Object attached to the resolved node */
209 char *FullPathname; /* Full pathname of the resolved node */
211 const ACPI_PREDEFINED_INFO *Predefined; /* Used if Node is a predefined name */
212 ACPI_OPERAND_OBJECT *ReturnObject; /* Object returned from the evaluation */
213 union acpi_operand_object *ParentPackage; /* Used if return object is a Package */
215 UINT32 ReturnFlags; /* Used for return value analysis */
216 UINT32 ReturnBtype; /* Bitmapped type of the returned object */
217 UINT16 ParamCount; /* Count of the input argument list */
218 UINT8 PassNumber; /* Parser pass number */
219 UINT8 ReturnObjectType; /* Object type of the returned object */
220 UINT8 NodeFlags; /* Same as Node->Flags */
221 UINT8 Flags; /* General flags */
223 } ACPI_EVALUATE_INFO;
225 /* Values for Flags above */
227 #define ACPI_IGNORE_RETURN_VALUE 1
229 /* Defines for ReturnFlags field above */
231 #define ACPI_OBJECT_REPAIRED 1
232 #define ACPI_OBJECT_WRAPPED 2
235 /* Info used by AcpiNsInitializeDevices */
237 typedef struct acpi_device_walk_info
239 ACPI_TABLE_DESC *TableDesc;
240 ACPI_EVALUATE_INFO *EvaluateInfo;
245 } ACPI_DEVICE_WALK_INFO;
248 /* TBD: [Restructure] Merge with struct above */
250 typedef struct acpi_walk_info
254 ACPI_OWNER_ID OwnerId;
261 #define ACPI_DISPLAY_SUMMARY (UINT8) 0
262 #define ACPI_DISPLAY_OBJECTS (UINT8) 1
263 #define ACPI_DISPLAY_MASK (UINT8) 1
265 #define ACPI_DISPLAY_SHORT (UINT8) 2