[BACK]Return to actypes.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / external / bsd / acpica / dist / include

Annotation of src/sys/external/bsd/acpica/dist/include/actypes.h, Revision 1.12

1.1       jruoho      1: /******************************************************************************
                      2:  *
                      3:  * Name: actypes.h - Common data types for the entire ACPI subsystem
                      4:  *
                      5:  *****************************************************************************/
                      6:
1.3       jruoho      7: /*
1.12    ! christos    8:  * Copyright (C) 2000 - 2017, Intel Corp.
1.1       jruoho      9:  * All rights reserved.
                     10:  *
1.3       jruoho     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:  */
1.1       jruoho     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: /*
                     59:  * Data type ranges
                     60:  * Note: These macros are designed to be compiler independent as well as
                     61:  * working around problems that some 32-bit compilers have with 64-bit
                     62:  * constants.
                     63:  */
                     64: #define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0)) /* 0xFF               */
                     65: #define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0)) /* 0xFFFF             */
                     66: #define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF         */
                     67: #define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
                     68: #define ACPI_ASCII_MAX                  0x7F
                     69:
                     70:
                     71: /*
                     72:  * Architecture-specific ACPICA Subsystem Data Types
                     73:  *
                     74:  * The goal of these types is to provide source code portability across
                     75:  * 16-bit, 32-bit, and 64-bit targets.
                     76:  *
                     77:  * 1) The following types are of fixed size for all targets (16/32/64):
                     78:  *
                     79:  * BOOLEAN      Logical boolean
                     80:  *
                     81:  * UINT8        8-bit  (1 byte) unsigned value
                     82:  * UINT16       16-bit (2 byte) unsigned value
                     83:  * UINT32       32-bit (4 byte) unsigned value
                     84:  * UINT64       64-bit (8 byte) unsigned value
                     85:  *
                     86:  * INT16        16-bit (2 byte) signed value
                     87:  * INT32        32-bit (4 byte) signed value
                     88:  * INT64        64-bit (8 byte) signed value
                     89:  *
                     90:  * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
                     91:  * compiler-dependent header(s) and were introduced because there is no common
                     92:  * 64-bit integer type across the various compilation models, as shown in
                     93:  * the table below.
                     94:  *
                     95:  * Datatype  LP64 ILP64 LLP64 ILP32 LP32 16bit
                     96:  * char      8    8     8     8     8    8
                     97:  * short     16   16    16    16    16   16
                     98:  * _int32         32
                     99:  * int       32   64    32    32    16   16
                    100:  * long      64   64    32    32    32   32
                    101:  * long long            64    64
                    102:  * pointer   64   64    64    32    32   32
                    103:  *
                    104:  * Note: ILP64 and LP32 are currently not supported.
                    105:  *
                    106:  *
                    107:  * 2) These types represent the native word size of the target mode of the
                    108:  * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
                    109:  * usually used for memory allocation, efficient loop counters, and array
                    110:  * indexes. The types are similar to the size_t type in the C library and are
                    111:  * required because there is no C type that consistently represents the native
                    112:  * data width. ACPI_SIZE is needed because there is no guarantee that a
                    113:  * kernel-level C library is present.
                    114:  *
                    115:  * ACPI_SIZE        16/32/64-bit unsigned value
                    116:  * ACPI_NATIVE_INT  16/32/64-bit signed value
                    117:  */
                    118:
                    119: /*******************************************************************************
                    120:  *
                    121:  * Common types for all compilers, all targets
                    122:  *
                    123:  ******************************************************************************/
                    124:
1.6       christos  125: #ifndef ACPI_USE_SYSTEM_INTTYPES
                    126:
1.1       jruoho    127: typedef unsigned char                   BOOLEAN;
                    128: typedef unsigned char                   UINT8;
                    129: typedef unsigned short                  UINT16;
1.6       christos  130: typedef short                           INT16;
1.1       jruoho    131: typedef COMPILER_DEPENDENT_UINT64       UINT64;
                    132: typedef COMPILER_DEPENDENT_INT64        INT64;
                    133:
1.6       christos  134: #endif /* ACPI_USE_SYSTEM_INTTYPES */
1.1       jruoho    135:
1.3       jruoho    136: /*
                    137:  * Value returned by AcpiOsGetThreadId. There is no standard "thread_id"
                    138:  * across operating systems or even the various UNIX systems. Since ACPICA
                    139:  * only needs the thread ID as a unique thread identifier, we use a UINT64
                    140:  * as the only common data type - it will accommodate any type of pointer or
                    141:  * any type of integer. It is up to the host-dependent OSL to cast the
                    142:  * native thread ID type to a UINT64 (in AcpiOsGetThreadId).
                    143:  */
                    144: #define ACPI_THREAD_ID                  UINT64
                    145:
1.1       jruoho    146:
                    147: /*******************************************************************************
                    148:  *
                    149:  * Types specific to 64-bit targets
                    150:  *
                    151:  ******************************************************************************/
                    152:
                    153: #if ACPI_MACHINE_WIDTH == 64
                    154:
1.6       christos  155: #ifndef ACPI_USE_SYSTEM_INTTYPES
1.1       jruoho    156:
                    157: typedef unsigned int                    UINT32;
                    158: typedef int                             INT32;
                    159:
1.6       christos  160: #endif /* ACPI_USE_SYSTEM_INTTYPES */
1.1       jruoho    161:
                    162:
                    163: typedef INT64                           ACPI_NATIVE_INT;
                    164: typedef UINT64                          ACPI_SIZE;
                    165: typedef UINT64                          ACPI_IO_ADDRESS;
                    166: typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
                    167:
                    168: #define ACPI_MAX_PTR                    ACPI_UINT64_MAX
                    169: #define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
                    170: #define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
                    171:
                    172: /*
                    173:  * In the case of the Itanium Processor Family (IPF), the hardware does not
                    174:  * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
                    175:  * to indicate that special precautions must be taken to avoid alignment faults.
                    176:  * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
                    177:  *
                    178:  * Note: EM64T and other X86-64 processors support misaligned transfers,
                    179:  * so there is no need to define this flag.
                    180:  */
                    181: #if defined (__IA64__) || defined (__ia64__)
                    182: #define ACPI_MISALIGNMENT_NOT_SUPPORTED
                    183: #endif
                    184:
                    185:
                    186: /*******************************************************************************
                    187:  *
                    188:  * Types specific to 32-bit targets
                    189:  *
                    190:  ******************************************************************************/
                    191:
                    192: #elif ACPI_MACHINE_WIDTH == 32
                    193:
1.6       christos  194: #ifndef ACPI_USE_SYSTEM_INTTYPES
1.1       jruoho    195:
                    196: typedef unsigned int                    UINT32;
                    197: typedef int                             INT32;
                    198:
1.6       christos  199: #endif /* ACPI_USE_SYSTEM_INTTYPES */
1.1       jruoho    200:
                    201:
                    202: typedef INT32                           ACPI_NATIVE_INT;
                    203: typedef UINT32                          ACPI_SIZE;
1.7       christos  204:
                    205: #ifdef ACPI_32BIT_PHYSICAL_ADDRESS
                    206:
                    207: /*
                    208:  * OSPMs can define this to shrink the size of the structures for 32-bit
                    209:  * none PAE environment. ASL compiler may always define this to generate
                    210:  * 32-bit OSPM compliant tables.
                    211:  */
1.1       jruoho    212: typedef UINT32                          ACPI_IO_ADDRESS;
                    213: typedef UINT32                          ACPI_PHYSICAL_ADDRESS;
                    214:
1.7       christos  215: #else /* ACPI_32BIT_PHYSICAL_ADDRESS */
                    216:
                    217: /*
                    218:  * It is reported that, after some calculations, the physical addresses can
                    219:  * wrap over the 32-bit boundary on 32-bit PAE environment.
                    220:  * https://bugzilla.kernel.org/show_bug.cgi?id=87971
                    221:  */
                    222: typedef UINT64                          ACPI_IO_ADDRESS;
                    223: typedef UINT64                          ACPI_PHYSICAL_ADDRESS;
                    224:
                    225: #endif /* ACPI_32BIT_PHYSICAL_ADDRESS */
                    226:
