xref: /minix3/minix/drivers/power/acpi/include/acstruct.h (revision 29492bb71c7148a089a5afafa0c99409161218df)
1433d6423SLionel Sambuc /******************************************************************************
2433d6423SLionel Sambuc  *
3433d6423SLionel Sambuc  * Name: acstruct.h - Internal structs
4433d6423SLionel Sambuc  *
5433d6423SLionel Sambuc  *****************************************************************************/
6433d6423SLionel Sambuc 
7*29492bb7SDavid van Moolenbroek /*
8*29492bb7SDavid van Moolenbroek  * Copyright (C) 2000 - 2014, Intel Corp.
9433d6423SLionel Sambuc  * All rights reserved.
10433d6423SLionel Sambuc  *
11*29492bb7SDavid van Moolenbroek  * Redistribution and use in source and binary forms, with or without
12*29492bb7SDavid van Moolenbroek  * modification, are permitted provided that the following conditions
13*29492bb7SDavid van Moolenbroek  * are met:
14*29492bb7SDavid van Moolenbroek  * 1. Redistributions of source code must retain the above copyright
15*29492bb7SDavid van Moolenbroek  *    notice, this list of conditions, and the following disclaimer,
16*29492bb7SDavid van Moolenbroek  *    without modification.
17*29492bb7SDavid van Moolenbroek  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18*29492bb7SDavid van Moolenbroek  *    substantially similar to the "NO WARRANTY" disclaimer below
19*29492bb7SDavid van Moolenbroek  *    ("Disclaimer") and any redistribution must be conditioned upon
20*29492bb7SDavid van Moolenbroek  *    including a substantially similar Disclaimer requirement for further
21*29492bb7SDavid van Moolenbroek  *    binary redistribution.
22*29492bb7SDavid van Moolenbroek  * 3. Neither the names of the above-listed copyright holders nor the names
23*29492bb7SDavid van Moolenbroek  *    of any contributors may be used to endorse or promote products derived
24*29492bb7SDavid van Moolenbroek  *    from this software without specific prior written permission.
25433d6423SLionel Sambuc  *
26*29492bb7SDavid van Moolenbroek  * Alternatively, this software may be distributed under the terms of the
27*29492bb7SDavid van Moolenbroek  * GNU General Public License ("GPL") version 2 as published by the Free
28*29492bb7SDavid van Moolenbroek  * Software Foundation.
29433d6423SLionel Sambuc  *
30*29492bb7SDavid van Moolenbroek  * NO WARRANTY
31*29492bb7SDavid van Moolenbroek  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32*29492bb7SDavid van Moolenbroek  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33*29492bb7SDavid van Moolenbroek  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34*29492bb7SDavid van Moolenbroek  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35*29492bb7SDavid van Moolenbroek  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36*29492bb7SDavid van Moolenbroek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37*29492bb7SDavid van Moolenbroek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38*29492bb7SDavid van Moolenbroek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*29492bb7SDavid van Moolenbroek  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40*29492bb7SDavid van Moolenbroek  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41*29492bb7SDavid van Moolenbroek  * POSSIBILITY OF SUCH DAMAGES.
42*29492bb7SDavid van Moolenbroek  */
43433d6423SLionel Sambuc 
44433d6423SLionel Sambuc #ifndef __ACSTRUCT_H__
45433d6423SLionel Sambuc #define __ACSTRUCT_H__
46433d6423SLionel Sambuc 
47433d6423SLionel Sambuc /* acpisrc:StructDefs -- for acpisrc conversion */
48433d6423SLionel Sambuc 
49433d6423SLionel Sambuc /*****************************************************************************
50433d6423SLionel Sambuc  *
51433d6423SLionel Sambuc  * Tree walking typedefs and structs
52433d6423SLionel Sambuc  *
53433d6423SLionel Sambuc  ****************************************************************************/
54433d6423SLionel Sambuc 
55433d6423SLionel Sambuc 
56433d6423SLionel Sambuc /*
57433d6423SLionel Sambuc  * Walk state - current state of a parse tree walk. Used for both a leisurely
58433d6423SLionel Sambuc  * stroll through the tree (for whatever reason), and for control method
59433d6423SLionel Sambuc  * execution.
60433d6423SLionel Sambuc  */
61433d6423SLionel Sambuc #define ACPI_NEXT_OP_DOWNWARD       1
62433d6423SLionel Sambuc #define ACPI_NEXT_OP_UPWARD         2
63433d6423SLionel Sambuc 
64433d6423SLionel Sambuc /*
65433d6423SLionel Sambuc  * Groups of definitions for WalkType used for different implementations of
66433d6423SLionel Sambuc  * walkers (never simultaneously) - flags for interpreter:
67433d6423SLionel Sambuc  */
68433d6423SLionel Sambuc #define ACPI_WALK_NON_METHOD        0
69433d6423SLionel Sambuc #define ACPI_WALK_METHOD            0x01
70433d6423SLionel Sambuc #define ACPI_WALK_METHOD_RESTART    0x02
71433d6423SLionel Sambuc 
72433d6423SLionel Sambuc /* Flags for iASL compiler only */
73433d6423SLionel Sambuc 
74433d6423SLionel Sambuc #define ACPI_WALK_CONST_REQUIRED    0x10
75433d6423SLionel Sambuc #define ACPI_WALK_CONST_OPTIONAL    0x20
76433d6423SLionel Sambuc 
77433d6423SLionel Sambuc 
78433d6423SLionel Sambuc typedef struct acpi_walk_state
79433d6423SLionel Sambuc {
80433d6423SLionel Sambuc     struct acpi_walk_state          *Next;              /* Next WalkState in list */
81433d6423SLionel Sambuc     UINT8                           DescriptorType;     /* To differentiate various internal objs */
82433d6423SLionel Sambuc     UINT8                           WalkType;
83433d6423SLionel Sambuc     UINT16                          Opcode;             /* Current AML opcode */
84433d6423SLionel Sambuc     UINT8                           NextOpInfo;         /* Info about NextOp */
85433d6423SLionel Sambuc     UINT8                           NumOperands;        /* Stack pointer for Operands[] array */
86433d6423SLionel Sambuc     UINT8                           OperandIndex;       /* Index into operand stack, to be used by AcpiDsObjStackPush */
87433d6423SLionel Sambuc     ACPI_OWNER_ID                   OwnerId;            /* Owner of objects created during the walk */
88433d6423SLionel Sambuc     BOOLEAN                         LastPredicate;      /* Result of last predicate */
89433d6423SLionel Sambuc     UINT8                           CurrentResult;
90433d6423SLionel Sambuc     UINT8                           ReturnUsed;
91433d6423SLionel Sambuc     UINT8                           ScopeDepth;
92433d6423SLionel Sambuc     UINT8                           PassNumber;         /* Parse pass during table load */
93433d6423SLionel Sambuc     UINT8                           ResultSize;         /* Total elements for the result stack */
94433d6423SLionel Sambuc     UINT8                           ResultCount;        /* Current number of occupied elements of result stack */
95433d6423SLionel Sambuc     UINT32                          AmlOffset;
96433d6423SLionel Sambuc     UINT32                          ArgTypes;
97433d6423SLionel Sambuc     UINT32                          MethodBreakpoint;   /* For single stepping */
98433d6423SLionel Sambuc     UINT32                          UserBreakpoint;     /* User AML breakpoint */
99433d6423SLionel Sambuc     UINT32                          ParseFlags;
100433d6423SLionel Sambuc 
101433d6423SLionel Sambuc     ACPI_PARSE_STATE                ParserState;        /* Current state of parser */
102433d6423SLionel Sambuc     UINT32                          PrevArgTypes;
103433d6423SLionel Sambuc     UINT32                          ArgCount;           /* push for fixed or var args */
104433d6423SLionel Sambuc 
105433d6423SLionel Sambuc     struct acpi_namespace_node      Arguments[ACPI_METHOD_NUM_ARGS];        /* Control method arguments */
106433d6423SLionel Sambuc     struct acpi_namespace_node      LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
107433d6423SLionel Sambuc     union acpi_operand_object       *Operands[ACPI_OBJ_NUM_OPERANDS + 1];   /* Operands passed to the interpreter (+1 for NULL terminator) */
108433d6423SLionel Sambuc     union acpi_operand_object       **Params;
109433d6423SLionel Sambuc 
110433d6423SLionel Sambuc     UINT8                           *AmlLastWhile;
111433d6423SLionel Sambuc     union acpi_operand_object       **CallerReturnDesc;
112433d6423SLionel Sambuc     ACPI_GENERIC_STATE              *ControlState;      /* List of control states (nested IFs) */
113433d6423SLionel Sambuc     struct acpi_namespace_node      *DeferredNode;      /* Used when executing deferred opcodes */
114433d6423SLionel Sambuc     union acpi_operand_object       *ImplicitReturnObj;
115433d6423SLionel Sambuc     struct acpi_namespace_node      *MethodCallNode;    /* Called method Node*/
116433d6423SLionel Sambuc     ACPI_PARSE_OBJECT               *MethodCallOp;      /* MethodCall Op if running a method */
117433d6423SLionel Sambuc     union acpi_operand_object       *MethodDesc;        /* Method descriptor if running a method */
118433d6423SLionel Sambuc     struct acpi_namespace_node      *MethodNode;        /* Method node if running a method. */
119433d6423SLionel Sambuc     ACPI_PARSE_OBJECT               *Op;                /* Current parser op */
120433d6423SLionel Sambuc     const ACPI_OPCODE_INFO          *OpInfo;            /* Info on current opcode */
121433d6423SLionel Sambuc     ACPI_PARSE_OBJECT               *Origin;            /* Start of walk [Obsolete] */
122433d6423SLionel Sambuc     union acpi_operand_object       *ResultObj;
123433d6423SLionel Sambuc     ACPI_GENERIC_STATE              *Results;           /* Stack of accumulated results */
124433d6423SLionel Sambuc     union acpi_operand_object       *ReturnDesc;        /* Return object, if any */
125433d6423SLionel Sambuc     ACPI_GENERIC_STATE              *ScopeInfo;         /* Stack of nested scopes */
126433d6423SLionel Sambuc     ACPI_PARSE_OBJECT               *PrevOp;            /* Last op that was processed */
127433d6423SLionel Sambuc     ACPI_PARSE_OBJECT               *NextOp;            /* next op to be processed */
128433d6423SLionel Sambuc     ACPI_THREAD_STATE               *Thread;
129433d6423SLionel Sambuc     ACPI_PARSE_DOWNWARDS            DescendingCallback;
130433d6423SLionel Sambuc     ACPI_PARSE_UPWARDS              AscendingCallback;
131433d6423SLionel Sambuc 
132433d6423SLionel Sambuc } ACPI_WALK_STATE;
133433d6423SLionel Sambuc 
134433d6423SLionel Sambuc 
135433d6423SLionel Sambuc /* Info used by AcpiNsInitializeObjects and AcpiDsInitializeObjects */
136433d6423SLionel Sambuc 
137433d6423SLionel Sambuc typedef struct acpi_init_walk_info
138433d6423SLionel Sambuc {
139433d6423SLionel Sambuc     UINT32                          TableIndex;
140433d6423SLionel Sambuc     UINT32                          ObjectCount;
141433d6423SLionel Sambuc     UINT32                          MethodCount;
142*29492bb7SDavid van Moolenbroek     UINT32                          SerialMethodCount;
143*29492bb7SDavid van Moolenbroek     UINT32                          NonSerialMethodCount;
144*29492bb7SDavid van Moolenbroek     UINT32                          SerializedMethodCount;
145433d6423SLionel Sambuc     UINT32                          DeviceCount;
146433d6423SLionel Sambuc     UINT32                          OpRegionCount;
147433d6423SLionel Sambuc     UINT32                          FieldCount;
148433d6423SLionel Sambuc     UINT32                          BufferCount;
149433d6423SLionel Sambuc     UINT32                          PackageCount;
150433d6423SLionel Sambuc     UINT32                          OpRegionInit;
151433d6423SLionel Sambuc     UINT32                          FieldInit;
152433d6423SLionel Sambuc     UINT32                          BufferInit;
153433d6423SLionel Sambuc     UINT32                          PackageInit;
154433d6423SLionel Sambuc     ACPI_OWNER_ID                   OwnerId;
155433d6423SLionel Sambuc 
156433d6423SLionel Sambuc } ACPI_INIT_WALK_INFO;
157433d6423SLionel Sambuc 
158433d6423SLionel Sambuc 
159433d6423SLionel Sambuc typedef struct acpi_get_devices_info
160433d6423SLionel Sambuc {
161433d6423SLionel Sambuc     ACPI_WALK_CALLBACK              UserFunction;
162433d6423SLionel Sambuc     void                            *Context;
163433d6423SLionel Sambuc     char                            *Hid;
164433d6423SLionel Sambuc 
165433d6423SLionel Sambuc } ACPI_GET_DEVICES_INFO;
166433d6423SLionel Sambuc 
167433d6423SLionel Sambuc 
168433d6423SLionel Sambuc typedef union acpi_aml_operands
169433d6423SLionel Sambuc {
170433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT             *Operands[7];
171433d6423SLionel Sambuc 
172433d6423SLionel Sambuc     struct
173433d6423SLionel Sambuc     {
174433d6423SLionel Sambuc         ACPI_OBJECT_INTEGER             *Type;
175433d6423SLionel Sambuc         ACPI_OBJECT_INTEGER             *Code;
176433d6423SLionel Sambuc         ACPI_OBJECT_INTEGER             *Argument;
177433d6423SLionel Sambuc 
178433d6423SLionel Sambuc     } Fatal;
179433d6423SLionel Sambuc 
180433d6423SLionel Sambuc     struct
181433d6423SLionel Sambuc     {
182433d6423SLionel Sambuc         ACPI_OPERAND_OBJECT             *Source;
183433d6423SLionel Sambuc         ACPI_OBJECT_INTEGER             *Index;
184433d6423SLionel Sambuc         ACPI_OPERAND_OBJECT             *Target;
185433d6423SLionel Sambuc 
186433d6423SLionel Sambuc     } Index;
187433d6423SLionel Sambuc 
188433d6423SLionel Sambuc     struct
189433d6423SLionel Sambuc     {
190433d6423SLionel Sambuc         ACPI_OPERAND_OBJECT             *Source;
191433d6423SLionel Sambuc         ACPI_OBJECT_INTEGER             *Index;
192433d6423SLionel Sambuc         ACPI_OBJECT_INTEGER             *Length;
193433d6423SLionel Sambuc         ACPI_OPERAND_OBJECT             *Target;
194433d6423SLionel Sambuc 
195433d6423SLionel Sambuc     } Mid;
196433d6423SLionel Sambuc 
197433d6423SLionel Sambuc } ACPI_AML_OPERANDS;
198433d6423SLionel Sambuc 
199433d6423SLionel Sambuc 
200433d6423SLionel Sambuc /*
201*29492bb7SDavid van Moolenbroek  * Structure used to pass object evaluation information and parameters.
202433d6423SLionel Sambuc  * Purpose is to reduce CPU stack use.
203433d6423SLionel Sambuc  */
204433d6423SLionel Sambuc typedef struct acpi_evaluate_info
205433d6423SLionel Sambuc {
206*29492bb7SDavid van Moolenbroek     /* The first 3 elements are passed by the caller to AcpiNsEvaluate */
207*29492bb7SDavid van Moolenbroek 
208*29492bb7SDavid van Moolenbroek     ACPI_NAMESPACE_NODE             *PrefixNode;        /* Input: starting node */
209*29492bb7SDavid van Moolenbroek     char                            *RelativePathname;  /* Input: path relative to PrefixNode */
210*29492bb7SDavid van Moolenbroek     ACPI_OPERAND_OBJECT             **Parameters;       /* Input: argument list */
211*29492bb7SDavid van Moolenbroek 
212*29492bb7SDavid van Moolenbroek     ACPI_NAMESPACE_NODE             *Node;              /* Resolved node (PrefixNode:RelativePathname) */
213*29492bb7SDavid van Moolenbroek     ACPI_OPERAND_OBJECT             *ObjDesc;           /* Object attached to the resolved node */
214*29492bb7SDavid van Moolenbroek     char                            *FullPathname;      /* Full pathname of the resolved node */
215*29492bb7SDavid van Moolenbroek 
216*29492bb7SDavid van Moolenbroek     const ACPI_PREDEFINED_INFO      *Predefined;        /* Used if Node is a predefined name */
217*29492bb7SDavid van Moolenbroek     ACPI_OPERAND_OBJECT             *ReturnObject;      /* Object returned from the evaluation */
218*29492bb7SDavid van Moolenbroek     union acpi_operand_object       *ParentPackage;     /* Used if return object is a Package */
219*29492bb7SDavid van Moolenbroek 
220*29492bb7SDavid van Moolenbroek     UINT32                          ReturnFlags;        /* Used for return value analysis */
221*29492bb7SDavid van Moolenbroek     UINT32                          ReturnBtype;        /* Bitmapped type of the returned object */
222*29492bb7SDavid van Moolenbroek     UINT16                          ParamCount;         /* Count of the input argument list */
223*29492bb7SDavid van Moolenbroek     UINT8                           PassNumber;         /* Parser pass number */
224*29492bb7SDavid van Moolenbroek     UINT8                           ReturnObjectType;   /* Object type of the returned object */
225*29492bb7SDavid van Moolenbroek     UINT8                           NodeFlags;          /* Same as Node->Flags */
226*29492bb7SDavid van Moolenbroek     UINT8                           Flags;              /* General flags */
227433d6423SLionel Sambuc 
228433d6423SLionel Sambuc } ACPI_EVALUATE_INFO;
229433d6423SLionel Sambuc 
230433d6423SLionel Sambuc /* Values for Flags above */
231433d6423SLionel Sambuc 
232433d6423SLionel Sambuc #define ACPI_IGNORE_RETURN_VALUE    1
233433d6423SLionel Sambuc 
234*29492bb7SDavid van Moolenbroek /* Defines for ReturnFlags field above */
235*29492bb7SDavid van Moolenbroek 
236*29492bb7SDavid van Moolenbroek #define ACPI_OBJECT_REPAIRED        1
237*29492bb7SDavid van Moolenbroek #define ACPI_OBJECT_WRAPPED         2
238*29492bb7SDavid van Moolenbroek 
239433d6423SLionel Sambuc 
240433d6423SLionel Sambuc /* Info used by AcpiNsInitializeDevices */
241433d6423SLionel Sambuc 
242433d6423SLionel Sambuc typedef struct acpi_device_walk_info
243433d6423SLionel Sambuc {
244433d6423SLionel Sambuc     ACPI_TABLE_DESC                 *TableDesc;
245433d6423SLionel Sambuc     ACPI_EVALUATE_INFO              *EvaluateInfo;
246433d6423SLionel Sambuc     UINT32                          DeviceCount;
247433d6423SLionel Sambuc     UINT32                          Num_STA;
248433d6423SLionel Sambuc     UINT32                          Num_INI;
249433d6423SLionel Sambuc 
250433d6423SLionel Sambuc } ACPI_DEVICE_WALK_INFO;
251433d6423SLionel Sambuc 
252433d6423SLionel Sambuc 
253433d6423SLionel Sambuc /* TBD: [Restructure] Merge with struct above */
254433d6423SLionel Sambuc 
255433d6423SLionel Sambuc typedef struct acpi_walk_info
256433d6423SLionel Sambuc {
257433d6423SLionel Sambuc     UINT32                          DebugLevel;
258433d6423SLionel Sambuc     UINT32                          Count;
259433d6423SLionel Sambuc     ACPI_OWNER_ID                   OwnerId;
260433d6423SLionel Sambuc     UINT8                           DisplayType;
261433d6423SLionel Sambuc 
262433d6423SLionel Sambuc } ACPI_WALK_INFO;
263433d6423SLionel Sambuc 
264433d6423SLionel Sambuc /* Display Types */
265433d6423SLionel Sambuc 
266433d6423SLionel Sambuc #define ACPI_DISPLAY_SUMMARY        (UINT8) 0
267433d6423SLionel Sambuc #define ACPI_DISPLAY_OBJECTS        (UINT8) 1
268433d6423SLionel Sambuc #define ACPI_DISPLAY_MASK           (UINT8) 1
269433d6423SLionel Sambuc 
270433d6423SLionel Sambuc #define ACPI_DISPLAY_SHORT          (UINT8) 2
271433d6423SLionel Sambuc 
272433d6423SLionel Sambuc 
273433d6423SLionel Sambuc #endif
274