xref: /onnv-gate/usr/src/uts/intel/sys/acpi/aclocal.h (revision 11225:eb6056029d84)
10Sstevel@tonic-gate /******************************************************************************
20Sstevel@tonic-gate  *
30Sstevel@tonic-gate  * Name: aclocal.h - Internal data types used across the ACPI subsystem
40Sstevel@tonic-gate  *
50Sstevel@tonic-gate  *****************************************************************************/
60Sstevel@tonic-gate 
70Sstevel@tonic-gate /******************************************************************************
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * 1. Copyright Notice
100Sstevel@tonic-gate  *
119980SDana.Myers@Sun.COM  * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp.
120Sstevel@tonic-gate  * All rights reserved.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * 2. License
150Sstevel@tonic-gate  *
160Sstevel@tonic-gate  * 2.1. This is your license from Intel Corp. under its intellectual property
170Sstevel@tonic-gate  * rights.  You may have additional license terms from the party that provided
180Sstevel@tonic-gate  * you this software, covering your right to use that party's intellectual
190Sstevel@tonic-gate  * property rights.
200Sstevel@tonic-gate  *
210Sstevel@tonic-gate  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
220Sstevel@tonic-gate  * copy of the source code appearing in this file ("Covered Code") an
230Sstevel@tonic-gate  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
240Sstevel@tonic-gate  * base code distributed originally by Intel ("Original Intel Code") to copy,
250Sstevel@tonic-gate  * make derivatives, distribute, use and display any portion of the Covered
260Sstevel@tonic-gate  * Code in any form, with the right to sublicense such rights; and
270Sstevel@tonic-gate  *
280Sstevel@tonic-gate  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
290Sstevel@tonic-gate  * license (with the right to sublicense), under only those claims of Intel
300Sstevel@tonic-gate  * patents that are infringed by the Original Intel Code, to make, use, sell,
310Sstevel@tonic-gate  * offer to sell, and import the Covered Code and derivative works thereof
320Sstevel@tonic-gate  * solely to the minimum extent necessary to exercise the above copyright
330Sstevel@tonic-gate  * license, and in no event shall the patent license extend to any additions
340Sstevel@tonic-gate  * to or modifications of the Original Intel Code.  No other license or right
350Sstevel@tonic-gate  * is granted directly or by implication, estoppel or otherwise;
360Sstevel@tonic-gate  *
370Sstevel@tonic-gate  * The above copyright and patent license is granted only if the following
380Sstevel@tonic-gate  * conditions are met:
390Sstevel@tonic-gate  *
400Sstevel@tonic-gate  * 3. Conditions
410Sstevel@tonic-gate  *
420Sstevel@tonic-gate  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
430Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
440Sstevel@tonic-gate  * Code or modification with rights to further distribute source must include
450Sstevel@tonic-gate  * the above Copyright Notice, the above License, this list of Conditions,
460Sstevel@tonic-gate  * and the following Disclaimer and Export Compliance provision.  In addition,
470Sstevel@tonic-gate  * Licensee must cause all Covered Code to which Licensee contributes to
480Sstevel@tonic-gate  * contain a file documenting the changes Licensee made to create that Covered
490Sstevel@tonic-gate  * Code and the date of any change.  Licensee must include in that file the
500Sstevel@tonic-gate  * documentation of any changes made by any predecessor Licensee.  Licensee
510Sstevel@tonic-gate  * must include a prominent statement that the modification is derived,
520Sstevel@tonic-gate  * directly or indirectly, from Original Intel Code.
530Sstevel@tonic-gate  *
540Sstevel@tonic-gate  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
550Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
560Sstevel@tonic-gate  * Code or modification without rights to further distribute source must
570Sstevel@tonic-gate  * include the following Disclaimer and Export Compliance provision in the
580Sstevel@tonic-gate  * documentation and/or other materials provided with distribution.  In
590Sstevel@tonic-gate  * addition, Licensee may not authorize further sublicense of source of any
600Sstevel@tonic-gate  * portion of the Covered Code, and must include terms to the effect that the
610Sstevel@tonic-gate  * license from Licensee to its licensee is limited to the intellectual
620Sstevel@tonic-gate  * property embodied in the software Licensee provides to its licensee, and
630Sstevel@tonic-gate  * not to intellectual property embodied in modifications its licensee may
640Sstevel@tonic-gate  * make.
650Sstevel@tonic-gate  *
660Sstevel@tonic-gate  * 3.3. Redistribution of Executable. Redistribution in executable form of any
670Sstevel@tonic-gate  * substantial portion of the Covered Code or modification must reproduce the
680Sstevel@tonic-gate  * above Copyright Notice, and the following Disclaimer and Export Compliance
690Sstevel@tonic-gate  * provision in the documentation and/or other materials provided with the
700Sstevel@tonic-gate  * distribution.
710Sstevel@tonic-gate  *
720Sstevel@tonic-gate  * 3.4. Intel retains all right, title, and interest in and to the Original
730Sstevel@tonic-gate  * Intel Code.
740Sstevel@tonic-gate  *
750Sstevel@tonic-gate  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
760Sstevel@tonic-gate  * Intel shall be used in advertising or otherwise to promote the sale, use or
770Sstevel@tonic-gate  * other dealings in products derived from or relating to the Covered Code
780Sstevel@tonic-gate  * without prior written authorization from Intel.
790Sstevel@tonic-gate  *
800Sstevel@tonic-gate  * 4. Disclaimer and Export Compliance
810Sstevel@tonic-gate  *
820Sstevel@tonic-gate  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
830Sstevel@tonic-gate  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
840Sstevel@tonic-gate  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
850Sstevel@tonic-gate  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
860Sstevel@tonic-gate  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
870Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
880Sstevel@tonic-gate  * PARTICULAR PURPOSE.
890Sstevel@tonic-gate  *
900Sstevel@tonic-gate  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
910Sstevel@tonic-gate  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
920Sstevel@tonic-gate  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
930Sstevel@tonic-gate  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
940Sstevel@tonic-gate  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
950Sstevel@tonic-gate  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
960Sstevel@tonic-gate  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
970Sstevel@tonic-gate  * LIMITED REMEDY.
980Sstevel@tonic-gate  *
990Sstevel@tonic-gate  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1000Sstevel@tonic-gate  * software or system incorporating such software without first obtaining any
1010Sstevel@tonic-gate  * required license or other approval from the U. S. Department of Commerce or
1020Sstevel@tonic-gate  * any other agency or department of the United States Government.  In the
1030Sstevel@tonic-gate  * event Licensee exports any such software from the United States or
1040Sstevel@tonic-gate  * re-exports any such software from a foreign destination, Licensee shall
1050Sstevel@tonic-gate  * ensure that the distribution and export/re-export of the software is in
1060Sstevel@tonic-gate  * compliance with all laws, regulations, orders, or other restrictions of the
1070Sstevel@tonic-gate  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1080Sstevel@tonic-gate  * any of its subsidiaries will export/re-export any technical data, process,
1090Sstevel@tonic-gate  * software, or service, directly or indirectly, to any country for which the
1100Sstevel@tonic-gate  * United States government or any agency thereof requires an export license,
1110Sstevel@tonic-gate  * other governmental approval, or letter of assurance, without first obtaining
1120Sstevel@tonic-gate  * such license, approval or letter.
1130Sstevel@tonic-gate  *
1140Sstevel@tonic-gate  *****************************************************************************/
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate #ifndef __ACLOCAL_H__
1170Sstevel@tonic-gate #define __ACLOCAL_H__
1180Sstevel@tonic-gate 
1199980SDana.Myers@Sun.COM 
1202623Smyers /* acpisrc:StructDefs -- for acpisrc conversion */
1210Sstevel@tonic-gate 
1222623Smyers #define ACPI_SERIALIZED                 0xFF
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate typedef UINT32                          ACPI_MUTEX_HANDLE;
1257851SDana.Myers@Sun.COM #define ACPI_GLOBAL_LOCK                (ACPI_SEMAPHORE) (-1)
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate /* Total number of aml opcodes defined */
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate #define AML_NUM_OPCODES                 0x7F
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate 
132347Smyers /* Forward declarations */
133347Smyers 
134347Smyers struct acpi_walk_state;
135347Smyers struct acpi_obj_mutex;
136347Smyers union acpi_parse_object;
137347Smyers 
138347Smyers 
1390Sstevel@tonic-gate /*****************************************************************************
1400Sstevel@tonic-gate  *
1410Sstevel@tonic-gate  * Mutex typedefs and structs
1420Sstevel@tonic-gate  *
1430Sstevel@tonic-gate  ****************************************************************************/
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate 
1460Sstevel@tonic-gate /*
1470Sstevel@tonic-gate  * Predefined handles for the mutex objects used within the subsystem
1480Sstevel@tonic-gate  * All mutex objects are automatically created by AcpiUtMutexInitialize.
1490Sstevel@tonic-gate  *
1502623Smyers  * The acquire/release ordering protocol is implied via this list. Mutexes
1510Sstevel@tonic-gate  * with a lower value must be acquired before mutexes with a higher value.
1520Sstevel@tonic-gate  *
1532623Smyers  * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
1542623Smyers  * table below also!
1550Sstevel@tonic-gate  */
1562623Smyers #define ACPI_MTX_INTERPRETER            0   /* AML Interpreter, main lock */
1577851SDana.Myers@Sun.COM #define ACPI_MTX_NAMESPACE              1   /* ACPI Namespace */
1587851SDana.Myers@Sun.COM #define ACPI_MTX_TABLES                 2   /* Data for ACPI tables */
1592623Smyers #define ACPI_MTX_EVENTS                 3   /* Data for ACPI events */
1602623Smyers #define ACPI_MTX_CACHES                 4   /* Internal caches, general purposes */
1612623Smyers #define ACPI_MTX_MEMORY                 5   /* Debug memory tracking lists */
1622623Smyers #define ACPI_MTX_DEBUG_CMD_COMPLETE     6   /* AML debugger */
1632623Smyers #define ACPI_MTX_DEBUG_CMD_READY        7   /* AML debugger */
1640Sstevel@tonic-gate 
1652623Smyers #define ACPI_MAX_MUTEX                  7
1662623Smyers #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
1690Sstevel@tonic-gate #ifdef DEFINE_ACPI_GLOBALS
1700Sstevel@tonic-gate 
1712623Smyers /* Debug names for the mutexes above */
1720Sstevel@tonic-gate 
1732623Smyers static char                 *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
1740Sstevel@tonic-gate {
1750Sstevel@tonic-gate     "ACPI_MTX_Interpreter",
1767851SDana.Myers@Sun.COM     "ACPI_MTX_Namespace",
1770Sstevel@tonic-gate     "ACPI_MTX_Tables",
1780Sstevel@tonic-gate     "ACPI_MTX_Events",
1790Sstevel@tonic-gate     "ACPI_MTX_Caches",
1800Sstevel@tonic-gate     "ACPI_MTX_Memory",
1812623Smyers     "ACPI_MTX_CommandComplete",
1822623Smyers     "ACPI_MTX_CommandReady"
1830Sstevel@tonic-gate };
1840Sstevel@tonic-gate 
1850Sstevel@tonic-gate #endif
1860Sstevel@tonic-gate #endif
1870Sstevel@tonic-gate 
1889980SDana.Myers@Sun.COM /* Lock structure for reader/writer interfaces */
1899980SDana.Myers@Sun.COM 
1909980SDana.Myers@Sun.COM typedef struct acpi_rw_lock
1919980SDana.Myers@Sun.COM {
1929980SDana.Myers@Sun.COM     ACPI_MUTEX              WriterMutex;
1939980SDana.Myers@Sun.COM     ACPI_MUTEX              ReaderMutex;
1949980SDana.Myers@Sun.COM     UINT32                  NumReaders;
1959980SDana.Myers@Sun.COM 
1969980SDana.Myers@Sun.COM } ACPI_RW_LOCK;
1979980SDana.Myers@Sun.COM 
1980Sstevel@tonic-gate 
1992623Smyers /*
2002623Smyers  * Predefined handles for spinlocks used within the subsystem.
2012623Smyers  * These spinlocks are created by AcpiUtMutexInitialize
2022623Smyers  */
2032623Smyers #define ACPI_LOCK_GPES                  0
2042623Smyers #define ACPI_LOCK_HARDWARE              1
2052623Smyers 
2062623Smyers #define ACPI_MAX_LOCK                   1
2072623Smyers #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
2082623Smyers 
2092623Smyers 
210347Smyers /* This Thread ID means that the mutex is not in use (unlocked) */
211347Smyers 
2129980SDana.Myers@Sun.COM #define ACPI_MUTEX_NOT_ACQUIRED         (ACPI_THREAD_ID) -1
213347Smyers 
2140Sstevel@tonic-gate /* Table for the global mutexes */
2150Sstevel@tonic-gate 
2160Sstevel@tonic-gate typedef struct acpi_mutex_info
2170Sstevel@tonic-gate {
2182623Smyers     ACPI_MUTEX                      Mutex;
2192623Smyers     UINT32                          UseCount;
2202623Smyers     ACPI_THREAD_ID                  ThreadId;
2210Sstevel@tonic-gate 
2220Sstevel@tonic-gate } ACPI_MUTEX_INFO;
2230Sstevel@tonic-gate 
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate /* Lock flag parameter for various interfaces */
2260Sstevel@tonic-gate 
2270Sstevel@tonic-gate #define ACPI_MTX_DO_NOT_LOCK            0
2280Sstevel@tonic-gate #define ACPI_MTX_LOCK                   1
2290Sstevel@tonic-gate 
2300Sstevel@tonic-gate 
2310Sstevel@tonic-gate /* Field access granularities */
2320Sstevel@tonic-gate 
2330Sstevel@tonic-gate #define ACPI_FIELD_BYTE_GRANULARITY     1
2340Sstevel@tonic-gate #define ACPI_FIELD_WORD_GRANULARITY     2
2350Sstevel@tonic-gate #define ACPI_FIELD_DWORD_GRANULARITY    4
2360Sstevel@tonic-gate #define ACPI_FIELD_QWORD_GRANULARITY    8
2370Sstevel@tonic-gate 
2380Sstevel@tonic-gate 
2392623Smyers #define ACPI_ENTRY_NOT_FOUND            NULL
2402623Smyers 
2412623Smyers 
2420Sstevel@tonic-gate /*****************************************************************************
2430Sstevel@tonic-gate  *
2440Sstevel@tonic-gate  * Namespace typedefs and structs
2450Sstevel@tonic-gate  *
2460Sstevel@tonic-gate  ****************************************************************************/
2470Sstevel@tonic-gate 
2480Sstevel@tonic-gate /* Operational modes of the AML interpreter/scanner */
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate typedef enum
2510Sstevel@tonic-gate {
2522623Smyers     ACPI_IMODE_LOAD_PASS1           = 0x01,
2532623Smyers     ACPI_IMODE_LOAD_PASS2           = 0x02,
2547851SDana.Myers@Sun.COM     ACPI_IMODE_EXECUTE              = 0x03
2550Sstevel@tonic-gate 
2560Sstevel@tonic-gate } ACPI_INTERPRETER_MODE;
2570Sstevel@tonic-gate 
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate /*
2602623Smyers  * The Namespace Node describes a named object that appears in the AML.
2612623Smyers  * DescriptorType is used to differentiate between internal descriptors.
2620Sstevel@tonic-gate  *
2632623Smyers  * The node is optimized for both 32-bit and 64-bit platforms:
2642623Smyers  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
2652623Smyers  *
2662623Smyers  * Note: The DescriptorType and Type fields must appear in the identical
2672623Smyers  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
2682623Smyers  * structures.
2690Sstevel@tonic-gate  */
2700Sstevel@tonic-gate typedef struct acpi_namespace_node
2710Sstevel@tonic-gate {
2722623Smyers     union acpi_operand_object       *Object;        /* Interpreter object */
2732623Smyers     UINT8                           DescriptorType; /* Differentiate object descriptor types */
2742623Smyers     UINT8                           Type;           /* ACPI Type associated with this name */
2752623Smyers     UINT8                           Flags;          /* Miscellaneous flags */
2762623Smyers     ACPI_OWNER_ID                   OwnerId;        /* Node creator */
2772623Smyers     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
2782623Smyers     struct acpi_namespace_node      *Child;         /* First child */
2792623Smyers     struct acpi_namespace_node      *Peer;          /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
2800Sstevel@tonic-gate 
2812623Smyers     /*
2822623Smyers      * The following fields are used by the ASL compiler and disassembler only
2832623Smyers      */
2842623Smyers #ifdef ACPI_LARGE_NAMESPACE_NODE
2852623Smyers     union acpi_parse_object         *Op;
2862623Smyers     UINT32                          Value;
2872623Smyers     UINT32                          Length;
288347Smyers #endif
289347Smyers 
2900Sstevel@tonic-gate } ACPI_NAMESPACE_NODE;
2910Sstevel@tonic-gate 
2920Sstevel@tonic-gate 
2932623Smyers /* Namespace Node flags */
2940Sstevel@tonic-gate 
2952623Smyers #define ANOBJ_END_OF_PEER_LIST          0x01    /* End-of-list, Peer field points to parent */
2967851SDana.Myers@Sun.COM #define ANOBJ_TEMPORARY                 0x02    /* Node is create by a method and is temporary */
2972623Smyers #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
2982623Smyers #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
2992623Smyers #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
3009980SDana.Myers@Sun.COM #define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
3019980SDana.Myers@Sun.COM #define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
3022623Smyers 
3032623Smyers #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
3042623Smyers #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
3052623Smyers #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
3062623Smyers #define ANOBJ_IS_BIT_OFFSET             0x40    /* iASL only: Reference is a bit offset */
3072623Smyers #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
3080Sstevel@tonic-gate 
3097851SDana.Myers@Sun.COM 
3107851SDana.Myers@Sun.COM /* One internal RSDT for table management */
3117851SDana.Myers@Sun.COM 
3127851SDana.Myers@Sun.COM typedef struct acpi_internal_rsdt
3130Sstevel@tonic-gate {
3147851SDana.Myers@Sun.COM     ACPI_TABLE_DESC                 *Tables;
3152623Smyers     UINT32                          Count;
3167851SDana.Myers@Sun.COM     UINT32                          Size;
3177851SDana.Myers@Sun.COM     UINT8                           Flags;
3180Sstevel@tonic-gate 
3197851SDana.Myers@Sun.COM } ACPI_INTERNAL_RSDT;
3207851SDana.Myers@Sun.COM 
3217851SDana.Myers@Sun.COM /* Flags for above */
3227851SDana.Myers@Sun.COM 
3237851SDana.Myers@Sun.COM #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)     /* ~ORIGIN_ALLOCATED */
3247851SDana.Myers@Sun.COM #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
3257851SDana.Myers@Sun.COM #define ACPI_ROOT_ALLOW_RESIZE          (2)
3267851SDana.Myers@Sun.COM 
3277851SDana.Myers@Sun.COM 
3287851SDana.Myers@Sun.COM /* Predefined (fixed) table indexes */
3297851SDana.Myers@Sun.COM 
3307851SDana.Myers@Sun.COM #define ACPI_TABLE_INDEX_DSDT           (0)
3317851SDana.Myers@Sun.COM #define ACPI_TABLE_INDEX_FACS           (1)
3320Sstevel@tonic-gate 
3330Sstevel@tonic-gate 
3340Sstevel@tonic-gate typedef struct acpi_find_context
3350Sstevel@tonic-gate {
3362623Smyers     char                            *SearchFor;
3372623Smyers     ACPI_HANDLE                     *List;
3382623Smyers     UINT32                          *Count;
3390Sstevel@tonic-gate 
3400Sstevel@tonic-gate } ACPI_FIND_CONTEXT;
3410Sstevel@tonic-gate 
3420Sstevel@tonic-gate 
3430Sstevel@tonic-gate typedef struct acpi_ns_search_data
3440Sstevel@tonic-gate {
3452623Smyers     ACPI_NAMESPACE_NODE             *Node;
3460Sstevel@tonic-gate 
3470Sstevel@tonic-gate } ACPI_NS_SEARCH_DATA;
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate 
3500Sstevel@tonic-gate /* Object types used during package copies */
3510Sstevel@tonic-gate 
3520Sstevel@tonic-gate #define ACPI_COPY_TYPE_SIMPLE           0
3530Sstevel@tonic-gate #define ACPI_COPY_TYPE_PACKAGE          1
3540Sstevel@tonic-gate 
3552623Smyers 
3560Sstevel@tonic-gate /* Info structure used to convert external<->internal namestrings */
3570Sstevel@tonic-gate 
3580Sstevel@tonic-gate typedef struct acpi_namestring_info
3590Sstevel@tonic-gate {
3607851SDana.Myers@Sun.COM     const char                      *ExternalName;
3617851SDana.Myers@Sun.COM     const char                      *NextExternalChar;
3622623Smyers     char                            *InternalName;
3632623Smyers     UINT32                          Length;
3642623Smyers     UINT32                          NumSegments;
3652623Smyers     UINT32                          NumCarats;
3662623Smyers     BOOLEAN                         FullyQualified;
3670Sstevel@tonic-gate 
3680Sstevel@tonic-gate } ACPI_NAMESTRING_INFO;
3690Sstevel@tonic-gate 
3700Sstevel@tonic-gate 
3710Sstevel@tonic-gate /* Field creation info */
3720Sstevel@tonic-gate 
3730Sstevel@tonic-gate typedef struct acpi_create_field_info
3740Sstevel@tonic-gate {
3752623Smyers     ACPI_NAMESPACE_NODE             *RegionNode;
3762623Smyers     ACPI_NAMESPACE_NODE             *FieldNode;
3772623Smyers     ACPI_NAMESPACE_NODE             *RegisterNode;
3782623Smyers     ACPI_NAMESPACE_NODE             *DataRegisterNode;
3792623Smyers     UINT32                          BankValue;
3802623Smyers     UINT32                          FieldBitPosition;
3812623Smyers     UINT32                          FieldBitLength;
3822623Smyers     UINT8                           FieldFlags;
3832623Smyers     UINT8                           Attribute;
3842623Smyers     UINT8                           FieldType;
3850Sstevel@tonic-gate 
3860Sstevel@tonic-gate } ACPI_CREATE_FIELD_INFO;
3870Sstevel@tonic-gate 
3880Sstevel@tonic-gate 
3892623Smyers typedef
3902623Smyers ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
3912623Smyers     struct acpi_walk_state          *WalkState);
3922623Smyers 
3932623Smyers 
3941560Smyers /*
3951560Smyers  * Bitmapped ACPI types.  Used internally only
3961560Smyers  */
3971560Smyers #define ACPI_BTYPE_ANY                  0x00000000
3981560Smyers #define ACPI_BTYPE_INTEGER              0x00000001
3991560Smyers #define ACPI_BTYPE_STRING               0x00000002
4001560Smyers #define ACPI_BTYPE_BUFFER               0x00000004
4011560Smyers #define ACPI_BTYPE_PACKAGE              0x00000008
4021560Smyers #define ACPI_BTYPE_FIELD_UNIT           0x00000010
4031560Smyers #define ACPI_BTYPE_DEVICE               0x00000020
4041560Smyers #define ACPI_BTYPE_EVENT                0x00000040
4051560Smyers #define ACPI_BTYPE_METHOD               0x00000080
4061560Smyers #define ACPI_BTYPE_MUTEX                0x00000100
4071560Smyers #define ACPI_BTYPE_REGION               0x00000200
4081560Smyers #define ACPI_BTYPE_POWER                0x00000400
4091560Smyers #define ACPI_BTYPE_PROCESSOR            0x00000800
4101560Smyers #define ACPI_BTYPE_THERMAL              0x00001000
4111560Smyers #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
4121560Smyers #define ACPI_BTYPE_DDB_HANDLE           0x00004000
4131560Smyers #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
4141560Smyers #define ACPI_BTYPE_REFERENCE            0x00010000
4151560Smyers #define ACPI_BTYPE_RESOURCE             0x00020000
4161560Smyers 
4171560Smyers #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
4181560Smyers 
4191560Smyers #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
4201560Smyers #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
4211560Smyers #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
4221560Smyers #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
4231560Smyers #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
4241560Smyers 
4251560Smyers 
4269980SDana.Myers@Sun.COM /*
4279980SDana.Myers@Sun.COM  * Information structure for ACPI predefined names.
4289980SDana.Myers@Sun.COM  * Each entry in the table contains the following items:
4299980SDana.Myers@Sun.COM  *
4309980SDana.Myers@Sun.COM  * Name                 - The ACPI reserved name
4319980SDana.Myers@Sun.COM  * ParamCount           - Number of arguments to the method
4329980SDana.Myers@Sun.COM  * ExpectedReturnBtypes - Allowed type(s) for the return value
4339980SDana.Myers@Sun.COM  */
4349980SDana.Myers@Sun.COM typedef struct acpi_name_info
4359980SDana.Myers@Sun.COM {
4369980SDana.Myers@Sun.COM     char                        Name[ACPI_NAME_SIZE];
4379980SDana.Myers@Sun.COM     UINT8                       ParamCount;
4389980SDana.Myers@Sun.COM     UINT8                       ExpectedBtypes;
4399980SDana.Myers@Sun.COM 
4409980SDana.Myers@Sun.COM } ACPI_NAME_INFO;
4419980SDana.Myers@Sun.COM 
4429980SDana.Myers@Sun.COM /*
4439980SDana.Myers@Sun.COM  * Secondary information structures for ACPI predefined objects that return
4449980SDana.Myers@Sun.COM  * package objects. This structure appears as the next entry in the table
4459980SDana.Myers@Sun.COM  * after the NAME_INFO structure above.
4469980SDana.Myers@Sun.COM  *
4479980SDana.Myers@Sun.COM  * The reason for this is to minimize the size of the predefined name table.
4489980SDana.Myers@Sun.COM  */
4499980SDana.Myers@Sun.COM 
4509980SDana.Myers@Sun.COM /*
4519980SDana.Myers@Sun.COM  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
4529980SDana.Myers@Sun.COM  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
4539980SDana.Myers@Sun.COM  */
4549980SDana.Myers@Sun.COM typedef struct acpi_package_info
4559980SDana.Myers@Sun.COM {
4569980SDana.Myers@Sun.COM     UINT8                       Type;
4579980SDana.Myers@Sun.COM     UINT8                       ObjectType1;
4589980SDana.Myers@Sun.COM     UINT8                       Count1;
4599980SDana.Myers@Sun.COM     UINT8                       ObjectType2;
4609980SDana.Myers@Sun.COM     UINT8                       Count2;
4619980SDana.Myers@Sun.COM     UINT8                       Reserved;
4629980SDana.Myers@Sun.COM 
4639980SDana.Myers@Sun.COM } ACPI_PACKAGE_INFO;
4649980SDana.Myers@Sun.COM 
4659980SDana.Myers@Sun.COM /* Used for ACPI_PTYPE2_FIXED */
4669980SDana.Myers@Sun.COM 
4679980SDana.Myers@Sun.COM typedef struct acpi_package_info2
4689980SDana.Myers@Sun.COM {
4699980SDana.Myers@Sun.COM     UINT8                       Type;
4709980SDana.Myers@Sun.COM     UINT8                       Count;
4719980SDana.Myers@Sun.COM     UINT8                       ObjectType[4];
4729980SDana.Myers@Sun.COM 
4739980SDana.Myers@Sun.COM } ACPI_PACKAGE_INFO2;
4749980SDana.Myers@Sun.COM 
4759980SDana.Myers@Sun.COM /* Used for ACPI_PTYPE1_OPTION */
4769980SDana.Myers@Sun.COM 
4779980SDana.Myers@Sun.COM typedef struct acpi_package_info3
4789980SDana.Myers@Sun.COM {
4799980SDana.Myers@Sun.COM     UINT8                       Type;
4809980SDana.Myers@Sun.COM     UINT8                       Count;
4819980SDana.Myers@Sun.COM     UINT8                       ObjectType[2];
4829980SDana.Myers@Sun.COM     UINT8                       TailObjectType;
4839980SDana.Myers@Sun.COM     UINT8                       Reserved;
4849980SDana.Myers@Sun.COM 
4859980SDana.Myers@Sun.COM } ACPI_PACKAGE_INFO3;
4869980SDana.Myers@Sun.COM 
4879980SDana.Myers@Sun.COM typedef union acpi_predefined_info
4889980SDana.Myers@Sun.COM {
4899980SDana.Myers@Sun.COM     ACPI_NAME_INFO              Info;
4909980SDana.Myers@Sun.COM     ACPI_PACKAGE_INFO           RetInfo;
4919980SDana.Myers@Sun.COM     ACPI_PACKAGE_INFO2          RetInfo2;
4929980SDana.Myers@Sun.COM     ACPI_PACKAGE_INFO3          RetInfo3;
4939980SDana.Myers@Sun.COM 
4949980SDana.Myers@Sun.COM } ACPI_PREDEFINED_INFO;
4959980SDana.Myers@Sun.COM 
496*11225SDana.Myers@Sun.COM 
497*11225SDana.Myers@Sun.COM /* Data block used during object validation */
498*11225SDana.Myers@Sun.COM 
499*11225SDana.Myers@Sun.COM typedef struct acpi_predefined_data
500*11225SDana.Myers@Sun.COM {
501*11225SDana.Myers@Sun.COM     char                        *Pathname;
502*11225SDana.Myers@Sun.COM     const ACPI_PREDEFINED_INFO  *Predefined;
503*11225SDana.Myers@Sun.COM     UINT32                      Flags;
504*11225SDana.Myers@Sun.COM     UINT8                       NodeFlags;
505*11225SDana.Myers@Sun.COM 
506*11225SDana.Myers@Sun.COM } ACPI_PREDEFINED_DATA;
507*11225SDana.Myers@Sun.COM 
508*11225SDana.Myers@Sun.COM /* Defines for Flags field above */
509*11225SDana.Myers@Sun.COM 
510*11225SDana.Myers@Sun.COM #define ACPI_OBJECT_REPAIRED    1
511*11225SDana.Myers@Sun.COM 
512*11225SDana.Myers@Sun.COM 
5139980SDana.Myers@Sun.COM /*
5149980SDana.Myers@Sun.COM  * Bitmapped return value types
5159980SDana.Myers@Sun.COM  * Note: the actual data types must be contiguous, a loop in nspredef.c
5169980SDana.Myers@Sun.COM  * depends on this.
5179980SDana.Myers@Sun.COM  */
5189980SDana.Myers@Sun.COM #define ACPI_RTYPE_ANY                  0x00
5199980SDana.Myers@Sun.COM #define ACPI_RTYPE_NONE                 0x01
5209980SDana.Myers@Sun.COM #define ACPI_RTYPE_INTEGER              0x02
5219980SDana.Myers@Sun.COM #define ACPI_RTYPE_STRING               0x04
5229980SDana.Myers@Sun.COM #define ACPI_RTYPE_BUFFER               0x08
5239980SDana.Myers@Sun.COM #define ACPI_RTYPE_PACKAGE              0x10
5249980SDana.Myers@Sun.COM #define ACPI_RTYPE_REFERENCE            0x20
5259980SDana.Myers@Sun.COM #define ACPI_RTYPE_ALL                  0x3F
5269980SDana.Myers@Sun.COM 
5279980SDana.Myers@Sun.COM #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
5289980SDana.Myers@Sun.COM 
5299980SDana.Myers@Sun.COM 
5300Sstevel@tonic-gate /*****************************************************************************
5310Sstevel@tonic-gate  *
5320Sstevel@tonic-gate  * Event typedefs and structs
5330Sstevel@tonic-gate  *
5340Sstevel@tonic-gate  ****************************************************************************/
5350Sstevel@tonic-gate 
5360Sstevel@tonic-gate /* Dispatch info for each GPE -- either a method or handler, cannot be both */
5370Sstevel@tonic-gate 
5380Sstevel@tonic-gate typedef struct acpi_handler_info
5390Sstevel@tonic-gate {
5400Sstevel@tonic-gate     ACPI_EVENT_HANDLER              Address;        /* Address of handler, if any */
5410Sstevel@tonic-gate     void                            *Context;       /* Context to be passed to handler */
5420Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
5430Sstevel@tonic-gate 
5440Sstevel@tonic-gate } ACPI_HANDLER_INFO;
5450Sstevel@tonic-gate 
5460Sstevel@tonic-gate typedef union acpi_gpe_dispatch_info
5470Sstevel@tonic-gate {
5480Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
5490Sstevel@tonic-gate     struct acpi_handler_info        *Handler;
5500Sstevel@tonic-gate 
5510Sstevel@tonic-gate } ACPI_GPE_DISPATCH_INFO;
5520Sstevel@tonic-gate 
5530Sstevel@tonic-gate /*
5540Sstevel@tonic-gate  * Information about a GPE, one per each GPE in an array.
5550Sstevel@tonic-gate  * NOTE: Important to keep this struct as small as possible.
5560Sstevel@tonic-gate  */
5570Sstevel@tonic-gate typedef struct acpi_gpe_event_info
5580Sstevel@tonic-gate {
5590Sstevel@tonic-gate     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method or Handler */
5600Sstevel@tonic-gate     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
5610Sstevel@tonic-gate     UINT8                           Flags;          /* Misc info about this GPE */
5627851SDana.Myers@Sun.COM     UINT8                           GpeNumber;      /* This GPE */
5630Sstevel@tonic-gate 
5640Sstevel@tonic-gate } ACPI_GPE_EVENT_INFO;
5650Sstevel@tonic-gate 
5660Sstevel@tonic-gate /* Information about a GPE register pair, one per each status/enable pair in an array */
5670Sstevel@tonic-gate 
5680Sstevel@tonic-gate typedef struct acpi_gpe_register_info
5690Sstevel@tonic-gate {
5700Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
5710Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
5720Sstevel@tonic-gate     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
5730Sstevel@tonic-gate     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
5740Sstevel@tonic-gate     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
5750Sstevel@tonic-gate 
5760Sstevel@tonic-gate } ACPI_GPE_REGISTER_INFO;
5770Sstevel@tonic-gate 
5780Sstevel@tonic-gate /*
5790Sstevel@tonic-gate  * Information about a GPE register block, one per each installed block --
5800Sstevel@tonic-gate  * GPE0, GPE1, and one per each installed GPE Block Device.
5810Sstevel@tonic-gate  */
5820Sstevel@tonic-gate typedef struct acpi_gpe_block_info
5830Sstevel@tonic-gate {
5840Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *Node;
5850Sstevel@tonic-gate     struct acpi_gpe_block_info      *Previous;
5860Sstevel@tonic-gate     struct acpi_gpe_block_info      *Next;
5870Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
5880Sstevel@tonic-gate     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
5890Sstevel@tonic-gate     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
5900Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            BlockAddress;   /* Base address of the block */
5910Sstevel@tonic-gate     UINT32                          RegisterCount;  /* Number of register pairs in block */
5920Sstevel@tonic-gate     UINT8                           BlockBaseNumber;/* Base GPE number for this block */
5930Sstevel@tonic-gate 
5940Sstevel@tonic-gate } ACPI_GPE_BLOCK_INFO;
5950Sstevel@tonic-gate 
5960Sstevel@tonic-gate /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
5970Sstevel@tonic-gate 
5980Sstevel@tonic-gate typedef struct acpi_gpe_xrupt_info
5990Sstevel@tonic-gate {
6000Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *Previous;
6010Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *Next;
6020Sstevel@tonic-gate     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
603347Smyers     UINT32                          InterruptNumber;    /* System interrupt number */
6040Sstevel@tonic-gate 
6050Sstevel@tonic-gate } ACPI_GPE_XRUPT_INFO;
6060Sstevel@tonic-gate 
6070Sstevel@tonic-gate typedef struct acpi_gpe_walk_info
6080Sstevel@tonic-gate {
6090Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *GpeDevice;
6100Sstevel@tonic-gate     ACPI_GPE_BLOCK_INFO             *GpeBlock;
6110Sstevel@tonic-gate 
6120Sstevel@tonic-gate } ACPI_GPE_WALK_INFO;
6130Sstevel@tonic-gate 
6149980SDana.Myers@Sun.COM typedef struct acpi_gpe_device_info
6159980SDana.Myers@Sun.COM {
6169980SDana.Myers@Sun.COM     UINT32                          Index;
6179980SDana.Myers@Sun.COM     UINT32                          NextBlockBaseIndex;
6189980SDana.Myers@Sun.COM     ACPI_STATUS                     Status;
6199980SDana.Myers@Sun.COM     ACPI_NAMESPACE_NODE             *GpeDevice;
6209980SDana.Myers@Sun.COM 
6219980SDana.Myers@Sun.COM } ACPI_GPE_DEVICE_INFO;
6220Sstevel@tonic-gate 
6230Sstevel@tonic-gate typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
6242623Smyers     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
6259980SDana.Myers@Sun.COM     ACPI_GPE_BLOCK_INFO             *GpeBlock,
6269980SDana.Myers@Sun.COM     void                            *Context);
6270Sstevel@tonic-gate 
6280Sstevel@tonic-gate 
6290Sstevel@tonic-gate /* Information about each particular fixed event */
6300Sstevel@tonic-gate 
6310Sstevel@tonic-gate typedef struct acpi_fixed_event_handler
6320Sstevel@tonic-gate {
6332623Smyers     ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
6342623Smyers     void                            *Context;       /* Context to be passed to handler */
6350Sstevel@tonic-gate 
6360Sstevel@tonic-gate } ACPI_FIXED_EVENT_HANDLER;
6370Sstevel@tonic-gate 
6380Sstevel@tonic-gate typedef struct acpi_fixed_event_info
6390Sstevel@tonic-gate {
6402623Smyers     UINT8                           StatusRegisterId;
6412623Smyers     UINT8                           EnableRegisterId;
6422623Smyers     UINT16                          StatusBitMask;
6432623Smyers     UINT16                          EnableBitMask;
6440Sstevel@tonic-gate 
6450Sstevel@tonic-gate } ACPI_FIXED_EVENT_INFO;
6460Sstevel@tonic-gate 
6470Sstevel@tonic-gate /* Information used during field processing */
6480Sstevel@tonic-gate 
6490Sstevel@tonic-gate typedef struct acpi_field_info
6500Sstevel@tonic-gate {
6512623Smyers     UINT8                           SkipField;
6522623Smyers     UINT8                           FieldFlag;
6532623Smyers     UINT32                          PkgLength;
6540Sstevel@tonic-gate 
6550Sstevel@tonic-gate } ACPI_FIELD_INFO;
6560Sstevel@tonic-gate 
6570Sstevel@tonic-gate 
6580Sstevel@tonic-gate /*****************************************************************************
6590Sstevel@tonic-gate  *
6600Sstevel@tonic-gate  * Generic "state" object for stacks
6610Sstevel@tonic-gate  *
6620Sstevel@tonic-gate  ****************************************************************************/
6630Sstevel@tonic-gate 
6640Sstevel@tonic-gate #define ACPI_CONTROL_NORMAL                  0xC0
6650Sstevel@tonic-gate #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
6660Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
6670Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
6680Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
6690Sstevel@tonic-gate 
6700Sstevel@tonic-gate 
6712623Smyers #define ACPI_STATE_COMMON \
6722623Smyers     void                            *Next; \
6732623Smyers     UINT8                           DescriptorType; /* To differentiate various internal objs */\
6742623Smyers     UINT8                           Flags; \
6752623Smyers     UINT16                          Value; \
6762623Smyers     UINT16                          State;
6772623Smyers 
6782623Smyers     /* There are 2 bytes available here until the next natural alignment boundary */
6790Sstevel@tonic-gate 
6800Sstevel@tonic-gate typedef struct acpi_common_state
6810Sstevel@tonic-gate {
6820Sstevel@tonic-gate     ACPI_STATE_COMMON
6830Sstevel@tonic-gate } ACPI_COMMON_STATE;
6840Sstevel@tonic-gate 
6850Sstevel@tonic-gate 
6860Sstevel@tonic-gate /*
6870Sstevel@tonic-gate  * Update state - used to traverse complex objects such as packages
6880Sstevel@tonic-gate  */
6890Sstevel@tonic-gate typedef struct acpi_update_state
6900Sstevel@tonic-gate {
6910Sstevel@tonic-gate     ACPI_STATE_COMMON
6922623Smyers     union acpi_operand_object       *Object;
6930Sstevel@tonic-gate 
6940Sstevel@tonic-gate } ACPI_UPDATE_STATE;
6950Sstevel@tonic-gate 
6960Sstevel@tonic-gate 
6970Sstevel@tonic-gate /*
6980Sstevel@tonic-gate  * Pkg state - used to traverse nested package structures
6990Sstevel@tonic-gate  */
7000Sstevel@tonic-gate typedef struct acpi_pkg_state
7010Sstevel@tonic-gate {
7020Sstevel@tonic-gate     ACPI_STATE_COMMON
7032623Smyers     UINT16                          Index;
7042623Smyers     union acpi_operand_object       *SourceObject;
7052623Smyers     union acpi_operand_object       *DestObject;
7062623Smyers     struct acpi_walk_state          *WalkState;
7072623Smyers     void                            *ThisTargetObj;
7082623Smyers     UINT32                          NumPackages;
7090Sstevel@tonic-gate 
7100Sstevel@tonic-gate } ACPI_PKG_STATE;
7110Sstevel@tonic-gate 
7120Sstevel@tonic-gate 
7130Sstevel@tonic-gate /*
7140Sstevel@tonic-gate  * Control state - one per if/else and while constructs.
7150Sstevel@tonic-gate  * Allows nesting of these constructs
7160Sstevel@tonic-gate  */
7170Sstevel@tonic-gate typedef struct acpi_control_state
7180Sstevel@tonic-gate {
7190Sstevel@tonic-gate     ACPI_STATE_COMMON
7202623Smyers     UINT16                          Opcode;
7212623Smyers     union acpi_parse_object         *PredicateOp;
7222623Smyers     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
7232623Smyers     UINT8                           *PackageEnd;            /* End of if/while block */
7249980SDana.Myers@Sun.COM     UINT32                          LoopCount;              /* While() loop counter */
7250Sstevel@tonic-gate 
7260Sstevel@tonic-gate } ACPI_CONTROL_STATE;
7270Sstevel@tonic-gate 
7280Sstevel@tonic-gate 
7290Sstevel@tonic-gate /*
7300Sstevel@tonic-gate  * Scope state - current scope during namespace lookups
7310Sstevel@tonic-gate  */
7320Sstevel@tonic-gate typedef struct acpi_scope_state
7330Sstevel@tonic-gate {
7340Sstevel@tonic-gate     ACPI_STATE_COMMON
7352623Smyers     ACPI_NAMESPACE_NODE             *Node;
7360Sstevel@tonic-gate 
7370Sstevel@tonic-gate } ACPI_SCOPE_STATE;
7380Sstevel@tonic-gate 
7390Sstevel@tonic-gate 
7400Sstevel@tonic-gate typedef struct acpi_pscope_state
7410Sstevel@tonic-gate {
7420Sstevel@tonic-gate     ACPI_STATE_COMMON
7432623Smyers     UINT32                          ArgCount;               /* Number of fixed arguments */
7442623Smyers     union acpi_parse_object         *Op;                    /* Current op being parsed */
7452623Smyers     UINT8                           *ArgEnd;                /* Current argument end */
7462623Smyers     UINT8                           *PkgEnd;                /* Current package end */
7472623Smyers     UINT32                          ArgList;                /* Next argument to parse */
7480Sstevel@tonic-gate 
7490Sstevel@tonic-gate } ACPI_PSCOPE_STATE;
7500Sstevel@tonic-gate 
7510Sstevel@tonic-gate 
7520Sstevel@tonic-gate /*
7530Sstevel@tonic-gate  * Thread state - one per thread across multiple walk states.  Multiple walk
7540Sstevel@tonic-gate  * states are created when there are nested control methods executing.
7550Sstevel@tonic-gate  */
7560Sstevel@tonic-gate typedef struct acpi_thread_state
7570Sstevel@tonic-gate {
7580Sstevel@tonic-gate     ACPI_STATE_COMMON
7592623Smyers     UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
7602623Smyers     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
7612623Smyers     union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
7622623Smyers     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
7630Sstevel@tonic-gate 
7640Sstevel@tonic-gate } ACPI_THREAD_STATE;
7650Sstevel@tonic-gate 
7660Sstevel@tonic-gate 
7670Sstevel@tonic-gate /*
7680Sstevel@tonic-gate  * Result values - used to accumulate the results of nested
7690Sstevel@tonic-gate  * AML arguments
7700Sstevel@tonic-gate  */
7710Sstevel@tonic-gate typedef struct acpi_result_values
7720Sstevel@tonic-gate {
7730Sstevel@tonic-gate     ACPI_STATE_COMMON
7747851SDana.Myers@Sun.COM     union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
7750Sstevel@tonic-gate 
7760Sstevel@tonic-gate } ACPI_RESULT_VALUES;
7770Sstevel@tonic-gate 
7780Sstevel@tonic-gate 
7790Sstevel@tonic-gate typedef
7800Sstevel@tonic-gate ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
7812623Smyers     struct acpi_walk_state          *WalkState,
7822623Smyers     union acpi_parse_object         **OutOp);
7830Sstevel@tonic-gate 
7840Sstevel@tonic-gate typedef
7850Sstevel@tonic-gate ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
7862623Smyers     struct acpi_walk_state          *WalkState);
7870Sstevel@tonic-gate 
7880Sstevel@tonic-gate 
7890Sstevel@tonic-gate /*
7900Sstevel@tonic-gate  * Notify info - used to pass info to the deferred notify
7910Sstevel@tonic-gate  * handler/dispatcher.
7920Sstevel@tonic-gate  */
7930Sstevel@tonic-gate typedef struct acpi_notify_info
7940Sstevel@tonic-gate {
7950Sstevel@tonic-gate     ACPI_STATE_COMMON
7962623Smyers     ACPI_NAMESPACE_NODE             *Node;
7972623Smyers     union acpi_operand_object       *HandlerObj;
7980Sstevel@tonic-gate 
7990Sstevel@tonic-gate } ACPI_NOTIFY_INFO;
8000Sstevel@tonic-gate 
8010Sstevel@tonic-gate 
8020Sstevel@tonic-gate /* Generic state is union of structs above */
8030Sstevel@tonic-gate 
8040Sstevel@tonic-gate typedef union acpi_generic_state
8050Sstevel@tonic-gate {
8062623Smyers     ACPI_COMMON_STATE               Common;
8072623Smyers     ACPI_CONTROL_STATE              Control;
8082623Smyers     ACPI_UPDATE_STATE               Update;
8092623Smyers     ACPI_SCOPE_STATE                Scope;
8102623Smyers     ACPI_PSCOPE_STATE               ParseScope;
8112623Smyers     ACPI_PKG_STATE                  Pkg;
8122623Smyers     ACPI_THREAD_STATE               Thread;
8132623Smyers     ACPI_RESULT_VALUES              Results;
8142623Smyers     ACPI_NOTIFY_INFO                Notify;
8150Sstevel@tonic-gate 
8160Sstevel@tonic-gate } ACPI_GENERIC_STATE;
8170Sstevel@tonic-gate 
8180Sstevel@tonic-gate 
8190Sstevel@tonic-gate /*****************************************************************************
8200Sstevel@tonic-gate  *
8210Sstevel@tonic-gate  * Interpreter typedefs and structs
8220Sstevel@tonic-gate  *
8230Sstevel@tonic-gate  ****************************************************************************/
8240Sstevel@tonic-gate 
8250Sstevel@tonic-gate typedef
8260Sstevel@tonic-gate ACPI_STATUS (*ACPI_EXECUTE_OP) (
8272623Smyers     struct acpi_walk_state          *WalkState);
8280Sstevel@tonic-gate 
8290Sstevel@tonic-gate 
8300Sstevel@tonic-gate /*****************************************************************************
8310Sstevel@tonic-gate  *
8320Sstevel@tonic-gate  * Parser typedefs and structs
8330Sstevel@tonic-gate  *
8340Sstevel@tonic-gate  ****************************************************************************/
8350Sstevel@tonic-gate 
8360Sstevel@tonic-gate /*
8370Sstevel@tonic-gate  * AML opcode, name, and argument layout
8380Sstevel@tonic-gate  */
8390Sstevel@tonic-gate typedef struct acpi_opcode_info
8400Sstevel@tonic-gate {
8410Sstevel@tonic-gate #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
8422623Smyers     char                            *Name;          /* Opcode name (disassembler/debug only) */
8430Sstevel@tonic-gate #endif
8442623Smyers     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
8452623Smyers     UINT32                          RuntimeArgs;    /* Interpret time arguments */
8462623Smyers     UINT16                          Flags;          /* Misc flags */
8472623Smyers     UINT8                           ObjectType;     /* Corresponding internal object type */
8482623Smyers     UINT8                           Class;          /* Opcode class */
8492623Smyers     UINT8                           Type;           /* Opcode type */
8500Sstevel@tonic-gate 
8510Sstevel@tonic-gate } ACPI_OPCODE_INFO;
8520Sstevel@tonic-gate 
8530Sstevel@tonic-gate typedef union acpi_parse_value
8540Sstevel@tonic-gate {
8552623Smyers     ACPI_INTEGER                    Integer;        /* Integer constant (Up to 64 bits) */
8562623Smyers     UINT64_STRUCT                   Integer64;      /* Structure overlay for 2 32-bit Dwords */
8572623Smyers     UINT32                          Size;           /* bytelist or field size */
8582623Smyers     char                            *String;        /* NULL terminated string */
8592623Smyers     UINT8                           *Buffer;        /* buffer or string */
8602623Smyers     char                            *Name;          /* NULL terminated string */
8612623Smyers     union acpi_parse_object         *Arg;           /* arguments and contained ops */
8620Sstevel@tonic-gate 
8630Sstevel@tonic-gate } ACPI_PARSE_VALUE;
8640Sstevel@tonic-gate 
8659980SDana.Myers@Sun.COM 
8669980SDana.Myers@Sun.COM #ifdef ACPI_DISASSEMBLER
8679980SDana.Myers@Sun.COM #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
8689980SDana.Myers@Sun.COM #else
8699980SDana.Myers@Sun.COM #define ACPI_DISASM_ONLY_MEMBERS(a)
8709980SDana.Myers@Sun.COM #endif
8719980SDana.Myers@Sun.COM 
8720Sstevel@tonic-gate #define ACPI_PARSE_COMMON \
8732623Smyers     union acpi_parse_object         *Parent;        /* Parent op */\
8742623Smyers     UINT8                           DescriptorType; /* To differentiate various internal objs */\
8752623Smyers     UINT8                           Flags;          /* Type of Op */\
8762623Smyers     UINT16                          AmlOpcode;      /* AML opcode */\
8772623Smyers     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
8782623Smyers     union acpi_parse_object         *Next;          /* Next op */\
8792623Smyers     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
8802623Smyers     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
8817851SDana.Myers@Sun.COM     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
8820Sstevel@tonic-gate     ACPI_DISASM_ONLY_MEMBERS (\
8832623Smyers     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
8842623Smyers     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
8852623Smyers     char                            AmlOpName[16])  /* Op name (debug only) */
8860Sstevel@tonic-gate 
8870Sstevel@tonic-gate 
8882623Smyers #define ACPI_DASM_BUFFER                0x00
8892623Smyers #define ACPI_DASM_RESOURCE              0x01
8902623Smyers #define ACPI_DASM_STRING                0x02
8912623Smyers #define ACPI_DASM_UNICODE               0x03
8922623Smyers #define ACPI_DASM_EISAID                0x04
8932623Smyers #define ACPI_DASM_MATCHOP               0x05
8942623Smyers #define ACPI_DASM_LNOT_PREFIX           0x06
8952623Smyers #define ACPI_DASM_LNOT_SUFFIX           0x07
8962623Smyers #define ACPI_DASM_IGNORE                0x08
8970Sstevel@tonic-gate 
8980Sstevel@tonic-gate /*
8992623Smyers  * Generic operation (for example:  If, While, Store)
9000Sstevel@tonic-gate  */
9010Sstevel@tonic-gate typedef struct acpi_parse_obj_common
9020Sstevel@tonic-gate {
9030Sstevel@tonic-gate     ACPI_PARSE_COMMON
9040Sstevel@tonic-gate } ACPI_PARSE_OBJ_COMMON;
9050Sstevel@tonic-gate 
9060Sstevel@tonic-gate 
9070Sstevel@tonic-gate /*
9080Sstevel@tonic-gate  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
9090Sstevel@tonic-gate  * and bytelists.
9100Sstevel@tonic-gate  */
9110Sstevel@tonic-gate typedef struct acpi_parse_obj_named
9120Sstevel@tonic-gate {
9130Sstevel@tonic-gate     ACPI_PARSE_COMMON
9142623Smyers     UINT8                           *Path;
9152623Smyers     UINT8                           *Data;          /* AML body or bytelist data */
9162623Smyers     UINT32                          Length;         /* AML length */
9172623Smyers     UINT32                          Name;           /* 4-byte name or zero if no name */
9180Sstevel@tonic-gate 
9190Sstevel@tonic-gate } ACPI_PARSE_OBJ_NAMED;
9200Sstevel@tonic-gate 
9210Sstevel@tonic-gate 
9222623Smyers /* This version is used by the iASL compiler only */
9230Sstevel@tonic-gate 
9241560Smyers #define ACPI_MAX_PARSEOP_NAME   20
9251560Smyers 
9260Sstevel@tonic-gate typedef struct acpi_parse_obj_asl
9270Sstevel@tonic-gate {
9280Sstevel@tonic-gate     ACPI_PARSE_COMMON
9292623Smyers     union acpi_parse_object         *Child;
9302623Smyers     union acpi_parse_object         *ParentMethod;
9312623Smyers     char                            *Filename;
9322623Smyers     char                            *ExternalName;
9332623Smyers     char                            *Namepath;
9342623Smyers     char                            NameSeg[4];
9352623Smyers     UINT32                          ExtraValue;
9362623Smyers     UINT32                          Column;
9372623Smyers     UINT32                          LineNumber;
9382623Smyers     UINT32                          LogicalLineNumber;
9392623Smyers     UINT32                          LogicalByteOffset;
9402623Smyers     UINT32                          EndLine;
9412623Smyers     UINT32                          EndLogicalLine;
9422623Smyers     UINT32                          AcpiBtype;
9432623Smyers     UINT32                          AmlLength;
9442623Smyers     UINT32                          AmlSubtreeLength;
9452623Smyers     UINT32                          FinalAmlLength;
9462623Smyers     UINT32                          FinalAmlOffset;
9472623Smyers     UINT32                          CompileFlags;
9482623Smyers     UINT16                          ParseOpcode;
9492623Smyers     UINT8                           AmlOpcodeLength;
9502623Smyers     UINT8                           AmlPkgLenBytes;
9512623Smyers     UINT8                           Extra;
9522623Smyers     char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
9530Sstevel@tonic-gate 
9540Sstevel@tonic-gate } ACPI_PARSE_OBJ_ASL;
9550Sstevel@tonic-gate 
9560Sstevel@tonic-gate typedef union acpi_parse_object
9570Sstevel@tonic-gate {
9582623Smyers     ACPI_PARSE_OBJ_COMMON           Common;
9592623Smyers     ACPI_PARSE_OBJ_NAMED            Named;
9602623Smyers     ACPI_PARSE_OBJ_ASL              Asl;
9610Sstevel@tonic-gate 
9620Sstevel@tonic-gate } ACPI_PARSE_OBJECT;
9630Sstevel@tonic-gate 
9640Sstevel@tonic-gate 
9650Sstevel@tonic-gate /*
9660Sstevel@tonic-gate  * Parse state - one state per parser invocation and each control
9670Sstevel@tonic-gate  * method.
9680Sstevel@tonic-gate  */
9690Sstevel@tonic-gate typedef struct acpi_parse_state
9700Sstevel@tonic-gate {
9712623Smyers     UINT8                           *AmlStart;      /* First AML byte */
9722623Smyers     UINT8                           *Aml;           /* Next AML byte */
9732623Smyers     UINT8                           *AmlEnd;        /* (last + 1) AML byte */
9742623Smyers     UINT8                           *PkgStart;      /* Current package begin */
9752623Smyers     UINT8                           *PkgEnd;        /* Current package end */
9762623Smyers     union acpi_parse_object         *StartOp;       /* Root of parse tree */
9772623Smyers     struct acpi_namespace_node      *StartNode;
9782623Smyers     union acpi_generic_state        *Scope;         /* Current scope */
9792623Smyers     union acpi_parse_object         *StartScope;
9802623Smyers     UINT32                          AmlSize;
9810Sstevel@tonic-gate 
9820Sstevel@tonic-gate } ACPI_PARSE_STATE;
9830Sstevel@tonic-gate 
9840Sstevel@tonic-gate 
9850Sstevel@tonic-gate /* Parse object flags */
9860Sstevel@tonic-gate 
9872623Smyers #define ACPI_PARSEOP_GENERIC            0x01
9882623Smyers #define ACPI_PARSEOP_NAMED              0x02
9892623Smyers #define ACPI_PARSEOP_DEFERRED           0x04
9902623Smyers #define ACPI_PARSEOP_BYTELIST           0x08
9917851SDana.Myers@Sun.COM #define ACPI_PARSEOP_IN_STACK           0x10
9927851SDana.Myers@Sun.COM #define ACPI_PARSEOP_TARGET             0x20
9932623Smyers #define ACPI_PARSEOP_IN_CACHE           0x80
9940Sstevel@tonic-gate 
9950Sstevel@tonic-gate /* Parse object DisasmFlags */
9960Sstevel@tonic-gate 
9972623Smyers #define ACPI_PARSEOP_IGNORE             0x01
9982623Smyers #define ACPI_PARSEOP_PARAMLIST          0x02
9992623Smyers #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
10002623Smyers #define ACPI_PARSEOP_SPECIAL            0x10
10010Sstevel@tonic-gate 
10020Sstevel@tonic-gate 
10030Sstevel@tonic-gate /*****************************************************************************
10040Sstevel@tonic-gate  *
10050Sstevel@tonic-gate  * Hardware (ACPI registers) and PNP
10060Sstevel@tonic-gate  *
10070Sstevel@tonic-gate  ****************************************************************************/
10080Sstevel@tonic-gate 
10090Sstevel@tonic-gate typedef struct acpi_bit_register_info
10100Sstevel@tonic-gate {
10112623Smyers     UINT8                           ParentRegister;
10122623Smyers     UINT8                           BitPosition;
10132623Smyers     UINT16                          AccessBitMask;
10140Sstevel@tonic-gate 
10150Sstevel@tonic-gate } ACPI_BIT_REGISTER_INFO;
10160Sstevel@tonic-gate 
10170Sstevel@tonic-gate 
10180Sstevel@tonic-gate /*
10192623Smyers  * Some ACPI registers have bits that must be ignored -- meaning that they
10202623Smyers  * must be preserved.
10212623Smyers  */
10222623Smyers #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
10239980SDana.Myers@Sun.COM 
10249980SDana.Myers@Sun.COM /* Write-only bits must be zeroed by software */
10259980SDana.Myers@Sun.COM 
10269980SDana.Myers@Sun.COM #define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004  /* Bits 13, 2 */
10279980SDana.Myers@Sun.COM 
10289980SDana.Myers@Sun.COM /* For control registers, both ignored and reserved bits must be preserved */
10292623Smyers 
10309980SDana.Myers@Sun.COM /*
10319980SDana.Myers@Sun.COM  * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
10329980SDana.Myers@Sun.COM  * ACPI specification to be a "preserved" bit - "OSPM always preserves this
10339980SDana.Myers@Sun.COM  * bit position", section 4.7.3.2.1. However, on some machines the OS must
10349980SDana.Myers@Sun.COM  * write a one to this bit after resume for the machine to work properly.
10359980SDana.Myers@Sun.COM  * To enable this, we no longer attempt to preserve this bit. No machines
10369980SDana.Myers@Sun.COM  * are known to fail if the bit is not preserved. (May 2009)
10379980SDana.Myers@Sun.COM  */
10389980SDana.Myers@Sun.COM #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200  /* Bit 9 */
10399980SDana.Myers@Sun.COM #define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8  /* Bits 14-15, 3-8 */
10409980SDana.Myers@Sun.COM #define ACPI_PM1_CONTROL_PRESERVED_BITS \
10419980SDana.Myers@Sun.COM          (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
10429980SDana.Myers@Sun.COM 
10439980SDana.Myers@Sun.COM #define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE /* All except bit 0 */
10442623Smyers 
10452623Smyers /*
10460Sstevel@tonic-gate  * Register IDs
10470Sstevel@tonic-gate  * These are the full ACPI registers
10480Sstevel@tonic-gate  */
10490Sstevel@tonic-gate #define ACPI_REGISTER_PM1_STATUS                0x01
10500Sstevel@tonic-gate #define ACPI_REGISTER_PM1_ENABLE                0x02
10510Sstevel@tonic-gate #define ACPI_REGISTER_PM1_CONTROL               0x03
10529980SDana.Myers@Sun.COM #define ACPI_REGISTER_PM2_CONTROL               0x04
10539980SDana.Myers@Sun.COM #define ACPI_REGISTER_PM_TIMER                  0x05
10549980SDana.Myers@Sun.COM #define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
10559980SDana.Myers@Sun.COM #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
10560Sstevel@tonic-gate 
10570Sstevel@tonic-gate 
10580Sstevel@tonic-gate /* Masks used to access the BitRegisters */
10590Sstevel@tonic-gate 
10600Sstevel@tonic-gate #define ACPI_BITMASK_TIMER_STATUS               0x0001
10610Sstevel@tonic-gate #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
10620Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
10630Sstevel@tonic-gate #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
10640Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
10650Sstevel@tonic-gate #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
10660Sstevel@tonic-gate #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
10670Sstevel@tonic-gate #define ACPI_BITMASK_WAKE_STATUS                0x8000
10680Sstevel@tonic-gate 
10692623Smyers #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
10702623Smyers     ACPI_BITMASK_TIMER_STATUS          | \
10712623Smyers     ACPI_BITMASK_BUS_MASTER_STATUS     | \
10722623Smyers     ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
10732623Smyers     ACPI_BITMASK_POWER_BUTTON_STATUS   | \
10742623Smyers     ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
10752623Smyers     ACPI_BITMASK_RT_CLOCK_STATUS       | \
10762623Smyers     ACPI_BITMASK_WAKE_STATUS)
10770Sstevel@tonic-gate 
10780Sstevel@tonic-gate #define ACPI_BITMASK_TIMER_ENABLE               0x0001
10790Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
10800Sstevel@tonic-gate #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
10810Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
10820Sstevel@tonic-gate #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
10830Sstevel@tonic-gate #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
10840Sstevel@tonic-gate 
10850Sstevel@tonic-gate #define ACPI_BITMASK_SCI_ENABLE                 0x0001
10860Sstevel@tonic-gate #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
10870Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
10889980SDana.Myers@Sun.COM #define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
10890Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
10900Sstevel@tonic-gate 
10910Sstevel@tonic-gate #define ACPI_BITMASK_ARB_DISABLE                0x0001
10920Sstevel@tonic-gate 
10930Sstevel@tonic-gate 
10940Sstevel@tonic-gate /* Raw bit position of each BitRegister */
10950Sstevel@tonic-gate 
10960Sstevel@tonic-gate #define ACPI_BITPOSITION_TIMER_STATUS           0x00
10970Sstevel@tonic-gate #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
10980Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
10990Sstevel@tonic-gate #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
11000Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
11010Sstevel@tonic-gate #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
11020Sstevel@tonic-gate #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
11030Sstevel@tonic-gate #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
11040Sstevel@tonic-gate 
11050Sstevel@tonic-gate #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
11060Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
11070Sstevel@tonic-gate #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
11080Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
11090Sstevel@tonic-gate #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
11100Sstevel@tonic-gate #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
11110Sstevel@tonic-gate 
11120Sstevel@tonic-gate #define ACPI_BITPOSITION_SCI_ENABLE             0x00
11130Sstevel@tonic-gate #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
11140Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
11159980SDana.Myers@Sun.COM #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
11160Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
11170Sstevel@tonic-gate 
11180Sstevel@tonic-gate #define ACPI_BITPOSITION_ARB_DISABLE            0x00
11190Sstevel@tonic-gate 
11200Sstevel@tonic-gate 
11219980SDana.Myers@Sun.COM /* Structs and definitions for _OSI support and I/O port validation */
11229980SDana.Myers@Sun.COM 
11239980SDana.Myers@Sun.COM #define ACPI_OSI_WIN_2000               0x01
11249980SDana.Myers@Sun.COM #define ACPI_OSI_WIN_XP                 0x02
11259980SDana.Myers@Sun.COM #define ACPI_OSI_WIN_XP_SP1             0x03
11269980SDana.Myers@Sun.COM #define ACPI_OSI_WINSRV_2003            0x04
11279980SDana.Myers@Sun.COM #define ACPI_OSI_WIN_XP_SP2             0x05
11289980SDana.Myers@Sun.COM #define ACPI_OSI_WINSRV_2003_SP1        0x06
11299980SDana.Myers@Sun.COM #define ACPI_OSI_WIN_VISTA              0x07
1130*11225SDana.Myers@Sun.COM #define ACPI_OSI_WINSRV_2008            0x08
1131*11225SDana.Myers@Sun.COM #define ACPI_OSI_WIN_VISTA_SP1          0x09
1132*11225SDana.Myers@Sun.COM #define ACPI_OSI_WIN_7                  0x0A
11339980SDana.Myers@Sun.COM 
11349980SDana.Myers@Sun.COM #define ACPI_ALWAYS_ILLEGAL             0x00
11359980SDana.Myers@Sun.COM 
11369980SDana.Myers@Sun.COM typedef struct acpi_interface_info
11379980SDana.Myers@Sun.COM {
11389980SDana.Myers@Sun.COM     char                    *Name;
11399980SDana.Myers@Sun.COM     UINT8                   Value;
11409980SDana.Myers@Sun.COM 
11419980SDana.Myers@Sun.COM } ACPI_INTERFACE_INFO;
11429980SDana.Myers@Sun.COM 
11439980SDana.Myers@Sun.COM typedef struct acpi_port_info
11449980SDana.Myers@Sun.COM {
11459980SDana.Myers@Sun.COM     char                    *Name;
11469980SDana.Myers@Sun.COM     UINT16                  Start;
11479980SDana.Myers@Sun.COM     UINT16                  End;
11489980SDana.Myers@Sun.COM     UINT8                   OsiDependency;
11499980SDana.Myers@Sun.COM 
11509980SDana.Myers@Sun.COM } ACPI_PORT_INFO;
11519980SDana.Myers@Sun.COM 
11529980SDana.Myers@Sun.COM 
11530Sstevel@tonic-gate /*****************************************************************************
11540Sstevel@tonic-gate  *
11550Sstevel@tonic-gate  * Resource descriptors
11560Sstevel@tonic-gate  *
11570Sstevel@tonic-gate  ****************************************************************************/
11580Sstevel@tonic-gate 
11590Sstevel@tonic-gate /* ResourceType values */
11600Sstevel@tonic-gate 
1161941Smyers #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
1162941Smyers #define ACPI_ADDRESS_TYPE_IO_RANGE              1
1163941Smyers #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
11640Sstevel@tonic-gate 
11650Sstevel@tonic-gate /* Resource descriptor types and masks */
11660Sstevel@tonic-gate 
1167941Smyers #define ACPI_RESOURCE_NAME_LARGE                0x80
1168941Smyers #define ACPI_RESOURCE_NAME_SMALL                0x00
11690Sstevel@tonic-gate 
1170941Smyers #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1171941Smyers #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1172941Smyers #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
11730Sstevel@tonic-gate 
11740Sstevel@tonic-gate 
11750Sstevel@tonic-gate /*
1176941Smyers  * Small resource descriptor "names" as defined by the ACPI specification.
1177941Smyers  * Note: Bits 2:0 are used for the descriptor length
11780Sstevel@tonic-gate  */
1179941Smyers #define ACPI_RESOURCE_NAME_IRQ                  0x20
1180941Smyers #define ACPI_RESOURCE_NAME_DMA                  0x28
1181941Smyers #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1182941Smyers #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1183941Smyers #define ACPI_RESOURCE_NAME_IO                   0x40
1184941Smyers #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1185941Smyers #define ACPI_RESOURCE_NAME_RESERVED_S1          0x50
1186941Smyers #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1187941Smyers #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1188941Smyers #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1189941Smyers #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1190941Smyers #define ACPI_RESOURCE_NAME_END_TAG              0x78
11910Sstevel@tonic-gate 
11920Sstevel@tonic-gate /*
1193941Smyers  * Large resource descriptor "names" as defined by the ACPI specification.
1194941Smyers  * Note: includes the Large Descriptor bit in bit[7]
11950Sstevel@tonic-gate  */
1196941Smyers #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1197941Smyers #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1198941Smyers #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1199941Smyers #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1200941Smyers #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1201941Smyers #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1202941Smyers #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1203941Smyers #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1204941Smyers #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1205941Smyers #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1206941Smyers #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1207941Smyers #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8B
12080Sstevel@tonic-gate 
12090Sstevel@tonic-gate 
12100Sstevel@tonic-gate /*****************************************************************************
12110Sstevel@tonic-gate  *
12120Sstevel@tonic-gate  * Miscellaneous
12130Sstevel@tonic-gate  *
12140Sstevel@tonic-gate  ****************************************************************************/
12150Sstevel@tonic-gate 
12162623Smyers #define ACPI_ASCII_ZERO                 0x30
12170Sstevel@tonic-gate 
12180Sstevel@tonic-gate 
12190Sstevel@tonic-gate /*****************************************************************************
12200Sstevel@tonic-gate  *
1221*11225SDana.Myers@Sun.COM  * Disassembler
1222*11225SDana.Myers@Sun.COM  *
1223*11225SDana.Myers@Sun.COM  ****************************************************************************/
1224*11225SDana.Myers@Sun.COM 
1225*11225SDana.Myers@Sun.COM typedef struct acpi_external_list
1226*11225SDana.Myers@Sun.COM {
1227*11225SDana.Myers@Sun.COM     char                        *Path;
1228*11225SDana.Myers@Sun.COM     char                        *InternalPath;
1229*11225SDana.Myers@Sun.COM     struct acpi_external_list   *Next;
1230*11225SDana.Myers@Sun.COM     UINT32                      Value;
1231*11225SDana.Myers@Sun.COM     UINT16                      Length;
1232*11225SDana.Myers@Sun.COM     UINT8                       Type;
1233*11225SDana.Myers@Sun.COM     UINT8                       Flags;
1234*11225SDana.Myers@Sun.COM 
1235*11225SDana.Myers@Sun.COM } ACPI_EXTERNAL_LIST;
1236*11225SDana.Myers@Sun.COM 
1237*11225SDana.Myers@Sun.COM /* Values for Flags field above */
1238*11225SDana.Myers@Sun.COM 
1239*11225SDana.Myers@Sun.COM #define ACPI_IPATH_ALLOCATED    0x01
1240*11225SDana.Myers@Sun.COM 
1241*11225SDana.Myers@Sun.COM 
1242*11225SDana.Myers@Sun.COM /*****************************************************************************
1243*11225SDana.Myers@Sun.COM  *
12440Sstevel@tonic-gate  * Debugger
12450Sstevel@tonic-gate  *
12460Sstevel@tonic-gate  ****************************************************************************/
12470Sstevel@tonic-gate 
12480Sstevel@tonic-gate typedef struct acpi_db_method_info
12490Sstevel@tonic-gate {
12507851SDana.Myers@Sun.COM     ACPI_HANDLE                     MainThreadGate;
12517851SDana.Myers@Sun.COM     ACPI_HANDLE                     ThreadCompleteGate;
12529980SDana.Myers@Sun.COM     ACPI_HANDLE                     InfoGate;
12537851SDana.Myers@Sun.COM     UINT32                          *Threads;
12547851SDana.Myers@Sun.COM     UINT32                          NumThreads;
12557851SDana.Myers@Sun.COM     UINT32                          NumCreated;
12567851SDana.Myers@Sun.COM     UINT32                          NumCompleted;
12577851SDana.Myers@Sun.COM 
12582623Smyers     char                            *Name;
12592623Smyers     UINT32                          Flags;
12602623Smyers     UINT32                          NumLoops;
12612623Smyers     char                            Pathname[128];
12627851SDana.Myers@Sun.COM     char                            **Args;
12637851SDana.Myers@Sun.COM 
12647851SDana.Myers@Sun.COM     /*
12657851SDana.Myers@Sun.COM      * Arguments to be passed to method for the command
12667851SDana.Myers@Sun.COM      * Threads -
12677851SDana.Myers@Sun.COM      *   the Number of threads, ID of current thread and
12687851SDana.Myers@Sun.COM      *   Index of current thread inside all them created.
12697851SDana.Myers@Sun.COM      */
12707851SDana.Myers@Sun.COM     char                            InitArgs;
12717851SDana.Myers@Sun.COM     char                            *Arguments[4];
12727851SDana.Myers@Sun.COM     char                            NumThreadsStr[11];
12737851SDana.Myers@Sun.COM     char                            IdOfThreadStr[11];
12747851SDana.Myers@Sun.COM     char                            IndexOfThreadStr[11];
12750Sstevel@tonic-gate 
12760Sstevel@tonic-gate } ACPI_DB_METHOD_INFO;
12770Sstevel@tonic-gate 
12780Sstevel@tonic-gate typedef struct acpi_integrity_info
12790Sstevel@tonic-gate {
12802623Smyers     UINT32                          Nodes;
12812623Smyers     UINT32                          Objects;
12820Sstevel@tonic-gate 
12830Sstevel@tonic-gate } ACPI_INTEGRITY_INFO;
12840Sstevel@tonic-gate 
12850Sstevel@tonic-gate 
12862623Smyers #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
12872623Smyers #define ACPI_DB_CONSOLE_OUTPUT          0x02
12882623Smyers #define ACPI_DB_DUPLICATE_OUTPUT        0x03
12890Sstevel@tonic-gate 
12900Sstevel@tonic-gate 
12910Sstevel@tonic-gate /*****************************************************************************
12920Sstevel@tonic-gate  *
12930Sstevel@tonic-gate  * Debug
12940Sstevel@tonic-gate  *
12950Sstevel@tonic-gate  ****************************************************************************/
12960Sstevel@tonic-gate 
12970Sstevel@tonic-gate /* Entry for a memory allocation (debug only) */
12980Sstevel@tonic-gate 
12992623Smyers #define ACPI_MEM_MALLOC                 0
13002623Smyers #define ACPI_MEM_CALLOC                 1
13012623Smyers #define ACPI_MAX_MODULE_NAME            16
13020Sstevel@tonic-gate 
13030Sstevel@tonic-gate #define ACPI_COMMON_DEBUG_MEM_HEADER \
13042623Smyers     struct acpi_debug_mem_block     *Previous; \
13052623Smyers     struct acpi_debug_mem_block     *Next; \
13062623Smyers     UINT32                          Size; \
13072623Smyers     UINT32                          Component; \
13082623Smyers     UINT32                          Line; \
13092623Smyers     char                            Module[ACPI_MAX_MODULE_NAME]; \
13102623Smyers     UINT8                           AllocType;
13110Sstevel@tonic-gate 
13120Sstevel@tonic-gate typedef struct acpi_debug_mem_header
13130Sstevel@tonic-gate {
13140Sstevel@tonic-gate     ACPI_COMMON_DEBUG_MEM_HEADER
13150Sstevel@tonic-gate 
13160Sstevel@tonic-gate } ACPI_DEBUG_MEM_HEADER;
13170Sstevel@tonic-gate 
13180Sstevel@tonic-gate typedef struct acpi_debug_mem_block
13190Sstevel@tonic-gate {
13200Sstevel@tonic-gate     ACPI_COMMON_DEBUG_MEM_HEADER
13212623Smyers     UINT64                          UserSpace;
13220Sstevel@tonic-gate 
13230Sstevel@tonic-gate } ACPI_DEBUG_MEM_BLOCK;
13240Sstevel@tonic-gate 
13250Sstevel@tonic-gate 
13260Sstevel@tonic-gate #define ACPI_MEM_LIST_GLOBAL            0
13270Sstevel@tonic-gate #define ACPI_MEM_LIST_NSNODE            1
1328347Smyers #define ACPI_MEM_LIST_MAX               1
1329347Smyers #define ACPI_NUM_MEM_LISTS              2
13300Sstevel@tonic-gate 
13310Sstevel@tonic-gate 
13320Sstevel@tonic-gate #endif /* __ACLOCAL_H__ */
1333