1.1       jruoho    227: #define ACPI_MAX_PTR                    ACPI_UINT32_MAX
                    228: #define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
                    229:
                    230: #else
                    231:
                    232: /* ACPI_MACHINE_WIDTH must be either 64 or 32 */
                    233:
                    234: #error unknown ACPI_MACHINE_WIDTH
                    235: #endif
                    236:
                    237:
                    238: /*******************************************************************************
                    239:  *
                    240:  * OS-dependent types
                    241:  *
                    242:  * If the defaults below are not appropriate for the host system, they can
                    243:  * be defined in the OS-specific header, and this will take precedence.
                    244:  *
                    245:  ******************************************************************************/
                    246:
                    247: /* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
                    248:
                    249: #ifndef ACPI_CPU_FLAGS
                    250: #define ACPI_CPU_FLAGS                  ACPI_SIZE
                    251: #endif
                    252:
                    253: /* Object returned from AcpiOsCreateCache */
                    254:
                    255: #ifndef ACPI_CACHE_T
                    256: #ifdef ACPI_USE_LOCAL_CACHE
                    257: #define ACPI_CACHE_T                    ACPI_MEMORY_LIST
                    258: #else
                    259: #define ACPI_CACHE_T                    void *
                    260: #endif
                    261: #endif
                    262:
                    263: /*
                    264:  * Synchronization objects - Mutexes, Semaphores, and SpinLocks
                    265:  */
                    266: #if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
                    267: /*
                    268:  * These macros are used if the host OS does not support a mutex object.
                    269:  * Map the OSL Mutex interfaces to binary semaphores.
                    270:  */
                    271: #define ACPI_MUTEX                      ACPI_SEMAPHORE
                    272: #define AcpiOsCreateMutex(OutHandle)    AcpiOsCreateSemaphore (1, 1, OutHandle)
                    273: #define AcpiOsDeleteMutex(Handle)       (void) AcpiOsDeleteSemaphore (Handle)
                    274: #define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
                    275: #define AcpiOsReleaseMutex(Handle)      (void) AcpiOsSignalSemaphore (Handle, 1)
                    276: #endif
                    277:
                    278: /* Configurable types for synchronization objects */
                    279:
                    280: #ifndef ACPI_SPINLOCK
                    281: #define ACPI_SPINLOCK                   void *
                    282: #endif
                    283:
                    284: #ifndef ACPI_SEMAPHORE
                    285: #define ACPI_SEMAPHORE                  void *
                    286: #endif
                    287:
                    288: #ifndef ACPI_MUTEX
                    289: #define ACPI_MUTEX                      void *
                    290: #endif
                    291:
                    292:
                    293: /*******************************************************************************
                    294:  *
                    295:  * Compiler-dependent types
                    296:  *
                    297:  * If the defaults below are not appropriate for the host compiler, they can
                    298:  * be defined in the compiler-specific header, and this will take precedence.
                    299:  *
                    300:  ******************************************************************************/
                    301:
                    302: /* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
                    303:
                    304: #ifndef ACPI_UINTPTR_T
                    305: #define ACPI_UINTPTR_T                  void *
                    306: #endif
                    307:
                    308: /*
                    309:  * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
                    310:  * some compilers can catch printf format string problems
                    311:  */
                    312: #ifndef ACPI_PRINTF_LIKE
                    313: #define ACPI_PRINTF_LIKE(c)
                    314: #endif
                    315:
                    316: /*
                    317:  * Some compilers complain about unused variables. Sometimes we don't want to
                    318:  * use all the variables (for example, _AcpiModuleName). This allows us
1.5       christos  319:  * to tell the compiler in a per-variable manner that a variable
1.1       jruoho    320:  * is unused
                    321:  */
                    322: #ifndef ACPI_UNUSED_VAR
                    323: #define ACPI_UNUSED_VAR
                    324: #endif
                    325:
                    326: /*
1.5       christos  327:  * All ACPICA external functions that are available to the rest of the kernel
                    328:  * are tagged with thes macros which can be defined as appropriate for the host.
                    329:  *
                    330:  * Notes:
                    331:  * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination
                    332:  * interfaces that may need special processing.
                    333:  * ACPI_EXPORT_SYMBOL is used for all other public external functions.
1.1       jruoho    334:  */
1.5       christos  335: #ifndef ACPI_EXPORT_SYMBOL_INIT
                    336: #define ACPI_EXPORT_SYMBOL_INIT(Symbol)
                    337: #endif
                    338:
1.1       jruoho    339: #ifndef ACPI_EXPORT_SYMBOL
                    340: #define ACPI_EXPORT_SYMBOL(Symbol)
                    341: #endif
                    342:
1.5       christos  343: /*
                    344:  * Compiler/Clibrary-dependent debug initialization. Used for ACPICA
                    345:  * utilities only.
                    346:  */
                    347: #ifndef ACPI_DEBUG_INITIALIZE
                    348: #define ACPI_DEBUG_INITIALIZE()
                    349: #endif
                    350:
                    351:
                    352: /*******************************************************************************
                    353:  *
                    354:  * Configuration
                    355:  *
                    356:  ******************************************************************************/
                    357:
1.6       christos  358: #ifdef ACPI_NO_MEM_ALLOCATIONS
                    359:
                    360: #define ACPI_ALLOCATE(a)                NULL
                    361: #define ACPI_ALLOCATE_ZEROED(a)         NULL
                    362: #define ACPI_FREE(a)
                    363: #define ACPI_MEM_TRACKING(a)
                    364:
                    365: #else /* ACPI_NO_MEM_ALLOCATIONS */
                    366:
1.5       christos  367: #ifdef ACPI_DBG_TRACK_ALLOCATIONS
                    368: /*
                    369:  * Memory allocation tracking (used by AcpiExec to detect memory leaks)
                    370:  */
                    371: #define ACPI_MEM_PARAMETERS             _COMPONENT, _AcpiModuleName, __LINE__
                    372: #define ACPI_ALLOCATE(a)                AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
                    373: #define ACPI_ALLOCATE_ZEROED(a)         AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
                    374: #define ACPI_FREE(a)                    AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS)
                    375: #define ACPI_MEM_TRACKING(a)            a
                    376:
                    377: #else
                    378: /*
                    379:  * Normal memory allocation directly via the OS services layer
                    380:  */
                    381: #define ACPI_ALLOCATE(a)                AcpiOsAllocate ((ACPI_SIZE) (a))
                    382: #define ACPI_ALLOCATE_ZEROED(a)         AcpiOsAllocateZeroed ((ACPI_SIZE) (a))
                    383: #define ACPI_FREE(a)                    AcpiOsFree (a)
                    384: #define ACPI_MEM_TRACKING(a)
                    385:
                    386: #endif /* ACPI_DBG_TRACK_ALLOCATIONS */
                    387:
1.6       christos  388: #endif /* ACPI_NO_MEM_ALLOCATIONS */
                    389:
1.1       jruoho    390:
                    391: /******************************************************************************
                    392:  *
                    393:  * ACPI Specification constants (Do not change unless the specification changes)
                    394:  *
                    395:  *****************************************************************************/
                    396:
                    397: /* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
                    398:
                    399: #define ACPI_MAX_GPE_BLOCKS             2
                    400:
                    401: /* Default ACPI register widths */
                    402:
                    403: #define ACPI_GPE_REGISTER_WIDTH         8
                    404: #define ACPI_PM1_REGISTER_WIDTH         16
                    405: #define ACPI_PM2_REGISTER_WIDTH         8
                    406: #define ACPI_PM_TIMER_WIDTH             32
