actypes.h revision 67754
1/******************************************************************************
2 *
3 * Name: actypes.h - Common data types for the entire ACPI subsystem
4 *       $Revision: 143 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
13 * 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 long                            INT64;
154typedef unsigned long                   UINT64;
155
156typedef UINT64                          NATIVE_UINT;
157typedef INT64                           NATIVE_INT;
158
159typedef NATIVE_UINT                     ACPI_TBLPTR;
160typedef UINT64                          ACPI_IO_ADDRESS;
161typedef UINT64                          ACPI_MEM_ADDRESS;
162
163#define ALIGNED_ADDRESS_BOUNDARY        0x00000008
164
165/* (No hardware alignment support in IA64) */
166
167
168#elif _IA16
169/*
170 * 16-bit type definitions
171 */
172typedef unsigned char                   UINT8;
173typedef unsigned char                   BOOLEAN;
174typedef unsigned char                   UCHAR;
175typedef unsigned int                    UINT16;
176typedef long                            INT32;
177typedef int                             INT16;
178typedef unsigned long                   UINT32;
179
180typedef UINT16                          NATIVE_UINT;
181typedef INT16                           NATIVE_INT;
182
183typedef UINT32                          ACPI_TBLPTR;
184typedef UINT32                          ACPI_IO_ADDRESS;
185typedef UINT32                          ACPI_MEM_ADDRESS;
186
187#define ALIGNED_ADDRESS_BOUNDARY        0x00000002
188#define _HW_ALIGNMENT_SUPPORT
189
190/* (16-bit only) Force internal integers to be 32, not 64 bits */
191
192#define ACPI_VERSION_1
193
194
195#else
196/*
197 * 32-bit type definitions (default)
198 */
199typedef unsigned char                   UINT8;
200typedef unsigned char                   BOOLEAN;
201typedef unsigned char                   UCHAR;
202typedef unsigned short                  UINT16;
203typedef int                             INT32;
204typedef unsigned int                    UINT32;
205typedef COMPILER_DEPENDENT_UINT64       UINT64;
206
207typedef UINT32                          NATIVE_UINT;
208typedef INT32                           NATIVE_INT;
209
210typedef NATIVE_UINT                     ACPI_TBLPTR;
211typedef UINT32                          ACPI_IO_ADDRESS;
212typedef UINT32                          ACPI_MEM_ADDRESS;
213
214#define ALIGNED_ADDRESS_BOUNDARY        0x00000004
215#define _HW_ALIGNMENT_SUPPORT
216
217#endif
218
219
220
221/*
222 * Miscellaneous common types
223 */
224
225typedef UINT32                          UINT32_BIT;
226typedef NATIVE_UINT                     ACPI_PTRDIFF;
227typedef char                            NATIVE_CHAR;
228
229
230/*
231 * Data type ranges
232 */
233
234#define ACPI_UINT8_MAX                  (UINT8)  0xFF
235#define ACPI_UINT16_MAX                 (UINT16) 0xFFFF
236#define ACPI_UINT32_MAX                 (UINT32) 0xFFFFFFFF
237#define ACPI_UINT64_MAX                 (UINT64) 0xFFFFFFFFFFFFFFFF
238
239
240#ifdef DEFINE_ALTERNATE_TYPES
241/*
242 * Types used only in translated source
243 */
244typedef INT32                           s32;
245typedef UINT8                           u8;
246typedef UINT16                          u16;
247typedef UINT32                          u32;
248typedef UINT64                          u64;
249#endif
250/*! [End] no source code translation !*/
251
252
253/*
254 * Useful defines
255 */
256
257#ifdef FALSE
258#undef FALSE
259#endif
260#define FALSE                           (1 == 0)
261
262#ifdef TRUE
263#undef TRUE
264#endif
265#define TRUE                            (1 == 1)
266
267#ifndef NULL
268#define NULL                            (void *) 0
269#endif
270
271
272/*
273 * Local datatypes
274 */
275
276typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
277typedef UINT32                          ACPI_NAME;      /* 4-INT8 ACPI name */
278typedef char*                           ACPI_STRING;    /* Null terminated ASCII string */
279typedef void*                           ACPI_HANDLE;    /* Actually a ptr to an Node */
280
281
282/* TBD: TEMP ONLY! */
283
284#define ACPI_VERSION_1
285
286/*
287 * Acpi integer width. In ACPI version 1, integers are
288 * 32 bits.  In ACPI version 2, integers are 64 bits.  Period.
289 * Note that this pertains to the ACPI integer type only, not
290 * other integers used in the implementation of the ACPI CA
291 * subsystem.
292 */
293
294#ifdef ACPI_VERSION_1
295
296/* 32-bit Integers */
297
298typedef UINT32                          ACPI_INTEGER;
299#define ACPI_INTEGER_MAX                ACPI_UINT32_MAX;
300#define ACPI_INTEGER_BIT_SIZE           32
301
302#else
303
304/* 64-bit Integers */
305
306typedef UINT64                          ACPI_INTEGER;
307#define ACPI_INTEGER_MAX                ACPI_UINT64_MAX;
308#define ACPI_INTEGER_BIT_SIZE           64
309#endif
310
311
312/*
313 * Constants with special meanings
314 */
315
316#define ACPI_ROOT_OBJECT                (ACPI_HANDLE)(-1)
317
318#define ACPI_FULL_INITIALIZATION        0x00
319#define ACPI_NO_ADDRESS_SPACE_INIT      0x01
320#define ACPI_NO_HARDWARE_INIT           0x02
321#define ACPI_NO_EVENT_INIT              0x04
322#define ACPI_NO_ACPI_ENABLE             0x08
323#define ACPI_NO_DEVICE_INIT             0x10
324#define ACPI_NO_PCI_INIT                0x20
325#define ACPI_NO_OBJECT_INIT             0x40
326
327
328/*
329 * Sleep state constants
330 */
331#define ACPI_STATE_S0                   (UINT8) 0
332#define ACPI_STATE_S1                   (UINT8) 1
333#define ACPI_STATE_S2                   (UINT8) 2
334#define ACPI_STATE_S3                   (UINT8) 3
335#define ACPI_STATE_S4                   (UINT8) 4
336#define ACPI_STATE_S4BIOS               (UINT8) 5
337#define ACPI_STATE_S5                   (UINT8) 6
338#define ACPI_S_STATES_MAX               ACPI_STATE_S5
339
340
341/*
342 *  Table types.  These values are passed to the table related APIs
343 */
344
345typedef UINT32                          ACPI_TABLE_TYPE;
346
347#define ACPI_TABLE_RSDP                 (ACPI_TABLE_TYPE) 0
348#define ACPI_TABLE_APIC                 (ACPI_TABLE_TYPE) 1
349#define ACPI_TABLE_DSDT                 (ACPI_TABLE_TYPE) 2
350#define ACPI_TABLE_FACP                 (ACPI_TABLE_TYPE) 3
351#define ACPI_TABLE_FACS                 (ACPI_TABLE_TYPE) 4
352#define ACPI_TABLE_PSDT                 (ACPI_TABLE_TYPE) 5
353#define ACPI_TABLE_RSDT                 (ACPI_TABLE_TYPE) 6
354#define ACPI_TABLE_SSDT                 (ACPI_TABLE_TYPE) 7
355#define ACPI_TABLE_SBST                 (ACPI_TABLE_TYPE) 8
356#define ACPI_TABLE_SPIC                 (ACPI_TABLE_TYPE) 9
357#define ACPI_TABLE_BOOT                 (ACPI_TABLE_TYPE) 10
358#define ACPI_TABLE_MAX                  10
359#define NUM_ACPI_TABLES                 (ACPI_TABLE_MAX+1)
360
361
362/*
363 * Types associated with names.  The first group of
364 * values correspond to the definition of the ACPI
365 * ObjectType operator (See the ACPI Spec).  Therefore,
366 * only add to the first group if the spec changes!
367 *
368 * Types must be kept in sync with the AcpiNsProperties
369 * and AcpiNsTypeNames arrays
370 */
371
372typedef UINT32                          ACPI_OBJECT_TYPE;
373typedef UINT8                           OBJECT_TYPE_INTERNAL;
374
375#define ACPI_TYPE_ANY                   0  /* 0x00  */
376#define ACPI_TYPE_NUMBER                1  /* 0x01  Byte/Word/Dword/Zero/One/Ones */
377#define ACPI_TYPE_STRING                2  /* 0x02  */
378#define ACPI_TYPE_BUFFER                3  /* 0x03  */
379#define ACPI_TYPE_PACKAGE               4  /* 0x04  ByteConst, multiple DataTerm/Constant/SuperName */
380#define ACPI_TYPE_FIELD_UNIT            5  /* 0x05  */
381#define ACPI_TYPE_DEVICE                6  /* 0x06  Name, multiple Node */
382#define ACPI_TYPE_EVENT                 7  /* 0x07  */
383#define ACPI_TYPE_METHOD                8  /* 0x08  Name, ByteConst, multiple Code */
384#define ACPI_TYPE_MUTEX                 9  /* 0x09  */
385#define ACPI_TYPE_REGION                10 /* 0x0A  */
386#define ACPI_TYPE_POWER                 11 /* 0x0B  Name,ByteConst,WordConst,multi Node */
387#define ACPI_TYPE_PROCESSOR             12 /* 0x0C  Name,ByteConst,DWordConst,ByteConst,multi NmO */
388#define ACPI_TYPE_THERMAL               13 /* 0x0D  Name, multiple Node */
389#define ACPI_TYPE_BUFFER_FIELD          14 /* 0x0E  */
390#define ACPI_TYPE_DDB_HANDLE            15 /* 0x0F  */
391#define ACPI_TYPE_DEBUG_OBJECT          16 /* 0x10  */
392
393#define ACPI_TYPE_MAX                   16
394
395/*
396 * This section contains object types that do not relate to the ACPI ObjectType operator.
397 * They are used for various internal purposes only.  If new predefined ACPI_TYPEs are
398 * added (via the ACPI specification), these internal types must move upwards.
399 * Also, values exceeding the largest official ACPI ObjectType must not overlap with
400 * defined AML opcodes.
401 */
402#define INTERNAL_TYPE_BEGIN             17
403
404#define INTERNAL_TYPE_DEF_FIELD         17 /* 0x11  */
405#define INTERNAL_TYPE_BANK_FIELD        18 /* 0x12  */
406#define INTERNAL_TYPE_INDEX_FIELD       19 /* 0x13  */
407#define INTERNAL_TYPE_REFERENCE         20 /* 0x14  Arg#, Local#, Name, Debug; used only in descriptors */
408#define INTERNAL_TYPE_ALIAS             21 /* 0x15  */
409#define INTERNAL_TYPE_NOTIFY            22 /* 0x16  */
410#define INTERNAL_TYPE_ADDRESS_HANDLER   23 /* 0x17  */
411
412#define INTERNAL_TYPE_NODE_MAX          23
413
414/* These are pseudo-types because there are never any namespace nodes with these types */
415
416#define INTERNAL_TYPE_DEF_FIELD_DEFN    24 /* 0x18  Name, ByteConst, multiple FieldElement */
417#define INTERNAL_TYPE_BANK_FIELD_DEFN   25 /* 0x19  2 Name,DWordConst,ByteConst,multi FieldElement */
418#define INTERNAL_TYPE_INDEX_FIELD_DEFN  26 /* 0x1A  2 Name, ByteConst, multiple FieldElement */
419#define INTERNAL_TYPE_IF                27 /* 0x1B  OpCode, multiple Code */
420#define INTERNAL_TYPE_ELSE              28 /* 0x1C  multiple Code */
421#define INTERNAL_TYPE_WHILE             29 /* 0x1D  OpCode, multiple Code */
422#define INTERNAL_TYPE_SCOPE             30 /* 0x1E  Name, multiple Node */
423#define INTERNAL_TYPE_DEF_ANY           31 /* 0x1F  type is Any, suppress search of enclosing scopes */
424#define INTERNAL_TYPE_METHOD_ARGUMENT   32 /* 0x20  */
425#define INTERNAL_TYPE_METHOD_LOCAL_VAR  33 /* 0x21  */
426#define INTERNAL_TYPE_EXTRA             34 /* 0x22  */
427
428#define INTERNAL_TYPE_MAX               34
429
430#define INTERNAL_TYPE_INVALID           35
431#define ACPI_TYPE_NOT_FOUND             0xFF
432
433/*
434 * AcpiEvent Types:
435 * ------------
436 * Fixed & general purpose...
437 */
438
439typedef UINT32                          ACPI_EVENT_TYPE;
440
441#define ACPI_EVENT_FIXED                (ACPI_EVENT_TYPE) 0
442#define ACPI_EVENT_GPE                  (ACPI_EVENT_TYPE) 1
443
444/*
445 * Fixed events
446 */
447
448#define ACPI_EVENT_PMTIMER              (ACPI_EVENT_TYPE) 0
449    /*
450     * There's no bus master event so index 1 is used for IRQ's that are not
451     * handled by the SCI handler
452     */
453#define ACPI_EVENT_NOT_USED             (ACPI_EVENT_TYPE) 1
454#define ACPI_EVENT_GLOBAL               (ACPI_EVENT_TYPE) 2
455#define ACPI_EVENT_POWER_BUTTON         (ACPI_EVENT_TYPE) 3
456#define ACPI_EVENT_SLEEP_BUTTON         (ACPI_EVENT_TYPE) 4
457#define ACPI_EVENT_RTC                  (ACPI_EVENT_TYPE) 5
458#define ACPI_EVENT_GENERAL              (ACPI_EVENT_TYPE) 6
459#define ACPI_EVENT_MAX                  6
460#define NUM_FIXED_EVENTS                (ACPI_EVENT_TYPE) 7
461
462#define ACPI_GPE_INVALID                0xFF
463#define ACPI_GPE_MAX                    0xFF
464#define NUM_GPE                         256
465
466#define ACPI_EVENT_LEVEL_TRIGGERED      (ACPI_EVENT_TYPE) 1
467#define ACPI_EVENT_EDGE_TRIGGERED       (ACPI_EVENT_TYPE) 2
468
469/*
470 * AcpiEvent Status:
471 * -------------
472 * The encoding of ACPI_EVENT_STATUS is illustrated below.
473 * Note that a set bit (1) indicates the property is TRUE
474 * (e.g. if bit 0 is set then the event is enabled).
475 * +---------------+-+-+
476 * |   Bits 31:2   |1|0|
477 * +---------------+-+-+
478 *          |       | |
479 *          |       | +- Enabled?
480 *          |       +--- Set?
481 *          +----------- <Reserved>
482 */
483typedef UINT32                          ACPI_EVENT_STATUS;
484
485#define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
486#define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x02
487
488
489/* Notify types */
490
491#define ACPI_SYSTEM_NOTIFY              0
492#define ACPI_DEVICE_NOTIFY              1
493#define ACPI_MAX_NOTIFY_HANDLER_TYPE    1
494
495#define MAX_SYS_NOTIFY                  0x7f
496
497
498/* Address Space (Operation Region) Types */
499
500typedef UINT32                          ACPI_ADDRESS_SPACE_TYPE;
501
502#define ADDRESS_SPACE_SYSTEM_MEMORY     (ACPI_ADDRESS_SPACE_TYPE) 0
503#define ADDRESS_SPACE_SYSTEM_IO         (ACPI_ADDRESS_SPACE_TYPE) 1
504#define ADDRESS_SPACE_PCI_CONFIG        (ACPI_ADDRESS_SPACE_TYPE) 2
505#define ADDRESS_SPACE_EC                (ACPI_ADDRESS_SPACE_TYPE) 3
506#define ADDRESS_SPACE_SMBUS             (ACPI_ADDRESS_SPACE_TYPE) 4
507
508
509/*
510 * External ACPI object definition
511 */
512
513typedef union AcpiObj
514{
515    ACPI_OBJECT_TYPE            Type;   /* See definition of AcpiNsType for values */
516    struct
517    {
518        ACPI_OBJECT_TYPE            Type;
519        ACPI_INTEGER                Value;      /* The actual number */
520    } Number;
521
522    struct
523    {
524        ACPI_OBJECT_TYPE            Type;
525        UINT32                      Length;     /* # of bytes in string, excluding trailing null */
526        NATIVE_CHAR                 *Pointer;   /* points to the string value */
527    } String;
528
529    struct
530    {
531        ACPI_OBJECT_TYPE            Type;
532        UINT32                      Length;     /* # of bytes in buffer */
533        UINT8                       *Pointer;   /* points to the buffer */
534    } Buffer;
535
536    struct
537    {
538        ACPI_OBJECT_TYPE            Type;
539        UINT32                      Fill1;
540        ACPI_HANDLE                 Handle;     /* object reference */
541    } Reference;
542
543    struct
544    {
545        ACPI_OBJECT_TYPE            Type;
546        UINT32                      Count;      /* # of elements in package */
547        union AcpiObj               *Elements;  /* Pointer to an array of ACPI_OBJECTs */
548    } Package;
549
550    struct
551    {
552        ACPI_OBJECT_TYPE            Type;
553        UINT32                      ProcId;
554        UINT32                      PblkAddress;
555        UINT32                      PblkLength;
556    } Processor;
557
558    struct
559    {
560        ACPI_OBJECT_TYPE            Type;
561        UINT32                      SystemLevel;
562        UINT32                      ResourceOrder;
563    } PowerResource;
564
565} ACPI_OBJECT, *PACPI_OBJECT;
566
567
568/*
569 * List of objects, used as a parameter list for control method evaluation
570 */
571
572typedef struct AcpiObjList
573{
574    UINT32                      Count;
575    ACPI_OBJECT                 *Pointer;
576
577} ACPI_OBJECT_LIST, *PACPI_OBJECT_LIST;
578
579
580/*
581 * Miscellaneous common Data Structures used by the interfaces
582 */
583
584typedef struct
585{
586    UINT32                      Length;         /* Length in bytes of the buffer */
587    void                        *Pointer;       /* pointer to buffer */
588
589} ACPI_BUFFER;
590
591
592/*
593 * NameType for AcpiGetName
594 */
595
596#define ACPI_FULL_PATHNAME              0
597#define ACPI_SINGLE_NAME                1
598#define ACPI_NAME_TYPE_MAX              1
599
600
601/*
602 * Structure and flags for AcpiGetSystemInfo
603 */
604
605#define SYS_MODE_UNKNOWN                0x0000
606#define SYS_MODE_ACPI                   0x0001
607#define SYS_MODE_LEGACY                 0x0002
608#define SYS_MODES_MASK                  0x0003
609
610/*
611 *  ACPI CPU Cx state handler
612 */
613typedef
614ACPI_STATUS (*ACPI_SET_C_STATE_HANDLER) (
615    NATIVE_UINT                 PblkAddress);
616
617/*
618 *  ACPI Cx State info
619 */
620typedef struct
621{
622    UINT32                      StateNumber;
623    UINT32                      Latency;
624} ACPI_CX_STATE;
625
626/*
627 *  ACPI CPU throttling info
628 */
629typedef struct
630{
631    UINT32                      StateNumber;
632    UINT32                      PercentOfClock;
633} ACPI_CPU_THROTTLING_STATE;
634
635/*
636 * ACPI Table Info.  One per ACPI table _type_
637 */
638typedef struct AcpiTableInfo
639{
640    UINT32                      Count;
641
642} ACPI_TABLE_INFO;
643
644
645/*
646 * System info returned by AcpiGetSystemInfo()
647 */
648
649typedef struct _AcpiSysInfo
650{
651    UINT32                      AcpiCaVersion;
652    UINT32                      Flags;
653    UINT32                      TimerResolution;
654    UINT32                      Reserved1;
655    UINT32                      Reserved2;
656    UINT32                      DebugLevel;
657    UINT32                      DebugLayer;
658    UINT32                      NumTableTypes;
659    ACPI_TABLE_INFO             TableInfo [NUM_ACPI_TABLES];
660
661} ACPI_SYSTEM_INFO;
662
663
664/*
665 *  System Initiailization data.  This data is passed to ACPIInitialize
666 *  copyied to global data and retained by ACPI CA
667 */
668
669typedef struct _AcpiInitData
670{
671    void                        *RSDP_PhysicalAddress;  /*  Address of RSDP, needed it it is    */
672                                                        /*  not found in the IA32 manner        */
673} ACPI_INIT_DATA;
674
675/*
676 * Various handlers and callback procedures
677 */
678
679typedef
680UINT32 (*FIXED_EVENT_HANDLER) (
681    void                        *Context);
682
683typedef
684void (*GPE_HANDLER) (
685    void                        *Context);
686
687typedef
688void (*NOTIFY_HANDLER) (
689    ACPI_HANDLE                 Device,
690    UINT32                      Value,
691    void                        *Context);
692
693#define ADDRESS_SPACE_READ              1
694#define ADDRESS_SPACE_WRITE             2
695
696typedef
697ACPI_STATUS (*ADDRESS_SPACE_HANDLER) (
698    UINT32                      Function,
699    ACPI_INTEGER                Address,
700    UINT32                      BitWidth,
701    UINT32                      *Value,
702    void                        *HandlerContext,
703    void                        *RegionContext);
704
705#define ACPI_DEFAULT_HANDLER            ((ADDRESS_SPACE_HANDLER) NULL)
706
707
708typedef
709ACPI_STATUS (*ADDRESS_SPACE_SETUP) (
710    ACPI_HANDLE                 RegionHandle,
711    UINT32                      Function,
712    void                        *HandlerContext,
713    void                        **RegionContext);
714
715#define ACPI_REGION_ACTIVATE    0
716#define ACPI_REGION_DEACTIVATE  1
717
718typedef
719ACPI_STATUS (*WALK_CALLBACK) (
720    ACPI_HANDLE                 ObjHandle,
721    UINT32                      NestingLevel,
722    void                        *Context,
723    void                        **ReturnValue);
724
725
726/* Interrupt handler return values */
727
728#define INTERRUPT_NOT_HANDLED           0x00
729#define INTERRUPT_HANDLED               0x01
730
731
732/* Structure and flags for AcpiGetDeviceInfo */
733
734#define ACPI_VALID_HID                  0x1
735#define ACPI_VALID_UID                  0x2
736#define ACPI_VALID_ADR                  0x4
737#define ACPI_VALID_STA                  0x8
738
739
740#define ACPI_COMMON_OBJ_INFO \
741    ACPI_OBJECT_TYPE            Type;           /* ACPI object type */ \
742    ACPI_NAME                   Name            /* ACPI object Name */
743
744
745typedef struct
746{
747    ACPI_COMMON_OBJ_INFO;
748} ACPI_OBJ_INFO_HEADER;
749
750
751typedef struct
752{
753    ACPI_COMMON_OBJ_INFO;
754
755    UINT32                      Valid;              /*  Are the next bits legit? */
756    NATIVE_CHAR                 HardwareId [9];     /*  _HID value if any */
757    NATIVE_CHAR                 UniqueId[9];        /*  _UID value if any */
758    ACPI_INTEGER                Address;            /*  _ADR value if any */
759    UINT32                      CurrentStatus;      /*  _STA value */
760} ACPI_DEVICE_INFO;
761
762
763/* Context structs for address space handlers */
764
765typedef struct
766{
767    UINT32                      Seg;
768    UINT32                      Bus;
769    UINT32                      DevFunc;
770} PCI_HANDLER_CONTEXT;
771
772
773typedef struct
774{
775    UINT8                       *MappedPhysicalAddress;
776    UINT8                       *MappedLogicalAddress;
777    UINT32                      MappedLength;
778} MEM_HANDLER_CONTEXT;
779
780
781/*
782 * C-state handler
783 */
784
785typedef ACPI_STATUS (*ACPI_C_STATE_HANDLER) (ACPI_IO_ADDRESS, UINT32*);
786
787
788/*
789 * Definitions for Resource Attributes
790 */
791
792/*
793 *  Memory Attributes
794 */
795#define READ_ONLY_MEMORY                (UINT8) 0x00
796#define READ_WRITE_MEMORY               (UINT8) 0x01
797
798#define NON_CACHEABLE_MEMORY            (UINT8) 0x00
799#define CACHABLE_MEMORY                 (UINT8) 0x01
800#define WRITE_COMBINING_MEMORY          (UINT8) 0x02
801#define PREFETCHABLE_MEMORY             (UINT8) 0x03
802
803/*
804 *  IO Attributes
805 *  The ISA IO ranges are: n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
806 *  The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
807 */
808#define NON_ISA_ONLY_RANGES             (UINT8) 0x01
809#define ISA_ONLY_RANGES                 (UINT8) 0x02
810#define ENTIRE_RANGE                    (NON_ISA_ONLY_RANGES | ISA_ONLY_RANGES)
811
812/*
813 *  IO Port Descriptor Decode
814 */
815#define DECODE_10                       (UINT8) 0x00    /* 10-bit IO address decode */
816#define DECODE_16                       (UINT8) 0x01    /* 16-bit IO address decode */
817
818/*
819 *  IRQ Attributes
820 */
821#define EDGE_SENSITIVE                  (UINT8) 0x00
822#define LEVEL_SENSITIVE                 (UINT8) 0x01
823
824#define ACTIVE_HIGH                     (UINT8) 0x00
825#define ACTIVE_LOW                      (UINT8) 0x01
826
827#define EXCLUSIVE                       (UINT8) 0x00
828#define SHARED                          (UINT8) 0x01
829
830/*
831 *  DMA Attributes
832 */
833#define COMPATIBILITY                   (UINT8) 0x00
834#define TYPE_A                          (UINT8) 0x01
835#define TYPE_B                          (UINT8) 0x02
836#define TYPE_F                          (UINT8) 0x03
837
838#define NOT_BUS_MASTER                  (UINT8) 0x00
839#define BUS_MASTER                      (UINT8) 0x01
840
841#define TRANSFER_8                      (UINT8) 0x00
842#define TRANSFER_8_16                   (UINT8) 0x01
843#define TRANSFER_16                     (UINT8) 0x02
844
845/*
846 * Start Dependent Functions Priority definitions
847 */
848#define GOOD_CONFIGURATION              (UINT8) 0x00
849#define ACCEPTABLE_CONFIGURATION        (UINT8) 0x01
850#define SUB_OPTIMAL_CONFIGURATION       (UINT8) 0x02
851
852/*
853 *  16, 32 and 64-bit Address Descriptor resource types
854 */
855#define MEMORY_RANGE                    (UINT8) 0x00
856#define IO_RANGE                        (UINT8) 0x01
857#define BUS_NUMBER_RANGE                (UINT8) 0x02
858
859#define ADDRESS_NOT_FIXED               (UINT8) 0x00
860#define ADDRESS_FIXED                   (UINT8) 0x01
861
862#define POS_DECODE                      (UINT8) 0x00
863#define SUB_DECODE                      (UINT8) 0x01
864
865#define PRODUCER                        (UINT8) 0x00
866#define CONSUMER                        (UINT8) 0x01
867
868
869/*
870 *  Structures used to describe device resources
871 */
872typedef struct
873{
874    UINT32                      EdgeLevel;
875    UINT32                      ActiveHighLow;
876    UINT32                      SharedExclusive;
877    UINT32                      NumberOfInterrupts;
878    UINT32                      Interrupts[1];
879
880} IRQ_RESOURCE;
881
882typedef struct
883{
884    UINT32                      Type;
885    UINT32                      BusMaster;
886    UINT32                      Transfer;
887    UINT32                      NumberOfChannels;
888    UINT32                      Channels[1];
889
890} DMA_RESOURCE;
891
892typedef struct
893{
894    UINT32                      CompatibilityPriority;
895    UINT32                      PerformanceRobustness;
896
897} START_DEPENDENT_FUNCTIONS_RESOURCE;
898
899/*
900 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
901 *  needed because it has no fields
902 */
903
904typedef struct
905{
906    UINT32                      IoDecode;
907    UINT32                      MinBaseAddress;
908    UINT32                      MaxBaseAddress;
909    UINT32                      Alignment;
910    UINT32                      RangeLength;
911
912} IO_RESOURCE;
913
914typedef struct
915{
916    UINT32                      BaseAddress;
917    UINT32                      RangeLength;
918
919} FIXED_IO_RESOURCE;
920
921typedef struct
922{
923    UINT32                      Length;
924    UINT8                       Reserved[1];
925
926} VENDOR_RESOURCE;
927
928typedef struct
929{
930    UINT32                      ReadWriteAttribute;
931    UINT32                      MinBaseAddress;
932    UINT32                      MaxBaseAddress;
933    UINT32                      Alignment;
934    UINT32                      RangeLength;
935
936} MEMORY24_RESOURCE;
937
938typedef struct
939{
940    UINT32                      ReadWriteAttribute;
941    UINT32                      MinBaseAddress;
942    UINT32                      MaxBaseAddress;
943    UINT32                      Alignment;
944    UINT32                      RangeLength;
945
946} MEMORY32_RESOURCE;
947
948typedef struct
949{
950    UINT32                      ReadWriteAttribute;
951    UINT32                      RangeBaseAddress;
952    UINT32                      RangeLength;
953
954} FIXED_MEMORY32_RESOURCE;
955
956typedef struct
957{
958    UINT16                      CacheAttribute;
959    UINT16                      ReadWriteAttribute;
960
961} MEMORY_ATTRIBUTE;
962
963typedef struct
964{
965    UINT16                      RangeAttribute;
966    UINT16                      Reserved;
967
968} IO_ATTRIBUTE;
969
970typedef struct
971{
972    UINT16                      Reserved1;
973    UINT16                      Reserved2;
974
975} BUS_ATTRIBUTE;
976
977typedef union
978{
979    MEMORY_ATTRIBUTE            Memory;
980    IO_ATTRIBUTE                Io;
981    BUS_ATTRIBUTE               Bus;
982
983} ATTRIBUTE_DATA;
984
985typedef struct
986{
987    UINT32                      ResourceType;
988    UINT32                      ProducerConsumer;
989    UINT32                      Decode;
990    UINT32                      MinAddressFixed;
991    UINT32                      MaxAddressFixed;
992    ATTRIBUTE_DATA              Attribute;
993    UINT32                      Granularity;
994    UINT32                      MinAddressRange;
995    UINT32                      MaxAddressRange;
996    UINT32                      AddressTranslationOffset;
997    UINT32                      AddressLength;
998    UINT32                      ResourceSourceIndex;
999    UINT32                      ResourceSourceStringLength;
1000    NATIVE_CHAR                 ResourceSource[1];
1001
1002} ADDRESS16_RESOURCE;
1003
1004typedef struct
1005{
1006    UINT32                      ResourceType;
1007    UINT32                      ProducerConsumer;
1008    UINT32                      Decode;
1009    UINT32                      MinAddressFixed;
1010    UINT32                      MaxAddressFixed;
1011    ATTRIBUTE_DATA              Attribute;
1012    UINT32                      Granularity;
1013    UINT32                      MinAddressRange;
1014    UINT32                      MaxAddressRange;
1015    UINT32                      AddressTranslationOffset;
1016    UINT32                      AddressLength;
1017    UINT32                      ResourceSourceIndex;
1018    UINT32                      ResourceSourceStringLength;
1019    NATIVE_CHAR                 ResourceSource[1];
1020
1021} ADDRESS32_RESOURCE;
1022
1023typedef struct
1024{
1025    UINT32                      ProducerConsumer;
1026    UINT32                      EdgeLevel;
1027    UINT32                      ActiveHighLow;
1028    UINT32                      SharedExclusive;
1029    UINT32                      NumberOfInterrupts;
1030    UINT32                      Interrupts[1];
1031    UINT32                      ResourceSourceIndex;
1032    UINT32                      ResourceSourceStringLength;
1033    NATIVE_CHAR                 ResourceSource[1];
1034
1035} EXTENDED_IRQ_RESOURCE;
1036
1037typedef enum
1038{
1039    Irq,
1040    Dma,
1041    StartDependentFunctions,
1042    EndDependentFunctions,
1043    Io,
1044    FixedIo,
1045    VendorSpecific,
1046    EndTag,
1047    Memory24,
1048    Memory32,
1049    FixedMemory32,
1050    Address16,
1051    Address32,
1052    ExtendedIrq
1053} RESOURCE_TYPE;
1054
1055typedef union
1056{
1057    IRQ_RESOURCE                        Irq;
1058    DMA_RESOURCE                        Dma;
1059    START_DEPENDENT_FUNCTIONS_RESOURCE  StartDependentFunctions;
1060    IO_RESOURCE                         Io;
1061    FIXED_IO_RESOURCE                   FixedIo;
1062    VENDOR_RESOURCE                     VendorSpecific;
1063    MEMORY24_RESOURCE                   Memory24;
1064    MEMORY32_RESOURCE                   Memory32;
1065    FIXED_MEMORY32_RESOURCE             FixedMemory32;
1066    ADDRESS16_RESOURCE                  Address16;
1067    ADDRESS32_RESOURCE                  Address32;
1068    EXTENDED_IRQ_RESOURCE               ExtendedIrq;
1069} RESOURCE_DATA;
1070
1071typedef struct _resource_tag
1072{
1073    RESOURCE_TYPE               Id;
1074    UINT32                      Length;
1075    RESOURCE_DATA               Data;
1076} RESOURCE;
1077
1078#define RESOURCE_LENGTH                 12
1079#define RESOURCE_LENGTH_NO_DATA         8
1080
1081#define NEXT_RESOURCE(Res)    (RESOURCE*)((UINT8*) Res + Res->length)
1082
1083/*
1084 * END: Definitions for Resource Attributes
1085 */
1086
1087/*
1088 * Definitions for PCI Routing tables
1089 */
1090typedef struct
1091{
1092    ACPI_INTEGER                Address;
1093    UINT32                      Pin;
1094    UINT32                      SourceIndex;
1095    NATIVE_CHAR                 Source[1];
1096
1097} PRT_ENTRY;
1098
1099typedef struct _prt_tag
1100{
1101    UINT32                      Length;
1102    PRT_ENTRY                   Data;
1103
1104} PCI_ROUTING_TABLE;
1105
1106
1107/*
1108 * END: Definitions for PCI Routing tables
1109 */
1110
1111#endif /* __ACTYPES_H__ */
1112