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