1.5       christos  407: #define ACPI_RESET_REGISTER_WIDTH       8
1.1       jruoho    408:
                    409: /* Names within the namespace are 4 bytes long */
                    410:
                    411: #define ACPI_NAME_SIZE                  4
                    412: #define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
                    413: #define ACPI_PATH_SEPARATOR             '.'
                    414:
                    415: /* Sizes for ACPI table headers */
                    416:
                    417: #define ACPI_OEM_ID_SIZE                6
                    418: #define ACPI_OEM_TABLE_ID_SIZE          8
                    419:
                    420: /* ACPI/PNP hardware IDs */
                    421:
                    422: #define PCI_ROOT_HID_STRING             "PNP0A03"
                    423: #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
                    424:
                    425: /* PM Timer ticks per second (HZ) */
                    426:
1.5       christos  427: #define ACPI_PM_TIMER_FREQUENCY         3579545
1.1       jruoho    428:
                    429:
                    430: /*******************************************************************************
                    431:  *
                    432:  * Independent types
                    433:  *
                    434:  ******************************************************************************/
                    435:
                    436: /* Logical defines and NULL */
                    437:
                    438: #ifdef FALSE
                    439: #undef FALSE
                    440: #endif
                    441: #define FALSE                           (1 == 0)
                    442:
                    443: #ifdef TRUE
                    444: #undef TRUE
                    445: #endif
                    446: #define TRUE                            (1 == 1)
                    447:
                    448: #ifndef NULL
                    449: #define NULL                            (void *) 0
                    450: #endif
                    451:
                    452:
                    453: /*
                    454:  * Miscellaneous types
                    455:  */
                    456: typedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
                    457: typedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
                    458: typedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
1.2       jruoho    459: typedef const char *                    ACPI_CONST_STRING;    /* Null terminated ASCII string */
1.1       jruoho    460: typedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
                    461:
                    462:
1.5       christos  463: /* Time constants for timer calculations */
                    464:
                    465: #define ACPI_MSEC_PER_SEC               1000L
                    466:
                    467: #define ACPI_USEC_PER_MSEC              1000L
                    468: #define ACPI_USEC_PER_SEC               1000000L
                    469:
                    470: #define ACPI_100NSEC_PER_USEC           10L
                    471: #define ACPI_100NSEC_PER_MSEC           10000L
                    472: #define ACPI_100NSEC_PER_SEC            10000000L
                    473:
                    474: #define ACPI_NSEC_PER_USEC              1000L
                    475: #define ACPI_NSEC_PER_MSEC              1000000L
                    476: #define ACPI_NSEC_PER_SEC               1000000000L
                    477:
                    478:
1.1       jruoho    479: /* Owner IDs are used to track namespace nodes for selective deletion */
                    480:
                    481: typedef UINT8                           ACPI_OWNER_ID;
                    482: #define ACPI_OWNER_ID_MAX               0xFF
                    483:
                    484:
                    485: #define ACPI_INTEGER_BIT_SIZE           64
                    486: #define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
                    487: #define ACPI_MAX64_DECIMAL_DIGITS       20
                    488: #define ACPI_MAX32_DECIMAL_DIGITS       10
                    489: #define ACPI_MAX16_DECIMAL_DIGITS        5
                    490: #define ACPI_MAX8_DECIMAL_DIGITS         3
                    491:
                    492: /*
                    493:  * Constants with special meanings
                    494:  */
                    495: #define ACPI_ROOT_OBJECT                ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
                    496: #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
                    497: #define ACPI_DO_NOT_WAIT                0
                    498:
                    499: /*
                    500:  * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits.
                    501:  * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this
                    502:  * pertains to the ACPI integer type only, not to other integers used in the
                    503:  * implementation of the ACPICA subsystem.
                    504:  *
                    505:  * 01/2010: This type is obsolete and has been removed from the entire ACPICA
                    506:  * code base. It remains here for compatibility with device drivers that use
                    507:  * the type. However, it will be removed in the future.
                    508:  */
                    509: typedef UINT64                          ACPI_INTEGER;
                    510: #define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
                    511:
                    512:
                    513: /*******************************************************************************
                    514:  *
                    515:  * Commonly used macros
                    516:  *
                    517:  ******************************************************************************/
                    518:
                    519: /* Data manipulation */
                    520:
                    521: #define ACPI_LOBYTE(Integer)            ((UINT8)   (UINT16)(Integer))
                    522: #define ACPI_HIBYTE(Integer)            ((UINT8) (((UINT16)(Integer)) >> 8))
                    523: #define ACPI_LOWORD(Integer)            ((UINT16)  (UINT32)(Integer))
                    524: #define ACPI_HIWORD(Integer)            ((UINT16)(((UINT32)(Integer)) >> 16))
                    525: #define ACPI_LODWORD(Integer64)         ((UINT32)  (UINT64)(Integer64))
                    526: #define ACPI_HIDWORD(Integer64)         ((UINT32)(((UINT64)(Integer64)) >> 32))
                    527:
                    528: #define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
                    529: #define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
                    530: #define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
                    531: #define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
                    532:
                    533: /* Size calculation */
                    534:
                    535: #define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
                    536:
                    537: /* Pointer manipulation */
                    538:
                    539: #define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
                    540: #define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
                    541: #define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
1.8       christos  542: #define ACPI_SUB_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b)))
1.1       jruoho    543: #define ACPI_PTR_DIFF(a, b)             (ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b)))
                    544:
                    545: /* Pointer/Integer type conversions */
                    546:
                    547: #define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) NULL,(ACPI_SIZE) i)
                    548: #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) NULL)
1.6       christos  549: #define ACPI_OFFSET(d, f)               ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) NULL)
1.1       jruoho    550: #define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
                    551: #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
                    552:
1.5       christos  553: /* Optimizations for 4-character (32-bit) ACPI_NAME manipulation */
                    554:
1.1       jruoho    555: #ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
                    556: #define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
1.5       christos  557: #define ACPI_MOVE_NAME(dest,src)        (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
1.1       jruoho    558: #else
1.8       christos  559: #define ACPI_COMPARE_NAME(a,b)          (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
                    560: #define ACPI_MOVE_NAME(dest,src)        (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
1.1       jruoho    561: #endif
                    562:
1.5       christos  563: /* Support for the special RSDP signature (8 characters) */
                    564:
1.8       christos  565: #define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
                    566: #define ACPI_MAKE_RSDP_SIG(dest)        (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
1.5       christos  567:
1.1       jruoho    568:
                    569: /*******************************************************************************
                    570:  *
                    571:  * Miscellaneous constants
                    572:  *
                    573:  ******************************************************************************/
                    574:
                    575: /*
                    576:  * Initialization sequence
                    577:  */
                    578: #define ACPI_FULL_INITIALIZATION        0x00
                    579: #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
                    580: #define ACPI_NO_HARDWARE_INIT           0x02
                    581: #define ACPI_NO_EVENT_INIT              0x04
                    582: #define ACPI_NO_HANDLER_INIT            0x08
                    583: #define ACPI_NO_ACPI_ENABLE             0x10
                    584: #define ACPI_NO_DEVICE_INIT             0x20
                    585: #define ACPI_NO_OBJECT_INIT             0x40
