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