xref: /illumos-gate/usr/src/uts/intel/sys/acpi/aclocal.h (revision 27f7c583)
17c478bd9Sstevel@tonic-gate /******************************************************************************
27c478bd9Sstevel@tonic-gate  *
37c478bd9Sstevel@tonic-gate  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4*27f7c583Smyers  *       $Revision: 1.237 $
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  *****************************************************************************/
77c478bd9Sstevel@tonic-gate 
87c478bd9Sstevel@tonic-gate /******************************************************************************
97c478bd9Sstevel@tonic-gate  *
107c478bd9Sstevel@tonic-gate  * 1. Copyright Notice
117c478bd9Sstevel@tonic-gate  *
1230082d0cSmyers  * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
137c478bd9Sstevel@tonic-gate  * All rights reserved.
147c478bd9Sstevel@tonic-gate  *
157c478bd9Sstevel@tonic-gate  * 2. License
167c478bd9Sstevel@tonic-gate  *
177c478bd9Sstevel@tonic-gate  * 2.1. This is your license from Intel Corp. under its intellectual property
187c478bd9Sstevel@tonic-gate  * rights.  You may have additional license terms from the party that provided
197c478bd9Sstevel@tonic-gate  * you this software, covering your right to use that party's intellectual
207c478bd9Sstevel@tonic-gate  * property rights.
217c478bd9Sstevel@tonic-gate  *
227c478bd9Sstevel@tonic-gate  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
237c478bd9Sstevel@tonic-gate  * copy of the source code appearing in this file ("Covered Code") an
247c478bd9Sstevel@tonic-gate  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
257c478bd9Sstevel@tonic-gate  * base code distributed originally by Intel ("Original Intel Code") to copy,
267c478bd9Sstevel@tonic-gate  * make derivatives, distribute, use and display any portion of the Covered
277c478bd9Sstevel@tonic-gate  * Code in any form, with the right to sublicense such rights; and
287c478bd9Sstevel@tonic-gate  *
297c478bd9Sstevel@tonic-gate  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
307c478bd9Sstevel@tonic-gate  * license (with the right to sublicense), under only those claims of Intel
317c478bd9Sstevel@tonic-gate  * patents that are infringed by the Original Intel Code, to make, use, sell,
327c478bd9Sstevel@tonic-gate  * offer to sell, and import the Covered Code and derivative works thereof
337c478bd9Sstevel@tonic-gate  * solely to the minimum extent necessary to exercise the above copyright
347c478bd9Sstevel@tonic-gate  * license, and in no event shall the patent license extend to any additions
357c478bd9Sstevel@tonic-gate  * to or modifications of the Original Intel Code.  No other license or right
367c478bd9Sstevel@tonic-gate  * is granted directly or by implication, estoppel or otherwise;
377c478bd9Sstevel@tonic-gate  *
387c478bd9Sstevel@tonic-gate  * The above copyright and patent license is granted only if the following
397c478bd9Sstevel@tonic-gate  * conditions are met:
407c478bd9Sstevel@tonic-gate  *
417c478bd9Sstevel@tonic-gate  * 3. Conditions
427c478bd9Sstevel@tonic-gate  *
437c478bd9Sstevel@tonic-gate  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
447c478bd9Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
457c478bd9Sstevel@tonic-gate  * Code or modification with rights to further distribute source must include
467c478bd9Sstevel@tonic-gate  * the above Copyright Notice, the above License, this list of Conditions,
477c478bd9Sstevel@tonic-gate  * and the following Disclaimer and Export Compliance provision.  In addition,
487c478bd9Sstevel@tonic-gate  * Licensee must cause all Covered Code to which Licensee contributes to
497c478bd9Sstevel@tonic-gate  * contain a file documenting the changes Licensee made to create that Covered
507c478bd9Sstevel@tonic-gate  * Code and the date of any change.  Licensee must include in that file the
517c478bd9Sstevel@tonic-gate  * documentation of any changes made by any predecessor Licensee.  Licensee
527c478bd9Sstevel@tonic-gate  * must include a prominent statement that the modification is derived,
537c478bd9Sstevel@tonic-gate  * directly or indirectly, from Original Intel Code.
547c478bd9Sstevel@tonic-gate  *
557c478bd9Sstevel@tonic-gate  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
567c478bd9Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
577c478bd9Sstevel@tonic-gate  * Code or modification without rights to further distribute source must
587c478bd9Sstevel@tonic-gate  * include the following Disclaimer and Export Compliance provision in the
597c478bd9Sstevel@tonic-gate  * documentation and/or other materials provided with distribution.  In
607c478bd9Sstevel@tonic-gate  * addition, Licensee may not authorize further sublicense of source of any
617c478bd9Sstevel@tonic-gate  * portion of the Covered Code, and must include terms to the effect that the
627c478bd9Sstevel@tonic-gate  * license from Licensee to its licensee is limited to the intellectual
637c478bd9Sstevel@tonic-gate  * property embodied in the software Licensee provides to its licensee, and
647c478bd9Sstevel@tonic-gate  * not to intellectual property embodied in modifications its licensee may
657c478bd9Sstevel@tonic-gate  * make.
667c478bd9Sstevel@tonic-gate  *
677c478bd9Sstevel@tonic-gate  * 3.3. Redistribution of Executable. Redistribution in executable form of any
687c478bd9Sstevel@tonic-gate  * substantial portion of the Covered Code or modification must reproduce the
697c478bd9Sstevel@tonic-gate  * above Copyright Notice, and the following Disclaimer and Export Compliance
707c478bd9Sstevel@tonic-gate  * provision in the documentation and/or other materials provided with the
717c478bd9Sstevel@tonic-gate  * distribution.
727c478bd9Sstevel@tonic-gate  *
737c478bd9Sstevel@tonic-gate  * 3.4. Intel retains all right, title, and interest in and to the Original
747c478bd9Sstevel@tonic-gate  * Intel Code.
757c478bd9Sstevel@tonic-gate  *
767c478bd9Sstevel@tonic-gate  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
777c478bd9Sstevel@tonic-gate  * Intel shall be used in advertising or otherwise to promote the sale, use or
787c478bd9Sstevel@tonic-gate  * other dealings in products derived from or relating to the Covered Code
797c478bd9Sstevel@tonic-gate  * without prior written authorization from Intel.
807c478bd9Sstevel@tonic-gate  *
817c478bd9Sstevel@tonic-gate  * 4. Disclaimer and Export Compliance
827c478bd9Sstevel@tonic-gate  *
837c478bd9Sstevel@tonic-gate  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
847c478bd9Sstevel@tonic-gate  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
857c478bd9Sstevel@tonic-gate  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
867c478bd9Sstevel@tonic-gate  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
877c478bd9Sstevel@tonic-gate  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
887c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
897c478bd9Sstevel@tonic-gate  * PARTICULAR PURPOSE.
907c478bd9Sstevel@tonic-gate  *
917c478bd9Sstevel@tonic-gate  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
927c478bd9Sstevel@tonic-gate  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
937c478bd9Sstevel@tonic-gate  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
947c478bd9Sstevel@tonic-gate  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
957c478bd9Sstevel@tonic-gate  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
967c478bd9Sstevel@tonic-gate  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
977c478bd9Sstevel@tonic-gate  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
987c478bd9Sstevel@tonic-gate  * LIMITED REMEDY.
997c478bd9Sstevel@tonic-gate  *
1007c478bd9Sstevel@tonic-gate  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1017c478bd9Sstevel@tonic-gate  * software or system incorporating such software without first obtaining any
1027c478bd9Sstevel@tonic-gate  * required license or other approval from the U. S. Department of Commerce or
1037c478bd9Sstevel@tonic-gate  * any other agency or department of the United States Government.  In the
1047c478bd9Sstevel@tonic-gate  * event Licensee exports any such software from the United States or
1057c478bd9Sstevel@tonic-gate  * re-exports any such software from a foreign destination, Licensee shall
1067c478bd9Sstevel@tonic-gate  * ensure that the distribution and export/re-export of the software is in
1077c478bd9Sstevel@tonic-gate  * compliance with all laws, regulations, orders, or other restrictions of the
1087c478bd9Sstevel@tonic-gate  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1097c478bd9Sstevel@tonic-gate  * any of its subsidiaries will export/re-export any technical data, process,
1107c478bd9Sstevel@tonic-gate  * software, or service, directly or indirectly, to any country for which the
1117c478bd9Sstevel@tonic-gate  * United States government or any agency thereof requires an export license,
1127c478bd9Sstevel@tonic-gate  * other governmental approval, or letter of assurance, without first obtaining
1137c478bd9Sstevel@tonic-gate  * such license, approval or letter.
1147c478bd9Sstevel@tonic-gate  *
1157c478bd9Sstevel@tonic-gate  *****************************************************************************/
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate #ifndef __ACLOCAL_H__
1187c478bd9Sstevel@tonic-gate #define __ACLOCAL_H__
1197c478bd9Sstevel@tonic-gate 
120*27f7c583Smyers /* acpisrc:StructDefs -- for acpisrc conversion */
1217c478bd9Sstevel@tonic-gate 
1227c478bd9Sstevel@tonic-gate #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
123*27f7c583Smyers #define ACPI_DO_NOT_WAIT                0
124*27f7c583Smyers #define ACPI_SERIALIZED                 0xFF
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate typedef UINT32                          ACPI_MUTEX_HANDLE;
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /* Total number of aml opcodes defined */
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate #define AML_NUM_OPCODES                 0x7F
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate 
133450d6964Smyers /* Forward declarations */
134450d6964Smyers 
135450d6964Smyers struct acpi_walk_state;
136450d6964Smyers struct acpi_obj_mutex;
137450d6964Smyers union acpi_parse_object;
138450d6964Smyers 
139450d6964Smyers 
1407c478bd9Sstevel@tonic-gate /*****************************************************************************
1417c478bd9Sstevel@tonic-gate  *
1427c478bd9Sstevel@tonic-gate  * Mutex typedefs and structs
1437c478bd9Sstevel@tonic-gate  *
1447c478bd9Sstevel@tonic-gate  ****************************************************************************/
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate 
1477c478bd9Sstevel@tonic-gate /*
1487c478bd9Sstevel@tonic-gate  * Predefined handles for the mutex objects used within the subsystem
1497c478bd9Sstevel@tonic-gate  * All mutex objects are automatically created by AcpiUtMutexInitialize.
1507c478bd9Sstevel@tonic-gate  *
151*27f7c583Smyers  * The acquire/release ordering protocol is implied via this list. Mutexes
1527c478bd9Sstevel@tonic-gate  * with a lower value must be acquired before mutexes with a higher value.
1537c478bd9Sstevel@tonic-gate  *
154*27f7c583Smyers  * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
155*27f7c583Smyers  * table below also!
1567c478bd9Sstevel@tonic-gate  */
157*27f7c583Smyers #define ACPI_MTX_INTERPRETER            0   /* AML Interpreter, main lock */
158*27f7c583Smyers #define ACPI_MTX_TABLES                 1   /* Data for ACPI tables */
159*27f7c583Smyers #define ACPI_MTX_NAMESPACE              2   /* ACPI Namespace */
160*27f7c583Smyers #define ACPI_MTX_EVENTS                 3   /* Data for ACPI events */
161*27f7c583Smyers #define ACPI_MTX_CACHES                 4   /* Internal caches, general purposes */
162*27f7c583Smyers #define ACPI_MTX_MEMORY                 5   /* Debug memory tracking lists */
163*27f7c583Smyers #define ACPI_MTX_DEBUG_CMD_COMPLETE     6   /* AML debugger */
164*27f7c583Smyers #define ACPI_MTX_DEBUG_CMD_READY        7   /* AML debugger */
165*27f7c583Smyers 
166*27f7c583Smyers #define ACPI_MAX_MUTEX                  7
167*27f7c583Smyers #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
1707c478bd9Sstevel@tonic-gate #ifdef DEFINE_ACPI_GLOBALS
1717c478bd9Sstevel@tonic-gate 
172*27f7c583Smyers /* Debug names for the mutexes above */
1737c478bd9Sstevel@tonic-gate 
174*27f7c583Smyers static char                 *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
1757c478bd9Sstevel@tonic-gate {
1767c478bd9Sstevel@tonic-gate     "ACPI_MTX_Interpreter",
1777c478bd9Sstevel@tonic-gate     "ACPI_MTX_Tables",
1787c478bd9Sstevel@tonic-gate     "ACPI_MTX_Namespace",
1797c478bd9Sstevel@tonic-gate     "ACPI_MTX_Events",
1807c478bd9Sstevel@tonic-gate     "ACPI_MTX_Caches",
1817c478bd9Sstevel@tonic-gate     "ACPI_MTX_Memory",
182*27f7c583Smyers     "ACPI_MTX_CommandComplete",
183*27f7c583Smyers     "ACPI_MTX_CommandReady"
1847c478bd9Sstevel@tonic-gate };
1857c478bd9Sstevel@tonic-gate 
1867c478bd9Sstevel@tonic-gate #endif
1877c478bd9Sstevel@tonic-gate #endif
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate 
190*27f7c583Smyers /*
191*27f7c583Smyers  * Predefined handles for spinlocks used within the subsystem.
192*27f7c583Smyers  * These spinlocks are created by AcpiUtMutexInitialize
193*27f7c583Smyers  */
194*27f7c583Smyers #define ACPI_LOCK_GPES                  0
195*27f7c583Smyers #define ACPI_LOCK_HARDWARE              1
196*27f7c583Smyers 
197*27f7c583Smyers #define ACPI_MAX_LOCK                   1
198*27f7c583Smyers #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
199*27f7c583Smyers 
200*27f7c583Smyers 
201450d6964Smyers /* Owner IDs are used to track namespace nodes for selective deletion */
202450d6964Smyers 
203450d6964Smyers typedef UINT8                           ACPI_OWNER_ID;
204450d6964Smyers #define ACPI_OWNER_ID_MAX               0xFF
205450d6964Smyers 
206450d6964Smyers /* This Thread ID means that the mutex is not in use (unlocked) */
207450d6964Smyers 
208450d6964Smyers #define ACPI_MUTEX_NOT_ACQUIRED         (UINT32) -1
209450d6964Smyers 
2107c478bd9Sstevel@tonic-gate /* Table for the global mutexes */
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate typedef struct acpi_mutex_info
2137c478bd9Sstevel@tonic-gate {
214*27f7c583Smyers     ACPI_MUTEX                      Mutex;
215*27f7c583Smyers     UINT32                          UseCount;
216*27f7c583Smyers     ACPI_THREAD_ID                  ThreadId;
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate } ACPI_MUTEX_INFO;
2197c478bd9Sstevel@tonic-gate 
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /* Lock flag parameter for various interfaces */
2227c478bd9Sstevel@tonic-gate 
2237c478bd9Sstevel@tonic-gate #define ACPI_MTX_DO_NOT_LOCK            0
2247c478bd9Sstevel@tonic-gate #define ACPI_MTX_LOCK                   1
2257c478bd9Sstevel@tonic-gate 
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate /* Field access granularities */
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate #define ACPI_FIELD_BYTE_GRANULARITY     1
2307c478bd9Sstevel@tonic-gate #define ACPI_FIELD_WORD_GRANULARITY     2
2317c478bd9Sstevel@tonic-gate #define ACPI_FIELD_DWORD_GRANULARITY    4
2327c478bd9Sstevel@tonic-gate #define ACPI_FIELD_QWORD_GRANULARITY    8
2337c478bd9Sstevel@tonic-gate 
2347c478bd9Sstevel@tonic-gate 
235*27f7c583Smyers #define ACPI_ENTRY_NOT_FOUND            NULL
236*27f7c583Smyers 
237*27f7c583Smyers 
2387c478bd9Sstevel@tonic-gate /*****************************************************************************
2397c478bd9Sstevel@tonic-gate  *
2407c478bd9Sstevel@tonic-gate  * Namespace typedefs and structs
2417c478bd9Sstevel@tonic-gate  *
2427c478bd9Sstevel@tonic-gate  ****************************************************************************/
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate /* Operational modes of the AML interpreter/scanner */
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate typedef enum
2477c478bd9Sstevel@tonic-gate {
248*27f7c583Smyers     ACPI_IMODE_LOAD_PASS1           = 0x01,
249*27f7c583Smyers     ACPI_IMODE_LOAD_PASS2           = 0x02,
250*27f7c583Smyers     ACPI_IMODE_EXECUTE              = 0x0E
2517c478bd9Sstevel@tonic-gate 
2527c478bd9Sstevel@tonic-gate } ACPI_INTERPRETER_MODE;
2537c478bd9Sstevel@tonic-gate 
2547c478bd9Sstevel@tonic-gate typedef union acpi_name_union
2557c478bd9Sstevel@tonic-gate {
256*27f7c583Smyers     UINT32                          Integer;
257*27f7c583Smyers     char                            Ascii[4];
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate } ACPI_NAME_UNION;
2607c478bd9Sstevel@tonic-gate 
261*27f7c583Smyers 
262*27f7c583Smyers /*
263*27f7c583Smyers  * The Namespace Node describes a named object that appears in the AML.
264*27f7c583Smyers  * DescriptorType is used to differentiate between internal descriptors.
265*27f7c583Smyers  *
266*27f7c583Smyers  * The node is optimized for both 32-bit and 64-bit platforms:
267*27f7c583Smyers  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
268*27f7c583Smyers  *
269*27f7c583Smyers  * Note: The DescriptorType and Type fields must appear in the identical
270*27f7c583Smyers  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
271*27f7c583Smyers  * structures.
272*27f7c583Smyers  */
2737c478bd9Sstevel@tonic-gate typedef struct acpi_namespace_node
2747c478bd9Sstevel@tonic-gate {
275*27f7c583Smyers     union acpi_operand_object       *Object;        /* Interpreter object */
276*27f7c583Smyers     UINT8                           DescriptorType; /* Differentiate object descriptor types */
277*27f7c583Smyers     UINT8                           Type;           /* ACPI Type associated with this name */
278*27f7c583Smyers     UINT8                           Flags;          /* Miscellaneous flags */
279*27f7c583Smyers     ACPI_OWNER_ID                   OwnerId;        /* Node creator */
280*27f7c583Smyers     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
281*27f7c583Smyers     struct acpi_namespace_node      *Child;         /* First child */
282*27f7c583Smyers     struct acpi_namespace_node      *Peer;          /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
283*27f7c583Smyers 
284*27f7c583Smyers     /*
285*27f7c583Smyers      * The following fields are used by the ASL compiler and disassembler only
286*27f7c583Smyers      */
287*27f7c583Smyers #ifdef ACPI_LARGE_NAMESPACE_NODE
288*27f7c583Smyers     union acpi_parse_object         *Op;
289*27f7c583Smyers     UINT32                          Value;
290*27f7c583Smyers     UINT32                          Length;
291450d6964Smyers #endif
292450d6964Smyers 
2937c478bd9Sstevel@tonic-gate } ACPI_NAMESPACE_NODE;
2947c478bd9Sstevel@tonic-gate 
2957c478bd9Sstevel@tonic-gate 
296*27f7c583Smyers /* Namespace Node flags */
2977c478bd9Sstevel@tonic-gate 
298*27f7c583Smyers #define ANOBJ_END_OF_PEER_LIST          0x01    /* End-of-list, Peer field points to parent */
299*27f7c583Smyers #define ANOBJ_RESERVED                  0x02    /* Available for future use */
300*27f7c583Smyers #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
301*27f7c583Smyers #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
302*27f7c583Smyers #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
3037c478bd9Sstevel@tonic-gate 
304*27f7c583Smyers #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
305*27f7c583Smyers #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
306*27f7c583Smyers #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
307*27f7c583Smyers #define ANOBJ_IS_BIT_OFFSET             0x40    /* iASL only: Reference is a bit offset */
308*27f7c583Smyers #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
3097c478bd9Sstevel@tonic-gate 
3107c478bd9Sstevel@tonic-gate /*
3117c478bd9Sstevel@tonic-gate  * ACPI Table Descriptor.  One per ACPI table
3127c478bd9Sstevel@tonic-gate  */
3137c478bd9Sstevel@tonic-gate typedef struct acpi_table_desc
3147c478bd9Sstevel@tonic-gate {
315*27f7c583Smyers     struct acpi_table_desc          *Prev;
316*27f7c583Smyers     struct acpi_table_desc          *Next;
317*27f7c583Smyers     struct acpi_table_desc          *InstalledDesc;
318*27f7c583Smyers     ACPI_TABLE_HEADER               *Pointer;
319*27f7c583Smyers     UINT8                           *AmlStart;
320*27f7c583Smyers     UINT64                          PhysicalAddress;
321*27f7c583Smyers     ACPI_SIZE                       Length;
322*27f7c583Smyers     UINT32                          AmlLength;
323*27f7c583Smyers     ACPI_OWNER_ID                   OwnerId;
324*27f7c583Smyers     UINT8                           Type;
325*27f7c583Smyers     UINT8                           Allocation;
326*27f7c583Smyers     BOOLEAN                         LoadedIntoNamespace;
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate } ACPI_TABLE_DESC;
3297c478bd9Sstevel@tonic-gate 
3307c478bd9Sstevel@tonic-gate typedef struct acpi_table_list
3317c478bd9Sstevel@tonic-gate {
332*27f7c583Smyers     struct acpi_table_desc          *Next;
333*27f7c583Smyers     UINT32                          Count;
3347c478bd9Sstevel@tonic-gate 
3357c478bd9Sstevel@tonic-gate } ACPI_TABLE_LIST;
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate typedef struct acpi_find_context
3397c478bd9Sstevel@tonic-gate {
340*27f7c583Smyers     char                            *SearchFor;
341*27f7c583Smyers     ACPI_HANDLE                     *List;
342*27f7c583Smyers     UINT32                          *Count;
3437c478bd9Sstevel@tonic-gate 
3447c478bd9Sstevel@tonic-gate } ACPI_FIND_CONTEXT;
3457c478bd9Sstevel@tonic-gate 
3467c478bd9Sstevel@tonic-gate 
3477c478bd9Sstevel@tonic-gate typedef struct acpi_ns_search_data
3487c478bd9Sstevel@tonic-gate {
349*27f7c583Smyers     ACPI_NAMESPACE_NODE             *Node;
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate } ACPI_NS_SEARCH_DATA;
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate /*
3557c478bd9Sstevel@tonic-gate  * Predefined Namespace items
3567c478bd9Sstevel@tonic-gate  */
3577c478bd9Sstevel@tonic-gate typedef struct acpi_predefined_names
3587c478bd9Sstevel@tonic-gate {
359*27f7c583Smyers     char                            *Name;
360*27f7c583Smyers     UINT8                           Type;
361*27f7c583Smyers     char                            *Val;
3627c478bd9Sstevel@tonic-gate 
3637c478bd9Sstevel@tonic-gate } ACPI_PREDEFINED_NAMES;
3647c478bd9Sstevel@tonic-gate 
3657c478bd9Sstevel@tonic-gate 
3667c478bd9Sstevel@tonic-gate /* Object types used during package copies */
3677c478bd9Sstevel@tonic-gate 
3687c478bd9Sstevel@tonic-gate #define ACPI_COPY_TYPE_SIMPLE           0
3697c478bd9Sstevel@tonic-gate #define ACPI_COPY_TYPE_PACKAGE          1
3707c478bd9Sstevel@tonic-gate 
371*27f7c583Smyers 
3727c478bd9Sstevel@tonic-gate /* Info structure used to convert external<->internal namestrings */
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate typedef struct acpi_namestring_info
3757c478bd9Sstevel@tonic-gate {
376*27f7c583Smyers     char                            *ExternalName;
377*27f7c583Smyers     char                            *NextExternalChar;
378*27f7c583Smyers     char                            *InternalName;
379*27f7c583Smyers     UINT32                          Length;
380*27f7c583Smyers     UINT32                          NumSegments;
381*27f7c583Smyers     UINT32                          NumCarats;
382*27f7c583Smyers     BOOLEAN                         FullyQualified;
3837c478bd9Sstevel@tonic-gate 
3847c478bd9Sstevel@tonic-gate } ACPI_NAMESTRING_INFO;
3857c478bd9Sstevel@tonic-gate 
3867c478bd9Sstevel@tonic-gate 
3877c478bd9Sstevel@tonic-gate /* Field creation info */
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate typedef struct acpi_create_field_info
3907c478bd9Sstevel@tonic-gate {
391*27f7c583Smyers     ACPI_NAMESPACE_NODE             *RegionNode;
392*27f7c583Smyers     ACPI_NAMESPACE_NODE             *FieldNode;
393*27f7c583Smyers     ACPI_NAMESPACE_NODE             *RegisterNode;
394*27f7c583Smyers     ACPI_NAMESPACE_NODE             *DataRegisterNode;
395*27f7c583Smyers     UINT32                          BankValue;
396*27f7c583Smyers     UINT32                          FieldBitPosition;
397*27f7c583Smyers     UINT32                          FieldBitLength;
398*27f7c583Smyers     UINT8                           FieldFlags;
399*27f7c583Smyers     UINT8                           Attribute;
400*27f7c583Smyers     UINT8                           FieldType;
4017c478bd9Sstevel@tonic-gate 
4027c478bd9Sstevel@tonic-gate } ACPI_CREATE_FIELD_INFO;
4037c478bd9Sstevel@tonic-gate 
4047c478bd9Sstevel@tonic-gate 
405*27f7c583Smyers typedef
406*27f7c583Smyers ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
407*27f7c583Smyers     struct acpi_walk_state          *WalkState);
408*27f7c583Smyers 
409*27f7c583Smyers 
41030082d0cSmyers /*
41130082d0cSmyers  * Bitmapped ACPI types.  Used internally only
41230082d0cSmyers  */
41330082d0cSmyers #define ACPI_BTYPE_ANY                  0x00000000
41430082d0cSmyers #define ACPI_BTYPE_INTEGER              0x00000001
41530082d0cSmyers #define ACPI_BTYPE_STRING               0x00000002
41630082d0cSmyers #define ACPI_BTYPE_BUFFER               0x00000004
41730082d0cSmyers #define ACPI_BTYPE_PACKAGE              0x00000008
41830082d0cSmyers #define ACPI_BTYPE_FIELD_UNIT           0x00000010
41930082d0cSmyers #define ACPI_BTYPE_DEVICE               0x00000020
42030082d0cSmyers #define ACPI_BTYPE_EVENT                0x00000040
42130082d0cSmyers #define ACPI_BTYPE_METHOD               0x00000080
42230082d0cSmyers #define ACPI_BTYPE_MUTEX                0x00000100
42330082d0cSmyers #define ACPI_BTYPE_REGION               0x00000200
42430082d0cSmyers #define ACPI_BTYPE_POWER                0x00000400
42530082d0cSmyers #define ACPI_BTYPE_PROCESSOR            0x00000800
42630082d0cSmyers #define ACPI_BTYPE_THERMAL              0x00001000
42730082d0cSmyers #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
42830082d0cSmyers #define ACPI_BTYPE_DDB_HANDLE           0x00004000
42930082d0cSmyers #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
43030082d0cSmyers #define ACPI_BTYPE_REFERENCE            0x00010000
43130082d0cSmyers #define ACPI_BTYPE_RESOURCE             0x00020000
43230082d0cSmyers 
43330082d0cSmyers #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
43430082d0cSmyers 
43530082d0cSmyers #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
43630082d0cSmyers #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
43730082d0cSmyers #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
43830082d0cSmyers #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
43930082d0cSmyers #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
44030082d0cSmyers 
44130082d0cSmyers 
4427c478bd9Sstevel@tonic-gate /*****************************************************************************
4437c478bd9Sstevel@tonic-gate  *
4447c478bd9Sstevel@tonic-gate  * Event typedefs and structs
4457c478bd9Sstevel@tonic-gate  *
4467c478bd9Sstevel@tonic-gate  ****************************************************************************/
4477c478bd9Sstevel@tonic-gate 
4487c478bd9Sstevel@tonic-gate /* Dispatch info for each GPE -- either a method or handler, cannot be both */
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate typedef struct acpi_handler_info
4517c478bd9Sstevel@tonic-gate {
4527c478bd9Sstevel@tonic-gate     ACPI_EVENT_HANDLER              Address;        /* Address of handler, if any */
4537c478bd9Sstevel@tonic-gate     void                            *Context;       /* Context to be passed to handler */
4547c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
4557c478bd9Sstevel@tonic-gate 
4567c478bd9Sstevel@tonic-gate } ACPI_HANDLER_INFO;
4577c478bd9Sstevel@tonic-gate 
4587c478bd9Sstevel@tonic-gate typedef union acpi_gpe_dispatch_info
4597c478bd9Sstevel@tonic-gate {
4607c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
4617c478bd9Sstevel@tonic-gate     struct acpi_handler_info        *Handler;
4627c478bd9Sstevel@tonic-gate 
4637c478bd9Sstevel@tonic-gate } ACPI_GPE_DISPATCH_INFO;
4647c478bd9Sstevel@tonic-gate 
4657c478bd9Sstevel@tonic-gate /*
4667c478bd9Sstevel@tonic-gate  * Information about a GPE, one per each GPE in an array.
4677c478bd9Sstevel@tonic-gate  * NOTE: Important to keep this struct as small as possible.
4687c478bd9Sstevel@tonic-gate  */
4697c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_event_info
4707c478bd9Sstevel@tonic-gate {
4717c478bd9Sstevel@tonic-gate     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method or Handler */
4727c478bd9Sstevel@tonic-gate     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
4737c478bd9Sstevel@tonic-gate     UINT8                           Flags;          /* Misc info about this GPE */
4747c478bd9Sstevel@tonic-gate     UINT8                           RegisterBit;    /* This GPE bit within the register */
4757c478bd9Sstevel@tonic-gate 
4767c478bd9Sstevel@tonic-gate } ACPI_GPE_EVENT_INFO;
4777c478bd9Sstevel@tonic-gate 
4787c478bd9Sstevel@tonic-gate /* Information about a GPE register pair, one per each status/enable pair in an array */
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_register_info
4817c478bd9Sstevel@tonic-gate {
4827c478bd9Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
4837c478bd9Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
4847c478bd9Sstevel@tonic-gate     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
4857c478bd9Sstevel@tonic-gate     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
4867c478bd9Sstevel@tonic-gate     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
4877c478bd9Sstevel@tonic-gate 
4887c478bd9Sstevel@tonic-gate } ACPI_GPE_REGISTER_INFO;
4897c478bd9Sstevel@tonic-gate 
4907c478bd9Sstevel@tonic-gate /*
4917c478bd9Sstevel@tonic-gate  * Information about a GPE register block, one per each installed block --
4927c478bd9Sstevel@tonic-gate  * GPE0, GPE1, and one per each installed GPE Block Device.
4937c478bd9Sstevel@tonic-gate  */
4947c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_block_info
4957c478bd9Sstevel@tonic-gate {
4967c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *Node;
4977c478bd9Sstevel@tonic-gate     struct acpi_gpe_block_info      *Previous;
4987c478bd9Sstevel@tonic-gate     struct acpi_gpe_block_info      *Next;
4997c478bd9Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
5007c478bd9Sstevel@tonic-gate     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
5017c478bd9Sstevel@tonic-gate     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
5027c478bd9Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            BlockAddress;   /* Base address of the block */
5037c478bd9Sstevel@tonic-gate     UINT32                          RegisterCount;  /* Number of register pairs in block */
5047c478bd9Sstevel@tonic-gate     UINT8                           BlockBaseNumber;/* Base GPE number for this block */
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate } ACPI_GPE_BLOCK_INFO;
5077c478bd9Sstevel@tonic-gate 
5087c478bd9Sstevel@tonic-gate /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
5097c478bd9Sstevel@tonic-gate 
5107c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_xrupt_info
5117c478bd9Sstevel@tonic-gate {
5127c478bd9Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *Previous;
5137c478bd9Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *Next;
5147c478bd9Sstevel@tonic-gate     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
515450d6964Smyers     UINT32                          InterruptNumber;    /* System interrupt number */
5167c478bd9Sstevel@tonic-gate 
5177c478bd9Sstevel@tonic-gate } ACPI_GPE_XRUPT_INFO;
5187c478bd9Sstevel@tonic-gate 
5197c478bd9Sstevel@tonic-gate 
5207c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_walk_info
5217c478bd9Sstevel@tonic-gate {
5227c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *GpeDevice;
5237c478bd9Sstevel@tonic-gate     ACPI_GPE_BLOCK_INFO             *GpeBlock;
5247c478bd9Sstevel@tonic-gate 
5257c478bd9Sstevel@tonic-gate } ACPI_GPE_WALK_INFO;
5267c478bd9Sstevel@tonic-gate 
5277c478bd9Sstevel@tonic-gate 
5287c478bd9Sstevel@tonic-gate typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
529*27f7c583Smyers     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
530*27f7c583Smyers     ACPI_GPE_BLOCK_INFO             *GpeBlock);
5317c478bd9Sstevel@tonic-gate 
5327c478bd9Sstevel@tonic-gate 
5337c478bd9Sstevel@tonic-gate /* Information about each particular fixed event */
5347c478bd9Sstevel@tonic-gate 
5357c478bd9Sstevel@tonic-gate typedef struct acpi_fixed_event_handler
5367c478bd9Sstevel@tonic-gate {
537*27f7c583Smyers     ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
538*27f7c583Smyers     void                            *Context;       /* Context to be passed to handler */
5397c478bd9Sstevel@tonic-gate 
5407c478bd9Sstevel@tonic-gate } ACPI_FIXED_EVENT_HANDLER;
5417c478bd9Sstevel@tonic-gate 
5427c478bd9Sstevel@tonic-gate typedef struct acpi_fixed_event_info
5437c478bd9Sstevel@tonic-gate {
544*27f7c583Smyers     UINT8                           StatusRegisterId;
545*27f7c583Smyers     UINT8                           EnableRegisterId;
546*27f7c583Smyers     UINT16                          StatusBitMask;
547*27f7c583Smyers     UINT16                          EnableBitMask;
5487c478bd9Sstevel@tonic-gate 
5497c478bd9Sstevel@tonic-gate } ACPI_FIXED_EVENT_INFO;
5507c478bd9Sstevel@tonic-gate 
5517c478bd9Sstevel@tonic-gate /* Information used during field processing */
5527c478bd9Sstevel@tonic-gate 
5537c478bd9Sstevel@tonic-gate typedef struct acpi_field_info
5547c478bd9Sstevel@tonic-gate {
555*27f7c583Smyers     UINT8                           SkipField;
556*27f7c583Smyers     UINT8                           FieldFlag;
557*27f7c583Smyers     UINT32                          PkgLength;
5587c478bd9Sstevel@tonic-gate 
5597c478bd9Sstevel@tonic-gate } ACPI_FIELD_INFO;
5607c478bd9Sstevel@tonic-gate 
5617c478bd9Sstevel@tonic-gate 
5627c478bd9Sstevel@tonic-gate /*****************************************************************************
5637c478bd9Sstevel@tonic-gate  *
5647c478bd9Sstevel@tonic-gate  * Generic "state" object for stacks
5657c478bd9Sstevel@tonic-gate  *
5667c478bd9Sstevel@tonic-gate  ****************************************************************************/
5677c478bd9Sstevel@tonic-gate 
5687c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_NORMAL                  0xC0
5697c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
5707c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
5717c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
5727c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
5737c478bd9Sstevel@tonic-gate 
5747c478bd9Sstevel@tonic-gate 
575*27f7c583Smyers #define ACPI_STATE_COMMON \
576*27f7c583Smyers     void                            *Next; \
577*27f7c583Smyers     UINT8                           DescriptorType; /* To differentiate various internal objs */\
578*27f7c583Smyers     UINT8                           Flags; \
579*27f7c583Smyers     UINT16                          Value; \
580*27f7c583Smyers     UINT16                          State;
581*27f7c583Smyers 
582*27f7c583Smyers     /* There are 2 bytes available here until the next natural alignment boundary */
5837c478bd9Sstevel@tonic-gate 
5847c478bd9Sstevel@tonic-gate typedef struct acpi_common_state
5857c478bd9Sstevel@tonic-gate {
5867c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
5877c478bd9Sstevel@tonic-gate } ACPI_COMMON_STATE;
5887c478bd9Sstevel@tonic-gate 
5897c478bd9Sstevel@tonic-gate 
5907c478bd9Sstevel@tonic-gate /*
5917c478bd9Sstevel@tonic-gate  * Update state - used to traverse complex objects such as packages
5927c478bd9Sstevel@tonic-gate  */
5937c478bd9Sstevel@tonic-gate typedef struct acpi_update_state
5947c478bd9Sstevel@tonic-gate {
5957c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
596*27f7c583Smyers     union acpi_operand_object       *Object;
5977c478bd9Sstevel@tonic-gate 
5987c478bd9Sstevel@tonic-gate } ACPI_UPDATE_STATE;
5997c478bd9Sstevel@tonic-gate 
6007c478bd9Sstevel@tonic-gate 
6017c478bd9Sstevel@tonic-gate /*
6027c478bd9Sstevel@tonic-gate  * Pkg state - used to traverse nested package structures
6037c478bd9Sstevel@tonic-gate  */
6047c478bd9Sstevel@tonic-gate typedef struct acpi_pkg_state
6057c478bd9Sstevel@tonic-gate {
6067c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
607*27f7c583Smyers     UINT16                          Index;
608*27f7c583Smyers     union acpi_operand_object       *SourceObject;
609*27f7c583Smyers     union acpi_operand_object       *DestObject;
610*27f7c583Smyers     struct acpi_walk_state          *WalkState;
611*27f7c583Smyers     void                            *ThisTargetObj;
612*27f7c583Smyers     UINT32                          NumPackages;
6137c478bd9Sstevel@tonic-gate 
6147c478bd9Sstevel@tonic-gate } ACPI_PKG_STATE;
6157c478bd9Sstevel@tonic-gate 
6167c478bd9Sstevel@tonic-gate 
6177c478bd9Sstevel@tonic-gate /*
6187c478bd9Sstevel@tonic-gate  * Control state - one per if/else and while constructs.
6197c478bd9Sstevel@tonic-gate  * Allows nesting of these constructs
6207c478bd9Sstevel@tonic-gate  */
6217c478bd9Sstevel@tonic-gate typedef struct acpi_control_state
6227c478bd9Sstevel@tonic-gate {
6237c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
624*27f7c583Smyers     UINT16                          Opcode;
625*27f7c583Smyers     union acpi_parse_object         *PredicateOp;
626*27f7c583Smyers     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
627*27f7c583Smyers     UINT8                           *PackageEnd;            /* End of if/while block */
6287c478bd9Sstevel@tonic-gate 
6297c478bd9Sstevel@tonic-gate } ACPI_CONTROL_STATE;
6307c478bd9Sstevel@tonic-gate 
6317c478bd9Sstevel@tonic-gate 
6327c478bd9Sstevel@tonic-gate /*
6337c478bd9Sstevel@tonic-gate  * Scope state - current scope during namespace lookups
6347c478bd9Sstevel@tonic-gate  */
6357c478bd9Sstevel@tonic-gate typedef struct acpi_scope_state
6367c478bd9Sstevel@tonic-gate {
6377c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
638*27f7c583Smyers     ACPI_NAMESPACE_NODE             *Node;
6397c478bd9Sstevel@tonic-gate 
6407c478bd9Sstevel@tonic-gate } ACPI_SCOPE_STATE;
6417c478bd9Sstevel@tonic-gate 
6427c478bd9Sstevel@tonic-gate 
6437c478bd9Sstevel@tonic-gate typedef struct acpi_pscope_state
6447c478bd9Sstevel@tonic-gate {
6457c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
646*27f7c583Smyers     UINT32                          ArgCount;               /* Number of fixed arguments */
647*27f7c583Smyers     union acpi_parse_object         *Op;                    /* Current op being parsed */
648*27f7c583Smyers     UINT8                           *ArgEnd;                /* Current argument end */
649*27f7c583Smyers     UINT8                           *PkgEnd;                /* Current package end */
650*27f7c583Smyers     UINT32                          ArgList;                /* Next argument to parse */
6517c478bd9Sstevel@tonic-gate 
6527c478bd9Sstevel@tonic-gate } ACPI_PSCOPE_STATE;
6537c478bd9Sstevel@tonic-gate 
6547c478bd9Sstevel@tonic-gate 
6557c478bd9Sstevel@tonic-gate /*
6567c478bd9Sstevel@tonic-gate  * Thread state - one per thread across multiple walk states.  Multiple walk
6577c478bd9Sstevel@tonic-gate  * states are created when there are nested control methods executing.
6587c478bd9Sstevel@tonic-gate  */
6597c478bd9Sstevel@tonic-gate typedef struct acpi_thread_state
6607c478bd9Sstevel@tonic-gate {
6617c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
662*27f7c583Smyers     UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
663*27f7c583Smyers     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
664*27f7c583Smyers     union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
665*27f7c583Smyers     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
6667c478bd9Sstevel@tonic-gate 
6677c478bd9Sstevel@tonic-gate } ACPI_THREAD_STATE;
6687c478bd9Sstevel@tonic-gate 
6697c478bd9Sstevel@tonic-gate 
6707c478bd9Sstevel@tonic-gate /*
6717c478bd9Sstevel@tonic-gate  * Result values - used to accumulate the results of nested
6727c478bd9Sstevel@tonic-gate  * AML arguments
6737c478bd9Sstevel@tonic-gate  */
6747c478bd9Sstevel@tonic-gate typedef struct acpi_result_values
6757c478bd9Sstevel@tonic-gate {
6767c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
677*27f7c583Smyers     UINT8                           NumResults;
678*27f7c583Smyers     UINT8                           LastInsert;
679*27f7c583Smyers     union acpi_operand_object       *ObjDesc [ACPI_OBJ_NUM_OPERANDS];
6807c478bd9Sstevel@tonic-gate 
6817c478bd9Sstevel@tonic-gate } ACPI_RESULT_VALUES;
6827c478bd9Sstevel@tonic-gate 
6837c478bd9Sstevel@tonic-gate 
6847c478bd9Sstevel@tonic-gate typedef
6857c478bd9Sstevel@tonic-gate ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
686*27f7c583Smyers     struct acpi_walk_state          *WalkState,
687*27f7c583Smyers     union acpi_parse_object         **OutOp);
6887c478bd9Sstevel@tonic-gate 
6897c478bd9Sstevel@tonic-gate typedef
6907c478bd9Sstevel@tonic-gate ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
691*27f7c583Smyers     struct acpi_walk_state          *WalkState);
6927c478bd9Sstevel@tonic-gate 
6937c478bd9Sstevel@tonic-gate 
6947c478bd9Sstevel@tonic-gate /*
6957c478bd9Sstevel@tonic-gate  * Notify info - used to pass info to the deferred notify
6967c478bd9Sstevel@tonic-gate  * handler/dispatcher.
6977c478bd9Sstevel@tonic-gate  */
6987c478bd9Sstevel@tonic-gate typedef struct acpi_notify_info
6997c478bd9Sstevel@tonic-gate {
7007c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
701*27f7c583Smyers     ACPI_NAMESPACE_NODE             *Node;
702*27f7c583Smyers     union acpi_operand_object       *HandlerObj;
7037c478bd9Sstevel@tonic-gate 
7047c478bd9Sstevel@tonic-gate } ACPI_NOTIFY_INFO;
7057c478bd9Sstevel@tonic-gate 
7067c478bd9Sstevel@tonic-gate 
7077c478bd9Sstevel@tonic-gate /* Generic state is union of structs above */
7087c478bd9Sstevel@tonic-gate 
7097c478bd9Sstevel@tonic-gate typedef union acpi_generic_state
7107c478bd9Sstevel@tonic-gate {
711*27f7c583Smyers     ACPI_COMMON_STATE               Common;
712*27f7c583Smyers     ACPI_CONTROL_STATE              Control;
713*27f7c583Smyers     ACPI_UPDATE_STATE               Update;
714*27f7c583Smyers     ACPI_SCOPE_STATE                Scope;
715*27f7c583Smyers     ACPI_PSCOPE_STATE               ParseScope;
716*27f7c583Smyers     ACPI_PKG_STATE                  Pkg;
717*27f7c583Smyers     ACPI_THREAD_STATE               Thread;
718*27f7c583Smyers     ACPI_RESULT_VALUES              Results;
719*27f7c583Smyers     ACPI_NOTIFY_INFO                Notify;
7207c478bd9Sstevel@tonic-gate 
7217c478bd9Sstevel@tonic-gate } ACPI_GENERIC_STATE;
7227c478bd9Sstevel@tonic-gate 
7237c478bd9Sstevel@tonic-gate 
7247c478bd9Sstevel@tonic-gate /*****************************************************************************
7257c478bd9Sstevel@tonic-gate  *
7267c478bd9Sstevel@tonic-gate  * Interpreter typedefs and structs
7277c478bd9Sstevel@tonic-gate  *
7287c478bd9Sstevel@tonic-gate  ****************************************************************************/
7297c478bd9Sstevel@tonic-gate 
7307c478bd9Sstevel@tonic-gate typedef
7317c478bd9Sstevel@tonic-gate ACPI_STATUS (*ACPI_EXECUTE_OP) (
732*27f7c583Smyers     struct acpi_walk_state          *WalkState);
7337c478bd9Sstevel@tonic-gate 
7347c478bd9Sstevel@tonic-gate 
7357c478bd9Sstevel@tonic-gate /*****************************************************************************
7367c478bd9Sstevel@tonic-gate  *
7377c478bd9Sstevel@tonic-gate  * Parser typedefs and structs
7387c478bd9Sstevel@tonic-gate  *
7397c478bd9Sstevel@tonic-gate  ****************************************************************************/
7407c478bd9Sstevel@tonic-gate 
7417c478bd9Sstevel@tonic-gate /*
7427c478bd9Sstevel@tonic-gate  * AML opcode, name, and argument layout
7437c478bd9Sstevel@tonic-gate  */
7447c478bd9Sstevel@tonic-gate typedef struct acpi_opcode_info
7457c478bd9Sstevel@tonic-gate {
7467c478bd9Sstevel@tonic-gate #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
747*27f7c583Smyers     char                            *Name;          /* Opcode name (disassembler/debug only) */
7487c478bd9Sstevel@tonic-gate #endif
749*27f7c583Smyers     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
750*27f7c583Smyers     UINT32                          RuntimeArgs;    /* Interpret time arguments */
751*27f7c583Smyers     UINT16                          Flags;          /* Misc flags */
752*27f7c583Smyers     UINT8                           ObjectType;     /* Corresponding internal object type */
753*27f7c583Smyers     UINT8                           Class;          /* Opcode class */
754*27f7c583Smyers     UINT8                           Type;           /* Opcode type */
7557c478bd9Sstevel@tonic-gate 
7567c478bd9Sstevel@tonic-gate } ACPI_OPCODE_INFO;
7577c478bd9Sstevel@tonic-gate 
7587c478bd9Sstevel@tonic-gate typedef union acpi_parse_value
7597c478bd9Sstevel@tonic-gate {
760*27f7c583Smyers     ACPI_INTEGER                    Integer;        /* Integer constant (Up to 64 bits) */
761*27f7c583Smyers     UINT64_STRUCT                   Integer64;      /* Structure overlay for 2 32-bit Dwords */
762*27f7c583Smyers     UINT32                          Size;           /* bytelist or field size */
763*27f7c583Smyers     char                            *String;        /* NULL terminated string */
764*27f7c583Smyers     UINT8                           *Buffer;        /* buffer or string */
765*27f7c583Smyers     char                            *Name;          /* NULL terminated string */
766*27f7c583Smyers     union acpi_parse_object         *Arg;           /* arguments and contained ops */
7677c478bd9Sstevel@tonic-gate 
7687c478bd9Sstevel@tonic-gate } ACPI_PARSE_VALUE;
7697c478bd9Sstevel@tonic-gate 
7707c478bd9Sstevel@tonic-gate #define ACPI_PARSE_COMMON \
771*27f7c583Smyers     union acpi_parse_object         *Parent;        /* Parent op */\
772*27f7c583Smyers     UINT8                           DescriptorType; /* To differentiate various internal objs */\
773*27f7c583Smyers     UINT8                           Flags;          /* Type of Op */\
774*27f7c583Smyers     UINT16                          AmlOpcode;      /* AML opcode */\
775*27f7c583Smyers     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
776*27f7c583Smyers     union acpi_parse_object         *Next;          /* Next op */\
777*27f7c583Smyers     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
778*27f7c583Smyers     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
7797c478bd9Sstevel@tonic-gate     ACPI_DISASM_ONLY_MEMBERS (\
780*27f7c583Smyers     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
781*27f7c583Smyers     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
782*27f7c583Smyers     char                            AmlOpName[16])  /* Op name (debug only) */
7837c478bd9Sstevel@tonic-gate 
7847c478bd9Sstevel@tonic-gate 
785*27f7c583Smyers #define ACPI_DASM_BUFFER                0x00
786*27f7c583Smyers #define ACPI_DASM_RESOURCE              0x01
787*27f7c583Smyers #define ACPI_DASM_STRING                0x02
788*27f7c583Smyers #define ACPI_DASM_UNICODE               0x03
789*27f7c583Smyers #define ACPI_DASM_EISAID                0x04
790*27f7c583Smyers #define ACPI_DASM_MATCHOP               0x05
791*27f7c583Smyers #define ACPI_DASM_LNOT_PREFIX           0x06
792*27f7c583Smyers #define ACPI_DASM_LNOT_SUFFIX           0x07
793*27f7c583Smyers #define ACPI_DASM_IGNORE                0x08
7947c478bd9Sstevel@tonic-gate 
7957c478bd9Sstevel@tonic-gate /*
796*27f7c583Smyers  * Generic operation (for example:  If, While, Store)
7977c478bd9Sstevel@tonic-gate  */
7987c478bd9Sstevel@tonic-gate typedef struct acpi_parse_obj_common
7997c478bd9Sstevel@tonic-gate {
8007c478bd9Sstevel@tonic-gate     ACPI_PARSE_COMMON
8017c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJ_COMMON;
8027c478bd9Sstevel@tonic-gate 
8037c478bd9Sstevel@tonic-gate 
8047c478bd9Sstevel@tonic-gate /*
8057c478bd9Sstevel@tonic-gate  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
8067c478bd9Sstevel@tonic-gate  * and bytelists.
8077c478bd9Sstevel@tonic-gate  */
8087c478bd9Sstevel@tonic-gate typedef struct acpi_parse_obj_named
8097c478bd9Sstevel@tonic-gate {
8107c478bd9Sstevel@tonic-gate     ACPI_PARSE_COMMON
811*27f7c583Smyers     UINT8                           *Path;
812*27f7c583Smyers     UINT8                           *Data;          /* AML body or bytelist data */
813*27f7c583Smyers     UINT32                          Length;         /* AML length */
814*27f7c583Smyers     UINT32                          Name;           /* 4-byte name or zero if no name */
8157c478bd9Sstevel@tonic-gate 
8167c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJ_NAMED;
8177c478bd9Sstevel@tonic-gate 
8187c478bd9Sstevel@tonic-gate 
819*27f7c583Smyers /* This version is used by the iASL compiler only */
8207c478bd9Sstevel@tonic-gate 
82130082d0cSmyers #define ACPI_MAX_PARSEOP_NAME   20
82230082d0cSmyers 
8237c478bd9Sstevel@tonic-gate typedef struct acpi_parse_obj_asl
8247c478bd9Sstevel@tonic-gate {
8257c478bd9Sstevel@tonic-gate     ACPI_PARSE_COMMON
826*27f7c583Smyers     union acpi_parse_object         *Child;
827*27f7c583Smyers     union acpi_parse_object         *ParentMethod;
828*27f7c583Smyers     char                            *Filename;
829*27f7c583Smyers     char                            *ExternalName;
830*27f7c583Smyers     char                            *Namepath;
831*27f7c583Smyers     char                            NameSeg[4];
832*27f7c583Smyers     UINT32                          ExtraValue;
833*27f7c583Smyers     UINT32                          Column;
834*27f7c583Smyers     UINT32                          LineNumber;
835*27f7c583Smyers     UINT32                          LogicalLineNumber;
836*27f7c583Smyers     UINT32                          LogicalByteOffset;
837*27f7c583Smyers     UINT32                          EndLine;
838*27f7c583Smyers     UINT32                          EndLogicalLine;
839*27f7c583Smyers     UINT32                          AcpiBtype;
840*27f7c583Smyers     UINT32                          AmlLength;
841*27f7c583Smyers     UINT32                          AmlSubtreeLength;
842*27f7c583Smyers     UINT32                          FinalAmlLength;
843*27f7c583Smyers     UINT32                          FinalAmlOffset;
844*27f7c583Smyers     UINT32                          CompileFlags;
845*27f7c583Smyers     UINT16                          ParseOpcode;
846*27f7c583Smyers     UINT8                           AmlOpcodeLength;
847*27f7c583Smyers     UINT8                           AmlPkgLenBytes;
848*27f7c583Smyers     UINT8                           Extra;
849*27f7c583Smyers     char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
8507c478bd9Sstevel@tonic-gate 
8517c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJ_ASL;
8527c478bd9Sstevel@tonic-gate 
8537c478bd9Sstevel@tonic-gate typedef union acpi_parse_object
8547c478bd9Sstevel@tonic-gate {
855*27f7c583Smyers     ACPI_PARSE_OBJ_COMMON           Common;
856*27f7c583Smyers     ACPI_PARSE_OBJ_NAMED            Named;
857*27f7c583Smyers     ACPI_PARSE_OBJ_ASL              Asl;
8587c478bd9Sstevel@tonic-gate 
8597c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJECT;
8607c478bd9Sstevel@tonic-gate 
8617c478bd9Sstevel@tonic-gate 
8627c478bd9Sstevel@tonic-gate /*
8637c478bd9Sstevel@tonic-gate  * Parse state - one state per parser invocation and each control
8647c478bd9Sstevel@tonic-gate  * method.
8657c478bd9Sstevel@tonic-gate  */
8667c478bd9Sstevel@tonic-gate typedef struct acpi_parse_state
8677c478bd9Sstevel@tonic-gate {
868*27f7c583Smyers     UINT8                           *AmlStart;      /* First AML byte */
869*27f7c583Smyers     UINT8                           *Aml;           /* Next AML byte */
870*27f7c583Smyers     UINT8                           *AmlEnd;        /* (last + 1) AML byte */
871*27f7c583Smyers     UINT8                           *PkgStart;      /* Current package begin */
872*27f7c583Smyers     UINT8                           *PkgEnd;        /* Current package end */
873*27f7c583Smyers     union acpi_parse_object         *StartOp;       /* Root of parse tree */
874*27f7c583Smyers     struct acpi_namespace_node      *StartNode;
875*27f7c583Smyers     union acpi_generic_state        *Scope;         /* Current scope */
876*27f7c583Smyers     union acpi_parse_object         *StartScope;
877*27f7c583Smyers     UINT32                          AmlSize;
8787c478bd9Sstevel@tonic-gate 
8797c478bd9Sstevel@tonic-gate } ACPI_PARSE_STATE;
8807c478bd9Sstevel@tonic-gate 
8817c478bd9Sstevel@tonic-gate 
8827c478bd9Sstevel@tonic-gate /* Parse object flags */
8837c478bd9Sstevel@tonic-gate 
884*27f7c583Smyers #define ACPI_PARSEOP_GENERIC            0x01
885*27f7c583Smyers #define ACPI_PARSEOP_NAMED              0x02
886*27f7c583Smyers #define ACPI_PARSEOP_DEFERRED           0x04
887*27f7c583Smyers #define ACPI_PARSEOP_BYTELIST           0x08
888*27f7c583Smyers #define ACPI_PARSEOP_IN_CACHE           0x80
8897c478bd9Sstevel@tonic-gate 
8907c478bd9Sstevel@tonic-gate /* Parse object DisasmFlags */
8917c478bd9Sstevel@tonic-gate 
892*27f7c583Smyers #define ACPI_PARSEOP_IGNORE             0x01
893*27f7c583Smyers #define ACPI_PARSEOP_PARAMLIST          0x02
894*27f7c583Smyers #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
895*27f7c583Smyers #define ACPI_PARSEOP_SPECIAL            0x10
8967c478bd9Sstevel@tonic-gate 
8977c478bd9Sstevel@tonic-gate 
8987c478bd9Sstevel@tonic-gate /*****************************************************************************
8997c478bd9Sstevel@tonic-gate  *
9007c478bd9Sstevel@tonic-gate  * Hardware (ACPI registers) and PNP
9017c478bd9Sstevel@tonic-gate  *
9027c478bd9Sstevel@tonic-gate  ****************************************************************************/
9037c478bd9Sstevel@tonic-gate 
904*27f7c583Smyers #define PCI_ROOT_HID_STRING             "PNP0A03"
905*27f7c583Smyers #define PCI_EXPRESS_ROOT_HID_STRING     "PNP0A08"
9067c478bd9Sstevel@tonic-gate 
9077c478bd9Sstevel@tonic-gate typedef struct acpi_bit_register_info
9087c478bd9Sstevel@tonic-gate {
909*27f7c583Smyers     UINT8                           ParentRegister;
910*27f7c583Smyers     UINT8                           BitPosition;
911*27f7c583Smyers     UINT16                          AccessBitMask;
9127c478bd9Sstevel@tonic-gate 
9137c478bd9Sstevel@tonic-gate } ACPI_BIT_REGISTER_INFO;
9147c478bd9Sstevel@tonic-gate 
9157c478bd9Sstevel@tonic-gate 
916*27f7c583Smyers /*
917*27f7c583Smyers  * Some ACPI registers have bits that must be ignored -- meaning that they
918*27f7c583Smyers  * must be preserved.
919*27f7c583Smyers  */
920*27f7c583Smyers #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
921*27f7c583Smyers #define ACPI_PM1_CONTROL_PRESERVED_BITS         0x0201  /* Bit 9, Bit 0 (SCI_EN) */
922*27f7c583Smyers 
923*27f7c583Smyers 
9247c478bd9Sstevel@tonic-gate /*
9257c478bd9Sstevel@tonic-gate  * Register IDs
9267c478bd9Sstevel@tonic-gate  * These are the full ACPI registers
9277c478bd9Sstevel@tonic-gate  */
9287c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1_STATUS                0x01
9297c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1_ENABLE                0x02
9307c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1_CONTROL               0x03
9317c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1A_CONTROL              0x04
9327c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1B_CONTROL              0x05
9337c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM2_CONTROL               0x06
9347c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM_TIMER                  0x07
9357c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
9367c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
9377c478bd9Sstevel@tonic-gate 
9387c478bd9Sstevel@tonic-gate 
9397c478bd9Sstevel@tonic-gate /* Masks used to access the BitRegisters */
9407c478bd9Sstevel@tonic-gate 
9417c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_TIMER_STATUS               0x0001
9427c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
9437c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
9447c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
9457c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
9467c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
9477c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
9487c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_WAKE_STATUS                0x8000
9497c478bd9Sstevel@tonic-gate 
950*27f7c583Smyers #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
951*27f7c583Smyers     ACPI_BITMASK_TIMER_STATUS          | \
952*27f7c583Smyers     ACPI_BITMASK_BUS_MASTER_STATUS     | \
953*27f7c583Smyers     ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
954*27f7c583Smyers     ACPI_BITMASK_POWER_BUTTON_STATUS   | \
955*27f7c583Smyers     ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
956*27f7c583Smyers     ACPI_BITMASK_RT_CLOCK_STATUS       | \
957*27f7c583Smyers     ACPI_BITMASK_WAKE_STATUS)
9587c478bd9Sstevel@tonic-gate 
9597c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_TIMER_ENABLE               0x0001
9607c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
9617c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
9627c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
9637c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
9647c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
9657c478bd9Sstevel@tonic-gate 
9667c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SCI_ENABLE                 0x0001
9677c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
9687c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
9697c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_TYPE_X               0x1C00
9707c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
9717c478bd9Sstevel@tonic-gate 
9727c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_ARB_DISABLE                0x0001
9737c478bd9Sstevel@tonic-gate 
9747c478bd9Sstevel@tonic-gate 
9757c478bd9Sstevel@tonic-gate /* Raw bit position of each BitRegister */
9767c478bd9Sstevel@tonic-gate 
9777c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_TIMER_STATUS           0x00
9787c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
9797c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
9807c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
9817c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
9827c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
9837c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
9847c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
9857c478bd9Sstevel@tonic-gate 
9867c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
9877c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
9887c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
9897c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
9907c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
9917c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
9927c478bd9Sstevel@tonic-gate 
9937c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SCI_ENABLE             0x00
9947c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
9957c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
9967c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_TYPE_X           0x0A
9977c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
9987c478bd9Sstevel@tonic-gate 
9997c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_ARB_DISABLE            0x00
10007c478bd9Sstevel@tonic-gate 
10017c478bd9Sstevel@tonic-gate 
10027c478bd9Sstevel@tonic-gate /*****************************************************************************
10037c478bd9Sstevel@tonic-gate  *
10047c478bd9Sstevel@tonic-gate  * Resource descriptors
10057c478bd9Sstevel@tonic-gate  *
10067c478bd9Sstevel@tonic-gate  ****************************************************************************/
10077c478bd9Sstevel@tonic-gate 
10087c478bd9Sstevel@tonic-gate /* ResourceType values */
10097c478bd9Sstevel@tonic-gate 
1010186507a7Smyers #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
1011186507a7Smyers #define ACPI_ADDRESS_TYPE_IO_RANGE              1
1012186507a7Smyers #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
10137c478bd9Sstevel@tonic-gate 
10147c478bd9Sstevel@tonic-gate /* Resource descriptor types and masks */
10157c478bd9Sstevel@tonic-gate 
1016186507a7Smyers #define ACPI_RESOURCE_NAME_LARGE                0x80
1017186507a7Smyers #define ACPI_RESOURCE_NAME_SMALL                0x00
10187c478bd9Sstevel@tonic-gate 
1019186507a7Smyers #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1020186507a7Smyers #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1021186507a7Smyers #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
10227c478bd9Sstevel@tonic-gate 
10237c478bd9Sstevel@tonic-gate 
10247c478bd9Sstevel@tonic-gate /*
1025186507a7Smyers  * Small resource descriptor "names" as defined by the ACPI specification.
1026186507a7Smyers  * Note: Bits 2:0 are used for the descriptor length
10277c478bd9Sstevel@tonic-gate  */
1028186507a7Smyers #define ACPI_RESOURCE_NAME_IRQ                  0x20
1029186507a7Smyers #define ACPI_RESOURCE_NAME_DMA                  0x28
1030186507a7Smyers #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1031186507a7Smyers #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1032186507a7Smyers #define ACPI_RESOURCE_NAME_IO                   0x40
1033186507a7Smyers #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1034186507a7Smyers #define ACPI_RESOURCE_NAME_RESERVED_S1          0x50
1035186507a7Smyers #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1036186507a7Smyers #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1037186507a7Smyers #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1038186507a7Smyers #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1039186507a7Smyers #define ACPI_RESOURCE_NAME_END_TAG              0x78
10407c478bd9Sstevel@tonic-gate 
10417c478bd9Sstevel@tonic-gate /*
1042186507a7Smyers  * Large resource descriptor "names" as defined by the ACPI specification.
1043186507a7Smyers  * Note: includes the Large Descriptor bit in bit[7]
10447c478bd9Sstevel@tonic-gate  */
1045186507a7Smyers #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1046186507a7Smyers #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1047186507a7Smyers #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1048186507a7Smyers #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1049186507a7Smyers #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1050186507a7Smyers #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1051186507a7Smyers #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1052186507a7Smyers #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1053186507a7Smyers #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1054186507a7Smyers #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1055186507a7Smyers #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1056186507a7Smyers #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8B
10577c478bd9Sstevel@tonic-gate 
10587c478bd9Sstevel@tonic-gate 
10597c478bd9Sstevel@tonic-gate /*****************************************************************************
10607c478bd9Sstevel@tonic-gate  *
10617c478bd9Sstevel@tonic-gate  * Miscellaneous
10627c478bd9Sstevel@tonic-gate  *
10637c478bd9Sstevel@tonic-gate  ****************************************************************************/
10647c478bd9Sstevel@tonic-gate 
1065*27f7c583Smyers #define ACPI_ASCII_ZERO                 0x30
10667c478bd9Sstevel@tonic-gate 
10677c478bd9Sstevel@tonic-gate 
10687c478bd9Sstevel@tonic-gate /*****************************************************************************
10697c478bd9Sstevel@tonic-gate  *
10707c478bd9Sstevel@tonic-gate  * Debugger
10717c478bd9Sstevel@tonic-gate  *
10727c478bd9Sstevel@tonic-gate  ****************************************************************************/
10737c478bd9Sstevel@tonic-gate 
10747c478bd9Sstevel@tonic-gate typedef struct acpi_db_method_info
10757c478bd9Sstevel@tonic-gate {
1076*27f7c583Smyers     ACPI_HANDLE                     ThreadGate;
1077*27f7c583Smyers     char                            *Name;
1078*27f7c583Smyers     char                            **Args;
1079*27f7c583Smyers     UINT32                          Flags;
1080*27f7c583Smyers     UINT32                          NumLoops;
1081*27f7c583Smyers     char                            Pathname[128];
10827c478bd9Sstevel@tonic-gate 
10837c478bd9Sstevel@tonic-gate } ACPI_DB_METHOD_INFO;
10847c478bd9Sstevel@tonic-gate 
10857c478bd9Sstevel@tonic-gate typedef struct acpi_integrity_info
10867c478bd9Sstevel@tonic-gate {
1087*27f7c583Smyers     UINT32                          Nodes;
1088*27f7c583Smyers     UINT32                          Objects;
10897c478bd9Sstevel@tonic-gate 
10907c478bd9Sstevel@tonic-gate } ACPI_INTEGRITY_INFO;
10917c478bd9Sstevel@tonic-gate 
10927c478bd9Sstevel@tonic-gate 
1093*27f7c583Smyers #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1094*27f7c583Smyers #define ACPI_DB_CONSOLE_OUTPUT          0x02
1095*27f7c583Smyers #define ACPI_DB_DUPLICATE_OUTPUT        0x03
10967c478bd9Sstevel@tonic-gate 
10977c478bd9Sstevel@tonic-gate 
10987c478bd9Sstevel@tonic-gate /*****************************************************************************
10997c478bd9Sstevel@tonic-gate  *
11007c478bd9Sstevel@tonic-gate  * Debug
11017c478bd9Sstevel@tonic-gate  *
11027c478bd9Sstevel@tonic-gate  ****************************************************************************/
11037c478bd9Sstevel@tonic-gate 
11047c478bd9Sstevel@tonic-gate /* Entry for a memory allocation (debug only) */
11057c478bd9Sstevel@tonic-gate 
1106*27f7c583Smyers #define ACPI_MEM_MALLOC                 0
1107*27f7c583Smyers #define ACPI_MEM_CALLOC                 1
1108*27f7c583Smyers #define ACPI_MAX_MODULE_NAME            16
11097c478bd9Sstevel@tonic-gate 
11107c478bd9Sstevel@tonic-gate #define ACPI_COMMON_DEBUG_MEM_HEADER \
1111*27f7c583Smyers     struct acpi_debug_mem_block     *Previous; \
1112*27f7c583Smyers     struct acpi_debug_mem_block     *Next; \
1113*27f7c583Smyers     UINT32                          Size; \
1114*27f7c583Smyers     UINT32                          Component; \
1115*27f7c583Smyers     UINT32                          Line; \
1116*27f7c583Smyers     char                            Module[ACPI_MAX_MODULE_NAME]; \
1117*27f7c583Smyers     UINT8                           AllocType;
11187c478bd9Sstevel@tonic-gate 
11197c478bd9Sstevel@tonic-gate typedef struct acpi_debug_mem_header
11207c478bd9Sstevel@tonic-gate {
11217c478bd9Sstevel@tonic-gate     ACPI_COMMON_DEBUG_MEM_HEADER
11227c478bd9Sstevel@tonic-gate 
11237c478bd9Sstevel@tonic-gate } ACPI_DEBUG_MEM_HEADER;
11247c478bd9Sstevel@tonic-gate 
11257c478bd9Sstevel@tonic-gate typedef struct acpi_debug_mem_block
11267c478bd9Sstevel@tonic-gate {
11277c478bd9Sstevel@tonic-gate     ACPI_COMMON_DEBUG_MEM_HEADER
1128*27f7c583Smyers     UINT64                          UserSpace;
11297c478bd9Sstevel@tonic-gate 
11307c478bd9Sstevel@tonic-gate } ACPI_DEBUG_MEM_BLOCK;
11317c478bd9Sstevel@tonic-gate 
11327c478bd9Sstevel@tonic-gate 
11337c478bd9Sstevel@tonic-gate #define ACPI_MEM_LIST_GLOBAL            0
11347c478bd9Sstevel@tonic-gate #define ACPI_MEM_LIST_NSNODE            1
1135450d6964Smyers #define ACPI_MEM_LIST_MAX               1
1136450d6964Smyers #define ACPI_NUM_MEM_LISTS              2
11377c478bd9Sstevel@tonic-gate 
11387c478bd9Sstevel@tonic-gate 
11397c478bd9Sstevel@tonic-gate typedef struct acpi_memory_list
11407c478bd9Sstevel@tonic-gate {
1141*27f7c583Smyers     char                            *ListName;
1142*27f7c583Smyers     void                            *ListHead;
1143*27f7c583Smyers     UINT16                          ObjectSize;
1144*27f7c583Smyers     UINT16                          MaxDepth;
1145*27f7c583Smyers     UINT16                          CurrentDepth;
1146*27f7c583Smyers     UINT16                          LinkOffset;
11477c478bd9Sstevel@tonic-gate 
11487c478bd9Sstevel@tonic-gate #ifdef ACPI_DBG_TRACK_ALLOCATIONS
11497c478bd9Sstevel@tonic-gate 
11507c478bd9Sstevel@tonic-gate     /* Statistics for debug memory tracking only */
11517c478bd9Sstevel@tonic-gate 
1152*27f7c583Smyers     UINT32                          TotalAllocated;
1153*27f7c583Smyers     UINT32                          TotalFreed;
1154*27f7c583Smyers     UINT32                          CurrentTotalSize;
1155*27f7c583Smyers     UINT32                          Requests;
1156*27f7c583Smyers     UINT32                          Hits;
11577c478bd9Sstevel@tonic-gate #endif
11587c478bd9Sstevel@tonic-gate 
11597c478bd9Sstevel@tonic-gate } ACPI_MEMORY_LIST;
11607c478bd9Sstevel@tonic-gate 
11617c478bd9Sstevel@tonic-gate 
11627c478bd9Sstevel@tonic-gate #endif /* __ACLOCAL_H__ */
1163