1 /******************************************************************************
3 * Name: actypes.h - Common data types for the entire ACPI subsystem
6 *****************************************************************************/
8 /******************************************************************************
12 * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
13 * All rights reserved.
17 * 2.1. This is your license from Intel Corp. under its intellectual property
18 * rights. You may have additional license terms from the party that provided
19 * you this software, covering your right to use that party's intellectual
22 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23 * copy of the source code appearing in this file ("Covered Code") an
24 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25 * base code distributed originally by Intel ("Original Intel Code") to copy,
26 * make derivatives, distribute, use and display any portion of the Covered
27 * Code in any form, with the right to sublicense such rights; and
29 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30 * license (with the right to sublicense), under only those claims of Intel
31 * patents that are infringed by the Original Intel Code, to make, use, sell,
32 * offer to sell, and import the Covered Code and derivative works thereof
33 * solely to the minimum extent necessary to exercise the above copyright
34 * license, and in no event shall the patent license extend to any additions
35 * to or modifications of the Original Intel Code. No other license or right
36 * is granted directly or by implication, estoppel or otherwise;
38 * The above copyright and patent license is granted only if the following
43 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44 * Redistribution of source code of any substantial portion of the Covered
45 * Code or modification with rights to further distribute source must include
46 * the above Copyright Notice, the above License, this list of Conditions,
47 * and the following Disclaimer and Export Compliance provision. In addition,
48 * Licensee must cause all Covered Code to which Licensee contributes to
49 * contain a file documenting the changes Licensee made to create that Covered
50 * Code and the date of any change. Licensee must include in that file the
51 * documentation of any changes made by any predecessor Licensee. Licensee
52 * must include a prominent statement that the modification is derived,
53 * directly or indirectly, from Original Intel Code.
55 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56 * Redistribution of source code of any substantial portion of the Covered
57 * Code or modification without rights to further distribute source must
58 * include the following Disclaimer and Export Compliance provision in the
59 * documentation and/or other materials provided with distribution. In
60 * addition, Licensee may not authorize further sublicense of source of any
61 * portion of the Covered Code, and must include terms to the effect that the
62 * license from Licensee to its licensee is limited to the intellectual
63 * property embodied in the software Licensee provides to its licensee, and
64 * not to intellectual property embodied in modifications its licensee may
67 * 3.3. Redistribution of Executable. Redistribution in executable form of any
68 * substantial portion of the Covered Code or modification must reproduce the
69 * above Copyright Notice, and the following Disclaimer and Export Compliance
70 * provision in the documentation and/or other materials provided with the
73 * 3.4. Intel retains all right, title, and interest in and to the Original
76 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77 * Intel shall be used in advertising or otherwise to promote the sale, use or
78 * other dealings in products derived from or relating to the Covered Code
79 * without prior written authorization from Intel.
81 * 4. Disclaimer and Export Compliance
83 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
86 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************/
117 #ifndef __ACTYPES_H__
118 #define __ACTYPES_H__
120 /* acpisrc:StructDefs -- for acpisrc conversion */
123 * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
124 * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of
127 #ifndef ACPI_MACHINE_WIDTH
128 #error ACPI_MACHINE_WIDTH not defined
131 /*! [Begin] no source code translation */
135 * Note: These macros are designed to be compiler independent as well as
136 * working around problems that some 32-bit compilers have with 64-bit
139 #define ACPI_UINT8_MAX (UINT8) (~((UINT8) 0)) /* 0xFF */
140 #define ACPI_UINT16_MAX (UINT16)(~((UINT16) 0)) /* 0xFFFF */
141 #define ACPI_UINT32_MAX (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF */
142 #define ACPI_UINT64_MAX (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
143 #define ACPI_ASCII_MAX 0x7F
147 * Architecture-specific ACPICA Subsystem Data Types
149 * The goal of these types is to provide source code portability across
150 * 16-bit, 32-bit, and 64-bit targets.
152 * 1) The following types are of fixed size for all targets (16/32/64):
154 * BOOLEAN Logical boolean
156 * UINT8 8-bit (1 byte) unsigned value
157 * UINT16 16-bit (2 byte) unsigned value
158 * UINT32 32-bit (4 byte) unsigned value
159 * UINT64 64-bit (8 byte) unsigned value
161 * INT16 16-bit (2 byte) signed value
162 * INT32 32-bit (4 byte) signed value
163 * INT64 64-bit (8 byte) signed value
165 * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
166 * compiler-dependent header(s) and were introduced because there is no common
167 * 64-bit integer type across the various compilation models, as shown in
170 * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit
172 * short 16 16 16 16 16 16
174 * int 32 64 32 32 16 16
175 * long 64 64 32 32 32 32
177 * pointer 64 64 64 32 32 32
179 * Note: ILP64 and LP32 are currently not supported.
182 * 2) These types represent the native word size of the target mode of the
183 * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
184 * usually used for memory allocation, efficient loop counters, and array
185 * indexes. The types are similar to the size_t type in the C library and are
186 * required because there is no C type that consistently represents the native
189 * ACPI_SIZE 16/32/64-bit unsigned value
190 * ACPI_NATIVE_UINT 16/32/64-bit unsigned value
191 * ACPI_NATIVE_INT 16/32/64-bit signed value
195 /*******************************************************************************
197 * Common types for all compilers, all targets
199 ******************************************************************************/
201 typedef unsigned char BOOLEAN;
202 typedef unsigned char UINT8;
203 typedef unsigned short UINT16;
204 typedef COMPILER_DEPENDENT_UINT64 UINT64;
205 typedef COMPILER_DEPENDENT_INT64 INT64;
207 /*! [End] no source code translation !*/
210 /*******************************************************************************
212 * Types specific to 64-bit targets
214 ******************************************************************************/
216 #if ACPI_MACHINE_WIDTH == 64
218 /*! [Begin] no source code translation (keep the typedefs as-is) */
220 typedef unsigned int UINT32;
223 /*! [End] no source code translation !*/
226 typedef UINT64 ACPI_NATIVE_UINT;
227 typedef INT64 ACPI_NATIVE_INT;
229 typedef UINT64 ACPI_IO_ADDRESS;
230 typedef UINT64 ACPI_PHYSICAL_ADDRESS;
232 #define ACPI_MAX_PTR ACPI_UINT64_MAX
233 #define ACPI_SIZE_MAX ACPI_UINT64_MAX
235 #define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */
238 * In the case of the Itanium Processor Family (IPF), the hardware does not
239 * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
240 * to indicate that special precautions must be taken to avoid alignment faults.
241 * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
243 * Note: EM64T and other X86-64 processors support misaligned transfers,
244 * so there is no need to define this flag.
246 #if defined (__IA64__) || defined (__ia64__)
247 #define ACPI_MISALIGNMENT_NOT_SUPPORTED
251 /*******************************************************************************
253 * Types specific to 32-bit targets
255 ******************************************************************************/
257 #elif ACPI_MACHINE_WIDTH == 32
259 /*! [Begin] no source code translation (keep the typedefs as-is) */
261 typedef unsigned int UINT32;
264 /*! [End] no source code translation !*/
267 typedef UINT32 ACPI_NATIVE_UINT;
268 typedef INT32 ACPI_NATIVE_INT;
270 typedef UINT32 ACPI_IO_ADDRESS;
271 typedef UINT32 ACPI_PHYSICAL_ADDRESS;
273 #define ACPI_MAX_PTR ACPI_UINT32_MAX
274 #define ACPI_SIZE_MAX ACPI_UINT32_MAX
278 /* ACPI_MACHINE_WIDTH must be either 64 or 32 */
280 #error unknown ACPI_MACHINE_WIDTH
284 /* Variable-width type, used instead of clib size_t */
286 typedef ACPI_NATIVE_UINT ACPI_SIZE;
289 /*******************************************************************************
291 * OS-dependent and compiler-dependent types
293 * If the defaults below are not appropriate for the host system, they can
294 * be defined in the compiler-specific or OS-specific header, and this will
297 ******************************************************************************/
300 /* Value returned by AcpiOsGetThreadId */
302 #ifndef ACPI_THREAD_ID
303 #define ACPI_THREAD_ID ACPI_NATIVE_UINT
306 /* Object returned from AcpiOsCreateLock */
308 #ifndef ACPI_SPINLOCK
309 #define ACPI_SPINLOCK void *
312 /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
314 #ifndef ACPI_CPU_FLAGS
315 #define ACPI_CPU_FLAGS ACPI_NATIVE_UINT
318 /* Object returned from AcpiOsCreateCache */
321 #define ACPI_CACHE_T ACPI_MEMORY_LIST
324 /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
326 #ifndef ACPI_UINTPTR_T
327 #define ACPI_UINTPTR_T void *
331 * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
332 * some compilers can catch printf format string problems
334 #ifndef ACPI_PRINTF_LIKE
335 #define ACPI_PRINTF_LIKE(c)
339 * Some compilers complain about unused variables. Sometimes we don't want to
340 * use all the variables (for example, _AcpiModuleName). This allows us
341 * to to tell the compiler in a per-variable manner that a variable
344 #ifndef ACPI_UNUSED_VAR
345 #define ACPI_UNUSED_VAR
349 * All ACPICA functions that are available to the rest of the kernel are
350 * tagged with this macro which can be defined as appropriate for the host.
352 #ifndef ACPI_EXPORT_SYMBOL
353 #define ACPI_EXPORT_SYMBOL(Symbol)
357 /*******************************************************************************
361 ******************************************************************************/
363 /* Logical defines and NULL */
368 #define FALSE (1 == 0)
373 #define TRUE (1 == 1)
376 #define NULL (void *) 0
381 * Mescellaneous types
383 typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */
384 typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */
385 typedef char * ACPI_STRING; /* Null terminated ASCII string */
386 typedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */
388 typedef struct uint64_struct
395 typedef union uint64_overlay
402 typedef struct uint32_struct
410 /* Synchronization objects */
412 #define ACPI_MUTEX void *
413 #define ACPI_SEMAPHORE void *
417 * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
418 * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
419 * type only, not other integers used in the implementation of the ACPI CA
422 typedef UINT64 ACPI_INTEGER;
423 #define ACPI_INTEGER_MAX ACPI_UINT64_MAX
424 #define ACPI_INTEGER_BIT_SIZE 64
425 #define ACPI_MAX_DECIMAL_DIGITS 20 /* 2^64 = 18,446,744,073,709,551,616 */
428 #if ACPI_MACHINE_WIDTH == 64
429 #define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
432 #define ACPI_MAX64_DECIMAL_DIGITS 20
433 #define ACPI_MAX32_DECIMAL_DIGITS 10
434 #define ACPI_MAX16_DECIMAL_DIGITS 5
435 #define ACPI_MAX8_DECIMAL_DIGITS 3
438 * Constants with special meanings
440 #define ACPI_ROOT_OBJECT ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
444 * Initialization sequence
446 #define ACPI_FULL_INITIALIZATION 0x00
447 #define ACPI_NO_ADDRESS_SPACE_INIT 0x01
448 #define ACPI_NO_HARDWARE_INIT 0x02
449 #define ACPI_NO_EVENT_INIT 0x04
450 #define ACPI_NO_HANDLER_INIT 0x08
451 #define ACPI_NO_ACPI_ENABLE 0x10
452 #define ACPI_NO_DEVICE_INIT 0x20
453 #define ACPI_NO_OBJECT_INIT 0x40
456 * Initialization state
458 #define ACPI_SUBSYSTEM_INITIALIZE 0x01
459 #define ACPI_INITIALIZED_OK 0x02
464 #define ACPI_STATE_UNKNOWN (UINT8) 0xFF
466 #define ACPI_STATE_S0 (UINT8) 0
467 #define ACPI_STATE_S1 (UINT8) 1
468 #define ACPI_STATE_S2 (UINT8) 2
469 #define ACPI_STATE_S3 (UINT8) 3
470 #define ACPI_STATE_S4 (UINT8) 4
471 #define ACPI_STATE_S5 (UINT8) 5
472 #define ACPI_S_STATES_MAX ACPI_STATE_S5
473 #define ACPI_S_STATE_COUNT 6
475 #define ACPI_STATE_D0 (UINT8) 0
476 #define ACPI_STATE_D1 (UINT8) 1
477 #define ACPI_STATE_D2 (UINT8) 2
478 #define ACPI_STATE_D3 (UINT8) 3
479 #define ACPI_D_STATES_MAX ACPI_STATE_D3
480 #define ACPI_D_STATE_COUNT 4
482 #define ACPI_STATE_C0 (UINT8) 0
483 #define ACPI_STATE_C1 (UINT8) 1
484 #define ACPI_STATE_C2 (UINT8) 2
485 #define ACPI_STATE_C3 (UINT8) 3
486 #define ACPI_C_STATES_MAX ACPI_STATE_C3
487 #define ACPI_C_STATE_COUNT 4
490 * Sleep type invalid value
492 #define ACPI_SLEEP_TYPE_MAX 0x7
493 #define ACPI_SLEEP_TYPE_INVALID 0xFF
496 * Standard notify values
498 #define ACPI_NOTIFY_BUS_CHECK (UINT8) 0
499 #define ACPI_NOTIFY_DEVICE_CHECK (UINT8) 1
500 #define ACPI_NOTIFY_DEVICE_WAKE (UINT8) 2
501 #define ACPI_NOTIFY_EJECT_REQUEST (UINT8) 3
502 #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT (UINT8) 4
503 #define ACPI_NOTIFY_FREQUENCY_MISMATCH (UINT8) 5
504 #define ACPI_NOTIFY_BUS_MODE_MISMATCH (UINT8) 6
505 #define ACPI_NOTIFY_POWER_FAULT (UINT8) 7
508 * Types associated with ACPI names and objects. The first group of
509 * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
510 * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
511 * only add to the first group if the spec changes.
513 * NOTE: Types must be kept in sync with the global AcpiNsProperties
514 * and AcpiNsTypeNames arrays.
516 typedef UINT32 ACPI_OBJECT_TYPE;
518 #define ACPI_TYPE_ANY 0x00
519 #define ACPI_TYPE_INTEGER 0x01 /* Byte/Word/Dword/Zero/One/Ones */
520 #define ACPI_TYPE_STRING 0x02
521 #define ACPI_TYPE_BUFFER 0x03
522 #define ACPI_TYPE_PACKAGE 0x04 /* ByteConst, multiple DataTerm/Constant/SuperName */
523 #define ACPI_TYPE_FIELD_UNIT 0x05
524 #define ACPI_TYPE_DEVICE 0x06 /* Name, multiple Node */
525 #define ACPI_TYPE_EVENT 0x07
526 #define ACPI_TYPE_METHOD 0x08 /* Name, ByteConst, multiple Code */
527 #define ACPI_TYPE_MUTEX 0x09
528 #define ACPI_TYPE_REGION 0x0A
529 #define ACPI_TYPE_POWER 0x0B /* Name,ByteConst,WordConst,multi Node */
530 #define ACPI_TYPE_PROCESSOR 0x0C /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
531 #define ACPI_TYPE_THERMAL 0x0D /* Name, multiple Node */
532 #define ACPI_TYPE_BUFFER_FIELD 0x0E
533 #define ACPI_TYPE_DDB_HANDLE 0x0F
534 #define ACPI_TYPE_DEBUG_OBJECT 0x10
536 #define ACPI_TYPE_EXTERNAL_MAX 0x10
539 * These are object types that do not map directly to the ACPI
540 * ObjectType() operator. They are used for various internal purposes only.
541 * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
542 * internal types must move upwards. (There is code that depends on these
543 * values being contiguous with the external types above.)
545 #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11
546 #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12
547 #define ACPI_TYPE_LOCAL_INDEX_FIELD 0x13
548 #define ACPI_TYPE_LOCAL_REFERENCE 0x14 /* Arg#, Local#, Name, Debug, RefOf, Index */
549 #define ACPI_TYPE_LOCAL_ALIAS 0x15
550 #define ACPI_TYPE_LOCAL_METHOD_ALIAS 0x16
551 #define ACPI_TYPE_LOCAL_NOTIFY 0x17
552 #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
553 #define ACPI_TYPE_LOCAL_RESOURCE 0x19
554 #define ACPI_TYPE_LOCAL_RESOURCE_FIELD 0x1A
555 #define ACPI_TYPE_LOCAL_SCOPE 0x1B /* 1 Name, multiple ObjectList Nodes */
557 #define ACPI_TYPE_NS_NODE_MAX 0x1B /* Last typecode used within a NS Node */
560 * These are special object types that never appear in
561 * a Namespace node, only in an ACPI_OPERAND_OBJECT
563 #define ACPI_TYPE_LOCAL_EXTRA 0x1C
564 #define ACPI_TYPE_LOCAL_DATA 0x1D
566 #define ACPI_TYPE_LOCAL_MAX 0x1D
568 /* All types above here are invalid */
570 #define ACPI_TYPE_INVALID 0x1E
571 #define ACPI_TYPE_NOT_FOUND 0xFF
578 #define ACPI_IO_MASK 1
581 * Event Types: Fixed & General Purpose
583 typedef UINT32 ACPI_EVENT_TYPE;
588 #define ACPI_EVENT_PMTIMER 0
589 #define ACPI_EVENT_GLOBAL 1
590 #define ACPI_EVENT_POWER_BUTTON 2
591 #define ACPI_EVENT_SLEEP_BUTTON 3
592 #define ACPI_EVENT_RTC 4
593 #define ACPI_EVENT_MAX 4
594 #define ACPI_NUM_FIXED_EVENTS ACPI_EVENT_MAX + 1
597 * Event Status - Per event
599 * The encoding of ACPI_EVENT_STATUS is illustrated below.
600 * Note that a set bit (1) indicates the property is TRUE
601 * (e.g. if bit 0 is set then the event is enabled).
602 * +-------------+-+-+-+
603 * | Bits 31:3 |2|1|0|
604 * +-------------+-+-+-+
607 * | | +--- Enabled for wake?
609 * +----------- <Reserved>
611 typedef UINT32 ACPI_EVENT_STATUS;
613 #define ACPI_EVENT_FLAG_DISABLED (ACPI_EVENT_STATUS) 0x00
614 #define ACPI_EVENT_FLAG_ENABLED (ACPI_EVENT_STATUS) 0x01
615 #define ACPI_EVENT_FLAG_WAKE_ENABLED (ACPI_EVENT_STATUS) 0x02
616 #define ACPI_EVENT_FLAG_SET (ACPI_EVENT_STATUS) 0x04
619 * General Purpose Events (GPE)
621 #define ACPI_GPE_INVALID 0xFF
622 #define ACPI_GPE_MAX 0xFF
623 #define ACPI_NUM_GPE 256
625 #define ACPI_GPE_ENABLE 0
626 #define ACPI_GPE_DISABLE 1
630 * GPE info flags - Per GPE
635 * | | | | | +--- Interrupt type: Edge or Level Triggered
636 * | | | | +--- Type: Wake-only, Runtime-only, or wake/runtime
637 * | | | +--- Type of dispatch -- to method, handler, or none
638 * | | +--- Enabled for runtime?
639 * | +--- Enabled for wake?
642 #define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01
643 #define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01
644 #define ACPI_GPE_EDGE_TRIGGERED (UINT8) 0x00
646 #define ACPI_GPE_TYPE_MASK (UINT8) 0x06
647 #define ACPI_GPE_TYPE_WAKE_RUN (UINT8) 0x06
648 #define ACPI_GPE_TYPE_WAKE (UINT8) 0x02
649 #define ACPI_GPE_TYPE_RUNTIME (UINT8) 0x04 /* Default */
651 #define ACPI_GPE_DISPATCH_MASK (UINT8) 0x18
652 #define ACPI_GPE_DISPATCH_HANDLER (UINT8) 0x08
653 #define ACPI_GPE_DISPATCH_METHOD (UINT8) 0x10
654 #define ACPI_GPE_DISPATCH_NOT_USED (UINT8) 0x00 /* Default */
656 #define ACPI_GPE_RUN_ENABLE_MASK (UINT8) 0x20
657 #define ACPI_GPE_RUN_ENABLED (UINT8) 0x20
658 #define ACPI_GPE_RUN_DISABLED (UINT8) 0x00 /* Default */
660 #define ACPI_GPE_WAKE_ENABLE_MASK (UINT8) 0x40
661 #define ACPI_GPE_WAKE_ENABLED (UINT8) 0x40
662 #define ACPI_GPE_WAKE_DISABLED (UINT8) 0x00 /* Default */
664 #define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */
667 * Flags for GPE and Lock interfaces
669 #define ACPI_EVENT_WAKE_ENABLE 0x2 /* AcpiGpeEnable */
670 #define ACPI_EVENT_WAKE_DISABLE 0x2 /* AcpiGpeDisable */
672 #define ACPI_NOT_ISR 0x1
678 #define ACPI_SYSTEM_NOTIFY 0x1
679 #define ACPI_DEVICE_NOTIFY 0x2
680 #define ACPI_ALL_NOTIFY 0x3
681 #define ACPI_MAX_NOTIFY_HANDLER_TYPE 0x3
683 #define ACPI_MAX_SYS_NOTIFY 0x7f
686 /* Address Space (Operation Region) Types */
688 typedef UINT8 ACPI_ADR_SPACE_TYPE;
690 #define ACPI_ADR_SPACE_SYSTEM_MEMORY (ACPI_ADR_SPACE_TYPE) 0
691 #define ACPI_ADR_SPACE_SYSTEM_IO (ACPI_ADR_SPACE_TYPE) 1
692 #define ACPI_ADR_SPACE_PCI_CONFIG (ACPI_ADR_SPACE_TYPE) 2
693 #define ACPI_ADR_SPACE_EC (ACPI_ADR_SPACE_TYPE) 3
694 #define ACPI_ADR_SPACE_SMBUS (ACPI_ADR_SPACE_TYPE) 4
695 #define ACPI_ADR_SPACE_CMOS (ACPI_ADR_SPACE_TYPE) 5
696 #define ACPI_ADR_SPACE_PCI_BAR_TARGET (ACPI_ADR_SPACE_TYPE) 6
697 #define ACPI_ADR_SPACE_DATA_TABLE (ACPI_ADR_SPACE_TYPE) 7
698 #define ACPI_ADR_SPACE_FIXED_HARDWARE (ACPI_ADR_SPACE_TYPE) 127
703 * These are bitfields defined within the full ACPI registers
705 #define ACPI_BITREG_TIMER_STATUS 0x00
706 #define ACPI_BITREG_BUS_MASTER_STATUS 0x01
707 #define ACPI_BITREG_GLOBAL_LOCK_STATUS 0x02
708 #define ACPI_BITREG_POWER_BUTTON_STATUS 0x03
709 #define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
710 #define ACPI_BITREG_RT_CLOCK_STATUS 0x05
711 #define ACPI_BITREG_WAKE_STATUS 0x06
712 #define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07
714 #define ACPI_BITREG_TIMER_ENABLE 0x08
715 #define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09
716 #define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A
717 #define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B
718 #define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C
719 #define ACPI_BITREG_WAKE_ENABLE 0x0D
720 #define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E
722 #define ACPI_BITREG_SCI_ENABLE 0x0F
723 #define ACPI_BITREG_BUS_MASTER_RLD 0x10
724 #define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11
725 #define ACPI_BITREG_SLEEP_TYPE_A 0x12
726 #define ACPI_BITREG_SLEEP_TYPE_B 0x13
727 #define ACPI_BITREG_SLEEP_ENABLE 0x14
729 #define ACPI_BITREG_ARB_DISABLE 0x15
731 #define ACPI_BITREG_MAX 0x15
732 #define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
736 * External ACPI object definition
738 typedef union acpi_object
740 ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */
743 ACPI_OBJECT_TYPE Type;
744 ACPI_INTEGER Value; /* The actual number */
749 ACPI_OBJECT_TYPE Type;
750 UINT32 Length; /* # of bytes in string, excluding trailing null */
751 char *Pointer; /* points to the string value */
756 ACPI_OBJECT_TYPE Type;
757 UINT32 Length; /* # of bytes in buffer */
758 UINT8 *Pointer; /* points to the buffer */
763 ACPI_OBJECT_TYPE Type;
765 ACPI_HANDLE Handle; /* object reference */
770 ACPI_OBJECT_TYPE Type;
771 UINT32 Count; /* # of elements in package */
772 union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */
777 ACPI_OBJECT_TYPE Type;
779 ACPI_IO_ADDRESS PblkAddress;
785 ACPI_OBJECT_TYPE Type;
787 UINT32 ResourceOrder;
794 * List of objects, used as a parameter list for control method evaluation
796 typedef struct acpi_object_list
799 ACPI_OBJECT *Pointer;
805 * Miscellaneous common Data Structures used by the interfaces
807 #define ACPI_NO_BUFFER 0
808 #define ACPI_ALLOCATE_BUFFER (ACPI_SIZE) (-1)
809 #define ACPI_ALLOCATE_LOCAL_BUFFER (ACPI_SIZE) (-2)
811 typedef struct acpi_buffer
813 ACPI_SIZE Length; /* Length in bytes of the buffer */
814 void *Pointer; /* pointer to buffer */
820 * NameType for AcpiGetName
822 #define ACPI_FULL_PATHNAME 0
823 #define ACPI_SINGLE_NAME 1
824 #define ACPI_NAME_TYPE_MAX 1
828 * Structure and flags for AcpiGetSystemInfo
830 #define ACPI_SYS_MODE_UNKNOWN 0x0000
831 #define ACPI_SYS_MODE_ACPI 0x0001
832 #define ACPI_SYS_MODE_LEGACY 0x0002
833 #define ACPI_SYS_MODES_MASK 0x0003
837 * System info returned by AcpiGetSystemInfo()
839 typedef struct acpi_system_info
841 UINT32 AcpiCaVersion;
843 UINT32 TimerResolution;
853 * Types specific to the OS service interfaces
856 (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
860 (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
864 * Various handlers and callback procedures
867 UINT32 (*ACPI_EVENT_HANDLER) (
871 void (*ACPI_NOTIFY_HANDLER) (
877 void (*ACPI_OBJECT_HANDLER) (
883 ACPI_STATUS (*ACPI_INIT_HANDLER) (
887 #define ACPI_INIT_DEVICE_INI 1
890 ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) (
891 ACPI_STATUS AmlStatus,
898 /* Address Spaces (For Operation Regions) */
901 ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
903 ACPI_PHYSICAL_ADDRESS Address,
906 void *HandlerContext,
907 void *RegionContext);
909 #define ACPI_DEFAULT_HANDLER NULL
913 ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
914 ACPI_HANDLE RegionHandle,
916 void *HandlerContext,
917 void **RegionContext);
919 #define ACPI_REGION_ACTIVATE 0
920 #define ACPI_REGION_DEACTIVATE 1
923 ACPI_STATUS (*ACPI_WALK_CALLBACK) (
924 ACPI_HANDLE ObjHandle,
930 /* Interrupt handler return values */
932 #define ACPI_INTERRUPT_NOT_HANDLED 0x00
933 #define ACPI_INTERRUPT_HANDLED 0x01
936 /* Common string version of device HIDs and UIDs */
938 typedef struct acpi_device_id
940 char Value[ACPI_DEVICE_ID_LENGTH];
944 /* Common string version of device CIDs */
946 typedef struct acpi_compatible_id
948 char Value[ACPI_MAX_CID_LENGTH];
950 } ACPI_COMPATIBLE_ID;
952 typedef struct acpi_compatible_id_list
956 ACPI_COMPATIBLE_ID Id[1];
958 } ACPI_COMPATIBLE_ID_LIST;
961 /* Structure and flags for AcpiGetObjectInfo */
963 #define ACPI_VALID_STA 0x0001
964 #define ACPI_VALID_ADR 0x0002
965 #define ACPI_VALID_HID 0x0004
966 #define ACPI_VALID_UID 0x0008
967 #define ACPI_VALID_CID 0x0010
968 #define ACPI_VALID_SXDS 0x0020
970 /* Flags for _STA method */
972 #define ACPI_STA_DEVICE_PRESENT 0x01
973 #define ACPI_STA_DEVICE_ENABLED 0x02
974 #define ACPI_STA_DEVICE_UI 0x04
975 #define ACPI_STA_DEVICE_FUNCTIONING 0x08
976 #define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
977 #define ACPI_STA_BATTERY_PRESENT 0x10
980 #define ACPI_COMMON_OBJ_INFO \
981 ACPI_OBJECT_TYPE Type; /* ACPI object type */ \
982 ACPI_NAME Name /* ACPI object Name */
985 typedef struct acpi_obj_info_header
987 ACPI_COMMON_OBJ_INFO;
989 } ACPI_OBJ_INFO_HEADER;
992 /* Structure returned from Get Object Info */
994 typedef struct acpi_device_info
996 ACPI_COMMON_OBJ_INFO;
998 UINT32 Valid; /* Indicates which fields below are valid */
999 UINT32 CurrentStatus; /* _STA value */
1000 ACPI_INTEGER Address; /* _ADR value if any */
1001 ACPI_DEVICE_ID HardwareId; /* _HID value if any */
1002 ACPI_DEVICE_ID UniqueId; /* _UID value if any */
1003 UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
1004 ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
1009 /* Context structs for address space handlers */
1011 typedef struct acpi_pci_id
1021 typedef struct acpi_mem_space_context
1024 ACPI_PHYSICAL_ADDRESS Address;
1025 ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress;
1026 UINT8 *MappedLogicalAddress;
1027 ACPI_SIZE MappedLength;
1029 } ACPI_MEM_SPACE_CONTEXT;
1033 * Definitions for Resource Attributes
1035 typedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */
1036 typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
1041 #define ACPI_READ_ONLY_MEMORY (UINT8) 0x00
1042 #define ACPI_READ_WRITE_MEMORY (UINT8) 0x01
1044 #define ACPI_NON_CACHEABLE_MEMORY (UINT8) 0x00
1045 #define ACPI_CACHABLE_MEMORY (UINT8) 0x01
1046 #define ACPI_WRITE_COMBINING_MEMORY (UINT8) 0x02
1047 #define ACPI_PREFETCHABLE_MEMORY (UINT8) 0x03
1051 * The ISA IO ranges are: n000-n0FFh, n400-n4FFh, n800-n8FFh, nC00-nCFFh.
1052 * The non-ISA IO ranges are: n100-n3FFh, n500-n7FFh, n900-nBFFh, nCD0-nFFFh.
1054 #define ACPI_NON_ISA_ONLY_RANGES (UINT8) 0x01
1055 #define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
1056 #define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
1058 /* Type of translation - 1=Sparse, 0=Dense */
1060 #define ACPI_SPARSE_TRANSLATION (UINT8) 0x01
1063 * IO Port Descriptor Decode
1065 #define ACPI_DECODE_10 (UINT8) 0x00 /* 10-bit IO address decode */
1066 #define ACPI_DECODE_16 (UINT8) 0x01 /* 16-bit IO address decode */
1071 #define ACPI_LEVEL_SENSITIVE (UINT8) 0x00
1072 #define ACPI_EDGE_SENSITIVE (UINT8) 0x01
1074 #define ACPI_ACTIVE_HIGH (UINT8) 0x00
1075 #define ACPI_ACTIVE_LOW (UINT8) 0x01
1077 #define ACPI_EXCLUSIVE (UINT8) 0x00
1078 #define ACPI_SHARED (UINT8) 0x01
1083 #define ACPI_COMPATIBILITY (UINT8) 0x00
1084 #define ACPI_TYPE_A (UINT8) 0x01
1085 #define ACPI_TYPE_B (UINT8) 0x02
1086 #define ACPI_TYPE_F (UINT8) 0x03
1088 #define ACPI_NOT_BUS_MASTER (UINT8) 0x00
1089 #define ACPI_BUS_MASTER (UINT8) 0x01
1091 #define ACPI_TRANSFER_8 (UINT8) 0x00
1092 #define ACPI_TRANSFER_8_16 (UINT8) 0x01
1093 #define ACPI_TRANSFER_16 (UINT8) 0x02
1096 * Start Dependent Functions Priority definitions
1098 #define ACPI_GOOD_CONFIGURATION (UINT8) 0x00
1099 #define ACPI_ACCEPTABLE_CONFIGURATION (UINT8) 0x01
1100 #define ACPI_SUB_OPTIMAL_CONFIGURATION (UINT8) 0x02
1103 * 16, 32 and 64-bit Address Descriptor resource types
1105 #define ACPI_MEMORY_RANGE (UINT8) 0x00
1106 #define ACPI_IO_RANGE (UINT8) 0x01
1107 #define ACPI_BUS_NUMBER_RANGE (UINT8) 0x02
1109 #define ACPI_ADDRESS_NOT_FIXED (UINT8) 0x00
1110 #define ACPI_ADDRESS_FIXED (UINT8) 0x01
1112 #define ACPI_POS_DECODE (UINT8) 0x00
1113 #define ACPI_SUB_DECODE (UINT8) 0x01
1115 #define ACPI_PRODUCER (UINT8) 0x00
1116 #define ACPI_CONSUMER (UINT8) 0x01
1120 * If possible, pack the following structures to byte alignment
1122 #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
1126 /* UUID data structures for use in vendor-defined resource descriptors */
1128 typedef struct acpi_uuid
1130 UINT8 Data[ACPI_UUID_LENGTH];
1133 typedef struct acpi_vendor_uuid
1136 UINT8 Data[ACPI_UUID_LENGTH];
1141 * Structures used to describe device resources
1143 typedef struct acpi_resource_irq
1148 UINT8 InterruptCount;
1149 UINT8 Interrupts[1];
1151 } ACPI_RESOURCE_IRQ;
1154 typedef struct ACPI_RESOURCE_DMA
1162 } ACPI_RESOURCE_DMA;
1165 typedef struct acpi_resource_start_dependent
1167 UINT8 CompatibilityPriority;
1168 UINT8 PerformanceRobustness;
1170 } ACPI_RESOURCE_START_DEPENDENT;
1174 * END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
1175 * needed because it has no fields
1179 typedef struct acpi_resource_io
1183 UINT8 AddressLength;
1189 typedef struct acpi_resource_fixed_io
1192 UINT8 AddressLength;
1194 } ACPI_RESOURCE_FIXED_IO;
1196 typedef struct acpi_resource_vendor
1201 } ACPI_RESOURCE_VENDOR;
1203 /* Vendor resource with UUID info (introduced in ACPI 3.0) */
1205 typedef struct acpi_resource_vendor_typed
1209 UINT8 Uuid[ACPI_UUID_LENGTH];
1212 } ACPI_RESOURCE_VENDOR_TYPED;
1214 typedef struct acpi_resource_end_tag
1218 } ACPI_RESOURCE_END_TAG;
1220 typedef struct acpi_resource_memory24
1226 UINT16 AddressLength;
1228 } ACPI_RESOURCE_MEMORY24;
1230 typedef struct acpi_resource_memory32
1236 UINT32 AddressLength;
1238 } ACPI_RESOURCE_MEMORY32;
1240 typedef struct acpi_resource_fixed_memory32
1244 UINT32 AddressLength;
1246 } ACPI_RESOURCE_FIXED_MEMORY32;
1248 typedef struct acpi_memory_attribute
1255 } ACPI_MEMORY_ATTRIBUTE;
1257 typedef struct acpi_io_attribute
1261 UINT8 TranslationType;
1264 } ACPI_IO_ATTRIBUTE;
1266 typedef union acpi_resource_attribute
1268 ACPI_MEMORY_ATTRIBUTE Mem;
1269 ACPI_IO_ATTRIBUTE Io;
1271 /* Used for the *WordSpace macros */
1275 } ACPI_RESOURCE_ATTRIBUTE;
1277 typedef struct acpi_resource_source
1280 UINT16 StringLength;
1283 } ACPI_RESOURCE_SOURCE;
1285 /* Fields common to all address descriptors, 16/32/64 bit */
1287 #define ACPI_RESOURCE_ADDRESS_COMMON \
1288 UINT8 ResourceType; \
1289 UINT8 ProducerConsumer; \
1291 UINT8 MinAddressFixed; \
1292 UINT8 MaxAddressFixed; \
1293 ACPI_RESOURCE_ATTRIBUTE Info;
1295 typedef struct acpi_resource_address
1297 ACPI_RESOURCE_ADDRESS_COMMON
1299 } ACPI_RESOURCE_ADDRESS;
1301 typedef struct acpi_resource_address16
1303 ACPI_RESOURCE_ADDRESS_COMMON
1307 UINT16 TranslationOffset;
1308 UINT16 AddressLength;
1309 ACPI_RESOURCE_SOURCE ResourceSource;
1311 } ACPI_RESOURCE_ADDRESS16;
1313 typedef struct acpi_resource_address32
1315 ACPI_RESOURCE_ADDRESS_COMMON
1319 UINT32 TranslationOffset;
1320 UINT32 AddressLength;
1321 ACPI_RESOURCE_SOURCE ResourceSource;
1323 } ACPI_RESOURCE_ADDRESS32;
1325 typedef struct acpi_resource_address64
1327 ACPI_RESOURCE_ADDRESS_COMMON
1331 UINT64 TranslationOffset;
1332 UINT64 AddressLength;
1333 ACPI_RESOURCE_SOURCE ResourceSource;
1335 } ACPI_RESOURCE_ADDRESS64;
1337 typedef struct acpi_resource_extended_address64
1339 ACPI_RESOURCE_ADDRESS_COMMON
1344 UINT64 TranslationOffset;
1345 UINT64 AddressLength;
1346 UINT64 TypeSpecific;
1348 } ACPI_RESOURCE_EXTENDED_ADDRESS64;
1350 typedef struct acpi_resource_extended_irq
1352 UINT8 ProducerConsumer;
1356 UINT8 InterruptCount;
1357 ACPI_RESOURCE_SOURCE ResourceSource;
1358 UINT32 Interrupts[1];
1360 } ACPI_RESOURCE_EXTENDED_IRQ;
1362 typedef struct acpi_resource_generic_register
1370 } ACPI_RESOURCE_GENERIC_REGISTER;
1373 /* ACPI_RESOURCE_TYPEs */
1375 #define ACPI_RESOURCE_TYPE_IRQ 0
1376 #define ACPI_RESOURCE_TYPE_DMA 1
1377 #define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
1378 #define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
1379 #define ACPI_RESOURCE_TYPE_IO 4
1380 #define ACPI_RESOURCE_TYPE_FIXED_IO 5
1381 #define ACPI_RESOURCE_TYPE_VENDOR 6
1382 #define ACPI_RESOURCE_TYPE_END_TAG 7
1383 #define ACPI_RESOURCE_TYPE_MEMORY24 8
1384 #define ACPI_RESOURCE_TYPE_MEMORY32 9
1385 #define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
1386 #define ACPI_RESOURCE_TYPE_ADDRESS16 11
1387 #define ACPI_RESOURCE_TYPE_ADDRESS32 12
1388 #define ACPI_RESOURCE_TYPE_ADDRESS64 13
1389 #define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
1390 #define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
1391 #define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
1392 #define ACPI_RESOURCE_TYPE_MAX 16
1395 typedef union acpi_resource_data
1397 ACPI_RESOURCE_IRQ Irq;
1398 ACPI_RESOURCE_DMA Dma;
1399 ACPI_RESOURCE_START_DEPENDENT StartDpf;
1400 ACPI_RESOURCE_IO Io;
1401 ACPI_RESOURCE_FIXED_IO FixedIo;
1402 ACPI_RESOURCE_VENDOR Vendor;
1403 ACPI_RESOURCE_VENDOR_TYPED VendorTyped;
1404 ACPI_RESOURCE_END_TAG EndTag;
1405 ACPI_RESOURCE_MEMORY24 Memory24;
1406 ACPI_RESOURCE_MEMORY32 Memory32;
1407 ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32;
1408 ACPI_RESOURCE_ADDRESS16 Address16;
1409 ACPI_RESOURCE_ADDRESS32 Address32;
1410 ACPI_RESOURCE_ADDRESS64 Address64;
1411 ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
1412 ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq;
1413 ACPI_RESOURCE_GENERIC_REGISTER GenericReg;
1417 ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */
1419 } ACPI_RESOURCE_DATA;
1422 typedef struct acpi_resource
1426 ACPI_RESOURCE_DATA Data;
1430 /* restore default alignment */
1435 #define ACPI_RS_SIZE_MIN 12
1436 #define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
1437 #define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
1439 #define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
1442 typedef struct acpi_pci_routing_table
1446 ACPI_INTEGER Address; /* here for 64-bit alignment */
1448 char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
1450 } ACPI_PCI_ROUTING_TABLE;
1453 #endif /* __ACTYPES_H__ */