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