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