xref: /minix/minix/drivers/power/acpi/include/actypes.h (revision 29492bb7)
1433d6423SLionel Sambuc /******************************************************************************
2433d6423SLionel Sambuc  *
3433d6423SLionel Sambuc  * Name: actypes.h - Common data types for the entire ACPI subsystem
4433d6423SLionel Sambuc  *
5433d6423SLionel Sambuc  *****************************************************************************/
6433d6423SLionel Sambuc 
7*29492bb7SDavid van Moolenbroek /*
8*29492bb7SDavid van Moolenbroek  * Copyright (C) 2000 - 2014, Intel Corp.
9433d6423SLionel Sambuc  * All rights reserved.
10433d6423SLionel Sambuc  *
11*29492bb7SDavid van Moolenbroek  * Redistribution and use in source and binary forms, with or without
12*29492bb7SDavid van Moolenbroek  * modification, are permitted provided that the following conditions
13*29492bb7SDavid van Moolenbroek  * are met:
14*29492bb7SDavid van Moolenbroek  * 1. Redistributions of source code must retain the above copyright
15*29492bb7SDavid van Moolenbroek  *    notice, this list of conditions, and the following disclaimer,
16*29492bb7SDavid van Moolenbroek  *    without modification.
17*29492bb7SDavid van Moolenbroek  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18*29492bb7SDavid van Moolenbroek  *    substantially similar to the "NO WARRANTY" disclaimer below
19*29492bb7SDavid van Moolenbroek  *    ("Disclaimer") and any redistribution must be conditioned upon
20*29492bb7SDavid van Moolenbroek  *    including a substantially similar Disclaimer requirement for further
21*29492bb7SDavid van Moolenbroek  *    binary redistribution.
22*29492bb7SDavid van Moolenbroek  * 3. Neither the names of the above-listed copyright holders nor the names
23*29492bb7SDavid van Moolenbroek  *    of any contributors may be used to endorse or promote products derived
24*29492bb7SDavid van Moolenbroek  *    from this software without specific prior written permission.
25433d6423SLionel Sambuc  *
26*29492bb7SDavid van Moolenbroek  * Alternatively, this software may be distributed under the terms of the
27*29492bb7SDavid van Moolenbroek  * GNU General Public License ("GPL") version 2 as published by the Free
28*29492bb7SDavid van Moolenbroek  * Software Foundation.
29433d6423SLionel Sambuc  *
30*29492bb7SDavid van Moolenbroek  * NO WARRANTY
31*29492bb7SDavid van Moolenbroek  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32*29492bb7SDavid van Moolenbroek  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33*29492bb7SDavid van Moolenbroek  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34*29492bb7SDavid van Moolenbroek  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35*29492bb7SDavid van Moolenbroek  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36*29492bb7SDavid van Moolenbroek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37*29492bb7SDavid van Moolenbroek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38*29492bb7SDavid van Moolenbroek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*29492bb7SDavid van Moolenbroek  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40*29492bb7SDavid van Moolenbroek  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41*29492bb7SDavid van Moolenbroek  * POSSIBILITY OF SUCH DAMAGES.
42*29492bb7SDavid van Moolenbroek  */
43433d6423SLionel Sambuc 
44433d6423SLionel Sambuc #ifndef __ACTYPES_H__
45433d6423SLionel Sambuc #define __ACTYPES_H__
46433d6423SLionel Sambuc 
47433d6423SLionel Sambuc /* acpisrc:StructDefs -- for acpisrc conversion */
48433d6423SLionel Sambuc 
49433d6423SLionel Sambuc /*
50433d6423SLionel Sambuc  * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
51433d6423SLionel Sambuc  * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of
52433d6423SLionel Sambuc  * 12/2006.
53433d6423SLionel Sambuc  */
54433d6423SLionel Sambuc #ifndef ACPI_MACHINE_WIDTH
55433d6423SLionel Sambuc #error ACPI_MACHINE_WIDTH not defined
56433d6423SLionel Sambuc #endif
57433d6423SLionel Sambuc 
58433d6423SLionel Sambuc /*
59433d6423SLionel Sambuc  * Data type ranges
60433d6423SLionel Sambuc  * Note: These macros are designed to be compiler independent as well as
61433d6423SLionel Sambuc  * working around problems that some 32-bit compilers have with 64-bit
62433d6423SLionel Sambuc  * constants.
63433d6423SLionel Sambuc  */
64433d6423SLionel Sambuc #define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0)) /* 0xFF               */
65433d6423SLionel Sambuc #define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0)) /* 0xFFFF             */
66433d6423SLionel Sambuc #define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF         */
67433d6423SLionel Sambuc #define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
68433d6423SLionel Sambuc #define ACPI_ASCII_MAX                  0x7F
69433d6423SLionel Sambuc 
70433d6423SLionel Sambuc 
71433d6423SLionel Sambuc /*
72433d6423SLionel Sambuc  * Architecture-specific ACPICA Subsystem Data Types
73433d6423SLionel Sambuc  *
74433d6423SLionel Sambuc  * The goal of these types is to provide source code portability across
75433d6423SLionel Sambuc  * 16-bit, 32-bit, and 64-bit targets.
76433d6423SLionel Sambuc  *
77433d6423SLionel Sambuc  * 1) The following types are of fixed size for all targets (16/32/64):
78433d6423SLionel Sambuc  *
79433d6423SLionel Sambuc  * BOOLEAN      Logical boolean
80433d6423SLionel Sambuc  *
81433d6423SLionel Sambuc  * UINT8        8-bit  (1 byte) unsigned value
82433d6423SLionel Sambuc  * UINT16       16-bit (2 byte) unsigned value
83433d6423SLionel Sambuc  * UINT32       32-bit (4 byte) unsigned value
84433d6423SLionel Sambuc  * UINT64       64-bit (8 byte) unsigned value
85433d6423SLionel Sambuc  *
86433d6423SLionel Sambuc  * INT16        16-bit (2 byte) signed value
87433d6423SLionel Sambuc  * INT32        32-bit (4 byte) signed value
88433d6423SLionel Sambuc  * INT64        64-bit (8 byte) signed value
89433d6423SLionel Sambuc  *
90433d6423SLionel Sambuc  * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
91433d6423SLionel Sambuc  * compiler-dependent header(s) and were introduced because there is no common
92433d6423SLionel Sambuc  * 64-bit integer type across the various compilation models, as shown in
93433d6423SLionel Sambuc  * the table below.
94433d6423SLionel Sambuc  *
95433d6423SLionel Sambuc  * Datatype  LP64 ILP64 LLP64 ILP32 LP32 16bit
96433d6423SLionel Sambuc  * char      8    8     8     8     8    8
97433d6423SLionel Sambuc  * short     16   16    16    16    16   16
98433d6423SLionel Sambuc  * _int32         32
99433d6423SLionel Sambuc  * int       32   64    32    32    16   16
100433d6423SLionel Sambuc  * long      64   64    32    32    32   32
101433d6423SLionel Sambuc  * long long            64    64
102433d6423SLionel Sambuc  * pointer   64   64    64    32    32   32
103433d6423SLionel Sambuc  *
104433d6423SLionel Sambuc  * Note: ILP64 and LP32 are currently not supported.
105433d6423SLionel Sambuc  *
106433d6423SLionel Sambuc  *
107433d6423SLionel Sambuc  * 2) These types represent the native word size of the target mode of the
108433d6423SLionel Sambuc  * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
109433d6423SLionel Sambuc  * usually used for memory allocation, efficient loop counters, and array
110433d6423SLionel Sambuc  * indexes. The types are similar to the size_t type in the C library and are
111433d6423SLionel Sambuc  * required because there is no C type that consistently represents the native
112433d6423SLionel Sambuc  * data width. ACPI_SIZE is needed because there is no guarantee that a
113433d6423SLionel Sambuc  * kernel-level C library is present.
114433d6423SLionel Sambuc  *
115433d6423SLionel Sambuc  * ACPI_SIZE        16/32/64-bit unsigned value
116433d6423SLionel Sambuc  * ACPI_NATIVE_INT  16/32/64-bit signed value
117433d6423SLionel Sambuc  */
118433d6423SLionel Sambuc 
119433d6423SLionel Sambuc /*******************************************************************************
120433d6423SLionel Sambuc  *
121433d6423SLionel Sambuc  * Common types for all compilers, all targets
122433d6423SLionel Sambuc  *
123433d6423SLionel Sambuc  ******************************************************************************/
124433d6423SLionel Sambuc 
125*29492bb7SDavid van Moolenbroek #ifndef ACPI_USE_SYSTEM_INTTYPES
126*29492bb7SDavid van Moolenbroek 
127433d6423SLionel Sambuc typedef unsigned char                   BOOLEAN;
128433d6423SLionel Sambuc typedef unsigned char                   UINT8;
129433d6423SLionel Sambuc typedef unsigned short                  UINT16;
130*29492bb7SDavid van Moolenbroek typedef short                           INT16;
131433d6423SLionel Sambuc typedef COMPILER_DEPENDENT_UINT64       UINT64;
132433d6423SLionel Sambuc typedef COMPILER_DEPENDENT_INT64        INT64;
133433d6423SLionel Sambuc 
134*29492bb7SDavid van Moolenbroek #endif /* ACPI_USE_SYSTEM_INTTYPES */
135*29492bb7SDavid van Moolenbroek 
136*29492bb7SDavid van Moolenbroek /*
137*29492bb7SDavid van Moolenbroek  * Value returned by AcpiOsGetThreadId. There is no standard "thread_id"
138*29492bb7SDavid van Moolenbroek  * across operating systems or even the various UNIX systems. Since ACPICA
139*29492bb7SDavid van Moolenbroek  * only needs the thread ID as a unique thread identifier, we use a UINT64
140*29492bb7SDavid van Moolenbroek  * as the only common data type - it will accommodate any type of pointer or
141*29492bb7SDavid van Moolenbroek  * any type of integer. It is up to the host-dependent OSL to cast the
142*29492bb7SDavid van Moolenbroek  * native thread ID type to a UINT64 (in AcpiOsGetThreadId).
143*29492bb7SDavid van Moolenbroek  */
144*29492bb7SDavid van Moolenbroek #define ACPI_THREAD_ID                  UINT64
145433d6423SLionel Sambuc 
146433d6423SLionel Sambuc 
147433d6423SLionel Sambuc /*******************************************************************************
148433d6423SLionel Sambuc  *
149433d6423SLionel Sambuc  * Types specific to 64-bit targets
150433d6423SLionel Sambuc  *
151433d6423SLionel Sambuc  ******************************************************************************/
152433d6423SLionel Sambuc 
153433d6423SLionel Sambuc #if ACPI_MACHINE_WIDTH == 64
154433d6423SLionel Sambuc 
155*29492bb7SDavid van Moolenbroek #ifndef ACPI_USE_SYSTEM_INTTYPES
156433d6423SLionel Sambuc 
157433d6423SLionel Sambuc typedef unsigned int                    UINT32;
158433d6423SLionel Sambuc typedef int                             INT32;
159433d6423SLionel Sambuc 
160*29492bb7SDavid van Moolenbroek #endif /* ACPI_USE_SYSTEM_INTTYPES */
161433d6423SLionel Sambuc 
162433d6423SLionel Sambuc 
163433d6423SLionel Sambuc typedef INT64                           ACPI_NATIVE_INT;
164433d6423SLionel Sambuc typedef UINT64                          ACPI_SIZE;
165433d6423SLionel Sambuc typedef UINT64                          ACPI_IO_ADDRESS;
166433d6423SLionel Sambuc typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
167433d6423SLionel Sambuc 
168433d6423SLionel Sambuc #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
169433d6423SLionel Sambuc #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
170433d6423SLionel Sambuc #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
171433d6423SLionel Sambuc 
172433d6423SLionel Sambuc /*
173433d6423SLionel Sambuc  * In the case of the Itanium Processor Family (IPF), the hardware does not
174433d6423SLionel Sambuc  * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
175433d6423SLionel Sambuc  * to indicate that special precautions must be taken to avoid alignment faults.
176433d6423SLionel Sambuc  * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
177433d6423SLionel Sambuc  *
178433d6423SLionel Sambuc  * Note: EM64T and other X86-64 processors support misaligned transfers,
179433d6423SLionel Sambuc  * so there is no need to define this flag.
180433d6423SLionel Sambuc  */
181433d6423SLionel Sambuc #if defined (__IA64__) || defined (__ia64__)
182433d6423SLionel Sambuc #define ACPI_MISALIGNMENT_NOT_SUPPORTED
183433d6423SLionel Sambuc #endif
184433d6423SLionel Sambuc 
185433d6423SLionel Sambuc 
186433d6423SLionel Sambuc /*******************************************************************************
187433d6423SLionel Sambuc  *
188433d6423SLionel Sambuc  * Types specific to 32-bit targets
189433d6423SLionel Sambuc  *
190433d6423SLionel Sambuc  ******************************************************************************/
191433d6423SLionel Sambuc 
192433d6423SLionel Sambuc #elif ACPI_MACHINE_WIDTH == 32
193433d6423SLionel Sambuc 
194*29492bb7SDavid van Moolenbroek #ifndef ACPI_USE_SYSTEM_INTTYPES
195433d6423SLionel Sambuc 
196433d6423SLionel Sambuc typedef unsigned int                    UINT32;
197433d6423SLionel Sambuc typedef int                             INT32;
198433d6423SLionel Sambuc 
199*29492bb7SDavid van Moolenbroek #endif /* ACPI_USE_SYSTEM_INTTYPES */
200433d6423SLionel Sambuc 
201433d6423SLionel Sambuc 
202433d6423SLionel Sambuc typedef INT32                           ACPI_NATIVE_INT;
203433d6423SLionel Sambuc typedef UINT32                          ACPI_SIZE;
204433d6423SLionel Sambuc typedef UINT32                          ACPI_IO_ADDRESS;
205433d6423SLionel Sambuc typedef UINT32                          ACPI_PHYSICAL_ADDRESS;
206433d6423SLionel Sambuc 
207433d6423SLionel Sambuc #define ACPI_MAX_PTR                    ACPI_UINT32_MAX
208433d6423SLionel Sambuc #define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
209433d6423SLionel Sambuc 
210433d6423SLionel Sambuc #else
211433d6423SLionel Sambuc 
212433d6423SLionel Sambuc /* ACPI_MACHINE_WIDTH must be either 64 or 32 */
213433d6423SLionel Sambuc 
214433d6423SLionel Sambuc #error unknown ACPI_MACHINE_WIDTH
215433d6423SLionel Sambuc #endif
216433d6423SLionel Sambuc 
217433d6423SLionel Sambuc 
218433d6423SLionel Sambuc /*******************************************************************************
219433d6423SLionel Sambuc  *
220433d6423SLionel Sambuc  * OS-dependent types
221433d6423SLionel Sambuc  *
222433d6423SLionel Sambuc  * If the defaults below are not appropriate for the host system, they can
223433d6423SLionel Sambuc  * be defined in the OS-specific header, and this will take precedence.
224433d6423SLionel Sambuc  *
225433d6423SLionel Sambuc  ******************************************************************************/
226433d6423SLionel Sambuc 
227433d6423SLionel Sambuc /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
228433d6423SLionel Sambuc 
229433d6423SLionel Sambuc #ifndef ACPI_CPU_FLAGS
230433d6423SLionel Sambuc #define ACPI_CPU_FLAGS                  ACPI_SIZE
231433d6423SLionel Sambuc #endif
232433d6423SLionel Sambuc 
233433d6423SLionel Sambuc /* Object returned from AcpiOsCreateCache */
234433d6423SLionel Sambuc 
235433d6423SLionel Sambuc #ifndef ACPI_CACHE_T
236433d6423SLionel Sambuc #ifdef ACPI_USE_LOCAL_CACHE
237433d6423SLionel Sambuc #define ACPI_CACHE_T                    ACPI_MEMORY_LIST
238433d6423SLionel Sambuc #else
239433d6423SLionel Sambuc #define ACPI_CACHE_T                    void *
240433d6423SLionel Sambuc #endif
241433d6423SLionel Sambuc #endif
242433d6423SLionel Sambuc 
243433d6423SLionel Sambuc /*
244433d6423SLionel Sambuc  * Synchronization objects - Mutexes, Semaphores, and SpinLocks
245433d6423SLionel Sambuc  */
246433d6423SLionel Sambuc #if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
247433d6423SLionel Sambuc /*
248433d6423SLionel Sambuc  * These macros are used if the host OS does not support a mutex object.
249433d6423SLionel Sambuc  * Map the OSL Mutex interfaces to binary semaphores.
250433d6423SLionel Sambuc  */
251433d6423SLionel Sambuc #define ACPI_MUTEX                      ACPI_SEMAPHORE
252433d6423SLionel Sambuc #define AcpiOsCreateMutex(OutHandle)    AcpiOsCreateSemaphore (1, 1, OutHandle)
253433d6423SLionel Sambuc #define AcpiOsDeleteMutex(Handle)       (void) AcpiOsDeleteSemaphore (Handle)
254433d6423SLionel Sambuc #define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
255433d6423SLionel Sambuc #define AcpiOsReleaseMutex(Handle)      (void) AcpiOsSignalSemaphore (Handle, 1)
256433d6423SLionel Sambuc #endif
257433d6423SLionel Sambuc 
258433d6423SLionel Sambuc /* Configurable types for synchronization objects */
259433d6423SLionel Sambuc 
260433d6423SLionel Sambuc #ifndef ACPI_SPINLOCK
261433d6423SLionel Sambuc #define ACPI_SPINLOCK                   void *
262433d6423SLionel Sambuc #endif
263433d6423SLionel Sambuc 
264433d6423SLionel Sambuc #ifndef ACPI_SEMAPHORE
265433d6423SLionel Sambuc #define ACPI_SEMAPHORE                  void *
266433d6423SLionel Sambuc #endif
267433d6423SLionel Sambuc 
268433d6423SLionel Sambuc #ifndef ACPI_MUTEX
269433d6423SLionel Sambuc #define ACPI_MUTEX                      void *
270433d6423SLionel Sambuc #endif
271433d6423SLionel Sambuc 
272433d6423SLionel Sambuc 
273433d6423SLionel Sambuc /*******************************************************************************
274433d6423SLionel Sambuc  *
275433d6423SLionel Sambuc  * Compiler-dependent types
276433d6423SLionel Sambuc  *
277433d6423SLionel Sambuc  * If the defaults below are not appropriate for the host compiler, they can
278433d6423SLionel Sambuc  * be defined in the compiler-specific header, and this will take precedence.
279433d6423SLionel Sambuc  *
280433d6423SLionel Sambuc  ******************************************************************************/
281433d6423SLionel Sambuc 
282433d6423SLionel Sambuc /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
283433d6423SLionel Sambuc 
284433d6423SLionel Sambuc #ifndef ACPI_UINTPTR_T
285433d6423SLionel Sambuc #define ACPI_UINTPTR_T                  void *
286433d6423SLionel Sambuc #endif
287433d6423SLionel Sambuc 
288433d6423SLionel Sambuc /*
289433d6423SLionel Sambuc  * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
290433d6423SLionel Sambuc  * some compilers can catch printf format string problems
291433d6423SLionel Sambuc  */
292433d6423SLionel Sambuc #ifndef ACPI_PRINTF_LIKE
293433d6423SLionel Sambuc #define ACPI_PRINTF_LIKE(c)
294433d6423SLionel Sambuc #endif
295433d6423SLionel Sambuc 
296433d6423SLionel Sambuc /*
297433d6423SLionel Sambuc  * Some compilers complain about unused variables. Sometimes we don't want to
298433d6423SLionel Sambuc  * use all the variables (for example, _AcpiModuleName). This allows us
299*29492bb7SDavid van Moolenbroek  * to tell the compiler in a per-variable manner that a variable
300433d6423SLionel Sambuc  * is unused
301433d6423SLionel Sambuc  */
302433d6423SLionel Sambuc #ifndef ACPI_UNUSED_VAR
303433d6423SLionel Sambuc #define ACPI_UNUSED_VAR
304433d6423SLionel Sambuc #endif
305433d6423SLionel Sambuc 
306433d6423SLionel Sambuc /*
307*29492bb7SDavid van Moolenbroek  * All ACPICA external functions that are available to the rest of the kernel
308*29492bb7SDavid van Moolenbroek  * are tagged with thes macros which can be defined as appropriate for the host.
309*29492bb7SDavid van Moolenbroek  *
310*29492bb7SDavid van Moolenbroek  * Notes:
311*29492bb7SDavid van Moolenbroek  * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination
312*29492bb7SDavid van Moolenbroek  * interfaces that may need special processing.
313*29492bb7SDavid van Moolenbroek  * ACPI_EXPORT_SYMBOL is used for all other public external functions.
314433d6423SLionel Sambuc  */
315*29492bb7SDavid van Moolenbroek #ifndef ACPI_EXPORT_SYMBOL_INIT
316*29492bb7SDavid van Moolenbroek #define ACPI_EXPORT_SYMBOL_INIT(Symbol)
317*29492bb7SDavid van Moolenbroek #endif
318*29492bb7SDavid van Moolenbroek 
319433d6423SLionel Sambuc #ifndef ACPI_EXPORT_SYMBOL
320433d6423SLionel Sambuc #define ACPI_EXPORT_SYMBOL(Symbol)
321433d6423SLionel Sambuc #endif
322433d6423SLionel Sambuc 
323*29492bb7SDavid van Moolenbroek /*
324*29492bb7SDavid van Moolenbroek  * Compiler/Clibrary-dependent debug initialization. Used for ACPICA
325*29492bb7SDavid van Moolenbroek  * utilities only.
326*29492bb7SDavid van Moolenbroek  */
327*29492bb7SDavid van Moolenbroek #ifndef ACPI_DEBUG_INITIALIZE
328*29492bb7SDavid van Moolenbroek #define ACPI_DEBUG_INITIALIZE()
329*29492bb7SDavid van Moolenbroek #endif
330*29492bb7SDavid van Moolenbroek 
331*29492bb7SDavid van Moolenbroek 
332*29492bb7SDavid van Moolenbroek /*******************************************************************************
333*29492bb7SDavid van Moolenbroek  *
334*29492bb7SDavid van Moolenbroek  * Configuration
335*29492bb7SDavid van Moolenbroek  *
336*29492bb7SDavid van Moolenbroek  ******************************************************************************/
337*29492bb7SDavid van Moolenbroek 
338*29492bb7SDavid van Moolenbroek #ifdef ACPI_NO_MEM_ALLOCATIONS
339*29492bb7SDavid van Moolenbroek 
340*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE(a)                NULL
341*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE_ZEROED(a)         NULL
342*29492bb7SDavid van Moolenbroek #define ACPI_FREE(a)
343*29492bb7SDavid van Moolenbroek #define ACPI_MEM_TRACKING(a)
344*29492bb7SDavid van Moolenbroek 
345*29492bb7SDavid van Moolenbroek #else /* ACPI_NO_MEM_ALLOCATIONS */
346*29492bb7SDavid van Moolenbroek 
347*29492bb7SDavid van Moolenbroek #ifdef ACPI_DBG_TRACK_ALLOCATIONS
348*29492bb7SDavid van Moolenbroek /*
349*29492bb7SDavid van Moolenbroek  * Memory allocation tracking (used by AcpiExec to detect memory leaks)
350*29492bb7SDavid van Moolenbroek  */
351*29492bb7SDavid van Moolenbroek #define ACPI_MEM_PARAMETERS             _COMPONENT, _AcpiModuleName, __LINE__
352*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE(a)                AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
353*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE_ZEROED(a)         AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
354*29492bb7SDavid van Moolenbroek #define ACPI_FREE(a)                    AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS)
355*29492bb7SDavid van Moolenbroek #define ACPI_MEM_TRACKING(a)            a
356*29492bb7SDavid van Moolenbroek 
357*29492bb7SDavid van Moolenbroek #else
358*29492bb7SDavid van Moolenbroek /*
359*29492bb7SDavid van Moolenbroek  * Normal memory allocation directly via the OS services layer
360*29492bb7SDavid van Moolenbroek  */
361*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE(a)                AcpiOsAllocate ((ACPI_SIZE) (a))
362*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE_ZEROED(a)         AcpiOsAllocateZeroed ((ACPI_SIZE) (a))
363*29492bb7SDavid van Moolenbroek #define ACPI_FREE(a)                    AcpiOsFree (a)
364*29492bb7SDavid van Moolenbroek #define ACPI_MEM_TRACKING(a)
365*29492bb7SDavid van Moolenbroek 
366*29492bb7SDavid van Moolenbroek #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
367*29492bb7SDavid van Moolenbroek 
368*29492bb7SDavid van Moolenbroek #endif /* ACPI_NO_MEM_ALLOCATIONS */
369*29492bb7SDavid van Moolenbroek 
370433d6423SLionel Sambuc 
371433d6423SLionel Sambuc /******************************************************************************
372433d6423SLionel Sambuc  *
373433d6423SLionel Sambuc  * ACPI Specification constants (Do not change unless the specification changes)
374433d6423SLionel Sambuc  *
375433d6423SLionel Sambuc  *****************************************************************************/
376433d6423SLionel Sambuc 
377433d6423SLionel Sambuc /* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
378433d6423SLionel Sambuc 
379433d6423SLionel Sambuc #define ACPI_MAX_GPE_BLOCKS             2
380433d6423SLionel Sambuc 
381433d6423SLionel Sambuc /* Default ACPI register widths */
382433d6423SLionel Sambuc 
383433d6423SLionel Sambuc #define ACPI_GPE_REGISTER_WIDTH         8
384433d6423SLionel Sambuc #define ACPI_PM1_REGISTER_WIDTH         16
385433d6423SLionel Sambuc #define ACPI_PM2_REGISTER_WIDTH         8
386433d6423SLionel Sambuc #define ACPI_PM_TIMER_WIDTH             32
387*29492bb7SDavid van Moolenbroek #define ACPI_RESET_REGISTER_WIDTH       8
388433d6423SLionel Sambuc 
389433d6423SLionel Sambuc /* Names within the namespace are 4 bytes long */
390433d6423SLionel Sambuc 
391433d6423SLionel Sambuc #define ACPI_NAME_SIZE                  4
392433d6423SLionel Sambuc #define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
393433d6423SLionel Sambuc #define ACPI_PATH_SEPARATOR             '.'
394433d6423SLionel Sambuc 
395433d6423SLionel Sambuc /* Sizes for ACPI table headers */
396433d6423SLionel Sambuc 
397433d6423SLionel Sambuc #define ACPI_OEM_ID_SIZE                6
398433d6423SLionel Sambuc #define ACPI_OEM_TABLE_ID_SIZE          8
399433d6423SLionel Sambuc 
400433d6423SLionel Sambuc /* ACPI/PNP hardware IDs */
401433d6423SLionel Sambuc 
402433d6423SLionel Sambuc #define PCI_ROOT_HID_STRING             "PNP0A03"
403433d6423SLionel Sambuc #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
404433d6423SLionel Sambuc 
405433d6423SLionel Sambuc /* PM Timer ticks per second (HZ) */
406433d6423SLionel Sambuc 
407*29492bb7SDavid van Moolenbroek #define ACPI_PM_TIMER_FREQUENCY         3579545
408433d6423SLionel Sambuc 
409433d6423SLionel Sambuc 
410433d6423SLionel Sambuc /*******************************************************************************
411433d6423SLionel Sambuc  *
412433d6423SLionel Sambuc  * Independent types
413433d6423SLionel Sambuc  *
414433d6423SLionel Sambuc  ******************************************************************************/
415433d6423SLionel Sambuc 
416433d6423SLionel Sambuc /* Logical defines and NULL */
417433d6423SLionel Sambuc 
418433d6423SLionel Sambuc #ifdef FALSE
419433d6423SLionel Sambuc #undef FALSE
420433d6423SLionel Sambuc #endif
421433d6423SLionel Sambuc #define FALSE                           (1 == 0)
422433d6423SLionel Sambuc 
423433d6423SLionel Sambuc #ifdef TRUE
424433d6423SLionel Sambuc #undef TRUE
425433d6423SLionel Sambuc #endif
426433d6423SLionel Sambuc #define TRUE                            (1 == 1)
427433d6423SLionel Sambuc 
428433d6423SLionel Sambuc #ifndef NULL
429433d6423SLionel Sambuc #define NULL                            (void *) 0
430433d6423SLionel Sambuc #endif
431433d6423SLionel Sambuc 
432433d6423SLionel Sambuc 
433433d6423SLionel Sambuc /*
434433d6423SLionel Sambuc  * Miscellaneous types
435433d6423SLionel Sambuc  */
436433d6423SLionel Sambuc typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
437433d6423SLionel Sambuc typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
438433d6423SLionel Sambuc typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
439433d6423SLionel Sambuc typedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
440433d6423SLionel Sambuc 
441433d6423SLionel Sambuc 
442*29492bb7SDavid van Moolenbroek /* Time constants for timer calculations */
443*29492bb7SDavid van Moolenbroek 
444*29492bb7SDavid van Moolenbroek #define ACPI_MSEC_PER_SEC               1000L
445*29492bb7SDavid van Moolenbroek 
446*29492bb7SDavid van Moolenbroek #define ACPI_USEC_PER_MSEC              1000L
447*29492bb7SDavid van Moolenbroek #define ACPI_USEC_PER_SEC               1000000L
448*29492bb7SDavid van Moolenbroek 
449*29492bb7SDavid van Moolenbroek #define ACPI_100NSEC_PER_USEC           10L
450*29492bb7SDavid van Moolenbroek #define ACPI_100NSEC_PER_MSEC           10000L
451*29492bb7SDavid van Moolenbroek #define ACPI_100NSEC_PER_SEC            10000000L
452*29492bb7SDavid van Moolenbroek 
453*29492bb7SDavid van Moolenbroek #define ACPI_NSEC_PER_USEC              1000L
454*29492bb7SDavid van Moolenbroek #define ACPI_NSEC_PER_MSEC              1000000L
455*29492bb7SDavid van Moolenbroek #define ACPI_NSEC_PER_SEC               1000000000L
456*29492bb7SDavid van Moolenbroek 
457*29492bb7SDavid van Moolenbroek 
458433d6423SLionel Sambuc /* Owner IDs are used to track namespace nodes for selective deletion */
459433d6423SLionel Sambuc 
460433d6423SLionel Sambuc typedef UINT8                           ACPI_OWNER_ID;
461433d6423SLionel Sambuc #define ACPI_OWNER_ID_MAX               0xFF
462433d6423SLionel Sambuc 
463433d6423SLionel Sambuc 
464433d6423SLionel Sambuc #define ACPI_INTEGER_BIT_SIZE           64
465433d6423SLionel Sambuc #define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
466433d6423SLionel Sambuc #define ACPI_MAX64_DECIMAL_DIGITS       20
467433d6423SLionel Sambuc #define ACPI_MAX32_DECIMAL_DIGITS       10
468433d6423SLionel Sambuc #define ACPI_MAX16_DECIMAL_DIGITS        5
469433d6423SLionel Sambuc #define ACPI_MAX8_DECIMAL_DIGITS         3
470433d6423SLionel Sambuc 
471433d6423SLionel Sambuc /*
472433d6423SLionel Sambuc  * Constants with special meanings
473433d6423SLionel Sambuc  */
474433d6423SLionel Sambuc #define ACPI_ROOT_OBJECT                ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
475433d6423SLionel Sambuc #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
476433d6423SLionel Sambuc #define ACPI_DO_NOT_WAIT                0
477433d6423SLionel Sambuc 
478433d6423SLionel Sambuc /*
479433d6423SLionel Sambuc  * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits.
480433d6423SLionel Sambuc  * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this
481433d6423SLionel Sambuc  * pertains to the ACPI integer type only, not to other integers used in the
482433d6423SLionel Sambuc  * implementation of the ACPICA subsystem.
483433d6423SLionel Sambuc  *
484433d6423SLionel Sambuc  * 01/2010: This type is obsolete and has been removed from the entire ACPICA
485433d6423SLionel Sambuc  * code base. It remains here for compatibility with device drivers that use
486433d6423SLionel Sambuc  * the type. However, it will be removed in the future.
487433d6423SLionel Sambuc  */
488433d6423SLionel Sambuc typedef UINT64                          ACPI_INTEGER;
489433d6423SLionel Sambuc #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
490433d6423SLionel Sambuc 
491433d6423SLionel Sambuc 
492433d6423SLionel Sambuc /*******************************************************************************
493433d6423SLionel Sambuc  *
494433d6423SLionel Sambuc  * Commonly used macros
495433d6423SLionel Sambuc  *
496433d6423SLionel Sambuc  ******************************************************************************/
497433d6423SLionel Sambuc 
498433d6423SLionel Sambuc /* Data manipulation */
499433d6423SLionel Sambuc 
500433d6423SLionel Sambuc #define ACPI_LOBYTE(Integer)            ((UINT8)   (UINT16)(Integer))
501433d6423SLionel Sambuc #define ACPI_HIBYTE(Integer)            ((UINT8) (((UINT16)(Integer)) >> 8))
502433d6423SLionel Sambuc #define ACPI_LOWORD(Integer)            ((UINT16)  (UINT32)(Integer))
503433d6423SLionel Sambuc #define ACPI_HIWORD(Integer)            ((UINT16)(((UINT32)(Integer)) >> 16))
504433d6423SLionel Sambuc #define ACPI_LODWORD(Integer64)         ((UINT32)  (UINT64)(Integer64))
505433d6423SLionel Sambuc #define ACPI_HIDWORD(Integer64)         ((UINT32)(((UINT64)(Integer64)) >> 32))
506433d6423SLionel Sambuc 
507433d6423SLionel Sambuc #define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
508433d6423SLionel Sambuc #define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
509433d6423SLionel Sambuc #define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
510433d6423SLionel Sambuc #define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
511433d6423SLionel Sambuc 
512433d6423SLionel Sambuc /* Size calculation */
513433d6423SLionel Sambuc 
514433d6423SLionel Sambuc #define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
515433d6423SLionel Sambuc 
516433d6423SLionel Sambuc /* Pointer manipulation */
517433d6423SLionel Sambuc 
518433d6423SLionel Sambuc #define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
519433d6423SLionel Sambuc #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
520433d6423SLionel Sambuc #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
521433d6423SLionel Sambuc #define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
522433d6423SLionel Sambuc 
523433d6423SLionel Sambuc /* Pointer/Integer type conversions */
524433d6423SLionel Sambuc 
525433d6423SLionel Sambuc #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
526433d6423SLionel Sambuc #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
527*29492bb7SDavid van Moolenbroek #define ACPI_OFFSET(d, f)               ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL)
528433d6423SLionel Sambuc #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
529433d6423SLionel Sambuc #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
530433d6423SLionel Sambuc 
531*29492bb7SDavid van Moolenbroek /* Optimizations for 4-character (32-bit) ACPI_NAME manipulation */
532*29492bb7SDavid van Moolenbroek 
533433d6423SLionel Sambuc #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
534433d6423SLionel Sambuc #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
535*29492bb7SDavid van Moolenbroek #define ACPI_MOVE_NAME(dest,src)        (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
536433d6423SLionel Sambuc #else
537433d6423SLionel Sambuc #define ACPI_COMPARE_NAME(a,b)          (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
538*29492bb7SDavid van Moolenbroek #define ACPI_MOVE_NAME(dest,src)        (ACPI_STRNCPY (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
539433d6423SLionel Sambuc #endif
540433d6423SLionel Sambuc 
541*29492bb7SDavid van Moolenbroek /* Support for the special RSDP signature (8 characters) */
542*29492bb7SDavid van Moolenbroek 
543*29492bb7SDavid van Moolenbroek #define ACPI_VALIDATE_RSDP_SIG(a)       (!ACPI_STRNCMP (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
544*29492bb7SDavid van Moolenbroek #define ACPI_MAKE_RSDP_SIG(dest)        (ACPI_MEMCPY (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
545*29492bb7SDavid van Moolenbroek 
546433d6423SLionel Sambuc 
547433d6423SLionel Sambuc /*******************************************************************************
548433d6423SLionel Sambuc  *
549433d6423SLionel Sambuc  * Miscellaneous constants
550433d6423SLionel Sambuc  *
551433d6423SLionel Sambuc  ******************************************************************************/
552433d6423SLionel Sambuc 
553433d6423SLionel Sambuc /*
554433d6423SLionel Sambuc  * Initialization sequence
555433d6423SLionel Sambuc  */
556433d6423SLionel Sambuc #define ACPI_FULL_INITIALIZATION        0x00
557433d6423SLionel Sambuc #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
558433d6423SLionel Sambuc #define ACPI_NO_HARDWARE_INIT           0x02
559433d6423SLionel Sambuc #define ACPI_NO_EVENT_INIT              0x04
560433d6423SLionel Sambuc #define ACPI_NO_HANDLER_INIT            0x08
561433d6423SLionel Sambuc #define ACPI_NO_ACPI_ENABLE             0x10
562433d6423SLionel Sambuc #define ACPI_NO_DEVICE_INIT             0x20
563433d6423SLionel Sambuc #define ACPI_NO_OBJECT_INIT             0x40
564433d6423SLionel Sambuc 
565433d6423SLionel Sambuc /*
566433d6423SLionel Sambuc  * Initialization state
567433d6423SLionel Sambuc  */
568433d6423SLionel Sambuc #define ACPI_SUBSYSTEM_INITIALIZE       0x01
569433d6423SLionel Sambuc #define ACPI_INITIALIZED_OK             0x02
570433d6423SLionel Sambuc 
571433d6423SLionel Sambuc /*
572433d6423SLionel Sambuc  * Power state values
573433d6423SLionel Sambuc  */
574433d6423SLionel Sambuc #define ACPI_STATE_UNKNOWN              (UINT8) 0xFF
575433d6423SLionel Sambuc 
576433d6423SLionel Sambuc #define ACPI_STATE_S0                   (UINT8) 0
577433d6423SLionel Sambuc #define ACPI_STATE_S1                   (UINT8) 1
578433d6423SLionel Sambuc #define ACPI_STATE_S2                   (UINT8) 2
579433d6423SLionel Sambuc #define ACPI_STATE_S3                   (UINT8) 3
580433d6423SLionel Sambuc #define ACPI_STATE_S4                   (UINT8) 4
581433d6423SLionel Sambuc #define ACPI_STATE_S5                   (UINT8) 5
582433d6423SLionel Sambuc #define ACPI_S_STATES_MAX               ACPI_STATE_S5
583433d6423SLionel Sambuc #define ACPI_S_STATE_COUNT              6
584433d6423SLionel Sambuc 
585433d6423SLionel Sambuc #define ACPI_STATE_D0                   (UINT8) 0
586433d6423SLionel Sambuc #define ACPI_STATE_D1                   (UINT8) 1
587433d6423SLionel Sambuc #define ACPI_STATE_D2                   (UINT8) 2
588433d6423SLionel Sambuc #define ACPI_STATE_D3                   (UINT8) 3
589433d6423SLionel Sambuc #define ACPI_D_STATES_MAX               ACPI_STATE_D3
590433d6423SLionel Sambuc #define ACPI_D_STATE_COUNT              4
591433d6423SLionel Sambuc 
592433d6423SLionel Sambuc #define ACPI_STATE_C0                   (UINT8) 0
593433d6423SLionel Sambuc #define ACPI_STATE_C1                   (UINT8) 1
594433d6423SLionel Sambuc #define ACPI_STATE_C2                   (UINT8) 2
595433d6423SLionel Sambuc #define ACPI_STATE_C3                   (UINT8) 3
596433d6423SLionel Sambuc #define ACPI_C_STATES_MAX               ACPI_STATE_C3
597433d6423SLionel Sambuc #define ACPI_C_STATE_COUNT              4
598433d6423SLionel Sambuc 
599433d6423SLionel Sambuc /*
600433d6423SLionel Sambuc  * Sleep type invalid value
601433d6423SLionel Sambuc  */
602433d6423SLionel Sambuc #define ACPI_SLEEP_TYPE_MAX             0x7
603433d6423SLionel Sambuc #define ACPI_SLEEP_TYPE_INVALID         0xFF
604433d6423SLionel Sambuc 
605433d6423SLionel Sambuc /*
606433d6423SLionel Sambuc  * Standard notify values
607433d6423SLionel Sambuc  */
608433d6423SLionel Sambuc #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00
609433d6423SLionel Sambuc #define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 0x01
610433d6423SLionel Sambuc #define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 0x02
611433d6423SLionel Sambuc #define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 0x03
612433d6423SLionel Sambuc #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 0x04
613433d6423SLionel Sambuc #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 0x05
614433d6423SLionel Sambuc #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 0x06
615433d6423SLionel Sambuc #define ACPI_NOTIFY_POWER_FAULT         (UINT8) 0x07
616433d6423SLionel Sambuc #define ACPI_NOTIFY_CAPABILITIES_CHECK  (UINT8) 0x08
617433d6423SLionel Sambuc #define ACPI_NOTIFY_DEVICE_PLD_CHECK    (UINT8) 0x09
618433d6423SLionel Sambuc #define ACPI_NOTIFY_RESERVED            (UINT8) 0x0A
619433d6423SLionel Sambuc #define ACPI_NOTIFY_LOCALITY_UPDATE     (UINT8) 0x0B
620*29492bb7SDavid van Moolenbroek #define ACPI_NOTIFY_SHUTDOWN_REQUEST    (UINT8) 0x0C
621*29492bb7SDavid van Moolenbroek #define ACPI_NOTIFY_AFFINITY_UPDATE     (UINT8) 0x0D
622433d6423SLionel Sambuc 
623*29492bb7SDavid van Moolenbroek #define ACPI_NOTIFY_MAX                 0x0D
624433d6423SLionel Sambuc 
625433d6423SLionel Sambuc /*
626433d6423SLionel Sambuc  * Types associated with ACPI names and objects. The first group of
627433d6423SLionel Sambuc  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
628433d6423SLionel Sambuc  * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
629433d6423SLionel Sambuc  * only add to the first group if the spec changes.
630433d6423SLionel Sambuc  *
631433d6423SLionel Sambuc  * NOTE: Types must be kept in sync with the global AcpiNsProperties
632433d6423SLionel Sambuc  * and AcpiNsTypeNames arrays.
633433d6423SLionel Sambuc  */
634433d6423SLionel Sambuc typedef UINT32                          ACPI_OBJECT_TYPE;
635433d6423SLionel Sambuc 
636433d6423SLionel Sambuc #define ACPI_TYPE_ANY                   0x00
637433d6423SLionel Sambuc #define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
638433d6423SLionel Sambuc #define ACPI_TYPE_STRING                0x02
639433d6423SLionel Sambuc #define ACPI_TYPE_BUFFER                0x03
640433d6423SLionel Sambuc #define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
641433d6423SLionel Sambuc #define ACPI_TYPE_FIELD_UNIT            0x05
642433d6423SLionel Sambuc #define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
643433d6423SLionel Sambuc #define ACPI_TYPE_EVENT                 0x07
644433d6423SLionel Sambuc #define ACPI_TYPE_METHOD                0x08  /* Name, ByteConst, multiple Code */
645433d6423SLionel Sambuc #define ACPI_TYPE_MUTEX                 0x09
646433d6423SLionel Sambuc #define ACPI_TYPE_REGION                0x0A
647433d6423SLionel Sambuc #define ACPI_TYPE_POWER                 0x0B  /* Name,ByteConst,WordConst,multi Node */
648433d6423SLionel Sambuc #define ACPI_TYPE_PROCESSOR             0x0C  /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
649433d6423SLionel Sambuc #define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
650433d6423SLionel Sambuc #define ACPI_TYPE_BUFFER_FIELD          0x0E
651433d6423SLionel Sambuc #define ACPI_TYPE_DDB_HANDLE            0x0F
652433d6423SLionel Sambuc #define ACPI_TYPE_DEBUG_OBJECT          0x10
653433d6423SLionel Sambuc 
654433d6423SLionel Sambuc #define ACPI_TYPE_EXTERNAL_MAX          0x10
655433d6423SLionel Sambuc 
656433d6423SLionel Sambuc /*
657433d6423SLionel Sambuc  * These are object types that do not map directly to the ACPI
658433d6423SLionel Sambuc  * ObjectType() operator. They are used for various internal purposes only.
659433d6423SLionel Sambuc  * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
660433d6423SLionel Sambuc  * internal types must move upwards. (There is code that depends on these
661433d6423SLionel Sambuc  * values being contiguous with the external types above.)
662433d6423SLionel Sambuc  */
663433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
664433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
665433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
666433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
667433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_ALIAS           0x15
668433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
669433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_NOTIFY          0x17
670433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
671433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_RESOURCE        0x19
672433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
673433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
674433d6423SLionel Sambuc 
675433d6423SLionel Sambuc #define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
676433d6423SLionel Sambuc 
677433d6423SLionel Sambuc /*
678433d6423SLionel Sambuc  * These are special object types that never appear in
679*29492bb7SDavid van Moolenbroek  * a Namespace node, only in an object of ACPI_OPERAND_OBJECT
680433d6423SLionel Sambuc  */
681433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_EXTRA           0x1C
682433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_DATA            0x1D
683433d6423SLionel Sambuc 
684433d6423SLionel Sambuc #define ACPI_TYPE_LOCAL_MAX             0x1D
685433d6423SLionel Sambuc 
686433d6423SLionel Sambuc /* All types above here are invalid */
687433d6423SLionel Sambuc 
688433d6423SLionel Sambuc #define ACPI_TYPE_INVALID               0x1E
689433d6423SLionel Sambuc #define ACPI_TYPE_NOT_FOUND             0xFF
690433d6423SLionel Sambuc 
691433d6423SLionel Sambuc #define ACPI_NUM_NS_TYPES               (ACPI_TYPE_INVALID + 1)
692433d6423SLionel Sambuc 
693433d6423SLionel Sambuc 
694433d6423SLionel Sambuc /*
695433d6423SLionel Sambuc  * All I/O
696433d6423SLionel Sambuc  */
697433d6423SLionel Sambuc #define ACPI_READ                       0
698433d6423SLionel Sambuc #define ACPI_WRITE                      1
699433d6423SLionel Sambuc #define ACPI_IO_MASK                    1
700433d6423SLionel Sambuc 
701433d6423SLionel Sambuc /*
702433d6423SLionel Sambuc  * Event Types: Fixed & General Purpose
703433d6423SLionel Sambuc  */
704433d6423SLionel Sambuc typedef UINT32                          ACPI_EVENT_TYPE;
705433d6423SLionel Sambuc 
706433d6423SLionel Sambuc /*
707433d6423SLionel Sambuc  * Fixed events
708433d6423SLionel Sambuc  */
709433d6423SLionel Sambuc #define ACPI_EVENT_PMTIMER              0
710433d6423SLionel Sambuc #define ACPI_EVENT_GLOBAL               1
711433d6423SLionel Sambuc #define ACPI_EVENT_POWER_BUTTON         2
712433d6423SLionel Sambuc #define ACPI_EVENT_SLEEP_BUTTON         3
713433d6423SLionel Sambuc #define ACPI_EVENT_RTC                  4
714433d6423SLionel Sambuc #define ACPI_EVENT_MAX                  4
715433d6423SLionel Sambuc #define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
716433d6423SLionel Sambuc 
717433d6423SLionel Sambuc /*
718433d6423SLionel Sambuc  * Event Status - Per event
719433d6423SLionel Sambuc  * -------------
720433d6423SLionel Sambuc  * The encoding of ACPI_EVENT_STATUS is illustrated below.
721433d6423SLionel Sambuc  * Note that a set bit (1) indicates the property is TRUE
722433d6423SLionel Sambuc  * (e.g. if bit 0 is set then the event is enabled).
723*29492bb7SDavid van Moolenbroek  * +-------------+-+-+-+-+
724*29492bb7SDavid van Moolenbroek  * |   Bits 31:4 |3|2|1|0|
725*29492bb7SDavid van Moolenbroek  * +-------------+-+-+-+-+
726*29492bb7SDavid van Moolenbroek  *          |     | | | |
727*29492bb7SDavid van Moolenbroek  *          |     | | | +- Enabled?
728*29492bb7SDavid van Moolenbroek  *          |     | | +--- Enabled for wake?
729*29492bb7SDavid van Moolenbroek  *          |     | +----- Set?
730*29492bb7SDavid van Moolenbroek  *          |     +------- Has a handler?
731*29492bb7SDavid van Moolenbroek  *          +------------- <Reserved>
732433d6423SLionel Sambuc  */
733433d6423SLionel Sambuc typedef UINT32                          ACPI_EVENT_STATUS;
734433d6423SLionel Sambuc 
735433d6423SLionel Sambuc #define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
736433d6423SLionel Sambuc #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
737433d6423SLionel Sambuc #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
738433d6423SLionel Sambuc #define ACPI_EVENT_FLAG_SET             (ACPI_EVENT_STATUS) 0x04
739*29492bb7SDavid van Moolenbroek #define ACPI_EVENT_FLAG_HAS_HANDLER     (ACPI_EVENT_STATUS) 0x08
740433d6423SLionel Sambuc 
741433d6423SLionel Sambuc /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
742433d6423SLionel Sambuc 
743433d6423SLionel Sambuc #define ACPI_GPE_ENABLE                 0
744433d6423SLionel Sambuc #define ACPI_GPE_DISABLE                1
745433d6423SLionel Sambuc #define ACPI_GPE_CONDITIONAL_ENABLE     2
746433d6423SLionel Sambuc 
747433d6423SLionel Sambuc /*
748433d6423SLionel Sambuc  * GPE info flags - Per GPE
749*29492bb7SDavid van Moolenbroek  * +-------+-+-+---+
750*29492bb7SDavid van Moolenbroek  * |  7:4  |3|2|1:0|
751*29492bb7SDavid van Moolenbroek  * +-------+-+-+---+
752433d6423SLionel Sambuc  *     |    | |  |
753*29492bb7SDavid van Moolenbroek  *     |    | |  +-- Type of dispatch:to method, handler, notify, or none
754*29492bb7SDavid van Moolenbroek  *     |    | +----- Interrupt type: edge or level triggered
755*29492bb7SDavid van Moolenbroek  *     |    +------- Is a Wake GPE
756*29492bb7SDavid van Moolenbroek  *     +------------ <Reserved>
757433d6423SLionel Sambuc  */
758*29492bb7SDavid van Moolenbroek #define ACPI_GPE_DISPATCH_NONE          (UINT8) 0x00
759*29492bb7SDavid van Moolenbroek #define ACPI_GPE_DISPATCH_METHOD        (UINT8) 0x01
760*29492bb7SDavid van Moolenbroek #define ACPI_GPE_DISPATCH_HANDLER       (UINT8) 0x02
761*29492bb7SDavid van Moolenbroek #define ACPI_GPE_DISPATCH_NOTIFY        (UINT8) 0x03
762*29492bb7SDavid van Moolenbroek #define ACPI_GPE_DISPATCH_MASK          (UINT8) 0x03
763*29492bb7SDavid van Moolenbroek 
764*29492bb7SDavid van Moolenbroek #define ACPI_GPE_LEVEL_TRIGGERED        (UINT8) 0x04
765433d6423SLionel Sambuc #define ACPI_GPE_EDGE_TRIGGERED         (UINT8) 0x00
766*29492bb7SDavid van Moolenbroek #define ACPI_GPE_XRUPT_TYPE_MASK        (UINT8) 0x04
767433d6423SLionel Sambuc 
768*29492bb7SDavid van Moolenbroek #define ACPI_GPE_CAN_WAKE               (UINT8) 0x08
769433d6423SLionel Sambuc 
770433d6423SLionel Sambuc /*
771433d6423SLionel Sambuc  * Flags for GPE and Lock interfaces
772433d6423SLionel Sambuc  */
773433d6423SLionel Sambuc #define ACPI_NOT_ISR                    0x1
774433d6423SLionel Sambuc #define ACPI_ISR                        0x0
775433d6423SLionel Sambuc 
776433d6423SLionel Sambuc 
777433d6423SLionel Sambuc /* Notify types */
778433d6423SLionel Sambuc 
779433d6423SLionel Sambuc #define ACPI_SYSTEM_NOTIFY              0x1
780433d6423SLionel Sambuc #define ACPI_DEVICE_NOTIFY              0x2
781433d6423SLionel Sambuc #define ACPI_ALL_NOTIFY                 (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
782433d6423SLionel Sambuc #define ACPI_MAX_NOTIFY_HANDLER_TYPE    0x3
783*29492bb7SDavid van Moolenbroek #define ACPI_NUM_NOTIFY_TYPES           2
784433d6423SLionel Sambuc 
785*29492bb7SDavid van Moolenbroek #define ACPI_MAX_SYS_NOTIFY             0x7F
786*29492bb7SDavid van Moolenbroek #define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF
787*29492bb7SDavid van Moolenbroek 
788*29492bb7SDavid van Moolenbroek #define ACPI_SYSTEM_HANDLER_LIST        0 /* Used as index, must be SYSTEM_NOTIFY -1 */
789*29492bb7SDavid van Moolenbroek #define ACPI_DEVICE_HANDLER_LIST        1 /* Used as index, must be DEVICE_NOTIFY -1 */
790433d6423SLionel Sambuc 
791433d6423SLionel Sambuc 
792433d6423SLionel Sambuc /* Address Space (Operation Region) Types */
793433d6423SLionel Sambuc 
794433d6423SLionel Sambuc typedef UINT8                           ACPI_ADR_SPACE_TYPE;
795433d6423SLionel Sambuc 
796433d6423SLionel Sambuc #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
797433d6423SLionel Sambuc #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
798433d6423SLionel Sambuc #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
799433d6423SLionel Sambuc #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
800433d6423SLionel Sambuc #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
801433d6423SLionel Sambuc #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
802433d6423SLionel Sambuc #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
803433d6423SLionel Sambuc #define ACPI_ADR_SPACE_IPMI             (ACPI_ADR_SPACE_TYPE) 7
804*29492bb7SDavid van Moolenbroek #define ACPI_ADR_SPACE_GPIO             (ACPI_ADR_SPACE_TYPE) 8
805*29492bb7SDavid van Moolenbroek #define ACPI_ADR_SPACE_GSBUS            (ACPI_ADR_SPACE_TYPE) 9
806*29492bb7SDavid van Moolenbroek #define ACPI_ADR_SPACE_PLATFORM_COMM    (ACPI_ADR_SPACE_TYPE) 10
807433d6423SLionel Sambuc 
808*29492bb7SDavid van Moolenbroek #define ACPI_NUM_PREDEFINED_REGIONS     11
809*29492bb7SDavid van Moolenbroek 
810*29492bb7SDavid van Moolenbroek /*
811*29492bb7SDavid van Moolenbroek  * Special Address Spaces
812*29492bb7SDavid van Moolenbroek  *
813*29492bb7SDavid van Moolenbroek  * Note: A Data Table region is a special type of operation region
814*29492bb7SDavid van Moolenbroek  * that has its own AML opcode. However, internally, the AML
815*29492bb7SDavid van Moolenbroek  * interpreter simply creates an operation region with an an address
816*29492bb7SDavid van Moolenbroek  * space type of ACPI_ADR_SPACE_DATA_TABLE.
817*29492bb7SDavid van Moolenbroek  */
818*29492bb7SDavid van Moolenbroek #define ACPI_ADR_SPACE_DATA_TABLE       (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */
819*29492bb7SDavid van Moolenbroek #define ACPI_ADR_SPACE_FIXED_HARDWARE   (ACPI_ADR_SPACE_TYPE) 0x7F
820*29492bb7SDavid van Moolenbroek 
821*29492bb7SDavid van Moolenbroek /* Values for _REG connection code */
822*29492bb7SDavid van Moolenbroek 
823*29492bb7SDavid van Moolenbroek #define ACPI_REG_DISCONNECT             0
824*29492bb7SDavid van Moolenbroek #define ACPI_REG_CONNECT                1
825433d6423SLionel Sambuc 
826433d6423SLionel Sambuc /*
827433d6423SLionel Sambuc  * BitRegister IDs
828433d6423SLionel Sambuc  *
829433d6423SLionel Sambuc  * These values are intended to be used by the hardware interfaces
830433d6423SLionel Sambuc  * and are mapped to individual bitfields defined within the ACPI
831433d6423SLionel Sambuc  * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c
832433d6423SLionel Sambuc  * for this mapping.
833433d6423SLionel Sambuc  */
834433d6423SLionel Sambuc 
835433d6423SLionel Sambuc /* PM1 Status register */
836433d6423SLionel Sambuc 
837433d6423SLionel Sambuc #define ACPI_BITREG_TIMER_STATUS                0x00
838433d6423SLionel Sambuc #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
839433d6423SLionel Sambuc #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
840433d6423SLionel Sambuc #define ACPI_BITREG_POWER_BUTTON_STATUS         0x03
841433d6423SLionel Sambuc #define ACPI_BITREG_SLEEP_BUTTON_STATUS         0x04
842433d6423SLionel Sambuc #define ACPI_BITREG_RT_CLOCK_STATUS             0x05
843433d6423SLionel Sambuc #define ACPI_BITREG_WAKE_STATUS                 0x06
844433d6423SLionel Sambuc #define ACPI_BITREG_PCIEXP_WAKE_STATUS          0x07
845433d6423SLionel Sambuc 
846433d6423SLionel Sambuc /* PM1 Enable register */
847433d6423SLionel Sambuc 
848433d6423SLionel Sambuc #define ACPI_BITREG_TIMER_ENABLE                0x08
849433d6423SLionel Sambuc #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x09
850433d6423SLionel Sambuc #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x0A
851433d6423SLionel Sambuc #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0B
852433d6423SLionel Sambuc #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0C
853433d6423SLionel Sambuc #define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0D
854433d6423SLionel Sambuc 
855433d6423SLionel Sambuc /* PM1 Control register */
856433d6423SLionel Sambuc 
857433d6423SLionel Sambuc #define ACPI_BITREG_SCI_ENABLE                  0x0E
858433d6423SLionel Sambuc #define ACPI_BITREG_BUS_MASTER_RLD              0x0F
859433d6423SLionel Sambuc #define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x10
860433d6423SLionel Sambuc #define ACPI_BITREG_SLEEP_TYPE                  0x11
861433d6423SLionel Sambuc #define ACPI_BITREG_SLEEP_ENABLE                0x12
862433d6423SLionel Sambuc 
863433d6423SLionel Sambuc /* PM2 Control register */
864433d6423SLionel Sambuc 
865433d6423SLionel Sambuc #define ACPI_BITREG_ARB_DISABLE                 0x13
866433d6423SLionel Sambuc 
867433d6423SLionel Sambuc #define ACPI_BITREG_MAX                         0x13
868433d6423SLionel Sambuc #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
869433d6423SLionel Sambuc 
870433d6423SLionel Sambuc 
871433d6423SLionel Sambuc /* Status register values. A 1 clears a status bit. 0 = no effect */
872433d6423SLionel Sambuc 
873433d6423SLionel Sambuc #define ACPI_CLEAR_STATUS                       1
874433d6423SLionel Sambuc 
875433d6423SLionel Sambuc /* Enable and Control register values */
876433d6423SLionel Sambuc 
877433d6423SLionel Sambuc #define ACPI_ENABLE_EVENT                       1
878433d6423SLionel Sambuc #define ACPI_DISABLE_EVENT                      0
879433d6423SLionel Sambuc 
880433d6423SLionel Sambuc 
881*29492bb7SDavid van Moolenbroek /* Sleep function dispatch */
882*29492bb7SDavid van Moolenbroek 
883*29492bb7SDavid van Moolenbroek typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) (
884*29492bb7SDavid van Moolenbroek     UINT8                   SleepState);
885*29492bb7SDavid van Moolenbroek 
886*29492bb7SDavid van Moolenbroek typedef struct acpi_sleep_functions
887*29492bb7SDavid van Moolenbroek {
888*29492bb7SDavid van Moolenbroek     ACPI_SLEEP_FUNCTION     LegacyFunction;
889*29492bb7SDavid van Moolenbroek     ACPI_SLEEP_FUNCTION     ExtendedFunction;
890*29492bb7SDavid van Moolenbroek 
891*29492bb7SDavid van Moolenbroek } ACPI_SLEEP_FUNCTIONS;
892*29492bb7SDavid van Moolenbroek 
893*29492bb7SDavid van Moolenbroek 
894433d6423SLionel Sambuc /*
895433d6423SLionel Sambuc  * External ACPI object definition
896433d6423SLionel Sambuc  */
897433d6423SLionel Sambuc 
898433d6423SLionel Sambuc /*
899433d6423SLionel Sambuc  * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element
900433d6423SLionel Sambuc  * or an unresolved named reference.
901433d6423SLionel Sambuc  */
902433d6423SLionel Sambuc typedef union acpi_object
903433d6423SLionel Sambuc {
904433d6423SLionel Sambuc     ACPI_OBJECT_TYPE                Type;   /* See definition of AcpiNsType for values */
905433d6423SLionel Sambuc     struct
906433d6423SLionel Sambuc     {
907433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_INTEGER */
908433d6423SLionel Sambuc         UINT64                          Value;      /* The actual number */
909433d6423SLionel Sambuc     } Integer;
910433d6423SLionel Sambuc 
911433d6423SLionel Sambuc     struct
912433d6423SLionel Sambuc     {
913433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_STRING */
914433d6423SLionel Sambuc         UINT32                          Length;     /* # of bytes in string, excluding trailing null */
915433d6423SLionel Sambuc         char                            *Pointer;   /* points to the string value */
916433d6423SLionel Sambuc     } String;
917433d6423SLionel Sambuc 
918433d6423SLionel Sambuc     struct
919433d6423SLionel Sambuc     {
920433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_BUFFER */
921433d6423SLionel Sambuc         UINT32                          Length;     /* # of bytes in buffer */
922433d6423SLionel Sambuc         UINT8                           *Pointer;   /* points to the buffer */
923433d6423SLionel Sambuc     } Buffer;
924433d6423SLionel Sambuc 
925433d6423SLionel Sambuc     struct
926433d6423SLionel Sambuc     {
927433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PACKAGE */
928433d6423SLionel Sambuc         UINT32                          Count;      /* # of elements in package */
929433d6423SLionel Sambuc         union acpi_object               *Elements;  /* Pointer to an array of ACPI_OBJECTs */
930433d6423SLionel Sambuc     } Package;
931433d6423SLionel Sambuc 
932433d6423SLionel Sambuc     struct
933433d6423SLionel Sambuc     {
934433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_LOCAL_REFERENCE */
935433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                ActualType; /* Type associated with the Handle */
936433d6423SLionel Sambuc         ACPI_HANDLE                     Handle;     /* object reference */
937433d6423SLionel Sambuc     } Reference;
938433d6423SLionel Sambuc 
939433d6423SLionel Sambuc     struct
940433d6423SLionel Sambuc     {
941433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PROCESSOR */
942433d6423SLionel Sambuc         UINT32                          ProcId;
943433d6423SLionel Sambuc         ACPI_IO_ADDRESS                 PblkAddress;
944433d6423SLionel Sambuc         UINT32                          PblkLength;
945433d6423SLionel Sambuc     } Processor;
946433d6423SLionel Sambuc 
947433d6423SLionel Sambuc     struct
948433d6423SLionel Sambuc     {
949433d6423SLionel Sambuc         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_POWER */
950433d6423SLionel Sambuc         UINT32                          SystemLevel;
951433d6423SLionel Sambuc         UINT32                          ResourceOrder;
952433d6423SLionel Sambuc     } PowerResource;
953433d6423SLionel Sambuc 
954433d6423SLionel Sambuc } ACPI_OBJECT;
955433d6423SLionel Sambuc 
956433d6423SLionel Sambuc 
957433d6423SLionel Sambuc /*
958433d6423SLionel Sambuc  * List of objects, used as a parameter list for control method evaluation
959433d6423SLionel Sambuc  */
960433d6423SLionel Sambuc typedef struct acpi_object_list
961433d6423SLionel Sambuc {
962433d6423SLionel Sambuc     UINT32                          Count;
963433d6423SLionel Sambuc     ACPI_OBJECT                     *Pointer;
964433d6423SLionel Sambuc 
965433d6423SLionel Sambuc } ACPI_OBJECT_LIST;
966433d6423SLionel Sambuc 
967433d6423SLionel Sambuc 
968433d6423SLionel Sambuc /*
969433d6423SLionel Sambuc  * Miscellaneous common Data Structures used by the interfaces
970433d6423SLionel Sambuc  */
971433d6423SLionel Sambuc #define ACPI_NO_BUFFER              0
972*29492bb7SDavid van Moolenbroek 
973*29492bb7SDavid van Moolenbroek #ifdef ACPI_NO_MEM_ALLOCATIONS
974*29492bb7SDavid van Moolenbroek 
975*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (0)
976*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (0)
977*29492bb7SDavid van Moolenbroek 
978*29492bb7SDavid van Moolenbroek #else /* ACPI_NO_MEM_ALLOCATIONS */
979*29492bb7SDavid van Moolenbroek 
980*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (-1)    /* Let ACPICA allocate buffer */
981*29492bb7SDavid van Moolenbroek #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (-2)    /* For internal use only (enables tracking) */
982*29492bb7SDavid van Moolenbroek 
983*29492bb7SDavid van Moolenbroek #endif /* ACPI_NO_MEM_ALLOCATIONS */
984433d6423SLionel Sambuc 
985433d6423SLionel Sambuc typedef struct acpi_buffer
986433d6423SLionel Sambuc {
987433d6423SLionel Sambuc     ACPI_SIZE                       Length;         /* Length in bytes of the buffer */
988433d6423SLionel Sambuc     void                            *Pointer;       /* pointer to buffer */
989433d6423SLionel Sambuc 
990433d6423SLionel Sambuc } ACPI_BUFFER;
991433d6423SLionel Sambuc 
992433d6423SLionel Sambuc 
993433d6423SLionel Sambuc /*
994433d6423SLionel Sambuc  * NameType for AcpiGetName
995433d6423SLionel Sambuc  */
996433d6423SLionel Sambuc #define ACPI_FULL_PATHNAME              0
997433d6423SLionel Sambuc #define ACPI_SINGLE_NAME                1
998433d6423SLionel Sambuc #define ACPI_NAME_TYPE_MAX              1
999433d6423SLionel Sambuc 
1000433d6423SLionel Sambuc 
1001433d6423SLionel Sambuc /*
1002433d6423SLionel Sambuc  * Predefined Namespace items
1003433d6423SLionel Sambuc  */
1004433d6423SLionel Sambuc typedef struct acpi_predefined_names
1005433d6423SLionel Sambuc {
1006433d6423SLionel Sambuc     char                            *Name;
1007433d6423SLionel Sambuc     UINT8                           Type;
1008433d6423SLionel Sambuc     char                            *Val;
1009433d6423SLionel Sambuc 
1010433d6423SLionel Sambuc } ACPI_PREDEFINED_NAMES;
1011433d6423SLionel Sambuc 
1012433d6423SLionel Sambuc 
1013433d6423SLionel Sambuc /*
1014433d6423SLionel Sambuc  * Structure and flags for AcpiGetSystemInfo
1015433d6423SLionel Sambuc  */
1016433d6423SLionel Sambuc #define ACPI_SYS_MODE_UNKNOWN           0x0000
1017433d6423SLionel Sambuc #define ACPI_SYS_MODE_ACPI              0x0001
1018433d6423SLionel Sambuc #define ACPI_SYS_MODE_LEGACY            0x0002
1019433d6423SLionel Sambuc #define ACPI_SYS_MODES_MASK             0x0003
1020433d6423SLionel Sambuc 
1021433d6423SLionel Sambuc 
1022433d6423SLionel Sambuc /*
1023433d6423SLionel Sambuc  * System info returned by AcpiGetSystemInfo()
1024433d6423SLionel Sambuc  */
1025433d6423SLionel Sambuc typedef struct acpi_system_info
1026433d6423SLionel Sambuc {
1027433d6423SLionel Sambuc     UINT32                          AcpiCaVersion;
1028433d6423SLionel Sambuc     UINT32                          Flags;
1029433d6423SLionel Sambuc     UINT32                          TimerResolution;
1030433d6423SLionel Sambuc     UINT32                          Reserved1;
1031433d6423SLionel Sambuc     UINT32                          Reserved2;
1032433d6423SLionel Sambuc     UINT32                          DebugLevel;
1033433d6423SLionel Sambuc     UINT32                          DebugLayer;
1034433d6423SLionel Sambuc 
1035433d6423SLionel Sambuc } ACPI_SYSTEM_INFO;
1036433d6423SLionel Sambuc 
1037433d6423SLionel Sambuc 
1038433d6423SLionel Sambuc /*
1039433d6423SLionel Sambuc  * System statistics returned by AcpiGetStatistics()
1040433d6423SLionel Sambuc  */
1041433d6423SLionel Sambuc typedef struct acpi_statistics
1042433d6423SLionel Sambuc {
1043433d6423SLionel Sambuc     UINT32                          SciCount;
1044433d6423SLionel Sambuc     UINT32                          GpeCount;
1045433d6423SLionel Sambuc     UINT32                          FixedEventCount[ACPI_NUM_FIXED_EVENTS];
1046433d6423SLionel Sambuc     UINT32                          MethodCount;
1047433d6423SLionel Sambuc 
1048433d6423SLionel Sambuc } ACPI_STATISTICS;
1049433d6423SLionel Sambuc 
1050433d6423SLionel Sambuc 
1051433d6423SLionel Sambuc /* Table Event Types */
1052433d6423SLionel Sambuc 
1053433d6423SLionel Sambuc #define ACPI_TABLE_EVENT_LOAD           0x0
1054433d6423SLionel Sambuc #define ACPI_TABLE_EVENT_UNLOAD         0x1
1055433d6423SLionel Sambuc #define ACPI_NUM_TABLE_EVENTS           2
1056433d6423SLionel Sambuc 
1057433d6423SLionel Sambuc 
1058433d6423SLionel Sambuc /*
1059433d6423SLionel Sambuc  * Types specific to the OS service interfaces
1060433d6423SLionel Sambuc  */
1061433d6423SLionel Sambuc typedef UINT32
1062433d6423SLionel Sambuc (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
1063433d6423SLionel Sambuc     void                            *Context);
1064433d6423SLionel Sambuc 
1065433d6423SLionel Sambuc typedef void
1066433d6423SLionel Sambuc (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
1067433d6423SLionel Sambuc     void                            *Context);
1068433d6423SLionel Sambuc 
1069433d6423SLionel Sambuc /*
1070433d6423SLionel Sambuc  * Various handlers and callback procedures
1071433d6423SLionel Sambuc  */
1072433d6423SLionel Sambuc typedef
1073*29492bb7SDavid van Moolenbroek UINT32 (*ACPI_SCI_HANDLER) (
1074*29492bb7SDavid van Moolenbroek     void                            *Context);
1075*29492bb7SDavid van Moolenbroek 
1076*29492bb7SDavid van Moolenbroek typedef
1077*29492bb7SDavid van Moolenbroek void (*ACPI_GBL_EVENT_HANDLER) (
1078*29492bb7SDavid van Moolenbroek     UINT32                          EventType,
1079*29492bb7SDavid van Moolenbroek     ACPI_HANDLE                     Device,
1080*29492bb7SDavid van Moolenbroek     UINT32                          EventNumber,
1081*29492bb7SDavid van Moolenbroek     void                            *Context);
1082*29492bb7SDavid van Moolenbroek 
1083*29492bb7SDavid van Moolenbroek #define ACPI_EVENT_TYPE_GPE         0
1084*29492bb7SDavid van Moolenbroek #define ACPI_EVENT_TYPE_FIXED       1
1085*29492bb7SDavid van Moolenbroek 
1086*29492bb7SDavid van Moolenbroek typedef
1087433d6423SLionel Sambuc UINT32 (*ACPI_EVENT_HANDLER) (
1088433d6423SLionel Sambuc     void                            *Context);
1089433d6423SLionel Sambuc 
1090433d6423SLionel Sambuc typedef
1091*29492bb7SDavid van Moolenbroek UINT32 (*ACPI_GPE_HANDLER) (
1092*29492bb7SDavid van Moolenbroek     ACPI_HANDLE                     GpeDevice,
1093*29492bb7SDavid van Moolenbroek     UINT32                          GpeNumber,
1094*29492bb7SDavid van Moolenbroek     void                            *Context);
1095*29492bb7SDavid van Moolenbroek 
1096*29492bb7SDavid van Moolenbroek typedef
1097433d6423SLionel Sambuc void (*ACPI_NOTIFY_HANDLER) (
1098433d6423SLionel Sambuc     ACPI_HANDLE                     Device,
1099433d6423SLionel Sambuc     UINT32                          Value,
1100433d6423SLionel Sambuc     void                            *Context);
1101433d6423SLionel Sambuc 
1102433d6423SLionel Sambuc typedef
1103433d6423SLionel Sambuc void (*ACPI_OBJECT_HANDLER) (
1104433d6423SLionel Sambuc     ACPI_HANDLE                     Object,
1105433d6423SLionel Sambuc     void                            *Data);
1106433d6423SLionel Sambuc 
1107433d6423SLionel Sambuc typedef
1108433d6423SLionel Sambuc ACPI_STATUS (*ACPI_INIT_HANDLER) (
1109433d6423SLionel Sambuc     ACPI_HANDLE                     Object,
1110433d6423SLionel Sambuc     UINT32                          Function);
1111433d6423SLionel Sambuc 
1112433d6423SLionel Sambuc #define ACPI_INIT_DEVICE_INI        1
1113433d6423SLionel Sambuc 
1114433d6423SLionel Sambuc typedef
1115433d6423SLionel Sambuc ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) (
1116433d6423SLionel Sambuc     ACPI_STATUS                     AmlStatus,
1117433d6423SLionel Sambuc     ACPI_NAME                       Name,
1118433d6423SLionel Sambuc     UINT16                          Opcode,
1119433d6423SLionel Sambuc     UINT32                          AmlOffset,
1120433d6423SLionel Sambuc     void                            *Context);
1121433d6423SLionel Sambuc 
1122433d6423SLionel Sambuc /* Table Event handler (Load, LoadTable, etc.) and types */
1123433d6423SLionel Sambuc 
1124433d6423SLionel Sambuc typedef
1125433d6423SLionel Sambuc ACPI_STATUS (*ACPI_TABLE_HANDLER) (
1126433d6423SLionel Sambuc     UINT32                          Event,
1127433d6423SLionel Sambuc     void                            *Table,
1128433d6423SLionel Sambuc     void                            *Context);
1129433d6423SLionel Sambuc 
1130433d6423SLionel Sambuc #define ACPI_TABLE_LOAD             0x0
1131433d6423SLionel Sambuc #define ACPI_TABLE_UNLOAD           0x1
1132433d6423SLionel Sambuc #define ACPI_NUM_TABLE_EVENTS       2
1133433d6423SLionel Sambuc 
1134433d6423SLionel Sambuc 
1135433d6423SLionel Sambuc /* Address Spaces (For Operation Regions) */
1136433d6423SLionel Sambuc 
1137433d6423SLionel Sambuc typedef
1138433d6423SLionel Sambuc ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
1139433d6423SLionel Sambuc     UINT32                          Function,
1140433d6423SLionel Sambuc     ACPI_PHYSICAL_ADDRESS           Address,
1141433d6423SLionel Sambuc     UINT32                          BitWidth,
1142433d6423SLionel Sambuc     UINT64                          *Value,
1143433d6423SLionel Sambuc     void                            *HandlerContext,
1144433d6423SLionel Sambuc     void                            *RegionContext);
1145433d6423SLionel Sambuc 
1146433d6423SLionel Sambuc #define ACPI_DEFAULT_HANDLER            NULL
1147433d6423SLionel Sambuc 
1148*29492bb7SDavid van Moolenbroek /* Special Context data for GenericSerialBus/GeneralPurposeIo (ACPI 5.0) */
1149*29492bb7SDavid van Moolenbroek 
1150*29492bb7SDavid van Moolenbroek typedef struct acpi_connection_info
1151*29492bb7SDavid van Moolenbroek {
1152*29492bb7SDavid van Moolenbroek     UINT8                           *Connection;
1153*29492bb7SDavid van Moolenbroek     UINT16                          Length;
1154*29492bb7SDavid van Moolenbroek     UINT8                           AccessLength;
1155*29492bb7SDavid van Moolenbroek 
1156*29492bb7SDavid van Moolenbroek } ACPI_CONNECTION_INFO;
1157*29492bb7SDavid van Moolenbroek 
1158*29492bb7SDavid van Moolenbroek 
1159433d6423SLionel Sambuc typedef
1160433d6423SLionel Sambuc ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
1161433d6423SLionel Sambuc     ACPI_HANDLE                     RegionHandle,
1162433d6423SLionel Sambuc     UINT32                          Function,
1163433d6423SLionel Sambuc     void                            *HandlerContext,
1164433d6423SLionel Sambuc     void                            **RegionContext);
1165433d6423SLionel Sambuc 
1166433d6423SLionel Sambuc #define ACPI_REGION_ACTIVATE    0
1167433d6423SLionel Sambuc #define ACPI_REGION_DEACTIVATE  1
1168433d6423SLionel Sambuc 
1169433d6423SLionel Sambuc typedef
1170433d6423SLionel Sambuc ACPI_STATUS (*ACPI_WALK_CALLBACK) (
1171433d6423SLionel Sambuc     ACPI_HANDLE                     Object,
1172433d6423SLionel Sambuc     UINT32                          NestingLevel,
1173433d6423SLionel Sambuc     void                            *Context,
1174433d6423SLionel Sambuc     void                            **ReturnValue);
1175433d6423SLionel Sambuc 
1176*29492bb7SDavid van Moolenbroek typedef
1177*29492bb7SDavid van Moolenbroek UINT32 (*ACPI_INTERFACE_HANDLER) (
1178*29492bb7SDavid van Moolenbroek     ACPI_STRING                     InterfaceName,
1179*29492bb7SDavid van Moolenbroek     UINT32                          Supported);
1180*29492bb7SDavid van Moolenbroek 
1181433d6423SLionel Sambuc 
1182433d6423SLionel Sambuc /* Interrupt handler return values */
1183433d6423SLionel Sambuc 
1184433d6423SLionel Sambuc #define ACPI_INTERRUPT_NOT_HANDLED      0x00
1185433d6423SLionel Sambuc #define ACPI_INTERRUPT_HANDLED          0x01
1186433d6423SLionel Sambuc 
1187*29492bb7SDavid van Moolenbroek /* GPE handler return values */
1188*29492bb7SDavid van Moolenbroek 
1189*29492bb7SDavid van Moolenbroek #define ACPI_REENABLE_GPE               0x80
1190*29492bb7SDavid van Moolenbroek 
1191*29492bb7SDavid van Moolenbroek 
1192433d6423SLionel Sambuc /* Length of 32-bit EISAID values when converted back to a string */
1193433d6423SLionel Sambuc 
1194433d6423SLionel Sambuc #define ACPI_EISAID_STRING_SIZE         8   /* Includes null terminator */
1195433d6423SLionel Sambuc 
1196433d6423SLionel Sambuc /* Length of UUID (string) values */
1197433d6423SLionel Sambuc 
1198433d6423SLionel Sambuc #define ACPI_UUID_LENGTH                16
1199433d6423SLionel Sambuc 
1200433d6423SLionel Sambuc 
1201*29492bb7SDavid van Moolenbroek /* Structures used for device/processor HID, UID, CID, and SUB */
1202433d6423SLionel Sambuc 
1203*29492bb7SDavid van Moolenbroek typedef struct acpi_pnp_device_id
1204433d6423SLionel Sambuc {
1205433d6423SLionel Sambuc     UINT32                          Length;             /* Length of string + null */
1206433d6423SLionel Sambuc     char                            *String;
1207433d6423SLionel Sambuc 
1208*29492bb7SDavid van Moolenbroek } ACPI_PNP_DEVICE_ID;
1209433d6423SLionel Sambuc 
1210*29492bb7SDavid van Moolenbroek typedef struct acpi_pnp_device_id_list
1211433d6423SLionel Sambuc {
1212433d6423SLionel Sambuc     UINT32                          Count;              /* Number of IDs in Ids array */
1213433d6423SLionel Sambuc     UINT32                          ListSize;           /* Size of list, including ID strings */
1214*29492bb7SDavid van Moolenbroek     ACPI_PNP_DEVICE_ID              Ids[1];             /* ID array */
1215433d6423SLionel Sambuc 
1216*29492bb7SDavid van Moolenbroek } ACPI_PNP_DEVICE_ID_LIST;
1217433d6423SLionel Sambuc 
1218433d6423SLionel Sambuc /*
1219433d6423SLionel Sambuc  * Structure returned from AcpiGetObjectInfo.
1220433d6423SLionel Sambuc  * Optimized for both 32- and 64-bit builds
1221433d6423SLionel Sambuc  */
1222433d6423SLionel Sambuc typedef struct acpi_device_info
1223433d6423SLionel Sambuc {
1224433d6423SLionel Sambuc     UINT32                          InfoSize;           /* Size of info, including ID strings */
1225433d6423SLionel Sambuc     UINT32                          Name;               /* ACPI object Name */
1226433d6423SLionel Sambuc     ACPI_OBJECT_TYPE                Type;               /* ACPI object Type */
1227433d6423SLionel Sambuc     UINT8                           ParamCount;         /* If a method, required parameter count */
1228433d6423SLionel Sambuc     UINT8                           Valid;              /* Indicates which optional fields are valid */
1229433d6423SLionel Sambuc     UINT8                           Flags;              /* Miscellaneous info */
1230433d6423SLionel Sambuc     UINT8                           HighestDstates[4];  /* _SxD values: 0xFF indicates not valid */
1231433d6423SLionel Sambuc     UINT8                           LowestDstates[5];   /* _SxW values: 0xFF indicates not valid */
1232433d6423SLionel Sambuc     UINT32                          CurrentStatus;      /* _STA value */
1233433d6423SLionel Sambuc     UINT64                          Address;            /* _ADR value */
1234*29492bb7SDavid van Moolenbroek     ACPI_PNP_DEVICE_ID              HardwareId;         /* _HID value */
1235*29492bb7SDavid van Moolenbroek     ACPI_PNP_DEVICE_ID              UniqueId;           /* _UID value */
1236*29492bb7SDavid van Moolenbroek     ACPI_PNP_DEVICE_ID              SubsystemId;        /* _SUB value */
1237*29492bb7SDavid van Moolenbroek     ACPI_PNP_DEVICE_ID_LIST         CompatibleIdList;   /* _CID list <must be last> */
1238433d6423SLionel Sambuc 
1239433d6423SLionel Sambuc } ACPI_DEVICE_INFO;
1240433d6423SLionel Sambuc 
1241433d6423SLionel Sambuc /* Values for Flags field above (AcpiGetObjectInfo) */
1242433d6423SLionel Sambuc 
1243433d6423SLionel Sambuc #define ACPI_PCI_ROOT_BRIDGE            0x01
1244433d6423SLionel Sambuc 
1245433d6423SLionel Sambuc /* Flags for Valid field above (AcpiGetObjectInfo) */
1246433d6423SLionel Sambuc 
1247433d6423SLionel Sambuc #define ACPI_VALID_STA                  0x01
1248433d6423SLionel Sambuc #define ACPI_VALID_ADR                  0x02
1249433d6423SLionel Sambuc #define ACPI_VALID_HID                  0x04
1250433d6423SLionel Sambuc #define ACPI_VALID_UID                  0x08
1251*29492bb7SDavid van Moolenbroek #define ACPI_VALID_SUB                  0x10
1252*29492bb7SDavid van Moolenbroek #define ACPI_VALID_CID                  0x20
1253*29492bb7SDavid van Moolenbroek #define ACPI_VALID_SXDS                 0x40
1254*29492bb7SDavid van Moolenbroek #define ACPI_VALID_SXWS                 0x80
1255433d6423SLionel Sambuc 
1256*29492bb7SDavid van Moolenbroek /* Flags for _STA return value (CurrentStatus above) */
1257433d6423SLionel Sambuc 
1258433d6423SLionel Sambuc #define ACPI_STA_DEVICE_PRESENT         0x01
1259433d6423SLionel Sambuc #define ACPI_STA_DEVICE_ENABLED         0x02
1260433d6423SLionel Sambuc #define ACPI_STA_DEVICE_UI              0x04
1261433d6423SLionel Sambuc #define ACPI_STA_DEVICE_FUNCTIONING     0x08
1262433d6423SLionel Sambuc #define ACPI_STA_DEVICE_OK              0x08 /* Synonym */
1263433d6423SLionel Sambuc #define ACPI_STA_BATTERY_PRESENT        0x10
1264433d6423SLionel Sambuc 
1265433d6423SLionel Sambuc 
1266433d6423SLionel Sambuc /* Context structs for address space handlers */
1267433d6423SLionel Sambuc 
1268433d6423SLionel Sambuc typedef struct acpi_pci_id
1269433d6423SLionel Sambuc {
1270433d6423SLionel Sambuc     UINT16                          Segment;
1271433d6423SLionel Sambuc     UINT16                          Bus;
1272433d6423SLionel Sambuc     UINT16                          Device;
1273433d6423SLionel Sambuc     UINT16                          Function;
1274433d6423SLionel Sambuc 
1275433d6423SLionel Sambuc } ACPI_PCI_ID;
1276433d6423SLionel Sambuc 
1277433d6423SLionel Sambuc typedef struct acpi_mem_space_context
1278433d6423SLionel Sambuc {
1279433d6423SLionel Sambuc     UINT32                          Length;
1280433d6423SLionel Sambuc     ACPI_PHYSICAL_ADDRESS           Address;
1281433d6423SLionel Sambuc     ACPI_PHYSICAL_ADDRESS           MappedPhysicalAddress;
1282433d6423SLionel Sambuc     UINT8                           *MappedLogicalAddress;
1283433d6423SLionel Sambuc     ACPI_SIZE                       MappedLength;
1284433d6423SLionel Sambuc 
1285433d6423SLionel Sambuc } ACPI_MEM_SPACE_CONTEXT;
1286433d6423SLionel Sambuc 
1287433d6423SLionel Sambuc 
1288433d6423SLionel Sambuc /*
1289433d6423SLionel Sambuc  * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled
1290433d6423SLionel Sambuc  */
1291433d6423SLionel Sambuc typedef struct acpi_memory_list
1292433d6423SLionel Sambuc {
1293433d6423SLionel Sambuc     char                            *ListName;
1294433d6423SLionel Sambuc     void                            *ListHead;
1295433d6423SLionel Sambuc     UINT16                          ObjectSize;
1296433d6423SLionel Sambuc     UINT16                          MaxDepth;
1297433d6423SLionel Sambuc     UINT16                          CurrentDepth;
1298433d6423SLionel Sambuc 
1299433d6423SLionel Sambuc #ifdef ACPI_DBG_TRACK_ALLOCATIONS
1300433d6423SLionel Sambuc 
1301433d6423SLionel Sambuc     /* Statistics for debug memory tracking only */
1302433d6423SLionel Sambuc 
1303433d6423SLionel Sambuc     UINT32                          TotalAllocated;
1304433d6423SLionel Sambuc     UINT32                          TotalFreed;
1305433d6423SLionel Sambuc     UINT32                          MaxOccupied;
1306433d6423SLionel Sambuc     UINT32                          TotalSize;
1307433d6423SLionel Sambuc     UINT32                          CurrentTotalSize;
1308433d6423SLionel Sambuc     UINT32                          Requests;
1309433d6423SLionel Sambuc     UINT32                          Hits;
1310433d6423SLionel Sambuc #endif
1311433d6423SLionel Sambuc 
1312433d6423SLionel Sambuc } ACPI_MEMORY_LIST;
1313433d6423SLionel Sambuc 
1314433d6423SLionel Sambuc 
1315*29492bb7SDavid van Moolenbroek /* Definitions of _OSI support */
1316*29492bb7SDavid van Moolenbroek 
1317*29492bb7SDavid van Moolenbroek #define ACPI_VENDOR_STRINGS                 0x01
1318*29492bb7SDavid van Moolenbroek #define ACPI_FEATURE_STRINGS                0x02
1319*29492bb7SDavid van Moolenbroek #define ACPI_ENABLE_INTERFACES              0x00
1320*29492bb7SDavid van Moolenbroek #define ACPI_DISABLE_INTERFACES             0x04
1321*29492bb7SDavid van Moolenbroek 
1322*29492bb7SDavid van Moolenbroek #define ACPI_DISABLE_ALL_VENDOR_STRINGS     (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS)
1323*29492bb7SDavid van Moolenbroek #define ACPI_DISABLE_ALL_FEATURE_STRINGS    (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS)
1324*29492bb7SDavid van Moolenbroek #define ACPI_DISABLE_ALL_STRINGS            (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
1325*29492bb7SDavid van Moolenbroek #define ACPI_ENABLE_ALL_VENDOR_STRINGS      (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS)
1326*29492bb7SDavid van Moolenbroek #define ACPI_ENABLE_ALL_FEATURE_STRINGS     (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS)
1327*29492bb7SDavid van Moolenbroek #define ACPI_ENABLE_ALL_STRINGS             (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
1328*29492bb7SDavid van Moolenbroek 
1329*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_2000               0x01
1330*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_XP                 0x02
1331*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_XP_SP1             0x03
1332*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WINSRV_2003            0x04
1333*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_XP_SP2             0x05
1334*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WINSRV_2003_SP1        0x06
1335*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_VISTA              0x07
1336*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WINSRV_2008            0x08
1337*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_VISTA_SP1          0x09
1338*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_VISTA_SP2          0x0A
1339*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_7                  0x0B
1340*29492bb7SDavid van Moolenbroek #define ACPI_OSI_WIN_8                  0x0C
1341*29492bb7SDavid van Moolenbroek 
1342*29492bb7SDavid van Moolenbroek 
1343*29492bb7SDavid van Moolenbroek /* Definitions of file IO */
1344*29492bb7SDavid van Moolenbroek 
1345*29492bb7SDavid van Moolenbroek #define ACPI_FILE_READING               0x01
1346*29492bb7SDavid van Moolenbroek #define ACPI_FILE_WRITING               0x02
1347*29492bb7SDavid van Moolenbroek #define ACPI_FILE_BINARY                0x04
1348*29492bb7SDavid van Moolenbroek 
1349*29492bb7SDavid van Moolenbroek #define ACPI_FILE_BEGIN                 0x01
1350*29492bb7SDavid van Moolenbroek #define ACPI_FILE_END                   0x02
1351*29492bb7SDavid van Moolenbroek 
1352*29492bb7SDavid van Moolenbroek 
1353*29492bb7SDavid van Moolenbroek /* Definitions of getopt */
1354*29492bb7SDavid van Moolenbroek 
1355*29492bb7SDavid van Moolenbroek #define ACPI_OPT_END                    -1
1356*29492bb7SDavid van Moolenbroek 
1357*29492bb7SDavid van Moolenbroek 
1358433d6423SLionel Sambuc #endif /* __ACTYPES_H__ */
1359