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