actypes.h revision 80062
1/******************************************************************************
2 *
3 * Name: actypes.h - Common data types for the entire ACPI subsystem
4 *       $Revision: 184 $
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-byte 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
326/*
327 * Initialization sequence
328 */
329#define ACPI_FULL_INITIALIZATION        0x00
330#define ACPI_NO_ADDRESS_SPACE_INIT      0x01
331#define ACPI_NO_HARDWARE_INIT           0x02
332#define ACPI_NO_EVENT_INIT              0x04
333#define ACPI_NO_ACPI_ENABLE             0x08
334#define ACPI_NO_DEVICE_INIT             0x10
335#define ACPI_NO_OBJECT_INIT             0x20
336
337/*
338 * Initialization state
339 */
340#define ACPI_INITIALIZED_OK             0x01
341
342/*
343 * Power state values
344 */
345
346#define ACPI_STATE_UNKNOWN              (UINT8) 0xFF
347
348#define ACPI_STATE_S0                   (UINT8) 0
349#define ACPI_STATE_S1                   (UINT8) 1
350#define ACPI_STATE_S2                   (UINT8) 2
351#define ACPI_STATE_S3                   (UINT8) 3
352#define ACPI_STATE_S4                   (UINT8) 4
353#define ACPI_STATE_S5                   (UINT8) 5
354#define ACPI_S_STATES_MAX               ACPI_STATE_S5
355#define ACPI_S_STATE_COUNT              6
356
357#define ACPI_STATE_D0                   (UINT8) 0
358#define ACPI_STATE_D1                   (UINT8) 1
359#define ACPI_STATE_D2                   (UINT8) 2
360#define ACPI_STATE_D3                   (UINT8) 3
361#define ACPI_D_STATES_MAX               ACPI_STATE_D3
362#define ACPI_D_STATE_COUNT              4
363
364/*
365 * Standard notify values
366 */
367#define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0
368#define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 1
369#define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 2
370#define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 3
371#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 4
372#define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 5
373#define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 6
374#define ACPI_NOTIFY_POWER_FAULT	        (UINT8) 7
375
376
377/*
378 *  Table types.  These values are passed to the table related APIs
379 */
380
381typedef UINT32                          ACPI_TABLE_TYPE;
382
383#define ACPI_TABLE_RSDP                 (ACPI_TABLE_TYPE) 0
384#define ACPI_TABLE_DSDT                 (ACPI_TABLE_TYPE) 1
385#define ACPI_TABLE_FADT                 (ACPI_TABLE_TYPE) 2
386#define ACPI_TABLE_FACS                 (ACPI_TABLE_TYPE) 3
387#define ACPI_TABLE_PSDT                 (ACPI_TABLE_TYPE) 4
388#define ACPI_TABLE_SSDT                 (ACPI_TABLE_TYPE) 5
389#define ACPI_TABLE_XSDT                 (ACPI_TABLE_TYPE) 6
390#define ACPI_TABLE_MAX                  6
391#define NUM_ACPI_TABLES                 (ACPI_TABLE_MAX+1)
392
393
394/*
395 * Types associated with names.  The first group of
396 * values correspond to the definition of the ACPI
397 * ObjectType operator (See the ACPI Spec).  Therefore,
398 * only add to the first group if the spec changes!
399 *
400 * Types must be kept in sync with the AcpiNsProperties
401 * and AcpiNsTypeNames arrays
402 */
403
404typedef UINT32                          ACPI_OBJECT_TYPE;
405typedef UINT8                           ACPI_OBJECT_TYPE8;
406
407
408#define ACPI_TYPE_ANY                   0  /* 0x00  */
409#define ACPI_TYPE_INTEGER               1  /* 0x01  Byte/Word/Dword/Zero/One/Ones */
410#define ACPI_TYPE_STRING                2  /* 0x02  */
411#define ACPI_TYPE_BUFFER                3  /* 0x03  */
412#define ACPI_TYPE_PACKAGE               4  /* 0x04  ByteConst, multiple DataTerm/Constant/SuperName */
413#define ACPI_TYPE_FIELD_UNIT            5  /* 0x05  */
414#define ACPI_TYPE_DEVICE                6  /* 0x06  Name, multiple Node */
415#define ACPI_TYPE_EVENT                 7  /* 0x07  */
416#define ACPI_TYPE_METHOD                8  /* 0x08  Name, ByteConst, multiple Code */
417#define ACPI_TYPE_MUTEX                 9  /* 0x09  */
418#define ACPI_TYPE_REGION                10 /* 0x0A  */
419#define ACPI_TYPE_POWER                 11 /* 0x0B  Name,ByteConst,WordConst,multi Node */
420#define ACPI_TYPE_PROCESSOR             12 /* 0x0C  Name,ByteConst,DWordConst,ByteConst,multi NmO */
421#define ACPI_TYPE_THERMAL               13 /* 0x0D  Name, multiple Node */
422#define ACPI_TYPE_BUFFER_FIELD          14 /* 0x0E  */
423#define ACPI_TYPE_DDB_HANDLE            15 /* 0x0F  */
424#define ACPI_TYPE_DEBUG_OBJECT          16 /* 0x10  */
425
426#define ACPI_TYPE_MAX                   16
427
428/*
429 * This section contains object types that do not relate to the ACPI ObjectType operator.
430 * They are used for various internal purposes only.  If new predefined ACPI_TYPEs are
431 * added (via the ACPI specification), these internal types must move upwards.
432 * Also, values exceeding the largest official ACPI ObjectType must not overlap with
433 * defined AML opcodes.
434 */
435#define INTERNAL_TYPE_BEGIN             17
436
437#define INTERNAL_TYPE_REGION_FIELD      17 /* 0x11  */
438#define INTERNAL_TYPE_BANK_FIELD        18 /* 0x12  */
439#define INTERNAL_TYPE_INDEX_FIELD       19 /* 0x13  */
440#define INTERNAL_TYPE_REFERENCE         20 /* 0x14  Arg#, Local#, Name, Debug; used only in descriptors */
441#define INTERNAL_TYPE_ALIAS             21 /* 0x15  */
442#define INTERNAL_TYPE_NOTIFY            22 /* 0x16  */
443#define INTERNAL_TYPE_ADDRESS_HANDLER   23 /* 0x17  */
444#define INTERNAL_TYPE_RESOURCE          24 /* 0x18  */
445#define INTERNAL_TYPE_RESOURCE_FIELD    25 /* 0x19  */
446
447
448#define INTERNAL_TYPE_NODE_MAX          25
449
450/* These are pseudo-types because there are never any namespace nodes with these types */
451
452#define INTERNAL_TYPE_FIELD_DEFN        26 /* 0x1A  Name, ByteConst, multiple FieldElement */
453#define INTERNAL_TYPE_BANK_FIELD_DEFN   27 /* 0x1B  2 Name,DWordConst,ByteConst,multi FieldElement */
454#define INTERNAL_TYPE_INDEX_FIELD_DEFN  28 /* 0x1C  2 Name, ByteConst, multiple FieldElement */
455#define INTERNAL_TYPE_IF                29 /* 0x1D  */
456#define INTERNAL_TYPE_ELSE              30 /* 0x1E  */
457#define INTERNAL_TYPE_WHILE             31 /* 0x1F  */
458#define INTERNAL_TYPE_SCOPE             32 /* 0x20  Name, multiple Node */
459#define INTERNAL_TYPE_DEF_ANY           33 /* 0x21  type is Any, suppress search of enclosing scopes */
460#define INTERNAL_TYPE_EXTRA             34 /* 0x22  */
461
462#define INTERNAL_TYPE_MAX               34
463
464#define INTERNAL_TYPE_INVALID           35
465#define ACPI_TYPE_NOT_FOUND             0xFF
466
467
468/*
469 * Bitmapped ACPI types
470 * Used internally only
471 */
472#define ACPI_BTYPE_ANY                  0x00000000
473#define ACPI_BTYPE_INTEGER              0x00000001
474#define ACPI_BTYPE_STRING               0x00000002
475#define ACPI_BTYPE_BUFFER               0x00000004
476#define ACPI_BTYPE_PACKAGE              0x00000008
477#define ACPI_BTYPE_FIELD_UNIT           0x00000010
478#define ACPI_BTYPE_DEVICE               0x00000020
479#define ACPI_BTYPE_EVENT                0x00000040
480#define ACPI_BTYPE_METHOD               0x00000080
481#define ACPI_BTYPE_MUTEX                0x00000100
482#define ACPI_BTYPE_REGION               0x00000200
483#define ACPI_BTYPE_POWER                0x00000400
484#define ACPI_BTYPE_PROCESSOR            0x00000800
485#define ACPI_BTYPE_THERMAL              0x00001000
486#define ACPI_BTYPE_BUFFER_FIELD         0x00002000
487#define ACPI_BTYPE_DDB_HANDLE           0x00004000
488#define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
489#define ACPI_BTYPE_REFERENCE            0x00010000
490#define ACPI_BTYPE_RESOURCE             0x00020000
491
492#define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
493
494#define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
495#define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
496#define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
497#define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
498#define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
499
500
501/*
502 * AcpiEvent Types:
503 * ------------
504 * Fixed & general purpose...
505 */
506
507typedef UINT32                          ACPI_EVENT_TYPE;
508
509#define ACPI_EVENT_FIXED                (ACPI_EVENT_TYPE) 0
510#define ACPI_EVENT_GPE                  (ACPI_EVENT_TYPE) 1
511
512/*
513 * Fixed events
514 */
515
516#define ACPI_EVENT_PMTIMER              (ACPI_EVENT_TYPE) 0
517    /*
518     * There's no bus master event so index 1 is used for IRQ's that are not
519     * handled by the SCI handler
520     */
521#define ACPI_EVENT_NOT_USED             (ACPI_EVENT_TYPE) 1
522#define ACPI_EVENT_GLOBAL               (ACPI_EVENT_TYPE) 2
523#define ACPI_EVENT_POWER_BUTTON         (ACPI_EVENT_TYPE) 3
524#define ACPI_EVENT_SLEEP_BUTTON         (ACPI_EVENT_TYPE) 4
525#define ACPI_EVENT_RTC                  (ACPI_EVENT_TYPE) 5
526#define ACPI_EVENT_GENERAL              (ACPI_EVENT_TYPE) 6
527#define ACPI_EVENT_MAX                  6
528#define ACPI_NUM_FIXED_EVENTS           (ACPI_EVENT_TYPE) 7
529
530#define ACPI_GPE_INVALID                0xFF
531#define ACPI_GPE_MAX                    0xFF
532#define ACPI_NUM_GPE                    256
533
534#define ACPI_EVENT_LEVEL_TRIGGERED      (ACPI_EVENT_TYPE) 1
535#define ACPI_EVENT_EDGE_TRIGGERED       (ACPI_EVENT_TYPE) 2
536
537/*
538 * AcpiEvent Status:
539 * -------------
540 * The encoding of ACPI_EVENT_STATUS is illustrated below.
541 * Note that a set bit (1) indicates the property is TRUE
542 * (e.g. if bit 0 is set then the event is enabled).
543 * +---------------+-+-+
544 * |   Bits 31:2   |1|0|
545 * +---------------+-+-+
546 *          |       | |
547 *          |       | +- Enabled?
548 *          |       +--- Set?
549 *          +----------- <Reserved>
550 */
551typedef UINT32                          ACPI_EVENT_STATUS;
552
553#define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
554#define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
555#define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x02
556
557
558/* Notify types */
559
560#define ACPI_SYSTEM_NOTIFY              0
561#define ACPI_DEVICE_NOTIFY              1
562#define ACPI_MAX_NOTIFY_HANDLER_TYPE    1
563
564#define MAX_SYS_NOTIFY                  0x7f
565
566
567/* Address Space (Operation Region) Types */
568
569typedef UINT8                           ACPI_ADR_SPACE_TYPE;
570
571#define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
572#define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
573#define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
574#define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
575#define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
576#define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
577#define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
578
579
580/*
581 * External ACPI object definition
582 */
583
584typedef union AcpiObj
585{
586    ACPI_OBJECT_TYPE            Type;   /* See definition of AcpiNsType for values */
587    struct
588    {
589        ACPI_OBJECT_TYPE            Type;
590        ACPI_INTEGER                Value;      /* The actual number */
591    } Integer;
592
593    struct
594    {
595        ACPI_OBJECT_TYPE            Type;
596        UINT32                      Length;     /* # of bytes in string, excluding trailing null */
597        NATIVE_CHAR                 *Pointer;   /* points to the string value */
598    } String;
599
600    struct
601    {
602        ACPI_OBJECT_TYPE            Type;
603        UINT32                      Length;     /* # of bytes in buffer */
604        UINT8                       *Pointer;   /* points to the buffer */
605    } Buffer;
606
607    struct
608    {
609        ACPI_OBJECT_TYPE            Type;
610        UINT32                      Fill1;
611        ACPI_HANDLE                 Handle;     /* object reference */
612    } Reference;
613
614    struct
615    {
616        ACPI_OBJECT_TYPE            Type;
617        UINT32                      Count;      /* # of elements in package */
618        union AcpiObj               *Elements;  /* Pointer to an array of ACPI_OBJECTs */
619    } Package;
620
621    struct
622    {
623        ACPI_OBJECT_TYPE            Type;
624        UINT32                      ProcId;
625        ACPI_IO_ADDRESS             PblkAddress;
626        UINT32                      PblkLength;
627    } Processor;
628
629    struct
630    {
631        ACPI_OBJECT_TYPE            Type;
632        UINT32                      SystemLevel;
633        UINT32                      ResourceOrder;
634    } PowerResource;
635
636} ACPI_OBJECT, *PACPI_OBJECT;
637
638
639/*
640 * List of objects, used as a parameter list for control method evaluation
641 */
642
643typedef struct AcpiObjList
644{
645    UINT32                      Count;
646    ACPI_OBJECT                 *Pointer;
647
648} ACPI_OBJECT_LIST, *PACPI_OBJECT_LIST;
649
650
651/*
652 * Miscellaneous common Data Structures used by the interfaces
653 */
654
655typedef struct
656{
657    UINT32                      Length;         /* Length in bytes of the buffer */
658    void                        *Pointer;       /* pointer to buffer */
659
660} ACPI_BUFFER;
661
662
663/*
664 * NameType for AcpiGetName
665 */
666
667#define ACPI_FULL_PATHNAME              0
668#define ACPI_SINGLE_NAME                1
669#define ACPI_NAME_TYPE_MAX              1
670
671
672/*
673 * Structure and flags for AcpiGetSystemInfo
674 */
675
676#define SYS_MODE_UNKNOWN                0x0000
677#define SYS_MODE_ACPI                   0x0001
678#define SYS_MODE_LEGACY                 0x0002
679#define SYS_MODES_MASK                  0x0003
680
681
682/*
683 * ACPI Table Info.  One per ACPI table _type_
684 */
685typedef struct AcpiTableInfo
686{
687    UINT32                      Count;
688
689} ACPI_TABLE_INFO;
690
691
692/*
693 * System info returned by AcpiGetSystemInfo()
694 */
695
696typedef struct _AcpiSysInfo
697{
698    UINT32                      AcpiCaVersion;
699    UINT32                      Flags;
700    UINT32                      TimerResolution;
701    UINT32                      Reserved1;
702    UINT32                      Reserved2;
703    UINT32                      DebugLevel;
704    UINT32                      DebugLayer;
705    UINT32                      NumTableTypes;
706    ACPI_TABLE_INFO             TableInfo [NUM_ACPI_TABLES];
707
708} ACPI_SYSTEM_INFO;
709
710
711/*
712 * Various handlers and callback procedures
713 */
714
715typedef
716UINT32 (*ACPI_EVENT_HANDLER) (
717    void                        *Context);
718
719typedef
720void (*ACPI_GPE_HANDLER) (
721    void                        *Context);
722
723typedef
724void (*ACPI_NOTIFY_HANDLER) (
725    ACPI_HANDLE                 Device,
726    UINT32                      Value,
727    void                        *Context);
728
729
730/* Address Spaces (Operation Regions */
731
732#define ACPI_READ_ADR_SPACE     1
733#define ACPI_WRITE_ADR_SPACE    2
734
735typedef
736ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
737    UINT32                      Function,
738    ACPI_PHYSICAL_ADDRESS       Address,
739    UINT32                      BitWidth,
740    UINT32                      *Value,
741    void                        *HandlerContext,
742    void                        *RegionContext);
743
744#define ACPI_DEFAULT_HANDLER            ((ACPI_ADR_SPACE_HANDLER) NULL)
745
746
747typedef
748ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
749    ACPI_HANDLE                 RegionHandle,
750    UINT32                      Function,
751    void                        *HandlerContext,
752    void                        **RegionContext);
753
754#define ACPI_REGION_ACTIVATE    0
755#define ACPI_REGION_DEACTIVATE  1
756
757typedef
758ACPI_STATUS (*ACPI_WALK_CALLBACK) (
759    ACPI_HANDLE                 ObjHandle,
760    UINT32                      NestingLevel,
761    void                        *Context,
762    void                        **ReturnValue);
763
764
765/* Interrupt handler return values */
766
767#define INTERRUPT_NOT_HANDLED           0x00
768#define INTERRUPT_HANDLED               0x01
769
770
771/* Structure and flags for AcpiGetDeviceInfo */
772
773#define ACPI_VALID_HID                  0x1
774#define ACPI_VALID_UID                  0x2
775#define ACPI_VALID_ADR                  0x4
776#define ACPI_VALID_STA                  0x8
777
778
779#define ACPI_COMMON_OBJ_INFO \
780    ACPI_OBJECT_TYPE            Type;           /* ACPI object type */ \
781    ACPI_NAME                   Name            /* ACPI object Name */
782
783
784typedef struct
785{
786    ACPI_COMMON_OBJ_INFO;
787} ACPI_OBJ_INFO_HEADER;
788
789
790typedef struct
791{
792    ACPI_COMMON_OBJ_INFO;
793
794    UINT32                      Valid;              /*  Are the next bits legit? */
795    NATIVE_CHAR                 HardwareId[9];      /*  _HID value if any */
796    NATIVE_CHAR                 UniqueId[9];        /*  _UID value if any */
797    ACPI_INTEGER                Address;            /*  _ADR value if any */
798    UINT32                      CurrentStatus;      /*  _STA value */
799} ACPI_DEVICE_INFO;
800
801
802/* Context structs for address space handlers */
803
804typedef struct
805{
806    UINT16                      Segment;
807    UINT16                      Bus;
808    UINT16                      Device;
809    UINT16                      Function;
810} ACPI_PCI_ID;
811
812
813typedef struct
814{
815    ACPI_PHYSICAL_ADDRESS       MappedPhysicalAddress;
816    UINT8                       *MappedLogicalAddress;
817    UINT32                      MappedLength;
818} ACPI_MEM_SPACE_CONTEXT;
819
820
821/*
822 * Definitions for Resource Attributes
823 */
824
825/*
826 *  Memory Attributes
827 */
828#define READ_ONLY_MEMORY                (UINT8) 0x00
829#define READ_WRITE_MEMORY               (UINT8) 0x01
830
831#define NON_CACHEABLE_MEMORY            (UINT8) 0x00
832#define CACHABLE_MEMORY                 (UINT8) 0x01
833#define WRITE_COMBINING_MEMORY          (UINT8) 0x02
834#define PREFETCHABLE_MEMORY             (UINT8) 0x03
835
836/*
837 *  IO Attributes
838 *  The ISA IO ranges are: n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
839 *  The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
840 */
841#define NON_ISA_ONLY_RANGES             (UINT8) 0x01
842#define ISA_ONLY_RANGES                 (UINT8) 0x02
843#define ENTIRE_RANGE                    (NON_ISA_ONLY_RANGES | ISA_ONLY_RANGES)
844
845/*
846 *  IO Port Descriptor Decode
847 */
848#define DECODE_10                       (UINT8) 0x00    /* 10-bit IO address decode */
849#define DECODE_16                       (UINT8) 0x01    /* 16-bit IO address decode */
850
851/*
852 *  IRQ Attributes
853 */
854#define EDGE_SENSITIVE                  (UINT8) 0x00
855#define LEVEL_SENSITIVE                 (UINT8) 0x01
856
857#define ACTIVE_HIGH                     (UINT8) 0x00
858#define ACTIVE_LOW                      (UINT8) 0x01
859
860#define EXCLUSIVE                       (UINT8) 0x00
861#define SHARED                          (UINT8) 0x01
862
863/*
864 *  DMA Attributes
865 */
866#define COMPATIBILITY                   (UINT8) 0x00
867#define TYPE_A                          (UINT8) 0x01
868#define TYPE_B                          (UINT8) 0x02
869#define TYPE_F                          (UINT8) 0x03
870
871#define NOT_BUS_MASTER                  (UINT8) 0x00
872#define BUS_MASTER                      (UINT8) 0x01
873
874#define TRANSFER_8                      (UINT8) 0x00
875#define TRANSFER_8_16                   (UINT8) 0x01
876#define TRANSFER_16                     (UINT8) 0x02
877
878/*
879 * Start Dependent Functions Priority definitions
880 */
881#define GOOD_CONFIGURATION              (UINT8) 0x00
882#define ACCEPTABLE_CONFIGURATION        (UINT8) 0x01
883#define SUB_OPTIMAL_CONFIGURATION       (UINT8) 0x02
884
885/*
886 *  16, 32 and 64-bit Address Descriptor resource types
887 */
888#define MEMORY_RANGE                    (UINT8) 0x00
889#define IO_RANGE                        (UINT8) 0x01
890#define BUS_NUMBER_RANGE                (UINT8) 0x02
891
892#define ADDRESS_NOT_FIXED               (UINT8) 0x00
893#define ADDRESS_FIXED                   (UINT8) 0x01
894
895#define POS_DECODE                      (UINT8) 0x00
896#define SUB_DECODE                      (UINT8) 0x01
897
898#define PRODUCER                        (UINT8) 0x00
899#define CONSUMER                        (UINT8) 0x01
900
901
902/*
903 *  Structures used to describe device resources
904 */
905typedef struct
906{
907    UINT32                      EdgeLevel;
908    UINT32                      ActiveHighLow;
909    UINT32                      SharedExclusive;
910    UINT32                      NumberOfInterrupts;
911    UINT32                      Interrupts[1];
912
913} ACPI_RESOURCE_IRQ;
914
915typedef struct
916{
917    UINT32                      Type;
918    UINT32                      BusMaster;
919    UINT32                      Transfer;
920    UINT32                      NumberOfChannels;
921    UINT32                      Channels[1];
922
923} ACPI_RESOURCE_DMA;
924
925typedef struct
926{
927    UINT32                      CompatibilityPriority;
928    UINT32                      PerformanceRobustness;
929
930} ACPI_RESOURCE_START_DPF;
931
932/*
933 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
934 *  needed because it has no fields
935 */
936
937typedef struct
938{
939    UINT32                      IoDecode;
940    UINT32                      MinBaseAddress;
941    UINT32                      MaxBaseAddress;
942    UINT32                      Alignment;
943    UINT32                      RangeLength;
944
945} ACPI_RESOURCE_IO;
946
947typedef struct
948{
949    UINT32                      BaseAddress;
950    UINT32                      RangeLength;
951
952} ACPI_RESOURCE_FIXED_IO;
953
954typedef struct
955{
956    UINT32                      Length;
957    UINT8                       Reserved[1];
958
959} ACPI_RESOURCE_VENDOR;
960
961typedef struct
962{
963    UINT32                      ReadWriteAttribute;
964    UINT32                      MinBaseAddress;
965    UINT32                      MaxBaseAddress;
966    UINT32                      Alignment;
967    UINT32                      RangeLength;
968
969} ACPI_RESOURCE_MEM24;
970
971typedef struct
972{
973    UINT32                      ReadWriteAttribute;
974    UINT32                      MinBaseAddress;
975    UINT32                      MaxBaseAddress;
976    UINT32                      Alignment;
977    UINT32                      RangeLength;
978
979} ACPI_RESOURCE_MEM32;
980
981typedef struct
982{
983    UINT32                      ReadWriteAttribute;
984    UINT32                      RangeBaseAddress;
985    UINT32                      RangeLength;
986
987} ACPI_RESOURCE_FIXED_MEM32;
988
989typedef struct
990{
991    UINT16                      CacheAttribute;
992    UINT16                      ReadWriteAttribute;
993
994} ACPI_MEMORY_ATTRIBUTE;
995
996typedef struct
997{
998    UINT16                      RangeAttribute;
999    UINT16                      Reserved;
1000
1001} ACPI_IO_ATTRIBUTE;
1002
1003typedef struct
1004{
1005    UINT16                      Reserved1;
1006    UINT16                      Reserved2;
1007
1008} ACPI_BUS_ATTRIBUTE;
1009
1010typedef union
1011{
1012    ACPI_MEMORY_ATTRIBUTE       Memory;
1013    ACPI_IO_ATTRIBUTE           Io;
1014    ACPI_BUS_ATTRIBUTE          Bus;
1015
1016} ACPI_RESOURCE_ATTRIBUTE;
1017
1018typedef struct
1019{
1020    UINT32                      Index;
1021    UINT32                      StringLength;
1022    NATIVE_CHAR                 *StringPtr;
1023
1024} ACPI_RESOURCE_SOURCE;
1025
1026typedef struct
1027{
1028    UINT32                      ResourceType;
1029    UINT32                      ProducerConsumer;
1030    UINT32                      Decode;
1031    UINT32                      MinAddressFixed;
1032    UINT32                      MaxAddressFixed;
1033    ACPI_RESOURCE_ATTRIBUTE     Attribute;
1034    UINT32                      Granularity;
1035    UINT32                      MinAddressRange;
1036    UINT32                      MaxAddressRange;
1037    UINT32                      AddressTranslationOffset;
1038    UINT32                      AddressLength;
1039    ACPI_RESOURCE_SOURCE        ResourceSource;
1040
1041} ACPI_RESOURCE_ADDRESS16;
1042
1043typedef struct
1044{
1045    UINT32                      ResourceType;
1046    UINT32                      ProducerConsumer;
1047    UINT32                      Decode;
1048    UINT32                      MinAddressFixed;
1049    UINT32                      MaxAddressFixed;
1050    ACPI_RESOURCE_ATTRIBUTE     Attribute;
1051    UINT32                      Granularity;
1052    UINT32                      MinAddressRange;
1053    UINT32                      MaxAddressRange;
1054    UINT32                      AddressTranslationOffset;
1055    UINT32                      AddressLength;
1056    ACPI_RESOURCE_SOURCE        ResourceSource;
1057
1058} ACPI_RESOURCE_ADDRESS32;
1059
1060typedef struct
1061{
1062    UINT32                      ResourceType;
1063    UINT32                      ProducerConsumer;
1064    UINT32                      Decode;
1065    UINT32                      MinAddressFixed;
1066    UINT32                      MaxAddressFixed;
1067    ACPI_RESOURCE_ATTRIBUTE     Attribute;
1068    UINT64                      Granularity;
1069    UINT64                      MinAddressRange;
1070    UINT64                      MaxAddressRange;
1071    UINT64                      AddressTranslationOffset;
1072    UINT64                      AddressLength;
1073    ACPI_RESOURCE_SOURCE        ResourceSource;
1074
1075} ACPI_RESOURCE_ADDRESS64;
1076
1077typedef struct
1078{
1079    UINT32                      ProducerConsumer;
1080    UINT32                      EdgeLevel;
1081    UINT32                      ActiveHighLow;
1082    UINT32                      SharedExclusive;
1083    UINT32                      NumberOfInterrupts;
1084    ACPI_RESOURCE_SOURCE        ResourceSource;
1085    UINT32                      Interrupts[1];
1086
1087} ACPI_RESOURCE_EXT_IRQ;
1088
1089
1090/* ACPI_RESOURCE_TYPEs */
1091
1092#define ACPI_RSTYPE_IRQ                 0
1093#define ACPI_RSTYPE_DMA                 1
1094#define ACPI_RSTYPE_START_DPF           2
1095#define ACPI_RSTYPE_END_DPF             3
1096#define ACPI_RSTYPE_IO                  4
1097#define ACPI_RSTYPE_FIXED_IO            5
1098#define ACPI_RSTYPE_VENDOR              6
1099#define ACPI_RSTYPE_END_TAG             7
1100#define ACPI_RSTYPE_MEM24               8
1101#define ACPI_RSTYPE_MEM32               9
1102#define ACPI_RSTYPE_FIXED_MEM32         10
1103#define ACPI_RSTYPE_ADDRESS16           11
1104#define ACPI_RSTYPE_ADDRESS32           12
1105#define ACPI_RSTYPE_ADDRESS64           13
1106#define ACPI_RSTYPE_EXT_IRQ             14
1107
1108typedef UINT32                  ACPI_RESOURCE_TYPE;
1109
1110typedef union
1111{
1112    ACPI_RESOURCE_IRQ           Irq;
1113    ACPI_RESOURCE_DMA           Dma;
1114    ACPI_RESOURCE_START_DPF     StartDpf;
1115    ACPI_RESOURCE_IO            Io;
1116    ACPI_RESOURCE_FIXED_IO      FixedIo;
1117    ACPI_RESOURCE_VENDOR        VendorSpecific;
1118    ACPI_RESOURCE_MEM24         Memory24;
1119    ACPI_RESOURCE_MEM32         Memory32;
1120    ACPI_RESOURCE_FIXED_MEM32   FixedMemory32;
1121    ACPI_RESOURCE_ADDRESS16     Address16;
1122    ACPI_RESOURCE_ADDRESS32     Address32;
1123    ACPI_RESOURCE_ADDRESS64     Address64;
1124    ACPI_RESOURCE_EXT_IRQ       ExtendedIrq;
1125
1126} ACPI_RESOURCE_DATA;
1127
1128typedef struct AcpiResource
1129{
1130    ACPI_RESOURCE_TYPE          Id;
1131    UINT32                      Length;
1132    ACPI_RESOURCE_DATA          Data;
1133
1134} ACPI_RESOURCE;
1135
1136#define ACPI_RESOURCE_LENGTH            12
1137#define ACPI_RESOURCE_LENGTH_NO_DATA    8       /* Id + Length fields */
1138
1139#define SIZEOF_RESOURCE(Type)   (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type))
1140
1141#define NEXT_RESOURCE(Res)      (ACPI_RESOURCE *)((UINT8 *) Res + Res->length)
1142
1143
1144/*
1145 * END: Definitions for Resource Attributes
1146 */
1147
1148
1149typedef struct pci_routing_table
1150{
1151    UINT32                      Length;
1152    UINT32                      Pin;
1153    ACPI_INTEGER                Address;        /* here for 64-bit alignment */
1154    UINT32                      SourceIndex;
1155    NATIVE_CHAR                 Source[4];      /* pad to 64 bits so sizeof() works in all cases */
1156
1157} PCI_ROUTING_TABLE;
1158
1159
1160/*
1161 * END: Definitions for PCI Routing tables
1162 */
1163
1164#endif /* __ACTYPES_H__ */
1165