aclocal.h revision 1.1.1.8 1 1.1 jruoho /******************************************************************************
2 1.1 jruoho *
3 1.1 jruoho * Name: aclocal.h - Internal data types used across the ACPI subsystem
4 1.1 jruoho *
5 1.1 jruoho *****************************************************************************/
6 1.1 jruoho
7 1.1.1.2 jruoho /*
8 1.1.1.8 christos * Copyright (C) 2000 - 2016, Intel Corp.
9 1.1 jruoho * All rights reserved.
10 1.1 jruoho *
11 1.1.1.2 jruoho * Redistribution and use in source and binary forms, with or without
12 1.1.1.2 jruoho * modification, are permitted provided that the following conditions
13 1.1.1.2 jruoho * are met:
14 1.1.1.2 jruoho * 1. Redistributions of source code must retain the above copyright
15 1.1.1.2 jruoho * notice, this list of conditions, and the following disclaimer,
16 1.1.1.2 jruoho * without modification.
17 1.1.1.2 jruoho * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18 1.1.1.2 jruoho * substantially similar to the "NO WARRANTY" disclaimer below
19 1.1.1.2 jruoho * ("Disclaimer") and any redistribution must be conditioned upon
20 1.1.1.2 jruoho * including a substantially similar Disclaimer requirement for further
21 1.1.1.2 jruoho * binary redistribution.
22 1.1.1.2 jruoho * 3. Neither the names of the above-listed copyright holders nor the names
23 1.1.1.2 jruoho * of any contributors may be used to endorse or promote products derived
24 1.1.1.2 jruoho * from this software without specific prior written permission.
25 1.1.1.2 jruoho *
26 1.1.1.2 jruoho * Alternatively, this software may be distributed under the terms of the
27 1.1.1.2 jruoho * GNU General Public License ("GPL") version 2 as published by the Free
28 1.1.1.2 jruoho * Software Foundation.
29 1.1.1.2 jruoho *
30 1.1.1.2 jruoho * NO WARRANTY
31 1.1.1.2 jruoho * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 1.1.1.2 jruoho * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 1.1.1.2 jruoho * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34 1.1.1.2 jruoho * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 1.1.1.2 jruoho * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36 1.1.1.2 jruoho * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37 1.1.1.2 jruoho * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38 1.1.1.2 jruoho * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39 1.1.1.2 jruoho * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40 1.1.1.2 jruoho * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 1.1.1.2 jruoho * POSSIBILITY OF SUCH DAMAGES.
42 1.1.1.2 jruoho */
43 1.1 jruoho
44 1.1 jruoho #ifndef __ACLOCAL_H__
45 1.1 jruoho #define __ACLOCAL_H__
46 1.1 jruoho
47 1.1 jruoho
48 1.1 jruoho /* acpisrc:StructDefs -- for acpisrc conversion */
49 1.1 jruoho
50 1.1 jruoho #define ACPI_SERIALIZED 0xFF
51 1.1 jruoho
52 1.1 jruoho typedef UINT32 ACPI_MUTEX_HANDLE;
53 1.1 jruoho #define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1)
54 1.1 jruoho
55 1.1 jruoho /* Total number of aml opcodes defined */
56 1.1 jruoho
57 1.1.1.6 christos #define AML_NUM_OPCODES 0x82
58 1.1 jruoho
59 1.1 jruoho
60 1.1 jruoho /* Forward declarations */
61 1.1 jruoho
62 1.1 jruoho struct acpi_walk_state;
63 1.1 jruoho struct acpi_obj_mutex;
64 1.1 jruoho union acpi_parse_object;
65 1.1 jruoho
66 1.1 jruoho
67 1.1 jruoho /*****************************************************************************
68 1.1 jruoho *
69 1.1 jruoho * Mutex typedefs and structs
70 1.1 jruoho *
71 1.1 jruoho ****************************************************************************/
72 1.1 jruoho
73 1.1 jruoho
74 1.1 jruoho /*
75 1.1 jruoho * Predefined handles for the mutex objects used within the subsystem
76 1.1 jruoho * All mutex objects are automatically created by AcpiUtMutexInitialize.
77 1.1 jruoho *
78 1.1 jruoho * The acquire/release ordering protocol is implied via this list. Mutexes
79 1.1 jruoho * with a lower value must be acquired before mutexes with a higher value.
80 1.1 jruoho *
81 1.1 jruoho * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
82 1.1 jruoho * table below also!
83 1.1 jruoho */
84 1.1 jruoho #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
85 1.1 jruoho #define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
86 1.1 jruoho #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
87 1.1 jruoho #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
88 1.1 jruoho #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
89 1.1 jruoho #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
90 1.1 jruoho
91 1.1.1.8 christos #define ACPI_MAX_MUTEX 5
92 1.1 jruoho #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
93 1.1 jruoho
94 1.1 jruoho
95 1.1 jruoho /* Lock structure for reader/writer interfaces */
96 1.1 jruoho
97 1.1 jruoho typedef struct acpi_rw_lock
98 1.1 jruoho {
99 1.1 jruoho ACPI_MUTEX WriterMutex;
100 1.1 jruoho ACPI_MUTEX ReaderMutex;
101 1.1 jruoho UINT32 NumReaders;
102 1.1 jruoho
103 1.1 jruoho } ACPI_RW_LOCK;
104 1.1 jruoho
105 1.1 jruoho
106 1.1 jruoho /*
107 1.1 jruoho * Predefined handles for spinlocks used within the subsystem.
108 1.1 jruoho * These spinlocks are created by AcpiUtMutexInitialize
109 1.1 jruoho */
110 1.1 jruoho #define ACPI_LOCK_GPES 0
111 1.1 jruoho #define ACPI_LOCK_HARDWARE 1
112 1.1 jruoho
113 1.1 jruoho #define ACPI_MAX_LOCK 1
114 1.1 jruoho #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
115 1.1 jruoho
116 1.1 jruoho
117 1.1 jruoho /* This Thread ID means that the mutex is not in use (unlocked) */
118 1.1 jruoho
119 1.1 jruoho #define ACPI_MUTEX_NOT_ACQUIRED (ACPI_THREAD_ID) -1
120 1.1 jruoho
121 1.1.1.8 christos /* This Thread ID means an invalid thread ID */
122 1.1.1.8 christos
123 1.1.1.8 christos #ifdef ACPI_OS_INVALID_THREAD_ID
124 1.1.1.8 christos #define ACPI_INVALID_THREAD_ID ACPI_OS_INVALID_THREAD_ID
125 1.1.1.8 christos #else
126 1.1.1.8 christos #define ACPI_INVALID_THREAD_ID ((ACPI_THREAD_ID) 0xFFFFFFFF)
127 1.1.1.8 christos #endif
128 1.1.1.8 christos
129 1.1 jruoho /* Table for the global mutexes */
130 1.1 jruoho
131 1.1 jruoho typedef struct acpi_mutex_info
132 1.1 jruoho {
133 1.1 jruoho ACPI_MUTEX Mutex;
134 1.1 jruoho UINT32 UseCount;
135 1.1 jruoho ACPI_THREAD_ID ThreadId;
136 1.1 jruoho
137 1.1 jruoho } ACPI_MUTEX_INFO;
138 1.1 jruoho
139 1.1 jruoho
140 1.1 jruoho /* Lock flag parameter for various interfaces */
141 1.1 jruoho
142 1.1 jruoho #define ACPI_MTX_DO_NOT_LOCK 0
143 1.1 jruoho #define ACPI_MTX_LOCK 1
144 1.1 jruoho
145 1.1 jruoho
146 1.1 jruoho /* Field access granularities */
147 1.1 jruoho
148 1.1 jruoho #define ACPI_FIELD_BYTE_GRANULARITY 1
149 1.1 jruoho #define ACPI_FIELD_WORD_GRANULARITY 2
150 1.1 jruoho #define ACPI_FIELD_DWORD_GRANULARITY 4
151 1.1 jruoho #define ACPI_FIELD_QWORD_GRANULARITY 8
152 1.1 jruoho
153 1.1 jruoho
154 1.1 jruoho #define ACPI_ENTRY_NOT_FOUND NULL
155 1.1 jruoho
156 1.1 jruoho
157 1.1 jruoho /*****************************************************************************
158 1.1 jruoho *
159 1.1 jruoho * Namespace typedefs and structs
160 1.1 jruoho *
161 1.1 jruoho ****************************************************************************/
162 1.1 jruoho
163 1.1 jruoho /* Operational modes of the AML interpreter/scanner */
164 1.1 jruoho
165 1.1 jruoho typedef enum
166 1.1 jruoho {
167 1.1 jruoho ACPI_IMODE_LOAD_PASS1 = 0x01,
168 1.1 jruoho ACPI_IMODE_LOAD_PASS2 = 0x02,
169 1.1 jruoho ACPI_IMODE_EXECUTE = 0x03
170 1.1 jruoho
171 1.1 jruoho } ACPI_INTERPRETER_MODE;
172 1.1 jruoho
173 1.1 jruoho
174 1.1 jruoho /*
175 1.1 jruoho * The Namespace Node describes a named object that appears in the AML.
176 1.1 jruoho * DescriptorType is used to differentiate between internal descriptors.
177 1.1 jruoho *
178 1.1 jruoho * The node is optimized for both 32-bit and 64-bit platforms:
179 1.1 jruoho * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
180 1.1 jruoho *
181 1.1 jruoho * Note: The DescriptorType and Type fields must appear in the identical
182 1.1 jruoho * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
183 1.1 jruoho * structures.
184 1.1 jruoho */
185 1.1 jruoho typedef struct acpi_namespace_node
186 1.1 jruoho {
187 1.1 jruoho union acpi_operand_object *Object; /* Interpreter object */
188 1.1 jruoho UINT8 DescriptorType; /* Differentiate object descriptor types */
189 1.1 jruoho UINT8 Type; /* ACPI Type associated with this name */
190 1.1 jruoho UINT8 Flags; /* Miscellaneous flags */
191 1.1 jruoho ACPI_OWNER_ID OwnerId; /* Node creator */
192 1.1 jruoho ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
193 1.1 jruoho struct acpi_namespace_node *Parent; /* Parent node */
194 1.1 jruoho struct acpi_namespace_node *Child; /* First child */
195 1.1 jruoho struct acpi_namespace_node *Peer; /* First peer */
196 1.1 jruoho
197 1.1 jruoho /*
198 1.1 jruoho * The following fields are used by the ASL compiler and disassembler only
199 1.1 jruoho */
200 1.1 jruoho #ifdef ACPI_LARGE_NAMESPACE_NODE
201 1.1 jruoho union acpi_parse_object *Op;
202 1.1.1.7 christos void *MethodLocals;
203 1.1.1.7 christos void *MethodArgs;
204 1.1 jruoho UINT32 Value;
205 1.1 jruoho UINT32 Length;
206 1.1.1.7 christos UINT8 ArgCount;
207 1.1.1.7 christos
208 1.1 jruoho #endif
209 1.1 jruoho
210 1.1 jruoho } ACPI_NAMESPACE_NODE;
211 1.1 jruoho
212 1.1 jruoho
213 1.1 jruoho /* Namespace Node flags */
214 1.1 jruoho
215 1.1 jruoho #define ANOBJ_RESERVED 0x01 /* Available for use */
216 1.1 jruoho #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
217 1.1 jruoho #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
218 1.1 jruoho #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
219 1.1 jruoho #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
220 1.1 jruoho #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
221 1.1 jruoho #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (InstallMethod) */
222 1.1 jruoho
223 1.1 jruoho #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
224 1.1 jruoho #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
225 1.1 jruoho #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
226 1.1 jruoho #define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
227 1.1 jruoho
228 1.1 jruoho
229 1.1 jruoho /* Internal ACPI table management - master table list */
230 1.1 jruoho
231 1.1 jruoho typedef struct acpi_table_list
232 1.1 jruoho {
233 1.1 jruoho ACPI_TABLE_DESC *Tables; /* Table descriptor array */
234 1.1 jruoho UINT32 CurrentTableCount; /* Tables currently in the array */
235 1.1 jruoho UINT32 MaxTableCount; /* Max tables array will hold */
236 1.1 jruoho UINT8 Flags;
237 1.1 jruoho
238 1.1 jruoho } ACPI_TABLE_LIST;
239 1.1 jruoho
240 1.1 jruoho /* Flags for above */
241 1.1 jruoho
242 1.1 jruoho #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
243 1.1 jruoho #define ACPI_ROOT_ORIGIN_ALLOCATED (1)
244 1.1 jruoho #define ACPI_ROOT_ALLOW_RESIZE (2)
245 1.1 jruoho
246 1.1 jruoho
247 1.1.1.8 christos /* List to manage incoming ACPI tables */
248 1.1.1.8 christos
249 1.1.1.8 christos typedef struct acpi_new_table_desc
250 1.1.1.8 christos {
251 1.1.1.8 christos ACPI_TABLE_HEADER *Table;
252 1.1.1.8 christos struct acpi_new_table_desc *Next;
253 1.1.1.8 christos
254 1.1.1.8 christos } ACPI_NEW_TABLE_DESC;
255 1.1.1.8 christos
256 1.1 jruoho
257 1.1.1.8 christos /* Predefined table indexes */
258 1.1.1.8 christos
259 1.1.1.8 christos #define ACPI_INVALID_TABLE_INDEX (0xFFFFFFFF)
260 1.1 jruoho
261 1.1 jruoho
262 1.1 jruoho typedef struct acpi_find_context
263 1.1 jruoho {
264 1.1 jruoho char *SearchFor;
265 1.1 jruoho ACPI_HANDLE *List;
266 1.1 jruoho UINT32 *Count;
267 1.1 jruoho
268 1.1 jruoho } ACPI_FIND_CONTEXT;
269 1.1 jruoho
270 1.1 jruoho
271 1.1 jruoho typedef struct acpi_ns_search_data
272 1.1 jruoho {
273 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
274 1.1 jruoho
275 1.1 jruoho } ACPI_NS_SEARCH_DATA;
276 1.1 jruoho
277 1.1 jruoho
278 1.1 jruoho /* Object types used during package copies */
279 1.1 jruoho
280 1.1 jruoho #define ACPI_COPY_TYPE_SIMPLE 0
281 1.1 jruoho #define ACPI_COPY_TYPE_PACKAGE 1
282 1.1 jruoho
283 1.1 jruoho
284 1.1 jruoho /* Info structure used to convert external<->internal namestrings */
285 1.1 jruoho
286 1.1 jruoho typedef struct acpi_namestring_info
287 1.1 jruoho {
288 1.1 jruoho const char *ExternalName;
289 1.1 jruoho const char *NextExternalChar;
290 1.1 jruoho char *InternalName;
291 1.1 jruoho UINT32 Length;
292 1.1 jruoho UINT32 NumSegments;
293 1.1 jruoho UINT32 NumCarats;
294 1.1 jruoho BOOLEAN FullyQualified;
295 1.1 jruoho
296 1.1 jruoho } ACPI_NAMESTRING_INFO;
297 1.1 jruoho
298 1.1 jruoho
299 1.1 jruoho /* Field creation info */
300 1.1 jruoho
301 1.1 jruoho typedef struct acpi_create_field_info
302 1.1 jruoho {
303 1.1 jruoho ACPI_NAMESPACE_NODE *RegionNode;
304 1.1 jruoho ACPI_NAMESPACE_NODE *FieldNode;
305 1.1 jruoho ACPI_NAMESPACE_NODE *RegisterNode;
306 1.1 jruoho ACPI_NAMESPACE_NODE *DataRegisterNode;
307 1.1.1.4 christos ACPI_NAMESPACE_NODE *ConnectionNode;
308 1.1.1.4 christos UINT8 *ResourceBuffer;
309 1.1 jruoho UINT32 BankValue;
310 1.1 jruoho UINT32 FieldBitPosition;
311 1.1 jruoho UINT32 FieldBitLength;
312 1.1.1.4 christos UINT16 ResourceLength;
313 1.1.1.5 christos UINT16 PinNumberIndex;
314 1.1 jruoho UINT8 FieldFlags;
315 1.1 jruoho UINT8 Attribute;
316 1.1 jruoho UINT8 FieldType;
317 1.1.1.4 christos UINT8 AccessLength;
318 1.1 jruoho
319 1.1 jruoho } ACPI_CREATE_FIELD_INFO;
320 1.1 jruoho
321 1.1 jruoho
322 1.1 jruoho typedef
323 1.1 jruoho ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
324 1.1 jruoho struct acpi_walk_state *WalkState);
325 1.1 jruoho
326 1.1 jruoho
327 1.1 jruoho /*
328 1.1.1.4 christos * Bitmapped ACPI types. Used internally only
329 1.1 jruoho */
330 1.1 jruoho #define ACPI_BTYPE_ANY 0x00000000
331 1.1 jruoho #define ACPI_BTYPE_INTEGER 0x00000001
332 1.1 jruoho #define ACPI_BTYPE_STRING 0x00000002
333 1.1 jruoho #define ACPI_BTYPE_BUFFER 0x00000004
334 1.1 jruoho #define ACPI_BTYPE_PACKAGE 0x00000008
335 1.1 jruoho #define ACPI_BTYPE_FIELD_UNIT 0x00000010
336 1.1 jruoho #define ACPI_BTYPE_DEVICE 0x00000020
337 1.1 jruoho #define ACPI_BTYPE_EVENT 0x00000040
338 1.1 jruoho #define ACPI_BTYPE_METHOD 0x00000080
339 1.1 jruoho #define ACPI_BTYPE_MUTEX 0x00000100
340 1.1 jruoho #define ACPI_BTYPE_REGION 0x00000200
341 1.1 jruoho #define ACPI_BTYPE_POWER 0x00000400
342 1.1 jruoho #define ACPI_BTYPE_PROCESSOR 0x00000800
343 1.1 jruoho #define ACPI_BTYPE_THERMAL 0x00001000
344 1.1 jruoho #define ACPI_BTYPE_BUFFER_FIELD 0x00002000
345 1.1 jruoho #define ACPI_BTYPE_DDB_HANDLE 0x00004000
346 1.1 jruoho #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
347 1.1.1.8 christos #define ACPI_BTYPE_REFERENCE_OBJECT 0x00010000 /* From Index(), RefOf(), etc (Type6Opcodes) */
348 1.1 jruoho #define ACPI_BTYPE_RESOURCE 0x00020000
349 1.1.1.8 christos #define ACPI_BTYPE_NAMED_REFERENCE 0x00040000 /* Generic unresolved Name or Namepath */
350 1.1 jruoho
351 1.1 jruoho #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
352 1.1 jruoho
353 1.1 jruoho #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
354 1.1.1.8 christos
355 1.1.1.8 christos /* Used by Copy, DeRefOf, Store, Printf, Fprintf */
356 1.1.1.8 christos
357 1.1.1.8 christos #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE_OBJECT | ACPI_BTYPE_DDB_HANDLE)
358 1.1 jruoho #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
359 1.1 jruoho #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
360 1.1 jruoho #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
361 1.1 jruoho
362 1.1.1.4 christos #pragma pack(1)
363 1.1 jruoho
364 1.1 jruoho /*
365 1.1 jruoho * Information structure for ACPI predefined names.
366 1.1 jruoho * Each entry in the table contains the following items:
367 1.1 jruoho *
368 1.1 jruoho * Name - The ACPI reserved name
369 1.1 jruoho * ParamCount - Number of arguments to the method
370 1.1 jruoho * ExpectedReturnBtypes - Allowed type(s) for the return value
371 1.1 jruoho */
372 1.1 jruoho typedef struct acpi_name_info
373 1.1 jruoho {
374 1.1 jruoho char Name[ACPI_NAME_SIZE];
375 1.1.1.4 christos UINT16 ArgumentList;
376 1.1 jruoho UINT8 ExpectedBtypes;
377 1.1 jruoho
378 1.1 jruoho } ACPI_NAME_INFO;
379 1.1 jruoho
380 1.1 jruoho /*
381 1.1 jruoho * Secondary information structures for ACPI predefined objects that return
382 1.1 jruoho * package objects. This structure appears as the next entry in the table
383 1.1 jruoho * after the NAME_INFO structure above.
384 1.1 jruoho *
385 1.1 jruoho * The reason for this is to minimize the size of the predefined name table.
386 1.1 jruoho */
387 1.1 jruoho
388 1.1 jruoho /*
389 1.1 jruoho * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
390 1.1.1.4 christos * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
391 1.1.1.4 christos * ACPI_PTYPE2_FIX_VAR
392 1.1 jruoho */
393 1.1 jruoho typedef struct acpi_package_info
394 1.1 jruoho {
395 1.1 jruoho UINT8 Type;
396 1.1 jruoho UINT8 ObjectType1;
397 1.1 jruoho UINT8 Count1;
398 1.1 jruoho UINT8 ObjectType2;
399 1.1 jruoho UINT8 Count2;
400 1.1.1.4 christos UINT16 Reserved;
401 1.1 jruoho
402 1.1 jruoho } ACPI_PACKAGE_INFO;
403 1.1 jruoho
404 1.1 jruoho /* Used for ACPI_PTYPE2_FIXED */
405 1.1 jruoho
406 1.1 jruoho typedef struct acpi_package_info2
407 1.1 jruoho {
408 1.1 jruoho UINT8 Type;
409 1.1 jruoho UINT8 Count;
410 1.1 jruoho UINT8 ObjectType[4];
411 1.1.1.4 christos UINT8 Reserved;
412 1.1 jruoho
413 1.1 jruoho } ACPI_PACKAGE_INFO2;
414 1.1 jruoho
415 1.1 jruoho /* Used for ACPI_PTYPE1_OPTION */
416 1.1 jruoho
417 1.1 jruoho typedef struct acpi_package_info3
418 1.1 jruoho {
419 1.1 jruoho UINT8 Type;
420 1.1 jruoho UINT8 Count;
421 1.1 jruoho UINT8 ObjectType[2];
422 1.1 jruoho UINT8 TailObjectType;
423 1.1.1.4 christos UINT16 Reserved;
424 1.1 jruoho
425 1.1 jruoho } ACPI_PACKAGE_INFO3;
426 1.1 jruoho
427 1.1.1.7 christos typedef struct acpi_package_info4
428 1.1.1.7 christos {
429 1.1.1.7 christos UINT8 Type;
430 1.1.1.7 christos UINT8 ObjectType1;
431 1.1.1.7 christos UINT8 Count1;
432 1.1.1.7 christos UINT8 SubObjectTypes;
433 1.1.1.7 christos UINT8 PkgCount;
434 1.1.1.7 christos UINT16 Reserved;
435 1.1.1.7 christos
436 1.1.1.7 christos } ACPI_PACKAGE_INFO4;
437 1.1.1.7 christos
438 1.1 jruoho typedef union acpi_predefined_info
439 1.1 jruoho {
440 1.1 jruoho ACPI_NAME_INFO Info;
441 1.1 jruoho ACPI_PACKAGE_INFO RetInfo;
442 1.1 jruoho ACPI_PACKAGE_INFO2 RetInfo2;
443 1.1 jruoho ACPI_PACKAGE_INFO3 RetInfo3;
444 1.1.1.7 christos ACPI_PACKAGE_INFO4 RetInfo4;
445 1.1 jruoho
446 1.1 jruoho } ACPI_PREDEFINED_INFO;
447 1.1 jruoho
448 1.1.1.4 christos /* Reset to default packing */
449 1.1 jruoho
450 1.1.1.4 christos #pragma pack()
451 1.1 jruoho
452 1.1 jruoho
453 1.1.1.4 christos /* Return object auto-repair info */
454 1.1 jruoho
455 1.1.1.4 christos typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (
456 1.1.1.8 christos struct acpi_namespace_node *Scope,
457 1.1.1.4 christos union acpi_operand_object *OriginalObject,
458 1.1.1.4 christos union acpi_operand_object **ConvertedObject);
459 1.1 jruoho
460 1.1.1.4 christos typedef struct acpi_simple_repair_info
461 1.1.1.4 christos {
462 1.1.1.4 christos char Name[ACPI_NAME_SIZE];
463 1.1.1.4 christos UINT32 UnexpectedBtypes;
464 1.1.1.4 christos UINT32 PackageIndex;
465 1.1.1.4 christos ACPI_OBJECT_CONVERTER ObjectConverter;
466 1.1.1.4 christos
467 1.1.1.4 christos } ACPI_SIMPLE_REPAIR_INFO;
468 1.1 jruoho
469 1.1 jruoho
470 1.1 jruoho /*
471 1.1 jruoho * Bitmapped return value types
472 1.1 jruoho * Note: the actual data types must be contiguous, a loop in nspredef.c
473 1.1 jruoho * depends on this.
474 1.1 jruoho */
475 1.1 jruoho #define ACPI_RTYPE_ANY 0x00
476 1.1 jruoho #define ACPI_RTYPE_NONE 0x01
477 1.1 jruoho #define ACPI_RTYPE_INTEGER 0x02
478 1.1 jruoho #define ACPI_RTYPE_STRING 0x04
479 1.1 jruoho #define ACPI_RTYPE_BUFFER 0x08
480 1.1 jruoho #define ACPI_RTYPE_PACKAGE 0x10
481 1.1 jruoho #define ACPI_RTYPE_REFERENCE 0x20
482 1.1 jruoho #define ACPI_RTYPE_ALL 0x3F
483 1.1 jruoho
484 1.1 jruoho #define ACPI_NUM_RTYPES 5 /* Number of actual object types */
485 1.1 jruoho
486 1.1 jruoho
487 1.1.1.8 christos /* Info for running the _REG methods */
488 1.1.1.8 christos
489 1.1.1.8 christos typedef struct acpi_reg_walk_info
490 1.1.1.8 christos {
491 1.1.1.8 christos ACPI_ADR_SPACE_TYPE SpaceId;
492 1.1.1.8 christos UINT32 Function;
493 1.1.1.8 christos UINT32 RegRunCount;
494 1.1.1.8 christos
495 1.1.1.8 christos } ACPI_REG_WALK_INFO;
496 1.1.1.8 christos
497 1.1.1.8 christos
498 1.1 jruoho /*****************************************************************************
499 1.1 jruoho *
500 1.1 jruoho * Event typedefs and structs
501 1.1 jruoho *
502 1.1 jruoho ****************************************************************************/
503 1.1 jruoho
504 1.1.1.4 christos /* Dispatch info for each host-installed SCI handler */
505 1.1.1.4 christos
506 1.1.1.4 christos typedef struct acpi_sci_handler_info
507 1.1.1.4 christos {
508 1.1.1.4 christos struct acpi_sci_handler_info *Next;
509 1.1.1.4 christos ACPI_SCI_HANDLER Address; /* Address of handler */
510 1.1.1.4 christos void *Context; /* Context to be passed to handler */
511 1.1.1.4 christos
512 1.1.1.4 christos } ACPI_SCI_HANDLER_INFO;
513 1.1.1.4 christos
514 1.1 jruoho /* Dispatch info for each GPE -- either a method or handler, cannot be both */
515 1.1 jruoho
516 1.1.1.2 jruoho typedef struct acpi_gpe_handler_info
517 1.1 jruoho {
518 1.1.1.2 jruoho ACPI_GPE_HANDLER Address; /* Address of handler, if any */
519 1.1 jruoho void *Context; /* Context to be passed to handler */
520 1.1 jruoho ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level (saved) */
521 1.1.1.2 jruoho UINT8 OriginalFlags; /* Original (pre-handler) GPE info */
522 1.1.1.2 jruoho BOOLEAN OriginallyEnabled; /* True if GPE was originally enabled */
523 1.1 jruoho
524 1.1.1.2 jruoho } ACPI_GPE_HANDLER_INFO;
525 1.1 jruoho
526 1.1.1.4 christos /* Notify info for implicit notify, multiple device objects */
527 1.1.1.4 christos
528 1.1.1.4 christos typedef struct acpi_gpe_notify_info
529 1.1.1.4 christos {
530 1.1.1.4 christos ACPI_NAMESPACE_NODE *DeviceNode; /* Device to be notified */
531 1.1.1.4 christos struct acpi_gpe_notify_info *Next;
532 1.1.1.4 christos
533 1.1.1.4 christos } ACPI_GPE_NOTIFY_INFO;
534 1.1.1.4 christos
535 1.1.1.2 jruoho /*
536 1.1.1.2 jruoho * GPE dispatch info. At any time, the GPE can have at most one type
537 1.1.1.2 jruoho * of dispatch - Method, Handler, or Implicit Notify.
538 1.1.1.2 jruoho */
539 1.1 jruoho typedef union acpi_gpe_dispatch_info
540 1.1 jruoho {
541 1.1 jruoho ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */
542 1.1.1.4 christos ACPI_GPE_HANDLER_INFO *Handler; /* Installed GPE handler */
543 1.1.1.4 christos ACPI_GPE_NOTIFY_INFO *NotifyList; /* List of _PRW devices for implicit notifies */
544 1.1 jruoho
545 1.1 jruoho } ACPI_GPE_DISPATCH_INFO;
546 1.1 jruoho
547 1.1 jruoho /*
548 1.1 jruoho * Information about a GPE, one per each GPE in an array.
549 1.1 jruoho * NOTE: Important to keep this struct as small as possible.
550 1.1 jruoho */
551 1.1 jruoho typedef struct acpi_gpe_event_info
552 1.1 jruoho {
553 1.1.1.4 christos union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */
554 1.1 jruoho struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
555 1.1 jruoho UINT8 Flags; /* Misc info about this GPE */
556 1.1 jruoho UINT8 GpeNumber; /* This GPE */
557 1.1 jruoho UINT8 RuntimeCount; /* References to a run GPE */
558 1.1 jruoho
559 1.1 jruoho } ACPI_GPE_EVENT_INFO;
560 1.1 jruoho
561 1.1 jruoho /* Information about a GPE register pair, one per each status/enable pair in an array */
562 1.1 jruoho
563 1.1 jruoho typedef struct acpi_gpe_register_info
564 1.1 jruoho {
565 1.1 jruoho ACPI_GENERIC_ADDRESS StatusAddress; /* Address of status reg */
566 1.1 jruoho ACPI_GENERIC_ADDRESS EnableAddress; /* Address of enable reg */
567 1.1.1.5 christos UINT16 BaseGpeNumber; /* Base GPE number for this register */
568 1.1 jruoho UINT8 EnableForWake; /* GPEs to keep enabled when sleeping */
569 1.1 jruoho UINT8 EnableForRun; /* GPEs to keep enabled when running */
570 1.1.1.6 christos UINT8 EnableMask; /* Current mask of enabled GPEs */
571 1.1 jruoho
572 1.1 jruoho } ACPI_GPE_REGISTER_INFO;
573 1.1 jruoho
574 1.1 jruoho /*
575 1.1 jruoho * Information about a GPE register block, one per each installed block --
576 1.1 jruoho * GPE0, GPE1, and one per each installed GPE Block Device.
577 1.1 jruoho */
578 1.1 jruoho typedef struct acpi_gpe_block_info
579 1.1 jruoho {
580 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
581 1.1 jruoho struct acpi_gpe_block_info *Previous;
582 1.1 jruoho struct acpi_gpe_block_info *Next;
583 1.1 jruoho struct acpi_gpe_xrupt_info *XruptBlock; /* Backpointer to interrupt block */
584 1.1 jruoho ACPI_GPE_REGISTER_INFO *RegisterInfo; /* One per GPE register pair */
585 1.1 jruoho ACPI_GPE_EVENT_INFO *EventInfo; /* One for each GPE */
586 1.1.1.5 christos UINT64 Address; /* Base address of the block */
587 1.1 jruoho UINT32 RegisterCount; /* Number of register pairs in block */
588 1.1 jruoho UINT16 GpeCount; /* Number of individual GPEs in block */
589 1.1.1.5 christos UINT16 BlockBaseNumber;/* Base GPE number for this block */
590 1.1.1.5 christos UINT8 SpaceId;
591 1.1.1.2 jruoho BOOLEAN Initialized; /* TRUE if this block is initialized */
592 1.1 jruoho
593 1.1 jruoho } ACPI_GPE_BLOCK_INFO;
594 1.1 jruoho
595 1.1 jruoho /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
596 1.1 jruoho
597 1.1 jruoho typedef struct acpi_gpe_xrupt_info
598 1.1 jruoho {
599 1.1 jruoho struct acpi_gpe_xrupt_info *Previous;
600 1.1 jruoho struct acpi_gpe_xrupt_info *Next;
601 1.1 jruoho ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
602 1.1 jruoho UINT32 InterruptNumber; /* System interrupt number */
603 1.1 jruoho
604 1.1 jruoho } ACPI_GPE_XRUPT_INFO;
605 1.1 jruoho
606 1.1 jruoho typedef struct acpi_gpe_walk_info
607 1.1 jruoho {
608 1.1 jruoho ACPI_NAMESPACE_NODE *GpeDevice;
609 1.1 jruoho ACPI_GPE_BLOCK_INFO *GpeBlock;
610 1.1 jruoho UINT16 Count;
611 1.1 jruoho ACPI_OWNER_ID OwnerId;
612 1.1 jruoho BOOLEAN ExecuteByOwnerId;
613 1.1 jruoho
614 1.1 jruoho } ACPI_GPE_WALK_INFO;
615 1.1 jruoho
616 1.1 jruoho typedef struct acpi_gpe_device_info
617 1.1 jruoho {
618 1.1 jruoho UINT32 Index;
619 1.1 jruoho UINT32 NextBlockBaseIndex;
620 1.1 jruoho ACPI_STATUS Status;
621 1.1 jruoho ACPI_NAMESPACE_NODE *GpeDevice;
622 1.1 jruoho
623 1.1 jruoho } ACPI_GPE_DEVICE_INFO;
624 1.1 jruoho
625 1.1 jruoho typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
626 1.1 jruoho ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
627 1.1 jruoho ACPI_GPE_BLOCK_INFO *GpeBlock,
628 1.1 jruoho void *Context);
629 1.1 jruoho
630 1.1 jruoho
631 1.1 jruoho /* Information about each particular fixed event */
632 1.1 jruoho
633 1.1 jruoho typedef struct acpi_fixed_event_handler
634 1.1 jruoho {
635 1.1 jruoho ACPI_EVENT_HANDLER Handler; /* Address of handler. */
636 1.1 jruoho void *Context; /* Context to be passed to handler */
637 1.1 jruoho
638 1.1 jruoho } ACPI_FIXED_EVENT_HANDLER;
639 1.1 jruoho
640 1.1 jruoho typedef struct acpi_fixed_event_info
641 1.1 jruoho {
642 1.1 jruoho UINT8 StatusRegisterId;
643 1.1 jruoho UINT8 EnableRegisterId;
644 1.1 jruoho UINT16 StatusBitMask;
645 1.1 jruoho UINT16 EnableBitMask;
646 1.1 jruoho
647 1.1 jruoho } ACPI_FIXED_EVENT_INFO;
648 1.1 jruoho
649 1.1 jruoho /* Information used during field processing */
650 1.1 jruoho
651 1.1 jruoho typedef struct acpi_field_info
652 1.1 jruoho {
653 1.1 jruoho UINT8 SkipField;
654 1.1 jruoho UINT8 FieldFlag;
655 1.1 jruoho UINT32 PkgLength;
656 1.1 jruoho
657 1.1 jruoho } ACPI_FIELD_INFO;
658 1.1 jruoho
659 1.1 jruoho
660 1.1 jruoho /*****************************************************************************
661 1.1 jruoho *
662 1.1 jruoho * Generic "state" object for stacks
663 1.1 jruoho *
664 1.1 jruoho ****************************************************************************/
665 1.1 jruoho
666 1.1 jruoho #define ACPI_CONTROL_NORMAL 0xC0
667 1.1 jruoho #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
668 1.1 jruoho #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
669 1.1 jruoho #define ACPI_CONTROL_PREDICATE_FALSE 0xC3
670 1.1 jruoho #define ACPI_CONTROL_PREDICATE_TRUE 0xC4
671 1.1 jruoho
672 1.1 jruoho
673 1.1 jruoho #define ACPI_STATE_COMMON \
674 1.1 jruoho void *Next; \
675 1.1 jruoho UINT8 DescriptorType; /* To differentiate various internal objs */\
676 1.1 jruoho UINT8 Flags; \
677 1.1 jruoho UINT16 Value; \
678 1.1 jruoho UINT16 State;
679 1.1 jruoho
680 1.1 jruoho /* There are 2 bytes available here until the next natural alignment boundary */
681 1.1 jruoho
682 1.1 jruoho typedef struct acpi_common_state
683 1.1 jruoho {
684 1.1 jruoho ACPI_STATE_COMMON
685 1.1 jruoho } ACPI_COMMON_STATE;
686 1.1 jruoho
687 1.1 jruoho
688 1.1 jruoho /*
689 1.1 jruoho * Update state - used to traverse complex objects such as packages
690 1.1 jruoho */
691 1.1 jruoho typedef struct acpi_update_state
692 1.1 jruoho {
693 1.1 jruoho ACPI_STATE_COMMON
694 1.1 jruoho union acpi_operand_object *Object;
695 1.1 jruoho
696 1.1 jruoho } ACPI_UPDATE_STATE;
697 1.1 jruoho
698 1.1 jruoho
699 1.1 jruoho /*
700 1.1 jruoho * Pkg state - used to traverse nested package structures
701 1.1 jruoho */
702 1.1 jruoho typedef struct acpi_pkg_state
703 1.1 jruoho {
704 1.1 jruoho ACPI_STATE_COMMON
705 1.1 jruoho UINT16 Index;
706 1.1 jruoho union acpi_operand_object *SourceObject;
707 1.1 jruoho union acpi_operand_object *DestObject;
708 1.1 jruoho struct acpi_walk_state *WalkState;
709 1.1 jruoho void *ThisTargetObj;
710 1.1 jruoho UINT32 NumPackages;
711 1.1 jruoho
712 1.1 jruoho } ACPI_PKG_STATE;
713 1.1 jruoho
714 1.1 jruoho
715 1.1 jruoho /*
716 1.1 jruoho * Control state - one per if/else and while constructs.
717 1.1 jruoho * Allows nesting of these constructs
718 1.1 jruoho */
719 1.1 jruoho typedef struct acpi_control_state
720 1.1 jruoho {
721 1.1 jruoho ACPI_STATE_COMMON
722 1.1 jruoho UINT16 Opcode;
723 1.1 jruoho union acpi_parse_object *PredicateOp;
724 1.1 jruoho UINT8 *AmlPredicateStart; /* Start of if/while predicate */
725 1.1 jruoho UINT8 *PackageEnd; /* End of if/while block */
726 1.1 jruoho UINT32 LoopCount; /* While() loop counter */
727 1.1 jruoho
728 1.1 jruoho } ACPI_CONTROL_STATE;
729 1.1 jruoho
730 1.1 jruoho
731 1.1 jruoho /*
732 1.1 jruoho * Scope state - current scope during namespace lookups
733 1.1 jruoho */
734 1.1 jruoho typedef struct acpi_scope_state
735 1.1 jruoho {
736 1.1 jruoho ACPI_STATE_COMMON
737 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
738 1.1 jruoho
739 1.1 jruoho } ACPI_SCOPE_STATE;
740 1.1 jruoho
741 1.1 jruoho
742 1.1 jruoho typedef struct acpi_pscope_state
743 1.1 jruoho {
744 1.1 jruoho ACPI_STATE_COMMON
745 1.1 jruoho UINT32 ArgCount; /* Number of fixed arguments */
746 1.1 jruoho union acpi_parse_object *Op; /* Current op being parsed */
747 1.1 jruoho UINT8 *ArgEnd; /* Current argument end */
748 1.1 jruoho UINT8 *PkgEnd; /* Current package end */
749 1.1 jruoho UINT32 ArgList; /* Next argument to parse */
750 1.1 jruoho
751 1.1 jruoho } ACPI_PSCOPE_STATE;
752 1.1 jruoho
753 1.1 jruoho
754 1.1 jruoho /*
755 1.1.1.4 christos * Thread state - one per thread across multiple walk states. Multiple walk
756 1.1 jruoho * states are created when there are nested control methods executing.
757 1.1 jruoho */
758 1.1 jruoho typedef struct acpi_thread_state
759 1.1 jruoho {
760 1.1 jruoho ACPI_STATE_COMMON
761 1.1 jruoho UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
762 1.1 jruoho struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
763 1.1 jruoho union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
764 1.1 jruoho ACPI_THREAD_ID ThreadId; /* Running thread ID */
765 1.1 jruoho
766 1.1 jruoho } ACPI_THREAD_STATE;
767 1.1 jruoho
768 1.1 jruoho
769 1.1 jruoho /*
770 1.1 jruoho * Result values - used to accumulate the results of nested
771 1.1 jruoho * AML arguments
772 1.1 jruoho */
773 1.1 jruoho typedef struct acpi_result_values
774 1.1 jruoho {
775 1.1 jruoho ACPI_STATE_COMMON
776 1.1 jruoho union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
777 1.1 jruoho
778 1.1 jruoho } ACPI_RESULT_VALUES;
779 1.1 jruoho
780 1.1 jruoho
781 1.1 jruoho typedef
782 1.1 jruoho ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
783 1.1 jruoho struct acpi_walk_state *WalkState,
784 1.1 jruoho union acpi_parse_object **OutOp);
785 1.1 jruoho
786 1.1 jruoho typedef
787 1.1 jruoho ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
788 1.1 jruoho struct acpi_walk_state *WalkState);
789 1.1 jruoho
790 1.1 jruoho
791 1.1.1.4 christos /* Global handlers for AML Notifies */
792 1.1.1.4 christos
793 1.1.1.4 christos typedef struct acpi_global_notify_handler
794 1.1.1.4 christos {
795 1.1.1.4 christos ACPI_NOTIFY_HANDLER Handler;
796 1.1.1.4 christos void *Context;
797 1.1.1.4 christos
798 1.1.1.4 christos } ACPI_GLOBAL_NOTIFY_HANDLER;
799 1.1.1.4 christos
800 1.1 jruoho /*
801 1.1 jruoho * Notify info - used to pass info to the deferred notify
802 1.1 jruoho * handler/dispatcher.
803 1.1 jruoho */
804 1.1 jruoho typedef struct acpi_notify_info
805 1.1 jruoho {
806 1.1 jruoho ACPI_STATE_COMMON
807 1.1.1.4 christos UINT8 HandlerListId;
808 1.1 jruoho ACPI_NAMESPACE_NODE *Node;
809 1.1.1.4 christos union acpi_operand_object *HandlerListHead;
810 1.1.1.4 christos ACPI_GLOBAL_NOTIFY_HANDLER *Global;
811 1.1 jruoho
812 1.1 jruoho } ACPI_NOTIFY_INFO;
813 1.1 jruoho
814 1.1 jruoho
815 1.1 jruoho /* Generic state is union of structs above */
816 1.1 jruoho
817 1.1 jruoho typedef union acpi_generic_state
818 1.1 jruoho {
819 1.1 jruoho ACPI_COMMON_STATE Common;
820 1.1 jruoho ACPI_CONTROL_STATE Control;
821 1.1 jruoho ACPI_UPDATE_STATE Update;
822 1.1 jruoho ACPI_SCOPE_STATE Scope;
823 1.1 jruoho ACPI_PSCOPE_STATE ParseScope;
824 1.1 jruoho ACPI_PKG_STATE Pkg;
825 1.1 jruoho ACPI_THREAD_STATE Thread;
826 1.1 jruoho ACPI_RESULT_VALUES Results;
827 1.1 jruoho ACPI_NOTIFY_INFO Notify;
828 1.1 jruoho
829 1.1 jruoho } ACPI_GENERIC_STATE;
830 1.1 jruoho
831 1.1 jruoho
832 1.1 jruoho /*****************************************************************************
833 1.1 jruoho *
834 1.1 jruoho * Interpreter typedefs and structs
835 1.1 jruoho *
836 1.1 jruoho ****************************************************************************/
837 1.1 jruoho
838 1.1 jruoho typedef
839 1.1 jruoho ACPI_STATUS (*ACPI_EXECUTE_OP) (
840 1.1 jruoho struct acpi_walk_state *WalkState);
841 1.1 jruoho
842 1.1.1.4 christos /* Address Range info block */
843 1.1.1.4 christos
844 1.1.1.4 christos typedef struct acpi_address_range
845 1.1.1.4 christos {
846 1.1.1.4 christos struct acpi_address_range *Next;
847 1.1.1.4 christos ACPI_NAMESPACE_NODE *RegionNode;
848 1.1.1.4 christos ACPI_PHYSICAL_ADDRESS StartAddress;
849 1.1.1.4 christos ACPI_PHYSICAL_ADDRESS EndAddress;
850 1.1.1.4 christos
851 1.1.1.4 christos } ACPI_ADDRESS_RANGE;
852 1.1.1.4 christos
853 1.1 jruoho
854 1.1 jruoho /*****************************************************************************
855 1.1 jruoho *
856 1.1 jruoho * Parser typedefs and structs
857 1.1 jruoho *
858 1.1 jruoho ****************************************************************************/
859 1.1 jruoho
860 1.1 jruoho /*
861 1.1 jruoho * AML opcode, name, and argument layout
862 1.1 jruoho */
863 1.1 jruoho typedef struct acpi_opcode_info
864 1.1 jruoho {
865 1.1 jruoho #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
866 1.1 jruoho char *Name; /* Opcode name (disassembler/debug only) */
867 1.1 jruoho #endif
868 1.1 jruoho UINT32 ParseArgs; /* Grammar/Parse time arguments */
869 1.1 jruoho UINT32 RuntimeArgs; /* Interpret time arguments */
870 1.1 jruoho UINT16 Flags; /* Misc flags */
871 1.1 jruoho UINT8 ObjectType; /* Corresponding internal object type */
872 1.1 jruoho UINT8 Class; /* Opcode class */
873 1.1 jruoho UINT8 Type; /* Opcode type */
874 1.1 jruoho
875 1.1 jruoho } ACPI_OPCODE_INFO;
876 1.1 jruoho
877 1.1.1.4 christos /* Structure for Resource Tag information */
878 1.1.1.4 christos
879 1.1.1.4 christos typedef struct acpi_tag_info
880 1.1.1.4 christos {
881 1.1.1.4 christos UINT32 BitOffset;
882 1.1.1.4 christos UINT32 BitLength;
883 1.1.1.4 christos
884 1.1.1.4 christos } ACPI_TAG_INFO;
885 1.1.1.4 christos
886 1.1.1.4 christos /* Value associated with the parse object */
887 1.1.1.4 christos
888 1.1 jruoho typedef union acpi_parse_value
889 1.1 jruoho {
890 1.1 jruoho UINT64 Integer; /* Integer constant (Up to 64 bits) */
891 1.1 jruoho UINT32 Size; /* bytelist or field size */
892 1.1 jruoho char *String; /* NULL terminated string */
893 1.1 jruoho UINT8 *Buffer; /* buffer or string */
894 1.1 jruoho char *Name; /* NULL terminated string */
895 1.1 jruoho union acpi_parse_object *Arg; /* arguments and contained ops */
896 1.1.1.4 christos ACPI_TAG_INFO Tag; /* Resource descriptor tag info */
897 1.1 jruoho
898 1.1 jruoho } ACPI_PARSE_VALUE;
899 1.1 jruoho
900 1.1 jruoho
901 1.1.1.7 christos #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
902 1.1 jruoho #define ACPI_DISASM_ONLY_MEMBERS(a) a;
903 1.1 jruoho #else
904 1.1 jruoho #define ACPI_DISASM_ONLY_MEMBERS(a)
905 1.1 jruoho #endif
906 1.1 jruoho
907 1.1 jruoho #define ACPI_PARSE_COMMON \
908 1.1 jruoho union acpi_parse_object *Parent; /* Parent op */\
909 1.1 jruoho UINT8 DescriptorType; /* To differentiate various internal objs */\
910 1.1 jruoho UINT8 Flags; /* Type of Op */\
911 1.1 jruoho UINT16 AmlOpcode; /* AML opcode */\
912 1.1.1.7 christos UINT8 *Aml; /* Address of declaration in AML */\
913 1.1 jruoho union acpi_parse_object *Next; /* Next op */\
914 1.1 jruoho ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
915 1.1 jruoho ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
916 1.1 jruoho UINT8 ArgListLength; /* Number of elements in the arg list */\
917 1.1 jruoho ACPI_DISASM_ONLY_MEMBERS (\
918 1.1 jruoho UINT8 DisasmFlags; /* Used during AML disassembly */\
919 1.1 jruoho UINT8 DisasmOpcode; /* Subtype used for disassembly */\
920 1.1.1.6 christos char *OperatorSymbol;/* Used for C-style operator name strings */\
921 1.1 jruoho char AmlOpName[16]) /* Op name (debug only) */
922 1.1 jruoho
923 1.1 jruoho
924 1.1.1.4 christos /* Flags for DisasmFlags field above */
925 1.1.1.4 christos
926 1.1.1.4 christos #define ACPI_DASM_BUFFER 0x00 /* Buffer is a simple data buffer */
927 1.1.1.4 christos #define ACPI_DASM_RESOURCE 0x01 /* Buffer is a Resource Descriptor */
928 1.1.1.4 christos #define ACPI_DASM_STRING 0x02 /* Buffer is a ASCII string */
929 1.1.1.4 christos #define ACPI_DASM_UNICODE 0x03 /* Buffer is a Unicode string */
930 1.1.1.4 christos #define ACPI_DASM_PLD_METHOD 0x04 /* Buffer is a _PLD method bit-packed buffer */
931 1.1.1.5 christos #define ACPI_DASM_UUID 0x05 /* Buffer is a UUID/GUID */
932 1.1.1.5 christos #define ACPI_DASM_EISAID 0x06 /* Integer is an EISAID */
933 1.1.1.5 christos #define ACPI_DASM_MATCHOP 0x07 /* Parent opcode is a Match() operator */
934 1.1.1.5 christos #define ACPI_DASM_LNOT_PREFIX 0x08 /* Start of a LNotEqual (etc.) pair of opcodes */
935 1.1.1.5 christos #define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */
936 1.1.1.5 christos #define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */
937 1.1.1.5 christos #define ACPI_DASM_IGNORE 0x0B /* Not used at this time */
938 1.1 jruoho
939 1.1 jruoho /*
940 1.1 jruoho * Generic operation (for example: If, While, Store)
941 1.1 jruoho */
942 1.1 jruoho typedef struct acpi_parse_obj_common
943 1.1 jruoho {
944 1.1 jruoho ACPI_PARSE_COMMON
945 1.1 jruoho } ACPI_PARSE_OBJ_COMMON;
946 1.1 jruoho
947 1.1 jruoho
948 1.1 jruoho /*
949 1.1 jruoho * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
950 1.1 jruoho * and bytelists.
951 1.1 jruoho */
952 1.1 jruoho typedef struct acpi_parse_obj_named
953 1.1 jruoho {
954 1.1 jruoho ACPI_PARSE_COMMON
955 1.1 jruoho UINT8 *Path;
956 1.1 jruoho UINT8 *Data; /* AML body or bytelist data */
957 1.1 jruoho UINT32 Length; /* AML length */
958 1.1 jruoho UINT32 Name; /* 4-byte name or zero if no name */
959 1.1 jruoho
960 1.1 jruoho } ACPI_PARSE_OBJ_NAMED;
961 1.1 jruoho
962 1.1 jruoho
963 1.1 jruoho /* This version is used by the iASL compiler only */
964 1.1 jruoho
965 1.1 jruoho #define ACPI_MAX_PARSEOP_NAME 20
966 1.1 jruoho
967 1.1 jruoho typedef struct acpi_parse_obj_asl
968 1.1 jruoho {
969 1.1 jruoho ACPI_PARSE_COMMON
970 1.1 jruoho union acpi_parse_object *Child;
971 1.1 jruoho union acpi_parse_object *ParentMethod;
972 1.1 jruoho char *Filename;
973 1.1 jruoho char *ExternalName;
974 1.1 jruoho char *Namepath;
975 1.1 jruoho char NameSeg[4];
976 1.1 jruoho UINT32 ExtraValue;
977 1.1 jruoho UINT32 Column;
978 1.1 jruoho UINT32 LineNumber;
979 1.1 jruoho UINT32 LogicalLineNumber;
980 1.1 jruoho UINT32 LogicalByteOffset;
981 1.1 jruoho UINT32 EndLine;
982 1.1 jruoho UINT32 EndLogicalLine;
983 1.1 jruoho UINT32 AcpiBtype;
984 1.1 jruoho UINT32 AmlLength;
985 1.1 jruoho UINT32 AmlSubtreeLength;
986 1.1 jruoho UINT32 FinalAmlLength;
987 1.1 jruoho UINT32 FinalAmlOffset;
988 1.1 jruoho UINT32 CompileFlags;
989 1.1 jruoho UINT16 ParseOpcode;
990 1.1 jruoho UINT8 AmlOpcodeLength;
991 1.1 jruoho UINT8 AmlPkgLenBytes;
992 1.1 jruoho UINT8 Extra;
993 1.1 jruoho char ParseOpName[ACPI_MAX_PARSEOP_NAME];
994 1.1 jruoho
995 1.1 jruoho } ACPI_PARSE_OBJ_ASL;
996 1.1 jruoho
997 1.1 jruoho typedef union acpi_parse_object
998 1.1 jruoho {
999 1.1 jruoho ACPI_PARSE_OBJ_COMMON Common;
1000 1.1 jruoho ACPI_PARSE_OBJ_NAMED Named;
1001 1.1 jruoho ACPI_PARSE_OBJ_ASL Asl;
1002 1.1 jruoho
1003 1.1 jruoho } ACPI_PARSE_OBJECT;
1004 1.1 jruoho
1005 1.1 jruoho
1006 1.1 jruoho /*
1007 1.1 jruoho * Parse state - one state per parser invocation and each control
1008 1.1 jruoho * method.
1009 1.1 jruoho */
1010 1.1 jruoho typedef struct acpi_parse_state
1011 1.1 jruoho {
1012 1.1 jruoho UINT8 *AmlStart; /* First AML byte */
1013 1.1 jruoho UINT8 *Aml; /* Next AML byte */
1014 1.1 jruoho UINT8 *AmlEnd; /* (last + 1) AML byte */
1015 1.1 jruoho UINT8 *PkgStart; /* Current package begin */
1016 1.1 jruoho UINT8 *PkgEnd; /* Current package end */
1017 1.1 jruoho union acpi_parse_object *StartOp; /* Root of parse tree */
1018 1.1 jruoho struct acpi_namespace_node *StartNode;
1019 1.1 jruoho union acpi_generic_state *Scope; /* Current scope */
1020 1.1 jruoho union acpi_parse_object *StartScope;
1021 1.1 jruoho UINT32 AmlSize;
1022 1.1 jruoho
1023 1.1 jruoho } ACPI_PARSE_STATE;
1024 1.1 jruoho
1025 1.1 jruoho
1026 1.1 jruoho /* Parse object flags */
1027 1.1 jruoho
1028 1.1 jruoho #define ACPI_PARSEOP_GENERIC 0x01
1029 1.1 jruoho #define ACPI_PARSEOP_NAMED 0x02
1030 1.1 jruoho #define ACPI_PARSEOP_DEFERRED 0x04
1031 1.1 jruoho #define ACPI_PARSEOP_BYTELIST 0x08
1032 1.1 jruoho #define ACPI_PARSEOP_IN_STACK 0x10
1033 1.1 jruoho #define ACPI_PARSEOP_TARGET 0x20
1034 1.1 jruoho #define ACPI_PARSEOP_IN_CACHE 0x80
1035 1.1 jruoho
1036 1.1 jruoho /* Parse object DisasmFlags */
1037 1.1 jruoho
1038 1.1 jruoho #define ACPI_PARSEOP_IGNORE 0x01
1039 1.1 jruoho #define ACPI_PARSEOP_PARAMLIST 0x02
1040 1.1 jruoho #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
1041 1.1.1.4 christos #define ACPI_PARSEOP_PREDEF_CHECKED 0x08
1042 1.1.1.8 christos #define ACPI_PARSEOP_CLOSING_PAREN 0x10
1043 1.1.1.6 christos #define ACPI_PARSEOP_COMPOUND 0x20
1044 1.1.1.6 christos #define ACPI_PARSEOP_ASSIGNMENT 0x40
1045 1.1.1.8 christos #define ACPI_PARSEOP_ELSEIF 0x80
1046 1.1 jruoho
1047 1.1 jruoho
1048 1.1 jruoho /*****************************************************************************
1049 1.1 jruoho *
1050 1.1 jruoho * Hardware (ACPI registers) and PNP
1051 1.1 jruoho *
1052 1.1 jruoho ****************************************************************************/
1053 1.1 jruoho
1054 1.1 jruoho typedef struct acpi_bit_register_info
1055 1.1 jruoho {
1056 1.1 jruoho UINT8 ParentRegister;
1057 1.1 jruoho UINT8 BitPosition;
1058 1.1 jruoho UINT16 AccessBitMask;
1059 1.1 jruoho
1060 1.1 jruoho } ACPI_BIT_REGISTER_INFO;
1061 1.1 jruoho
1062 1.1 jruoho
1063 1.1 jruoho /*
1064 1.1 jruoho * Some ACPI registers have bits that must be ignored -- meaning that they
1065 1.1 jruoho * must be preserved.
1066 1.1 jruoho */
1067 1.1 jruoho #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
1068 1.1 jruoho
1069 1.1 jruoho /* Write-only bits must be zeroed by software */
1070 1.1 jruoho
1071 1.1 jruoho #define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */
1072 1.1 jruoho
1073 1.1 jruoho /* For control registers, both ignored and reserved bits must be preserved */
1074 1.1 jruoho
1075 1.1 jruoho /*
1076 1.1 jruoho * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
1077 1.1 jruoho * ACPI specification to be a "preserved" bit - "OSPM always preserves this
1078 1.1 jruoho * bit position", section 4.7.3.2.1. However, on some machines the OS must
1079 1.1 jruoho * write a one to this bit after resume for the machine to work properly.
1080 1.1 jruoho * To enable this, we no longer attempt to preserve this bit. No machines
1081 1.1 jruoho * are known to fail if the bit is not preserved. (May 2009)
1082 1.1 jruoho */
1083 1.1 jruoho #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */
1084 1.1 jruoho #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */
1085 1.1 jruoho #define ACPI_PM1_CONTROL_PRESERVED_BITS \
1086 1.1 jruoho (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
1087 1.1 jruoho
1088 1.1 jruoho #define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */
1089 1.1 jruoho
1090 1.1 jruoho /*
1091 1.1 jruoho * Register IDs
1092 1.1 jruoho * These are the full ACPI registers
1093 1.1 jruoho */
1094 1.1 jruoho #define ACPI_REGISTER_PM1_STATUS 0x01
1095 1.1 jruoho #define ACPI_REGISTER_PM1_ENABLE 0x02
1096 1.1 jruoho #define ACPI_REGISTER_PM1_CONTROL 0x03
1097 1.1 jruoho #define ACPI_REGISTER_PM2_CONTROL 0x04
1098 1.1 jruoho #define ACPI_REGISTER_PM_TIMER 0x05
1099 1.1 jruoho #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06
1100 1.1 jruoho #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07
1101 1.1 jruoho
1102 1.1 jruoho
1103 1.1 jruoho /* Masks used to access the BitRegisters */
1104 1.1 jruoho
1105 1.1 jruoho #define ACPI_BITMASK_TIMER_STATUS 0x0001
1106 1.1 jruoho #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010
1107 1.1 jruoho #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020
1108 1.1 jruoho #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
1109 1.1 jruoho #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
1110 1.1 jruoho #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
1111 1.1 jruoho #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
1112 1.1 jruoho #define ACPI_BITMASK_WAKE_STATUS 0x8000
1113 1.1 jruoho
1114 1.1 jruoho #define ACPI_BITMASK_ALL_FIXED_STATUS (\
1115 1.1 jruoho ACPI_BITMASK_TIMER_STATUS | \
1116 1.1 jruoho ACPI_BITMASK_BUS_MASTER_STATUS | \
1117 1.1 jruoho ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
1118 1.1 jruoho ACPI_BITMASK_POWER_BUTTON_STATUS | \
1119 1.1 jruoho ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
1120 1.1 jruoho ACPI_BITMASK_RT_CLOCK_STATUS | \
1121 1.1.1.2 jruoho ACPI_BITMASK_PCIEXP_WAKE_STATUS | \
1122 1.1 jruoho ACPI_BITMASK_WAKE_STATUS)
1123 1.1 jruoho
1124 1.1 jruoho #define ACPI_BITMASK_TIMER_ENABLE 0x0001
1125 1.1 jruoho #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
1126 1.1 jruoho #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
1127 1.1 jruoho #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
1128 1.1 jruoho #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
1129 1.1 jruoho #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
1130 1.1 jruoho
1131 1.1 jruoho #define ACPI_BITMASK_SCI_ENABLE 0x0001
1132 1.1 jruoho #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
1133 1.1 jruoho #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004
1134 1.1 jruoho #define ACPI_BITMASK_SLEEP_TYPE 0x1C00
1135 1.1 jruoho #define ACPI_BITMASK_SLEEP_ENABLE 0x2000
1136 1.1 jruoho
1137 1.1 jruoho #define ACPI_BITMASK_ARB_DISABLE 0x0001
1138 1.1 jruoho
1139 1.1 jruoho
1140 1.1 jruoho /* Raw bit position of each BitRegister */
1141 1.1 jruoho
1142 1.1 jruoho #define ACPI_BITPOSITION_TIMER_STATUS 0x00
1143 1.1 jruoho #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04
1144 1.1 jruoho #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05
1145 1.1 jruoho #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
1146 1.1 jruoho #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
1147 1.1 jruoho #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
1148 1.1 jruoho #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
1149 1.1 jruoho #define ACPI_BITPOSITION_WAKE_STATUS 0x0F
1150 1.1 jruoho
1151 1.1 jruoho #define ACPI_BITPOSITION_TIMER_ENABLE 0x00
1152 1.1 jruoho #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05
1153 1.1 jruoho #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
1154 1.1 jruoho #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
1155 1.1 jruoho #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
1156 1.1 jruoho #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
1157 1.1 jruoho
1158 1.1 jruoho #define ACPI_BITPOSITION_SCI_ENABLE 0x00
1159 1.1 jruoho #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
1160 1.1 jruoho #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02
1161 1.1 jruoho #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A
1162 1.1 jruoho #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D
1163 1.1 jruoho
1164 1.1 jruoho #define ACPI_BITPOSITION_ARB_DISABLE 0x00
1165 1.1 jruoho
1166 1.1 jruoho
1167 1.1 jruoho /* Structs and definitions for _OSI support and I/O port validation */
1168 1.1 jruoho
1169 1.1 jruoho #define ACPI_ALWAYS_ILLEGAL 0x00
1170 1.1 jruoho
1171 1.1 jruoho typedef struct acpi_interface_info
1172 1.1 jruoho {
1173 1.1.1.2 jruoho char *Name;
1174 1.1.1.2 jruoho struct acpi_interface_info *Next;
1175 1.1.1.2 jruoho UINT8 Flags;
1176 1.1.1.2 jruoho UINT8 Value;
1177 1.1 jruoho
1178 1.1 jruoho } ACPI_INTERFACE_INFO;
1179 1.1 jruoho
1180 1.1.1.2 jruoho #define ACPI_OSI_INVALID 0x01
1181 1.1.1.2 jruoho #define ACPI_OSI_DYNAMIC 0x02
1182 1.1.1.4 christos #define ACPI_OSI_FEATURE 0x04
1183 1.1.1.4 christos #define ACPI_OSI_DEFAULT_INVALID 0x08
1184 1.1.1.4 christos #define ACPI_OSI_OPTIONAL_FEATURE (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
1185 1.1.1.2 jruoho
1186 1.1 jruoho typedef struct acpi_port_info
1187 1.1 jruoho {
1188 1.1 jruoho char *Name;
1189 1.1 jruoho UINT16 Start;
1190 1.1 jruoho UINT16 End;
1191 1.1 jruoho UINT8 OsiDependency;
1192 1.1 jruoho
1193 1.1 jruoho } ACPI_PORT_INFO;
1194 1.1 jruoho
1195 1.1 jruoho
1196 1.1 jruoho /*****************************************************************************
1197 1.1 jruoho *
1198 1.1 jruoho * Resource descriptors
1199 1.1 jruoho *
1200 1.1 jruoho ****************************************************************************/
1201 1.1 jruoho
1202 1.1 jruoho /* ResourceType values */
1203 1.1 jruoho
1204 1.1 jruoho #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
1205 1.1 jruoho #define ACPI_ADDRESS_TYPE_IO_RANGE 1
1206 1.1 jruoho #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
1207 1.1 jruoho
1208 1.1 jruoho /* Resource descriptor types and masks */
1209 1.1 jruoho
1210 1.1 jruoho #define ACPI_RESOURCE_NAME_LARGE 0x80
1211 1.1 jruoho #define ACPI_RESOURCE_NAME_SMALL 0x00
1212 1.1 jruoho
1213 1.1 jruoho #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
1214 1.1 jruoho #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
1215 1.1 jruoho #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
1216 1.1 jruoho
1217 1.1 jruoho
1218 1.1 jruoho /*
1219 1.1 jruoho * Small resource descriptor "names" as defined by the ACPI specification.
1220 1.1 jruoho * Note: Bits 2:0 are used for the descriptor length
1221 1.1 jruoho */
1222 1.1 jruoho #define ACPI_RESOURCE_NAME_IRQ 0x20
1223 1.1 jruoho #define ACPI_RESOURCE_NAME_DMA 0x28
1224 1.1 jruoho #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
1225 1.1 jruoho #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
1226 1.1 jruoho #define ACPI_RESOURCE_NAME_IO 0x40
1227 1.1 jruoho #define ACPI_RESOURCE_NAME_FIXED_IO 0x48
1228 1.1.1.4 christos #define ACPI_RESOURCE_NAME_FIXED_DMA 0x50
1229 1.1 jruoho #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
1230 1.1 jruoho #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
1231 1.1 jruoho #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
1232 1.1 jruoho #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
1233 1.1 jruoho #define ACPI_RESOURCE_NAME_END_TAG 0x78
1234 1.1 jruoho
1235 1.1 jruoho /*
1236 1.1 jruoho * Large resource descriptor "names" as defined by the ACPI specification.
1237 1.1 jruoho * Note: includes the Large Descriptor bit in bit[7]
1238 1.1 jruoho */
1239 1.1 jruoho #define ACPI_RESOURCE_NAME_MEMORY24 0x81
1240 1.1 jruoho #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
1241 1.1 jruoho #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
1242 1.1 jruoho #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
1243 1.1 jruoho #define ACPI_RESOURCE_NAME_MEMORY32 0x85
1244 1.1 jruoho #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
1245 1.1 jruoho #define ACPI_RESOURCE_NAME_ADDRESS32 0x87
1246 1.1 jruoho #define ACPI_RESOURCE_NAME_ADDRESS16 0x88
1247 1.1 jruoho #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
1248 1.1 jruoho #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
1249 1.1 jruoho #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
1250 1.1.1.4 christos #define ACPI_RESOURCE_NAME_GPIO 0x8C
1251 1.1.1.4 christos #define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E
1252 1.1.1.4 christos #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E
1253 1.1 jruoho
1254 1.1 jruoho
1255 1.1 jruoho /*****************************************************************************
1256 1.1 jruoho *
1257 1.1 jruoho * Miscellaneous
1258 1.1 jruoho *
1259 1.1 jruoho ****************************************************************************/
1260 1.1 jruoho
1261 1.1 jruoho #define ACPI_ASCII_ZERO 0x30
1262 1.1 jruoho
1263 1.1 jruoho
1264 1.1 jruoho /*****************************************************************************
1265 1.1 jruoho *
1266 1.1 jruoho * Disassembler
1267 1.1 jruoho *
1268 1.1 jruoho ****************************************************************************/
1269 1.1 jruoho
1270 1.1 jruoho typedef struct acpi_external_list
1271 1.1 jruoho {
1272 1.1 jruoho char *Path;
1273 1.1 jruoho char *InternalPath;
1274 1.1 jruoho struct acpi_external_list *Next;
1275 1.1 jruoho UINT32 Value;
1276 1.1 jruoho UINT16 Length;
1277 1.1.1.4 christos UINT16 Flags;
1278 1.1 jruoho UINT8 Type;
1279 1.1 jruoho
1280 1.1 jruoho } ACPI_EXTERNAL_LIST;
1281 1.1 jruoho
1282 1.1 jruoho /* Values for Flags field above */
1283 1.1 jruoho
1284 1.1.1.4 christos #define ACPI_EXT_RESOLVED_REFERENCE 0x01 /* Object was resolved during cross ref */
1285 1.1.1.4 christos #define ACPI_EXT_ORIGIN_FROM_FILE 0x02 /* External came from a file */
1286 1.1.1.4 christos #define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */
1287 1.1.1.4 christos #define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */
1288 1.1 jruoho
1289 1.1 jruoho
1290 1.1.1.2 jruoho typedef struct acpi_external_file
1291 1.1.1.2 jruoho {
1292 1.1.1.2 jruoho char *Path;
1293 1.1.1.2 jruoho struct acpi_external_file *Next;
1294 1.1.1.2 jruoho
1295 1.1.1.2 jruoho } ACPI_EXTERNAL_FILE;
1296 1.1.1.2 jruoho
1297 1.1.1.2 jruoho
1298 1.1 jruoho /*****************************************************************************
1299 1.1 jruoho *
1300 1.1 jruoho * Debugger
1301 1.1 jruoho *
1302 1.1 jruoho ****************************************************************************/
1303 1.1 jruoho
1304 1.1 jruoho typedef struct acpi_db_method_info
1305 1.1 jruoho {
1306 1.1.1.4 christos ACPI_HANDLE Method;
1307 1.1 jruoho ACPI_HANDLE MainThreadGate;
1308 1.1 jruoho ACPI_HANDLE ThreadCompleteGate;
1309 1.1 jruoho ACPI_HANDLE InfoGate;
1310 1.1.1.2 jruoho ACPI_THREAD_ID *Threads;
1311 1.1 jruoho UINT32 NumThreads;
1312 1.1 jruoho UINT32 NumCreated;
1313 1.1 jruoho UINT32 NumCompleted;
1314 1.1 jruoho
1315 1.1 jruoho char *Name;
1316 1.1 jruoho UINT32 Flags;
1317 1.1 jruoho UINT32 NumLoops;
1318 1.1.1.4 christos char Pathname[ACPI_DB_LINE_BUFFER_SIZE];
1319 1.1 jruoho char **Args;
1320 1.1.1.3 jruoho ACPI_OBJECT_TYPE *Types;
1321 1.1 jruoho
1322 1.1 jruoho /*
1323 1.1 jruoho * Arguments to be passed to method for the command
1324 1.1 jruoho * Threads -
1325 1.1 jruoho * the Number of threads, ID of current thread and
1326 1.1 jruoho * Index of current thread inside all them created.
1327 1.1 jruoho */
1328 1.1 jruoho char InitArgs;
1329 1.1.1.7 christos #ifdef ACPI_DEBUGGER
1330 1.1.1.3 jruoho ACPI_OBJECT_TYPE ArgTypes[4];
1331 1.1.1.7 christos #endif
1332 1.1 jruoho char *Arguments[4];
1333 1.1 jruoho char NumThreadsStr[11];
1334 1.1 jruoho char IdOfThreadStr[11];
1335 1.1 jruoho char IndexOfThreadStr[11];
1336 1.1 jruoho
1337 1.1 jruoho } ACPI_DB_METHOD_INFO;
1338 1.1 jruoho
1339 1.1 jruoho typedef struct acpi_integrity_info
1340 1.1 jruoho {
1341 1.1 jruoho UINT32 Nodes;
1342 1.1 jruoho UINT32 Objects;
1343 1.1 jruoho
1344 1.1 jruoho } ACPI_INTEGRITY_INFO;
1345 1.1 jruoho
1346 1.1 jruoho
1347 1.1.1.4 christos #define ACPI_DB_DISABLE_OUTPUT 0x00
1348 1.1 jruoho #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
1349 1.1 jruoho #define ACPI_DB_CONSOLE_OUTPUT 0x02
1350 1.1 jruoho #define ACPI_DB_DUPLICATE_OUTPUT 0x03
1351 1.1 jruoho
1352 1.1 jruoho
1353 1.1.1.8 christos typedef struct acpi_object_info
1354 1.1.1.8 christos {
1355 1.1.1.8 christos UINT32 Types[ACPI_TOTAL_TYPES];
1356 1.1.1.8 christos
1357 1.1.1.8 christos } ACPI_OBJECT_INFO;
1358 1.1.1.8 christos
1359 1.1.1.8 christos
1360 1.1 jruoho /*****************************************************************************
1361 1.1 jruoho *
1362 1.1 jruoho * Debug
1363 1.1 jruoho *
1364 1.1 jruoho ****************************************************************************/
1365 1.1 jruoho
1366 1.1 jruoho /* Entry for a memory allocation (debug only) */
1367 1.1 jruoho
1368 1.1 jruoho #define ACPI_MEM_MALLOC 0
1369 1.1 jruoho #define ACPI_MEM_CALLOC 1
1370 1.1 jruoho #define ACPI_MAX_MODULE_NAME 16
1371 1.1 jruoho
1372 1.1 jruoho #define ACPI_COMMON_DEBUG_MEM_HEADER \
1373 1.1 jruoho struct acpi_debug_mem_block *Previous; \
1374 1.1 jruoho struct acpi_debug_mem_block *Next; \
1375 1.1 jruoho UINT32 Size; \
1376 1.1 jruoho UINT32 Component; \
1377 1.1 jruoho UINT32 Line; \
1378 1.1 jruoho char Module[ACPI_MAX_MODULE_NAME]; \
1379 1.1 jruoho UINT8 AllocType;
1380 1.1 jruoho
1381 1.1 jruoho typedef struct acpi_debug_mem_header
1382 1.1 jruoho {
1383 1.1 jruoho ACPI_COMMON_DEBUG_MEM_HEADER
1384 1.1 jruoho
1385 1.1 jruoho } ACPI_DEBUG_MEM_HEADER;
1386 1.1 jruoho
1387 1.1 jruoho typedef struct acpi_debug_mem_block
1388 1.1 jruoho {
1389 1.1 jruoho ACPI_COMMON_DEBUG_MEM_HEADER
1390 1.1 jruoho UINT64 UserSpace;
1391 1.1 jruoho
1392 1.1 jruoho } ACPI_DEBUG_MEM_BLOCK;
1393 1.1 jruoho
1394 1.1 jruoho
1395 1.1 jruoho #define ACPI_MEM_LIST_GLOBAL 0
1396 1.1 jruoho #define ACPI_MEM_LIST_NSNODE 1
1397 1.1 jruoho #define ACPI_MEM_LIST_MAX 1
1398 1.1 jruoho #define ACPI_NUM_MEM_LISTS 2
1399 1.1 jruoho
1400 1.1 jruoho
1401 1.1.1.4 christos /*****************************************************************************
1402 1.1.1.4 christos *
1403 1.1.1.4 christos * Info/help support
1404 1.1.1.4 christos *
1405 1.1.1.4 christos ****************************************************************************/
1406 1.1.1.4 christos
1407 1.1.1.4 christos typedef struct ah_predefined_name
1408 1.1.1.4 christos {
1409 1.1.1.4 christos char *Name;
1410 1.1.1.4 christos char *Description;
1411 1.1.1.4 christos #ifndef ACPI_ASL_COMPILER
1412 1.1.1.4 christos char *Action;
1413 1.1.1.4 christos #endif
1414 1.1.1.4 christos
1415 1.1.1.4 christos } AH_PREDEFINED_NAME;
1416 1.1.1.4 christos
1417 1.1.1.5 christos typedef struct ah_device_id
1418 1.1.1.5 christos {
1419 1.1.1.5 christos char *Name;
1420 1.1.1.5 christos char *Description;
1421 1.1.1.5 christos
1422 1.1.1.5 christos } AH_DEVICE_ID;
1423 1.1.1.5 christos
1424 1.1.1.5 christos typedef struct ah_uuid
1425 1.1.1.5 christos {
1426 1.1.1.5 christos char *Description;
1427 1.1.1.5 christos char *String;
1428 1.1.1.5 christos
1429 1.1.1.5 christos } AH_UUID;
1430 1.1.1.5 christos
1431 1.1.1.7 christos typedef struct ah_table
1432 1.1.1.7 christos {
1433 1.1.1.7 christos char *Signature;
1434 1.1.1.7 christos char *Description;
1435 1.1.1.7 christos
1436 1.1.1.7 christos } AH_TABLE;
1437 1.1.1.7 christos
1438 1.1 jruoho #endif /* __ACLOCAL_H__ */
1439