1.8       christos  586: #define ACPI_NO_FACS_INIT               0x80
1.1       jruoho    587:
                    588: /*
                    589:  * Initialization state
                    590:  */
                    591: #define ACPI_SUBSYSTEM_INITIALIZE       0x01
                    592: #define ACPI_INITIALIZED_OK             0x02
                    593:
                    594: /*
                    595:  * Power state values
                    596:  */
                    597: #define ACPI_STATE_UNKNOWN              (UINT8) 0xFF
                    598:
                    599: #define ACPI_STATE_S0                   (UINT8) 0
                    600: #define ACPI_STATE_S1                   (UINT8) 1
                    601: #define ACPI_STATE_S2                   (UINT8) 2
                    602: #define ACPI_STATE_S3                   (UINT8) 3
                    603: #define ACPI_STATE_S4                   (UINT8) 4
                    604: #define ACPI_STATE_S5                   (UINT8) 5
                    605: #define ACPI_S_STATES_MAX               ACPI_STATE_S5
                    606: #define ACPI_S_STATE_COUNT              6
                    607:
                    608: #define ACPI_STATE_D0                   (UINT8) 0
                    609: #define ACPI_STATE_D1                   (UINT8) 1
                    610: #define ACPI_STATE_D2                   (UINT8) 2
                    611: #define ACPI_STATE_D3                   (UINT8) 3
                    612: #define ACPI_D_STATES_MAX               ACPI_STATE_D3
                    613: #define ACPI_D_STATE_COUNT              4
                    614:
                    615: #define ACPI_STATE_C0                   (UINT8) 0
                    616: #define ACPI_STATE_C1                   (UINT8) 1
                    617: #define ACPI_STATE_C2                   (UINT8) 2
                    618: #define ACPI_STATE_C3                   (UINT8) 3
                    619: #define ACPI_C_STATES_MAX               ACPI_STATE_C3
                    620: #define ACPI_C_STATE_COUNT              4
                    621:
                    622: /*
                    623:  * Sleep type invalid value
                    624:  */
                    625: #define ACPI_SLEEP_TYPE_MAX             0x7
                    626: #define ACPI_SLEEP_TYPE_INVALID         0xFF
                    627:
                    628: /*
                    629:  * Standard notify values
                    630:  */
                    631: #define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00
                    632: #define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 0x01
                    633: #define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 0x02
                    634: #define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 0x03
                    635: #define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 0x04
                    636: #define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 0x05
                    637: #define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 0x06
                    638: #define ACPI_NOTIFY_POWER_FAULT         (UINT8) 0x07
                    639: #define ACPI_NOTIFY_CAPABILITIES_CHECK  (UINT8) 0x08
                    640: #define ACPI_NOTIFY_DEVICE_PLD_CHECK    (UINT8) 0x09
                    641: #define ACPI_NOTIFY_RESERVED            (UINT8) 0x0A
                    642: #define ACPI_NOTIFY_LOCALITY_UPDATE     (UINT8) 0x0B
1.5       christos  643: #define ACPI_NOTIFY_SHUTDOWN_REQUEST    (UINT8) 0x0C
1.6       christos  644: #define ACPI_NOTIFY_AFFINITY_UPDATE     (UINT8) 0x0D
1.1       jruoho    645:
1.10      christos  646: #define ACPI_GENERIC_NOTIFY_MAX         0x0D
                    647: #define ACPI_SPECIFIC_NOTIFY_MAX        0x84
1.1       jruoho    648:
                    649: /*
                    650:  * Types associated with ACPI names and objects. The first group of
                    651:  * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
                    652:  * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
                    653:  * only add to the first group if the spec changes.
                    654:  *
                    655:  * NOTE: Types must be kept in sync with the global AcpiNsProperties
                    656:  * and AcpiNsTypeNames arrays.
                    657:  */
                    658: typedef UINT32                          ACPI_OBJECT_TYPE;
                    659:
                    660: #define ACPI_TYPE_ANY                   0x00
                    661: #define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
                    662: #define ACPI_TYPE_STRING                0x02
                    663: #define ACPI_TYPE_BUFFER                0x03
                    664: #define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
                    665: #define ACPI_TYPE_FIELD_UNIT            0x05
                    666: #define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
                    667: #define ACPI_TYPE_EVENT                 0x07
                    668: #define ACPI_TYPE_METHOD                0x08  /* Name, ByteConst, multiple Code */
                    669: #define ACPI_TYPE_MUTEX                 0x09
                    670: #define ACPI_TYPE_REGION                0x0A
                    671: #define ACPI_TYPE_POWER                 0x0B  /* Name,ByteConst,WordConst,multi Node */
                    672: #define ACPI_TYPE_PROCESSOR             0x0C  /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
                    673: #define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
                    674: #define ACPI_TYPE_BUFFER_FIELD          0x0E
                    675: #define ACPI_TYPE_DDB_HANDLE            0x0F
                    676: #define ACPI_TYPE_DEBUG_OBJECT          0x10
                    677:
                    678: #define ACPI_TYPE_EXTERNAL_MAX          0x10
1.9       christos  679: #define ACPI_NUM_TYPES                  (ACPI_TYPE_EXTERNAL_MAX + 1)
1.1       jruoho    680:
                    681: /*
                    682:  * These are object types that do not map directly to the ACPI
                    683:  * ObjectType() operator. They are used for various internal purposes only.
                    684:  * If new predefined ACPI_TYPEs are added (via the ACPI specification), these
                    685:  * internal types must move upwards. (There is code that depends on these
                    686:  * values being contiguous with the external types above.)
                    687:  */
                    688: #define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
                    689: #define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
                    690: #define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
                    691: #define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
                    692: #define ACPI_TYPE_LOCAL_ALIAS           0x15
                    693: #define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
                    694: #define ACPI_TYPE_LOCAL_NOTIFY          0x17
                    695: #define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
                    696: #define ACPI_TYPE_LOCAL_RESOURCE        0x19
                    697: #define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
                    698: #define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
                    699:
                    700: #define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
1.9       christos  701: #define ACPI_TOTAL_TYPES                (ACPI_TYPE_NS_NODE_MAX + 1)
1.1       jruoho    702:
                    703: /*
                    704:  * These are special object types that never appear in
1.5       christos  705:  * a Namespace node, only in an object of ACPI_OPERAND_OBJECT
1.1       jruoho    706:  */
                    707: #define ACPI_TYPE_LOCAL_EXTRA           0x1C
                    708: #define ACPI_TYPE_LOCAL_DATA            0x1D
                    709:
                    710: #define ACPI_TYPE_LOCAL_MAX             0x1D
                    711:
                    712: /* All types above here are invalid */
                    713:
                    714: #define ACPI_TYPE_INVALID               0x1E
                    715: #define ACPI_TYPE_NOT_FOUND             0xFF
                    716:
                    717: #define ACPI_NUM_NS_TYPES               (ACPI_TYPE_INVALID + 1)
                    718:
                    719:
                    720: /*
                    721:  * All I/O
                    722:  */
                    723: #define ACPI_READ                       0
                    724: #define ACPI_WRITE                      1
                    725: #define ACPI_IO_MASK                    1
                    726:
                    727: /*
                    728:  * Event Types: Fixed & General Purpose
                    729:  */
                    730: typedef UINT32                          ACPI_EVENT_TYPE;
                    731:
                    732: /*
                    733:  * Fixed events
                    734:  */
                    735: #define ACPI_EVENT_PMTIMER              0
                    736: #define ACPI_EVENT_GLOBAL               1
                    737: #define ACPI_EVENT_POWER_BUTTON         2
                    738: #define ACPI_EVENT_SLEEP_BUTTON         3
                    739: #define ACPI_EVENT_RTC                  4
                    740: #define ACPI_EVENT_MAX                  4
                    741: #define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
                    742:
                    743: /*
                    744:  * Event Status - Per event
                    745:  * -------------
                    746:  * The encoding of ACPI_EVENT_STATUS is illustrated below.
                    747:  * Note that a set bit (1) indicates the property is TRUE
                    748:  * (e.g. if bit 0 is set then the event is enabled).
1.11      christos  749:  * +-------------+-+-+-+-+-+-+
                    750:  * |   Bits 31:6 |5|4|3|2|1|0|
                    751:  * +-------------+-+-+-+-+-+-+
                    752:  *          |     | | | | | |
                    753:  *          |     | | | | | +- Enabled?
                    754:  *          |     | | | | +--- Enabled for wake?
                    755:  *          |     | | | +----- Status bit set?
                    756:  *          |     | | +------- Enable bit set?
                    757:  *          |     | +--------- Has a handler?
                    758:  *          |     +----------- Masked?
                    759:  *          +----------------- <Reserved>
1.1       jruoho    760:  */
                    761: typedef UINT32                          ACPI_EVENT_STATUS;
                    762:
                    763: #define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
                    764: #define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
                    765: #define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
