The real, definitive, Visual C++ support branch. Accept no substitutes
[reactos.git] / drivers / bus / acpi / include / actypes.h
1 /******************************************************************************
2 *
3 * Name: actypes.h - Common data types for the entire ACPI subsystem
4 * $Revision: 1.5 $
5 *
6 *****************************************************************************/
7
8 /*
9 * Copyright (C) 2000, 2001 R. Byron Moore
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26 #ifndef __ACTYPES_H__
27 #define __ACTYPES_H__
28
29 /*! [Begin] no source code translation (keep the typedefs) */
30
31 /*
32 * Data types - Fixed across all compilation models
33 *
34 * BOOLEAN Logical Boolean.
35 * 1 byte value containing a 0 for FALSE or a 1 for TRUE.
36 * Other values are undefined.
37 *
38 * INT8 8-bit (1 byte) signed value
39 * UINT8 8-bit (1 byte) unsigned value
40 * INT16 16-bit (2 byte) signed value
41 * UINT16 16-bit (2 byte) unsigned value
42 * INT32 32-bit (4 byte) signed value
43 * UINT32 32-bit (4 byte) unsigned value
44 * INT64 64-bit (8 byte) signed value
45 * UINT64 64-bit (8 byte) unsigned value
46 * NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
47 * NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
48 * UCHAR Character. 1 byte unsigned value.
49 */
50
51
52 #ifdef _IA64
53 /*
54 * 64-bit type definitions
55 */
56 typedef unsigned char UINT8;
57 typedef unsigned char BOOLEAN;
58 typedef unsigned char UCHAR;
59 typedef unsigned short UINT16;
60 typedef int INT32;
61 typedef unsigned int UINT32;
62 typedef COMPILER_DEPENDENT_UINT64 UINT64;
63
64 typedef UINT64 NATIVE_UINT;
65 typedef INT64 NATIVE_INT;
66
67 typedef NATIVE_UINT ACPI_TBLPTR;
68 typedef UINT64 ACPI_IO_ADDRESS;
69 typedef UINT64 ACPI_PHYSICAL_ADDRESS;
70
71 #define ALIGNED_ADDRESS_BOUNDARY 0x00000008
72
73 /* (No hardware alignment support in IA64) */
74
75
76 #elif _IA16
77 /*
78 * 16-bit type definitions
79 */
80 typedef unsigned char UINT8;
81 typedef unsigned char BOOLEAN;
82 typedef unsigned char UCHAR;
83 typedef unsigned int UINT16;
84 typedef long INT32;
85 typedef int INT16;
86 typedef unsigned long UINT32;
87
88 typedef struct
89 {
90 UINT32 Lo;
91 UINT32 Hi;
92
93 } UINT64;
94
95 typedef UINT16 NATIVE_UINT;
96 typedef INT16 NATIVE_INT;
97
98 typedef UINT32 ACPI_TBLPTR;
99 typedef UINT32 ACPI_IO_ADDRESS;
100 typedef char *ACPI_PHYSICAL_ADDRESS;
101
102 #define ALIGNED_ADDRESS_BOUNDARY 0x00000002
103 #define _HW_ALIGNMENT_SUPPORT
104
105 /*
106 * (16-bit only) internal integers must be 32-bits, so
107 * 64-bit integers cannot be supported
108 */
109 #define ACPI_NO_INTEGER64_SUPPORT
110
111
112 #else
113 /*
114 * 32-bit type definitions (default)
115 */
116 //typedef unsigned char UINT8;
117 //typedef unsigned char BOOLEAN;
118 //typedef unsigned char UCHAR;
119 //typedef unsigned short UINT16;
120 //typedef int INT32;
121 //typedef unsigned int UINT32;
122 //typedef COMPILER_DEPENDENT_UINT64 UINT64;
123
124 typedef UINT32 NATIVE_UINT;
125 typedef INT32 NATIVE_INT;
126
127 typedef NATIVE_UINT ACPI_TBLPTR;
128 typedef UINT32 ACPI_IO_ADDRESS;
129 typedef UINT64 ACPI_PHYSICAL_ADDRESS;
130
131 #define ALIGNED_ADDRESS_BOUNDARY 0x00000004
132 #define _HW_ALIGNMENT_SUPPORT
133 #endif
134
135
136
137 /*
138 * Miscellaneous common types
139 */
140
141 typedef UINT32 UINT32_BIT;
142 typedef NATIVE_UINT ACPI_PTRDIFF;
143 typedef char NATIVE_CHAR;
144
145
146 /*
147 * Data type ranges
148 */
149
150 #define ACPI_UINT8_MAX (UINT8) 0xFF
151 #define ACPI_UINT16_MAX (UINT16) 0xFFFF
152 #define ACPI_UINT32_MAX (UINT32) 0xFFFFFFFF
153 #ifdef __GNUC__
154 #define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFFULL
155 #else
156 #define ACPI_UINT64_MAX (UINT64) 0xFFFFFFFFFFFFFFFF
157 #endif
158
159 #ifdef DEFINE_ALTERNATE_TYPES
160 /*
161 * Types used only in translated source
162 */
163 typedef INT32 s32;
164 typedef UINT8 u8;
165 typedef UINT16 u16;
166 typedef UINT32 u32;
167 typedef UINT64 u64;
168 #endif
169 /*! [End] no source code translation !*/
170
171
172 /*
173 * Useful defines
174 */
175
176 #ifdef FALSE
177 #undef FALSE
178 #endif
179 #define FALSE (1 == 0)
180
181 #ifdef TRUE
182 #undef TRUE
183 #endif
184 #define TRUE (1 == 1)
185
186 #ifndef NULL
187 #define NULL (void *) 0
188 #endif
189
190
191 /*
192 * Local datatypes
193 */
194 #ifdef _MSC_VER
195 typedef ULONGLONG u64;
196 typedef ULONG u32;
197 typedef USHORT u16;
198 typedef UCHAR u8;
199 typedef LONGLONG s64;
200 typedef LONG s32;
201 typedef SHORT s16;
202 typedef CHAR s8;
203 #endif
204
205 typedef u32 ACPI_STATUS; /* All ACPI Exceptions */
206 typedef u32 ACPI_NAME; /* 4-s8 ACPI name */
207 typedef char* ACPI_STRING; /* Null terminated ASCII string */
208 typedef void* ACPI_HANDLE; /* Actually a ptr to an Node */
209
210
211 /*
212 * Acpi integer width. In ACPI version 1, integers are
213 * 32 bits. In ACPI version 2, integers are 64 bits.
214 * Note that this pertains to the ACPI integer type only, not
215 * other integers used in the implementation of the ACPI CA
216 * subsystem.
217 */
218 #ifdef ACPI_NO_INTEGER64_SUPPORT
219
220 /* 32-bit integers only, no 64-bit support */
221
222 typedef u32 ACPI_INTEGER;
223 #define ACPI_INTEGER_MAX ACPI_UINT32_MAX
224 #define ACPI_INTEGER_BIT_SIZE 32
225 #define ACPI_MAX_BCD_VALUE 99999999
226 #define ACPI_MAX_BCD_DIGITS 8
227
228 #else
229
230 /* 64-bit integers */
231
232 typedef UINT64 ACPI_INTEGER;
233 #define ACPI_INTEGER_MAX ACPI_UINT64_MAX
234 #define ACPI_INTEGER_BIT_SIZE 64
235 #ifdef __GNUC__
236 #define ACPI_MAX_BCD_VALUE 9999999999999999ULL
237 #else
238 #define ACPI_MAX_BCD_VALUE 9999999999999999
239 #endif
240 #define ACPI_MAX_BCD_DIGITS 16
241
242 #endif
243
244
245 /*
246 * Constants with special meanings
247 */
248
249 #define ACPI_ROOT_OBJECT (ACPI_HANDLE)(-1)
250
251 #define ACPI_FULL_INITIALIZATION 0x00
252 #define ACPI_NO_ADDRESS_SPACE_INIT 0x01
253 #define ACPI_NO_HARDWARE_INIT 0x02
254 #define ACPI_NO_EVENT_INIT 0x04
255 #define ACPI_NO_ACPI_ENABLE 0x08
256 #define ACPI_NO_DEVICE_INIT 0x10
257 #define ACPI_NO_OBJECT_INIT 0x20
258
259
260 /*
261 * System states
262 */
263 #define ACPI_STATE_S0 (u8) 0
264 #define ACPI_STATE_S1 (u8) 1
265 #define ACPI_STATE_S2 (u8) 2
266 #define ACPI_STATE_S3 (u8) 3
267 #define ACPI_STATE_S4 (u8) 4
268 #define ACPI_STATE_S5 (u8) 5
269 /* let's pretend S4_bIOS didn't exist for now. ASG */
270 #define ACPI_STATE_S4_bIOS (u8) 6
271 #define ACPI_S_STATES_MAX ACPI_STATE_S5
272 #define ACPI_S_STATE_COUNT 6
273
274 /*
275 * Device power states
276 */
277 #define ACPI_STATE_D0 (u8) 0
278 #define ACPI_STATE_D1 (u8) 1
279 #define ACPI_STATE_D2 (u8) 2
280 #define ACPI_STATE_D3 (u8) 3
281 #define ACPI_D_STATES_MAX ACPI_STATE_D3
282 #define ACPI_D_STATE_COUNT 4
283
284 #define ACPI_STATE_UNKNOWN (u8) 0xFF
285
286
287 /*
288 * Table types. These values are passed to the table related APIs
289 */
290
291 typedef u32 ACPI_TABLE_TYPE;
292
293 #define ACPI_TABLE_RSDP (ACPI_TABLE_TYPE) 0
294 #define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 1
295 #define ACPI_TABLE_FADT (ACPI_TABLE_TYPE) 2
296 #define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 3
297 #define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 4
298 #define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5
299 #define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6
300 #define ACPI_TABLE_MAX 6
301 #define NUM_ACPI_TABLES (ACPI_TABLE_MAX+1)
302
303
304 /*
305 * Types associated with names. The first group of
306 * values correspond to the definition of the ACPI
307 * Object_type operator (See the ACPI Spec). Therefore,
308 * only add to the first group if the spec changes!
309 *
310 * Types must be kept in sync with the Acpi_ns_properties
311 * and Acpi_ns_type_names arrays
312 */
313
314 typedef u32 ACPI_OBJECT_TYPE;
315 typedef u8 OBJECT_TYPE_INTERNAL;
316
317 #define ACPI_BTYPE_ANY 0x00000000
318 #define ACPI_BTYPE_INTEGER 0x00000001
319 #define ACPI_BTYPE_STRING 0x00000002
320 #define ACPI_BTYPE_BUFFER 0x00000004
321 #define ACPI_BTYPE_PACKAGE 0x00000008
322 #define ACPI_BTYPE_FIELD_UNIT 0x00000010
323 #define ACPI_BTYPE_DEVICE 0x00000020
324 #define ACPI_BTYPE_EVENT 0x00000040
325 #define ACPI_BTYPE_METHOD 0x00000080
326 #define ACPI_BTYPE_MUTEX 0x00000100
327 #define ACPI_BTYPE_REGION 0x00000200
328 #define ACPI_BTYPE_POWER 0x00000400
329 #define ACPI_BTYPE_PROCESSOR 0x00000800
330 #define ACPI_BTYPE_THERMAL 0x00001000
331 #define ACPI_BTYPE_BUFFER_FIELD 0x00002000
332 #define ACPI_BTYPE_DDB_HANDLE 0x00004000
333 #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
334 #define ACPI_BTYPE_REFERENCE 0x00010000
335 #define ACPI_BTYPE_RESOURCE 0x00020000
336
337 #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
338
339 #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
340 #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
341 #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
342 #define ACPI_BTYPE_OBJECTS_AND_REFS 0x00017FFF /* ARG or LOCAL */
343 #define ACPI_BTYPE_ALL_OBJECTS 0x00007FFF
344
345
346 #define ACPI_TYPE_ANY 0 /* 0x00 */
347 #define ACPI_TYPE_INTEGER 1 /* 0x01 Byte/Word/Dword/Zero/One/Ones */
348 #define ACPI_TYPE_STRING 2 /* 0x02 */
349 #define ACPI_TYPE_BUFFER 3 /* 0x03 */
350 #define ACPI_TYPE_PACKAGE 4 /* 0x04 Byte_const, multiple Data_term/Constant/Super_name */
351 #define ACPI_TYPE_FIELD_UNIT 5 /* 0x05 */
352 #define ACPI_TYPE_DEVICE 6 /* 0x06 Name, multiple Node */
353 #define ACPI_TYPE_EVENT 7 /* 0x07 */
354 #define ACPI_TYPE_METHOD 8 /* 0x08 Name, Byte_const, multiple Code */
355 #define ACPI_TYPE_MUTEX 9 /* 0x09 */
356 #define ACPI_TYPE_REGION 10 /* 0x0A */
357 #define ACPI_TYPE_POWER 11 /* 0x0B Name,Byte_const,Word_const,multi Node */
358 #define ACPI_TYPE_PROCESSOR 12 /* 0x0C Name,Byte_const,DWord_const,Byte_const,multi Nm_o */
359 #define ACPI_TYPE_THERMAL 13 /* 0x0D Name, multiple Node */
360 #define ACPI_TYPE_BUFFER_FIELD 14 /* 0x0E */
361 #define ACPI_TYPE_DDB_HANDLE 15 /* 0x0F */
362 #define ACPI_TYPE_DEBUG_OBJECT 16 /* 0x10 */
363
364 #define ACPI_TYPE_MAX 16
365
366 /*
367 * This section contains object types that do not relate to the ACPI Object_type operator.
368 * They are used for various internal purposes only. If new predefined ACPI_TYPEs are
369 * added (via the ACPI specification), these internal types must move upwards.
370 * Also, values exceeding the largest official ACPI Object_type must not overlap with
371 * defined AML opcodes.
372 */
373 #define INTERNAL_TYPE_BEGIN 17
374
375 #define INTERNAL_TYPE_DEF_FIELD 17 /* 0x11 */
376 #define INTERNAL_TYPE_BANK_FIELD 18 /* 0x12 */
377 #define INTERNAL_TYPE_INDEX_FIELD 19 /* 0x13 */
378 #define INTERNAL_TYPE_REFERENCE 20 /* 0x14 Arg#, Local#, Name, Debug; used only in descriptors */
379 #define INTERNAL_TYPE_ALIAS 21 /* 0x15 */
380 #define INTERNAL_TYPE_NOTIFY 22 /* 0x16 */
381 #define INTERNAL_TYPE_ADDRESS_HANDLER 23 /* 0x17 */
382 #define INTERNAL_TYPE_RESOURCE 24 /* 0x18 */
383
384
385 #define INTERNAL_TYPE_NODE_MAX 24
386
387 /* These are pseudo-types because there are never any namespace nodes with these types */
388
389 #define INTERNAL_TYPE_DEF_FIELD_DEFN 25 /* 0x19 Name, Byte_const, multiple Field_element */
390 #define INTERNAL_TYPE_BANK_FIELD_DEFN 26 /* 0x1A 2 Name,DWord_const,Byte_const,multi Field_element */
391 #define INTERNAL_TYPE_INDEX_FIELD_DEFN 27 /* 0x1B 2 Name, Byte_const, multiple Field_element */
392 #define INTERNAL_TYPE_IF 28 /* 0x1C */
393 #define INTERNAL_TYPE_ELSE 29 /* 0x1D */
394 #define INTERNAL_TYPE_WHILE 30 /* 0x1E */
395 #define INTERNAL_TYPE_SCOPE 31 /* 0x1F Name, multiple Node */
396 #define INTERNAL_TYPE_DEF_ANY 32 /* 0x20 type is Any, suppress search of enclosing scopes */
397 #define INTERNAL_TYPE_EXTRA 33 /* 0x21 */
398
399 #define INTERNAL_TYPE_MAX 33
400
401 #define INTERNAL_TYPE_INVALID 34
402 #define ACPI_TYPE_NOT_FOUND 0xFF
403
404 /*
405 * Acpi_event Types:
406 * ------------
407 * Fixed & general purpose...
408 */
409
410 typedef u32 ACPI_EVENT_TYPE;
411
412 #define ACPI_EVENT_FIXED (ACPI_EVENT_TYPE) 0
413 #define ACPI_EVENT_GPE (ACPI_EVENT_TYPE) 1
414
415 /*
416 * Fixed events
417 */
418
419 #define ACPI_EVENT_PMTIMER (ACPI_EVENT_TYPE) 0
420 /*
421 * There's no bus master event so index 1 is used for IRQ's that are not
422 * handled by the SCI handler
423 */
424 #define ACPI_EVENT_NOT_USED (ACPI_EVENT_TYPE) 1
425 #define ACPI_EVENT_GLOBAL (ACPI_EVENT_TYPE) 2
426 #define ACPI_EVENT_POWER_BUTTON (ACPI_EVENT_TYPE) 3
427 #define ACPI_EVENT_SLEEP_BUTTON (ACPI_EVENT_TYPE) 4
428 #define ACPI_EVENT_RTC (ACPI_EVENT_TYPE) 5
429 #define ACPI_EVENT_GENERAL (ACPI_EVENT_TYPE) 6
430 #define ACPI_EVENT_MAX 6
431 #define NUM_FIXED_EVENTS (ACPI_EVENT_TYPE) 7
432
433 #define ACPI_GPE_INVALID 0xFF
434 #define ACPI_GPE_MAX 0xFF
435 #define NUM_GPE 256
436
437 #define ACPI_EVENT_LEVEL_TRIGGERED (ACPI_EVENT_TYPE) 1
438 #define ACPI_EVENT_EDGE_TRIGGERED (ACPI_EVENT_TYPE) 2
439
440 /*
441 * Acpi_event Status:
442 * -------------
443 * The encoding of ACPI_EVENT_STATUS is illustrated below.
444 * Note that a set bit (1) indicates the property is TRUE
445 * (e.g. if bit 0 is set then the event is enabled).
446 * +---------------+-+-+
447 * | Bits 31:2 |1|0|
448 * +---------------+-+-+
449 * | | |
450 * | | +- Enabled?
451 * | +--- Set?
452 * +----------- <Reserved>
453 */
454 typedef u32 ACPI_EVENT_STATUS;
455
456 #define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00
457 #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01
458 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x02
459
460
461 /* Notify types */
462
463 #define ACPI_SYSTEM_NOTIFY 0
464 #define ACPI_DEVICE_NOTIFY 1
465 #define ACPI_MAX_NOTIFY_HANDLER_TYPE 1
466
467 #define MAX_SYS_NOTIFY 0x7f
468
469
470 /* Address Space (Operation Region) Types */
471
472 typedef u8 ACPI_ADDRESS_SPACE_TYPE;
473
474 #define ADDRESS_SPACE_SYSTEM_MEMORY (ACPI_ADDRESS_SPACE_TYPE) 0
475 #define ADDRESS_SPACE_SYSTEM_IO (ACPI_ADDRESS_SPACE_TYPE) 1
476 #define ADDRESS_SPACE_PCI_CONFIG (ACPI_ADDRESS_SPACE_TYPE) 2
477 #define ADDRESS_SPACE_EC (ACPI_ADDRESS_SPACE_TYPE) 3
478 #define ADDRESS_SPACE_SMBUS (ACPI_ADDRESS_SPACE_TYPE) 4
479 #define ADDRESS_SPACE_CMOS (ACPI_ADDRESS_SPACE_TYPE) 5
480 #define ADDRESS_SPACE_PCI_BAR_TARGET (ACPI_ADDRESS_SPACE_TYPE) 6
481
482
483 /*
484 * External ACPI object definition
485 */
486
487 typedef union acpi_obj
488 {
489 ACPI_OBJECT_TYPE type; /* See definition of Acpi_ns_type for values */
490 struct
491 {
492 ACPI_OBJECT_TYPE type;
493 ACPI_INTEGER value; /* The actual number */
494 } integer;
495
496 struct
497 {
498 ACPI_OBJECT_TYPE type;
499 u32 length; /* # of bytes in string, excluding trailing null */
500 NATIVE_CHAR *pointer; /* points to the string value */
501 } string;
502
503 struct
504 {
505 ACPI_OBJECT_TYPE type;
506 u32 length; /* # of bytes in buffer */
507 u8 *pointer; /* points to the buffer */
508 } buffer;
509
510 struct
511 {
512 ACPI_OBJECT_TYPE type;
513 u32 fill1;
514 ACPI_HANDLE handle; /* object reference */
515 } reference;
516
517 struct
518 {
519 ACPI_OBJECT_TYPE type;
520 u32 count; /* # of elements in package */
521 union acpi_obj *elements; /* Pointer to an array of ACPI_OBJECTs */
522 } package;
523
524 struct
525 {
526 ACPI_OBJECT_TYPE type;
527 u32 proc_id;
528 ACPI_IO_ADDRESS pblk_address;
529 u32 pblk_length;
530 } processor;
531
532 struct
533 {
534 ACPI_OBJECT_TYPE type;
535 u32 system_level;
536 u32 resource_order;
537 } power_resource;
538
539 } ACPI_OBJECT, *PACPI_OBJECT;
540
541
542 /*
543 * List of objects, used as a parameter list for control method evaluation
544 */
545
546 typedef struct acpi_obj_list
547 {
548 u32 count;
549 ACPI_OBJECT *pointer;
550
551 } ACPI_OBJECT_LIST, *PACPI_OBJECT_LIST;
552
553
554 /*
555 * Miscellaneous common Data Structures used by the interfaces
556 */
557
558 typedef struct
559 {
560 u32 length; /* Length in bytes of the buffer */
561 void *pointer; /* pointer to buffer */
562
563 } ACPI_BUFFER;
564
565
566 /*
567 * Name_type for Acpi_get_name
568 */
569
570 #define ACPI_FULL_PATHNAME 0
571 #define ACPI_SINGLE_NAME 1
572 #define ACPI_NAME_TYPE_MAX 1
573
574
575 /*
576 * Structure and flags for Acpi_get_system_info
577 */
578
579 #define SYS_MODE_UNKNOWN 0x0000
580 #define SYS_MODE_ACPI 0x0001
581 #define SYS_MODE_LEGACY 0x0002
582 #define SYS_MODES_MASK 0x0003
583
584 /*
585 * ACPI CPU Cx state handler
586 */
587 typedef
588 ACPI_STATUS (*ACPI_SET_C_STATE_HANDLER) (
589 NATIVE_UINT pblk_address);
590
591 /*
592 * ACPI Cx State info
593 */
594 typedef struct
595 {
596 u32 state_number;
597 u32 latency;
598 } ACPI_CX_STATE;
599
600 /*
601 * ACPI CPU throttling info
602 */
603 typedef struct
604 {
605 u32 state_number;
606 u32 percent_of_clock;
607 } ACPI_CPU_THROTTLING_STATE;
608
609 /*
610 * ACPI Table Info. One per ACPI table _type_
611 */
612 typedef struct acpi_table_info
613 {
614 u32 count;
615
616 } ACPI_TABLE_INFO;
617
618
619 /*
620 * System info returned by Acpi_get_system_info()
621 */
622
623 typedef struct _acpi_sys_info
624 {
625 u32 acpi_ca_version;
626 u32 flags;
627 u32 timer_resolution;
628 u32 reserved1;
629 u32 reserved2;
630 u32 debug_level;
631 u32 debug_layer;
632 u32 num_table_types;
633 ACPI_TABLE_INFO table_info [NUM_ACPI_TABLES];
634
635 } ACPI_SYSTEM_INFO;
636
637
638 /*
639 * System Initiailization data. This data is passed to ACPIInitialize
640 * copyied to global data and retained by ACPI CA
641 */
642
643 typedef struct _acpi_init_data
644 {
645 void *RSDP_physical_address; /* Address of RSDP, needed it it is */
646 /* not found in the IA32 manner */
647 } ACPI_INIT_DATA;
648
649 /*
650 * Various handlers and callback procedures
651 */
652
653 typedef
654 u32 (*FIXED_EVENT_HANDLER) (
655 void *context);
656
657 typedef
658 void (*GPE_HANDLER) (
659 void *context);
660
661 typedef
662 void (*NOTIFY_HANDLER) (
663 ACPI_HANDLE device,
664 u32 value,
665 void *context);
666
667 #define ADDRESS_SPACE_READ 1
668 #define ADDRESS_SPACE_WRITE 2
669
670 typedef
671 ACPI_STATUS (*ADDRESS_SPACE_HANDLER) (
672 u32 function,
673 ACPI_PHYSICAL_ADDRESS address,
674 u32 bit_width,
675 u32 *value,
676 void *handler_context,
677 void *region_context);
678
679 #define ACPI_DEFAULT_HANDLER ((ADDRESS_SPACE_HANDLER) NULL)
680
681
682 typedef
683 ACPI_STATUS (*ADDRESS_SPACE_SETUP) (
684 ACPI_HANDLE region_handle,
685 u32 function,
686 void *handler_context,
687 void **region_context);
688
689 #define ACPI_REGION_ACTIVATE 0
690 #define ACPI_REGION_DEACTIVATE 1
691
692 typedef
693 ACPI_STATUS (*WALK_CALLBACK) (
694 ACPI_HANDLE obj_handle,
695 u32 nesting_level,
696 void *context,
697 void **return_value);
698
699
700 /* Interrupt handler return values */
701
702 #define INTERRUPT_NOT_HANDLED 0x00
703 #define INTERRUPT_HANDLED 0x01
704
705
706 /* Structure and flags for Acpi_get_device_info */
707
708 #define ACPI_VALID_HID 0x1
709 #define ACPI_VALID_UID 0x2
710 #define ACPI_VALID_ADR 0x4
711 #define ACPI_VALID_STA 0x8
712
713
714 #define ACPI_COMMON_OBJ_INFO \
715 ACPI_OBJECT_TYPE type; /* ACPI object type */ \
716 ACPI_NAME name /* ACPI object Name */
717
718
719 typedef struct
720 {
721 ACPI_COMMON_OBJ_INFO;
722 } ACPI_OBJ_INFO_HEADER;
723
724
725 typedef struct
726 {
727 ACPI_COMMON_OBJ_INFO;
728
729 u32 valid; /* Are the next bits legit? */
730 NATIVE_CHAR hardware_id [9]; /* _HID value if any */
731 NATIVE_CHAR unique_id[9]; /* _UID value if any */
732 ACPI_INTEGER address; /* _ADR value if any */
733 u32 current_status; /* _STA value */
734 } ACPI_DEVICE_INFO;
735
736
737 /* Context structs for address space handlers */
738
739 typedef struct
740 {
741 u32 seg;
742 u32 bus;
743 u32 dev_func;
744 } PCI_HANDLER_CONTEXT;
745
746
747 typedef struct
748 {
749 ACPI_PHYSICAL_ADDRESS mapped_physical_address;
750 u8 *mapped_logical_address;
751 u32 mapped_length;
752 } MEM_HANDLER_CONTEXT;
753
754
755 /*
756 * C-state handler
757 */
758
759 typedef ACPI_STATUS (*ACPI_C_STATE_HANDLER) (ACPI_IO_ADDRESS, u32*);
760
761
762 /*
763 * Definitions for Resource Attributes
764 */
765
766 /*
767 * Memory Attributes
768 */
769 #define READ_ONLY_MEMORY (u8) 0x00
770 #define READ_WRITE_MEMORY (u8) 0x01
771
772 #define NON_CACHEABLE_MEMORY (u8) 0x00
773 #define CACHABLE_MEMORY (u8) 0x01
774 #define WRITE_COMBINING_MEMORY (u8) 0x02
775 #define PREFETCHABLE_MEMORY (u8) 0x03
776
777 /*
778 * IO Attributes
779 * The ISA IO ranges are: n000-n0FFh, n400-n4_fFh, n800-n8_fFh, n_c00-n_cFFh.
780 * The non-ISA IO ranges are: n100-n3_fFh, n500-n7_fFh, n900-n_bFFh, n_cD0-n_fFFh.
781 */
782 #define NON_ISA_ONLY_RANGES (u8) 0x01
783 #define ISA_ONLY_RANGES (u8) 0x02
784 #define ENTIRE_RANGE (NON_ISA_ONLY_RANGES | ISA_ONLY_RANGES)
785
786 /*
787 * IO Port Descriptor Decode
788 */
789 #define DECODE_10 (u8) 0x00 /* 10-bit IO address decode */
790 #define DECODE_16 (u8) 0x01 /* 16-bit IO address decode */
791
792 /*
793 * IRQ Attributes
794 */
795 #define EDGE_SENSITIVE (u8) 0x00
796 #define LEVEL_SENSITIVE (u8) 0x01
797
798 #define ACTIVE_HIGH (u8) 0x00
799 #define ACTIVE_LOW (u8) 0x01
800
801 #define EXCLUSIVE (u8) 0x00
802 #define SHARED (u8) 0x01
803
804 /*
805 * DMA Attributes
806 */
807 #define COMPATIBILITY (u8) 0x00
808 #define TYPE_A (u8) 0x01
809 #define TYPE_B (u8) 0x02
810 #define TYPE_F (u8) 0x03
811
812 #define NOT_BUS_MASTER (u8) 0x00
813 #define BUS_MASTER (u8) 0x01
814
815 #define TRANSFER_8 (u8) 0x00
816 #define TRANSFER_8_16 (u8) 0x01
817 #define TRANSFER_16 (u8) 0x02
818
819 /*
820 * Start Dependent Functions Priority definitions
821 */
822 #define GOOD_CONFIGURATION (u8) 0x00
823 #define ACCEPTABLE_CONFIGURATION (u8) 0x01
824 #define SUB_OPTIMAL_CONFIGURATION (u8) 0x02
825
826 /*
827 * 16, 32 and 64-bit Address Descriptor resource types
828 */
829 #define MEMORY_RANGE (u8) 0x00
830 #define IO_RANGE (u8) 0x01
831 #define BUS_NUMBER_RANGE (u8) 0x02
832
833 #define ADDRESS_NOT_FIXED (u8) 0x00
834 #define ADDRESS_FIXED (u8) 0x01
835
836 #define POS_DECODE (u8) 0x00
837 #define SUB_DECODE (u8) 0x01
838
839 #define PRODUCER (u8) 0x00
840 #define CONSUMER (u8) 0x01
841
842
843 /*
844 * Structures used to describe device resources
845 */
846 typedef struct
847 {
848 u32 edge_level;
849 u32 active_high_low;
850 u32 shared_exclusive;
851 u32 number_of_interrupts;
852 u32 interrupts[1];
853
854 } IRQ_RESOURCE;
855
856 typedef struct
857 {
858 u32 type;
859 u32 bus_master;
860 u32 transfer;
861 u32 number_of_channels;
862 u32 channels[1];
863
864 } DMA_RESOURCE;
865
866 typedef struct
867 {
868 u32 compatibility_priority;
869 u32 performance_robustness;
870
871 } START_DEPENDENT_FUNCTIONS_RESOURCE;
872
873 /*
874 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
875 * needed because it has no fields
876 */
877
878 typedef struct
879 {
880 u32 io_decode;
881 u32 min_base_address;
882 u32 max_base_address;
883 u32 alignment;
884 u32 range_length;
885
886 } IO_RESOURCE;
887
888 typedef struct
889 {
890 u32 base_address;
891 u32 range_length;
892
893 } FIXED_IO_RESOURCE;
894
895 typedef struct
896 {
897 u32 length;
898 u8 reserved[1];
899
900 } VENDOR_RESOURCE;
901
902 typedef struct
903 {
904 u32 read_write_attribute;
905 u32 min_base_address;
906 u32 max_base_address;
907 u32 alignment;
908 u32 range_length;
909
910 } MEMORY24_RESOURCE;
911
912 typedef struct
913 {
914 u32 read_write_attribute;
915 u32 min_base_address;
916 u32 max_base_address;
917 u32 alignment;
918 u32 range_length;
919
920 } MEMORY32_RESOURCE;
921
922 typedef struct
923 {
924 u32 read_write_attribute;
925 u32 range_base_address;
926 u32 range_length;
927
928 } FIXED_MEMORY32_RESOURCE;
929
930 typedef struct
931 {
932 u16 cache_attribute;
933 u16 read_write_attribute;
934
935 } MEMORY_ATTRIBUTE;
936
937 typedef struct
938 {
939 u16 range_attribute;
940 u16 reserved;
941
942 } IO_ATTRIBUTE;
943
944 typedef struct
945 {
946 u16 reserved1;
947 u16 reserved2;
948
949 } BUS_ATTRIBUTE;
950
951 typedef union
952 {
953 MEMORY_ATTRIBUTE memory;
954 IO_ATTRIBUTE io;
955 BUS_ATTRIBUTE bus;
956
957 } ATTRIBUTE_DATA;
958
959 typedef struct
960 {
961 u32 resource_type;
962 u32 producer_consumer;
963 u32 decode;
964 u32 min_address_fixed;
965 u32 max_address_fixed;
966 ATTRIBUTE_DATA attribute;
967 u32 granularity;
968 u32 min_address_range;
969 u32 max_address_range;
970 u32 address_translation_offset;
971 u32 address_length;
972 u32 resource_source_index;
973 u32 resource_source_string_length;
974 NATIVE_CHAR resource_source[1];
975
976 } ADDRESS16_RESOURCE;
977
978 typedef struct
979 {
980 u32 resource_type;
981 u32 producer_consumer;
982 u32 decode;
983 u32 min_address_fixed;
984 u32 max_address_fixed;
985 ATTRIBUTE_DATA attribute;
986 u32 granularity;
987 u32 min_address_range;
988 u32 max_address_range;
989 u32 address_translation_offset;
990 u32 address_length;
991 u32 resource_source_index;
992 u32 resource_source_string_length;
993 NATIVE_CHAR resource_source[1];
994
995 } ADDRESS32_RESOURCE;
996
997 typedef struct
998 {
999 u32 producer_consumer;
1000 u32 edge_level;
1001 u32 active_high_low;
1002 u32 shared_exclusive;
1003 u32 number_of_interrupts;
1004 u32 interrupts[1];
1005 u32 resource_source_index;
1006 u32 resource_source_string_length;
1007 NATIVE_CHAR resource_source[1];
1008
1009 } EXTENDED_IRQ_RESOURCE;
1010
1011 typedef enum
1012 {
1013 irq,
1014 dma,
1015 start_dependent_functions,
1016 end_dependent_functions,
1017 io,
1018 fixed_io,
1019 vendor_specific,
1020 end_tag,
1021 memory24,
1022 memory32,
1023 fixed_memory32,
1024 address16,
1025 address32,
1026 extended_irq
1027 } RESOURCE_TYPE;
1028
1029 typedef union
1030 {
1031 IRQ_RESOURCE irq;
1032 DMA_RESOURCE dma;
1033 START_DEPENDENT_FUNCTIONS_RESOURCE start_dependent_functions;
1034 IO_RESOURCE io;
1035 FIXED_IO_RESOURCE fixed_io;
1036 VENDOR_RESOURCE vendor_specific;
1037 MEMORY24_RESOURCE memory24;
1038 MEMORY32_RESOURCE memory32;
1039 FIXED_MEMORY32_RESOURCE fixed_memory32;
1040 ADDRESS16_RESOURCE address16;
1041 ADDRESS32_RESOURCE address32;
1042 EXTENDED_IRQ_RESOURCE extended_irq;
1043 } RESOURCE_DATA;
1044
1045 typedef struct _resource_tag
1046 {
1047 RESOURCE_TYPE id;
1048 u32 length;
1049 RESOURCE_DATA data;
1050 } RESOURCE;
1051
1052 #define RESOURCE_LENGTH 12
1053 #define RESOURCE_LENGTH_NO_DATA 8
1054
1055 #define NEXT_RESOURCE(res) (RESOURCE*)((u8*) res + res->length)
1056
1057 /*
1058 * END: Definitions for Resource Attributes
1059 */
1060
1061
1062 typedef struct pci_routing_table
1063 {
1064 u32 length;
1065 u32 pin;
1066 ACPI_INTEGER address; /* here for 64-bit alignment */
1067 u32 source_index;
1068 NATIVE_CHAR source[4]; /* pad to 64 bits so sizeof() works in all cases */
1069
1070 } PCI_ROUTING_TABLE;
1071
1072
1073 /*
1074 * END: Definitions for PCI Routing tables
1075 */
1076
1077 #endif /* __ACTYPES_H__ */