xref: /illumos-gate/usr/src/uts/intel/sys/acpi/actypes.h (revision aa2aa9a6)
1 /******************************************************************************
2  *
3  * Name: actypes.h - Common data types for the entire ACPI subsystem
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights.  You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code.  No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision.  In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change.  Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee.  Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution.  In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government.  In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115 
116 #ifndef __ACTYPES_H__
117 #define __ACTYPES_H__
118 
119 /* acpisrc:StructDefs -- for acpisrc conversion */
120 
121 /*
122  * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
123  * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of
124  * 12/2006.
125  */
126 #ifndef ACPI_MACHINE_WIDTH
127 #error ACPI_MACHINE_WIDTH not defined
128 #endif
129 
130 /*! [Begin] no source code translation */
131 
132 /*
133  * Data type ranges
134  * Note: These macros are designed to be compiler independent as well as
135  * working around problems that some 32-bit compilers have with 64-bit
136  * constants.
137  */
138 #define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0)) /* 0xFF               */
139 #define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0)) /* 0xFFFF             */
140 #define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF         */
141 #define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
142 #define ACPI_ASCII_MAX                  0x7F
143 
144 
145 /*
146  * Architecture-specific ACPICA Subsystem Data Types
147  *
148  * The goal of these types is to provide source code portability across
149  * 16-bit, 32-bit, and 64-bit targets.
150  *
151  * 1) The following types are of fixed size for all targets (16/32/64):
152  *
153  * BOOLEAN      Logical boolean
154  *
155  * UINT8        8-bit  (1 byte) unsigned value
156  * UINT16       16-bit (2 byte) unsigned value
157  * UINT32       32-bit (4 byte) unsigned value
158  * UINT64       64-bit (8 byte) unsigned value
159  *
160  * INT16        16-bit (2 byte) signed value
161  * INT32        32-bit (4 byte) signed value
162  * INT64        64-bit (8 byte) signed value
163  *
164  * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
165  * compiler-dependent header(s) and were introduced because there is no common
166  * 64-bit integer type across the various compilation models, as shown in
167  * the table below.
168  *
169  * Datatype  LP64 ILP64 LLP64 ILP32 LP32 16bit
170  * char      8    8     8     8     8    8
171  * short     16   16    16    16    16   16
172  * _int32         32
173  * int       32   64    32    32    16   16
174  * long      64   64    32    32    32   32
175  * long long            64    64
176  * pointer   64   64    64    32    32   32
177  *
178  * Note: ILP64 and LP32 are currently not supported.
179  *
180  *
181  * 2) These types represent the native word size of the target mode of the
182  * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
183  * usually used for memory allocation, efficient loop counters, and array
184  * indexes. The types are similar to the size_t type in the C library and are
185  * required because there is no C type that consistently represents the native
186  * data width. ACPI_SIZE is needed because there is no guarantee that a
187  * kernel-level C library is present.
188  *
189  * ACPI_SIZE        16/32/64-bit unsigned value
190  * ACPI_NATIVE_INT  16/32/64-bit signed value
191  *
192  */
193 
194 /*******************************************************************************
195  *
196  * Common types for all compilers, all targets
197  *
198  ******************************************************************************/
199 
200 typedef unsigned char                   BOOLEAN;
201 typedef unsigned char                   UINT8;
202 typedef unsigned short                  UINT16;
203 typedef COMPILER_DEPENDENT_UINT64       UINT64;
204 typedef COMPILER_DEPENDENT_INT64        INT64;
205 
206 /*! [End] no source code translation !*/
207 
208 
209 /*******************************************************************************
210  *
211  * Types specific to 64-bit targets
212  *
213  ******************************************************************************/
214 
215 #if ACPI_MACHINE_WIDTH == 64
216 
217 /*! [Begin] no source code translation (keep the typedefs as-is) */
218 
219 typedef unsigned int                    UINT32;
220 typedef int                             INT32;
221 
222 /*! [End] no source code translation !*/
223 
224 
225 typedef INT64                           ACPI_NATIVE_INT;
226 typedef UINT64                          ACPI_SIZE;
227 typedef UINT64                          ACPI_IO_ADDRESS;
228 typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
229 
230 #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
231 #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
232 #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
233 
234 /*
235  * In the case of the Itanium Processor Family (IPF), the hardware does not
236  * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
237  * to indicate that special precautions must be taken to avoid alignment faults.
238  * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
239  *
240  * Note: EM64T and other X86-64 processors support misaligned transfers,
241  * so there is no need to define this flag.
242  */
243 #if defined (__IA64__) || defined (__ia64__)
244 #define ACPI_MISALIGNMENT_NOT_SUPPORTED
245 #endif
246 
247 
248 /*******************************************************************************
249  *
250  * Types specific to 32-bit targets
251  *
252  ******************************************************************************/
253 
254 #elif ACPI_MACHINE_WIDTH == 32
255 
256 /*! [Begin] no source code translation (keep the typedefs as-is) */
257 
258 typedef unsigned int                    UINT32;
259 typedef int                             INT32;
260 
261 /*! [End] no source code translation !*/
262 
263 
264 typedef INT32                           ACPI_NATIVE_INT;
265 typedef UINT32                          ACPI_SIZE;
266 typedef UINT32                          ACPI_IO_ADDRESS;
267 typedef UINT32                          ACPI_PHYSICAL_ADDRESS;
268 
269 #define ACPI_MAX_PTR                    ACPI_UINT32_MAX
270 #define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
271 
272 #else
273 
274 /* ACPI_MACHINE_WIDTH must be either 64 or 32 */
275 
276 #error unknown ACPI_MACHINE_WIDTH
277 #endif
278 
279 
280 /*******************************************************************************
281  *
282  * OS-dependent types
283  *
284  * If the defaults below are not appropriate for the host system, they can
285  * be defined in the OS-specific header, and this will take precedence.
286  *
287  ******************************************************************************/
288 
289 /* Value returned by AcpiOsGetThreadId */
290 
291 #ifndef ACPI_THREAD_ID
292 #define ACPI_THREAD_ID                  ACPI_SIZE
293 #endif
294 
295 /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
296 
297 #ifndef ACPI_CPU_FLAGS
298 #define ACPI_CPU_FLAGS                  ACPI_SIZE
299 #endif
300 
301 /* Object returned from AcpiOsCreateCache */
302 
303 #ifndef ACPI_CACHE_T
304 #ifdef ACPI_USE_LOCAL_CACHE
305 #define ACPI_CACHE_T                    ACPI_MEMORY_LIST
306 #else
307 #define ACPI_CACHE_T                    void *
308 #endif
309 #endif
310 
311 /*
312  * Synchronization objects - Mutexes, Semaphores, and SpinLocks
313  */
314 #if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
315 /*
316  * These macros are used if the host OS does not support a mutex object.
317  * Map the OSL Mutex interfaces to binary semaphores.
318  */
319 #define ACPI_MUTEX                      ACPI_SEMAPHORE
320 #define AcpiOsCreateMutex(OutHandle)    AcpiOsCreateSemaphore (1, 1, OutHandle)
321 #define AcpiOsDeleteMutex(Handle)       (void) AcpiOsDeleteSemaphore (Handle)
322 #define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
323 #define AcpiOsReleaseMutex(Handle)      (void) AcpiOsSignalSemaphore (Handle, 1)
324 #endif
325 
326 /* Configurable types for synchronization objects */
327 
328 #ifndef ACPI_SPINLOCK
329 #define ACPI_SPINLOCK                   void *
330 #endif
331 
332 #ifndef ACPI_SEMAPHORE
333 #define ACPI_SEMAPHORE                  void *
334 #endif
335 
336 #ifndef ACPI_MUTEX
337 #define ACPI_MUTEX                      void *
338 #endif
339 
340 
341 /*******************************************************************************
342  *
343  * Compiler-dependent types
344  *
345  * If the defaults below are not appropriate for the host compiler, they can
346  * be defined in the compiler-specific header, and this will take precedence.
347  *
348  ******************************************************************************/
349 
350 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
351 
352 #ifndef ACPI_UINTPTR_T
353 #define ACPI_UINTPTR_T                  void *
354 #endif
355 
356 /*
357  * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
358  * some compilers can catch printf format string problems
359  */
360 #ifndef ACPI_PRINTF_LIKE
361 #define ACPI_PRINTF_LIKE(c)
362 #endif
363 
364 /*
365  * Some compilers complain about unused variables. Sometimes we don't want to
366  * use all the variables (for example, _AcpiModuleName). This allows us
367  * to to tell the compiler in a per-variable manner that a variable
368  * is unused
369  */
370 #ifndef ACPI_UNUSED_VAR
371 #define ACPI_UNUSED_VAR
372 #endif
373 
374 /*
375  * All ACPICA functions that are available to the rest of the kernel are
376  * tagged with this macro which can be defined as appropriate for the host.
377  */
378 #ifndef ACPI_EXPORT_SYMBOL
379 #define ACPI_EXPORT_SYMBOL(Symbol)
380 #endif
381 
382 
383 /******************************************************************************
384  *
385  * ACPI Specification constants (Do not change unless the specification changes)
386  *
387  *****************************************************************************/
388 
389 /* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
390 
391 #define ACPI_MAX_GPE_BLOCKS             2
392 
393 /* Default ACPI register widths */
394 
395 #define ACPI_GPE_REGISTER_WIDTH         8
396 #define ACPI_PM1_REGISTER_WIDTH         16
397 #define ACPI_PM2_REGISTER_WIDTH         8
398 #define ACPI_PM_TIMER_WIDTH             32
399 
400 /* Names within the namespace are 4 bytes long */
401 
402 #define ACPI_NAME_SIZE                  4
403 #define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
404 #define ACPI_PATH_SEPARATOR             '.'
405 
406 /* Sizes for ACPI table headers */
407 
408 #define ACPI_OEM_ID_SIZE                6
409 #define ACPI_OEM_TABLE_ID_SIZE          8
410 
411 /* ACPI/PNP hardware IDs */
412 
413 #define PCI_ROOT_HID_STRING             "PNP0A03"
414 #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
415 
416 /* PM Timer ticks per second (HZ) */
417 
418 #define PM_TIMER_FREQUENCY  3579545
419 
420 
421 /*******************************************************************************
422  *
423  * Independent types
424  *
425  ******************************************************************************/
426 
427 /* Logical defines and NULL */
428 
429 #ifdef FALSE
430 #undef FALSE
431 #endif
432 #define FALSE                           (1 == 0)
433 
434 #ifdef TRUE
435 #undef TRUE
436 #endif
437 #define TRUE                            (1 == 1)
438 
439 #ifndef NULL
440 #define NULL                            (void *) 0
441 #endif
442 
443 
444 /*
445  * Miscellaneous types
446  */
447 typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
448 typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
449 typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
450 typedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
451 
452 
453 /* Owner IDs are used to track namespace nodes for selective deletion */
454 
455 typedef UINT8                           ACPI_OWNER_ID;
456 #define ACPI_OWNER_ID_MAX               0xFF
457 
458 
459 typedef struct uint64_struct
460 {
461     UINT32                          Lo;
462     UINT32                          Hi;
463 
464 } UINT64_STRUCT;
465 
466 typedef union uint64_overlay
467 {
468     UINT64                          Full;
469     UINT64_STRUCT                   Part;
470 
471 } UINT64_OVERLAY;
472 
473 typedef struct uint32_struct
474 {
475     UINT32                          Lo;
476     UINT32                          Hi;
477 
478 } UINT32_STRUCT;
479 
480 
481 /*
482  * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
483  * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
484  * type only, not other integers used in the implementation of the ACPI CA
485  * subsystem.
486  */
487 typedef UINT64                          ACPI_INTEGER;
488 #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
489 #define ACPI_INTEGER_BIT_SIZE           64
490 #define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
491 #define ACPI_MAX64_DECIMAL_DIGITS       20
492 #define ACPI_MAX32_DECIMAL_DIGITS       10
493 #define ACPI_MAX16_DECIMAL_DIGITS        5
494 #define ACPI_MAX8_DECIMAL_DIGITS         3
495 
496 /*
497  * Constants with special meanings
498  */
499 #define ACPI_ROOT_OBJECT                ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
500 #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
501 #define ACPI_DO_NOT_WAIT                0
502 
503 
504 /*******************************************************************************
505  *
506  * Commonly used macros
507  *
508  ******************************************************************************/
509 
510 /* Data manipulation */
511 
512 #define ACPI_LOBYTE(Integer)            ((UINT8)   (UINT16)(Integer))
513 #define ACPI_HIBYTE(Integer)            ((UINT8) (((UINT16)(Integer)) >> 8))
514 #define ACPI_LOWORD(Integer)            ((UINT16)  (UINT32)(Integer))
515 #define ACPI_HIWORD(Integer)            ((UINT16)(((UINT32)(Integer)) >> 16))
516 #define ACPI_LODWORD(Integer64)         ((UINT32)  (UINT64)(Integer64))
517 #define ACPI_HIDWORD(Integer64)         ((UINT32)(((UINT64)(Integer64)) >> 32))
518 
519 #define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
520 #define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
521 #define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
522 #define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
523 
524 /* Size calculation */
525 
526 #define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
527 
528 /* Pointer manipulation */
529 
530 #define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
531 #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
532 #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
533 #define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
534 
535 /* Pointer/Integer type conversions */
536 
537 #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
538 #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
539 #define ACPI_OFFSET(d, f)               (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f), (void *) NULL)
540 #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
541 #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
542 
543 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
544 #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
545 #else
546 #define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
547 #endif
548 
549 
550 /*******************************************************************************
551  *
552  * Miscellaneous constants
553  *
554  ******************************************************************************/
555 
556 /*
557  * Initialization sequence
558  */
559 #define ACPI_FULL_INITIALIZATION        0x00
560 #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
561 #define ACPI_NO_HARDWARE_INIT           0x02
562 #define ACPI_NO_EVENT_INIT              0x04
563 #define ACPI_NO_HANDLER_INIT            0x08
564 #define ACPI_NO_ACPI_ENABLE             0x10
565 #define ACPI_NO_DEVICE_INIT             0x20
566 #define ACPI_NO_OBJECT_INIT             0x40
567 
568 /*
569  * Initialization state
570  */
571 #define ACPI_SUBSYSTEM_INITIALIZE       0x01
572 #define ACPI_INITIALIZED_OK             0x02
573 
574 /*
575  * Power state values
576  */
577 #define ACPI_STATE_UNKNOWN              (UINT8) 0xFF
578 
579 #define ACPI_STATE_S0                   (UINT8) 0
580 #define ACPI_STATE_S1                   (UINT8) 1
581 #define ACPI_STATE_S2                   (UINT8) 2
582 #define ACPI_STATE_S3                   (UINT8) 3
583 #define ACPI_STATE_S4                   (UINT8) 4
584 #define ACPI_STATE_S5                   (UINT8) 5
585 #define ACPI_S_STATES_MAX               ACPI_STATE_S5
586 #define ACPI_S_STATE_COUNT              6
587 
588 #define ACPI_STATE_D0                   (UINT8) 0
589 #define ACPI_STATE_D1                   (UINT8) 1
590 #define ACPI_STATE_D2                   (UINT8) 2
591 #define ACPI_STATE_D3                   (UINT8) 3
592 #define ACPI_D_STATES_MAX               ACPI_STATE_D3
593 #define ACPI_D_STATE_COUNT              4
594 
595 #define ACPI_STATE_C0                   (UINT8) 0
596 #define ACPI_STATE_C1                   (UINT8) 1
597 #define ACPI_STATE_C2                   (UINT8) 2
598 #define ACPI_STATE_C3                   (UINT8) 3
599 #define ACPI_C_STATES_MAX               ACPI_STATE_C3
600 #define ACPI_C_STATE_COUNT              4
601 
602 /*
603  * Sleep type invalid value
604  */
605 #define ACPI_SLEEP_TYPE_MAX             0x7
606 #define ACPI_SLEEP_TYPE_INVALID         0xFF
607 
608 /*
609  * Standard notify values
610  */
611 #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00
612 #define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 0x01
613 #define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 0x02
614 #define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 0x03
615 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 0x04
616 #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 0x05
617 #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 0x06
618 #define ACPI_NOTIFY_POWER_FAULT         (UINT8) 0x07
619 #define ACPI_NOTIFY_CAPABILITIES_CHECK  (UINT8) 0x08
620 #define ACPI_NOTIFY_DEVICE_PLD_CHECK    (UINT8) 0x09
621 #define ACPI_NOTIFY_RESERVED            (UINT8) 0x0A
622 #define ACPI_NOTIFY_LOCALITY_UPDATE     (UINT8) 0x0B
623 
624 #define ACPI_NOTIFY_MAX                 0x0B
625 
626 /*
627  * Types associated with ACPI names and objects. The first group of
628  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
629  * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
630  * only add to the first group if the spec changes.
631  *
632  * NOTE: Types must be kept in sync with the global AcpiNsProperties
633  * and AcpiNsTypeNames arrays.
634  */
635 typedef UINT32                          ACPI_OBJECT_TYPE;
636 
637 #define ACPI_TYPE_ANY                   0x00
638 #define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
639 #define ACPI_TYPE_STRING                0x02
640 #define ACPI_TYPE_BUFFER                0x03
641 #define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
642 #define ACPI_TYPE_FIELD_UNIT            0x05
643 #define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
644 #define ACPI_TYPE_EVENT                 0x07
645 #define ACPI_TYPE_METHOD                0x08  /* Name, ByteConst, multiple Code */
646 #define ACPI_TYPE_MUTEX                 0x09
647 #define ACPI_TYPE_REGION                0x0A
648 #define ACPI_TYPE_POWER                 0x0B  /* Name,ByteConst,WordConst,multi Node */
649 #define ACPI_TYPE_PROCESSOR             0x0C  /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
650 #define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
651 #define ACPI_TYPE_BUFFER_FIELD          0x0E
652 #define ACPI_TYPE_DDB_HANDLE            0x0F
653 #define ACPI_TYPE_DEBUG_OBJECT          0x10
654 
655 #define ACPI_TYPE_EXTERNAL_MAX          0x10
656 
657 /*
658  * These are object types that do not map directly to the ACPI
659  * ObjectType() operator. They are used for various internal purposes only.
660  * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
661  * internal types must move upwards. (There is code that depends on these
662  * values being contiguous with the external types above.)
663  */
664 #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
665 #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
666 #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
667 #define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
668 #define ACPI_TYPE_LOCAL_ALIAS           0x15
669 #define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
670 #define ACPI_TYPE_LOCAL_NOTIFY          0x17
671 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
672 #define ACPI_TYPE_LOCAL_RESOURCE        0x19
673 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
674 #define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
675 
676 #define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
677 
678 /*
679  * These are special object types that never appear in
680  * a Namespace node, only in an ACPI_OPERAND_OBJECT
681  */
682 #define ACPI_TYPE_LOCAL_EXTRA           0x1C
683 #define ACPI_TYPE_LOCAL_DATA            0x1D
684 
685 #define ACPI_TYPE_LOCAL_MAX             0x1D
686 
687 /* All types above here are invalid */
688 
689 #define ACPI_TYPE_INVALID               0x1E
690 #define ACPI_TYPE_NOT_FOUND             0xFF
691 
692 #define ACPI_NUM_NS_TYPES               (ACPI_TYPE_INVALID + 1)
693 
694 
695 /*
696  * All I/O
697  */
698 #define ACPI_READ                       0
699 #define ACPI_WRITE                      1
700 #define ACPI_IO_MASK                    1
701 
702 /*
703  * Event Types: Fixed & General Purpose
704  */
705 typedef UINT32                          ACPI_EVENT_TYPE;
706 
707 /*
708  * Fixed events
709  */
710 #define ACPI_EVENT_PMTIMER              0
711 #define ACPI_EVENT_GLOBAL               1
712 #define ACPI_EVENT_POWER_BUTTON         2
713 #define ACPI_EVENT_SLEEP_BUTTON         3
714 #define ACPI_EVENT_RTC                  4
715 #define ACPI_EVENT_MAX                  4
716 #define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
717 
718 /*
719  * Event Status - Per event
720  * -------------
721  * The encoding of ACPI_EVENT_STATUS is illustrated below.
722  * Note that a set bit (1) indicates the property is TRUE
723  * (e.g. if bit 0 is set then the event is enabled).
724  * +-------------+-+-+-+
725  * |   Bits 31:3 |2|1|0|
726  * +-------------+-+-+-+
727  *          |     | | |
728  *          |     | | +- Enabled?
729  *          |     | +--- Enabled for wake?
730  *          |     +----- Set?
731  *          +----------- <Reserved>
732  */
733 typedef UINT32                          ACPI_EVENT_STATUS;
734 
735 #define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
736 #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
737 #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
738 #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
739 
740 /*
741  * General Purpose Events (GPE)
742  */
743 #define ACPI_GPE_INVALID                0xFF
744 #define ACPI_GPE_MAX                    0xFF
745 #define ACPI_NUM_GPE                    256
746 
747 #define ACPI_GPE_ENABLE                 0
748 #define ACPI_GPE_DISABLE                1
749 
750 
751 /*
752  * GPE info flags - Per GPE
753  * +-+-+-+---+---+-+
754  * |7|6|5|4:3|2:1|0|
755  * +-+-+-+---+---+-+
756  *  | | |  |   |  |
757  *  | | |  |   |  +--- Interrupt type: Edge or Level Triggered
758  *  | | |  |   +--- Type: Wake-only, Runtime-only, or wake/runtime
759  *  | | |  +--- Type of dispatch -- to method, handler, or none
760  *  | | +--- Enabled for runtime?
761  *  | +--- Enabled for wake?
762  *  +--- Unused
763  */
764 #define ACPI_GPE_XRUPT_TYPE_MASK        (UINT8) 0x01
765 #define ACPI_GPE_LEVEL_TRIGGERED        (UINT8) 0x01
766 #define ACPI_GPE_EDGE_TRIGGERED         (UINT8) 0x00
767 
768 #define ACPI_GPE_TYPE_MASK              (UINT8) 0x06
769 #define ACPI_GPE_TYPE_WAKE_RUN          (UINT8) 0x06
770 #define ACPI_GPE_TYPE_WAKE              (UINT8) 0x02
771 #define ACPI_GPE_TYPE_RUNTIME           (UINT8) 0x04    /* Default */
772 
773 #define ACPI_GPE_DISPATCH_MASK          (UINT8) 0x18
774 #define ACPI_GPE_DISPATCH_HANDLER       (UINT8) 0x08
775 #define ACPI_GPE_DISPATCH_METHOD        (UINT8) 0x10
776 #define ACPI_GPE_DISPATCH_NOT_USED      (UINT8) 0x00    /* Default */
777 
778 #define ACPI_GPE_RUN_ENABLE_MASK        (UINT8) 0x20
779 #define ACPI_GPE_RUN_ENABLED            (UINT8) 0x20
780 #define ACPI_GPE_RUN_DISABLED           (UINT8) 0x00    /* Default */
781 
782 #define ACPI_GPE_WAKE_ENABLE_MASK       (UINT8) 0x40
783 #define ACPI_GPE_WAKE_ENABLED           (UINT8) 0x40
784 #define ACPI_GPE_WAKE_DISABLED          (UINT8) 0x00    /* Default */
785 
786 #define ACPI_GPE_ENABLE_MASK            (UINT8) 0x60    /* Both run/wake */
787 
788 /*
789  * Flags for GPE and Lock interfaces
790  */
791 #define ACPI_EVENT_WAKE_ENABLE          0x2             /* AcpiGpeEnable */
792 #define ACPI_EVENT_WAKE_DISABLE         0x2             /* AcpiGpeDisable */
793 
794 #define ACPI_NOT_ISR                    0x1
795 #define ACPI_ISR                        0x0
796 
797 
798 /* Notify types */
799 
800 #define ACPI_SYSTEM_NOTIFY              0x1
801 #define ACPI_DEVICE_NOTIFY              0x2
802 #define ACPI_ALL_NOTIFY                 (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
803 #define ACPI_MAX_NOTIFY_HANDLER_TYPE    0x3
804 
805 #define ACPI_MAX_SYS_NOTIFY             0x7f
806 
807 
808 /* Address Space (Operation Region) Types */
809 
810 typedef UINT8                           ACPI_ADR_SPACE_TYPE;
811 
812 #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
813 #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
814 #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
815 #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
816 #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
817 #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
818 #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
819 #define ACPI_ADR_SPACE_DATA_TABLE       (ACPI_ADR_SPACE_TYPE) 7
820 #define ACPI_ADR_SPACE_FIXED_HARDWARE   (ACPI_ADR_SPACE_TYPE) 127
821 
822 
823 /*
824  * BitRegister IDs
825  *
826  * These values are intended to be used by the hardware interfaces
827  * and are mapped to individual bitfields defined within the ACPI
828  * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c
829  * for this mapping.
830  */
831 
832 /* PM1 Status register */
833 
834 #define ACPI_BITREG_TIMER_STATUS                0x00
835 #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
836 #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
837 #define ACPI_BITREG_POWER_BUTTON_STATUS         0x03
838 #define ACPI_BITREG_SLEEP_BUTTON_STATUS         0x04
839 #define ACPI_BITREG_RT_CLOCK_STATUS             0x05
840 #define ACPI_BITREG_WAKE_STATUS                 0x06
841 #define ACPI_BITREG_PCIEXP_WAKE_STATUS          0x07
842 
843 /* PM1 Enable register */
844 
845 #define ACPI_BITREG_TIMER_ENABLE                0x08
846 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x09
847 #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x0A
848 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0B
849 #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0C
850 #define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0D
851 
852 /* PM1 Control register */
853 
854 #define ACPI_BITREG_SCI_ENABLE                  0x0E
855 #define ACPI_BITREG_BUS_MASTER_RLD              0x0F
856 #define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x10
857 #define ACPI_BITREG_SLEEP_TYPE                  0x11
858 #define ACPI_BITREG_SLEEP_ENABLE                0x12
859 
860 /* PM2 Control register */
861 
862 #define ACPI_BITREG_ARB_DISABLE                 0x13
863 
864 #define ACPI_BITREG_MAX                         0x13
865 #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
866 
867 
868 /* Status register values. A 1 clears a status bit. 0 = no effect */
869 
870 #define ACPI_CLEAR_STATUS                       1
871 
872 /* Enable and Control register values */
873 
874 #define ACPI_ENABLE_EVENT                       1
875 #define ACPI_DISABLE_EVENT                      0
876 
877 
878 /*
879  * External ACPI object definition
880  */
881 
882 /*
883  * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element
884  * or an unresolved named reference.
885  */
886 typedef union acpi_object
887 {
888     ACPI_OBJECT_TYPE                Type;   /* See definition of AcpiNsType for values */
889     struct
890     {
891         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_INTEGER */
892         ACPI_INTEGER                    Value;      /* The actual number */
893     } Integer;
894 
895     struct
896     {
897         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_STRING */
898         UINT32                          Length;     /* # of bytes in string, excluding trailing null */
899         char                            *Pointer;   /* points to the string value */
900     } String;
901 
902     struct
903     {
904         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_BUFFER */
905         UINT32                          Length;     /* # of bytes in buffer */
906         UINT8                           *Pointer;   /* points to the buffer */
907     } Buffer;
908 
909     struct
910     {
911         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PACKAGE */
912         UINT32                          Count;      /* # of elements in package */
913         union acpi_object               *Elements;  /* Pointer to an array of ACPI_OBJECTs */
914     } Package;
915 
916     struct
917     {
918         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_LOCAL_REFERENCE */
919         ACPI_OBJECT_TYPE                ActualType; /* Type associated with the Handle */
920         ACPI_HANDLE                     Handle;     /* object reference */
921     } Reference;
922 
923     struct
924     {
925         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PROCESSOR */
926         UINT32                          ProcId;
927         ACPI_IO_ADDRESS                 PblkAddress;
928         UINT32                          PblkLength;
929     } Processor;
930 
931     struct
932     {
933         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_POWER */
934         UINT32                          SystemLevel;
935         UINT32                          ResourceOrder;
936     } PowerResource;
937 
938 } ACPI_OBJECT;
939 
940 
941 /*
942  * List of objects, used as a parameter list for control method evaluation
943  */
944 typedef struct acpi_object_list
945 {
946     UINT32                          Count;
947     ACPI_OBJECT                     *Pointer;
948 
949 } ACPI_OBJECT_LIST;
950 
951 
952 /*
953  * Miscellaneous common Data Structures used by the interfaces
954  */
955 #define ACPI_NO_BUFFER              0
956 #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (-1)
957 #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (-2)
958 
959 typedef struct acpi_buffer
960 {
961     ACPI_SIZE                       Length;         /* Length in bytes of the buffer */
962     void                            *Pointer;       /* pointer to buffer */
963 
964 } ACPI_BUFFER;
965 
966 
967 /*
968  * NameType for AcpiGetName
969  */
970 #define ACPI_FULL_PATHNAME              0
971 #define ACPI_SINGLE_NAME                1
972 #define ACPI_NAME_TYPE_MAX              1
973 
974 
975 /*
976  * Predefined Namespace items
977  */
978 typedef struct acpi_predefined_names
979 {
980     char                            *Name;
981     UINT8                           Type;
982     char                            *Val;
983 
984 } ACPI_PREDEFINED_NAMES;
985 
986 
987 /*
988  * Structure and flags for AcpiGetSystemInfo
989  */
990 #define ACPI_SYS_MODE_UNKNOWN           0x0000
991 #define ACPI_SYS_MODE_ACPI              0x0001
992 #define ACPI_SYS_MODE_LEGACY            0x0002
993 #define ACPI_SYS_MODES_MASK             0x0003
994 
995 
996 /*
997  * System info returned by AcpiGetSystemInfo()
998  */
999 typedef struct acpi_system_info
1000 {
1001     UINT32                          AcpiCaVersion;
1002     UINT32                          Flags;
1003     UINT32                          TimerResolution;
1004     UINT32                          Reserved1;
1005     UINT32                          Reserved2;
1006     UINT32                          DebugLevel;
1007     UINT32                          DebugLayer;
1008 
1009 } ACPI_SYSTEM_INFO;
1010 
1011 
1012 /*
1013  * System statistics returned by AcpiGetStatistics()
1014  */
1015 typedef struct acpi_statistics
1016 {
1017     UINT32                          SciCount;
1018     UINT32                          GpeCount;
1019     UINT32                          FixedEventCount[ACPI_NUM_FIXED_EVENTS];
1020     UINT32                          MethodCount;
1021 
1022 } ACPI_STATISTICS;
1023 
1024 
1025 /* Table Event Types */
1026 
1027 #define ACPI_TABLE_EVENT_LOAD           0x0
1028 #define ACPI_TABLE_EVENT_UNLOAD         0x1
1029 #define ACPI_NUM_TABLE_EVENTS           2
1030 
1031 
1032 /*
1033  * Types specific to the OS service interfaces
1034  */
1035 typedef UINT32
1036 (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
1037     void                            *Context);
1038 
1039 typedef void
1040 (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
1041     void                            *Context);
1042 
1043 /*
1044  * Various handlers and callback procedures
1045  */
1046 typedef
1047 UINT32 (*ACPI_EVENT_HANDLER) (
1048     void                            *Context);
1049 
1050 typedef
1051 void (*ACPI_NOTIFY_HANDLER) (
1052     ACPI_HANDLE                     Device,
1053     UINT32                          Value,
1054     void                            *Context);
1055 
1056 typedef
1057 void (*ACPI_OBJECT_HANDLER) (
1058     ACPI_HANDLE                     Object,
1059     UINT32                          Function,
1060     void                            *Data);
1061 
1062 typedef
1063 ACPI_STATUS (*ACPI_INIT_HANDLER) (
1064     ACPI_HANDLE                     Object,
1065     UINT32                          Function);
1066 
1067 #define ACPI_INIT_DEVICE_INI        1
1068 
1069 typedef
1070 ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) (
1071     ACPI_STATUS                     AmlStatus,
1072     ACPI_NAME                       Name,
1073     UINT16                          Opcode,
1074     UINT32                          AmlOffset,
1075     void                            *Context);
1076 
1077 /* Table Event handler (Load, LoadTable, etc.) and types */
1078 
1079 typedef
1080 ACPI_STATUS (*ACPI_TABLE_HANDLER) (
1081     UINT32                          Event,
1082     void                            *Table,
1083     void                            *Context);
1084 
1085 #define ACPI_TABLE_LOAD             0x0
1086 #define ACPI_TABLE_UNLOAD           0x1
1087 #define ACPI_NUM_TABLE_EVENTS       2
1088 
1089 
1090 /* Address Spaces (For Operation Regions) */
1091 
1092 typedef
1093 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
1094     UINT32                          Function,
1095     ACPI_PHYSICAL_ADDRESS           Address,
1096     UINT32                          BitWidth,
1097     ACPI_INTEGER                    *Value,
1098     void                            *HandlerContext,
1099     void                            *RegionContext);
1100 
1101 #define ACPI_DEFAULT_HANDLER            NULL
1102 
1103 typedef
1104 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
1105     ACPI_HANDLE                     RegionHandle,
1106     UINT32                          Function,
1107     void                            *HandlerContext,
1108     void                            **RegionContext);
1109 
1110 #define ACPI_REGION_ACTIVATE    0
1111 #define ACPI_REGION_DEACTIVATE  1
1112 
1113 typedef
1114 ACPI_STATUS (*ACPI_WALK_CALLBACK) (
1115     ACPI_HANDLE                     ObjHandle,
1116     UINT32                          NestingLevel,
1117     void                            *Context,
1118     void                            **ReturnValue);
1119 
1120 
1121 /* Interrupt handler return values */
1122 
1123 #define ACPI_INTERRUPT_NOT_HANDLED      0x00
1124 #define ACPI_INTERRUPT_HANDLED          0x01
1125 
1126 
1127 /* Length of _HID, _UID, _CID, and UUID values */
1128 
1129 #define ACPI_DEVICE_ID_LENGTH           0x09
1130 #define ACPI_MAX_CID_LENGTH             48
1131 #define ACPI_UUID_LENGTH                16
1132 
1133 /* Common string version of device HIDs and UIDs */
1134 
1135 typedef struct acpi_device_id
1136 {
1137     char                            Value[ACPI_DEVICE_ID_LENGTH];
1138 
1139 } ACPI_DEVICE_ID;
1140 
1141 /* Common string version of device CIDs */
1142 
1143 typedef struct acpi_compatible_id
1144 {
1145     char                            Value[ACPI_MAX_CID_LENGTH];
1146 
1147 } ACPI_COMPATIBLE_ID;
1148 
1149 typedef struct acpi_compatible_id_list
1150 {
1151     UINT32                          Count;
1152     UINT32                          Size;
1153     ACPI_COMPATIBLE_ID              Id[1];
1154 
1155 } ACPI_COMPATIBLE_ID_LIST;
1156 
1157 
1158 /* Structure and flags for AcpiGetObjectInfo */
1159 
1160 #define ACPI_VALID_STA                  0x0001
1161 #define ACPI_VALID_ADR                  0x0002
1162 #define ACPI_VALID_HID                  0x0004
1163 #define ACPI_VALID_UID                  0x0008
1164 #define ACPI_VALID_CID                  0x0010
1165 #define ACPI_VALID_SXDS                 0x0020
1166 
1167 /* Flags for _STA method */
1168 
1169 #define ACPI_STA_DEVICE_PRESENT         0x01
1170 #define ACPI_STA_DEVICE_ENABLED         0x02
1171 #define ACPI_STA_DEVICE_UI              0x04
1172 #define ACPI_STA_DEVICE_FUNCTIONING     0x08
1173 #define ACPI_STA_DEVICE_OK              0x08 /* Synonym */
1174 #define ACPI_STA_BATTERY_PRESENT        0x10
1175 
1176 
1177 #define ACPI_COMMON_OBJ_INFO \
1178     ACPI_OBJECT_TYPE                Type;           /* ACPI object type */ \
1179     ACPI_NAME                       Name            /* ACPI object Name */
1180 
1181 
1182 typedef struct acpi_obj_info_header
1183 {
1184     ACPI_COMMON_OBJ_INFO;
1185 
1186 } ACPI_OBJ_INFO_HEADER;
1187 
1188 
1189 /* Structure returned from Get Object Info */
1190 
1191 typedef struct acpi_device_info
1192 {
1193     ACPI_COMMON_OBJ_INFO;
1194 
1195     UINT32                          ParamCount;         /* If a method, required parameter count */
1196     UINT32                          Valid;              /* Indicates which fields below are valid */
1197     UINT32                          CurrentStatus;      /* _STA value */
1198     ACPI_INTEGER                    Address;            /* _ADR value if any */
1199     ACPI_DEVICE_ID                  HardwareId;         /* _HID value if any */
1200     ACPI_DEVICE_ID                  UniqueId;           /* _UID value if any */
1201     UINT8                           HighestDstates[4];  /* _SxD values: 0xFF indicates not valid */
1202     ACPI_COMPATIBLE_ID_LIST         CompatibilityId;    /* List of _CIDs if any */
1203 
1204 } ACPI_DEVICE_INFO;
1205 
1206 
1207 /* Context structs for address space handlers */
1208 
1209 typedef struct acpi_pci_id
1210 {
1211     UINT16                          Segment;
1212     UINT16                          Bus;
1213     UINT16                          Device;
1214     UINT16                          Function;
1215 
1216 } ACPI_PCI_ID;
1217 
1218 
1219 typedef struct acpi_mem_space_context
1220 {
1221     UINT32                          Length;
1222     ACPI_PHYSICAL_ADDRESS           Address;
1223     ACPI_PHYSICAL_ADDRESS           MappedPhysicalAddress;
1224     UINT8                           *MappedLogicalAddress;
1225     ACPI_SIZE                       MappedLength;
1226 
1227 } ACPI_MEM_SPACE_CONTEXT;
1228 
1229 
1230 /*
1231  * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled
1232  */
1233 typedef struct acpi_memory_list
1234 {
1235     char                            *ListName;
1236     void                            *ListHead;
1237     UINT16                          ObjectSize;
1238     UINT16                          MaxDepth;
1239     UINT16                          CurrentDepth;
1240     UINT16                          LinkOffset;
1241 
1242 #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1243 
1244     /* Statistics for debug memory tracking only */
1245 
1246     UINT32                          TotalAllocated;
1247     UINT32                          TotalFreed;
1248     UINT32                          MaxOccupied;
1249     UINT32                          TotalSize;
1250     UINT32                          CurrentTotalSize;
1251     UINT32                          Requests;
1252     UINT32                          Hits;
1253 #endif
1254 
1255 } ACPI_MEMORY_LIST;
1256 
1257 
1258 #endif /* __ACTYPES_H__ */
1259