1.7       christos  766: #define ACPI_EVENT_FLAG_STATUS_SET      (ACPI_EVENT_STATUS) 0x04
                    767: #define ACPI_EVENT_FLAG_ENABLE_SET      (ACPI_EVENT_STATUS) 0x08
                    768: #define ACPI_EVENT_FLAG_HAS_HANDLER     (ACPI_EVENT_STATUS) 0x10
1.11      christos  769: #define ACPI_EVENT_FLAG_MASKED          (ACPI_EVENT_STATUS) 0x20
1.7       christos  770: #define ACPI_EVENT_FLAG_SET             ACPI_EVENT_FLAG_STATUS_SET
1.1       jruoho    771:
1.3       jruoho    772: /* Actions for AcpiSetGpe, AcpiGpeWakeup, AcpiHwLowSetGpe */
1.1       jruoho    773:
                    774: #define ACPI_GPE_ENABLE                 0
                    775: #define ACPI_GPE_DISABLE                1
1.3       jruoho    776: #define ACPI_GPE_CONDITIONAL_ENABLE     2
1.1       jruoho    777:
                    778: /*
                    779:  * GPE info flags - Per GPE
1.11      christos  780:  * +---+-+-+-+---+
                    781:  * |7:6|5|4|3|2:0|
                    782:  * +---+-+-+-+---+
                    783:  *   |  | | |  |
                    784:  *   |  | | |  +-- Type of dispatch:to method, handler, notify, or none
                    785:  *   |  | | +----- Interrupt type: edge or level triggered
                    786:  *   |  | +------- Is a Wake GPE
                    787:  *   |  +--------- Is GPE masked by the software GPE masking machanism
                    788:  *   +------------ <Reserved>
1.3       jruoho    789:  */
                    790: #define ACPI_GPE_DISPATCH_NONE          (UINT8) 0x00
                    791: #define ACPI_GPE_DISPATCH_METHOD        (UINT8) 0x01
                    792: #define ACPI_GPE_DISPATCH_HANDLER       (UINT8) 0x02
                    793: #define ACPI_GPE_DISPATCH_NOTIFY        (UINT8) 0x03
1.7       christos  794: #define ACPI_GPE_DISPATCH_RAW_HANDLER   (UINT8) 0x04
                    795: #define ACPI_GPE_DISPATCH_MASK          (UINT8) 0x07
                    796: #define ACPI_GPE_DISPATCH_TYPE(flags)   ((UINT8) ((flags) & ACPI_GPE_DISPATCH_MASK))
1.3       jruoho    797:
1.7       christos  798: #define ACPI_GPE_LEVEL_TRIGGERED        (UINT8) 0x08
1.1       jruoho    799: #define ACPI_GPE_EDGE_TRIGGERED         (UINT8) 0x00
1.7       christos  800: #define ACPI_GPE_XRUPT_TYPE_MASK        (UINT8) 0x08
1.1       jruoho    801:
1.7       christos  802: #define ACPI_GPE_CAN_WAKE               (UINT8) 0x10
1.1       jruoho    803:
                    804: /*
                    805:  * Flags for GPE and Lock interfaces
                    806:  */
                    807: #define ACPI_NOT_ISR                    0x1
                    808: #define ACPI_ISR                        0x0
                    809:
                    810:
                    811: /* Notify types */
                    812:
                    813: #define ACPI_SYSTEM_NOTIFY              0x1
                    814: #define ACPI_DEVICE_NOTIFY              0x2
                    815: #define ACPI_ALL_NOTIFY                 (ACPI_SYSTEM_NOTIFY | ACPI_DEVICE_NOTIFY)
                    816: #define ACPI_MAX_NOTIFY_HANDLER_TYPE    0x3
1.5       christos  817: #define ACPI_NUM_NOTIFY_TYPES           2
                    818:
                    819: #define ACPI_MAX_SYS_NOTIFY             0x7F
                    820: #define ACPI_MAX_DEVICE_SPECIFIC_NOTIFY 0xBF
1.1       jruoho    821:
1.5       christos  822: #define ACPI_SYSTEM_HANDLER_LIST        0 /* Used as index, must be SYSTEM_NOTIFY -1 */
                    823: #define ACPI_DEVICE_HANDLER_LIST        1 /* Used as index, must be DEVICE_NOTIFY -1 */
1.1       jruoho    824:
                    825:
                    826: /* Address Space (Operation Region) Types */
                    827:
                    828: typedef UINT8                           ACPI_ADR_SPACE_TYPE;
                    829:
                    830: #define ACPI_ADR_SPACE_SYSTEM_MEMORY    (ACPI_ADR_SPACE_TYPE) 0
                    831: #define ACPI_ADR_SPACE_SYSTEM_IO        (ACPI_ADR_SPACE_TYPE) 1
                    832: #define ACPI_ADR_SPACE_PCI_CONFIG       (ACPI_ADR_SPACE_TYPE) 2
                    833: #define ACPI_ADR_SPACE_EC               (ACPI_ADR_SPACE_TYPE) 3
                    834: #define ACPI_ADR_SPACE_SMBUS            (ACPI_ADR_SPACE_TYPE) 4
                    835: #define ACPI_ADR_SPACE_CMOS             (ACPI_ADR_SPACE_TYPE) 5
                    836: #define ACPI_ADR_SPACE_PCI_BAR_TARGET   (ACPI_ADR_SPACE_TYPE) 6
                    837: #define ACPI_ADR_SPACE_IPMI             (ACPI_ADR_SPACE_TYPE) 7
1.5       christos  838: #define ACPI_ADR_SPACE_GPIO             (ACPI_ADR_SPACE_TYPE) 8
                    839: #define ACPI_ADR_SPACE_GSBUS            (ACPI_ADR_SPACE_TYPE) 9
                    840: #define ACPI_ADR_SPACE_PLATFORM_COMM    (ACPI_ADR_SPACE_TYPE) 10
1.1       jruoho    841:
1.5       christos  842: #define ACPI_NUM_PREDEFINED_REGIONS     11
1.4       jruoho    843:
                    844: /*
                    845:  * Special Address Spaces
                    846:  *
                    847:  * Note: A Data Table region is a special type of operation region
                    848:  * that has its own AML opcode. However, internally, the AML
                    849:  * interpreter simply creates an operation region with an an address
                    850:  * space type of ACPI_ADR_SPACE_DATA_TABLE.
                    851:  */
                    852: #define ACPI_ADR_SPACE_DATA_TABLE       (ACPI_ADR_SPACE_TYPE) 0x7E /* Internal to ACPICA only */
                    853: #define ACPI_ADR_SPACE_FIXED_HARDWARE   (ACPI_ADR_SPACE_TYPE) 0x7F
                    854:
                    855: /* Values for _REG connection code */
                    856:
                    857: #define ACPI_REG_DISCONNECT             0
                    858: #define ACPI_REG_CONNECT                1
