17c478bdstevel@tonic-gate/******************************************************************************
27c478bdstevel@tonic-gate *
37c478bdstevel@tonic-gate * Name: actypes.h - Common data types for the entire ACPI subsystem
47c478bdstevel@tonic-gate *
57c478bdstevel@tonic-gate *****************************************************************************/
67c478bdstevel@tonic-gate
735786f6Robert Mustacchi/******************************************************************************
835786f6Robert Mustacchi *
935786f6Robert Mustacchi * 1. Copyright Notice
1035786f6Robert Mustacchi *
1135786f6Robert Mustacchi * Some or all of this work - Copyright (c) 1999 - 2018, Intel Corp.
127c478bdstevel@tonic-gate * All rights reserved.
137c478bdstevel@tonic-gate *
1435786f6Robert Mustacchi * 2. License
1535786f6Robert Mustacchi *
1635786f6Robert Mustacchi * 2.1. This is your license from Intel Corp. under its intellectual property
1735786f6Robert Mustacchi * rights. You may have additional license terms from the party that provided
1835786f6Robert Mustacchi * you this software, covering your right to use that party's intellectual
1935786f6Robert Mustacchi * property rights.
2035786f6Robert Mustacchi *
2135786f6Robert Mustacchi * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2235786f6Robert Mustacchi * copy of the source code appearing in this file ("Covered Code") an
2335786f6Robert Mustacchi * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2435786f6Robert Mustacchi * base code distributed originally by Intel ("Original Intel Code") to copy,
2535786f6Robert Mustacchi * make derivatives, distribute, use and display any portion of the Covered
2635786f6Robert Mustacchi * Code in any form, with the right to sublicense such rights; and
2735786f6Robert Mustacchi *
2835786f6Robert Mustacchi * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
2935786f6Robert Mustacchi * license (with the right to sublicense), under only those claims of Intel
3035786f6Robert Mustacchi * patents that are infringed by the Original Intel Code, to make, use, sell,
3135786f6Robert Mustacchi * offer to sell, and import the Covered Code and derivative works thereof
3235786f6Robert Mustacchi * solely to the minimum extent necessary to exercise the above copyright
3335786f6Robert Mustacchi * license, and in no event shall the patent license extend to any additions
3435786f6Robert Mustacchi * to or modifications of the Original Intel Code. No other license or right
3535786f6Robert Mustacchi * is granted directly or by implication, estoppel or otherwise;
3635786f6Robert Mustacchi *
3735786f6Robert Mustacchi * The above copyright and patent license is granted only if the following
3835786f6Robert Mustacchi * conditions are met:
3935786f6Robert Mustacchi *
4035786f6Robert Mustacchi * 3. Conditions
4135786f6Robert Mustacchi *
4235786f6Robert Mustacchi * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4335786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
4435786f6Robert Mustacchi * Code or modification with rights to further distribute source must include
4535786f6Robert Mustacchi * the above Copyright Notice, the above License, this list of Conditions,
4635786f6Robert Mustacchi * and the following Disclaimer and Export Compliance provision. In addition,
4735786f6Robert Mustacchi * Licensee must cause all Covered Code to which Licensee contributes to
4835786f6Robert Mustacchi * contain a file documenting the changes Licensee made to create that Covered
4935786f6Robert Mustacchi * Code and the date of any change. Licensee must include in that file the
5035786f6Robert Mustacchi * documentation of any changes made by any predecessor Licensee. Licensee
5135786f6Robert Mustacchi * must include a prominent statement that the modification is derived,
5235786f6Robert Mustacchi * directly or indirectly, from Original Intel Code.
5335786f6Robert Mustacchi *
5435786f6Robert Mustacchi * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5535786f6Robert Mustacchi * Redistribution of source code of any substantial portion of the Covered
5635786f6Robert Mustacchi * Code or modification without rights to further distribute source must
5735786f6Robert Mustacchi * include the following Disclaimer and Export Compliance provision in the
5835786f6Robert Mustacchi * documentation and/or other materials provided with distribution. In
5935786f6Robert Mustacchi * addition, Licensee may not authorize further sublicense of source of any
6035786f6Robert Mustacchi * portion of the Covered Code, and must include terms to the effect that the
6135786f6Robert Mustacchi * license from Licensee to its licensee is limited to the intellectual
6235786f6Robert Mustacchi * property embodied in the software Licensee provides to its licensee, and
6335786f6Robert Mustacchi * not to intellectual property embodied in modifications its licensee may
6435786f6Robert Mustacchi * make.
6535786f6Robert Mustacchi *
6635786f6Robert Mustacchi * 3.3. Redistribution of Executable. Redistribution in executable form of any
6735786f6Robert Mustacchi * substantial portion of the Covered Code or modification must reproduce the
6835786f6Robert Mustacchi * above Copyright Notice, and the following Disclaimer and Export Compliance
6935786f6Robert Mustacchi * provision in the documentation and/or other materials provided with the
7035786f6Robert Mustacchi * distribution.
7135786f6Robert Mustacchi *
7235786f6Robert Mustacchi * 3.4. Intel retains all right, title, and interest in and to the Original
7335786f6Robert Mustacchi * Intel Code.
7435786f6Robert Mustacchi *
7535786f6Robert Mustacchi * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7635786f6Robert Mustacchi * Intel shall be used in advertising or otherwise to promote the sale, use or
7735786f6Robert Mustacchi * other dealings in products derived from or relating to the Covered Code
7835786f6Robert Mustacchi * without prior written authorization from Intel.
7935786f6Robert Mustacchi *
8035786f6Robert Mustacchi * 4. Disclaimer and Export Compliance
8135786f6Robert Mustacchi *
8235786f6Robert Mustacchi * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8335786f6Robert Mustacchi * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8435786f6Robert Mustacchi * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
8535786f6Robert Mustacchi * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
8635786f6Robert Mustacchi * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
8735786f6Robert Mustacchi * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8835786f6Robert Mustacchi * PARTICULAR PURPOSE.
8935786f6Robert Mustacchi *
9035786f6Robert Mustacchi * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9135786f6Robert Mustacchi * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9235786f6Robert Mustacchi * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9335786f6Robert Mustacchi * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9435786f6Robert Mustacchi * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9535786f6Robert Mustacchi * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
9635786f6Robert Mustacchi * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9735786f6Robert Mustacchi * LIMITED REMEDY.
9835786f6Robert Mustacchi *
9935786f6Robert Mustacchi * 4.3. Licensee shall not export, either directly or indirectly, any of this
10035786f6Robert Mustacchi * software or system incorporating such software without first obtaining any
10135786f6Robert Mustacchi * required license or other approval from the U. S. Department of Commerce or
10235786f6Robert Mustacchi * any other agency or department of the United States Government. In the
10335786f6Robert Mustacchi * event Licensee exports any such software from the United States or
10435786f6Robert Mustacchi * re-exports any such software from a foreign destination, Licensee shall
10535786f6Robert Mustacchi * ensure that the distribution and export/re-export of the software is in
10635786f6Robert Mustacchi * compliance with all laws, regulations, orders, or other restrictions of the
10735786f6Robert Mustacchi * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10835786f6Robert Mustacchi * any of its subsidiaries will export/re-export any technical data, process,
10935786f6Robert Mustacchi * software, or service, directly or indirectly, to any country for which the
11035786f6Robert Mustacchi * United States government or any agency thereof requires an export license,
11135786f6Robert Mustacchi * other governmental approval, or letter of assurance, without first obtaining
11235786f6Robert Mustacchi * such license, approval or letter.
11335786f6Robert Mustacchi *
11435786f6Robert Mustacchi *****************************************************************************
11535786f6Robert Mustacchi *
11635786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
11735786f6Robert Mustacchi * following license:
11835786f6Robert Mustacchi *
11926f3cdfGordon Ross * Redistribution and use in source and binary forms, with or without
12026f3cdfGordon Ross * modification, are permitted provided that the following conditions
12126f3cdfGordon Ross * are met:
12226f3cdfGordon Ross * 1. Redistributions of source code must retain the above copyright
12326f3cdfGordon Ross *    notice, this list of conditions, and the following disclaimer,
12426f3cdfGordon Ross *    without modification.
12526f3cdfGordon Ross * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12626f3cdfGordon Ross *    substantially similar to the "NO WARRANTY" disclaimer below
12726f3cdfGordon Ross *    ("Disclaimer") and any redistribution must be conditioned upon
12826f3cdfGordon Ross *    including a substantially similar Disclaimer requirement for further
12926f3cdfGordon Ross *    binary redistribution.
13026f3cdfGordon Ross * 3. Neither the names of the above-listed copyright holders nor the names
13126f3cdfGordon Ross *    of any contributors may be used to endorse or promote products derived
13226f3cdfGordon Ross *    from this software without specific prior written permission.
1337c478bdstevel@tonic-gate *
13426f3cdfGordon Ross * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13526f3cdfGordon Ross * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
13635786f6Robert Mustacchi * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
13726f3cdfGordon Ross * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
13835786f6Robert Mustacchi * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
13935786f6Robert Mustacchi * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14035786f6Robert Mustacchi * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
14135786f6Robert Mustacchi * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
14235786f6Robert Mustacchi * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14335786f6Robert Mustacchi * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14435786f6Robert Mustacchi * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14535786f6Robert Mustacchi *
14635786f6Robert Mustacchi * Alternatively, you may choose to be licensed under the terms of the
14735786f6Robert Mustacchi * GNU General Public License ("GPL") version 2 as published by the Free
14835786f6Robert Mustacchi * Software Foundation.
14935786f6Robert Mustacchi *
15035786f6Robert Mustacchi *****************************************************************************/
1517c478bdstevel@tonic-gate
1527c478bdstevel@tonic-gate#ifndef __ACTYPES_H__
1537c478bdstevel@tonic-gate#define __ACTYPES_H__
1547c478bdstevel@tonic-gate
15527f7c58myers/* acpisrc:StructDefs -- for acpisrc conversion */
15627f7c58myers
15730082d0myers/*
15835786f6Robert Mustacchi * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent
15935786f6Robert Mustacchi * header and must be either 32 or 64. 16-bit ACPICA is no longer
16035786f6Robert Mustacchi * supported, as of 12/2006.
16130082d0myers */
16230082d0myers#ifndef ACPI_MACHINE_WIDTH
16330082d0myers#error ACPI_MACHINE_WIDTH not defined
16430082d0myers#endif
1657c478bdstevel@tonic-gate
1667c478bdstevel@tonic-gate/*
1677c478bdstevel@tonic-gate * Data type ranges
1687c478bdstevel@tonic-gate * Note: These macros are designed to be compiler independent as well as
1697c478bdstevel@tonic-gate * working around problems that some 32-bit compilers have with 64-bit
1707c478bdstevel@tonic-gate * constants.
1717c478bdstevel@tonic-gate */
1727c478bdstevel@tonic-gate#define ACPI_UINT8_MAX                  (UINT8) (~((UINT8)  0)) /* 0xFF               */
1737c478bdstevel@tonic-gate#define ACPI_UINT16_MAX                 (UINT16)(~((UINT16) 0)) /* 0xFFFF             */
1747c478bdstevel@tonic-gate#define ACPI_UINT32_MAX                 (UINT32)(~((UINT32) 0)) /* 0xFFFFFFFF         */
1757c478bdstevel@tonic-gate#define ACPI_UINT64_MAX                 (UINT64)(~((UINT64) 0)) /* 0xFFFFFFFFFFFFFFFF */
1767c478bdstevel@tonic-gate#define ACPI_ASCII_MAX                  0x7F
1777c478bdstevel@tonic-gate
1787c478bdstevel@tonic-gate
1797c478bdstevel@tonic-gate/*
18030082d0myers * Architecture-specific ACPICA Subsystem Data Types
18130082d0myers *
18230082d0myers * The goal of these types is to provide source code portability across
18330082d0myers * 16-bit, 32-bit, and 64-bit targets.
18430082d0myers *
18530082d0myers * 1) The following types are of fixed size for all targets (16/32/64):
18630082d0myers *
18730082d0myers * BOOLEAN      Logical boolean
18830082d0myers *
18930082d0myers * UINT8        8-bit  (1 byte) unsigned value
19030082d0myers * UINT16       16-bit (2 byte) unsigned value
19130082d0myers * UINT32       32-bit (4 byte) unsigned value
19230082d0myers * UINT64       64-bit (8 byte) unsigned value
19330082d0myers *
19430082d0myers * INT16        16-bit (2 byte) signed value
19530082d0myers * INT32        32-bit (4 byte) signed value
19630082d0myers * INT64        64-bit (8 byte) signed value
19730082d0myers *
19830082d0myers * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
19935786f6Robert Mustacchi * compiler-dependent header(s) and were introduced because there is no
20035786f6Robert Mustacchi * common 64-bit integer type across the various compilation models, as
20135786f6Robert Mustacchi * shown in the table below.
20230082d0myers *
20330082d0myers * Datatype  LP64 ILP64 LLP64 ILP32 LP32 16bit
20430082d0myers * char      8    8     8     8     8    8
20530082d0myers * short     16   16    16    16    16   16
20630082d0myers * _int32         32
20730082d0myers * int       32   64    32    32    16   16
20830082d0myers * long      64   64    32    32    32   32
20930082d0myers * long long            64    64
21030082d0myers * pointer   64   64    64    32    32   32
21130082d0myers *
21230082d0myers * Note: ILP64 and LP32 are currently not supported.
21330082d0myers *
21430082d0myers *
21530082d0myers * 2) These types represent the native word size of the target mode of the
21630082d0myers * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
21730082d0myers * usually used for memory allocation, efficient loop counters, and array
21835786f6Robert Mustacchi * indexes. The types are similar to the size_t type in the C library and
21935786f6Robert Mustacchi * are required because there is no C type that consistently represents the
22035786f6Robert Mustacchi * native data width. ACPI_SIZE is needed because there is no guarantee
22135786f6Robert Mustacchi * that a kernel-level C library is present.
22230082d0myers *
22330082d0myers * ACPI_SIZE        16/32/64-bit unsigned value
22430082d0myers * ACPI_NATIVE_INT  16/32/64-bit signed value
2257c478bdstevel@tonic-gate */
2267c478bdstevel@tonic-gate
22730082d0myers/*******************************************************************************
22830082d0myers *
22930082d0myers * Common types for all compilers, all targets
23030082d0myers *
23130082d0myers ******************************************************************************/
2327c478bdstevel@tonic-gate
2337b1019aJerry Jelinek#ifndef ACPI_USE_SYSTEM_INTTYPES
2347b1019aJerry Jelinek
23530082d0myerstypedef unsigned char                   BOOLEAN;
23630082d0myerstypedef unsigned char                   UINT8;
23730082d0myerstypedef unsigned short                  UINT16;
2387b1019aJerry Jelinektypedef short                           INT16;
23930082d0myerstypedef COMPILER_DEPENDENT_UINT64       UINT64;
24030082d0myerstypedef COMPILER_DEPENDENT_INT64        INT64;
2417c478bdstevel@tonic-gate
2427b1019aJerry Jelinek#endif /* ACPI_USE_SYSTEM_INTTYPES */
2437c478bdstevel@tonic-gate
24426f3cdfGordon Ross/*
24526f3cdfGordon Ross * Value returned by AcpiOsGetThreadId. There is no standard "thread_id"
24626f3cdfGordon Ross * across operating systems or even the various UNIX systems. Since ACPICA
24726f3cdfGordon Ross * only needs the thread ID as a unique thread identifier, we use a UINT64
24826f3cdfGordon Ross * as the only common data type - it will accommodate any type of pointer or
24926f3cdfGordon Ross * any type of integer. It is up to the host-dependent OSL to cast the
25026f3cdfGordon Ross * native thread ID type to a UINT64 (in AcpiOsGetThreadId).
25126f3cdfGordon Ross */
25226f3cdfGordon Ross#define ACPI_THREAD_ID                  UINT64
25326f3cdfGordon Ross
25430082d0myers
25530082d0myers/*******************************************************************************
25630082d0myers *
25730082d0myers * Types specific to 64-bit targets
25830082d0myers *
25930082d0myers ******************************************************************************/
2607c478bdstevel@tonic-gate
2617c478bdstevel@tonic-gate#if ACPI_MACHINE_WIDTH == 64
2627c478bdstevel@tonic-gate
2637b1019aJerry Jelinek#ifndef ACPI_USE_SYSTEM_INTTYPES
2647c478bdstevel@tonic-gate
2657c478bdstevel@tonic-gatetypedef unsigned int                    UINT32;
26630082d0myerstypedef int                             INT32;
2677c478bdstevel@tonic-gate
2687b1019aJerry Jelinek#endif /* ACPI_USE_SYSTEM_INTTYPES */
2697c478bdstevel@tonic-gate
27030082d0myers
27130082d0myerstypedef INT64                           ACPI_NATIVE_INT;
272db2bae3Dana Myerstypedef UINT64                          ACPI_SIZE;
2737c478bdstevel@tonic-gatetypedef UINT64                          ACPI_IO_ADDRESS;
2747c478bdstevel@tonic-gatetypedef UINT64                          ACPI_PHYSICAL_ADDRESS;
2757c478bdstevel@tonic-gate
2767c478bdstevel@tonic-gate#define ACPI_MAX_PTR                    ACPI_UINT64_MAX
2777c478bdstevel@tonic-gate#define ACPI_SIZE_MAX                   ACPI_UINT64_MAX
27830082d0myers#define ACPI_USE_NATIVE_DIVIDE          /* Has native 64-bit integer support */
27935786f6Robert Mustacchi#define ACPI_USE_NATIVE_MATH64          /* Has native 64-bit integer support */
2807c478bdstevel@tonic-gate
2817c478bdstevel@tonic-gate/*
28230082d0myers * In the case of the Itanium Processor Family (IPF), the hardware does not
28335786f6Robert Mustacchi * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED
28435786f6Robert Mustacchi * flag to indicate that special precautions must be taken to avoid alignment
28535786f6Robert Mustacchi * faults. (IA64 or ia64 is currently used by existing compilers to indicate
28635786f6Robert Mustacchi * IPF.)
28730082d0myers *
28830082d0myers * Note: EM64T and other X86-64 processors support misaligned transfers,
28930082d0myers * so there is no need to define this flag.
2907c478bdstevel@tonic-gate */
29130082d0myers#if defined (__IA64__) || defined (__ia64__)
29230082d0myers#define ACPI_MISALIGNMENT_NOT_SUPPORTED
29330082d0myers#endif
2947c478bdstevel@tonic-gate
2957c478bdstevel@tonic-gate
29630082d0myers/*******************************************************************************
29730082d0myers *
29830082d0myers * Types specific to 32-bit targets
29930082d0myers *
30030082d0myers ******************************************************************************/
30130082d0myers
30230082d0myers#elif ACPI_MACHINE_WIDTH == 32
30330082d0myers
3047b1019aJerry Jelinek#ifndef ACPI_USE_SYSTEM_INTTYPES
30530082d0myers
30630082d0myerstypedef unsigned int                    UINT32;
30730082d0myerstypedef int                             INT32;
30830082d0myers
3097b1019aJerry Jelinek#endif /* ACPI_USE_SYSTEM_INTTYPES */
31030082d0myers
31130082d0myers
31230082d0myerstypedef INT32                           ACPI_NATIVE_INT;
313db2bae3Dana Myerstypedef UINT32                          ACPI_SIZE;
3147b1019aJerry Jelinek
3157b1019aJerry Jelinek#ifdef ACPI_32BIT_PHYSICAL_ADDRESS
3167b1019aJerry Jelinek
3177b1019aJerry Jelinek/*
3187b1019aJerry Jelinek * OSPMs can define this to shrink the size of the structures for 32-bit
3197b1019aJerry Jelinek * none PAE environment. ASL compiler may always define this to generate
3207b1019aJerry Jelinek * 32-bit OSPM compliant tables.
3217b1019aJerry Jelinek */
32230082d0myerstypedef UINT32                          ACPI_IO_ADDRESS;
323db2bae3Dana Myerstypedef UINT32                          ACPI_PHYSICAL_ADDRESS;
32430082d0myers
3257b1019aJerry Jelinek#else /* ACPI_32BIT_PHYSICAL_ADDRESS */
3267b1019aJerry Jelinek
3277b1019aJerry Jelinek/*
3287b1019aJerry Jelinek * It is reported that, after some calculations, the physical addresses can
3297b1019aJerry Jelinek * wrap over the 32-bit boundary on 32-bit PAE environment.
3307b1019aJerry Jelinek * https://bugzilla.kernel.org/show_bug.cgi?id=87971
3317b1019aJerry Jelinek */
3327b1019aJerry Jelinektypedef UINT64                          ACPI_IO_ADDRESS;
3337b1019aJerry Jelinektypedef UINT64                          ACPI_PHYSICAL_ADDRESS;
3347b1019aJerry Jelinek
3357b1019aJerry Jelinek#endif /* ACPI_32BIT_PHYSICAL_ADDRESS */
3367b1019aJerry Jelinek
33730082d0myers#define ACPI_MAX_PTR                    ACPI_UINT32_MAX
33830082d0myers#define ACPI_SIZE_MAX                   ACPI_UINT32_MAX
33930082d0myers
34030082d0myers#else
3417c478bdstevel@tonic-gate
342db2bae3Dana Myers/* ACPI_MACHINE_WIDTH must be either 64 or 32 */
3437c478bdstevel@tonic-gate
34430082d0myers#error unknown ACPI_MACHINE_WIDTH
34530082d0myers#endif
3467c478bdstevel@tonic-gate
3477c478bdstevel@tonic-gate
34830082d0myers/*******************************************************************************
34930082d0myers *
350aa2aa9aDana Myers * OS-dependent types
35130082d0myers *
35227f7c58myers * If the defaults below are not appropriate for the host system, they can
353aa2aa9aDana Myers * be defined in the OS-specific header, and this will take precedence.
35430082d0myers *
35530082d0myers ******************************************************************************/
35630082d0myers
35727f7c58myers/* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
35827f7c58myers
35930082d0myers#ifndef ACPI_CPU_FLAGS
360db2bae3Dana Myers#define ACPI_CPU_FLAGS                  ACPI_SIZE
36130082d0myers#endif
36230082d0myers
36327f7c58myers/* Object returned from AcpiOsCreateCache */
36427f7c58myers
36527f7c58myers#ifndef ACPI_CACHE_T
366aa2aa9aDana Myers#ifdef ACPI_USE_LOCAL_CACHE
36727f7c58myers#define ACPI_CACHE_T                    ACPI_MEMORY_LIST
368aa2aa9aDana Myers#else
369aa2aa9aDana Myers#define ACPI_CACHE_T                    void *
370aa2aa9aDana Myers#endif
37127f7c58myers#endif
37227f7c58myers
373aa2aa9aDana Myers/*
374aa2aa9aDana Myers * Synchronization objects - Mutexes, Semaphores, and SpinLocks
375aa2aa9aDana Myers */
376aa2aa9aDana Myers#if (ACPI_MUTEX_TYPE == ACPI_BINARY_SEMAPHORE)
377aa2aa9aDana Myers/*
378aa2aa9aDana Myers * These macros are used if the host OS does not support a mutex object.
379aa2aa9aDana Myers * Map the OSL Mutex interfaces to binary semaphores.
380aa2aa9aDana Myers */
381aa2aa9aDana Myers#define ACPI_MUTEX                      ACPI_SEMAPHORE
382aa2aa9aDana Myers#define AcpiOsCreateMutex(OutHandle)    AcpiOsCreateSemaphore (1, 1, OutHandle)
383aa2aa9aDana Myers#define AcpiOsDeleteMutex(Handle)       (void) AcpiOsDeleteSemaphore (Handle)
384aa2aa9aDana Myers#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
385aa2aa9aDana Myers#define AcpiOsReleaseMutex(Handle)      (void) AcpiOsSignalSemaphore (Handle, 1)
386aa2aa9aDana Myers#endif
387aa2aa9aDana Myers
388aa2aa9aDana Myers/* Configurable types for synchronization objects */
389aa2aa9aDana Myers
390aa2aa9aDana Myers#ifndef ACPI_SPINLOCK
391aa2aa9aDana Myers#define ACPI_SPINLOCK                   void *
392aa2aa9aDana Myers#endif
393aa2aa9aDana Myers
394aa2aa9aDana Myers#ifndef ACPI_SEMAPHORE
395aa2aa9aDana Myers#define ACPI_SEMAPHORE                  void *
396aa2aa9aDana Myers#endif
397aa2aa9aDana Myers
398aa2aa9aDana Myers#ifndef ACPI_MUTEX
399aa2aa9aDana Myers#define ACPI_MUTEX                      void *
400aa2aa9aDana Myers#endif
401aa2aa9aDana Myers
402aa2aa9aDana Myers
403aa2aa9aDana Myers/*******************************************************************************
404aa2aa9aDana Myers *
405aa2aa9aDana Myers * Compiler-dependent types
406aa2aa9aDana Myers *
407aa2aa9aDana Myers * If the defaults below are not appropriate for the host compiler, they can
408aa2aa9aDana Myers * be defined in the compiler-specific header, and this will take precedence.
409aa2aa9aDana Myers *
410aa2aa9aDana Myers ******************************************************************************/
411aa2aa9aDana Myers
41227f7c58myers/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
41327f7c58myers
41427f7c58myers#ifndef ACPI_UINTPTR_T
41527f7c58myers#define ACPI_UINTPTR_T                  void *
41627f7c58myers#endif
41727f7c58myers
41830082d0myers/*
41930082d0myers * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
42030082d0myers * some compilers can catch printf format string problems
42130082d0myers */
42230082d0myers#ifndef ACPI_PRINTF_LIKE
42330082d0myers#define ACPI_PRINTF_LIKE(c)
42430082d0myers#endif
42530082d0myers
42630082d0myers/*
42735786f6Robert Mustacchi * Some compilers complain about unused variables. Sometimes we don't want
42835786f6Robert Mustacchi * to use all the variables (for example, _AcpiModuleName). This allows us
4297b1019aJerry Jelinek * to tell the compiler in a per-variable manner that a variable
43030082d0myers * is unused
43130082d0myers */
43230082d0myers#ifndef ACPI_UNUSED_VAR
43330082d0myers#define ACPI_UNUSED_VAR
43430082d0myers#endif
43530082d0myers
43627f7c58myers/*
43735786f6Robert Mustacchi * All ACPICA external functions that are available to the rest of the
43835786f6Robert Mustacchi * kernel are tagged with these macros which can be defined as appropriate
43935786f6Robert Mustacchi * for the host.
4407b1019aJerry Jelinek *
4417b1019aJerry Jelinek * Notes:
4427b1019aJerry Jelinek * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination
4437b1019aJerry Jelinek * interfaces that may need special processing.
4447b1019aJerry Jelinek * ACPI_EXPORT_SYMBOL is used for all other public external functions.
44527f7c58myers */
4467b1019aJerry Jelinek#ifndef ACPI_EXPORT_SYMBOL_INIT
4477b1019aJerry Jelinek#define ACPI_EXPORT_SYMBOL_INIT(Symbol)
4487b1019aJerry Jelinek#endif
4497b1019aJerry Jelinek
45027f7c58myers#ifndef ACPI_EXPORT_SYMBOL
45127f7c58myers#define ACPI_EXPORT_SYMBOL(Symbol)
45227f7c58myers#endif
45327f7c58myers
4547b1019aJerry Jelinek/*
4557b1019aJerry Jelinek * Compiler/Clibrary-dependent debug initialization. Used for ACPICA
4567b1019aJerry Jelinek * utilities only.
4577b1019aJerry Jelinek */
4587b1019aJerry Jelinek#ifndef ACPI_DEBUG_INITIALIZE
4597b1019aJerry Jelinek#define ACPI_DEBUG_INITIALIZE()
4607b1019aJerry Jelinek#endif
4617b1019aJerry Jelinek
4627b1019aJerry Jelinek
4637b1019aJerry Jelinek/*******************************************************************************
4647b1019aJerry Jelinek *
4657b1019aJerry Jelinek * Configuration
4667b1019aJerry Jelinek *
4677b1019aJerry Jelinek ******************************************************************************/
4687b1019aJerry Jelinek
4697b1019aJerry Jelinek#ifdef ACPI_NO_MEM_ALLOCATIONS
4707b1019aJerry Jelinek
4717b1019aJerry Jelinek#define ACPI_ALLOCATE(a)                NULL
4727b1019aJerry Jelinek#define ACPI_ALLOCATE_ZEROED(a)         NULL
4737b1019aJerry Jelinek#define ACPI_FREE(a)
4747b1019aJerry Jelinek#define ACPI_MEM_TRACKING(a)
4757b1019aJerry Jelinek
4767b1019aJerry Jelinek#else /* ACPI_NO_MEM_ALLOCATIONS */
4777b1019aJerry Jelinek
4787b1019aJerry Jelinek#ifdef ACPI_DBG_TRACK_ALLOCATIONS
4797b1019aJerry Jelinek/*
4807b1019aJerry Jelinek * Memory allocation tracking (used by AcpiExec to detect memory leaks)
4817b1019aJerry Jelinek */
4827b1019aJerry Jelinek#define ACPI_MEM_PARAMETERS             _COMPONENT, _AcpiModuleName, __LINE__
4837b1019aJerry Jelinek#define ACPI_ALLOCATE(a)                AcpiUtAllocateAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
4847b1019aJerry Jelinek#define ACPI_ALLOCATE_ZEROED(a)         AcpiUtAllocateZeroedAndTrack ((ACPI_SIZE) (a), ACPI_MEM_PARAMETERS)
4857b1019aJerry Jelinek#define ACPI_FREE(a)                    AcpiUtFreeAndTrack (a, ACPI_MEM_PARAMETERS)
4867b1019aJerry Jelinek#define ACPI_MEM_TRACKING(a)            a
4877b1019aJerry Jelinek
4887b1019aJerry Jelinek#else
4897b1019aJerry Jelinek/*
4907b1019aJerry Jelinek * Normal memory allocation directly via the OS services layer
4917b1019aJerry Jelinek */
4927b1019aJerry Jelinek#define ACPI_ALLOCATE(a)                AcpiOsAllocate ((ACPI_SIZE) (a))
4937b1019aJerry Jelinek#define ACPI_ALLOCATE_ZEROED(a)         AcpiOsAllocateZeroed ((ACPI_SIZE) (a))
4947b1019aJerry Jelinek#define ACPI_FREE(a)                    AcpiOsFree (a)
4957b1019aJerry Jelinek#define ACPI_MEM_TRACKING(a)
4967b1019aJerry Jelinek
4977b1019aJerry Jelinek#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
4987b1019aJerry Jelinek
4997b1019aJerry Jelinek#endif /* ACPI_NO_MEM_ALLOCATIONS */
5007b1019aJerry Jelinek
50130082d0myers
502aa2aa9aDana Myers/******************************************************************************
503aa2aa9aDana Myers *
50435786f6Robert Mustacchi * ACPI Specification constants (Do not change unless the specification
50535786f6Robert Mustacchi * changes)
506aa2aa9aDana Myers *
507aa2aa9aDana Myers *****************************************************************************/
508aa2aa9aDana Myers
509aa2aa9aDana Myers/* Number of distinct FADT-based GPE register blocks (GPE0 and GPE1) */
510aa2aa9aDana Myers
511aa2aa9aDana Myers#define ACPI_MAX_GPE_BLOCKS             2
512aa2aa9aDana Myers
513aa2aa9aDana Myers/* Default ACPI register widths */
514aa2aa9aDana Myers
515aa2aa9aDana Myers#define ACPI_GPE_REGISTER_WIDTH         8
516aa2aa9aDana Myers#define ACPI_PM1_REGISTER_WIDTH         16
517aa2aa9aDana Myers#define ACPI_PM2_REGISTER_WIDTH         8
518aa2aa9aDana Myers#define ACPI_PM_TIMER_WIDTH             32
5197b1019aJerry Jelinek#define ACPI_RESET_REGISTER_WIDTH       8
520aa2aa9aDana Myers
521aa2aa9aDana Myers/* Names within the namespace are 4 bytes long */
522aa2aa9aDana Myers
523aa2aa9aDana Myers#define ACPI_NAME_SIZE                  4
524aa2aa9aDana Myers#define ACPI_PATH_SEGMENT_LENGTH        5           /* 4 chars for name + 1 char for separator */
525aa2aa9aDana Myers#define ACPI_PATH_SEPARATOR             '.'
526aa2aa9aDana Myers
527aa2aa9aDana Myers/* Sizes for ACPI table headers */
528aa2aa9aDana Myers
529aa2aa9aDana Myers#define ACPI_OEM_ID_SIZE                6
530aa2aa9aDana Myers#define ACPI_OEM_TABLE_ID_SIZE          8
531aa2aa9aDana Myers
532aa2aa9aDana Myers/* ACPI/PNP hardware IDs */
533aa2aa9aDana Myers
534aa2aa9aDana Myers#define PCI_ROOT_HID_STRING             "PNP0A03"
535aa2aa9aDana Myers#define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
536aa2aa9aDana Myers
537aa2aa9aDana Myers/* PM Timer ticks per second (HZ) */
538aa2aa9aDana Myers
5397b1019aJerry Jelinek#define ACPI_PM_TIMER_FREQUENCY         3579545
540aa2aa9aDana Myers
541aa2aa9aDana Myers
54230082d0myers/*******************************************************************************
54330082d0myers *
54430082d0myers * Independent types
54530082d0myers *
54630082d0myers ******************************************************************************/
5477c478bdstevel@tonic-gate
54830082d0myers/* Logical defines and NULL */
54930082d0myers
5507c478bdstevel@tonic-gate#ifdef FALSE
5517c478bdstevel@tonic-gate#undef FALSE
5527c478bdstevel@tonic-gate#endif
5537c478bdstevel@tonic-gate#define FALSE                           (1 == 0)
5547c478bdstevel@tonic-gate
5557c478bdstevel@tonic-gate#ifdef TRUE
5567c478bdstevel@tonic-gate#undef TRUE
5577c478bdstevel@tonic-gate#endif
5587c478bdstevel@tonic-gate#define TRUE                            (1 == 1)
5597c478bdstevel@tonic-gate
5607c478bdstevel@tonic-gate#ifndef NULL
5617c478bdstevel@tonic-gate#define NULL                            (void *) 0
5627c478bdstevel@tonic-gate#endif
5637c478bdstevel@tonic-gate
5647c478bdstevel@tonic-gate
5657c478bdstevel@tonic-gate/*
566aa2aa9aDana Myers * Miscellaneous types
5677c478bdstevel@tonic-gate */
5687c478bdstevel@tonic-gatetypedef UINT32                          ACPI_STATUS;    /* All ACPI Exceptions */
5697c478bdstevel@tonic-gatetypedef UINT32                          ACPI_NAME;      /* 4-byte ACPI name */
5707c478bdstevel@tonic-gatetypedef char *                          ACPI_STRING;    /* Null terminated ASCII string */
57130082d0myerstypedef void *                          ACPI_HANDLE;    /* Actually a ptr to a NS Node */
5727c478bdstevel@tonic-gate
573aa2aa9aDana Myers
5747b1019aJerry Jelinek/* Time constants for timer calculations */
5757b1019aJerry Jelinek
5767b1019aJerry Jelinek#define ACPI_MSEC_PER_SEC               1000L
5777b1019aJerry Jelinek
5787b1019aJerry Jelinek#define ACPI_USEC_PER_MSEC              1000L
5797b1019aJerry Jelinek#define ACPI_USEC_PER_SEC               1000000L
5807b1019aJerry Jelinek
5817b1019aJerry Jelinek#define ACPI_100NSEC_PER_USEC           10L
5827b1019aJerry Jelinek#define ACPI_100NSEC_PER_MSEC           10000L
5837b1019aJerry Jelinek#define ACPI_100NSEC_PER_SEC            10000000L
5847b1019aJerry Jelinek
5857b1019aJerry Jelinek#define ACPI_NSEC_PER_USEC              1000L
5867b1019aJerry Jelinek#define ACPI_NSEC_PER_MSEC              1000000L
5877b1019aJerry Jelinek#define ACPI_NSEC_PER_SEC               1000000000L
5887b1019aJerry Jelinek
58935786f6Robert Mustacchi#define ACPI_TIME_AFTER(a, b)           ((INT64)((b) - (a)) < 0)
59035786f6Robert Mustacchi
5917b1019aJerry Jelinek
592aa2aa9aDana Myers/* Owner IDs are used to track namespace nodes for selective deletion */
593aa2aa9aDana Myers
594aa2aa9aDana Myerstypedef UINT8                           ACPI_OWNER_ID;
595aa2aa9aDana Myers#define ACPI_OWNER_ID_MAX               0xFF
596aa2aa9aDana Myers
597aa2aa9aDana Myers
5987c478bdstevel@tonic-gate#define ACPI_INTEGER_BIT_SIZE           64
5997c478bdstevel@tonic-gate#define ACPI_MAX_DECIMAL_DIGITS         20  /* 2^64 = 18,446,744,073,709,551,616 */
6007c478bdstevel@tonic-gate#define ACPI_MAX64_DECIMAL_DIGITS       20
6017c478bdstevel@tonic-gate#define ACPI_MAX32_DECIMAL_DIGITS       10
6027c478bdstevel@tonic-gate#define ACPI_MAX16_DECIMAL_DIGITS        5
6037c478bdstevel@tonic-gate#define ACPI_MAX8_DECIMAL_DIGITS         3
6047c478bdstevel@tonic-gate
6057c478bdstevel@tonic-gate/*
6067c478bdstevel@tonic-gate * Constants with special meanings
6077c478bdstevel@tonic-gate */
60835786f6Robert Mustacchi#define ACPI_ROOT_OBJECT                ((ACPI_HANDLE) ACPI_TO_POINTER (ACPI_MAX_PTR))
609aa2aa9aDana Myers#define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
610aa2aa9aDana Myers#define ACPI_DO_NOT_WAIT                0
611aa2aa9aDana Myers
61226f3cdfGordon Ross/*
61335786f6Robert Mustacchi * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are
61435786f6Robert Mustacchi * 32 bits. In ACPI version 2 (2000) and later, integers are max 64 bits.
61535786f6Robert Mustacchi * Note that this pertains to the ACPI integer type only, not to other
61635786f6Robert Mustacchi * integers used in the implementation of the ACPICA subsystem.
61726f3cdfGordon Ross *
61826f3cdfGordon Ross * 01/2010: This type is obsolete and has been removed from the entire ACPICA
61926f3cdfGordon Ross * code base. It remains here for compatibility with device drivers that use
62026f3cdfGordon Ross * the type. However, it will be removed in the future.
62126f3cdfGordon Ross */
62226f3cdfGordon Rosstypedef UINT64                          ACPI_INTEGER;
62326f3cdfGordon Ross#define ACPI_INTEGER_MAX                ACPI_UINT64_MAX
62426f3cdfGordon Ross
625aa2aa9aDana Myers
626aa2aa9aDana Myers/*******************************************************************************
627aa2aa9aDana Myers *
628aa2aa9aDana Myers * Commonly used macros
629aa2aa9aDana Myers *
630aa2aa9aDana Myers ******************************************************************************/
631aa2aa9aDana Myers
632aa2aa9aDana Myers/* Data manipulation */
633aa2aa9aDana Myers
634aa2aa9aDana Myers#define ACPI_LOBYTE(Integer)            ((UINT8)   (UINT16)(Integer))
635aa2aa9aDana Myers#define ACPI_HIBYTE(Integer)            ((UINT8) (((UINT16)(Integer)) >> 8))
636aa2aa9aDana Myers#define ACPI_LOWORD(Integer)            ((UINT16)  (UINT32)(Integer))
637aa2aa9aDana Myers#define ACPI_HIWORD(Integer)            ((UINT16)(((UINT32)(Integer)) >> 16))
638aa2aa9aDana Myers#define ACPI_LODWORD(Integer64)         ((UINT32)  (UINT64)(Integer64))
639aa2aa9aDana Myers#define ACPI_HIDWORD(Integer64)         ((UINT32)(((UINT64)(Integer64)) >> 32))
640aa2aa9aDana Myers
641aa2aa9aDana Myers#define ACPI_SET_BIT(target,bit)        ((target) |= (bit))
642aa2aa9aDana Myers#define ACPI_CLEAR_BIT(target,bit)      ((target) &= ~(bit))
643aa2aa9aDana Myers#define ACPI_MIN(a,b)                   (((a)<(b))?(a):(b))
644aa2aa9aDana Myers#define ACPI_MAX(a,b)                   (((a)>(b))?(a):(b))
645aa2aa9aDana Myers
646aa2aa9aDana Myers/* Size calculation */
6477c478bdstevel@tonic-gate
648aa2aa9aDana Myers#define ACPI_ARRAY_LENGTH(x)            (sizeof(x) / sizeof((x)[0]))
649aa2aa9aDana Myers
650aa2aa9aDana Myers/* Pointer manipulation */
651aa2aa9aDana Myers
652aa2aa9aDana Myers#define ACPI_CAST_PTR(t, p)             ((t *) (ACPI_UINTPTR_T) (p))
653aa2aa9aDana Myers#define ACPI_CAST_INDIRECT_PTR(t, p)    ((t **) (ACPI_UINTPTR_T) (p))
654aa2aa9aDana Myers#define ACPI_ADD_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) + (ACPI_SIZE)(b)))
6557b1019aJerry Jelinek#define ACPI_SUB_PTR(t, a, b)           ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8, (a)) - (ACPI_SIZE)(b)))
65635786f6Robert Mustacchi#define ACPI_PTR_DIFF(a, b)             ((ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))))
657aa2aa9aDana Myers
658aa2aa9aDana Myers/* Pointer/Integer type conversions */
659aa2aa9aDana Myers
66035786f6Robert Mustacchi#define ACPI_TO_POINTER(i)              ACPI_ADD_PTR (void, (void *) 0, (ACPI_SIZE) (i))
66135786f6Robert Mustacchi#define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) 0)
66235786f6Robert Mustacchi#define ACPI_OFFSET(d, f)               ACPI_PTR_DIFF (&(((d *) 0)->f), (void *) 0)
663aa2aa9aDana Myers#define ACPI_PHYSADDR_TO_PTR(i)         ACPI_TO_POINTER(i)
664aa2aa9aDana Myers#define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
665aa2aa9aDana Myers
6667b1019aJerry Jelinek/* Optimizations for 4-character (32-bit) ACPI_NAME manipulation */
6677b1019aJerry Jelinek
668aa2aa9aDana Myers#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
669aa2aa9aDana Myers#define ACPI_COMPARE_NAME(a,b)          (*ACPI_CAST_PTR (UINT32, (a)) == *ACPI_CAST_PTR (UINT32, (b)))
6707b1019aJerry Jelinek#define ACPI_MOVE_NAME(dest,src)        (*ACPI_CAST_PTR (UINT32, (dest)) = *ACPI_CAST_PTR (UINT32, (src)))
671aa2aa9aDana Myers#else
6727b1019aJerry Jelinek#define ACPI_COMPARE_NAME(a,b)          (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_CAST_PTR (char, (b)), ACPI_NAME_SIZE))
6737b1019aJerry Jelinek#define ACPI_MOVE_NAME(dest,src)        (strncpy (ACPI_CAST_PTR (char, (dest)), ACPI_CAST_PTR (char, (src)), ACPI_NAME_SIZE))
674aa2aa9aDana Myers#endif
675aa2aa9aDana Myers
6767b1019aJerry Jelinek/* Support for the special RSDP signature (8 characters) */
6777b1019aJerry Jelinek
6787b1019aJerry Jelinek#define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
6797b1019aJerry Jelinek#define ACPI_MAKE_RSDP_SIG(dest)        (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
6807b1019aJerry Jelinek
68135786f6Robert Mustacchi/*
68235786f6Robert Mustacchi * Algorithm to obtain access bit width.
68335786f6Robert Mustacchi * Can be used with AccessWidth of ACPI_GENERIC_ADDRESS and AccessSize of
68435786f6Robert Mustacchi * ACPI_RESOURCE_GENERIC_REGISTER.
68535786f6Robert Mustacchi */
68635786f6Robert Mustacchi#define ACPI_ACCESS_BIT_WIDTH(size)     (1 << ((size) + 2))
68735786f6Robert Mustacchi
688aa2aa9aDana Myers
689aa2aa9aDana Myers/*******************************************************************************
690aa2aa9aDana Myers *
691aa2aa9aDana Myers * Miscellaneous constants
692aa2aa9aDana Myers *
693aa2aa9aDana Myers ******************************************************************************/
6947c478bdstevel@tonic-gate
6957c478bdstevel@tonic-gate/*
69635786f6Robert Mustacchi * Initialization sequence options
6977c478bdstevel@tonic-gate */
69835786f6Robert Mustacchi#define ACPI_FULL_INITIALIZATION        0x0000
69935786f6Robert Mustacchi#define ACPI_NO_FACS_INIT               0x0001
70035786f6Robert Mustacchi#define ACPI_NO_ACPI_ENABLE             0x0002
70135786f6Robert Mustacchi#define ACPI_NO_HARDWARE_INIT           0x0004
70235786f6Robert Mustacchi#define ACPI_NO_EVENT_INIT              0x0008
70335786f6Robert Mustacchi#define ACPI_NO_HANDLER_INIT            0x0010
70435786f6Robert Mustacchi#define ACPI_NO_OBJECT_INIT             0x0020
70535786f6Robert Mustacchi#define ACPI_NO_DEVICE_INIT             0x0040
70635786f6Robert Mustacchi#define ACPI_NO_ADDRESS_SPACE_INIT      0x0080
7077c478bdstevel@tonic-gate
7087c478bdstevel@tonic-gate/*
7097c478bdstevel@tonic-gate * Initialization state
7107c478bdstevel@tonic-gate */
711db2bae3Dana Myers#define ACPI_SUBSYSTEM_INITIALIZE       0x01
712db2bae3Dana Myers#define ACPI_INITIALIZED_OK             0x02
7137c478bdstevel@tonic-gate
7147c478bdstevel@tonic-gate/*
7157c478bdstevel@tonic-gate * Power state values
7167c478bdstevel@tonic-gate */
7177c478bdstevel@tonic-gate#define ACPI_STATE_UNKNOWN              (UINT8) 0xFF
7187c478bdstevel@tonic-gate
7197c478bdstevel@tonic-gate#define ACPI_STATE_S0                   (UINT8) 0
7207c478bdstevel@tonic-gate#define ACPI_STATE_S1                   (UINT8) 1
7217c478bdstevel@tonic-gate#define ACPI_STATE_S2                   (UINT8) 2
7227c478bdstevel@tonic-gate#define ACPI_STATE_S3                   (UINT8) 3
7237c478bdstevel@tonic-gate#define ACPI_STATE_S4                   (UINT8) 4
7247c478bdstevel@tonic-gate#define ACPI_STATE_S5                   (UINT8) 5
7257c478bdstevel@tonic-gate#define ACPI_S_STATES_MAX               ACPI_STATE_S5
7267c478bdstevel@tonic-gate#define ACPI_S_STATE_COUNT              6
7277c478bdstevel@tonic-gate
7287c478bdstevel@tonic-gate#define ACPI_STATE_D0                   (UINT8) 0
7297c478bdstevel@tonic-gate#define ACPI_STATE_D1                   (UINT8) 1
7307c478bdstevel@tonic-gate#define ACPI_STATE_D2                   (UINT8) 2
7317c478bdstevel@tonic-gate#define ACPI_STATE_D3                   (UINT8) 3
7327c478bdstevel@tonic-gate#define ACPI_D_STATES_MAX               ACPI_STATE_D3
7337c478bdstevel@tonic-gate#define ACPI_D_STATE_COUNT              4
7347c478bdstevel@tonic-gate
7357c478bdstevel@tonic-gate#define ACPI_STATE_C0                   (UINT8) 0
7367c478bdstevel@tonic-gate#define ACPI_STATE_C1                   (UINT8) 1
7377c478bdstevel@tonic-gate#define ACPI_STATE_C2                   (UINT8) 2
7387c478bdstevel@tonic-gate#define ACPI_STATE_C3                   (UINT8) 3
7397c478bdstevel@tonic-gate#define ACPI_C_STATES_MAX               ACPI_STATE_C3
7407c478bdstevel@tonic-gate#define ACPI_C_STATE_COUNT              4
7417c478bdstevel@tonic-gate
7427c478bdstevel@tonic-gate/*
7437c478bdstevel@tonic-gate * Sleep type invalid value
7447c478bdstevel@tonic-gate */
7457c478bdstevel@tonic-gate#define ACPI_SLEEP_TYPE_MAX             0x7
7467c478bdstevel@tonic-gate#define ACPI_SLEEP_TYPE_INVALID         0xFF
7477c478bdstevel@tonic-gate
7487c478bdstevel@tonic-gate/*
7497c478bdstevel@tonic-gate * Standard notify values
7507c478bdstevel@tonic-gate */
751db2bae3Dana Myers#define ACPI_NOTIFY_BUS_CHECK           (UINT8) 0x00
752db2bae3Dana Myers#define ACPI_NOTIFY_DEVICE_CHECK        (UINT8) 0x01
753db2bae3Dana Myers#define ACPI_NOTIFY_DEVICE_WAKE         (UINT8) 0x02
754db2bae3Dana Myers#define ACPI_NOTIFY_EJECT_REQUEST       (UINT8) 0x03
755db2bae3Dana Myers#define ACPI_NOTIFY_DEVICE_CHECK_LIGHT  (UINT8) 0x04
756db2bae3Dana Myers#define ACPI_NOTIFY_FREQUENCY_MISMATCH  (UINT8) 0x05
757db2bae3Dana Myers#define ACPI_NOTIFY_BUS_MODE_MISMATCH   (UINT8) 0x06
758db2bae3Dana Myers#define ACPI_NOTIFY_POWER_FAULT         (UINT8) 0x07
759db2bae3Dana Myers#define ACPI_NOTIFY_CAPABILITIES_CHECK  (UINT8) 0x08
760db2bae3Dana Myers#define ACPI_NOTIFY_DEVICE_PLD_CHECK    (UINT8) 0x09
761db2bae3Dana Myers#define ACPI_NOTIFY_RESERVED            (UINT8) 0x0A
762db2bae3Dana Myers#define ACPI_NOTIFY_LOCALITY_UPDATE     (UINT8) 0x0B
7637b1019aJerry Jelinek#define ACPI_NOTIFY_SHUTDOWN_REQUEST    (UINT8) 0x0C
7647b1019aJerry Jelinek#define ACPI_NOTIFY_AFFINITY_UPDATE     (UINT8) 0x0D
76535786f6Robert Mustacchi#define ACPI_NOTIFY_MEMORY_UPDATE       (UINT8) 0x0E
766db2bae3Dana Myers
76735786f6Robert Mustacchi#define ACPI_GENERIC_NOTIFY_MAX         0x0E
7687b1019aJerry Jelinek#define ACPI_SPECIFIC_NOTIFY_MAX        0x84
7697c478bdstevel@tonic-gate
7707c478bdstevel@tonic-gate/*
771aa2aa9aDana Myers * Types associated with ACPI names and objects. The first group of
7727c478bdstevel@tonic-gate * values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
773aa2aa9aDana Myers * of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
7747c478bdstevel@tonic-gate * only add to the first group if the spec changes.
7757c478bdstevel@tonic-gate *
7767c478bdstevel@tonic-gate * NOTE: Types must be kept in sync with the global AcpiNsProperties
7777c478bdstevel@tonic-gate * and AcpiNsTypeNames arrays.
7787c478bdstevel@tonic-gate */
7797c478bdstevel@tonic-gatetypedef UINT32                          ACPI_OBJECT_TYPE;
7807c478bdstevel@tonic-gate
7817c478bdstevel@tonic-gate#define ACPI_TYPE_ANY                   0x00
7827c478bdstevel@tonic-gate#define ACPI_TYPE_INTEGER               0x01  /* Byte/Word/Dword/Zero/One/Ones */
7837c478bdstevel@tonic-gate#define ACPI_TYPE_STRING                0x02
7847c478bdstevel@tonic-gate#define ACPI_TYPE_BUFFER                0x03
7857c478bdstevel@tonic-gate#define ACPI_TYPE_PACKAGE               0x04  /* ByteConst, multiple DataTerm/Constant/SuperName */
7867c478bdstevel@tonic-gate#define ACPI_TYPE_FIELD_UNIT            0x05
7877c478bdstevel@tonic-gate#define ACPI_TYPE_DEVICE                0x06  /* Name, multiple Node */
7887c478bdstevel@tonic-gate#define ACPI_TYPE_EVENT                 0x07
7897c478bdstevel@tonic-gate#define ACPI_TYPE_METHOD                0x08  /* Name, ByteConst, multiple Code */
7907c478bdstevel@tonic-gate#define ACPI_TYPE_MUTEX                 0x09
7917c478bdstevel@tonic-gate#define ACPI_TYPE_REGION                0x0A
7927c478bdstevel@tonic-gate#define ACPI_TYPE_POWER                 0x0B  /* Name,ByteConst,WordConst,multi Node */
7937c478bdstevel@tonic-gate#define ACPI_TYPE_PROCESSOR             0x0C  /* Name,ByteConst,DWordConst,ByteConst,multi NmO */
7947c478bdstevel@tonic-gate#define ACPI_TYPE_THERMAL               0x0D  /* Name, multiple Node */
7957c478bdstevel@tonic-gate#define ACPI_TYPE_BUFFER_FIELD          0x0E
7967c478bdstevel@tonic-gate#define ACPI_TYPE_DDB_HANDLE            0x0F
7977c478bdstevel@tonic-gate#define ACPI_TYPE_DEBUG_OBJECT          0x10
7987c478bdstevel@tonic-gate
7997c478bdstevel@tonic-gate#define ACPI_TYPE_EXTERNAL_MAX          0x10
8007b1019aJerry Jelinek#define ACPI_NUM_TYPES                  (ACPI_TYPE_EXTERNAL_MAX + 1)
8017c478bdstevel@tonic-gate
8027c478bdstevel@tonic-gate/*
8037c478bdstevel@tonic-gate * These are object types that do not map directly to the ACPI
80435786f6Robert Mustacchi * ObjectType() operator. They are used for various internal purposes
80535786f6Robert Mustacchi * only. If new predefined ACPI_TYPEs are added (via the ACPI
80635786f6Robert Mustacchi * specification), these internal types must move upwards. (There
80735786f6Robert Mustacchi * is code that depends on these values being contiguous with the
80835786f6Robert Mustacchi * external types above.)
8097c478bdstevel@tonic-gate */
8107c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_REGION_FIELD    0x11
8117c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_BANK_FIELD      0x12
8127c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_INDEX_FIELD     0x13
8137c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_REFERENCE       0x14  /* Arg#, Local#, Name, Debug, RefOf, Index */
8147c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_ALIAS           0x15
8157c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_METHOD_ALIAS    0x16
8167c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_NOTIFY          0x17
8177c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_ADDRESS_HANDLER 0x18
8187c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_RESOURCE        0x19
8197c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_RESOURCE_FIELD  0x1A
8207c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_SCOPE           0x1B  /* 1 Name, multiple ObjectList Nodes */
8217c478bdstevel@tonic-gate
8227c478bdstevel@tonic-gate#define ACPI_TYPE_NS_NODE_MAX           0x1B  /* Last typecode used within a NS Node */
8237b1019aJerry Jelinek#define ACPI_TOTAL_TYPES                (ACPI_TYPE_NS_NODE_MAX + 1)
8247c478bdstevel@tonic-gate
8257c478bdstevel@tonic-gate/*
8267c478bdstevel@tonic-gate * These are special object types that never appear in
8277b1019aJerry Jelinek * a Namespace node, only in an object of ACPI_OPERAND_OBJECT
8287c478bdstevel@tonic-gate */
8297c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_EXTRA           0x1C
8307c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_DATA            0x1D
8317c478bdstevel@tonic-gate
8327c478bdstevel@tonic-gate#define ACPI_TYPE_LOCAL_MAX             0x1D
8337c478bdstevel@tonic-gate
8347c478bdstevel@tonic-gate/* All types above here are invalid */
8357c478bdstevel@tonic-gate
8367c478bdstevel@tonic-gate#define ACPI_TYPE_INVALID               0x1E
8377c478bdstevel@tonic-gate#define ACPI_TYPE_NOT_FOUND             0xFF
8387c478bdstevel@tonic-gate
839db2bae3Dana Myers#define ACPI_NUM_NS_TYPES               (ACPI_TYPE_INVALID + 1)
840db2bae3Dana Myers
841db2bae3Dana Myers
8427c478bdstevel@tonic-gate/*
8437c478bdstevel@tonic-gate * All I/O
8447c478bdstevel@tonic-gate */
8457c478bdstevel@tonic-gate#define ACPI_READ                       0
8467c478bdstevel@tonic-gate#define ACPI_WRITE                      1
8477c478bdstevel@tonic-gate#define ACPI_IO_MASK                    1
8487c478bdstevel@tonic-gate
8497c478bdstevel@tonic-gate/*
8507c478bdstevel@tonic-gate * Event Types: Fixed & General Purpose
8517c478bdstevel@tonic-gate */
8527c478bdstevel@tonic-gatetypedef UINT32                          ACPI_EVENT_TYPE;
8537c478bdstevel@tonic-gate
8547c478bdstevel@tonic-gate/*
8557c478bdstevel@tonic-gate * Fixed events
8567c478bdstevel@tonic-gate */
8577c478bdstevel@tonic-gate#define ACPI_EVENT_PMTIMER              0
8587c478bdstevel@tonic-gate#define ACPI_EVENT_GLOBAL               1
8597c478bdstevel@tonic-gate#define ACPI_EVENT_POWER_BUTTON         2
8607c478bdstevel@tonic-gate#define ACPI_EVENT_SLEEP_BUTTON         3
8617c478bdstevel@tonic-gate#define ACPI_EVENT_RTC                  4
8627c478bdstevel@tonic-gate#define ACPI_EVENT_MAX                  4
8637c478bdstevel@tonic-gate#define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
8647c478bdstevel@tonic-gate
8657c478bdstevel@tonic-gate/*
8667c478bdstevel@tonic-gate * Event Status - Per event
8677c478bdstevel@tonic-gate * -------------
8687c478bdstevel@tonic-gate * The encoding of ACPI_EVENT_STATUS is illustrated below.
8697c478bdstevel@tonic-gate * Note that a set bit (1) indicates the property is TRUE
8707c478bdstevel@tonic-gate * (e.g. if bit 0 is set then the event is enabled).
87135786f6Robert Mustacchi * +-------------+-+-+-+-+-+-+
87235786f6Robert Mustacchi * |   Bits 31:6 |5|4|3|2|1|0|
87335786f6Robert Mustacchi * +-------------+-+-+-+-+-+-+
87435786f6Robert Mustacchi *          |     | | | | | |
87535786f6Robert Mustacchi *          |     | | | | | +- Enabled?
87635786f6Robert Mustacchi *          |     | | | | +--- Enabled for wake?
87735786f6Robert Mustacchi *          |     | | | +----- Status bit set?
87835786f6Robert Mustacchi *          |     | | +------- Enable bit set?
87935786f6Robert Mustacchi *          |     | +--------- Has a handler?
88035786f6Robert Mustacchi *          |     +----------- Masked?
88135786f6Robert Mustacchi *          +----------------- <Reserved>
8827c478bdstevel@tonic-gate */
8837c478bdstevel@tonic-gatetypedef UINT32                          ACPI_EVENT_STATUS;
8847c478bdstevel@tonic-gate
8857c478bdstevel@tonic-gate#define ACPI_EVENT_FLAG_DISABLED        (ACPI_EVENT_STATUS) 0x00
8867c478bdstevel@tonic-gate#define ACPI_EVENT_FLAG_ENABLED         (ACPI_EVENT_STATUS) 0x01
8877c478bdstevel@tonic-gate#define ACPI_EVENT_FLAG_WAKE_ENABLED    (ACPI_EVENT_STATUS) 0x02
8887b1019aJerry Jelinek#define ACPI_EVENT_FLAG_STATUS_SET      (ACPI_EVENT_STATUS) 0x04
8897b1019aJerry Jelinek#define ACPI_EVENT_FLAG_ENABLE_SET      (ACPI_EVENT_STATUS) 0x08
8907b1019aJerry Jelinek#define ACPI_EVENT_FLAG_HAS_HANDLER     (ACPI_EVENT_STATUS) 0x10
89135786f6Robert Mustacchi#define ACPI_EVENT_FLAG_MASKED          (ACPI_EVENT_STATUS) 0x20
892