actypes.h revision 73561
1/******************************************************************************
2 *
3 * Name: actypes.h - Common data types for the entire ACPI subsystem
4 *       $Revision: 165 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
13 * All rights reserved.
14 *
15 * 2. License
16 *
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights.  You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
20 * property rights.
21 *
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
28 *
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code.  No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
37 *
38 * The above copyright and patent license is granted only if the following
39 * conditions are met:
40 *
41 * 3. Conditions
42 *
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision.  In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change.  Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee.  Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
54 *
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution.  In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
65 * make.
66 *
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3.4. Intel retains all right, title, and interest in and to the Original
74 * Intel Code.
75 *
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
80 *
81 * 4. Disclaimer and Export Compliance
82 *
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
90 *
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
99 *
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government.  In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
114 *
115 *****************************************************************************/
116
117#ifndef __ACTYPES_H__
118#define __ACTYPES_H__
119
120/*! [Begin] no source code translation (keep the typedefs) */
121
122/*
123 * Data types - Fixed across all compilation models
124 *
125 * BOOLEAN      Logical Boolean.
126 *              1 byte value containing a 0 for FALSE or a 1 for TRUE.
127 *              Other values are undefined.
128 *
129 * INT8         8-bit  (1 byte) signed value
130 * UINT8        8-bit  (1 byte) unsigned value
131 * INT16        16-bit (2 byte) signed value
132 * UINT16       16-bit (2 byte) unsigned value
133 * INT32        32-bit (4 byte) signed value
134 * UINT32       32-bit (4 byte) unsigned value
135 * INT64        64-bit (8 byte) signed value
136 * UINT64       64-bit (8 byte) unsigned value
137 * NATIVE_INT   32-bit on IA-32, 64-bit on IA-64 signed value
138 * NATIVE_UINT  32-bit on IA-32, 64-bit on IA-64 unsigned value
139 * UCHAR        Character. 1 byte unsigned value.
140 */
141
142
143#ifdef _IA64
144/*
145 * 64-bit type definitions
146 */
147typedef unsigned char                   UINT8;
148typedef unsigned char                   BOOLEAN;
149typedef unsigned char                   UCHAR;
150typedef unsigned short                  UINT16;
151typedef int                             INT32;
152typedef unsigned int                    UINT32;
153typedef COMPILER_DEPENDENT_UINT64       UINT64;
154
155typedef UINT64                          NATIVE_UINT;
156typedef INT64                           NATIVE_INT;
157
158typedef NATIVE_UINT                     ACPI_TBLPTR;
159typedef UINT64                          ACPI_IO_ADDRESS;
160typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
161
162#define ALIGNED_ADDRESS_BOUNDARY        0x00000008
163
164/* (No hardware alignment support in IA64) */
165
166
167#elif _IA16
168/*
169 * 16-bit type definitions
170 */
171typedef unsigned char                   UINT8;
172typedef unsigned char                   BOOLEAN;
173typedef unsigned char                   UCHAR;
174typedef unsigned int                    UINT16;
175typedef long                            INT32;
176typedef int                             INT16;
177typedef unsigned long                   UINT32;
178
179typedef struct
180{
181    UINT32                                  Lo;
182    UINT32                                  Hi;
183
184} UINT64;
185
186typedef UINT16                          NATIVE_UINT;
187typedef INT16                           NATIVE_INT;
188
189typedef UINT32                          ACPI_TBLPTR;
190typedef UINT32                          ACPI_IO_ADDRESS;
191typedef char                            *ACPI_PHYSICAL_ADDRESS;
192
193#define ALIGNED_ADDRESS_BOUNDARY        0x00000002
194#define _HW_ALIGNMENT_SUPPORT
195
196/*
197 * (16-bit only) internal integers must be 32-bits, so
198 * 64-bit integers cannot be supported
199 */
200#define ACPI_NO_INTEGER64_SUPPORT
201
202
203#else
204/*
205 * 32-bit type definitions (default)
206 */
207typedef unsigned char                   UINT8;
208typedef unsigned char                   BOOLEAN;
209typedef unsigned char                   UCHAR;
210typedef unsigned short                  UINT16;
211typedef int                             INT32;
212typedef unsigned int                    UINT32;
213typedef COMPILER_DEPENDENT_UINT64       UINT64;
214
215typedef UINT32                          NATIVE_UINT;
216typedef INT32                           NATIVE_INT;
217
218typedef NATIVE_UINT                     ACPI_TBLPTR;
219typedef UINT32                          ACPI_IO_ADDRESS;
220typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
221
222#define ALIGNED_ADDRESS_BOUNDARY        0x00000004
223#define _HW_ALIGNMENT_SUPPORT
224#endif
225
226
227
228/*
229 * Miscellaneous common types
230 */
231
232typedef UINT32                          UINT32_BIT;
233typedef NATIVE_UINT                     ACPI_PTRDIFF;
234typedef char                            NATIVE_CHAR;
235
236
237/*
238 * Data type ranges
239 */
240
241#define ACPI_UINT8_MAX                  (UINT8)  0xFF
242#define ACPI_UINT16_MAX                 (UINT16) 0xFFFF
243#define ACPI_UINT32_MAX                 (UINT32) 0xFFFFFFFF
244#define ACPI_UINT64_MAX                 (UINT64) 0xFFFFFFFFFFFFFFFF
245
246
247#ifdef DEFINE_ALTERNATE_TYPES
248/*
249 * Types used only in translated source
250 */
251typedef INT32                           s32;
252typedef UINT8                           u8;
253typedef UINT16                          u16;
254typedef UINT32                          u32;
255typedef UINT64                          u64;
256#endif
257/*! [End] no source code translation !*/
258
259
260/*
261 * Useful defines
262 */
263
264#ifdef FALSE
265#undef FALSE
266#endif
267#define FALSE                           (1 == 0)
268
269#ifdef TRUE
270#undef TRUE
271#endif
272#define TRUE                            (1 == 1)
273
274#ifndef NULL
275#define NULL                            (void *) 0
276#endif
277
278
279/*
280 * Local datatypes
281 */
282
283typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
284typedef UINT32                          ACPI_NAME;      /* 4-INT8 ACPI name */
285typedef char*                           ACPI_STRING;    /* Null terminated ASCII string */
286typedef void*                           ACPI_HANDLE;    /* Actually a ptr to an Node */
287
288
289/*
290 * Acpi integer width. In ACPI version 1, integers are
291 * 32 bits.  In ACPI version 2, integers are 64 bits.
292 * Note that this pertains to the ACPI integer type only, not
293 * other integers used in the implementation of the ACPI CA
294 * subsystem.
295 */
296#ifdef ACPI_NO_INTEGER64_SUPPORT
297
298/* 32-bit integers only, no 64-bit support */
299
300typedef UINT32                          ACPI_INTEGER;
301#define ACPI_INTEGER_MAX                ACPI_UINT32_MAX
302#define ACPI_INTEGER_BIT_SIZE           32
303#define ACPI_MAX_BCD_VALUE              99999999
304#define ACPI_MAX_BCD_DIGITS             8
305
306#else
307
308/* 64-bit integers */
309
310typedef UINT64                          ACPI_INTEGER;
311#define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
312#define ACPI_INTEGER_BIT_SIZE           64
313#define ACPI_MAX_BCD_VALUE              9999999999999999
314#define ACPI_MAX_BCD_DIGITS             16
315
316#endif
317
318
319/*
320 * Constants with special meanings
321 */
322
323#define ACPI_ROOT_OBJECT                (ACPI_HANDLE)(-1)
324
325#define ACPI_FULL_INITIALIZATION        0x00
326#define ACPI_NO_ADDRESS_SPACE_INIT      0x01
327#define ACPI_NO_HARDWARE_INIT           0x02
328#define ACPI_NO_EVENT_INIT              0x04
329#define ACPI_NO_ACPI_ENABLE             0x08
330#define ACPI_NO_DEVICE_INIT             0x10
331#define ACPI_NO_OBJECT_INIT             0x20
332
333
334/*
335 * Sleep state constants
336 */
337#define ACPI_STATE_S0                   (UINT8) 0
338#define ACPI_STATE_S1                   (UINT8) 1
339#define ACPI_STATE_S2                   (UINT8) 2
340#define ACPI_STATE_S3                   (UINT8) 3
341#define ACPI_STATE_S4                   (UINT8) 4
342#define ACPI_STATE_S5                   (UINT8) 5
343/* let's pretend S4BIOS didn't exist for now. ASG */
344#define ACPI_STATE_S4BIOS               (UINT8) 6
345#define ACPI_S_STATES_MAX               ACPI_STATE_S5
346
347
348/*
349 *  Table types.  These values are passed to the table related APIs
350 */
351
352typedef UINT32                          ACPI_TABLE_TYPE;
353
354#define ACPI_TABLE_RSDP                 (ACPI_TABLE_TYPE) 0
355#define ACPI_TABLE_DSDT                 (ACPI_TABLE_TYPE) 1
356#define ACPI_TABLE_FADT                 (ACPI_TABLE_TYPE) 2
357#define ACPI_TABLE_FACS                 (ACPI_TABLE_TYPE) 3
358#define ACPI_TABLE_PSDT                 (ACPI_TABLE_TYPE) 4
359#define ACPI_TABLE_SSDT                 (ACPI_TABLE_TYPE) 5
360#define ACPI_TABLE_XSDT                 (ACPI_TABLE_TYPE) 6
361#define ACPI_TABLE_MAX                  6
362#define NUM_ACPI_TABLES                 (ACPI_TABLE_MAX+1)
363
364
365/*
366 * Types associated with names.  The first group of
367 * values correspond to the definition of the ACPI
368 * ObjectType operator (See the ACPI Spec).  Therefore,
369 * only add to the first group if the spec changes!
370 *
371 * Types must be kept in sync with the AcpiNsProperties
372 * and AcpiNsTypeNames arrays
373 */
374
375typedef UINT32                          ACPI_OBJECT_TYPE;
376typedef UINT8                           OBJECT_TYPE_INTERNAL;
377
378#define ACPI_BTYPE_ANY                  0x00000000
379#define ACPI_BTYPE_INTEGER               0x00000001
380#define ACPI_BTYPE_STRING               0x00000002
381#define ACPI_BTYPE_BUFFER               0x00000004
382#define ACPI_BTYPE_PACKAGE              0x00000008
383#define ACPI_BTYPE_FIELD_UNIT           0x00000010
384#define ACPI_BTYPE_DEVICE               0x00000020
385#define ACPI_BTYPE_EVENT                0x00000040
386#define ACPI_BTYPE_METHOD               0x00000080
387#define ACPI_BTYPE_MUTEX                0x00000100
388#define ACPI_BTYPE_REGION               0x00000200
389#define ACPI_BTYPE_POWER                0x00000400
390#define ACPI_BTYPE_PROCESSOR            0x00000800
391#define ACPI_BTYPE_THERMAL              0x00001000
392#define ACPI_BTYPE_BUFFER_FIELD         0x00002000
393#define ACPI_BTYPE_DDB_HANDLE           0x00004000
394#define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
395#define ACPI_BTYPE_REFERENCE            0x00010000
396#define ACPI_BTYPE_RESOURCE             0x00020000
397
398#define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
399
400#define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
401#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
402#define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
403#define ACPI_BTYPE_OBJECTS_AND_REFS     0x00017FFF  /* ARG or LOCAL */
404#define ACPI_BTYPE_ALL_OBJECTS          0x00007FFF
405
406
407#define ACPI_TYPE_ANY                   0  /* 0x00  */
408#define ACPI_TYPE_INTEGER               1  /* 0x01  Byte/Word/Dword/Zero/One/Ones */
409#define ACPI_TYPE_STRING                2  /* 0x02  */
410#define ACPI_TYPE_BUFFER                3  /* 0x03  */
411#define ACPI_TYPE_PACKAGE               4  /* 0x04  ByteConst, multiple DataTerm/Constant/SuperName */
412#define ACPI_TYPE_FIELD_UNIT            5  /* 0x05  */
413#define ACPI_TYPE_DEVICE                6  /* 0x06  Name, multiple Node */
414#define ACPI_TYPE_EVENT                 7  /* 0x07  */
415#define ACPI_TYPE_METHOD                8  /* 0x08  Name, ByteConst, multiple Code */
416#define ACPI_TYPE_MUTEX                 9  /* 0x09  */
417#define ACPI_TYPE_REGION                10 /* 0x0A  */
418#define ACPI_TYPE_POWER                 11 /* 0x0B  Name,ByteConst,WordConst,multi Node */
419#define ACPI_TYPE_PROCESSOR             12 /* 0x0C  Name,ByteConst,DWordConst,ByteConst,multi NmO */
420#define ACPI_TYPE_THERMAL               13 /* 0x0D  Name, multiple Node */
421#define ACPI_TYPE_BUFFER_FIELD          14 /* 0x0E  */
422#define ACPI_TYPE_DDB_HANDLE            15 /* 0x0F  */
423#define ACPI_TYPE_DEBUG_OBJECT          16 /* 0x10  */
424
425#define ACPI_TYPE_MAX                   16
426
427/*
428 * This section contains object types that do not relate to the ACPI ObjectType operator.
429 * They are used for various internal purposes only.  If new predefined ACPI_TYPEs are
430 * added (via the ACPI specification), these internal types must move upwards.
431 * Also, values exceeding the largest official ACPI ObjectType must not overlap with
432 * defined AML opcodes.
433 */
434#define INTERNAL_TYPE_BEGIN             17
435
436#define INTERNAL_TYPE_DEF_FIELD         17 /* 0x11  */
437#define INTERNAL_TYPE_BANK_FIELD        18 /* 0x12  */
438#define INTERNAL_TYPE_INDEX_FIELD       19 /* 0x13  */
439#define INTERNAL_TYPE_REFERENCE         20 /* 0x14  Arg#, Local#, Name, Debug; used only in descriptors */
440#define INTERNAL_TYPE_ALIAS             21 /* 0x15  */
441#define INTERNAL_TYPE_NOTIFY            22 /* 0x16  */
442#define INTERNAL_TYPE_ADDRESS_HANDLER   23 /* 0x17  */
443#define INTERNAL_TYPE_RESOURCE          24 /* 0x18  */
444
445
446#define INTERNAL_TYPE_NODE_MAX          24
447
448/* These are pseudo-types because there are never any namespace nodes with these types */
449
450#define INTERNAL_TYPE_DEF_FIELD_DEFN    25 /* 0x19  Name, ByteConst, multiple FieldElement */
451#define INTERNAL_TYPE_BANK_FIELD_DEFN   26 /* 0x1A  2 Name,DWordConst,ByteConst,multi FieldElement */
452#define INTERNAL_TYPE_INDEX_FIELD_DEFN  27 /* 0x1B  2 Name, ByteConst, multiple FieldElement */
453#define INTERNAL_TYPE_IF                28 /* 0x1C  OpCode, multiple Code */
454#define INTERNAL_TYPE_ELSE              29 /* 0x1D  multiple Code */
455#define INTERNAL_TYPE_WHILE             30 /* 0x1E  OpCode, multiple Code */
456#define INTERNAL_TYPE_SCOPE             31 /* 0x1F  Name, multiple Node */
457#define INTERNAL_TYPE_DEF_ANY           32 /* 0x20  type is Any, suppress search of enclosing scopes */
458#define INTERNAL_TYPE_EXTRA             33 /* 0x21  */
459
460#define INTERNAL_TYPE_MAX               33
461
462#define INTERNAL_TYPE_INVALID           34
463#define ACPI_TYPE_NOT_FOUND             0xFF
464
465/*
466 * AcpiEvent Types:
467 * ------------
468 * Fixed & general purpose...
469 */
470
471typedef UINT32                          ACPI_EVENT_TYPE;
472
473#define ACPI_EVENT_FIXED                (ACPI_EVENT_TYPE) 0
474#define ACPI_EVENT_GPE                  (ACPI_EVENT_TYPE) 1
475
476/*
477 * Fixed events
478 */
479
480#define ACPI_EVENT_PMTIMER              (ACPI_EVENT_TYPE) 0
481    /*
482     * There's no bus master event so index 1 is used for IRQ's that are not
483     * handled by the SCI handler
484     */
485#define ACPI_EVENT_NOT_USED             (ACPI_EVENT_TYPE) 1
486#define ACPI_EVENT_GLOBAL               (ACPI_EVENT_TYPE) 2
487#define ACPI_EVENT_POWER_BUTTON         (ACPI_EVENT_TYPE) 3
488#define ACPI_EVENT_SLEEP_BUTTON         (ACPI_EVENT_TYPE) 4
489#define ACPI_EVENT_RTC                  (ACPI_EVENT_TYPE) 5
490#define ACPI_EVENT_GENERAL              (ACPI_EVENT_TYPE) 6
491#define ACPI_EVENT_MAX                  6
492#define NUM_FIXED_EVENTS                (ACPI_EVENT_TYPE) 7
493
494#define ACPI_GPE_INVALID                0xFF
495#define ACPI_GPE_MAX                    0xFF
496#define NUM_GPE                         256
497
498#define ACPI_EVENT_LEVEL_TRIGGERED      (ACPI_EVENT_TYPE) 1
499#define ACPI_EVENT_EDGE_TRIGGERED       (ACPI_EVENT_TYPE) 2
500
501/*
502 * AcpiEvent Status:
503 * -------------
504 * The encoding of ACPI_EVENT_STATUS is illustrated below.
505 * Note that a set bit (1) indicates the property is TRUE
506 * (e.g. if bit 0 is set then the event is enabled).
507 * +---------------+-+-+
508 * |   Bits 31:2   |1|0|
509 * +---------------+-+-+
510 *          |       | |
511 *          |       | +- Enabled?
512 *          |       +--- Set?
513 *          +----------- <Reserved>
514 */
515typedef UINT32                          ACPI_EVENT_STATUS;
516
517#define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
518#define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
519#define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x02
520
521
522/* Notify types */
523
524#define ACPI_SYSTEM_NOTIFY              0
525#define ACPI_DEVICE_NOTIFY              1
526#define ACPI_MAX_NOTIFY_HANDLER_TYPE    1
527
528#define MAX_SYS_NOTIFY                  0x7f
529
530
531/* Address Space (Operation Region) Types */
532
533typedef UINT8                           ACPI_ADDRESS_SPACE_TYPE;
534
535#define ADDRESS_SPACE_SYSTEM_MEMORY     (ACPI_ADDRESS_SPACE_TYPE) 0
536#define ADDRESS_SPACE_SYSTEM_IO         (ACPI_ADDRESS_SPACE_TYPE) 1
537#define ADDRESS_SPACE_PCI_CONFIG        (ACPI_ADDRESS_SPACE_TYPE) 2
538#define ADDRESS_SPACE_EC                (ACPI_ADDRESS_SPACE_TYPE) 3
539#define ADDRESS_SPACE_SMBUS             (ACPI_ADDRESS_SPACE_TYPE) 4
540#define ADDRESS_SPACE_CMOS              (ACPI_ADDRESS_SPACE_TYPE) 5
541#define ADDRESS_SPACE_PCI_BAR_TARGET    (ACPI_ADDRESS_SPACE_TYPE) 6
542
543
544/*
545 * External ACPI object definition
546 */
547
548typedef union AcpiObj
549{
550    ACPI_OBJECT_TYPE            Type;   /* See definition of AcpiNsType for values */
551    struct
552    {
553        ACPI_OBJECT_TYPE            Type;
554        ACPI_INTEGER                Value;      /* The actual number */
555    } Integer;
556
557    struct
558    {
559        ACPI_OBJECT_TYPE            Type;
560        UINT32                      Length;     /* # of bytes in string, excluding trailing null */
561        NATIVE_CHAR                 *Pointer;   /* points to the string value */
562    } String;
563
564    struct
565    {
566        ACPI_OBJECT_TYPE            Type;
567        UINT32                      Length;     /* # of bytes in buffer */
568        UINT8                       *Pointer;   /* points to the buffer */
569    } Buffer;
570
571    struct
572    {
573        ACPI_OBJECT_TYPE            Type;
574        UINT32                      Fill1;
575        ACPI_HANDLE                 Handle;     /* object reference */
576    } Reference;
577
578    struct
579    {
580        ACPI_OBJECT_TYPE            Type;
581        UINT32                      Count;      /* # of elements in package */
582        union AcpiObj               *Elements;  /* Pointer to an array of ACPI_OBJECTs */
583    } Package;
584
585    struct
586    {
587        ACPI_OBJECT_TYPE            Type;
588        UINT32                      ProcId;
589        UINT32                      PblkAddress;
590        UINT32                      PblkLength;
591    } Processor;
592
593    struct
594    {
595        ACPI_OBJECT_TYPE            Type;
596        UINT32                      SystemLevel;
597        UINT32                      ResourceOrder;
598    } PowerResource;
599
600} ACPI_OBJECT, *PACPI_OBJECT;
601
602
603/*
604 * List of objects, used as a parameter list for control method evaluation
605 */
606
607typedef struct AcpiObjList
608{
609    UINT32                      Count;
610    ACPI_OBJECT                 *Pointer;
611
612} ACPI_OBJECT_LIST, *PACPI_OBJECT_LIST;
613
614
615/*
616 * Miscellaneous common Data Structures used by the interfaces
617 */
618
619typedef struct
620{
621    UINT32                      Length;         /* Length in bytes of the buffer */
622    void                        *Pointer;       /* pointer to buffer */
623
624} ACPI_BUFFER;
625
626
627/*
628 * NameType for AcpiGetName
629 */
630
631#define ACPI_FULL_PATHNAME              0
632#define ACPI_SINGLE_NAME                1
633#define ACPI_NAME_TYPE_MAX              1
634
635
636/*
637 * Structure and flags for AcpiGetSystemInfo
638 */
639
640#define SYS_MODE_UNKNOWN                0x0000
641#define SYS_MODE_ACPI                   0x0001
642#define SYS_MODE_LEGACY                 0x0002
643#define SYS_MODES_MASK                  0x0003
644
645/*
646 *  ACPI CPU Cx state handler
647 */
648typedef
649ACPI_STATUS (*ACPI_SET_C_STATE_HANDLER) (
650    NATIVE_UINT                 PblkAddress);
651
652/*
653 *  ACPI Cx State info
654 */
655typedef struct
656{
657    UINT32                      StateNumber;
658    UINT32                      Latency;
659} ACPI_CX_STATE;
660
661/*
662 *  ACPI CPU throttling info
663 */
664typedef struct
665{
666    UINT32                      StateNumber;
667    UINT32                      PercentOfClock;
668} ACPI_CPU_THROTTLING_STATE;
669
670/*
671 * ACPI Table Info.  One per ACPI table _type_
672 */
673typedef struct AcpiTableInfo
674{
675    UINT32                      Count;
676
677} ACPI_TABLE_INFO;
678
679
680/*
681 * System info returned by AcpiGetSystemInfo()
682 */
683
684typedef struct _AcpiSysInfo
685{
686    UINT32                      AcpiCaVersion;
687    UINT32                      Flags;
688    UINT32                      TimerResolution;
689    UINT32                      Reserved1;
690    UINT32                      Reserved2;
691    UINT32                      DebugLevel;
692    UINT32                      DebugLayer;
693    UINT32                      NumTableTypes;
694    ACPI_TABLE_INFO             TableInfo [NUM_ACPI_TABLES];
695
696} ACPI_SYSTEM_INFO;
697
698
699/*
700 *  System Initiailization data.  This data is passed to ACPIInitialize
701 *  copyied to global data and retained by ACPI CA
702 */
703
704typedef struct _AcpiInitData
705{
706    void                        *RSDP_PhysicalAddress;  /*  Address of RSDP, needed it it is    */
707                                                        /*  not found in the IA32 manner        */
708} ACPI_INIT_DATA;
709
710/*
711 * Various handlers and callback procedures
712 */
713
714typedef
715UINT32 (*FIXED_EVENT_HANDLER) (
716    void                        *Context);
717
718typedef
719void (*GPE_HANDLER) (
720    void                        *Context);
721
722typedef
723void (*NOTIFY_HANDLER) (
724    ACPI_HANDLE                 Device,
725    UINT32                      Value,
726    void                        *Context);
727
728#define ADDRESS_SPACE_READ              1
729#define ADDRESS_SPACE_WRITE             2
730
731typedef
732ACPI_STATUS (*ADDRESS_SPACE_HANDLER) (
733    UINT32                      Function,
734    ACPI_PHYSICAL_ADDRESS       Address,
735    UINT32                      BitWidth,
736    UINT32                      *Value,
737    void                        *HandlerContext,
738    void                        *RegionContext);
739
740#define ACPI_DEFAULT_HANDLER            ((ADDRESS_SPACE_HANDLER) NULL)
741
742
743typedef
744ACPI_STATUS (*ADDRESS_SPACE_SETUP) (
745    ACPI_HANDLE                 RegionHandle,
746    UINT32                      Function,
747    void                        *HandlerContext,
748    void                        **RegionContext);
749
750#define ACPI_REGION_ACTIVATE    0
751#define ACPI_REGION_DEACTIVATE  1
752
753typedef
754ACPI_STATUS (*WALK_CALLBACK) (
755    ACPI_HANDLE                 ObjHandle,
756    UINT32                      NestingLevel,
757    void                        *Context,
758    void                        **ReturnValue);
759
760
761
762
763/* Interrupt handler return values */
764
765#define INTERRUPT_NOT_HANDLED           0x00
766#define INTERRUPT_HANDLED               0x01
767
768
769/* Structure and flags for AcpiGetDeviceInfo */
770
771#define ACPI_VALID_HID                  0x1
772#define ACPI_VALID_UID                  0x2
773#define ACPI_VALID_ADR                  0x4
774#define ACPI_VALID_STA                  0x8
775
776
777#define ACPI_COMMON_OBJ_INFO \
778    ACPI_OBJECT_TYPE            Type;           /* ACPI object type */ \
779    ACPI_NAME                   Name            /* ACPI object Name */
780
781
782typedef struct
783{
784    ACPI_COMMON_OBJ_INFO;
785} ACPI_OBJ_INFO_HEADER;
786
787
788typedef struct
789{
790    ACPI_COMMON_OBJ_INFO;
791
792    UINT32                      Valid;              /*  Are the next bits legit? */
793    NATIVE_CHAR                 HardwareId [9];     /*  _HID value if any */
794    NATIVE_CHAR                 UniqueId[9];        /*  _UID value if any */
795    ACPI_INTEGER                Address;            /*  _ADR value if any */
796    UINT32                      CurrentStatus;      /*  _STA value */
797} ACPI_DEVICE_INFO;
798
799
800/* Context structs for address space handlers */
801
802typedef struct
803{
804    UINT32                      Seg;
805    UINT32                      Bus;
806    UINT32                      DevFunc;
807} PCI_HANDLER_CONTEXT;
808
809
810typedef struct
811{
812    ACPI_PHYSICAL_ADDRESS       MappedPhysicalAddress;
813    UINT8                       *MappedLogicalAddress;
814    UINT32                      MappedLength;
815} MEM_HANDLER_CONTEXT;
816
817
818/*
819 * C-state handler
820 */
821
822typedef ACPI_STATUS (*ACPI_C_STATE_HANDLER) (ACPI_IO_ADDRESS, UINT32*);
823
824
825/*
826 * Definitions for Resource Attributes
827 */
828
829/*
830 *  Memory Attributes
831 */
832#define READ_ONLY_MEMORY                (UINT8) 0x00
833#define READ_WRITE_MEMORY               (UINT8) 0x01
834
835#define NON_CACHEABLE_MEMORY            (UINT8) 0x00
836#define CACHABLE_MEMORY                 (UINT8) 0x01
837#define WRITE_COMBINING_MEMORY          (UINT8) 0x02
838#define PREFETCHABLE_MEMORY             (UINT8) 0x03
839
840/*
841 *  IO Attributes
842 *  The ISA IO ranges are: n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
843 *  The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
844 */
845#define NON_ISA_ONLY_RANGES             (UINT8) 0x01
846#define ISA_ONLY_RANGES                 (UINT8) 0x02
847#define ENTIRE_RANGE                    (NON_ISA_ONLY_RANGES | ISA_ONLY_RANGES)
848
849/*
850 *  IO Port Descriptor Decode
851 */
852#define DECODE_10                       (UINT8) 0x00    /* 10-bit IO address decode */
853#define DECODE_16                       (UINT8) 0x01    /* 16-bit IO address decode */
854
855/*
856 *  IRQ Attributes
857 */
858#define EDGE_SENSITIVE                  (UINT8) 0x00
859#define LEVEL_SENSITIVE                 (UINT8) 0x01
860
861#define ACTIVE_HIGH                     (UINT8) 0x00
862#define ACTIVE_LOW                      (UINT8) 0x01
863
864#define EXCLUSIVE                       (UINT8) 0x00
865#define SHARED                          (UINT8) 0x01
866
867/*
868 *  DMA Attributes
869 */
870#define COMPATIBILITY                   (UINT8) 0x00
871#define TYPE_A                          (UINT8) 0x01
872#define TYPE_B                          (UINT8) 0x02
873#define TYPE_F                          (UINT8) 0x03
874
875#define NOT_BUS_MASTER                  (UINT8) 0x00
876#define BUS_MASTER                      (UINT8) 0x01
877
878#define TRANSFER_8                      (UINT8) 0x00
879#define TRANSFER_8_16                   (UINT8) 0x01
880#define TRANSFER_16                     (UINT8) 0x02
881
882/*
883 * Start Dependent Functions Priority definitions
884 */
885#define GOOD_CONFIGURATION              (UINT8) 0x00
886#define ACCEPTABLE_CONFIGURATION        (UINT8) 0x01
887#define SUB_OPTIMAL_CONFIGURATION       (UINT8) 0x02
888
889/*
890 *  16, 32 and 64-bit Address Descriptor resource types
891 */
892#define MEMORY_RANGE                    (UINT8) 0x00
893#define IO_RANGE                        (UINT8) 0x01
894#define BUS_NUMBER_RANGE                (UINT8) 0x02
895
896#define ADDRESS_NOT_FIXED               (UINT8) 0x00
897#define ADDRESS_FIXED                   (UINT8) 0x01
898
899#define POS_DECODE                      (UINT8) 0x00
900#define SUB_DECODE                      (UINT8) 0x01
901
902#define PRODUCER                        (UINT8) 0x00
903#define CONSUMER                        (UINT8) 0x01
904
905
906/*
907 *  Structures used to describe device resources
908 */
909typedef struct
910{
911    UINT32                      EdgeLevel;
912    UINT32                      ActiveHighLow;
913    UINT32                      SharedExclusive;
914    UINT32                      NumberOfInterrupts;
915    UINT32                      Interrupts[1];
916
917} IRQ_RESOURCE;
918
919typedef struct
920{
921    UINT32                      Type;
922    UINT32                      BusMaster;
923    UINT32                      Transfer;
924    UINT32                      NumberOfChannels;
925    UINT32                      Channels[1];
926
927} DMA_RESOURCE;
928
929typedef struct
930{
931    UINT32                      CompatibilityPriority;
932    UINT32                      PerformanceRobustness;
933
934} START_DEPENDENT_FUNCTIONS_RESOURCE;
935
936/*
937 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
938 *  needed because it has no fields
939 */
940
941typedef struct
942{
943    UINT32                      IoDecode;
944    UINT32                      MinBaseAddress;
945    UINT32                      MaxBaseAddress;
946    UINT32                      Alignment;
947    UINT32                      RangeLength;
948
949} IO_RESOURCE;
950
951typedef struct
952{
953    UINT32                      BaseAddress;
954    UINT32                      RangeLength;
955
956} FIXED_IO_RESOURCE;
957
958typedef struct
959{
960    UINT32                      Length;
961    UINT8                       Reserved[1];
962
963} VENDOR_RESOURCE;
964
965typedef struct
966{
967    UINT32                      ReadWriteAttribute;
968    UINT32                      MinBaseAddress;
969    UINT32                      MaxBaseAddress;
970    UINT32                      Alignment;
971    UINT32                      RangeLength;
972
973} MEMORY24_RESOURCE;
974
975typedef struct
976{
977    UINT32                      ReadWriteAttribute;
978    UINT32                      MinBaseAddress;
979    UINT32                      MaxBaseAddress;
980    UINT32                      Alignment;
981    UINT32                      RangeLength;
982
983} MEMORY32_RESOURCE;
984
985typedef struct
986{
987    UINT32                      ReadWriteAttribute;
988    UINT32                      RangeBaseAddress;
989    UINT32                      RangeLength;
990
991} FIXED_MEMORY32_RESOURCE;
992
993typedef struct
994{
995    UINT16                      CacheAttribute;
996    UINT16                      ReadWriteAttribute;
997
998} MEMORY_ATTRIBUTE;
999
1000typedef struct
1001{
1002    UINT16                      RangeAttribute;
1003    UINT16                      Reserved;
1004
1005} IO_ATTRIBUTE;
1006
1007typedef struct
1008{
1009    UINT16                      Reserved1;
1010    UINT16                      Reserved2;
1011
1012} BUS_ATTRIBUTE;
1013
1014typedef union
1015{
1016    MEMORY_ATTRIBUTE            Memory;
1017    IO_ATTRIBUTE                Io;
1018    BUS_ATTRIBUTE               Bus;
1019
1020} ATTRIBUTE_DATA;
1021
1022typedef struct
1023{
1024    UINT32                      ResourceType;
1025    UINT32                      ProducerConsumer;
1026    UINT32                      Decode;
1027    UINT32                      MinAddressFixed;
1028    UINT32                      MaxAddressFixed;
1029    ATTRIBUTE_DATA              Attribute;
1030    UINT32                      Granularity;
1031    UINT32                      MinAddressRange;
1032    UINT32                      MaxAddressRange;
1033    UINT32                      AddressTranslationOffset;
1034    UINT32                      AddressLength;
1035    UINT32                      ResourceSourceIndex;
1036    UINT32                      ResourceSourceStringLength;
1037    NATIVE_CHAR                 ResourceSource[1];
1038
1039} ADDRESS16_RESOURCE;
1040
1041typedef struct
1042{
1043    UINT32                      ResourceType;
1044    UINT32                      ProducerConsumer;
1045    UINT32                      Decode;
1046    UINT32                      MinAddressFixed;
1047    UINT32                      MaxAddressFixed;
1048    ATTRIBUTE_DATA              Attribute;
1049    UINT32                      Granularity;
1050    UINT32                      MinAddressRange;
1051    UINT32                      MaxAddressRange;
1052    UINT32                      AddressTranslationOffset;
1053    UINT32                      AddressLength;
1054    UINT32                      ResourceSourceIndex;
1055    UINT32                      ResourceSourceStringLength;
1056    NATIVE_CHAR                 ResourceSource[1];
1057
1058} ADDRESS32_RESOURCE;
1059
1060typedef struct
1061{
1062    UINT32                      ProducerConsumer;
1063    UINT32                      EdgeLevel;
1064    UINT32                      ActiveHighLow;
1065    UINT32                      SharedExclusive;
1066    UINT32                      NumberOfInterrupts;
1067    UINT32                      Interrupts[1];
1068    UINT32                      ResourceSourceIndex;
1069    UINT32                      ResourceSourceStringLength;
1070    NATIVE_CHAR                 ResourceSource[1];
1071
1072} EXTENDED_IRQ_RESOURCE;
1073
1074typedef enum
1075{
1076    Irq,
1077    Dma,
1078    StartDependentFunctions,
1079    EndDependentFunctions,
1080    Io,
1081    FixedIo,
1082    VendorSpecific,
1083    EndTag,
1084    Memory24,
1085    Memory32,
1086    FixedMemory32,
1087    Address16,
1088    Address32,
1089    ExtendedIrq
1090} RESOURCE_TYPE;
1091
1092typedef union
1093{
1094    IRQ_RESOURCE                        Irq;
1095    DMA_RESOURCE                        Dma;
1096    START_DEPENDENT_FUNCTIONS_RESOURCE  StartDependentFunctions;
1097    IO_RESOURCE                         Io;
1098    FIXED_IO_RESOURCE                   FixedIo;
1099    VENDOR_RESOURCE                     VendorSpecific;
1100    MEMORY24_RESOURCE                   Memory24;
1101    MEMORY32_RESOURCE                   Memory32;
1102    FIXED_MEMORY32_RESOURCE             FixedMemory32;
1103    ADDRESS16_RESOURCE                  Address16;
1104    ADDRESS32_RESOURCE                  Address32;
1105    EXTENDED_IRQ_RESOURCE               ExtendedIrq;
1106} RESOURCE_DATA;
1107
1108typedef struct _resource_tag
1109{
1110    RESOURCE_TYPE               Id;
1111    UINT32                      Length;
1112    RESOURCE_DATA               Data;
1113} RESOURCE;
1114
1115#define RESOURCE_LENGTH                 12
1116#define RESOURCE_LENGTH_NO_DATA         8
1117
1118#define NEXT_RESOURCE(Res)    (RESOURCE*)((UINT8*) Res + Res->length)
1119
1120/*
1121 * END: Definitions for Resource Attributes
1122 */
1123
1124
1125typedef struct pci_routing_table
1126{
1127    UINT32                      Length;
1128    UINT32                      Pin;
1129    ACPI_INTEGER                Address;        /* here for 64-bit alignment */
1130    UINT32                      SourceIndex;
1131    NATIVE_CHAR                 Source[4];      /* pad to 64 bits so sizeof() works in all cases */
1132
1133} PCI_ROUTING_TABLE;
1134
1135
1136/*
1137 * END: Definitions for PCI Routing tables
1138 */
1139
1140#endif /* __ACTYPES_H__ */
1141