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