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