Raise WARNS to 6:
[dragonfly.git] / sys / contrib / dev / acpica / actypes.h
1 /******************************************************************************
2  *
3  * Name: actypes.h - Common data types for the entire ACPI subsystem
4  *       $Revision: 253 $
5  *
6  *****************************************************************************/
7
8 /******************************************************************************
9  *
10  * 1. Copyright Notice
11  *
12  * Some or all of this work - Copyright (c) 1999 - 2003, 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 /* $DragonFly: src/sys/contrib/dev/acpica/Attic/actypes.h,v 1.2 2003/11/15 21:05:40 dillon Exp $                                                               */
117
118 #ifndef __ACTYPES_H__
119 #define __ACTYPES_H__
120
121 /*! [Begin] no source code translation (keep the typedefs) */
122
123
124
125 /*
126  * Data type ranges
127  */
128 #define ACPI_UINT8_MAX                  (UINT8)  0xFF
129 #define ACPI_UINT16_MAX                 (UINT16) 0xFFFF
130 #define ACPI_UINT32_MAX                 (UINT32) 0xFFFFFFFFU
131 #define ACPI_UINT64_MAX                 (UINT64) 0xFFFFFFFFFFFFFFFFULL
132 #define ACPI_ASCII_MAX                  0x7F
133
134
135 #ifdef DEFINE_ALTERNATE_TYPES
136 /*
137  * Types used only in translated source, defined here to enable
138  * cross-platform compilation only.
139  */
140 typedef int                             s32;
141 typedef unsigned char                   u8;
142 typedef unsigned short                  u16;
143 typedef unsigned int                    u32;
144 typedef COMPILER_DEPENDENT_UINT64       u64;
145
146 #endif
147
148
149 /*
150  * Data types - Fixed across all compilation models (16/32/64)
151  *
152  * BOOLEAN          Logical Boolean.
153  * INT8             8-bit  (1 byte) signed value
154  * UINT8            8-bit  (1 byte) unsigned value
155  * INT16            16-bit (2 byte) signed value
156  * UINT16           16-bit (2 byte) unsigned value
157  * INT32            32-bit (4 byte) signed value
158  * UINT32           32-bit (4 byte) unsigned value
159  * INT64            64-bit (8 byte) signed value
160  * UINT64           64-bit (8 byte) unsigned value
161  * ACPI_NATIVE_INT  32-bit on IA-32, 64-bit on IA-64 signed value
162  * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
163  */
164
165 /*
166 #ifndef ACPI_MACHINE_WIDTH
167 #error ACPI_MACHINE_WIDTH not defined
168 #endif
169 */
170
171 #if ACPI_MACHINE_WIDTH == 64
172
173 /*! [Begin] no source code translation (keep the typedefs) */
174
175 /*
176  * 64-bit type definitions
177  */
178 typedef unsigned char                   UINT8;
179 typedef unsigned char                   BOOLEAN;
180 typedef unsigned short                  UINT16;
181 typedef int                             INT32;
182 typedef unsigned int                    UINT32;
183 typedef COMPILER_DEPENDENT_INT64        INT64;
184 typedef COMPILER_DEPENDENT_UINT64       UINT64;
185
186 /*! [End] no source code translation !*/
187
188 typedef INT64                           ACPI_NATIVE_INT;
189 typedef UINT64                          ACPI_NATIVE_UINT;
190
191 typedef UINT64                          ACPI_TABLE_PTR;
192 typedef UINT64                          ACPI_IO_ADDRESS;
193 typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
194 typedef UINT64                          ACPI_SIZE;
195
196 #define ALIGNED_ADDRESS_BOUNDARY        0x00000008      /* No hardware alignment support in IA64 */
197 #define ACPI_USE_NATIVE_DIVIDE                          /* Native 64-bit integer support */
198 #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
199 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
200
201
202 #elif ACPI_MACHINE_WIDTH == 16
203
204 /*! [Begin] no source code translation (keep the typedefs) */
205
206 /*
207  * 16-bit type definitions
208  */
209 typedef unsigned char                   UINT8;
210 typedef unsigned char                   BOOLEAN;
211 typedef unsigned int                    UINT16;
212 typedef long                            INT32;
213 typedef int                             INT16;
214 typedef unsigned long                   UINT32;
215
216 typedef struct
217 {
218     UINT32                                  Lo;
219     UINT32                                  Hi;
220
221 } UINT64;
222
223 /*! [End] no source code translation !*/
224
225 typedef UINT16                          ACPI_NATIVE_UINT;
226 typedef INT16                           ACPI_NATIVE_INT;
227
228 typedef UINT32                          ACPI_TABLE_PTR;
229 typedef UINT32                          ACPI_IO_ADDRESS;
230 typedef char                            *ACPI_PHYSICAL_ADDRESS;
231 typedef UINT16                          ACPI_SIZE;
232
233 #define ALIGNED_ADDRESS_BOUNDARY        0x00000002
234 #define _HW_ALIGNMENT_SUPPORT
235 #define ACPI_USE_NATIVE_DIVIDE                          /* No 64-bit integers, ok to use native divide */
236 #define ACPI_MAX_PTR                    ACPI_UINT16_MAX
237 #define ACPI_SIZE_MAX                   ACPI_UINT16_MAX
238
239 /*
240  * (16-bit only) internal integers must be 32-bits, so
241  * 64-bit integers cannot be supported
242  */
243 #define ACPI_NO_INTEGER64_SUPPORT
244
245
246 #elif ACPI_MACHINE_WIDTH == 32
247
248 /*! [Begin] no source code translation (keep the typedefs) */
249
250 /*
251  * 32-bit type definitions (default)
252  */
253 typedef unsigned char                   UINT8;
254 typedef unsigned char                   BOOLEAN;
255 typedef unsigned short                  UINT16;
256 typedef int                             INT32;
257 typedef unsigned int                    UINT32;
258 typedef COMPILER_DEPENDENT_INT64        INT64;
259 typedef COMPILER_DEPENDENT_UINT64       UINT64;
260
261 /*! [End] no source code translation !*/
262
263 typedef INT32                           ACPI_NATIVE_INT;
264 typedef UINT32                          ACPI_NATIVE_UINT;
265
266 typedef UINT64                          ACPI_TABLE_PTR;
267 typedef UINT32                          ACPI_IO_ADDRESS;
268 typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
269 typedef UINT32                          ACPI_SIZE;
270
271 #define ALIGNED_ADDRESS_BOUNDARY        0x00000004
272 #define _HW_ALIGNMENT_SUPPORT
273 #define ACPI_MAX_PTR                    ACPI_UINT32_MAX
274 #define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
275
276 #else
277 #error unknown ACPI_MACHINE_WIDTH
278 #endif
279
280
281 /*
282  * Miscellaneous common types
283  */
284 typedef UINT32                          UINT32_BIT;
285 typedef ACPI_NATIVE_UINT                ACPI_PTRDIFF;
286
287 /*
288  * Pointer overlays to avoid lots of typecasting for
289  * code that accepts both physical and logical pointers.
290  */
291 typedef union acpi_pointers
292 {
293     ACPI_PHYSICAL_ADDRESS       Physical;
294     void                        *Logical;
295     ACPI_TABLE_PTR              Value;
296
297 } ACPI_POINTERS;
298
299 typedef struct acpi_pointer
300 {
301     UINT32                      PointerType;
302     union acpi_pointers         Pointer;
303
304 } ACPI_POINTER;
305
306 /* PointerTypes for above */
307
308 #define ACPI_PHYSICAL_POINTER           0x01
309 #define ACPI_LOGICAL_POINTER            0x02
310
311 /* Processor mode */
312
313 #define ACPI_PHYSICAL_ADDRESSING        0x04
314 #define ACPI_LOGICAL_ADDRESSING         0x08
315 #define ACPI_MEMORY_MODE                0x0C
316
317 #define ACPI_PHYSMODE_PHYSPTR           ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
318 #define ACPI_LOGMODE_PHYSPTR            ACPI_LOGICAL_ADDRESSING  | ACPI_PHYSICAL_POINTER
319 #define ACPI_LOGMODE_LOGPTR             ACPI_LOGICAL_ADDRESSING  | ACPI_LOGICAL_POINTER
320
321
322 /*
323  * Useful defines
324  */
325 #ifdef FALSE
326 #undef FALSE
327 #endif
328 #define FALSE                           (1 == 0)
329
330 #ifdef TRUE
331 #undef TRUE
332 #endif
333 #define TRUE                            (1 == 1)
334
335 #ifndef NULL
336 #define NULL                            (void *) 0
337 #endif
338
339
340 /*
341  * Local datatypes
342  */
343 typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
344 typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
345 typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
346 typedef void *                          ACPI_HANDLE;    /* Actually a ptr to an Node */
347
348 typedef struct uint64_struct
349 {
350     UINT32                      Lo;
351     UINT32                      Hi;
352
353 } UINT64_STRUCT;
354
355 typedef union uint64_overlay
356 {
357     UINT64                      Full;
358     UINT64_STRUCT               Part;
359
360 } UINT64_OVERLAY;
361
362 typedef struct uint32_struct
363 {
364     UINT32                      Lo;
365     UINT32                      Hi;
366
367 } UINT32_STRUCT;
368
369
370 /*
371  * Acpi integer width. In ACPI version 1, integers are
372  * 32 bits.  In ACPI version 2, integers are 64 bits.
373  * Note that this pertains to the ACPI integer type only, not
374  * other integers used in the implementation of the ACPI CA
375  * subsystem.
376  */
377 #ifdef ACPI_NO_INTEGER64_SUPPORT
378
379 /* 32-bit integers only, no 64-bit support */
380
381 typedef UINT32                          ACPI_INTEGER;
382 #define ACPI_INTEGER_MAX                ACPI_UINT32_MAX
383 #define ACPI_INTEGER_BIT_SIZE           32
384 #define ACPI_MAX_BCD_VALUE              99999999
385 #define ACPI_MAX_BCD_DIGITS             8
386 #define ACPI_MAX_DECIMAL_DIGITS         10
387
388 #define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 32-bit divide */
389
390
391 #else
392
393 /* 64-bit integers */
394
395 typedef UINT64                          ACPI_INTEGER;
396 #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
397 #define ACPI_INTEGER_BIT_SIZE           64
398 #define ACPI_MAX_BCD_VALUE              9999999999999999LL
399 #define ACPI_MAX_BCD_DIGITS             16
400 #define ACPI_MAX_DECIMAL_DIGITS         19
401
402 #if ACPI_MACHINE_WIDTH == 64
403 #define ACPI_USE_NATIVE_DIVIDE          /* Use compiler native 64-bit divide */
404 #endif
405 #endif
406
407
408 /*
409  * Constants with special meanings
410  */
411 #define ACPI_ROOT_OBJECT                (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
412
413
414 /*
415  * Initialization sequence
416  */
417 #define ACPI_FULL_INITIALIZATION        0x00
418 #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
419 #define ACPI_NO_HARDWARE_INIT           0x02
420 #define ACPI_NO_EVENT_INIT              0x04
421 #define ACPI_NO_HANDLER_INIT            0x08
422 #define ACPI_NO_ACPI_ENABLE             0x10
423 #define ACPI_NO_DEVICE_INIT             0x20
424 #define ACPI_NO_OBJECT_INIT             0x40
425
426 /*
427  * Initialization state
428  */
429 #define ACPI_INITIALIZED_OK             0x01
430
431 /*
432  * Power state values
433  */
434
435 #define ACPI_STATE_UNKNOWN              (UINT8) 0xFF
436
437 #define ACPI_STATE_S0                   (UINT8) 0
438 #define ACPI_STATE_S1                   (UINT8) 1
439 #define ACPI_STATE_S2                   (UINT8) 2
440 #define ACPI_STATE_S3                   (UINT8) 3
441 #define ACPI_STATE_S4                   (UINT8) 4
442 #define ACPI_STATE_S5                   (UINT8) 5
443 #define ACPI_S_STATES_MAX               ACPI_STATE_S5
444 #define ACPI_S_STATE_COUNT              6
445
446 #define ACPI_STATE_D0                   (UINT8) 0
447 #define ACPI_STATE_D1                   (UINT8) 1
448 #define ACPI_STATE_D2                   (UINT8) 2
449 #define ACPI_STATE_D3                   (UINT8) 3
450 #define ACPI_D_STATES_MAX               ACPI_STATE_D3
451 #define ACPI_D_STATE_COUNT              4
452
453 #define ACPI_STATE_C0                   (UINT8) 0
454 #define ACPI_STATE_C1                   (UINT8) 1
455 #define ACPI_STATE_C2                   (UINT8) 2
456 #define ACPI_STATE_C3                   (UINT8) 3
457 #define ACPI_C_STATES_MAX               ACPI_STATE_C3
458 #define ACPI_C_STATE_COUNT              4
459
460 /*
461  * Sleep type invalid value
462  */
463 #define ACPI_SLEEP_TYPE_MAX             0x7
464 #define ACPI_SLEEP_TYPE_INVALID         0xFF
465
466 /*
467  * Standard notify values
468  */
469 #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0
470 #define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 1
471 #define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 2
472 #define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 3
473 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 4
474 #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 5
475 #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 6
476 #define ACPI_NOTIFY_POWER_FAULT         (UINT8) 7
477
478
479 /*
480  *  Table types.  These values are passed to the table related APIs
481  */
482 typedef UINT32                          ACPI_TABLE_TYPE;
483
484 #define ACPI_TABLE_RSDP                 (ACPI_TABLE_TYPE) 0
485 #define ACPI_TABLE_DSDT                 (ACPI_TABLE_TYPE) 1
486 #define ACPI_TABLE_FADT                 (ACPI_TABLE_TYPE) 2
487 #define ACPI_TABLE_FACS                 (ACPI_TABLE_TYPE) 3
488 #define ACPI_TABLE_PSDT                 (ACPI_TABLE_TYPE) 4
489 #define ACPI_TABLE_SSDT                 (ACPI_TABLE_TYPE) 5
490 #define ACPI_TABLE_XSDT                 (ACPI_TABLE_TYPE) 6
491 #define ACPI_TABLE_MAX                  6
492 #define NUM_ACPI_TABLES                 (ACPI_TABLE_MAX+1)
493
494
495 /*
496  * Types associated with ACPI names and objects.  The first group of
497  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
498  * of the ACPI ObjectType() operator (See the ACPI Spec).  Therefore,
499  * only add to the first group if the spec changes.
500  *
501  * Types must be kept in sync with the global AcpiNsProperties
502  * and AcpiNsTypeNames arrays.
503  */
504 typedef UINT32                          ACPI_OBJECT_TYPE;
505
506 #define ACPI_TYPE_ANY                   0x00
507 #define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
508 #define ACPI_TYPE_STRING                0x02
509 #define ACPI_TYPE_BUFFER                0x03
510 #define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
511 #define ACPI_TYPE_FIELD_UNIT            0x05
512 #define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
513 #define ACPI_TYPE_EVENT                 0x07
514 #define ACPI_TYPE_METHOD                0x08  /* Name, ByteConst, multiple Code */
515 #define ACPI_TYPE_MUTEX                 0x09
516 #define ACPI_TYPE_REGION                0x0A
517 #define ACPI_TYPE_POWER                 0x0B  /* Name,ByteConst,WordConst,multi Node */
518 #define ACPI_TYPE_PROCESSOR             0x0C  /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
519 #define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
520 #define ACPI_TYPE_BUFFER_FIELD          0x0E
521 #define ACPI_TYPE_DDB_HANDLE            0x0F
522 #define ACPI_TYPE_DEBUG_OBJECT          0x10
523
524 #define ACPI_TYPE_EXTERNAL_MAX          0x10
525
526 /*
527  * These are object types that do not map directly to the ACPI
528  * ObjectType() operator. They are used for various internal purposes only.
529  * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
530  * internal types must move upwards. (There is code that depends on these
531  * values being contiguous with the external types above.)
532  */
533 #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
534 #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
535 #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
536 #define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
537 #define ACPI_TYPE_LOCAL_ALIAS           0x15
538 #define ACPI_TYPE_LOCAL_NOTIFY          0x16
539 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x17
540 #define ACPI_TYPE_LOCAL_RESOURCE        0x18
541 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x19
542 #define ACPI_TYPE_LOCAL_SCOPE           0x1A  /* 1 Name, multiple ObjectList Nodes */
543
544 #define ACPI_TYPE_NS_NODE_MAX           0x1A  /* Last typecode used within a NS Node */
545
546 /*
547  * These are special object types that never appear in
548  * a Namespace node, only in an ACPI_OPERAND_OBJECT
549  */
550 #define ACPI_TYPE_LOCAL_EXTRA           0x1B
551 #define ACPI_TYPE_LOCAL_DATA            0x1C
552
553 #define ACPI_TYPE_LOCAL_MAX             0x1C
554
555 /* All types above here are invalid */
556
557 #define ACPI_TYPE_INVALID               0x1D
558 #define ACPI_TYPE_NOT_FOUND             0xFF
559
560
561 /*
562  * Bitmapped ACPI types.  Used internally only
563  */
564 #define ACPI_BTYPE_ANY                  0x00000000
565 #define ACPI_BTYPE_INTEGER              0x00000001
566 #define ACPI_BTYPE_STRING               0x00000002
567 #define ACPI_BTYPE_BUFFER               0x00000004
568 #define ACPI_BTYPE_PACKAGE              0x00000008
569 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
570 #define ACPI_BTYPE_DEVICE               0x00000020
571 #define ACPI_BTYPE_EVENT                0x00000040
572 #define ACPI_BTYPE_METHOD               0x00000080
573 #define ACPI_BTYPE_MUTEX                0x00000100
574 #define ACPI_BTYPE_REGION               0x00000200
575 #define ACPI_BTYPE_POWER                0x00000400
576 #define ACPI_BTYPE_PROCESSOR            0x00000800
577 #define ACPI_BTYPE_THERMAL              0x00001000
578 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
579 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
580 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
581 #define ACPI_BTYPE_REFERENCE            0x00010000
582 #define ACPI_BTYPE_RESOURCE             0x00020000
583
584 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
585
586 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
587 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
588 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
589 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
590 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
591
592 /*
593  * All I/O
594  */
595 #define ACPI_READ                       0
596 #define ACPI_WRITE                      1
597 #define ACPI_IO_MASK                    1
598
599
600 /*
601  * AcpiEvent Types: Fixed & General Purpose
602  */
603 typedef UINT32                          ACPI_EVENT_TYPE;
604
605 #define ACPI_EVENT_FIXED                0
606 #define ACPI_EVENT_GPE                  1
607
608 /*
609  * Fixed events
610  */
611 #define ACPI_EVENT_PMTIMER              0
612 #define ACPI_EVENT_GLOBAL               1
613 #define ACPI_EVENT_POWER_BUTTON         2
614 #define ACPI_EVENT_SLEEP_BUTTON         3
615 #define ACPI_EVENT_RTC                  4
616 #define ACPI_EVENT_MAX                  4
617 #define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
618
619 #define ACPI_GPE_INVALID                0xFF
620 #define ACPI_GPE_MAX                    0xFF
621 #define ACPI_NUM_GPE                    256
622
623 #define ACPI_EVENT_LEVEL_TRIGGERED      1
624 #define ACPI_EVENT_EDGE_TRIGGERED       2
625
626 /*
627  * GPEs
628  */
629 #define ACPI_EVENT_WAKE_ENABLE          0x1
630 #define ACPI_EVENT_WAKE_DISABLE         0x1
631
632
633 /*
634  * AcpiEvent Status:
635  * -------------
636  * The encoding of ACPI_EVENT_STATUS is illustrated below.
637  * Note that a set bit (1) indicates the property is TRUE
638  * (e.g. if bit 0 is set then the event is enabled).
639  * +-------------+-+-+-+
640  * |   Bits 31:3 |2|1|0|
641  * +-------------+-+-+-+
642  *          |     | | |
643  *          |     | | +- Enabled?
644  *          |     | +--- Enabled for wake?
645  *          |     +----- Set?
646  *          +----------- <Reserved>
647  */
648 typedef UINT32                          ACPI_EVENT_STATUS;
649
650 #define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
651 #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
652 #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
653 #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
654
655
656 /* Notify types */
657
658 #define ACPI_SYSTEM_NOTIFY              0
659 #define ACPI_DEVICE_NOTIFY              1
660 #define ACPI_MAX_NOTIFY_HANDLER_TYPE    1
661
662 #define ACPI_MAX_SYS_NOTIFY             0x7f
663
664
665 /* Address Space (Operation Region) Types */
666
667 typedef UINT8                           ACPI_ADR_SPACE_TYPE;
668
669 #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
670 #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
671 #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
672 #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
673 #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
674 #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
675 #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
676 #define ACPI_ADR_SPACE_DATA_TABLE       (ACPI_ADR_SPACE_TYPE) 7
677 #define ACPI_ADR_SPACE_FIXED_HARDWARE   (ACPI_ADR_SPACE_TYPE) 127
678
679
680 /*
681  * BitRegister IDs
682  * These are bitfields defined within the full ACPI registers
683  */
684 #define ACPI_BITREG_TIMER_STATUS                0x00
685 #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
686 #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
687 #define ACPI_BITREG_POWER_BUTTON_STATUS         0x03
688 #define ACPI_BITREG_SLEEP_BUTTON_STATUS         0x04
689 #define ACPI_BITREG_RT_CLOCK_STATUS             0x05
690 #define ACPI_BITREG_WAKE_STATUS                 0x06
691
692 #define ACPI_BITREG_TIMER_ENABLE                0x07
693 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x08
694 #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x09
695 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0A
696 #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0B
697 #define ACPI_BITREG_WAKE_ENABLE                 0x0C
698
699 #define ACPI_BITREG_SCI_ENABLE                  0x0D
700 #define ACPI_BITREG_BUS_MASTER_RLD              0x0E
701 #define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x0F
702 #define ACPI_BITREG_SLEEP_TYPE_A                0x10
703 #define ACPI_BITREG_SLEEP_TYPE_B                0x11
704 #define ACPI_BITREG_SLEEP_ENABLE                0x12
705
706 #define ACPI_BITREG_ARB_DISABLE                 0x13
707
708 #define ACPI_BITREG_MAX                         0x13
709 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
710
711
712 /*
713  * External ACPI object definition
714  */
715 typedef union acpi_object
716 {
717     ACPI_OBJECT_TYPE            Type;   /* See definition of AcpiNsType for values */
718     struct
719     {
720         ACPI_OBJECT_TYPE            Type;
721         ACPI_INTEGER                Value;      /* The actual number */
722     } Integer;
723
724     struct
725     {
726         ACPI_OBJECT_TYPE            Type;
727         UINT32                      Length;     /* # of bytes in string, excluding trailing null */
728         char                        *Pointer;   /* points to the string value */
729     } String;
730
731     struct
732     {
733         ACPI_OBJECT_TYPE            Type;
734         UINT32                      Length;     /* # of bytes in buffer */
735         UINT8                       *Pointer;   /* points to the buffer */
736     } Buffer;
737
738     struct
739     {
740         ACPI_OBJECT_TYPE            Type;
741         UINT32                      Fill1;
742         ACPI_HANDLE                 Handle;     /* object reference */
743     } Reference;
744
745     struct
746     {
747         ACPI_OBJECT_TYPE            Type;
748         UINT32                      Count;      /* # of elements in package */
749         union acpi_object           *Elements;  /* Pointer to an array of ACPI_OBJECTs */
750     } Package;
751
752     struct
753     {
754         ACPI_OBJECT_TYPE            Type;
755         UINT32                      ProcId;
756         ACPI_IO_ADDRESS             PblkAddress;
757         UINT32                      PblkLength;
758     } Processor;
759
760     struct
761     {
762         ACPI_OBJECT_TYPE            Type;
763         UINT32                      SystemLevel;
764         UINT32                      ResourceOrder;
765     } PowerResource;
766
767 } ACPI_OBJECT;
768
769
770 /*
771  * List of objects, used as a parameter list for control method evaluation
772  */
773 typedef struct acpi_object_list
774 {
775     UINT32                      Count;
776     ACPI_OBJECT                 *Pointer;
777
778 } ACPI_OBJECT_LIST;
779
780
781 /*
782  * Miscellaneous common Data Structures used by the interfaces
783  */
784 #define ACPI_NO_BUFFER              0
785 #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (-1)
786 #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (-2)
787
788 typedef struct acpi_buffer
789 {
790     ACPI_SIZE                   Length;         /* Length in bytes of the buffer */
791     void                        *Pointer;       /* pointer to buffer */
792
793 } ACPI_BUFFER;
794
795
796 /*
797  * NameType for AcpiGetName
798  */
799 #define ACPI_FULL_PATHNAME              0
800 #define ACPI_SINGLE_NAME                1
801 #define ACPI_NAME_TYPE_MAX              1
802
803
804 /*
805  * Structure and flags for AcpiGetSystemInfo
806  */
807 #define ACPI_SYS_MODE_UNKNOWN           0x0000
808 #define ACPI_SYS_MODE_ACPI              0x0001
809 #define ACPI_SYS_MODE_LEGACY            0x0002
810 #define ACPI_SYS_MODES_MASK             0x0003
811
812
813 /*
814  * ACPI Table Info.  One per ACPI table _type_
815  */
816 typedef struct acpi_table_info
817 {
818     UINT32                      Count;
819
820 } ACPI_TABLE_INFO;
821
822
823 /*
824  * System info returned by AcpiGetSystemInfo()
825  */
826 typedef struct acpi_system_info
827 {
828     UINT32                      AcpiCaVersion;
829     UINT32                      Flags;
830     UINT32                      TimerResolution;
831     UINT32                      Reserved1;
832     UINT32                      Reserved2;
833     UINT32                      DebugLevel;
834     UINT32                      DebugLayer;
835     UINT32                      NumTableTypes;
836     ACPI_TABLE_INFO             TableInfo [NUM_ACPI_TABLES];
837
838 } ACPI_SYSTEM_INFO;
839
840
841 /*
842  * Various handlers and callback procedures
843  */
844 typedef
845 UINT32 (*ACPI_EVENT_HANDLER) (
846     void                        *Context);
847
848 typedef
849 void (*ACPI_GPE_HANDLER) (
850     void                        *Context);
851
852 typedef
853 void (*ACPI_NOTIFY_HANDLER) (
854     ACPI_HANDLE                 Device,
855     UINT32                      Value,
856     void                        *Context);
857
858 typedef
859 void (*ACPI_OBJECT_HANDLER) (
860     ACPI_HANDLE                 Object,
861     UINT32                      Function,
862     void                        *Data);
863
864 typedef
865 ACPI_STATUS (*ACPI_INIT_HANDLER) (
866     ACPI_HANDLE                 Object,
867     UINT32                      Function);
868
869 #define ACPI_INIT_DEVICE_INI        1
870
871
872 /* Address Spaces (Operation Regions */
873
874 typedef
875 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
876     UINT32                      Function,
877     ACPI_PHYSICAL_ADDRESS       Address,
878     UINT32                      BitWidth,
879     ACPI_INTEGER                *Value,
880     void                        *HandlerContext,
881     void                        *RegionContext);
882
883 #define ACPI_DEFAULT_HANDLER        NULL
884
885
886 typedef
887 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
888     ACPI_HANDLE                 RegionHandle,
889     UINT32                      Function,
890     void                        *HandlerContext,
891     void                        **RegionContext);
892
893 #define ACPI_REGION_ACTIVATE    0
894 #define ACPI_REGION_DEACTIVATE  1
895
896 typedef
897 ACPI_STATUS (*ACPI_WALK_CALLBACK) (
898     ACPI_HANDLE                 ObjHandle,
899     UINT32                      NestingLevel,
900     void                        *Context,
901     void                        **ReturnValue);
902
903
904 /* Interrupt handler return values */
905
906 #define ACPI_INTERRUPT_NOT_HANDLED      0x00
907 #define ACPI_INTERRUPT_HANDLED          0x01
908
909
910 /* Structure and flags for AcpiGetDeviceInfo */
911
912 #define ACPI_VALID_HID                  0x1
913 #define ACPI_VALID_UID                  0x2
914 #define ACPI_VALID_ADR                  0x4
915 #define ACPI_VALID_STA                  0x8
916
917
918 #define ACPI_COMMON_OBJ_INFO \
919     ACPI_OBJECT_TYPE            Type;           /* ACPI object type */ \
920     ACPI_NAME                   Name            /* ACPI object Name */
921
922
923 typedef struct acpi_obj_info_header
924 {
925     ACPI_COMMON_OBJ_INFO;
926
927 } ACPI_OBJ_INFO_HEADER;
928
929
930 typedef struct acpi_device_info
931 {
932     ACPI_COMMON_OBJ_INFO;
933
934     UINT32                      Valid;              /*  Are the next bits legit? */
935     char                        HardwareId[9];      /*  _HID value if any */
936     char                        UniqueId[9];        /*  _UID value if any */
937     ACPI_INTEGER                Address;            /*  _ADR value if any */
938     UINT32                      CurrentStatus;      /*  _STA value */
939
940 } ACPI_DEVICE_INFO;
941
942
943 /* Context structs for address space handlers */
944
945 typedef struct acpi_pci_id
946 {
947     UINT16                      Segment;
948     UINT16                      Bus;
949     UINT16                      Device;
950     UINT16                      Function;
951
952 } ACPI_PCI_ID;
953
954
955 typedef struct acpi_mem_space_context
956 {
957     UINT32                      Length;
958     ACPI_PHYSICAL_ADDRESS       Address;
959     ACPI_PHYSICAL_ADDRESS       MappedPhysicalAddress;
960     UINT8                       *MappedLogicalAddress;
961     ACPI_SIZE                   MappedLength;
962
963 } ACPI_MEM_SPACE_CONTEXT;
964
965
966 /*
967  * Definitions for Resource Attributes
968  */
969
970 /*
971  *  Memory Attributes
972  */
973 #define ACPI_READ_ONLY_MEMORY           (UINT8) 0x00
974 #define ACPI_READ_WRITE_MEMORY          (UINT8) 0x01
975
976 #define ACPI_NON_CACHEABLE_MEMORY       (UINT8) 0x00
977 #define ACPI_CACHABLE_MEMORY            (UINT8) 0x01
978 #define ACPI_WRITE_COMBINING_MEMORY     (UINT8) 0x02
979 #define ACPI_PREFETCHABLE_MEMORY        (UINT8) 0x03
980
981 /*
982  *  IO Attributes
983  *  The ISA IO ranges are:     n000-n0FFh,  n400-n4FFh, n800-n8FFh, nC00-nCFFh.
984  *  The non-ISA IO ranges are: n100-n3FFh,  n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
985  */
986 #define ACPI_NON_ISA_ONLY_RANGES        (UINT8) 0x01
987 #define ACPI_ISA_ONLY_RANGES            (UINT8) 0x02
988 #define ACPI_ENTIRE_RANGE               (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
989
990 #define ACPI_SPARSE_TRANSLATION         (UINT8) 0x03
991
992 /*
993  *  IO Port Descriptor Decode
994  */
995 #define ACPI_DECODE_10                  (UINT8) 0x00    /* 10-bit IO address decode */
996 #define ACPI_DECODE_16                  (UINT8) 0x01    /* 16-bit IO address decode */
997
998 /*
999  *  IRQ Attributes
1000  */
1001 #define ACPI_EDGE_SENSITIVE             (UINT8) 0x00
1002 #define ACPI_LEVEL_SENSITIVE            (UINT8) 0x01
1003
1004 #define ACPI_ACTIVE_HIGH                (UINT8) 0x00
1005 #define ACPI_ACTIVE_LOW                 (UINT8) 0x01
1006
1007 #define ACPI_EXCLUSIVE                  (UINT8) 0x00
1008 #define ACPI_SHARED                     (UINT8) 0x01
1009
1010 /*
1011  *  DMA Attributes
1012  */
1013 #define ACPI_COMPATIBILITY              (UINT8) 0x00
1014 #define ACPI_TYPE_A                     (UINT8) 0x01
1015 #define ACPI_TYPE_B                     (UINT8) 0x02
1016 #define ACPI_TYPE_F                     (UINT8) 0x03
1017
1018 #define ACPI_NOT_BUS_MASTER             (UINT8) 0x00
1019 #define ACPI_BUS_MASTER                 (UINT8) 0x01
1020
1021 #define ACPI_TRANSFER_8                 (UINT8) 0x00
1022 #define ACPI_TRANSFER_8_16              (UINT8) 0x01
1023 #define ACPI_TRANSFER_16                (UINT8) 0x02
1024
1025 /*
1026  * Start Dependent Functions Priority definitions
1027  */
1028 #define ACPI_GOOD_CONFIGURATION         (UINT8) 0x00
1029 #define ACPI_ACCEPTABLE_CONFIGURATION   (UINT8) 0x01
1030 #define ACPI_SUB_OPTIMAL_CONFIGURATION  (UINT8) 0x02
1031
1032 /*
1033  *  16, 32 and 64-bit Address Descriptor resource types
1034  */
1035 #define ACPI_MEMORY_RANGE               (UINT8) 0x00
1036 #define ACPI_IO_RANGE                   (UINT8) 0x01
1037 #define ACPI_BUS_NUMBER_RANGE           (UINT8) 0x02
1038
1039 #define ACPI_ADDRESS_NOT_FIXED          (UINT8) 0x00
1040 #define ACPI_ADDRESS_FIXED              (UINT8) 0x01
1041
1042 #define ACPI_POS_DECODE                 (UINT8) 0x00
1043 #define ACPI_SUB_DECODE                 (UINT8) 0x01
1044
1045 #define ACPI_PRODUCER                   (UINT8) 0x00
1046 #define ACPI_CONSUMER                   (UINT8) 0x01
1047
1048
1049 /*
1050  *  Structures used to describe device resources
1051  */
1052 typedef struct acpi_resource_irq
1053 {
1054     UINT32                      EdgeLevel;
1055     UINT32                      ActiveHighLow;
1056     UINT32                      SharedExclusive;
1057     UINT32                      NumberOfInterrupts;
1058     UINT32                      Interrupts[1];
1059
1060 } ACPI_RESOURCE_IRQ;
1061
1062 typedef struct ACPI_RESOURCE_DMA
1063 {
1064     UINT32                      Type;
1065     UINT32                      BusMaster;
1066     UINT32                      Transfer;
1067     UINT32                      NumberOfChannels;
1068     UINT32                      Channels[1];
1069
1070 } ACPI_RESOURCE_DMA;
1071
1072 typedef struct acpi_resource_start_dpf
1073 {
1074     UINT32                      CompatibilityPriority;
1075     UINT32                      PerformanceRobustness;
1076
1077 } ACPI_RESOURCE_START_DPF;
1078
1079 /*
1080  * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
1081  * needed because it has no fields
1082  */
1083
1084 typedef struct acpi_resource_io
1085 {
1086     UINT32                      IoDecode;
1087     UINT32                      MinBaseAddress;
1088     UINT32                      MaxBaseAddress;
1089     UINT32                      Alignment;
1090     UINT32                      RangeLength;
1091
1092 } ACPI_RESOURCE_IO;
1093
1094 typedef struct acpi_resource_fixed_io
1095 {
1096     UINT32                      BaseAddress;
1097     UINT32                      RangeLength;
1098
1099 } ACPI_RESOURCE_FIXED_IO;
1100
1101 typedef struct acpi_resource_vendor
1102 {
1103     UINT32                      Length;
1104     UINT8                       Reserved[1];
1105
1106 } ACPI_RESOURCE_VENDOR;
1107
1108 typedef struct acpi_resource_end_tag
1109 {
1110     UINT8                       Checksum;
1111
1112 } ACPI_RESOURCE_END_TAG;
1113
1114 typedef struct acpi_resource_mem24
1115 {
1116     UINT32                      ReadWriteAttribute;
1117     UINT32                      MinBaseAddress;
1118     UINT32                      MaxBaseAddress;
1119     UINT32                      Alignment;
1120     UINT32                      RangeLength;
1121
1122 } ACPI_RESOURCE_MEM24;
1123
1124 typedef struct acpi_resource_mem32
1125 {
1126     UINT32                      ReadWriteAttribute;
1127     UINT32                      MinBaseAddress;
1128     UINT32                      MaxBaseAddress;
1129     UINT32                      Alignment;
1130     UINT32                      RangeLength;
1131
1132 } ACPI_RESOURCE_MEM32;
1133
1134 typedef struct acpi_resource_fixed_mem32
1135 {
1136     UINT32                      ReadWriteAttribute;
1137     UINT32                      RangeBaseAddress;
1138     UINT32                      RangeLength;
1139
1140 } ACPI_RESOURCE_FIXED_MEM32;
1141
1142 typedef struct acpi_memory_attribute
1143 {
1144     UINT16                      CacheAttribute;
1145     UINT16                      ReadWriteAttribute;
1146
1147 } ACPI_MEMORY_ATTRIBUTE;
1148
1149 typedef struct acpi_io_attribute
1150 {
1151     UINT16                      RangeAttribute;
1152     UINT16                      TranslationAttribute;
1153
1154 } ACPI_IO_ATTRIBUTE;
1155
1156 typedef struct acpi_bus_attribute
1157 {
1158     UINT16                      Reserved1;
1159     UINT16                      Reserved2;
1160
1161 } ACPI_BUS_ATTRIBUTE;
1162
1163 typedef union acpi_resource_attribute
1164 {
1165     ACPI_MEMORY_ATTRIBUTE       Memory;
1166     ACPI_IO_ATTRIBUTE           Io;
1167     ACPI_BUS_ATTRIBUTE          Bus;
1168
1169 } ACPI_RESOURCE_ATTRIBUTE;
1170
1171 typedef struct acpi_resource_source
1172 {
1173     UINT32                      Index;
1174     UINT32                      StringLength;
1175     char                        *StringPtr;
1176
1177 } ACPI_RESOURCE_SOURCE;
1178
1179 typedef struct acpi_resource_address16
1180 {
1181     UINT32                      ResourceType;
1182     UINT32                      ProducerConsumer;
1183     UINT32                      Decode;
1184     UINT32                      MinAddressFixed;
1185     UINT32                      MaxAddressFixed;
1186     ACPI_RESOURCE_ATTRIBUTE     Attribute;
1187     UINT32                      Granularity;
1188     UINT32                      MinAddressRange;
1189     UINT32                      MaxAddressRange;
1190     UINT32                      AddressTranslationOffset;
1191     UINT32                      AddressLength;
1192     ACPI_RESOURCE_SOURCE        ResourceSource;
1193
1194 } ACPI_RESOURCE_ADDRESS16;
1195
1196 typedef struct acpi_resource_address32
1197 {
1198     UINT32                      ResourceType;
1199     UINT32                      ProducerConsumer;
1200     UINT32                      Decode;
1201     UINT32                      MinAddressFixed;
1202     UINT32                      MaxAddressFixed;
1203     ACPI_RESOURCE_ATTRIBUTE     Attribute;
1204     UINT32                      Granularity;
1205     UINT32                      MinAddressRange;
1206     UINT32                      MaxAddressRange;
1207     UINT32                      AddressTranslationOffset;
1208     UINT32                      AddressLength;
1209     ACPI_RESOURCE_SOURCE        ResourceSource;
1210
1211 } ACPI_RESOURCE_ADDRESS32;
1212
1213 typedef struct acpi_resource_address64
1214 {
1215     UINT32                      ResourceType;
1216     UINT32                      ProducerConsumer;
1217     UINT32                      Decode;
1218     UINT32                      MinAddressFixed;
1219     UINT32                      MaxAddressFixed;
1220     ACPI_RESOURCE_ATTRIBUTE     Attribute;
1221     UINT64                      Granularity;
1222     UINT64                      MinAddressRange;
1223     UINT64                      MaxAddressRange;
1224     UINT64                      AddressTranslationOffset;
1225     UINT64                      AddressLength;
1226     ACPI_RESOURCE_SOURCE        ResourceSource;
1227
1228 } ACPI_RESOURCE_ADDRESS64;
1229
1230 typedef struct acpi_resource_ext_irq
1231 {
1232     UINT32                      ProducerConsumer;
1233     UINT32                      EdgeLevel;
1234     UINT32                      ActiveHighLow;
1235     UINT32                      SharedExclusive;
1236     UINT32                      NumberOfInterrupts;
1237     ACPI_RESOURCE_SOURCE        ResourceSource;
1238     UINT32                      Interrupts[1];
1239
1240 } ACPI_RESOURCE_EXT_IRQ;
1241
1242
1243 /* ACPI_RESOURCE_TYPEs */
1244
1245 #define ACPI_RSTYPE_IRQ                 0
1246 #define ACPI_RSTYPE_DMA                 1
1247 #define ACPI_RSTYPE_START_DPF           2
1248 #define ACPI_RSTYPE_END_DPF             3
1249 #define ACPI_RSTYPE_IO                  4
1250 #define ACPI_RSTYPE_FIXED_IO            5
1251 #define ACPI_RSTYPE_VENDOR              6
1252 #define ACPI_RSTYPE_END_TAG             7
1253 #define ACPI_RSTYPE_MEM24               8
1254 #define ACPI_RSTYPE_MEM32               9
1255 #define ACPI_RSTYPE_FIXED_MEM32         10
1256 #define ACPI_RSTYPE_ADDRESS16           11
1257 #define ACPI_RSTYPE_ADDRESS32           12
1258 #define ACPI_RSTYPE_ADDRESS64           13
1259 #define ACPI_RSTYPE_EXT_IRQ             14
1260
1261 typedef UINT32                          ACPI_RESOURCE_TYPE;
1262
1263 typedef union acpi_resource_data
1264 {
1265     ACPI_RESOURCE_IRQ           Irq;
1266     ACPI_RESOURCE_DMA           Dma;
1267     ACPI_RESOURCE_START_DPF     StartDpf;
1268     ACPI_RESOURCE_IO            Io;
1269     ACPI_RESOURCE_FIXED_IO      FixedIo;
1270     ACPI_RESOURCE_VENDOR        VendorSpecific;
1271     ACPI_RESOURCE_END_TAG       EndTag;
1272     ACPI_RESOURCE_MEM24         Memory24;
1273     ACPI_RESOURCE_MEM32         Memory32;
1274     ACPI_RESOURCE_FIXED_MEM32   FixedMemory32;
1275     ACPI_RESOURCE_ADDRESS16     Address16;
1276     ACPI_RESOURCE_ADDRESS32     Address32;
1277     ACPI_RESOURCE_ADDRESS64     Address64;
1278     ACPI_RESOURCE_EXT_IRQ       ExtendedIrq;
1279
1280 } ACPI_RESOURCE_DATA;
1281
1282 typedef struct acpi_resource
1283 {
1284     ACPI_RESOURCE_TYPE          Id;
1285     UINT32                      Length;
1286     ACPI_RESOURCE_DATA          Data;
1287
1288 } ACPI_RESOURCE;
1289
1290 #define ACPI_RESOURCE_LENGTH                12
1291 #define ACPI_RESOURCE_LENGTH_NO_DATA        8       /* Id + Length fields */
1292
1293 #define ACPI_SIZEOF_RESOURCE(Type)          (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type))
1294
1295 #define ACPI_NEXT_RESOURCE(Res)             (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
1296
1297 #ifdef _HW_ALIGNMENT_SUPPORT
1298 #define ACPI_ALIGN_RESOURCE_SIZE(Length)    (Length)
1299 #else
1300 #define ACPI_ALIGN_RESOURCE_SIZE(Length)    ACPI_ROUND_UP_TO_NATIVE_WORD(Length)
1301 #endif
1302
1303 /*
1304  * END: of definitions for Resource Attributes
1305  */
1306
1307
1308 typedef struct acpi_pci_routing_table
1309 {
1310     UINT32                      Length;
1311     UINT32                      Pin;
1312     ACPI_INTEGER                Address;        /* here for 64-bit alignment */
1313     UINT32                      SourceIndex;
1314     char                        Source[4];      /* pad to 64 bits so sizeof() works in all cases */
1315
1316 } ACPI_PCI_ROUTING_TABLE;
1317
1318 /*
1319  * END: of definitions for PCI Routing tables
1320  */
1321
1322
1323 #endif /* __ACTYPES_H__ */