1.1       jruoho    859:
                    860: /*
                    861:  * BitRegister IDs
                    862:  *
                    863:  * These values are intended to be used by the hardware interfaces
                    864:  * and are mapped to individual bitfields defined within the ACPI
                    865:  * registers. See the AcpiGbl_BitRegisterInfo global table in utglobal.c
                    866:  * for this mapping.
                    867:  */
                    868:
                    869: /* PM1 Status register */
                    870:
                    871: #define ACPI_BITREG_TIMER_STATUS                0x00
                    872: #define ACPI_BITREG_BUS_MASTER_STATUS           0x01
                    873: #define ACPI_BITREG_GLOBAL_LOCK_STATUS          0x02
                    874: #define ACPI_BITREG_POWER_BUTTON_STATUS         0x03
                    875: #define ACPI_BITREG_SLEEP_BUTTON_STATUS         0x04
                    876: #define ACPI_BITREG_RT_CLOCK_STATUS             0x05
                    877: #define ACPI_BITREG_WAKE_STATUS                 0x06
                    878: #define ACPI_BITREG_PCIEXP_WAKE_STATUS          0x07
                    879:
                    880: /* PM1 Enable register */
                    881:
                    882: #define ACPI_BITREG_TIMER_ENABLE                0x08
                    883: #define ACPI_BITREG_GLOBAL_LOCK_ENABLE          0x09
                    884: #define ACPI_BITREG_POWER_BUTTON_ENABLE         0x0A
                    885: #define ACPI_BITREG_SLEEP_BUTTON_ENABLE         0x0B
                    886: #define ACPI_BITREG_RT_CLOCK_ENABLE             0x0C
                    887: #define ACPI_BITREG_PCIEXP_WAKE_DISABLE         0x0D
                    888:
                    889: /* PM1 Control register */
                    890:
                    891: #define ACPI_BITREG_SCI_ENABLE                  0x0E
                    892: #define ACPI_BITREG_BUS_MASTER_RLD              0x0F
                    893: #define ACPI_BITREG_GLOBAL_LOCK_RELEASE         0x10
                    894: #define ACPI_BITREG_SLEEP_TYPE                  0x11
                    895: #define ACPI_BITREG_SLEEP_ENABLE                0x12
                    896:
                    897: /* PM2 Control register */
                    898:
                    899: #define ACPI_BITREG_ARB_DISABLE                 0x13
                    900:
                    901: #define ACPI_BITREG_MAX                         0x13
                    902: #define ACPI_NUM_BITREG                         ACPI_BITREG_MAX + 1
                    903:
                    904:
                    905: /* Status register values. A 1 clears a status bit. 0 = no effect */
                    906:
                    907: #define ACPI_CLEAR_STATUS                       1
                    908:
                    909: /* Enable and Control register values */
                    910:
                    911: #define ACPI_ENABLE_EVENT                       1
                    912: #define ACPI_DISABLE_EVENT                      0
                    913:
                    914:
1.5       christos  915: /* Sleep function dispatch */
                    916:
                    917: typedef ACPI_STATUS (*ACPI_SLEEP_FUNCTION) (
                    918:     UINT8                   SleepState);
                    919:
                    920: typedef struct acpi_sleep_functions
                    921: {
                    922:     ACPI_SLEEP_FUNCTION     LegacyFunction;
                    923:     ACPI_SLEEP_FUNCTION     ExtendedFunction;
                    924:
                    925: } ACPI_SLEEP_FUNCTIONS;
                    926:
                    927:
1.1       jruoho    928: /*
                    929:  * External ACPI object definition
                    930:  */
                    931:
                    932: /*
                    933:  * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element
                    934:  * or an unresolved named reference.
                    935:  */
                    936: typedef union acpi_object
                    937: {
                    938:     ACPI_OBJECT_TYPE                Type;   /* See definition of AcpiNsType for values */
                    939:     struct
                    940:     {
                    941:         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_INTEGER */
                    942:         UINT64                          Value;      /* The actual number */
                    943:     } Integer;
                    944:
                    945:     struct
                    946:     {
                    947:         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_STRING */
                    948:         UINT32                          Length;     /* # of bytes in string, excluding trailing null */
                    949:         char                            *Pointer;   /* points to the string value */
                    950:     } String;
                    951:
                    952:     struct
                    953:     {
                    954:         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_BUFFER */
                    955:         UINT32                          Length;     /* # of bytes in buffer */
                    956:         UINT8                           *Pointer;   /* points to the buffer */
                    957:     } Buffer;
                    958:
                    959:     struct
                    960:     {
                    961:         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PACKAGE */
                    962:         UINT32                          Count;      /* # of elements in package */
                    963:         union acpi_object               *Elements;  /* Pointer to an array of ACPI_OBJECTs */
                    964:     } Package;
                    965:
                    966:     struct
                    967:     {
                    968:         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_LOCAL_REFERENCE */
                    969:         ACPI_OBJECT_TYPE                ActualType; /* Type associated with the Handle */
                    970:         ACPI_HANDLE                     Handle;     /* object reference */
                    971:     } Reference;
                    972:
                    973:     struct
                    974:     {
                    975:         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_PROCESSOR */
                    976:         UINT32                          ProcId;
                    977:         ACPI_IO_ADDRESS                 PblkAddress;
                    978:         UINT32                          PblkLength;
                    979:     } Processor;
                    980:
                    981:     struct
                    982:     {
                    983:         ACPI_OBJECT_TYPE                Type;       /* ACPI_TYPE_POWER */
                    984:         UINT32                          SystemLevel;
                    985:         UINT32                          ResourceOrder;
                    986:     } PowerResource;
                    987:
                    988: } ACPI_OBJECT;
                    989:
                    990:
                    991: /*
                    992:  * List of objects, used as a parameter list for control method evaluation
                    993:  */
                    994: typedef struct acpi_object_list
                    995: {
                    996:     UINT32                          Count;
                    997:     ACPI_OBJECT                     *Pointer;
                    998:
                    999: } ACPI_OBJECT_LIST;
                   1000:
                   1001:
                   1002: /*
                   1003:  * Miscellaneous common Data Structures used by the interfaces
                   1004:  */
                   1005: #define ACPI_NO_BUFFER              0
1.6       christos 1006:
                   1007: #ifdef ACPI_NO_MEM_ALLOCATIONS
                   1008:
                   1009: #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (0)
                   1010: #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (0)
                   1011:
                   1012: #else /* ACPI_NO_MEM_ALLOCATIONS */
                   1013:
1.5       christos 1014: #define ACPI_ALLOCATE_BUFFER        (ACPI_SIZE) (-1)    /* Let ACPICA allocate buffer */
                   1015: #define ACPI_ALLOCATE_LOCAL_BUFFER  (ACPI_SIZE) (-2)    /* For internal use only (enables tracking) */
1.1       jruoho   1016:
1.6       christos 1017: #endif /* ACPI_NO_MEM_ALLOCATIONS */
                   1018:
1.1       jruoho   1019: typedef struct acpi_buffer
                   1020: {
                   1021:     ACPI_SIZE                       Length;         /* Length in bytes of the buffer */
                   1022:     void                            *Pointer;       /* pointer to buffer */
                   1023:
                   1024: } ACPI_BUFFER;
                   1025:
                   1026:
                   1027: /*
                   1028:  * NameType for AcpiGetName
                   1029:  */
                   1030: #define ACPI_FULL_PATHNAME              0
                   1031: #define ACPI_SINGLE_NAME                1
1.8       christos 1032: #define ACPI_FULL_PATHNAME_NO_TRAILING  2
                   1033: #define ACPI_NAME_TYPE_MAX              2
1.1       jruoho   1034:
                   1035:
                   1036: /*
                   1037:  * Predefined Namespace items
                   1038:  */
                   1039: typedef struct acpi_predefined_names
                   1040: {
1.2       jruoho   1041:     const char                      *Name;
1.1       jruoho   1042:     UINT8                           Type;
1.2       jruoho   1043:     const char                      *Val;
1.1       jruoho   1044:
                   1045: } ACPI_PREDEFINED_NAMES;
                   1046:
                   1047:
                   1048: /*
                   1049:  * Structure and flags for AcpiGetSystemInfo
                   1050:  */
                   1051: #define ACPI_SYS_MODE_UNKNOWN           0x0000
                   1052: #define ACPI_SYS_MODE_ACPI              0x0001
                   1053: #define ACPI_SYS_MODE_LEGACY            0x0002
                   1054: #define ACPI_SYS_MODES_MASK             0x0003
                   1055:
                   1056:
                   1057: /*
                   1058:  * System info returned by AcpiGetSystemInfo()
                   1059:  */
                   1060: typedef struct acpi_system_info
                   1061: {
                   1062:     UINT32                          AcpiCaVersion;
                   1063:     UINT32                          Flags;
                   1064:     UINT32                          TimerResolution;
                   1065:     UINT32                          Reserved1;
                   1066:     UINT32                          Reserved2;
                   1067:     UINT32                          DebugLevel;
                   1068:     UINT32                          DebugLayer;
                   1069:
                   1070: } ACPI_SYSTEM_INFO;
                   1071:
                   1072:
                   1073: /*
                   1074:  * System statistics returned by AcpiGetStatistics()
                   1075:  */
                   1076: typedef struct acpi_statistics
                   1077: {
                   1078:     UINT32                          SciCount;
                   1079:     UINT32                          GpeCount;
                   1080:     UINT32                          FixedEventCount[ACPI_NUM_FIXED_EVENTS];
                   1081:     UINT32                          MethodCount;
                   1082:
                   1083: } ACPI_STATISTICS;
                   1084:
                   1085:
                   1086: /*
                   1087:  * Types specific to the OS service interfaces
                   1088:  */
                   1089: typedef UINT32
                   1090: (ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
                   1091:     void                            *Context);
                   1092:
                   1093: typedef void
                   1094: (ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
                   1095:     void                            *Context);
                   1096:
                   1097: /*
                   1098:  * Various handlers and callback procedures
                   1099:  */
                   1100: typedef
