xref: /illumos-gate/usr/src/uts/intel/sys/acpi/aclocal.h (revision 450d6964)
17c478bd9Sstevel@tonic-gate /******************************************************************************
27c478bd9Sstevel@tonic-gate  *
37c478bd9Sstevel@tonic-gate  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4*450d6964Smyers  *       $Revision: 211 $
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  *****************************************************************************/
77c478bd9Sstevel@tonic-gate 
87c478bd9Sstevel@tonic-gate /******************************************************************************
97c478bd9Sstevel@tonic-gate  *
107c478bd9Sstevel@tonic-gate  * 1. Copyright Notice
117c478bd9Sstevel@tonic-gate  *
127c478bd9Sstevel@tonic-gate  * Some or all of this work - Copyright (c) 1999 - 2005, 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 
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #define ACPI_WAIT_FOREVER               0xFFFF  /* UINT16, as per ACPI spec */
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate typedef void *                          ACPI_MUTEX;
1247c478bd9Sstevel@tonic-gate typedef UINT32                          ACPI_MUTEX_HANDLE;
1257c478bd9Sstevel@tonic-gate 
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate /* Total number of aml opcodes defined */
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate #define AML_NUM_OPCODES                 0x7F
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate 
132*450d6964Smyers /* Forward declarations */
133*450d6964Smyers 
134*450d6964Smyers struct acpi_walk_state;
135*450d6964Smyers struct acpi_obj_mutex;
136*450d6964Smyers union acpi_parse_object;
137*450d6964Smyers 
138*450d6964Smyers 
1397c478bd9Sstevel@tonic-gate /*****************************************************************************
1407c478bd9Sstevel@tonic-gate  *
1417c478bd9Sstevel@tonic-gate  * Mutex typedefs and structs
1427c478bd9Sstevel@tonic-gate  *
1437c478bd9Sstevel@tonic-gate  ****************************************************************************/
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate 
1467c478bd9Sstevel@tonic-gate /*
1477c478bd9Sstevel@tonic-gate  * Predefined handles for the mutex objects used within the subsystem
1487c478bd9Sstevel@tonic-gate  * All mutex objects are automatically created by AcpiUtMutexInitialize.
1497c478bd9Sstevel@tonic-gate  *
1507c478bd9Sstevel@tonic-gate  * The acquire/release ordering protocol is implied via this list.  Mutexes
1517c478bd9Sstevel@tonic-gate  * with a lower value must be acquired before mutexes with a higher value.
1527c478bd9Sstevel@tonic-gate  *
1537c478bd9Sstevel@tonic-gate  * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames table also!
1547c478bd9Sstevel@tonic-gate  */
1557c478bd9Sstevel@tonic-gate #define ACPI_MTX_EXECUTE                0
1567c478bd9Sstevel@tonic-gate #define ACPI_MTX_INTERPRETER            1
1577c478bd9Sstevel@tonic-gate #define ACPI_MTX_PARSER                 2
1587c478bd9Sstevel@tonic-gate #define ACPI_MTX_DISPATCHER             3
1597c478bd9Sstevel@tonic-gate #define ACPI_MTX_TABLES                 4
1607c478bd9Sstevel@tonic-gate #define ACPI_MTX_OP_REGIONS             5
1617c478bd9Sstevel@tonic-gate #define ACPI_MTX_NAMESPACE              6
1627c478bd9Sstevel@tonic-gate #define ACPI_MTX_EVENTS                 7
1637c478bd9Sstevel@tonic-gate #define ACPI_MTX_HARDWARE               8
1647c478bd9Sstevel@tonic-gate #define ACPI_MTX_CACHES                 9
1657c478bd9Sstevel@tonic-gate #define ACPI_MTX_MEMORY                 10
1667c478bd9Sstevel@tonic-gate #define ACPI_MTX_DEBUG_CMD_COMPLETE     11
1677c478bd9Sstevel@tonic-gate #define ACPI_MTX_DEBUG_CMD_READY        12
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #define MAX_MUTEX                       12
1707c478bd9Sstevel@tonic-gate #define NUM_MUTEX                       MAX_MUTEX+1
1717c478bd9Sstevel@tonic-gate 
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
1747c478bd9Sstevel@tonic-gate #ifdef DEFINE_ACPI_GLOBALS
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate /* Names for the mutexes used in the subsystem */
1777c478bd9Sstevel@tonic-gate 
1787c478bd9Sstevel@tonic-gate static char                 *AcpiGbl_MutexNames[] =
1797c478bd9Sstevel@tonic-gate {
1807c478bd9Sstevel@tonic-gate     "ACPI_MTX_Execute",
1817c478bd9Sstevel@tonic-gate     "ACPI_MTX_Interpreter",
1827c478bd9Sstevel@tonic-gate     "ACPI_MTX_Parser",
1837c478bd9Sstevel@tonic-gate     "ACPI_MTX_Dispatcher",
1847c478bd9Sstevel@tonic-gate     "ACPI_MTX_Tables",
1857c478bd9Sstevel@tonic-gate     "ACPI_MTX_OpRegions",
1867c478bd9Sstevel@tonic-gate     "ACPI_MTX_Namespace",
1877c478bd9Sstevel@tonic-gate     "ACPI_MTX_Events",
1887c478bd9Sstevel@tonic-gate     "ACPI_MTX_Hardware",
1897c478bd9Sstevel@tonic-gate     "ACPI_MTX_Caches",
1907c478bd9Sstevel@tonic-gate     "ACPI_MTX_Memory",
1917c478bd9Sstevel@tonic-gate     "ACPI_MTX_DebugCmdComplete",
1927c478bd9Sstevel@tonic-gate     "ACPI_MTX_DebugCmdReady",
1937c478bd9Sstevel@tonic-gate };
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate #endif
1967c478bd9Sstevel@tonic-gate #endif
1977c478bd9Sstevel@tonic-gate 
1987c478bd9Sstevel@tonic-gate 
199*450d6964Smyers /* Owner IDs are used to track namespace nodes for selective deletion */
200*450d6964Smyers 
201*450d6964Smyers typedef UINT8                           ACPI_OWNER_ID;
202*450d6964Smyers #define ACPI_OWNER_ID_MAX               0xFF
203*450d6964Smyers 
204*450d6964Smyers /* This Thread ID means that the mutex is not in use (unlocked) */
205*450d6964Smyers 
206*450d6964Smyers #define ACPI_MUTEX_NOT_ACQUIRED         (UINT32) -1
207*450d6964Smyers 
2087c478bd9Sstevel@tonic-gate /* Table for the global mutexes */
2097c478bd9Sstevel@tonic-gate 
2107c478bd9Sstevel@tonic-gate typedef struct acpi_mutex_info
2117c478bd9Sstevel@tonic-gate {
2127c478bd9Sstevel@tonic-gate     ACPI_MUTEX                  Mutex;
2137c478bd9Sstevel@tonic-gate     UINT32                      UseCount;
214*450d6964Smyers     UINT32                      ThreadId;
2157c478bd9Sstevel@tonic-gate 
2167c478bd9Sstevel@tonic-gate } ACPI_MUTEX_INFO;
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate /* Lock flag parameter for various interfaces */
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate #define ACPI_MTX_DO_NOT_LOCK            0
2227c478bd9Sstevel@tonic-gate #define ACPI_MTX_LOCK                   1
2237c478bd9Sstevel@tonic-gate 
2247c478bd9Sstevel@tonic-gate 
2257c478bd9Sstevel@tonic-gate /* Field access granularities */
2267c478bd9Sstevel@tonic-gate 
2277c478bd9Sstevel@tonic-gate #define ACPI_FIELD_BYTE_GRANULARITY     1
2287c478bd9Sstevel@tonic-gate #define ACPI_FIELD_WORD_GRANULARITY     2
2297c478bd9Sstevel@tonic-gate #define ACPI_FIELD_DWORD_GRANULARITY    4
2307c478bd9Sstevel@tonic-gate #define ACPI_FIELD_QWORD_GRANULARITY    8
2317c478bd9Sstevel@tonic-gate 
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate /*****************************************************************************
2347c478bd9Sstevel@tonic-gate  *
2357c478bd9Sstevel@tonic-gate  * Namespace typedefs and structs
2367c478bd9Sstevel@tonic-gate  *
2377c478bd9Sstevel@tonic-gate  ****************************************************************************/
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate /* Operational modes of the AML interpreter/scanner */
2407c478bd9Sstevel@tonic-gate 
2417c478bd9Sstevel@tonic-gate typedef enum
2427c478bd9Sstevel@tonic-gate {
2437c478bd9Sstevel@tonic-gate     ACPI_IMODE_LOAD_PASS1               = 0x01,
2447c478bd9Sstevel@tonic-gate     ACPI_IMODE_LOAD_PASS2               = 0x02,
2457c478bd9Sstevel@tonic-gate     ACPI_IMODE_EXECUTE                  = 0x0E
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate } ACPI_INTERPRETER_MODE;
2487c478bd9Sstevel@tonic-gate 
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate /*
2517c478bd9Sstevel@tonic-gate  * The Node describes a named object that appears in the AML
2527c478bd9Sstevel@tonic-gate  * An AcpiNode is used to store Nodes.
2537c478bd9Sstevel@tonic-gate  *
2547c478bd9Sstevel@tonic-gate  * DataType is used to differentiate between internal descriptors, and MUST
2557c478bd9Sstevel@tonic-gate  * be the first byte in this structure.
2567c478bd9Sstevel@tonic-gate  */
2577c478bd9Sstevel@tonic-gate typedef union acpi_name_union
2587c478bd9Sstevel@tonic-gate {
2597c478bd9Sstevel@tonic-gate     UINT32                      Integer;
2607c478bd9Sstevel@tonic-gate     char                        Ascii[4];
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate } ACPI_NAME_UNION;
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate typedef struct acpi_namespace_node
2657c478bd9Sstevel@tonic-gate {
2667c478bd9Sstevel@tonic-gate     UINT8                       Descriptor;     /* Used to differentiate object descriptor types */
2677c478bd9Sstevel@tonic-gate     UINT8                       Type;           /* Type associated with this name */
268*450d6964Smyers     UINT16                      ReferenceCount; /* Current count of references and children */
2697c478bd9Sstevel@tonic-gate     ACPI_NAME_UNION             Name;           /* ACPI Name, always 4 chars per ACPI spec */
2707c478bd9Sstevel@tonic-gate     union acpi_operand_object   *Object;        /* Pointer to attached ACPI object (optional) */
2717c478bd9Sstevel@tonic-gate     struct acpi_namespace_node  *Child;         /* First child */
2727c478bd9Sstevel@tonic-gate     struct acpi_namespace_node  *Peer;          /* Next peer*/
273*450d6964Smyers     UINT8                       OwnerId;        /* Who created this node */
2747c478bd9Sstevel@tonic-gate     UINT8                       Flags;
2757c478bd9Sstevel@tonic-gate 
276*450d6964Smyers     /* Fields used by the ASL compiler only */
277*450d6964Smyers 
278*450d6964Smyers #ifdef ACPI_ASL_COMPILER
279*450d6964Smyers     UINT32                      Value;
280*450d6964Smyers     union acpi_parse_object     *Op;
281*450d6964Smyers #endif
282*450d6964Smyers 
2837c478bd9Sstevel@tonic-gate } ACPI_NAMESPACE_NODE;
2847c478bd9Sstevel@tonic-gate 
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate #define ACPI_ENTRY_NOT_FOUND            NULL
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate /* Node flags */
2907c478bd9Sstevel@tonic-gate 
2917c478bd9Sstevel@tonic-gate #define ANOBJ_RESERVED                  0x01
2927c478bd9Sstevel@tonic-gate #define ANOBJ_END_OF_PEER_LIST          0x02
2937c478bd9Sstevel@tonic-gate #define ANOBJ_DATA_WIDTH_32             0x04     /* Parent table is 64-bits */
2947c478bd9Sstevel@tonic-gate #define ANOBJ_METHOD_ARG                0x08
2957c478bd9Sstevel@tonic-gate #define ANOBJ_METHOD_LOCAL              0x10
2967c478bd9Sstevel@tonic-gate #define ANOBJ_METHOD_NO_RETVAL          0x20
2977c478bd9Sstevel@tonic-gate #define ANOBJ_METHOD_SOME_NO_RETVAL     0x40
2987c478bd9Sstevel@tonic-gate #define ANOBJ_IS_BIT_OFFSET             0x80
2997c478bd9Sstevel@tonic-gate 
3007c478bd9Sstevel@tonic-gate /*
3017c478bd9Sstevel@tonic-gate  * ACPI Table Descriptor.  One per ACPI table
3027c478bd9Sstevel@tonic-gate  */
3037c478bd9Sstevel@tonic-gate typedef struct acpi_table_desc
3047c478bd9Sstevel@tonic-gate {
3057c478bd9Sstevel@tonic-gate     struct acpi_table_desc  *Prev;
3067c478bd9Sstevel@tonic-gate     struct acpi_table_desc  *Next;
3077c478bd9Sstevel@tonic-gate     struct acpi_table_desc  *InstalledDesc;
3087c478bd9Sstevel@tonic-gate     ACPI_TABLE_HEADER       *Pointer;
3097c478bd9Sstevel@tonic-gate     UINT8                   *AmlStart;
3107c478bd9Sstevel@tonic-gate     UINT64                  PhysicalAddress;
3117c478bd9Sstevel@tonic-gate     UINT32                  AmlLength;
3127c478bd9Sstevel@tonic-gate     ACPI_SIZE               Length;
313*450d6964Smyers     ACPI_OWNER_ID           OwnerId;
3147c478bd9Sstevel@tonic-gate     UINT8                   Type;
3157c478bd9Sstevel@tonic-gate     UINT8                   Allocation;
3167c478bd9Sstevel@tonic-gate     BOOLEAN                 LoadedIntoNamespace;
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate } ACPI_TABLE_DESC;
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate typedef struct acpi_table_list
3217c478bd9Sstevel@tonic-gate {
3227c478bd9Sstevel@tonic-gate     struct acpi_table_desc  *Next;
3237c478bd9Sstevel@tonic-gate     UINT32                  Count;
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate } ACPI_TABLE_LIST;
3267c478bd9Sstevel@tonic-gate 
3277c478bd9Sstevel@tonic-gate 
3287c478bd9Sstevel@tonic-gate typedef struct acpi_find_context
3297c478bd9Sstevel@tonic-gate {
3307c478bd9Sstevel@tonic-gate     char                    *SearchFor;
3317c478bd9Sstevel@tonic-gate     ACPI_HANDLE             *List;
3327c478bd9Sstevel@tonic-gate     UINT32                  *Count;
3337c478bd9Sstevel@tonic-gate 
3347c478bd9Sstevel@tonic-gate } ACPI_FIND_CONTEXT;
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate typedef struct acpi_ns_search_data
3387c478bd9Sstevel@tonic-gate {
3397c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE     *Node;
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate } ACPI_NS_SEARCH_DATA;
3427c478bd9Sstevel@tonic-gate 
3437c478bd9Sstevel@tonic-gate 
3447c478bd9Sstevel@tonic-gate /*
3457c478bd9Sstevel@tonic-gate  * Predefined Namespace items
3467c478bd9Sstevel@tonic-gate  */
3477c478bd9Sstevel@tonic-gate typedef struct acpi_predefined_names
3487c478bd9Sstevel@tonic-gate {
3497c478bd9Sstevel@tonic-gate     char                    *Name;
3507c478bd9Sstevel@tonic-gate     UINT8                   Type;
3517c478bd9Sstevel@tonic-gate     char                    *Val;
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate } ACPI_PREDEFINED_NAMES;
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate 
3567c478bd9Sstevel@tonic-gate /* Object types used during package copies */
3577c478bd9Sstevel@tonic-gate 
3587c478bd9Sstevel@tonic-gate 
3597c478bd9Sstevel@tonic-gate #define ACPI_COPY_TYPE_SIMPLE           0
3607c478bd9Sstevel@tonic-gate #define ACPI_COPY_TYPE_PACKAGE          1
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate /* Info structure used to convert external<->internal namestrings */
3637c478bd9Sstevel@tonic-gate 
3647c478bd9Sstevel@tonic-gate typedef struct acpi_namestring_info
3657c478bd9Sstevel@tonic-gate {
3667c478bd9Sstevel@tonic-gate     char                    *ExternalName;
3677c478bd9Sstevel@tonic-gate     char                    *NextExternalChar;
3687c478bd9Sstevel@tonic-gate     char                    *InternalName;
3697c478bd9Sstevel@tonic-gate     UINT32                  Length;
3707c478bd9Sstevel@tonic-gate     UINT32                  NumSegments;
3717c478bd9Sstevel@tonic-gate     UINT32                  NumCarats;
3727c478bd9Sstevel@tonic-gate     BOOLEAN                 FullyQualified;
3737c478bd9Sstevel@tonic-gate 
3747c478bd9Sstevel@tonic-gate } ACPI_NAMESTRING_INFO;
3757c478bd9Sstevel@tonic-gate 
3767c478bd9Sstevel@tonic-gate 
3777c478bd9Sstevel@tonic-gate /* Field creation info */
3787c478bd9Sstevel@tonic-gate 
3797c478bd9Sstevel@tonic-gate typedef struct acpi_create_field_info
3807c478bd9Sstevel@tonic-gate {
3817c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE     *RegionNode;
3827c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE     *FieldNode;
3837c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE     *RegisterNode;
3847c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE     *DataRegisterNode;
3857c478bd9Sstevel@tonic-gate     UINT32                  BankValue;
3867c478bd9Sstevel@tonic-gate     UINT32                  FieldBitPosition;
3877c478bd9Sstevel@tonic-gate     UINT32                  FieldBitLength;
3887c478bd9Sstevel@tonic-gate     UINT8                   FieldFlags;
3897c478bd9Sstevel@tonic-gate     UINT8                   Attribute;
3907c478bd9Sstevel@tonic-gate     UINT8                   FieldType;
3917c478bd9Sstevel@tonic-gate 
3927c478bd9Sstevel@tonic-gate } ACPI_CREATE_FIELD_INFO;
3937c478bd9Sstevel@tonic-gate 
3947c478bd9Sstevel@tonic-gate 
3957c478bd9Sstevel@tonic-gate /*****************************************************************************
3967c478bd9Sstevel@tonic-gate  *
3977c478bd9Sstevel@tonic-gate  * Event typedefs and structs
3987c478bd9Sstevel@tonic-gate  *
3997c478bd9Sstevel@tonic-gate  ****************************************************************************/
4007c478bd9Sstevel@tonic-gate 
4017c478bd9Sstevel@tonic-gate /* Dispatch info for each GPE -- either a method or handler, cannot be both */
4027c478bd9Sstevel@tonic-gate 
4037c478bd9Sstevel@tonic-gate typedef struct acpi_handler_info
4047c478bd9Sstevel@tonic-gate {
4057c478bd9Sstevel@tonic-gate     ACPI_EVENT_HANDLER              Address;        /* Address of handler, if any */
4067c478bd9Sstevel@tonic-gate     void                            *Context;       /* Context to be passed to handler */
4077c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
4087c478bd9Sstevel@tonic-gate 
4097c478bd9Sstevel@tonic-gate } ACPI_HANDLER_INFO;
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate typedef union acpi_gpe_dispatch_info
4127c478bd9Sstevel@tonic-gate {
4137c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
4147c478bd9Sstevel@tonic-gate     struct acpi_handler_info        *Handler;
4157c478bd9Sstevel@tonic-gate 
4167c478bd9Sstevel@tonic-gate } ACPI_GPE_DISPATCH_INFO;
4177c478bd9Sstevel@tonic-gate 
4187c478bd9Sstevel@tonic-gate /*
4197c478bd9Sstevel@tonic-gate  * Information about a GPE, one per each GPE in an array.
4207c478bd9Sstevel@tonic-gate  * NOTE: Important to keep this struct as small as possible.
4217c478bd9Sstevel@tonic-gate  */
4227c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_event_info
4237c478bd9Sstevel@tonic-gate {
4247c478bd9Sstevel@tonic-gate     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method or Handler */
4257c478bd9Sstevel@tonic-gate     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
4267c478bd9Sstevel@tonic-gate     UINT8                           Flags;          /* Misc info about this GPE */
4277c478bd9Sstevel@tonic-gate     UINT8                           RegisterBit;    /* This GPE bit within the register */
4287c478bd9Sstevel@tonic-gate 
4297c478bd9Sstevel@tonic-gate } ACPI_GPE_EVENT_INFO;
4307c478bd9Sstevel@tonic-gate 
4317c478bd9Sstevel@tonic-gate /* Information about a GPE register pair, one per each status/enable pair in an array */
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_register_info
4347c478bd9Sstevel@tonic-gate {
4357c478bd9Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
4367c478bd9Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
4377c478bd9Sstevel@tonic-gate     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
4387c478bd9Sstevel@tonic-gate     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
4397c478bd9Sstevel@tonic-gate     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
4407c478bd9Sstevel@tonic-gate 
4417c478bd9Sstevel@tonic-gate } ACPI_GPE_REGISTER_INFO;
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate /*
4447c478bd9Sstevel@tonic-gate  * Information about a GPE register block, one per each installed block --
4457c478bd9Sstevel@tonic-gate  * GPE0, GPE1, and one per each installed GPE Block Device.
4467c478bd9Sstevel@tonic-gate  */
4477c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_block_info
4487c478bd9Sstevel@tonic-gate {
4497c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *Node;
4507c478bd9Sstevel@tonic-gate     struct acpi_gpe_block_info      *Previous;
4517c478bd9Sstevel@tonic-gate     struct acpi_gpe_block_info      *Next;
4527c478bd9Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
4537c478bd9Sstevel@tonic-gate     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
4547c478bd9Sstevel@tonic-gate     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
4557c478bd9Sstevel@tonic-gate     ACPI_GENERIC_ADDRESS            BlockAddress;   /* Base address of the block */
4567c478bd9Sstevel@tonic-gate     UINT32                          RegisterCount;  /* Number of register pairs in block */
4577c478bd9Sstevel@tonic-gate     UINT8                           BlockBaseNumber;/* Base GPE number for this block */
4587c478bd9Sstevel@tonic-gate 
4597c478bd9Sstevel@tonic-gate } ACPI_GPE_BLOCK_INFO;
4607c478bd9Sstevel@tonic-gate 
4617c478bd9Sstevel@tonic-gate /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
4627c478bd9Sstevel@tonic-gate 
4637c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_xrupt_info
4647c478bd9Sstevel@tonic-gate {
4657c478bd9Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *Previous;
4667c478bd9Sstevel@tonic-gate     struct acpi_gpe_xrupt_info      *Next;
4677c478bd9Sstevel@tonic-gate     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
468*450d6964Smyers     UINT32                          InterruptNumber;    /* System interrupt number */
4697c478bd9Sstevel@tonic-gate 
4707c478bd9Sstevel@tonic-gate } ACPI_GPE_XRUPT_INFO;
4717c478bd9Sstevel@tonic-gate 
4727c478bd9Sstevel@tonic-gate 
4737c478bd9Sstevel@tonic-gate typedef struct acpi_gpe_walk_info
4747c478bd9Sstevel@tonic-gate {
4757c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE             *GpeDevice;
4767c478bd9Sstevel@tonic-gate     ACPI_GPE_BLOCK_INFO             *GpeBlock;
4777c478bd9Sstevel@tonic-gate 
4787c478bd9Sstevel@tonic-gate } ACPI_GPE_WALK_INFO;
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate 
4817c478bd9Sstevel@tonic-gate typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
4827c478bd9Sstevel@tonic-gate     ACPI_GPE_XRUPT_INFO     *GpeXruptInfo,
4837c478bd9Sstevel@tonic-gate     ACPI_GPE_BLOCK_INFO     *GpeBlock);
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate 
4867c478bd9Sstevel@tonic-gate /* Information about each particular fixed event */
4877c478bd9Sstevel@tonic-gate 
4887c478bd9Sstevel@tonic-gate typedef struct acpi_fixed_event_handler
4897c478bd9Sstevel@tonic-gate {
4907c478bd9Sstevel@tonic-gate     ACPI_EVENT_HANDLER      Handler;        /* Address of handler. */
4917c478bd9Sstevel@tonic-gate     void                    *Context;       /* Context to be passed to handler */
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate } ACPI_FIXED_EVENT_HANDLER;
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate typedef struct acpi_fixed_event_info
4967c478bd9Sstevel@tonic-gate {
4977c478bd9Sstevel@tonic-gate     UINT8                   StatusRegisterId;
4987c478bd9Sstevel@tonic-gate     UINT8                   EnableRegisterId;
4997c478bd9Sstevel@tonic-gate     UINT16                  StatusBitMask;
5007c478bd9Sstevel@tonic-gate     UINT16                  EnableBitMask;
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate } ACPI_FIXED_EVENT_INFO;
5037c478bd9Sstevel@tonic-gate 
5047c478bd9Sstevel@tonic-gate /* Information used during field processing */
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate typedef struct acpi_field_info
5077c478bd9Sstevel@tonic-gate {
5087c478bd9Sstevel@tonic-gate     UINT8                   SkipField;
5097c478bd9Sstevel@tonic-gate     UINT8                   FieldFlag;
5107c478bd9Sstevel@tonic-gate     UINT32                  PkgLength;
5117c478bd9Sstevel@tonic-gate 
5127c478bd9Sstevel@tonic-gate } ACPI_FIELD_INFO;
5137c478bd9Sstevel@tonic-gate 
5147c478bd9Sstevel@tonic-gate 
5157c478bd9Sstevel@tonic-gate /*****************************************************************************
5167c478bd9Sstevel@tonic-gate  *
5177c478bd9Sstevel@tonic-gate  * Generic "state" object for stacks
5187c478bd9Sstevel@tonic-gate  *
5197c478bd9Sstevel@tonic-gate  ****************************************************************************/
5207c478bd9Sstevel@tonic-gate 
5217c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_NORMAL                  0xC0
5227c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
5237c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
5247c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
5257c478bd9Sstevel@tonic-gate #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
5267c478bd9Sstevel@tonic-gate 
5277c478bd9Sstevel@tonic-gate 
5287c478bd9Sstevel@tonic-gate #define ACPI_STATE_COMMON                  /* Two 32-bit fields and a pointer */\
5297c478bd9Sstevel@tonic-gate     UINT8                       DataType;           /* To differentiate various internal objs */\
5307c478bd9Sstevel@tonic-gate     UINT8                       Flags;      \
5317c478bd9Sstevel@tonic-gate     UINT16                      Value;      \
5327c478bd9Sstevel@tonic-gate     UINT16                      State;      \
5337c478bd9Sstevel@tonic-gate     UINT16                      Reserved;   \
5347c478bd9Sstevel@tonic-gate     void                        *Next;      \
5357c478bd9Sstevel@tonic-gate 
5367c478bd9Sstevel@tonic-gate typedef struct acpi_common_state
5377c478bd9Sstevel@tonic-gate {
5387c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
5397c478bd9Sstevel@tonic-gate } ACPI_COMMON_STATE;
5407c478bd9Sstevel@tonic-gate 
5417c478bd9Sstevel@tonic-gate 
5427c478bd9Sstevel@tonic-gate /*
5437c478bd9Sstevel@tonic-gate  * Update state - used to traverse complex objects such as packages
5447c478bd9Sstevel@tonic-gate  */
5457c478bd9Sstevel@tonic-gate typedef struct acpi_update_state
5467c478bd9Sstevel@tonic-gate {
5477c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
5487c478bd9Sstevel@tonic-gate     union acpi_operand_object   *Object;
5497c478bd9Sstevel@tonic-gate 
5507c478bd9Sstevel@tonic-gate } ACPI_UPDATE_STATE;
5517c478bd9Sstevel@tonic-gate 
5527c478bd9Sstevel@tonic-gate 
5537c478bd9Sstevel@tonic-gate /*
5547c478bd9Sstevel@tonic-gate  * Pkg state - used to traverse nested package structures
5557c478bd9Sstevel@tonic-gate  */
5567c478bd9Sstevel@tonic-gate typedef struct acpi_pkg_state
5577c478bd9Sstevel@tonic-gate {
5587c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
5597c478bd9Sstevel@tonic-gate     union acpi_operand_object   *SourceObject;
5607c478bd9Sstevel@tonic-gate     union acpi_operand_object   *DestObject;
5617c478bd9Sstevel@tonic-gate     struct acpi_walk_state      *WalkState;
5627c478bd9Sstevel@tonic-gate     void                        *ThisTargetObj;
5637c478bd9Sstevel@tonic-gate     UINT32                      NumPackages;
5647c478bd9Sstevel@tonic-gate     UINT16                      Index;
5657c478bd9Sstevel@tonic-gate 
5667c478bd9Sstevel@tonic-gate } ACPI_PKG_STATE;
5677c478bd9Sstevel@tonic-gate 
5687c478bd9Sstevel@tonic-gate 
5697c478bd9Sstevel@tonic-gate /*
5707c478bd9Sstevel@tonic-gate  * Control state - one per if/else and while constructs.
5717c478bd9Sstevel@tonic-gate  * Allows nesting of these constructs
5727c478bd9Sstevel@tonic-gate  */
5737c478bd9Sstevel@tonic-gate typedef struct acpi_control_state
5747c478bd9Sstevel@tonic-gate {
5757c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
5767c478bd9Sstevel@tonic-gate     union acpi_parse_object     *PredicateOp;
5777c478bd9Sstevel@tonic-gate     UINT8                       *AmlPredicateStart;     /* Start of if/while predicate */
5787c478bd9Sstevel@tonic-gate     UINT8                       *PackageEnd;            /* End of if/while block */
5797c478bd9Sstevel@tonic-gate     UINT16                      Opcode;
5807c478bd9Sstevel@tonic-gate 
5817c478bd9Sstevel@tonic-gate } ACPI_CONTROL_STATE;
5827c478bd9Sstevel@tonic-gate 
5837c478bd9Sstevel@tonic-gate 
5847c478bd9Sstevel@tonic-gate /*
5857c478bd9Sstevel@tonic-gate  * Scope state - current scope during namespace lookups
5867c478bd9Sstevel@tonic-gate  */
5877c478bd9Sstevel@tonic-gate typedef struct acpi_scope_state
5887c478bd9Sstevel@tonic-gate {
5897c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
5907c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE         *Node;
5917c478bd9Sstevel@tonic-gate 
5927c478bd9Sstevel@tonic-gate } ACPI_SCOPE_STATE;
5937c478bd9Sstevel@tonic-gate 
5947c478bd9Sstevel@tonic-gate 
5957c478bd9Sstevel@tonic-gate typedef struct acpi_pscope_state
5967c478bd9Sstevel@tonic-gate {
5977c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
5987c478bd9Sstevel@tonic-gate     union acpi_parse_object     *Op;                    /* Current op being parsed */
5997c478bd9Sstevel@tonic-gate     UINT8                       *ArgEnd;                /* Current argument end */
6007c478bd9Sstevel@tonic-gate     UINT8                       *PkgEnd;                /* Current package end */
6017c478bd9Sstevel@tonic-gate     UINT32                      ArgList;                /* Next argument to parse */
6027c478bd9Sstevel@tonic-gate     UINT32                      ArgCount;               /* Number of fixed arguments */
6037c478bd9Sstevel@tonic-gate 
6047c478bd9Sstevel@tonic-gate } ACPI_PSCOPE_STATE;
6057c478bd9Sstevel@tonic-gate 
6067c478bd9Sstevel@tonic-gate 
6077c478bd9Sstevel@tonic-gate /*
6087c478bd9Sstevel@tonic-gate  * Thread state - one per thread across multiple walk states.  Multiple walk
6097c478bd9Sstevel@tonic-gate  * states are created when there are nested control methods executing.
6107c478bd9Sstevel@tonic-gate  */
6117c478bd9Sstevel@tonic-gate typedef struct acpi_thread_state
6127c478bd9Sstevel@tonic-gate {
6137c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
6147c478bd9Sstevel@tonic-gate     struct acpi_walk_state      *WalkStateList;         /* Head of list of WalkStates for this thread */
6157c478bd9Sstevel@tonic-gate     union acpi_operand_object   *AcquiredMutexList;     /* List of all currently acquired mutexes */
6167c478bd9Sstevel@tonic-gate     UINT32                      ThreadId;               /* Running thread ID */
6177c478bd9Sstevel@tonic-gate     UINT8                       CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
6187c478bd9Sstevel@tonic-gate 
6197c478bd9Sstevel@tonic-gate } ACPI_THREAD_STATE;
6207c478bd9Sstevel@tonic-gate 
6217c478bd9Sstevel@tonic-gate 
6227c478bd9Sstevel@tonic-gate /*
6237c478bd9Sstevel@tonic-gate  * Result values - used to accumulate the results of nested
6247c478bd9Sstevel@tonic-gate  * AML arguments
6257c478bd9Sstevel@tonic-gate  */
6267c478bd9Sstevel@tonic-gate typedef struct acpi_result_values
6277c478bd9Sstevel@tonic-gate {
6287c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
6297c478bd9Sstevel@tonic-gate     union acpi_operand_object   *ObjDesc [ACPI_OBJ_NUM_OPERANDS];
6307c478bd9Sstevel@tonic-gate     UINT8                       NumResults;
6317c478bd9Sstevel@tonic-gate     UINT8                       LastInsert;
6327c478bd9Sstevel@tonic-gate 
6337c478bd9Sstevel@tonic-gate } ACPI_RESULT_VALUES;
6347c478bd9Sstevel@tonic-gate 
6357c478bd9Sstevel@tonic-gate 
6367c478bd9Sstevel@tonic-gate typedef
6377c478bd9Sstevel@tonic-gate ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
6387c478bd9Sstevel@tonic-gate     struct acpi_walk_state      *WalkState,
6397c478bd9Sstevel@tonic-gate     union acpi_parse_object     **OutOp);
6407c478bd9Sstevel@tonic-gate 
6417c478bd9Sstevel@tonic-gate typedef
6427c478bd9Sstevel@tonic-gate ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
6437c478bd9Sstevel@tonic-gate     struct acpi_walk_state      *WalkState);
6447c478bd9Sstevel@tonic-gate 
6457c478bd9Sstevel@tonic-gate 
6467c478bd9Sstevel@tonic-gate /*
6477c478bd9Sstevel@tonic-gate  * Notify info - used to pass info to the deferred notify
6487c478bd9Sstevel@tonic-gate  * handler/dispatcher.
6497c478bd9Sstevel@tonic-gate  */
6507c478bd9Sstevel@tonic-gate typedef struct acpi_notify_info
6517c478bd9Sstevel@tonic-gate {
6527c478bd9Sstevel@tonic-gate     ACPI_STATE_COMMON
6537c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE         *Node;
6547c478bd9Sstevel@tonic-gate     union acpi_operand_object   *HandlerObj;
6557c478bd9Sstevel@tonic-gate 
6567c478bd9Sstevel@tonic-gate } ACPI_NOTIFY_INFO;
6577c478bd9Sstevel@tonic-gate 
6587c478bd9Sstevel@tonic-gate 
6597c478bd9Sstevel@tonic-gate /* Generic state is union of structs above */
6607c478bd9Sstevel@tonic-gate 
6617c478bd9Sstevel@tonic-gate typedef union acpi_generic_state
6627c478bd9Sstevel@tonic-gate {
6637c478bd9Sstevel@tonic-gate     ACPI_COMMON_STATE           Common;
6647c478bd9Sstevel@tonic-gate     ACPI_CONTROL_STATE          Control;
6657c478bd9Sstevel@tonic-gate     ACPI_UPDATE_STATE           Update;
6667c478bd9Sstevel@tonic-gate     ACPI_SCOPE_STATE            Scope;
6677c478bd9Sstevel@tonic-gate     ACPI_PSCOPE_STATE           ParseScope;
6687c478bd9Sstevel@tonic-gate     ACPI_PKG_STATE              Pkg;
6697c478bd9Sstevel@tonic-gate     ACPI_THREAD_STATE           Thread;
6707c478bd9Sstevel@tonic-gate     ACPI_RESULT_VALUES          Results;
6717c478bd9Sstevel@tonic-gate     ACPI_NOTIFY_INFO            Notify;
6727c478bd9Sstevel@tonic-gate 
6737c478bd9Sstevel@tonic-gate } ACPI_GENERIC_STATE;
6747c478bd9Sstevel@tonic-gate 
6757c478bd9Sstevel@tonic-gate 
6767c478bd9Sstevel@tonic-gate /*****************************************************************************
6777c478bd9Sstevel@tonic-gate  *
6787c478bd9Sstevel@tonic-gate  * Interpreter typedefs and structs
6797c478bd9Sstevel@tonic-gate  *
6807c478bd9Sstevel@tonic-gate  ****************************************************************************/
6817c478bd9Sstevel@tonic-gate 
6827c478bd9Sstevel@tonic-gate typedef
6837c478bd9Sstevel@tonic-gate ACPI_STATUS (*ACPI_EXECUTE_OP) (
6847c478bd9Sstevel@tonic-gate     struct acpi_walk_state      *WalkState);
6857c478bd9Sstevel@tonic-gate 
6867c478bd9Sstevel@tonic-gate 
6877c478bd9Sstevel@tonic-gate /*****************************************************************************
6887c478bd9Sstevel@tonic-gate  *
6897c478bd9Sstevel@tonic-gate  * Parser typedefs and structs
6907c478bd9Sstevel@tonic-gate  *
6917c478bd9Sstevel@tonic-gate  ****************************************************************************/
6927c478bd9Sstevel@tonic-gate 
6937c478bd9Sstevel@tonic-gate /*
6947c478bd9Sstevel@tonic-gate  * AML opcode, name, and argument layout
6957c478bd9Sstevel@tonic-gate  */
6967c478bd9Sstevel@tonic-gate typedef struct acpi_opcode_info
6977c478bd9Sstevel@tonic-gate {
6987c478bd9Sstevel@tonic-gate #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
6997c478bd9Sstevel@tonic-gate     char                        *Name;          /* Opcode name (disassembler/debug only) */
7007c478bd9Sstevel@tonic-gate #endif
7017c478bd9Sstevel@tonic-gate     UINT32                      ParseArgs;      /* Grammar/Parse time arguments */
7027c478bd9Sstevel@tonic-gate     UINT32                      RuntimeArgs;    /* Interpret time arguments */
7037c478bd9Sstevel@tonic-gate     UINT32                      Flags;          /* Misc flags */
7047c478bd9Sstevel@tonic-gate     UINT8                       ObjectType;     /* Corresponding internal object type */
7057c478bd9Sstevel@tonic-gate     UINT8                       Class;          /* Opcode class */
7067c478bd9Sstevel@tonic-gate     UINT8                       Type;           /* Opcode type */
7077c478bd9Sstevel@tonic-gate 
7087c478bd9Sstevel@tonic-gate } ACPI_OPCODE_INFO;
7097c478bd9Sstevel@tonic-gate 
7107c478bd9Sstevel@tonic-gate typedef union acpi_parse_value
7117c478bd9Sstevel@tonic-gate {
7127c478bd9Sstevel@tonic-gate     ACPI_INTEGER                Integer;        /* Integer constant (Up to 64 bits) */
7137c478bd9Sstevel@tonic-gate     UINT64_STRUCT               Integer64;      /* Structure overlay for 2 32-bit Dwords */
7147c478bd9Sstevel@tonic-gate     UINT32                      Size;           /* bytelist or field size */
7157c478bd9Sstevel@tonic-gate     char                        *String;        /* NULL terminated string */
7167c478bd9Sstevel@tonic-gate     UINT8                       *Buffer;        /* buffer or string */
7177c478bd9Sstevel@tonic-gate     char                        *Name;          /* NULL terminated string */
7187c478bd9Sstevel@tonic-gate     union acpi_parse_object     *Arg;           /* arguments and contained ops */
7197c478bd9Sstevel@tonic-gate 
7207c478bd9Sstevel@tonic-gate } ACPI_PARSE_VALUE;
7217c478bd9Sstevel@tonic-gate 
7227c478bd9Sstevel@tonic-gate #define ACPI_PARSE_COMMON \
7237c478bd9Sstevel@tonic-gate     UINT8                       DataType;       /* To differentiate various internal objs */\
7247c478bd9Sstevel@tonic-gate     UINT8                       Flags;          /* Type of Op */\
7257c478bd9Sstevel@tonic-gate     UINT16                      AmlOpcode;      /* AML opcode */\
7267c478bd9Sstevel@tonic-gate     UINT32                      AmlOffset;      /* Offset of declaration in AML */\
7277c478bd9Sstevel@tonic-gate     union acpi_parse_object     *Parent;        /* Parent op */\
7287c478bd9Sstevel@tonic-gate     union acpi_parse_object     *Next;          /* Next op */\
7297c478bd9Sstevel@tonic-gate     ACPI_DISASM_ONLY_MEMBERS (\
7307c478bd9Sstevel@tonic-gate     UINT8                       DisasmFlags;    /* Used during AML disassembly */\
7317c478bd9Sstevel@tonic-gate     UINT8                       DisasmOpcode;   /* Subtype used for disassembly */\
7327c478bd9Sstevel@tonic-gate     char                        AmlOpName[16])  /* Op name (debug only) */\
7337c478bd9Sstevel@tonic-gate                                                 /* NON-DEBUG members below: */\
7347c478bd9Sstevel@tonic-gate     ACPI_NAMESPACE_NODE         *Node;          /* For use by interpreter */\
7357c478bd9Sstevel@tonic-gate     ACPI_PARSE_VALUE            Value;          /* Value or args associated with the opcode */\
7367c478bd9Sstevel@tonic-gate 
7377c478bd9Sstevel@tonic-gate 
7387c478bd9Sstevel@tonic-gate #define ACPI_DASM_BUFFER        0x00
7397c478bd9Sstevel@tonic-gate #define ACPI_DASM_RESOURCE      0x01
7407c478bd9Sstevel@tonic-gate #define ACPI_DASM_STRING        0x02
7417c478bd9Sstevel@tonic-gate #define ACPI_DASM_UNICODE       0x03
7427c478bd9Sstevel@tonic-gate #define ACPI_DASM_EISAID        0x04
7437c478bd9Sstevel@tonic-gate #define ACPI_DASM_MATCHOP       0x05
7447c478bd9Sstevel@tonic-gate 
7457c478bd9Sstevel@tonic-gate /*
7467c478bd9Sstevel@tonic-gate  * generic operation (for example:  If, While, Store)
7477c478bd9Sstevel@tonic-gate  */
7487c478bd9Sstevel@tonic-gate typedef struct acpi_parse_obj_common
7497c478bd9Sstevel@tonic-gate {
7507c478bd9Sstevel@tonic-gate     ACPI_PARSE_COMMON
7517c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJ_COMMON;
7527c478bd9Sstevel@tonic-gate 
7537c478bd9Sstevel@tonic-gate 
7547c478bd9Sstevel@tonic-gate /*
7557c478bd9Sstevel@tonic-gate  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
7567c478bd9Sstevel@tonic-gate  * and bytelists.
7577c478bd9Sstevel@tonic-gate  */
7587c478bd9Sstevel@tonic-gate typedef struct acpi_parse_obj_named
7597c478bd9Sstevel@tonic-gate {
7607c478bd9Sstevel@tonic-gate     ACPI_PARSE_COMMON
7617c478bd9Sstevel@tonic-gate     UINT8                       *Path;
7627c478bd9Sstevel@tonic-gate     UINT8                       *Data;          /* AML body or bytelist data */
7637c478bd9Sstevel@tonic-gate     UINT32                      Length;         /* AML length */
7647c478bd9Sstevel@tonic-gate     UINT32                      Name;           /* 4-byte name or zero if no name */
7657c478bd9Sstevel@tonic-gate 
7667c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJ_NAMED;
7677c478bd9Sstevel@tonic-gate 
7687c478bd9Sstevel@tonic-gate 
7697c478bd9Sstevel@tonic-gate /* The parse node is the fundamental element of the parse tree */
7707c478bd9Sstevel@tonic-gate 
7717c478bd9Sstevel@tonic-gate typedef struct acpi_parse_obj_asl
7727c478bd9Sstevel@tonic-gate {
7737c478bd9Sstevel@tonic-gate     ACPI_PARSE_COMMON
7747c478bd9Sstevel@tonic-gate     union acpi_parse_object     *Child;
7757c478bd9Sstevel@tonic-gate     union acpi_parse_object     *ParentMethod;
7767c478bd9Sstevel@tonic-gate     char                        *Filename;
7777c478bd9Sstevel@tonic-gate     char                        *ExternalName;
7787c478bd9Sstevel@tonic-gate     char                        *Namepath;
7797c478bd9Sstevel@tonic-gate     char                        NameSeg[4];
7807c478bd9Sstevel@tonic-gate     UINT32                      ExtraValue;
7817c478bd9Sstevel@tonic-gate     UINT32                      Column;
7827c478bd9Sstevel@tonic-gate     UINT32                      LineNumber;
7837c478bd9Sstevel@tonic-gate     UINT32                      LogicalLineNumber;
7847c478bd9Sstevel@tonic-gate     UINT32                      LogicalByteOffset;
7857c478bd9Sstevel@tonic-gate     UINT32                      EndLine;
7867c478bd9Sstevel@tonic-gate     UINT32                      EndLogicalLine;
7877c478bd9Sstevel@tonic-gate     UINT32                      AcpiBtype;
7887c478bd9Sstevel@tonic-gate     UINT32                      AmlLength;
7897c478bd9Sstevel@tonic-gate     UINT32                      AmlSubtreeLength;
7907c478bd9Sstevel@tonic-gate     UINT32                      FinalAmlLength;
7917c478bd9Sstevel@tonic-gate     UINT32                      FinalAmlOffset;
7927c478bd9Sstevel@tonic-gate     UINT32                      CompileFlags;
7937c478bd9Sstevel@tonic-gate     UINT16                      ParseOpcode;
7947c478bd9Sstevel@tonic-gate     UINT8                       AmlOpcodeLength;
7957c478bd9Sstevel@tonic-gate     UINT8                       AmlPkgLenBytes;
7967c478bd9Sstevel@tonic-gate     UINT8                       Extra;
7977c478bd9Sstevel@tonic-gate     char                        ParseOpName[12];
7987c478bd9Sstevel@tonic-gate 
7997c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJ_ASL;
8007c478bd9Sstevel@tonic-gate 
8017c478bd9Sstevel@tonic-gate typedef union acpi_parse_object
8027c478bd9Sstevel@tonic-gate {
8037c478bd9Sstevel@tonic-gate     ACPI_PARSE_OBJ_COMMON       Common;
8047c478bd9Sstevel@tonic-gate     ACPI_PARSE_OBJ_NAMED        Named;
8057c478bd9Sstevel@tonic-gate     ACPI_PARSE_OBJ_ASL          Asl;
8067c478bd9Sstevel@tonic-gate 
8077c478bd9Sstevel@tonic-gate } ACPI_PARSE_OBJECT;
8087c478bd9Sstevel@tonic-gate 
8097c478bd9Sstevel@tonic-gate 
8107c478bd9Sstevel@tonic-gate /*
8117c478bd9Sstevel@tonic-gate  * Parse state - one state per parser invocation and each control
8127c478bd9Sstevel@tonic-gate  * method.
8137c478bd9Sstevel@tonic-gate  */
8147c478bd9Sstevel@tonic-gate typedef struct acpi_parse_state
8157c478bd9Sstevel@tonic-gate {
8167c478bd9Sstevel@tonic-gate     UINT32                      AmlSize;
8177c478bd9Sstevel@tonic-gate     UINT8                       *AmlStart;      /* First AML byte */
8187c478bd9Sstevel@tonic-gate     UINT8                       *Aml;           /* Next AML byte */
8197c478bd9Sstevel@tonic-gate     UINT8                       *AmlEnd;        /* (last + 1) AML byte */
8207c478bd9Sstevel@tonic-gate     UINT8                       *PkgStart;      /* Current package begin */
8217c478bd9Sstevel@tonic-gate     UINT8                       *PkgEnd;        /* Current package end */
8227c478bd9Sstevel@tonic-gate     union acpi_parse_object     *StartOp;       /* Root of parse tree */
8237c478bd9Sstevel@tonic-gate     struct acpi_namespace_node  *StartNode;
8247c478bd9Sstevel@tonic-gate     union acpi_generic_state    *Scope;         /* Current scope */
8257c478bd9Sstevel@tonic-gate     union acpi_parse_object     *StartScope;
8267c478bd9Sstevel@tonic-gate 
8277c478bd9Sstevel@tonic-gate } ACPI_PARSE_STATE;
8287c478bd9Sstevel@tonic-gate 
8297c478bd9Sstevel@tonic-gate 
8307c478bd9Sstevel@tonic-gate /* Parse object flags */
8317c478bd9Sstevel@tonic-gate 
8327c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_GENERIC                    0x01
8337c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_NAMED                      0x02
8347c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_DEFERRED                   0x04
8357c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_BYTELIST                   0x08
8367c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_IN_CACHE                   0x80
8377c478bd9Sstevel@tonic-gate 
8387c478bd9Sstevel@tonic-gate /* Parse object DisasmFlags */
8397c478bd9Sstevel@tonic-gate 
8407c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_IGNORE                     0x01
8417c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_PARAMLIST                  0x02
8427c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_EMPTY_TERMLIST             0x04
8437c478bd9Sstevel@tonic-gate #define ACPI_PARSEOP_SPECIAL                    0x10
8447c478bd9Sstevel@tonic-gate 
8457c478bd9Sstevel@tonic-gate 
8467c478bd9Sstevel@tonic-gate /*****************************************************************************
8477c478bd9Sstevel@tonic-gate  *
8487c478bd9Sstevel@tonic-gate  * Hardware (ACPI registers) and PNP
8497c478bd9Sstevel@tonic-gate  *
8507c478bd9Sstevel@tonic-gate  ****************************************************************************/
8517c478bd9Sstevel@tonic-gate 
8527c478bd9Sstevel@tonic-gate #define PCI_ROOT_HID_STRING         "PNP0A03"
853*450d6964Smyers #define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
8547c478bd9Sstevel@tonic-gate 
8557c478bd9Sstevel@tonic-gate typedef struct acpi_bit_register_info
8567c478bd9Sstevel@tonic-gate {
8577c478bd9Sstevel@tonic-gate     UINT8                       ParentRegister;
8587c478bd9Sstevel@tonic-gate     UINT8                       BitPosition;
8597c478bd9Sstevel@tonic-gate     UINT16                      AccessBitMask;
8607c478bd9Sstevel@tonic-gate 
8617c478bd9Sstevel@tonic-gate } ACPI_BIT_REGISTER_INFO;
8627c478bd9Sstevel@tonic-gate 
8637c478bd9Sstevel@tonic-gate 
8647c478bd9Sstevel@tonic-gate /*
8657c478bd9Sstevel@tonic-gate  * Register IDs
8667c478bd9Sstevel@tonic-gate  * These are the full ACPI registers
8677c478bd9Sstevel@tonic-gate  */
8687c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1_STATUS                0x01
8697c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1_ENABLE                0x02
8707c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1_CONTROL               0x03
8717c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1A_CONTROL              0x04
8727c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM1B_CONTROL              0x05
8737c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM2_CONTROL               0x06
8747c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PM_TIMER                  0x07
8757c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_PROCESSOR_BLOCK           0x08
8767c478bd9Sstevel@tonic-gate #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x09
8777c478bd9Sstevel@tonic-gate 
8787c478bd9Sstevel@tonic-gate 
8797c478bd9Sstevel@tonic-gate /* Masks used to access the BitRegisters */
8807c478bd9Sstevel@tonic-gate 
8817c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_TIMER_STATUS               0x0001
8827c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
8837c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
8847c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
8857c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
8867c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
8877c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
8887c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_WAKE_STATUS                0x8000
8897c478bd9Sstevel@tonic-gate 
8907c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_ALL_FIXED_STATUS           (ACPI_BITMASK_TIMER_STATUS          | \
8917c478bd9Sstevel@tonic-gate                                                  ACPI_BITMASK_BUS_MASTER_STATUS     | \
8927c478bd9Sstevel@tonic-gate                                                  ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
8937c478bd9Sstevel@tonic-gate                                                  ACPI_BITMASK_POWER_BUTTON_STATUS   | \
8947c478bd9Sstevel@tonic-gate                                                  ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
8957c478bd9Sstevel@tonic-gate                                                  ACPI_BITMASK_RT_CLOCK_STATUS       | \
8967c478bd9Sstevel@tonic-gate                                                  ACPI_BITMASK_WAKE_STATUS)
8977c478bd9Sstevel@tonic-gate 
8987c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_TIMER_ENABLE               0x0001
8997c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
9007c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
9017c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
9027c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
9037c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
9047c478bd9Sstevel@tonic-gate 
9057c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SCI_ENABLE                 0x0001
9067c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
9077c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
9087c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_TYPE_X               0x1C00
9097c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
9107c478bd9Sstevel@tonic-gate 
9117c478bd9Sstevel@tonic-gate #define ACPI_BITMASK_ARB_DISABLE                0x0001
9127c478bd9Sstevel@tonic-gate 
9137c478bd9Sstevel@tonic-gate 
9147c478bd9Sstevel@tonic-gate /* Raw bit position of each BitRegister */
9157c478bd9Sstevel@tonic-gate 
9167c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_TIMER_STATUS           0x00
9177c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
9187c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
9197c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
9207c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
9217c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
9227c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
9237c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
9247c478bd9Sstevel@tonic-gate 
9257c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
9267c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
9277c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
9287c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
9297c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
9307c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
9317c478bd9Sstevel@tonic-gate 
9327c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SCI_ENABLE             0x00
9337c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
9347c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
9357c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_TYPE_X           0x0A
9367c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
9377c478bd9Sstevel@tonic-gate 
9387c478bd9Sstevel@tonic-gate #define ACPI_BITPOSITION_ARB_DISABLE            0x00
9397c478bd9Sstevel@tonic-gate 
9407c478bd9Sstevel@tonic-gate 
9417c478bd9Sstevel@tonic-gate /*****************************************************************************
9427c478bd9Sstevel@tonic-gate  *
9437c478bd9Sstevel@tonic-gate  * Resource descriptors
9447c478bd9Sstevel@tonic-gate  *
9457c478bd9Sstevel@tonic-gate  ****************************************************************************/
9467c478bd9Sstevel@tonic-gate 
9477c478bd9Sstevel@tonic-gate /* ResourceType values */
9487c478bd9Sstevel@tonic-gate 
9497c478bd9Sstevel@tonic-gate #define ACPI_RESOURCE_TYPE_MEMORY_RANGE         0
9507c478bd9Sstevel@tonic-gate #define ACPI_RESOURCE_TYPE_IO_RANGE             1
9517c478bd9Sstevel@tonic-gate #define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE     2
9527c478bd9Sstevel@tonic-gate 
9537c478bd9Sstevel@tonic-gate /* Resource descriptor types and masks */
9547c478bd9Sstevel@tonic-gate 
9557c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_LARGE                   0x80
9567c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_SMALL                   0x00
9577c478bd9Sstevel@tonic-gate 
9587c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_MASK                    0x80
9597c478bd9Sstevel@tonic-gate #define ACPI_RDESC_SMALL_MASK                   0x78 /* Only bits 6:3 contain the type */
9607c478bd9Sstevel@tonic-gate 
9617c478bd9Sstevel@tonic-gate 
9627c478bd9Sstevel@tonic-gate /*
9637c478bd9Sstevel@tonic-gate  * Small resource descriptor types
9647c478bd9Sstevel@tonic-gate  * Note: The 3 length bits (2:0) must be zero
9657c478bd9Sstevel@tonic-gate  */
9667c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_IRQ_FORMAT              0x20
9677c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_DMA_FORMAT              0x28
9687c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_START_DEPENDENT         0x30
9697c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_END_DEPENDENT           0x38
9707c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_IO_PORT                 0x40
9717c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_FIXED_IO_PORT           0x48
9727c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_SMALL_VENDOR            0x70
9737c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_END_TAG                 0x78
9747c478bd9Sstevel@tonic-gate 
9757c478bd9Sstevel@tonic-gate /*
9767c478bd9Sstevel@tonic-gate  * Large resource descriptor types
9777c478bd9Sstevel@tonic-gate  */
9787c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_MEMORY_24               0x81
9797c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_GENERAL_REGISTER        0x82
9807c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_LARGE_VENDOR            0x84
9817c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_MEMORY_32               0x85
9827c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_FIXED_MEMORY_32         0x86
9837c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE     0x87
9847c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE      0x88
9857c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_EXTENDED_XRUPT          0x89
9867c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE     0x8A
9877c478bd9Sstevel@tonic-gate #define ACPI_RDESC_TYPE_EXTENDED_ADDRESS_SPACE  0x8B
9887c478bd9Sstevel@tonic-gate 
9897c478bd9Sstevel@tonic-gate 
9907c478bd9Sstevel@tonic-gate /*****************************************************************************
9917c478bd9Sstevel@tonic-gate  *
9927c478bd9Sstevel@tonic-gate  * Miscellaneous
9937c478bd9Sstevel@tonic-gate  *
9947c478bd9Sstevel@tonic-gate  ****************************************************************************/
9957c478bd9Sstevel@tonic-gate 
9967c478bd9Sstevel@tonic-gate #define ACPI_ASCII_ZERO                      0x30
9977c478bd9Sstevel@tonic-gate 
9987c478bd9Sstevel@tonic-gate 
9997c478bd9Sstevel@tonic-gate /*****************************************************************************
10007c478bd9Sstevel@tonic-gate  *
10017c478bd9Sstevel@tonic-gate  * Debugger
10027c478bd9Sstevel@tonic-gate  *
10037c478bd9Sstevel@tonic-gate  ****************************************************************************/
10047c478bd9Sstevel@tonic-gate 
10057c478bd9Sstevel@tonic-gate typedef struct acpi_db_method_info
10067c478bd9Sstevel@tonic-gate {
10077c478bd9Sstevel@tonic-gate     ACPI_HANDLE             ThreadGate;
10087c478bd9Sstevel@tonic-gate     char                    *Name;
10097c478bd9Sstevel@tonic-gate     char                    **Args;
10107c478bd9Sstevel@tonic-gate     UINT32                  Flags;
10117c478bd9Sstevel@tonic-gate     UINT32                  NumLoops;
10127c478bd9Sstevel@tonic-gate     char                    Pathname[128];
10137c478bd9Sstevel@tonic-gate 
10147c478bd9Sstevel@tonic-gate } ACPI_DB_METHOD_INFO;
10157c478bd9Sstevel@tonic-gate 
10167c478bd9Sstevel@tonic-gate typedef struct acpi_integrity_info
10177c478bd9Sstevel@tonic-gate {
10187c478bd9Sstevel@tonic-gate     UINT32              Nodes;
10197c478bd9Sstevel@tonic-gate     UINT32              Objects;
10207c478bd9Sstevel@tonic-gate 
10217c478bd9Sstevel@tonic-gate } ACPI_INTEGRITY_INFO;
10227c478bd9Sstevel@tonic-gate 
10237c478bd9Sstevel@tonic-gate 
10247c478bd9Sstevel@tonic-gate #define ACPI_DB_REDIRECTABLE_OUTPUT  0x01
10257c478bd9Sstevel@tonic-gate #define ACPI_DB_CONSOLE_OUTPUT       0x02
10267c478bd9Sstevel@tonic-gate #define ACPI_DB_DUPLICATE_OUTPUT     0x03
10277c478bd9Sstevel@tonic-gate 
10287c478bd9Sstevel@tonic-gate 
10297c478bd9Sstevel@tonic-gate /*****************************************************************************
10307c478bd9Sstevel@tonic-gate  *
10317c478bd9Sstevel@tonic-gate  * Debug
10327c478bd9Sstevel@tonic-gate  *
10337c478bd9Sstevel@tonic-gate  ****************************************************************************/
10347c478bd9Sstevel@tonic-gate 
10357c478bd9Sstevel@tonic-gate /* Entry for a memory allocation (debug only) */
10367c478bd9Sstevel@tonic-gate 
10377c478bd9Sstevel@tonic-gate #define ACPI_MEM_MALLOC                      0
10387c478bd9Sstevel@tonic-gate #define ACPI_MEM_CALLOC                      1
10397c478bd9Sstevel@tonic-gate #define ACPI_MAX_MODULE_NAME                 16
10407c478bd9Sstevel@tonic-gate 
10417c478bd9Sstevel@tonic-gate #define ACPI_COMMON_DEBUG_MEM_HEADER \
10427c478bd9Sstevel@tonic-gate     struct acpi_debug_mem_block *Previous; \
10437c478bd9Sstevel@tonic-gate     struct acpi_debug_mem_block *Next; \
10447c478bd9Sstevel@tonic-gate     UINT32                      Size; \
10457c478bd9Sstevel@tonic-gate     UINT32                      Component; \
10467c478bd9Sstevel@tonic-gate     UINT32                      Line; \
10477c478bd9Sstevel@tonic-gate     char                        Module[ACPI_MAX_MODULE_NAME]; \
10487c478bd9Sstevel@tonic-gate     UINT8                       AllocType;
10497c478bd9Sstevel@tonic-gate 
10507c478bd9Sstevel@tonic-gate typedef struct acpi_debug_mem_header
10517c478bd9Sstevel@tonic-gate {
10527c478bd9Sstevel@tonic-gate     ACPI_COMMON_DEBUG_MEM_HEADER
10537c478bd9Sstevel@tonic-gate 
10547c478bd9Sstevel@tonic-gate } ACPI_DEBUG_MEM_HEADER;
10557c478bd9Sstevel@tonic-gate 
10567c478bd9Sstevel@tonic-gate typedef struct acpi_debug_mem_block
10577c478bd9Sstevel@tonic-gate {
10587c478bd9Sstevel@tonic-gate     ACPI_COMMON_DEBUG_MEM_HEADER
10597c478bd9Sstevel@tonic-gate     UINT64                      UserSpace;
10607c478bd9Sstevel@tonic-gate 
10617c478bd9Sstevel@tonic-gate } ACPI_DEBUG_MEM_BLOCK;
10627c478bd9Sstevel@tonic-gate 
10637c478bd9Sstevel@tonic-gate 
10647c478bd9Sstevel@tonic-gate #define ACPI_MEM_LIST_GLOBAL            0
10657c478bd9Sstevel@tonic-gate #define ACPI_MEM_LIST_NSNODE            1
1066*450d6964Smyers #define ACPI_MEM_LIST_MAX               1
1067*450d6964Smyers #define ACPI_NUM_MEM_LISTS              2
10687c478bd9Sstevel@tonic-gate 
10697c478bd9Sstevel@tonic-gate 
10707c478bd9Sstevel@tonic-gate typedef struct acpi_memory_list
10717c478bd9Sstevel@tonic-gate {
1072*450d6964Smyers     char                        *ListName;
10737c478bd9Sstevel@tonic-gate     void                        *ListHead;
10747c478bd9Sstevel@tonic-gate     UINT16                      ObjectSize;
1075*450d6964Smyers     UINT16                      MaxDepth;
1076*450d6964Smyers     UINT16                      CurrentDepth;
1077*450d6964Smyers     UINT16                      LinkOffset;
10787c478bd9Sstevel@tonic-gate 
10797c478bd9Sstevel@tonic-gate #ifdef ACPI_DBG_TRACK_ALLOCATIONS
10807c478bd9Sstevel@tonic-gate 
10817c478bd9Sstevel@tonic-gate     /* Statistics for debug memory tracking only */
10827c478bd9Sstevel@tonic-gate 
10837c478bd9Sstevel@tonic-gate     UINT32                      TotalAllocated;
10847c478bd9Sstevel@tonic-gate     UINT32                      TotalFreed;
10857c478bd9Sstevel@tonic-gate     UINT32                      CurrentTotalSize;
1086*450d6964Smyers     UINT32                      Requests;
1087*450d6964Smyers     UINT32                      Hits;
10887c478bd9Sstevel@tonic-gate #endif
10897c478bd9Sstevel@tonic-gate 
10907c478bd9Sstevel@tonic-gate } ACPI_MEMORY_LIST;
10917c478bd9Sstevel@tonic-gate 
10927c478bd9Sstevel@tonic-gate 
10937c478bd9Sstevel@tonic-gate #endif /* __ACLOCAL_H__ */
1094