Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Name: actypes.h - Common data types for the entire ACPI subsystem | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | |
9 | * All rights reserved. | |
10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | |
15 | * notice, this list of conditions, and the following disclaimer, | |
16 | * without modification. | |
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | |
18 | * substantially similar to the "NO WARRANTY" disclaimer below | |
19 | * ("Disclaimer") and any redistribution must be conditioned upon | |
20 | * including a substantially similar Disclaimer requirement for further | |
21 | * binary redistribution. | |
22 | * 3. Neither the names of the above-listed copyright holders nor the names | |
23 | * of any contributors may be used to endorse or promote products derived | |
24 | * from this software without specific prior written permission. | |
25 | * | |
26 | * Alternatively, this software may be distributed under the terms of the | |
27 | * GNU General Public License ("GPL") version 2 as published by the Free | |
28 | * Software Foundation. | |
29 | * | |
30 | * NO WARRANTY | |
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | |
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
41 | * POSSIBILITY OF SUCH DAMAGES. | |
42 | */ | |
43 | ||
44 | #ifndef __ACTYPES_H__ | |
45 | #define __ACTYPES_H__ | |
46 | ||
47 | /*! [Begin] no source code translation (keep the typedefs) */ | |
48 | ||
1da177e4 LT |
49 | /* |
50 | * Data type ranges | |
51 | * Note: These macros are designed to be compiler independent as well as | |
52 | * working around problems that some 32-bit compilers have with 64-bit | |
53 | * constants. | |
54 | */ | |
4be44fcd LB |
55 | #define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */ |
56 | #define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */ | |
57 | #define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */ | |
58 | #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */ | |
1da177e4 LT |
59 | #define ACPI_ASCII_MAX 0x7F |
60 | ||
1da177e4 LT |
61 | #ifdef DEFINE_ALTERNATE_TYPES |
62 | /* | |
63 | * Types used only in translated source, defined here to enable | |
64 | * cross-platform compilation only. | |
65 | */ | |
4be44fcd LB |
66 | typedef int s32; |
67 | typedef unsigned char u8; | |
68 | typedef unsigned short u16; | |
69 | typedef unsigned int u32; | |
70 | typedef COMPILER_DEPENDENT_UINT64 u64; | |
1da177e4 LT |
71 | |
72 | #endif | |
73 | ||
1da177e4 LT |
74 | /* |
75 | * Data types - Fixed across all compilation models (16/32/64) | |
76 | * | |
77 | * BOOLEAN Logical Boolean. | |
78 | * INT8 8-bit (1 byte) signed value | |
79 | * UINT8 8-bit (1 byte) unsigned value | |
80 | * INT16 16-bit (2 byte) signed value | |
81 | * UINT16 16-bit (2 byte) unsigned value | |
82 | * INT32 32-bit (4 byte) signed value | |
83 | * UINT32 32-bit (4 byte) unsigned value | |
84 | * INT64 64-bit (8 byte) signed value | |
85 | * UINT64 64-bit (8 byte) unsigned value | |
86 | * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value | |
87 | * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value | |
88 | */ | |
89 | ||
90 | #ifndef ACPI_MACHINE_WIDTH | |
91 | #error ACPI_MACHINE_WIDTH not defined | |
92 | #endif | |
93 | ||
94 | #if ACPI_MACHINE_WIDTH == 64 | |
95 | ||
96 | /*! [Begin] no source code translation (keep the typedefs) */ | |
97 | ||
98 | /* | |
99 | * 64-bit type definitions | |
100 | */ | |
4be44fcd LB |
101 | typedef unsigned char UINT8; |
102 | typedef unsigned char BOOLEAN; | |
103 | typedef unsigned short UINT16; | |
104 | typedef int INT32; | |
105 | typedef unsigned int UINT32; | |
106 | typedef COMPILER_DEPENDENT_INT64 INT64; | |
107 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | |
1da177e4 LT |
108 | |
109 | /*! [End] no source code translation !*/ | |
110 | ||
4be44fcd LB |
111 | typedef s64 acpi_native_int; |
112 | typedef u64 acpi_native_uint; | |
1da177e4 | 113 | |
4be44fcd LB |
114 | typedef u64 acpi_table_ptr; |
115 | typedef u64 acpi_io_address; | |
116 | typedef u64 acpi_physical_address; | |
117 | typedef u64 acpi_size; | |
1da177e4 | 118 | |
4be44fcd LB |
119 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */ |
120 | #define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */ | |
1da177e4 LT |
121 | #define ACPI_MAX_PTR ACPI_UINT64_MAX |
122 | #define ACPI_SIZE_MAX ACPI_UINT64_MAX | |
123 | ||
1da177e4 LT |
124 | #elif ACPI_MACHINE_WIDTH == 16 |
125 | ||
126 | /*! [Begin] no source code translation (keep the typedefs) */ | |
127 | ||
128 | /* | |
129 | * 16-bit type definitions | |
130 | */ | |
4be44fcd LB |
131 | typedef unsigned char UINT8; |
132 | typedef unsigned char BOOLEAN; | |
133 | typedef unsigned int UINT16; | |
134 | typedef long INT32; | |
135 | typedef int INT16; | |
136 | typedef unsigned long UINT32; | |
137 | ||
138 | struct { | |
139 | UINT32 Lo; | |
140 | UINT32 Hi; | |
1da177e4 LT |
141 | }; |
142 | ||
143 | /*! [End] no source code translation !*/ | |
144 | ||
4be44fcd LB |
145 | typedef u16 acpi_native_uint; |
146 | typedef s16 acpi_native_int; | |
1da177e4 | 147 | |
4be44fcd LB |
148 | typedef u32 acpi_table_ptr; |
149 | typedef u32 acpi_io_address; | |
150 | typedef char *acpi_physical_address; | |
151 | typedef u16 acpi_size; | |
1da177e4 LT |
152 | |
153 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000002 | |
154 | #define ACPI_MISALIGNED_TRANSFERS | |
4be44fcd | 155 | #define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */ |
1da177e4 LT |
156 | #define ACPI_MAX_PTR ACPI_UINT16_MAX |
157 | #define ACPI_SIZE_MAX ACPI_UINT16_MAX | |
158 | ||
159 | /* | |
160 | * (16-bit only) internal integers must be 32-bits, so | |
161 | * 64-bit integers cannot be supported | |
162 | */ | |
163 | #define ACPI_NO_INTEGER64_SUPPORT | |
164 | ||
1da177e4 LT |
165 | #elif ACPI_MACHINE_WIDTH == 32 |
166 | ||
167 | /*! [Begin] no source code translation (keep the typedefs) */ | |
168 | ||
169 | /* | |
170 | * 32-bit type definitions (default) | |
171 | */ | |
4be44fcd LB |
172 | typedef unsigned char UINT8; |
173 | typedef unsigned char BOOLEAN; | |
174 | typedef unsigned short UINT16; | |
175 | typedef int INT32; | |
176 | typedef unsigned int UINT32; | |
177 | typedef COMPILER_DEPENDENT_INT64 INT64; | |
178 | typedef COMPILER_DEPENDENT_UINT64 UINT64; | |
1da177e4 LT |
179 | |
180 | /*! [End] no source code translation !*/ | |
181 | ||
4be44fcd LB |
182 | typedef s32 acpi_native_int; |
183 | typedef u32 acpi_native_uint; | |
1da177e4 | 184 | |
4be44fcd LB |
185 | typedef u64 acpi_table_ptr; |
186 | typedef u32 acpi_io_address; | |
187 | typedef u64 acpi_physical_address; | |
188 | typedef u32 acpi_size; | |
1da177e4 LT |
189 | |
190 | #define ALIGNED_ADDRESS_BOUNDARY 0x00000004 | |
191 | #define ACPI_MISALIGNED_TRANSFERS | |
192 | #define ACPI_MAX_PTR ACPI_UINT32_MAX | |
193 | #define ACPI_SIZE_MAX ACPI_UINT32_MAX | |
194 | ||
195 | #else | |
196 | #error unknown ACPI_MACHINE_WIDTH | |
197 | #endif | |
198 | ||
1da177e4 | 199 | /* |
f9f4601f RM |
200 | * This type is used for bitfields in ACPI tables. The only type that is |
201 | * even remotely portable is u8. Anything else is not portable, so | |
202 | * do not add any more bitfield types. | |
1da177e4 | 203 | */ |
4be44fcd LB |
204 | typedef u8 UINT8_BIT; |
205 | typedef acpi_native_uint ACPI_PTRDIFF; | |
1da177e4 LT |
206 | |
207 | /* | |
208 | * Pointer overlays to avoid lots of typecasting for | |
209 | * code that accepts both physical and logical pointers. | |
210 | */ | |
4be44fcd LB |
211 | union acpi_pointers { |
212 | acpi_physical_address physical; | |
213 | void *logical; | |
214 | acpi_table_ptr value; | |
1da177e4 LT |
215 | }; |
216 | ||
4be44fcd LB |
217 | struct acpi_pointer { |
218 | u32 pointer_type; | |
219 | union acpi_pointers pointer; | |
1da177e4 LT |
220 | }; |
221 | ||
222 | /* pointer_types for above */ | |
223 | ||
224 | #define ACPI_PHYSICAL_POINTER 0x01 | |
225 | #define ACPI_LOGICAL_POINTER 0x02 | |
226 | ||
227 | /* Processor mode */ | |
228 | ||
229 | #define ACPI_PHYSICAL_ADDRESSING 0x04 | |
230 | #define ACPI_LOGICAL_ADDRESSING 0x08 | |
231 | #define ACPI_MEMORY_MODE 0x0C | |
232 | ||
233 | #define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER | |
234 | #define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER | |
235 | #define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER | |
236 | ||
f9f4601f RM |
237 | /* |
238 | * If acpi_cache_t was not defined in the OS-dependent header, | |
239 | * define it now. This is typically the case where the local cache | |
240 | * manager implementation is to be used (ACPI_USE_LOCAL_CACHE) | |
241 | */ | |
242 | #ifndef acpi_cache_t | |
243 | #define acpi_cache_t struct acpi_memory_list | |
73459f73 | 244 | #endif |
1da177e4 LT |
245 | |
246 | /* | |
247 | * Useful defines | |
248 | */ | |
249 | #ifdef FALSE | |
250 | #undef FALSE | |
251 | #endif | |
252 | #define FALSE (1 == 0) | |
253 | ||
254 | #ifdef TRUE | |
255 | #undef TRUE | |
256 | #endif | |
257 | #define TRUE (1 == 1) | |
258 | ||
259 | #ifndef NULL | |
260 | #define NULL (void *) 0 | |
261 | #endif | |
262 | ||
1da177e4 LT |
263 | /* |
264 | * Local datatypes | |
265 | */ | |
4be44fcd LB |
266 | typedef u32 acpi_status; /* All ACPI Exceptions */ |
267 | typedef u32 acpi_name; /* 4-byte ACPI name */ | |
268 | typedef char *acpi_string; /* Null terminated ASCII string */ | |
269 | typedef void *acpi_handle; /* Actually a ptr to an Node */ | |
270 | ||
271 | struct uint64_struct { | |
272 | u32 lo; | |
273 | u32 hi; | |
1da177e4 LT |
274 | }; |
275 | ||
4be44fcd LB |
276 | union uint64_overlay { |
277 | u64 full; | |
278 | struct uint64_struct part; | |
1da177e4 LT |
279 | }; |
280 | ||
4be44fcd LB |
281 | struct uint32_struct { |
282 | u32 lo; | |
283 | u32 hi; | |
1da177e4 LT |
284 | }; |
285 | ||
1da177e4 LT |
286 | /* |
287 | * Acpi integer width. In ACPI version 1, integers are | |
288 | * 32 bits. In ACPI version 2, integers are 64 bits. | |
289 | * Note that this pertains to the ACPI integer type only, not | |
290 | * other integers used in the implementation of the ACPI CA | |
291 | * subsystem. | |
292 | */ | |
293 | #ifdef ACPI_NO_INTEGER64_SUPPORT | |
294 | ||
295 | /* 32-bit integers only, no 64-bit support */ | |
296 | ||
4be44fcd | 297 | typedef u32 acpi_integer; |
1da177e4 LT |
298 | #define ACPI_INTEGER_MAX ACPI_UINT32_MAX |
299 | #define ACPI_INTEGER_BIT_SIZE 32 | |
4be44fcd | 300 | #define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */ |
1da177e4 | 301 | |
4be44fcd | 302 | #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */ |
1da177e4 LT |
303 | |
304 | #else | |
305 | ||
306 | /* 64-bit integers */ | |
307 | ||
4be44fcd | 308 | typedef u64 acpi_integer; |
1da177e4 LT |
309 | #define ACPI_INTEGER_MAX ACPI_UINT64_MAX |
310 | #define ACPI_INTEGER_BIT_SIZE 64 | |
4be44fcd | 311 | #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */ |
1da177e4 LT |
312 | |
313 | #if ACPI_MACHINE_WIDTH == 64 | |
4be44fcd | 314 | #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */ |
1da177e4 LT |
315 | #endif |
316 | #endif | |
317 | ||
318 | #define ACPI_MAX64_DECIMAL_DIGITS 20 | |
319 | #define ACPI_MAX32_DECIMAL_DIGITS 10 | |
320 | #define ACPI_MAX16_DECIMAL_DIGITS 5 | |
321 | #define ACPI_MAX8_DECIMAL_DIGITS 3 | |
322 | ||
323 | /* | |
324 | * Constants with special meanings | |
325 | */ | |
326 | #define ACPI_ROOT_OBJECT (acpi_handle) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR) | |
327 | ||
1da177e4 LT |
328 | /* |
329 | * Initialization sequence | |
330 | */ | |
331 | #define ACPI_FULL_INITIALIZATION 0x00 | |
332 | #define ACPI_NO_ADDRESS_SPACE_INIT 0x01 | |
333 | #define ACPI_NO_HARDWARE_INIT 0x02 | |
334 | #define ACPI_NO_EVENT_INIT 0x04 | |
335 | #define ACPI_NO_HANDLER_INIT 0x08 | |
336 | #define ACPI_NO_ACPI_ENABLE 0x10 | |
337 | #define ACPI_NO_DEVICE_INIT 0x20 | |
338 | #define ACPI_NO_OBJECT_INIT 0x40 | |
339 | ||
340 | /* | |
341 | * Initialization state | |
342 | */ | |
343 | #define ACPI_INITIALIZED_OK 0x01 | |
344 | ||
345 | /* | |
346 | * Power state values | |
347 | */ | |
348 | #define ACPI_STATE_UNKNOWN (u8) 0xFF | |
349 | ||
350 | #define ACPI_STATE_S0 (u8) 0 | |
351 | #define ACPI_STATE_S1 (u8) 1 | |
352 | #define ACPI_STATE_S2 (u8) 2 | |
353 | #define ACPI_STATE_S3 (u8) 3 | |
354 | #define ACPI_STATE_S4 (u8) 4 | |
355 | #define ACPI_STATE_S5 (u8) 5 | |
356 | #define ACPI_S_STATES_MAX ACPI_STATE_S5 | |
357 | #define ACPI_S_STATE_COUNT 6 | |
358 | ||
359 | #define ACPI_STATE_D0 (u8) 0 | |
360 | #define ACPI_STATE_D1 (u8) 1 | |
361 | #define ACPI_STATE_D2 (u8) 2 | |
362 | #define ACPI_STATE_D3 (u8) 3 | |
363 | #define ACPI_D_STATES_MAX ACPI_STATE_D3 | |
364 | #define ACPI_D_STATE_COUNT 4 | |
365 | ||
366 | #define ACPI_STATE_C0 (u8) 0 | |
367 | #define ACPI_STATE_C1 (u8) 1 | |
368 | #define ACPI_STATE_C2 (u8) 2 | |
369 | #define ACPI_STATE_C3 (u8) 3 | |
370 | #define ACPI_C_STATES_MAX ACPI_STATE_C3 | |
371 | #define ACPI_C_STATE_COUNT 4 | |
372 | ||
373 | /* | |
374 | * Sleep type invalid value | |
375 | */ | |
376 | #define ACPI_SLEEP_TYPE_MAX 0x7 | |
377 | #define ACPI_SLEEP_TYPE_INVALID 0xFF | |
378 | ||
379 | /* | |
380 | * Standard notify values | |
381 | */ | |
382 | #define ACPI_NOTIFY_BUS_CHECK (u8) 0 | |
383 | #define ACPI_NOTIFY_DEVICE_CHECK (u8) 1 | |
384 | #define ACPI_NOTIFY_DEVICE_WAKE (u8) 2 | |
385 | #define ACPI_NOTIFY_EJECT_REQUEST (u8) 3 | |
386 | #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (u8) 4 | |
387 | #define ACPI_NOTIFY_FREQUENCY_MISMATCH (u8) 5 | |
388 | #define ACPI_NOTIFY_BUS_MODE_MISMATCH (u8) 6 | |
389 | #define ACPI_NOTIFY_POWER_FAULT (u8) 7 | |
390 | ||
391 | /* | |
392 | * Table types. These values are passed to the table related APIs | |
393 | */ | |
4be44fcd | 394 | typedef u32 acpi_table_type; |
1da177e4 LT |
395 | |
396 | #define ACPI_TABLE_RSDP (acpi_table_type) 0 | |
397 | #define ACPI_TABLE_DSDT (acpi_table_type) 1 | |
398 | #define ACPI_TABLE_FADT (acpi_table_type) 2 | |
399 | #define ACPI_TABLE_FACS (acpi_table_type) 3 | |
400 | #define ACPI_TABLE_PSDT (acpi_table_type) 4 | |
401 | #define ACPI_TABLE_SSDT (acpi_table_type) 5 | |
402 | #define ACPI_TABLE_XSDT (acpi_table_type) 6 | |
403 | #define ACPI_TABLE_MAX 6 | |
404 | #define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1) | |
405 | ||
406 | /* | |
407 | * Types associated with ACPI names and objects. The first group of | |
408 | * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition | |
409 | * of the ACPI object_type() operator (See the ACPI Spec). Therefore, | |
410 | * only add to the first group if the spec changes. | |
411 | * | |
412 | * NOTE: Types must be kept in sync with the global acpi_ns_properties | |
413 | * and acpi_ns_type_names arrays. | |
414 | */ | |
4be44fcd | 415 | typedef u32 acpi_object_type; |
1da177e4 LT |
416 | |
417 | #define ACPI_TYPE_ANY 0x00 | |
4be44fcd | 418 | #define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */ |
1da177e4 LT |
419 | #define ACPI_TYPE_STRING 0x02 |
420 | #define ACPI_TYPE_BUFFER 0x03 | |
4be44fcd | 421 | #define ACPI_TYPE_PACKAGE 0x04 /* byte_const, multiple data_term/Constant/super_name */ |
1da177e4 | 422 | #define ACPI_TYPE_FIELD_UNIT 0x05 |
4be44fcd | 423 | #define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */ |
1da177e4 | 424 | #define ACPI_TYPE_EVENT 0x07 |
4be44fcd | 425 | #define ACPI_TYPE_METHOD 0x08 /* Name, byte_const, multiple Code */ |
1da177e4 LT |
426 | #define ACPI_TYPE_MUTEX 0x09 |
427 | #define ACPI_TYPE_REGION 0x0A | |
4be44fcd LB |
428 | #define ACPI_TYPE_POWER 0x0B /* Name,byte_const,word_const,multi Node */ |
429 | #define ACPI_TYPE_PROCESSOR 0x0C /* Name,byte_const,Dword_const,byte_const,multi nm_o */ | |
430 | #define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */ | |
1da177e4 LT |
431 | #define ACPI_TYPE_BUFFER_FIELD 0x0E |
432 | #define ACPI_TYPE_DDB_HANDLE 0x0F | |
433 | #define ACPI_TYPE_DEBUG_OBJECT 0x10 | |
434 | ||
435 | #define ACPI_TYPE_EXTERNAL_MAX 0x10 | |
436 | ||
437 | /* | |
438 | * These are object types that do not map directly to the ACPI | |
439 | * object_type() operator. They are used for various internal purposes only. | |
440 | * If new predefined ACPI_TYPEs are added (via the ACPI specification), these | |
441 | * internal types must move upwards. (There is code that depends on these | |
442 | * values being contiguous with the external types above.) | |
443 | */ | |
444 | #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 | |
445 | #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 | |
446 | #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13 | |
4be44fcd | 447 | #define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, ref_of, Index */ |
1da177e4 LT |
448 | #define ACPI_TYPE_LOCAL_ALIAS 0x15 |
449 | #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16 | |
450 | #define ACPI_TYPE_LOCAL_NOTIFY 0x17 | |
451 | #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18 | |
452 | #define ACPI_TYPE_LOCAL_RESOURCE 0x19 | |
453 | #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A | |
4be44fcd | 454 | #define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple object_list Nodes */ |
1da177e4 | 455 | |
4be44fcd | 456 | #define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */ |
1da177e4 LT |
457 | |
458 | /* | |
459 | * These are special object types that never appear in | |
460 | * a Namespace node, only in an union acpi_operand_object | |
461 | */ | |
462 | #define ACPI_TYPE_LOCAL_EXTRA 0x1C | |
463 | #define ACPI_TYPE_LOCAL_DATA 0x1D | |
464 | ||
465 | #define ACPI_TYPE_LOCAL_MAX 0x1D | |
466 | ||
467 | /* All types above here are invalid */ | |
468 | ||
469 | #define ACPI_TYPE_INVALID 0x1E | |
470 | #define ACPI_TYPE_NOT_FOUND 0xFF | |
471 | ||
1da177e4 LT |
472 | /* |
473 | * Bitmapped ACPI types. Used internally only | |
474 | */ | |
475 | #define ACPI_BTYPE_ANY 0x00000000 | |
476 | #define ACPI_BTYPE_INTEGER 0x00000001 | |
477 | #define ACPI_BTYPE_STRING 0x00000002 | |
478 | #define ACPI_BTYPE_BUFFER 0x00000004 | |
479 | #define ACPI_BTYPE_PACKAGE 0x00000008 | |
480 | #define ACPI_BTYPE_FIELD_UNIT 0x00000010 | |
481 | #define ACPI_BTYPE_DEVICE 0x00000020 | |
482 | #define ACPI_BTYPE_EVENT 0x00000040 | |
483 | #define ACPI_BTYPE_METHOD 0x00000080 | |
484 | #define ACPI_BTYPE_MUTEX 0x00000100 | |
485 | #define ACPI_BTYPE_REGION 0x00000200 | |
486 | #define ACPI_BTYPE_POWER 0x00000400 | |
487 | #define ACPI_BTYPE_PROCESSOR 0x00000800 | |
488 | #define ACPI_BTYPE_THERMAL 0x00001000 | |
489 | #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 | |
490 | #define ACPI_BTYPE_DDB_HANDLE 0x00004000 | |
491 | #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 | |
492 | #define ACPI_BTYPE_REFERENCE 0x00010000 | |
493 | #define ACPI_BTYPE_RESOURCE 0x00020000 | |
494 | ||
495 | #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) | |
496 | ||
497 | #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) | |
498 | #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) | |
499 | #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) | |
4be44fcd | 500 | #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ |
1da177e4 LT |
501 | #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF |
502 | ||
503 | /* | |
504 | * All I/O | |
505 | */ | |
506 | #define ACPI_READ 0 | |
507 | #define ACPI_WRITE 1 | |
508 | #define ACPI_IO_MASK 1 | |
509 | ||
510 | /* | |
511 | * Event Types: Fixed & General Purpose | |
512 | */ | |
4be44fcd | 513 | typedef u32 acpi_event_type; |
1da177e4 LT |
514 | |
515 | /* | |
516 | * Fixed events | |
517 | */ | |
518 | #define ACPI_EVENT_PMTIMER 0 | |
519 | #define ACPI_EVENT_GLOBAL 1 | |
520 | #define ACPI_EVENT_POWER_BUTTON 2 | |
521 | #define ACPI_EVENT_SLEEP_BUTTON 3 | |
522 | #define ACPI_EVENT_RTC 4 | |
523 | #define ACPI_EVENT_MAX 4 | |
524 | #define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1 | |
525 | ||
526 | /* | |
527 | * Event Status - Per event | |
528 | * ------------- | |
529 | * The encoding of acpi_event_status is illustrated below. | |
530 | * Note that a set bit (1) indicates the property is TRUE | |
531 | * (e.g. if bit 0 is set then the event is enabled). | |
532 | * +-------------+-+-+-+ | |
533 | * | Bits 31:3 |2|1|0| | |
534 | * +-------------+-+-+-+ | |
535 | * | | | | | |
536 | * | | | +- Enabled? | |
537 | * | | +--- Enabled for wake? | |
538 | * | +----- Set? | |
539 | * +----------- <Reserved> | |
540 | */ | |
4be44fcd | 541 | typedef u32 acpi_event_status; |
1da177e4 LT |
542 | |
543 | #define ACPI_EVENT_FLAG_DISABLED (acpi_event_status) 0x00 | |
544 | #define ACPI_EVENT_FLAG_ENABLED (acpi_event_status) 0x01 | |
545 | #define ACPI_EVENT_FLAG_WAKE_ENABLED (acpi_event_status) 0x02 | |
546 | #define ACPI_EVENT_FLAG_SET (acpi_event_status) 0x04 | |
547 | ||
548 | /* | |
549 | * General Purpose Events (GPE) | |
550 | */ | |
551 | #define ACPI_GPE_INVALID 0xFF | |
552 | #define ACPI_GPE_MAX 0xFF | |
553 | #define ACPI_NUM_GPE 256 | |
554 | ||
555 | #define ACPI_GPE_ENABLE 0 | |
556 | #define ACPI_GPE_DISABLE 1 | |
557 | ||
1da177e4 LT |
558 | /* |
559 | * GPE info flags - Per GPE | |
560 | * +-+-+-+---+---+-+ | |
561 | * |7|6|5|4:3|2:1|0| | |
562 | * +-+-+-+---+---+-+ | |
563 | * | | | | | | | |
564 | * | | | | | +--- Interrupt type: Edge or Level Triggered | |
565 | * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime | |
566 | * | | | +--- Type of dispatch -- to method, handler, or none | |
567 | * | | +--- Enabled for runtime? | |
568 | * | +--- Enabled for wake? | |
569 | * +--- System state when GPE ocurred (running/waking) | |
570 | */ | |
571 | #define ACPI_GPE_XRUPT_TYPE_MASK (u8) 0x01 | |
572 | #define ACPI_GPE_LEVEL_TRIGGERED (u8) 0x01 | |
573 | #define ACPI_GPE_EDGE_TRIGGERED (u8) 0x00 | |
574 | ||
575 | #define ACPI_GPE_TYPE_MASK (u8) 0x06 | |
576 | #define ACPI_GPE_TYPE_WAKE_RUN (u8) 0x06 | |
577 | #define ACPI_GPE_TYPE_WAKE (u8) 0x02 | |
4be44fcd | 578 | #define ACPI_GPE_TYPE_RUNTIME (u8) 0x04 /* Default */ |
1da177e4 LT |
579 | |
580 | #define ACPI_GPE_DISPATCH_MASK (u8) 0x18 | |
581 | #define ACPI_GPE_DISPATCH_HANDLER (u8) 0x08 | |
582 | #define ACPI_GPE_DISPATCH_METHOD (u8) 0x10 | |
4be44fcd | 583 | #define ACPI_GPE_DISPATCH_NOT_USED (u8) 0x00 /* Default */ |
1da177e4 LT |
584 | |
585 | #define ACPI_GPE_RUN_ENABLE_MASK (u8) 0x20 | |
586 | #define ACPI_GPE_RUN_ENABLED (u8) 0x20 | |
4be44fcd | 587 | #define ACPI_GPE_RUN_DISABLED (u8) 0x00 /* Default */ |
1da177e4 LT |
588 | |
589 | #define ACPI_GPE_WAKE_ENABLE_MASK (u8) 0x40 | |
590 | #define ACPI_GPE_WAKE_ENABLED (u8) 0x40 | |
4be44fcd | 591 | #define ACPI_GPE_WAKE_DISABLED (u8) 0x00 /* Default */ |
1da177e4 | 592 | |
4be44fcd | 593 | #define ACPI_GPE_ENABLE_MASK (u8) 0x60 /* Both run/wake */ |
1da177e4 LT |
594 | |
595 | #define ACPI_GPE_SYSTEM_MASK (u8) 0x80 | |
596 | #define ACPI_GPE_SYSTEM_RUNNING (u8) 0x80 | |
597 | #define ACPI_GPE_SYSTEM_WAKING (u8) 0x00 | |
598 | ||
599 | /* | |
600 | * Flags for GPE and Lock interfaces | |
601 | */ | |
4be44fcd LB |
602 | #define ACPI_EVENT_WAKE_ENABLE 0x2 /* acpi_gpe_enable */ |
603 | #define ACPI_EVENT_WAKE_DISABLE 0x2 /* acpi_gpe_disable */ | |
1da177e4 LT |
604 | |
605 | #define ACPI_NOT_ISR 0x1 | |
606 | #define ACPI_ISR 0x0 | |
607 | ||
1da177e4 LT |
608 | /* Notify types */ |
609 | ||
610 | #define ACPI_SYSTEM_NOTIFY 0x1 | |
611 | #define ACPI_DEVICE_NOTIFY 0x2 | |
612 | #define ACPI_ALL_NOTIFY 0x3 | |
613 | #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3 | |
614 | ||
615 | #define ACPI_MAX_SYS_NOTIFY 0x7f | |
616 | ||
1da177e4 LT |
617 | /* Address Space (Operation Region) Types */ |
618 | ||
4be44fcd | 619 | typedef u8 acpi_adr_space_type; |
1da177e4 LT |
620 | |
621 | #define ACPI_ADR_SPACE_SYSTEM_MEMORY (acpi_adr_space_type) 0 | |
622 | #define ACPI_ADR_SPACE_SYSTEM_IO (acpi_adr_space_type) 1 | |
623 | #define ACPI_ADR_SPACE_PCI_CONFIG (acpi_adr_space_type) 2 | |
624 | #define ACPI_ADR_SPACE_EC (acpi_adr_space_type) 3 | |
625 | #define ACPI_ADR_SPACE_SMBUS (acpi_adr_space_type) 4 | |
626 | #define ACPI_ADR_SPACE_CMOS (acpi_adr_space_type) 5 | |
627 | #define ACPI_ADR_SPACE_PCI_BAR_TARGET (acpi_adr_space_type) 6 | |
628 | #define ACPI_ADR_SPACE_DATA_TABLE (acpi_adr_space_type) 7 | |
629 | #define ACPI_ADR_SPACE_FIXED_HARDWARE (acpi_adr_space_type) 127 | |
630 | ||
1da177e4 LT |
631 | /* |
632 | * bit_register IDs | |
633 | * These are bitfields defined within the full ACPI registers | |
634 | */ | |
635 | #define ACPI_BITREG_TIMER_STATUS 0x00 | |
636 | #define ACPI_BITREG_BUS_MASTER_STATUS 0x01 | |
637 | #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02 | |
638 | #define ACPI_BITREG_POWER_BUTTON_STATUS 0x03 | |
639 | #define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04 | |
640 | #define ACPI_BITREG_RT_CLOCK_STATUS 0x05 | |
641 | #define ACPI_BITREG_WAKE_STATUS 0x06 | |
642 | #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07 | |
643 | ||
644 | #define ACPI_BITREG_TIMER_ENABLE 0x08 | |
645 | #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09 | |
646 | #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A | |
647 | #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B | |
648 | #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C | |
649 | #define ACPI_BITREG_WAKE_ENABLE 0x0D | |
650 | #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E | |
651 | ||
652 | #define ACPI_BITREG_SCI_ENABLE 0x0F | |
653 | #define ACPI_BITREG_BUS_MASTER_RLD 0x10 | |
654 | #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11 | |
655 | #define ACPI_BITREG_SLEEP_TYPE_A 0x12 | |
656 | #define ACPI_BITREG_SLEEP_TYPE_B 0x13 | |
657 | #define ACPI_BITREG_SLEEP_ENABLE 0x14 | |
658 | ||
659 | #define ACPI_BITREG_ARB_DISABLE 0x15 | |
660 | ||
661 | #define ACPI_BITREG_MAX 0x15 | |
662 | #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1 | |
663 | ||
1da177e4 LT |
664 | /* |
665 | * External ACPI object definition | |
666 | */ | |
4be44fcd LB |
667 | union acpi_object { |
668 | acpi_object_type type; /* See definition of acpi_ns_type for values */ | |
669 | struct { | |
670 | acpi_object_type type; | |
671 | acpi_integer value; /* The actual number */ | |
1da177e4 LT |
672 | } integer; |
673 | ||
4be44fcd LB |
674 | struct { |
675 | acpi_object_type type; | |
676 | u32 length; /* # of bytes in string, excluding trailing null */ | |
677 | char *pointer; /* points to the string value */ | |
1da177e4 LT |
678 | } string; |
679 | ||
4be44fcd LB |
680 | struct { |
681 | acpi_object_type type; | |
682 | u32 length; /* # of bytes in buffer */ | |
683 | u8 *pointer; /* points to the buffer */ | |
1da177e4 LT |
684 | } buffer; |
685 | ||
4be44fcd LB |
686 | struct { |
687 | acpi_object_type type; | |
688 | u32 fill1; | |
689 | acpi_handle handle; /* object reference */ | |
1da177e4 LT |
690 | } reference; |
691 | ||
4be44fcd LB |
692 | struct { |
693 | acpi_object_type type; | |
694 | u32 count; /* # of elements in package */ | |
695 | union acpi_object *elements; /* Pointer to an array of ACPI_OBJECTs */ | |
1da177e4 LT |
696 | } package; |
697 | ||
4be44fcd LB |
698 | struct { |
699 | acpi_object_type type; | |
700 | u32 proc_id; | |
701 | acpi_io_address pblk_address; | |
702 | u32 pblk_length; | |
1da177e4 LT |
703 | } processor; |
704 | ||
4be44fcd LB |
705 | struct { |
706 | acpi_object_type type; | |
707 | u32 system_level; | |
708 | u32 resource_order; | |
1da177e4 LT |
709 | } power_resource; |
710 | }; | |
711 | ||
1da177e4 LT |
712 | /* |
713 | * List of objects, used as a parameter list for control method evaluation | |
714 | */ | |
4be44fcd LB |
715 | struct acpi_object_list { |
716 | u32 count; | |
717 | union acpi_object *pointer; | |
1da177e4 LT |
718 | }; |
719 | ||
1da177e4 LT |
720 | /* |
721 | * Miscellaneous common Data Structures used by the interfaces | |
722 | */ | |
723 | #define ACPI_NO_BUFFER 0 | |
724 | #define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) | |
725 | #define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) | |
726 | ||
4be44fcd LB |
727 | struct acpi_buffer { |
728 | acpi_size length; /* Length in bytes of the buffer */ | |
729 | void *pointer; /* pointer to buffer */ | |
1da177e4 LT |
730 | }; |
731 | ||
1da177e4 LT |
732 | /* |
733 | * name_type for acpi_get_name | |
734 | */ | |
735 | #define ACPI_FULL_PATHNAME 0 | |
736 | #define ACPI_SINGLE_NAME 1 | |
737 | #define ACPI_NAME_TYPE_MAX 1 | |
738 | ||
1da177e4 LT |
739 | /* |
740 | * Structure and flags for acpi_get_system_info | |
741 | */ | |
742 | #define ACPI_SYS_MODE_UNKNOWN 0x0000 | |
743 | #define ACPI_SYS_MODE_ACPI 0x0001 | |
744 | #define ACPI_SYS_MODE_LEGACY 0x0002 | |
745 | #define ACPI_SYS_MODES_MASK 0x0003 | |
746 | ||
1da177e4 LT |
747 | /* |
748 | * ACPI Table Info. One per ACPI table _type_ | |
749 | */ | |
4be44fcd LB |
750 | struct acpi_table_info { |
751 | u32 count; | |
1da177e4 LT |
752 | }; |
753 | ||
1da177e4 LT |
754 | /* |
755 | * System info returned by acpi_get_system_info() | |
756 | */ | |
4be44fcd LB |
757 | struct acpi_system_info { |
758 | u32 acpi_ca_version; | |
759 | u32 flags; | |
760 | u32 timer_resolution; | |
761 | u32 reserved1; | |
762 | u32 reserved2; | |
763 | u32 debug_level; | |
764 | u32 debug_layer; | |
765 | u32 num_table_types; | |
766 | struct acpi_table_info table_info[NUM_ACPI_TABLE_TYPES]; | |
1da177e4 LT |
767 | }; |
768 | ||
1da177e4 LT |
769 | /* |
770 | * Types specific to the OS service interfaces | |
771 | */ | |
4be44fcd | 772 | typedef u32(ACPI_SYSTEM_XFACE * acpi_osd_handler) (void *context); |
1da177e4 LT |
773 | |
774 | typedef void | |
4be44fcd | 775 | (ACPI_SYSTEM_XFACE * acpi_osd_exec_callback) (void *context); |
1da177e4 LT |
776 | |
777 | /* | |
778 | * Various handlers and callback procedures | |
779 | */ | |
4be44fcd | 780 | typedef u32(*acpi_event_handler) (void *context); |
1da177e4 LT |
781 | |
782 | typedef | |
4be44fcd | 783 | void (*acpi_notify_handler) (acpi_handle device, u32 value, void *context); |
1da177e4 LT |
784 | |
785 | typedef | |
4be44fcd | 786 | void (*acpi_object_handler) (acpi_handle object, u32 function, void *data); |
1da177e4 | 787 | |
4be44fcd | 788 | typedef acpi_status(*acpi_init_handler) (acpi_handle object, u32 function); |
1da177e4 LT |
789 | |
790 | #define ACPI_INIT_DEVICE_INI 1 | |
791 | ||
792 | typedef | |
4be44fcd LB |
793 | acpi_status(*acpi_exception_handler) (acpi_status aml_status, |
794 | acpi_name name, | |
795 | u16 opcode, | |
796 | u32 aml_offset, void *context); | |
1da177e4 LT |
797 | |
798 | /* Address Spaces (For Operation Regions) */ | |
799 | ||
800 | typedef | |
4be44fcd LB |
801 | acpi_status(*acpi_adr_space_handler) (u32 function, |
802 | acpi_physical_address address, | |
803 | u32 bit_width, | |
804 | acpi_integer * value, | |
805 | void *handler_context, | |
806 | void *region_context); | |
1da177e4 LT |
807 | |
808 | #define ACPI_DEFAULT_HANDLER NULL | |
809 | ||
1da177e4 | 810 | typedef |
4be44fcd LB |
811 | acpi_status(*acpi_adr_space_setup) (acpi_handle region_handle, |
812 | u32 function, | |
813 | void *handler_context, | |
814 | void **region_context); | |
1da177e4 LT |
815 | |
816 | #define ACPI_REGION_ACTIVATE 0 | |
817 | #define ACPI_REGION_DEACTIVATE 1 | |
818 | ||
819 | typedef | |
4be44fcd LB |
820 | acpi_status(*acpi_walk_callback) (acpi_handle obj_handle, |
821 | u32 nesting_level, | |
822 | void *context, void **return_value); | |
1da177e4 LT |
823 | |
824 | /* Interrupt handler return values */ | |
825 | ||
826 | #define ACPI_INTERRUPT_NOT_HANDLED 0x00 | |
827 | #define ACPI_INTERRUPT_HANDLED 0x01 | |
828 | ||
1da177e4 LT |
829 | /* Common string version of device HIDs and UIDs */ |
830 | ||
4be44fcd LB |
831 | struct acpi_device_id { |
832 | char value[ACPI_DEVICE_ID_LENGTH]; | |
1da177e4 LT |
833 | }; |
834 | ||
835 | /* Common string version of device CIDs */ | |
836 | ||
4be44fcd LB |
837 | struct acpi_compatible_id { |
838 | char value[ACPI_MAX_CID_LENGTH]; | |
1da177e4 LT |
839 | }; |
840 | ||
4be44fcd LB |
841 | struct acpi_compatible_id_list { |
842 | u32 count; | |
843 | u32 size; | |
844 | struct acpi_compatible_id id[1]; | |
1da177e4 LT |
845 | }; |
846 | ||
1da177e4 LT |
847 | /* Structure and flags for acpi_get_object_info */ |
848 | ||
849 | #define ACPI_VALID_STA 0x0001 | |
850 | #define ACPI_VALID_ADR 0x0002 | |
851 | #define ACPI_VALID_HID 0x0004 | |
852 | #define ACPI_VALID_UID 0x0008 | |
853 | #define ACPI_VALID_CID 0x0010 | |
854 | #define ACPI_VALID_SXDS 0x0020 | |
855 | ||
1da177e4 LT |
856 | #define ACPI_COMMON_OBJ_INFO \ |
857 | acpi_object_type type; /* ACPI object type */ \ | |
4be44fcd | 858 | acpi_name name /* ACPI object Name */ |
1da177e4 | 859 | |
4be44fcd | 860 | struct acpi_obj_info_header { |
1da177e4 LT |
861 | ACPI_COMMON_OBJ_INFO; |
862 | }; | |
863 | ||
1da177e4 LT |
864 | /* Structure returned from Get Object Info */ |
865 | ||
4be44fcd | 866 | struct acpi_device_info { |
1da177e4 LT |
867 | ACPI_COMMON_OBJ_INFO; |
868 | ||
4be44fcd LB |
869 | u32 valid; /* Indicates which fields below are valid */ |
870 | u32 current_status; /* _STA value */ | |
871 | acpi_integer address; /* _ADR value if any */ | |
872 | struct acpi_device_id hardware_id; /* _HID value if any */ | |
873 | struct acpi_device_id unique_id; /* _UID value if any */ | |
874 | u8 highest_dstates[4]; /* _sx_d values: 0xFF indicates not valid */ | |
875 | struct acpi_compatible_id_list compatibility_id; /* List of _CIDs if any */ | |
1da177e4 LT |
876 | }; |
877 | ||
1da177e4 LT |
878 | /* Context structs for address space handlers */ |
879 | ||
4be44fcd LB |
880 | struct acpi_pci_id { |
881 | u16 segment; | |
882 | u16 bus; | |
883 | u16 device; | |
884 | u16 function; | |
1da177e4 LT |
885 | }; |
886 | ||
4be44fcd LB |
887 | struct acpi_mem_space_context { |
888 | u32 length; | |
889 | acpi_physical_address address; | |
890 | acpi_physical_address mapped_physical_address; | |
891 | u8 *mapped_logical_address; | |
892 | acpi_size mapped_length; | |
1da177e4 LT |
893 | }; |
894 | ||
1da177e4 LT |
895 | /* |
896 | * Definitions for Resource Attributes | |
897 | */ | |
898 | ||
899 | /* | |
900 | * Memory Attributes | |
901 | */ | |
902 | #define ACPI_READ_ONLY_MEMORY (u8) 0x00 | |
903 | #define ACPI_READ_WRITE_MEMORY (u8) 0x01 | |
904 | ||
905 | #define ACPI_NON_CACHEABLE_MEMORY (u8) 0x00 | |
906 | #define ACPI_CACHABLE_MEMORY (u8) 0x01 | |
907 | #define ACPI_WRITE_COMBINING_MEMORY (u8) 0x02 | |
908 | #define ACPI_PREFETCHABLE_MEMORY (u8) 0x03 | |
909 | ||
910 | /* | |
911 | * IO Attributes | |
912 | * The ISA Io ranges are: n000-n0_ffh, n400-n4_ffh, n800-n8_ffh, n_c00-n_cFFh. | |
913 | * The non-ISA Io ranges are: n100-n3_ffh, n500-n7_ffh, n900-n_bFfh, n_cd0-n_fFFh. | |
914 | */ | |
915 | #define ACPI_NON_ISA_ONLY_RANGES (u8) 0x01 | |
916 | #define ACPI_ISA_ONLY_RANGES (u8) 0x02 | |
917 | #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES) | |
918 | ||
919 | #define ACPI_SPARSE_TRANSLATION (u8) 0x03 | |
920 | ||
921 | /* | |
922 | * IO Port Descriptor Decode | |
923 | */ | |
4be44fcd LB |
924 | #define ACPI_DECODE_10 (u8) 0x00 /* 10-bit IO address decode */ |
925 | #define ACPI_DECODE_16 (u8) 0x01 /* 16-bit IO address decode */ | |
1da177e4 LT |
926 | |
927 | /* | |
928 | * IRQ Attributes | |
929 | */ | |
930 | #define ACPI_EDGE_SENSITIVE (u8) 0x00 | |
931 | #define ACPI_LEVEL_SENSITIVE (u8) 0x01 | |
932 | ||
933 | #define ACPI_ACTIVE_HIGH (u8) 0x00 | |
934 | #define ACPI_ACTIVE_LOW (u8) 0x01 | |
935 | ||
936 | #define ACPI_EXCLUSIVE (u8) 0x00 | |
937 | #define ACPI_SHARED (u8) 0x01 | |
938 | ||
939 | /* | |
940 | * DMA Attributes | |
941 | */ | |
942 | #define ACPI_COMPATIBILITY (u8) 0x00 | |
943 | #define ACPI_TYPE_A (u8) 0x01 | |
944 | #define ACPI_TYPE_B (u8) 0x02 | |
945 | #define ACPI_TYPE_F (u8) 0x03 | |
946 | ||
947 | #define ACPI_NOT_BUS_MASTER (u8) 0x00 | |
948 | #define ACPI_BUS_MASTER (u8) 0x01 | |
949 | ||
950 | #define ACPI_TRANSFER_8 (u8) 0x00 | |
951 | #define ACPI_TRANSFER_8_16 (u8) 0x01 | |
952 | #define ACPI_TRANSFER_16 (u8) 0x02 | |
953 | ||
954 | /* | |
955 | * Start Dependent Functions Priority definitions | |
956 | */ | |
957 | #define ACPI_GOOD_CONFIGURATION (u8) 0x00 | |
958 | #define ACPI_ACCEPTABLE_CONFIGURATION (u8) 0x01 | |
959 | #define ACPI_SUB_OPTIMAL_CONFIGURATION (u8) 0x02 | |
960 | ||
961 | /* | |
962 | * 16, 32 and 64-bit Address Descriptor resource types | |
963 | */ | |
964 | #define ACPI_MEMORY_RANGE (u8) 0x00 | |
965 | #define ACPI_IO_RANGE (u8) 0x01 | |
966 | #define ACPI_BUS_NUMBER_RANGE (u8) 0x02 | |
967 | ||
968 | #define ACPI_ADDRESS_NOT_FIXED (u8) 0x00 | |
969 | #define ACPI_ADDRESS_FIXED (u8) 0x01 | |
970 | ||
971 | #define ACPI_POS_DECODE (u8) 0x00 | |
972 | #define ACPI_SUB_DECODE (u8) 0x01 | |
973 | ||
974 | #define ACPI_PRODUCER (u8) 0x00 | |
975 | #define ACPI_CONSUMER (u8) 0x01 | |
976 | ||
1da177e4 LT |
977 | /* |
978 | * Structures used to describe device resources | |
979 | */ | |
4be44fcd LB |
980 | struct acpi_resource_irq { |
981 | u32 edge_level; | |
982 | u32 active_high_low; | |
983 | u32 shared_exclusive; | |
984 | u32 number_of_interrupts; | |
985 | u32 interrupts[1]; | |
1da177e4 LT |
986 | }; |
987 | ||
4be44fcd LB |
988 | struct acpi_resource_dma { |
989 | u32 type; | |
990 | u32 bus_master; | |
991 | u32 transfer; | |
992 | u32 number_of_channels; | |
993 | u32 channels[1]; | |
1da177e4 LT |
994 | }; |
995 | ||
4be44fcd LB |
996 | struct acpi_resource_start_dpf { |
997 | u32 compatibility_priority; | |
998 | u32 performance_robustness; | |
1da177e4 LT |
999 | }; |
1000 | ||
1001 | /* | |
1002 | * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not | |
1003 | * needed because it has no fields | |
1004 | */ | |
1005 | ||
4be44fcd LB |
1006 | struct acpi_resource_io { |
1007 | u32 io_decode; | |
1008 | u32 min_base_address; | |
1009 | u32 max_base_address; | |
1010 | u32 alignment; | |
1011 | u32 range_length; | |
1da177e4 LT |
1012 | }; |
1013 | ||
4be44fcd LB |
1014 | struct acpi_resource_fixed_io { |
1015 | u32 base_address; | |
1016 | u32 range_length; | |
1da177e4 LT |
1017 | }; |
1018 | ||
4be44fcd LB |
1019 | struct acpi_resource_vendor { |
1020 | u32 length; | |
1021 | u8 reserved[1]; | |
1da177e4 LT |
1022 | }; |
1023 | ||
4be44fcd LB |
1024 | struct acpi_resource_end_tag { |
1025 | u8 checksum; | |
1da177e4 LT |
1026 | }; |
1027 | ||
4be44fcd LB |
1028 | struct acpi_resource_mem24 { |
1029 | u32 read_write_attribute; | |
1030 | u32 min_base_address; | |
1031 | u32 max_base_address; | |
1032 | u32 alignment; | |
1033 | u32 range_length; | |
1da177e4 LT |
1034 | }; |
1035 | ||
4be44fcd LB |
1036 | struct acpi_resource_mem32 { |
1037 | u32 read_write_attribute; | |
1038 | u32 min_base_address; | |
1039 | u32 max_base_address; | |
1040 | u32 alignment; | |
1041 | u32 range_length; | |
1da177e4 LT |
1042 | }; |
1043 | ||
4be44fcd LB |
1044 | struct acpi_resource_fixed_mem32 { |
1045 | u32 read_write_attribute; | |
1046 | u32 range_base_address; | |
1047 | u32 range_length; | |
1da177e4 LT |
1048 | }; |
1049 | ||
4be44fcd LB |
1050 | struct acpi_memory_attribute { |
1051 | u16 cache_attribute; | |
1052 | u16 read_write_attribute; | |
1da177e4 LT |
1053 | }; |
1054 | ||
4be44fcd LB |
1055 | struct acpi_io_attribute { |
1056 | u16 range_attribute; | |
1057 | u16 translation_attribute; | |
1da177e4 LT |
1058 | }; |
1059 | ||
4be44fcd LB |
1060 | struct acpi_bus_attribute { |
1061 | u16 reserved1; | |
1062 | u16 reserved2; | |
1da177e4 LT |
1063 | }; |
1064 | ||
4be44fcd LB |
1065 | union acpi_resource_attribute { |
1066 | struct acpi_memory_attribute memory; | |
1067 | struct acpi_io_attribute io; | |
1068 | struct acpi_bus_attribute bus; | |
1da177e4 LT |
1069 | }; |
1070 | ||
4be44fcd LB |
1071 | struct acpi_resource_source { |
1072 | u32 index; | |
1073 | u32 string_length; | |
1074 | char *string_ptr; | |
1da177e4 LT |
1075 | }; |
1076 | ||
aff8c277 RM |
1077 | /* Fields common to all address descriptors, 16/32/64 bit */ |
1078 | ||
1079 | #define ACPI_RESOURCE_ADDRESS_COMMON \ | |
1080 | u32 resource_type; \ | |
1081 | u32 producer_consumer; \ | |
1082 | u32 decode; \ | |
1083 | u32 min_address_fixed; \ | |
1084 | u32 max_address_fixed; \ | |
1085 | union acpi_resource_attribute attribute; | |
1086 | ||
1087 | struct acpi_resource_address { | |
1088 | ACPI_RESOURCE_ADDRESS_COMMON}; | |
1089 | ||
4be44fcd | 1090 | struct acpi_resource_address16 { |
aff8c277 | 1091 | ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; |
4be44fcd LB |
1092 | u32 min_address_range; |
1093 | u32 max_address_range; | |
1094 | u32 address_translation_offset; | |
1095 | u32 address_length; | |
1096 | struct acpi_resource_source resource_source; | |
1da177e4 LT |
1097 | }; |
1098 | ||
4be44fcd | 1099 | struct acpi_resource_address32 { |
aff8c277 | 1100 | ACPI_RESOURCE_ADDRESS_COMMON u32 granularity; |
4be44fcd LB |
1101 | u32 min_address_range; |
1102 | u32 max_address_range; | |
1103 | u32 address_translation_offset; | |
1104 | u32 address_length; | |
1105 | struct acpi_resource_source resource_source; | |
1da177e4 LT |
1106 | }; |
1107 | ||
4be44fcd | 1108 | struct acpi_resource_address64 { |
aff8c277 | 1109 | ACPI_RESOURCE_ADDRESS_COMMON u64 granularity; |
4be44fcd LB |
1110 | u64 min_address_range; |
1111 | u64 max_address_range; | |
1112 | u64 address_translation_offset; | |
1113 | u64 address_length; | |
1114 | u64 type_specific_attributes; | |
1115 | struct acpi_resource_source resource_source; | |
1da177e4 LT |
1116 | }; |
1117 | ||
4be44fcd LB |
1118 | struct acpi_resource_ext_irq { |
1119 | u32 producer_consumer; | |
1120 | u32 edge_level; | |
1121 | u32 active_high_low; | |
1122 | u32 shared_exclusive; | |
1123 | u32 number_of_interrupts; | |
1124 | struct acpi_resource_source resource_source; | |
1125 | u32 interrupts[1]; | |
1da177e4 LT |
1126 | }; |
1127 | ||
bda663d3 RM |
1128 | struct acpi_resource_generic_reg { |
1129 | u32 space_id; | |
1130 | u32 bit_width; | |
1131 | u32 bit_offset; | |
1132 | u32 address_size; | |
1133 | u64 address; | |
1134 | }; | |
1135 | ||
1da177e4 LT |
1136 | /* ACPI_RESOURCE_TYPEs */ |
1137 | ||
1138 | #define ACPI_RSTYPE_IRQ 0 | |
1139 | #define ACPI_RSTYPE_DMA 1 | |
1140 | #define ACPI_RSTYPE_START_DPF 2 | |
1141 | #define ACPI_RSTYPE_END_DPF 3 | |
1142 | #define ACPI_RSTYPE_IO 4 | |
1143 | #define ACPI_RSTYPE_FIXED_IO 5 | |
1144 | #define ACPI_RSTYPE_VENDOR 6 | |
1145 | #define ACPI_RSTYPE_END_TAG 7 | |
1146 | #define ACPI_RSTYPE_MEM24 8 | |
1147 | #define ACPI_RSTYPE_MEM32 9 | |
1148 | #define ACPI_RSTYPE_FIXED_MEM32 10 | |
1149 | #define ACPI_RSTYPE_ADDRESS16 11 | |
1150 | #define ACPI_RSTYPE_ADDRESS32 12 | |
1151 | #define ACPI_RSTYPE_ADDRESS64 13 | |
1152 | #define ACPI_RSTYPE_EXT_IRQ 14 | |
bda663d3 RM |
1153 | #define ACPI_RSTYPE_GENERIC_REG 15 |
1154 | #define ACPI_RSTYPE_MAX 15 | |
1da177e4 | 1155 | |
4be44fcd LB |
1156 | typedef u32 acpi_resource_type; |
1157 | ||
1158 | union acpi_resource_data { | |
1159 | struct acpi_resource_irq irq; | |
1160 | struct acpi_resource_dma dma; | |
1161 | struct acpi_resource_start_dpf start_dpf; | |
1162 | struct acpi_resource_io io; | |
1163 | struct acpi_resource_fixed_io fixed_io; | |
1164 | struct acpi_resource_vendor vendor_specific; | |
1165 | struct acpi_resource_end_tag end_tag; | |
1166 | struct acpi_resource_mem24 memory24; | |
1167 | struct acpi_resource_mem32 memory32; | |
1168 | struct acpi_resource_fixed_mem32 fixed_memory32; | |
aff8c277 | 1169 | struct acpi_resource_address address; /* Common 16/32/64 address fields */ |
4be44fcd LB |
1170 | struct acpi_resource_address16 address16; |
1171 | struct acpi_resource_address32 address32; | |
1172 | struct acpi_resource_address64 address64; | |
1173 | struct acpi_resource_ext_irq extended_irq; | |
bda663d3 | 1174 | struct acpi_resource_generic_reg generic_reg; |
1da177e4 LT |
1175 | }; |
1176 | ||
4be44fcd | 1177 | struct acpi_resource { |
bda663d3 | 1178 | acpi_resource_type type; |
4be44fcd LB |
1179 | u32 length; |
1180 | union acpi_resource_data data; | |
1da177e4 LT |
1181 | }; |
1182 | ||
1183 | #define ACPI_RESOURCE_LENGTH 12 | |
4be44fcd | 1184 | #define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */ |
1da177e4 LT |
1185 | |
1186 | #define ACPI_SIZEOF_RESOURCE(type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (type)) | |
1187 | ||
1188 | #define ACPI_NEXT_RESOURCE(res) (struct acpi_resource *)((u8 *) res + res->length) | |
1189 | ||
1190 | #ifdef ACPI_MISALIGNED_TRANSFERS | |
1191 | #define ACPI_ALIGN_RESOURCE_SIZE(length) (length) | |
1192 | #else | |
1193 | #define ACPI_ALIGN_RESOURCE_SIZE(length) ACPI_ROUND_UP_TO_NATIVE_WORD(length) | |
1194 | #endif | |
1195 | ||
1196 | /* | |
1197 | * END: of definitions for Resource Attributes | |
1198 | */ | |
1199 | ||
4be44fcd LB |
1200 | struct acpi_pci_routing_table { |
1201 | u32 length; | |
1202 | u32 pin; | |
1203 | acpi_integer address; /* here for 64-bit alignment */ | |
1204 | u32 source_index; | |
1205 | char source[4]; /* pad to 64 bits so sizeof() works in all cases */ | |
1da177e4 LT |
1206 | }; |
1207 | ||
1208 | /* | |
1209 | * END: of definitions for PCI Routing tables | |
1210 | */ | |
1211 | ||
4be44fcd | 1212 | #endif /* __ACTYPES_H__ */ |