1.5       christos 1101: UINT32 (*ACPI_SCI_HANDLER) (
                   1102:     void                            *Context);
                   1103:
                   1104: typedef
1.3       jruoho   1105: void (*ACPI_GBL_EVENT_HANDLER) (
                   1106:     UINT32                          EventType,
                   1107:     ACPI_HANDLE                     Device,
                   1108:     UINT32                          EventNumber,
                   1109:     void                            *Context);
                   1110:
                   1111: #define ACPI_EVENT_TYPE_GPE         0
                   1112: #define ACPI_EVENT_TYPE_FIXED       1
                   1113:
                   1114: typedef
1.1       jruoho   1115: UINT32 (*ACPI_EVENT_HANDLER) (
                   1116:     void                            *Context);
                   1117:
                   1118: typedef
1.3       jruoho   1119: UINT32 (*ACPI_GPE_HANDLER) (
                   1120:     ACPI_HANDLE                     GpeDevice,
                   1121:     UINT32                          GpeNumber,
                   1122:     void                            *Context);
                   1123:
                   1124: typedef
1.1       jruoho   1125: void (*ACPI_NOTIFY_HANDLER) (
                   1126:     ACPI_HANDLE                     Device,
                   1127:     UINT32                          Value,
                   1128:     void                            *Context);
                   1129:
                   1130: typedef
                   1131: void (*ACPI_OBJECT_HANDLER) (
                   1132:     ACPI_HANDLE                     Object,
                   1133:     void                            *Data);
                   1134:
                   1135: typedef
                   1136: ACPI_STATUS (*ACPI_INIT_HANDLER) (
                   1137:     ACPI_HANDLE                     Object,
                   1138:     UINT32                          Function);
                   1139:
                   1140: #define ACPI_INIT_DEVICE_INI        1
                   1141:
                   1142: typedef
                   1143: ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) (
                   1144:     ACPI_STATUS                     AmlStatus,
                   1145:     ACPI_NAME                       Name,
                   1146:     UINT16                          Opcode,
                   1147:     UINT32                          AmlOffset,
                   1148:     void                            *Context);
                   1149:
                   1150: /* Table Event handler (Load, LoadTable, etc.) and types */
                   1151:
                   1152: typedef
                   1153: ACPI_STATUS (*ACPI_TABLE_HANDLER) (
                   1154:     UINT32                          Event,
                   1155:     void                            *Table,
                   1156:     void                            *Context);
                   1157:
1.11      christos 1158:
                   1159: /* Table Event Types */
                   1160:
                   1161: #define ACPI_TABLE_EVENT_LOAD           0x0
                   1162: #define ACPI_TABLE_EVENT_UNLOAD         0x1
                   1163: #define ACPI_TABLE_EVENT_INSTALL        0x2
                   1164: #define ACPI_TABLE_EVENT_UNINSTALL      0x3
                   1165: #define ACPI_NUM_TABLE_EVENTS           4
1.1       jruoho   1166:
                   1167:
                   1168: /* Address Spaces (For Operation Regions) */
                   1169:
                   1170: typedef
                   1171: ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
                   1172:     UINT32                          Function,
                   1173:     ACPI_PHYSICAL_ADDRESS           Address,
                   1174:     UINT32                          BitWidth,
                   1175:     UINT64                          *Value,
                   1176:     void                            *HandlerContext,
                   1177:     void                            *RegionContext);
                   1178:
                   1179: #define ACPI_DEFAULT_HANDLER            NULL
                   1180:
1.5       christos 1181: /* Special Context data for GenericSerialBus/GeneralPurposeIo (ACPI 5.0) */
                   1182:
                   1183: typedef struct acpi_connection_info
                   1184: {
                   1185:     UINT8                           *Connection;
                   1186:     UINT16                          Length;
                   1187:     UINT8                           AccessLength;
                   1188:
                   1189: } ACPI_CONNECTION_INFO;
                   1190:
                   1191:
1.1       jruoho   1192: typedef
                   1193: ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
                   1194:     ACPI_HANDLE                     RegionHandle,
                   1195:     UINT32                          Function,
                   1196:     void                            *HandlerContext,
                   1197:     void                            **RegionContext);
                   1198:
                   1199: #define ACPI_REGION_ACTIVATE    0
                   1200: #define ACPI_REGION_DEACTIVATE  1
                   1201:
                   1202: typedef
                   1203: ACPI_STATUS (*ACPI_WALK_CALLBACK) (
                   1204:     ACPI_HANDLE                     Object,
                   1205:     UINT32                          NestingLevel,
                   1206:     void                            *Context,
                   1207:     void                            **ReturnValue);
                   1208:
1.3       jruoho   1209: typedef
                   1210: UINT32 (*ACPI_INTERFACE_HANDLER) (
                   1211:     ACPI_STRING                     InterfaceName,
                   1212:     UINT32                          Supported);
                   1213:
1.1       jruoho   1214:
                   1215: /* Interrupt handler return values */
                   1216:
                   1217: #define ACPI_INTERRUPT_NOT_HANDLED      0x00
                   1218: #define ACPI_INTERRUPT_HANDLED          0x01
                   1219:
1.3       jruoho   1220: /* GPE handler return values */
                   1221:
                   1222: #define ACPI_REENABLE_GPE               0x80
                   1223:
                   1224:
1.1       jruoho   1225: /* Length of 32-bit EISAID values when converted back to a string */
                   1226:
                   1227: #define ACPI_EISAID_STRING_SIZE         8   /* Includes null terminator */
                   1228:
                   1229: /* Length of UUID (string) values */
                   1230:
                   1231: #define ACPI_UUID_LENGTH                16
                   1232:
1.8       christos 1233: /* Length of 3-byte PCI class code values when converted back to a string */
                   1234:
                   1235: #define ACPI_PCICLS_STRING_SIZE         7   /* Includes null terminator */
                   1236:
