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