1.1       jruoho   1237:
1.9       christos 1238: /* Structures used for device/processor HID, UID, CID */
1.1       jruoho   1239:
1.5       christos 1240: typedef struct acpi_pnp_device_id
1.1       jruoho   1241: {
                   1242:     UINT32                          Length;             /* Length of string + null */
                   1243:     char                            *String;
                   1244:
1.5       christos 1245: } ACPI_PNP_DEVICE_ID;
1.1       jruoho   1246:
1.5       christos 1247: typedef struct acpi_pnp_device_id_list
1.1       jruoho   1248: {
                   1249:     UINT32                          Count;              /* Number of IDs in Ids array */
                   1250:     UINT32                          ListSize;           /* Size of list, including ID strings */
1.5       christos 1251:     ACPI_PNP_DEVICE_ID              Ids[1];             /* ID array */
1.1       jruoho   1252:
1.5       christos 1253: } ACPI_PNP_DEVICE_ID_LIST;
1.1       jruoho   1254:
                   1255: /*
                   1256:  * Structure returned from AcpiGetObjectInfo.
                   1257:  * Optimized for both 32- and 64-bit builds
                   1258:  */
                   1259: typedef struct acpi_device_info
                   1260: {
                   1261:     UINT32                          InfoSize;           /* Size of info, including ID strings */
                   1262:     UINT32                          Name;               /* ACPI object Name */
                   1263:     ACPI_OBJECT_TYPE                Type;               /* ACPI object Type */
                   1264:     UINT8                           ParamCount;         /* If a method, required parameter count */
1.8       christos 1265:     UINT16                          Valid;              /* Indicates which optional fields are valid */
1.1       jruoho   1266:     UINT8                           Flags;              /* Miscellaneous info */
                   1267:     UINT8                           HighestDstates[4];  /* _SxD values: 0xFF indicates not valid */
                   1268:     UINT8                           LowestDstates[5];   /* _SxW values: 0xFF indicates not valid */
                   1269:     UINT32                          CurrentStatus;      /* _STA value */
                   1270:     UINT64                          Address;            /* _ADR value */
1.5       christos 1271:     ACPI_PNP_DEVICE_ID              HardwareId;         /* _HID value */
                   1272:     ACPI_PNP_DEVICE_ID              UniqueId;           /* _UID value */
1.8       christos 1273:     ACPI_PNP_DEVICE_ID              ClassCode;          /* _CLS value */
1.5       christos 1274:     ACPI_PNP_DEVICE_ID_LIST         CompatibleIdList;   /* _CID list <must be last> */
1.1       jruoho   1275:
                   1276: } ACPI_DEVICE_INFO;
                   1277:
                   1278: /* Values for Flags field above (AcpiGetObjectInfo) */
                   1279:
                   1280: #define ACPI_PCI_ROOT_BRIDGE            0x01
                   1281:
                   1282: /* Flags for Valid field above (AcpiGetObjectInfo) */
                   1283:
1.8       christos 1284: #define ACPI_VALID_STA                  0x0001
                   1285: #define ACPI_VALID_ADR                  0x0002
                   1286: #define ACPI_VALID_HID                  0x0004
                   1287: #define ACPI_VALID_UID                  0x0008
                   1288: #define ACPI_VALID_CID                  0x0020
                   1289: #define ACPI_VALID_CLS                  0x0040
                   1290: #define ACPI_VALID_SXDS                 0x0100
                   1291: #define ACPI_VALID_SXWS                 0x0200
1.1       jruoho   1292:
1.9       christos 1293: /* Flags for _STA method */
1.1       jruoho   1294:
                   1295: #define ACPI_STA_DEVICE_PRESENT         0x01
                   1296: #define ACPI_STA_DEVICE_ENABLED         0x02
                   1297: #define ACPI_STA_DEVICE_UI              0x04
                   1298: #define ACPI_STA_DEVICE_FUNCTIONING     0x08
                   1299: #define ACPI_STA_DEVICE_OK              0x08 /* Synonym */
                   1300: #define ACPI_STA_BATTERY_PRESENT        0x10
                   1301:
                   1302:
                   1303: /* Context structs for address space handlers */
                   1304:
                   1305: typedef struct acpi_pci_id
                   1306: {
                   1307:     UINT16                          Segment;
                   1308:     UINT16                          Bus;
                   1309:     UINT16                          Device;
                   1310:     UINT16                          Function;
                   1311:
                   1312: } ACPI_PCI_ID;
                   1313:
                   1314: typedef struct acpi_mem_space_context
                   1315: {
                   1316:     UINT32                          Length;
                   1317:     ACPI_PHYSICAL_ADDRESS           Address;
                   1318:     ACPI_PHYSICAL_ADDRESS           MappedPhysicalAddress;
                   1319:     UINT8                           *MappedLogicalAddress;
                   1320:     ACPI_SIZE                       MappedLength;
                   1321:
                   1322: } ACPI_MEM_SPACE_CONTEXT;
                   1323:
                   1324:
                   1325: /*
                   1326:  * ACPI_MEMORY_LIST is used only if the ACPICA local cache is enabled
                   1327:  */
                   1328: typedef struct acpi_memory_list
                   1329: {
1.10      christos 1330:     const char                      *ListName;
1.1       jruoho   1331:     void                            *ListHead;
                   1332:     UINT16                          ObjectSize;
                   1333:     UINT16                          MaxDepth;
                   1334:     UINT16                          CurrentDepth;
                   1335:
                   1336: #ifdef ACPI_DBG_TRACK_ALLOCATIONS
                   1337:
                   1338:     /* Statistics for debug memory tracking only */
                   1339:
                   1340:     UINT32                          TotalAllocated;
                   1341:     UINT32                          TotalFreed;
                   1342:     UINT32                          MaxOccupied;
                   1343:     UINT32                          TotalSize;
                   1344:     UINT32                          CurrentTotalSize;
                   1345:     UINT32                          Requests;
                   1346:     UINT32                          Hits;
                   1347: #endif
                   1348:
                   1349: } ACPI_MEMORY_LIST;
                   1350:
                   1351:
1.8       christos 1352: /* Definitions of trace event types */
                   1353:
                   1354: typedef enum
                   1355: {
                   1356:     ACPI_TRACE_AML_METHOD,
                   1357:     ACPI_TRACE_AML_OPCODE,
                   1358:     ACPI_TRACE_AML_REGION
                   1359:
                   1360: } ACPI_TRACE_EVENT_TYPE;
                   1361:
                   1362:
1.5       christos 1363: /* Definitions of _OSI support */
                   1364:
                   1365: #define ACPI_VENDOR_STRINGS                 0x01
                   1366: #define ACPI_FEATURE_STRINGS                0x02
                   1367: #define ACPI_ENABLE_INTERFACES              0x00
                   1368: #define ACPI_DISABLE_INTERFACES             0x04
                   1369:
                   1370: #define ACPI_DISABLE_ALL_VENDOR_STRINGS     (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS)
                   1371: #define ACPI_DISABLE_ALL_FEATURE_STRINGS    (ACPI_DISABLE_INTERFACES | ACPI_FEATURE_STRINGS)
                   1372: #define ACPI_DISABLE_ALL_STRINGS            (ACPI_DISABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
                   1373: #define ACPI_ENABLE_ALL_VENDOR_STRINGS      (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS)
                   1374: #define ACPI_ENABLE_ALL_FEATURE_STRINGS     (ACPI_ENABLE_INTERFACES | ACPI_FEATURE_STRINGS)
                   1375: #define ACPI_ENABLE_ALL_STRINGS             (ACPI_ENABLE_INTERFACES | ACPI_VENDOR_STRINGS | ACPI_FEATURE_STRINGS)
                   1376:
                   1377: #define ACPI_OSI_WIN_2000               0x01
                   1378: #define ACPI_OSI_WIN_XP                 0x02
                   1379: #define ACPI_OSI_WIN_XP_SP1             0x03
                   1380: #define ACPI_OSI_WINSRV_2003            0x04
                   1381: #define ACPI_OSI_WIN_XP_SP2             0x05
                   1382: #define ACPI_OSI_WINSRV_2003_SP1        0x06
                   1383: #define ACPI_OSI_WIN_VISTA              0x07
                   1384: #define ACPI_OSI_WINSRV_2008            0x08
                   1385: #define ACPI_OSI_WIN_VISTA_SP1          0x09
                   1386: #define ACPI_OSI_WIN_VISTA_SP2          0x0A
                   1387: #define ACPI_OSI_WIN_7                  0x0B
                   1388: #define ACPI_OSI_WIN_8                  0x0C
1.7       christos 1389: #define ACPI_OSI_WIN_10                 0x0D
1.5       christos 1390:
                   1391:
1.6       christos 1392: /* Definitions of getopt */
                   1393:
                   1394: #define ACPI_OPT_END                    -1
                   1395:
                   1396:
1.1       jruoho   1397: #endif /* __ACTYPES_H__ */

CVSweb <webmaster@jp.NetBSD.org>