10Sstevel@tonic-gate /******************************************************************************
20Sstevel@tonic-gate  *
30Sstevel@tonic-gate  * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
40Sstevel@tonic-gate  *                   Declarations and definitions contained herein are derived
50Sstevel@tonic-gate  *                   directly from the ACPI specification.
6*2623Smyers  *       $Revision: 1.84 $
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  *****************************************************************************/
90Sstevel@tonic-gate 
100Sstevel@tonic-gate /******************************************************************************
110Sstevel@tonic-gate  *
120Sstevel@tonic-gate  * 1. Copyright Notice
130Sstevel@tonic-gate  *
141560Smyers  * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp.
150Sstevel@tonic-gate  * All rights reserved.
160Sstevel@tonic-gate  *
170Sstevel@tonic-gate  * 2. License
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * 2.1. This is your license from Intel Corp. under its intellectual property
200Sstevel@tonic-gate  * rights.  You may have additional license terms from the party that provided
210Sstevel@tonic-gate  * you this software, covering your right to use that party's intellectual
220Sstevel@tonic-gate  * property rights.
230Sstevel@tonic-gate  *
240Sstevel@tonic-gate  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
250Sstevel@tonic-gate  * copy of the source code appearing in this file ("Covered Code") an
260Sstevel@tonic-gate  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
270Sstevel@tonic-gate  * base code distributed originally by Intel ("Original Intel Code") to copy,
280Sstevel@tonic-gate  * make derivatives, distribute, use and display any portion of the Covered
290Sstevel@tonic-gate  * Code in any form, with the right to sublicense such rights; and
300Sstevel@tonic-gate  *
310Sstevel@tonic-gate  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
320Sstevel@tonic-gate  * license (with the right to sublicense), under only those claims of Intel
330Sstevel@tonic-gate  * patents that are infringed by the Original Intel Code, to make, use, sell,
340Sstevel@tonic-gate  * offer to sell, and import the Covered Code and derivative works thereof
350Sstevel@tonic-gate  * solely to the minimum extent necessary to exercise the above copyright
360Sstevel@tonic-gate  * license, and in no event shall the patent license extend to any additions
370Sstevel@tonic-gate  * to or modifications of the Original Intel Code.  No other license or right
380Sstevel@tonic-gate  * is granted directly or by implication, estoppel or otherwise;
390Sstevel@tonic-gate  *
400Sstevel@tonic-gate  * The above copyright and patent license is granted only if the following
410Sstevel@tonic-gate  * conditions are met:
420Sstevel@tonic-gate  *
430Sstevel@tonic-gate  * 3. Conditions
440Sstevel@tonic-gate  *
450Sstevel@tonic-gate  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
460Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
470Sstevel@tonic-gate  * Code or modification with rights to further distribute source must include
480Sstevel@tonic-gate  * the above Copyright Notice, the above License, this list of Conditions,
490Sstevel@tonic-gate  * and the following Disclaimer and Export Compliance provision.  In addition,
500Sstevel@tonic-gate  * Licensee must cause all Covered Code to which Licensee contributes to
510Sstevel@tonic-gate  * contain a file documenting the changes Licensee made to create that Covered
520Sstevel@tonic-gate  * Code and the date of any change.  Licensee must include in that file the
530Sstevel@tonic-gate  * documentation of any changes made by any predecessor Licensee.  Licensee
540Sstevel@tonic-gate  * must include a prominent statement that the modification is derived,
550Sstevel@tonic-gate  * directly or indirectly, from Original Intel Code.
560Sstevel@tonic-gate  *
570Sstevel@tonic-gate  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
580Sstevel@tonic-gate  * Redistribution of source code of any substantial portion of the Covered
590Sstevel@tonic-gate  * Code or modification without rights to further distribute source must
600Sstevel@tonic-gate  * include the following Disclaimer and Export Compliance provision in the
610Sstevel@tonic-gate  * documentation and/or other materials provided with distribution.  In
620Sstevel@tonic-gate  * addition, Licensee may not authorize further sublicense of source of any
630Sstevel@tonic-gate  * portion of the Covered Code, and must include terms to the effect that the
640Sstevel@tonic-gate  * license from Licensee to its licensee is limited to the intellectual
650Sstevel@tonic-gate  * property embodied in the software Licensee provides to its licensee, and
660Sstevel@tonic-gate  * not to intellectual property embodied in modifications its licensee may
670Sstevel@tonic-gate  * make.
680Sstevel@tonic-gate  *
690Sstevel@tonic-gate  * 3.3. Redistribution of Executable. Redistribution in executable form of any
700Sstevel@tonic-gate  * substantial portion of the Covered Code or modification must reproduce the
710Sstevel@tonic-gate  * above Copyright Notice, and the following Disclaimer and Export Compliance
720Sstevel@tonic-gate  * provision in the documentation and/or other materials provided with the
730Sstevel@tonic-gate  * distribution.
740Sstevel@tonic-gate  *
750Sstevel@tonic-gate  * 3.4. Intel retains all right, title, and interest in and to the Original
760Sstevel@tonic-gate  * Intel Code.
770Sstevel@tonic-gate  *
780Sstevel@tonic-gate  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
790Sstevel@tonic-gate  * Intel shall be used in advertising or otherwise to promote the sale, use or
800Sstevel@tonic-gate  * other dealings in products derived from or relating to the Covered Code
810Sstevel@tonic-gate  * without prior written authorization from Intel.
820Sstevel@tonic-gate  *
830Sstevel@tonic-gate  * 4. Disclaimer and Export Compliance
840Sstevel@tonic-gate  *
850Sstevel@tonic-gate  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
860Sstevel@tonic-gate  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
870Sstevel@tonic-gate  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
880Sstevel@tonic-gate  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
890Sstevel@tonic-gate  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
900Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
910Sstevel@tonic-gate  * PARTICULAR PURPOSE.
920Sstevel@tonic-gate  *
930Sstevel@tonic-gate  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
940Sstevel@tonic-gate  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
950Sstevel@tonic-gate  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
960Sstevel@tonic-gate  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
970Sstevel@tonic-gate  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
980Sstevel@tonic-gate  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
990Sstevel@tonic-gate  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
1000Sstevel@tonic-gate  * LIMITED REMEDY.
1010Sstevel@tonic-gate  *
1020Sstevel@tonic-gate  * 4.3. Licensee shall not export, either directly or indirectly, any of this
1030Sstevel@tonic-gate  * software or system incorporating such software without first obtaining any
1040Sstevel@tonic-gate  * required license or other approval from the U. S. Department of Commerce or
1050Sstevel@tonic-gate  * any other agency or department of the United States Government.  In the
1060Sstevel@tonic-gate  * event Licensee exports any such software from the United States or
1070Sstevel@tonic-gate  * re-exports any such software from a foreign destination, Licensee shall
1080Sstevel@tonic-gate  * ensure that the distribution and export/re-export of the software is in
1090Sstevel@tonic-gate  * compliance with all laws, regulations, orders, or other restrictions of the
1100Sstevel@tonic-gate  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
1110Sstevel@tonic-gate  * any of its subsidiaries will export/re-export any technical data, process,
1120Sstevel@tonic-gate  * software, or service, directly or indirectly, to any country for which the
1130Sstevel@tonic-gate  * United States government or any agency thereof requires an export license,
1140Sstevel@tonic-gate  * other governmental approval, or letter of assurance, without first obtaining
1150Sstevel@tonic-gate  * such license, approval or letter.
1160Sstevel@tonic-gate  *
1170Sstevel@tonic-gate  *****************************************************************************/
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate #ifndef __AMLCODE_H__
1200Sstevel@tonic-gate #define __AMLCODE_H__
1210Sstevel@tonic-gate 
1220Sstevel@tonic-gate /* primary opcodes */
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate #define AML_NULL_CHAR               (UINT16) 0x00
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate #define AML_ZERO_OP                 (UINT16) 0x00
1270Sstevel@tonic-gate #define AML_ONE_OP                  (UINT16) 0x01
1280Sstevel@tonic-gate #define AML_UNASSIGNED              (UINT16) 0x02
1290Sstevel@tonic-gate #define AML_ALIAS_OP                (UINT16) 0x06
1300Sstevel@tonic-gate #define AML_NAME_OP                 (UINT16) 0x08
1310Sstevel@tonic-gate #define AML_BYTE_OP                 (UINT16) 0x0a
1320Sstevel@tonic-gate #define AML_WORD_OP                 (UINT16) 0x0b
1330Sstevel@tonic-gate #define AML_DWORD_OP                (UINT16) 0x0c
1340Sstevel@tonic-gate #define AML_STRING_OP               (UINT16) 0x0d
1350Sstevel@tonic-gate #define AML_QWORD_OP                (UINT16) 0x0e     /* ACPI 2.0 */
1360Sstevel@tonic-gate #define AML_SCOPE_OP                (UINT16) 0x10
1370Sstevel@tonic-gate #define AML_BUFFER_OP               (UINT16) 0x11
1380Sstevel@tonic-gate #define AML_PACKAGE_OP              (UINT16) 0x12
1390Sstevel@tonic-gate #define AML_VAR_PACKAGE_OP          (UINT16) 0x13     /* ACPI 2.0 */
1400Sstevel@tonic-gate #define AML_METHOD_OP               (UINT16) 0x14
1410Sstevel@tonic-gate #define AML_DUAL_NAME_PREFIX        (UINT16) 0x2e
1420Sstevel@tonic-gate #define AML_MULTI_NAME_PREFIX_OP    (UINT16) 0x2f
1430Sstevel@tonic-gate #define AML_NAME_CHAR_SUBSEQ        (UINT16) 0x30
1440Sstevel@tonic-gate #define AML_NAME_CHAR_FIRST         (UINT16) 0x41
145347Smyers #define AML_EXTENDED_OP_PREFIX      (UINT16) 0x5b
1460Sstevel@tonic-gate #define AML_ROOT_PREFIX             (UINT16) 0x5c
1470Sstevel@tonic-gate #define AML_PARENT_PREFIX           (UINT16) 0x5e
1480Sstevel@tonic-gate #define AML_LOCAL_OP                (UINT16) 0x60
1490Sstevel@tonic-gate #define AML_LOCAL0                  (UINT16) 0x60
1500Sstevel@tonic-gate #define AML_LOCAL1                  (UINT16) 0x61
1510Sstevel@tonic-gate #define AML_LOCAL2                  (UINT16) 0x62
1520Sstevel@tonic-gate #define AML_LOCAL3                  (UINT16) 0x63
1530Sstevel@tonic-gate #define AML_LOCAL4                  (UINT16) 0x64
1540Sstevel@tonic-gate #define AML_LOCAL5                  (UINT16) 0x65
1550Sstevel@tonic-gate #define AML_LOCAL6                  (UINT16) 0x66
1560Sstevel@tonic-gate #define AML_LOCAL7                  (UINT16) 0x67
1570Sstevel@tonic-gate #define AML_ARG_OP                  (UINT16) 0x68
1580Sstevel@tonic-gate #define AML_ARG0                    (UINT16) 0x68
1590Sstevel@tonic-gate #define AML_ARG1                    (UINT16) 0x69
1600Sstevel@tonic-gate #define AML_ARG2                    (UINT16) 0x6a
1610Sstevel@tonic-gate #define AML_ARG3                    (UINT16) 0x6b
1620Sstevel@tonic-gate #define AML_ARG4                    (UINT16) 0x6c
1630Sstevel@tonic-gate #define AML_ARG5                    (UINT16) 0x6d
1640Sstevel@tonic-gate #define AML_ARG6                    (UINT16) 0x6e
1650Sstevel@tonic-gate #define AML_STORE_OP                (UINT16) 0x70
1660Sstevel@tonic-gate #define AML_REF_OF_OP               (UINT16) 0x71
1670Sstevel@tonic-gate #define AML_ADD_OP                  (UINT16) 0x72
1680Sstevel@tonic-gate #define AML_CONCAT_OP               (UINT16) 0x73
1690Sstevel@tonic-gate #define AML_SUBTRACT_OP             (UINT16) 0x74
1700Sstevel@tonic-gate #define AML_INCREMENT_OP            (UINT16) 0x75
1710Sstevel@tonic-gate #define AML_DECREMENT_OP            (UINT16) 0x76
1720Sstevel@tonic-gate #define AML_MULTIPLY_OP             (UINT16) 0x77
1730Sstevel@tonic-gate #define AML_DIVIDE_OP               (UINT16) 0x78
1740Sstevel@tonic-gate #define AML_SHIFT_LEFT_OP           (UINT16) 0x79
1750Sstevel@tonic-gate #define AML_SHIFT_RIGHT_OP          (UINT16) 0x7a
1760Sstevel@tonic-gate #define AML_BIT_AND_OP              (UINT16) 0x7b
1770Sstevel@tonic-gate #define AML_BIT_NAND_OP             (UINT16) 0x7c
1780Sstevel@tonic-gate #define AML_BIT_OR_OP               (UINT16) 0x7d
1790Sstevel@tonic-gate #define AML_BIT_NOR_OP              (UINT16) 0x7e
1800Sstevel@tonic-gate #define AML_BIT_XOR_OP              (UINT16) 0x7f
1810Sstevel@tonic-gate #define AML_BIT_NOT_OP              (UINT16) 0x80
1820Sstevel@tonic-gate #define AML_FIND_SET_LEFT_BIT_OP    (UINT16) 0x81
1830Sstevel@tonic-gate #define AML_FIND_SET_RIGHT_BIT_OP   (UINT16) 0x82
1840Sstevel@tonic-gate #define AML_DEREF_OF_OP             (UINT16) 0x83
1850Sstevel@tonic-gate #define AML_CONCAT_RES_OP           (UINT16) 0x84     /* ACPI 2.0 */
1860Sstevel@tonic-gate #define AML_MOD_OP                  (UINT16) 0x85     /* ACPI 2.0 */
1870Sstevel@tonic-gate #define AML_NOTIFY_OP               (UINT16) 0x86
1880Sstevel@tonic-gate #define AML_SIZE_OF_OP              (UINT16) 0x87
1890Sstevel@tonic-gate #define AML_INDEX_OP                (UINT16) 0x88
1900Sstevel@tonic-gate #define AML_MATCH_OP                (UINT16) 0x89
1910Sstevel@tonic-gate #define AML_CREATE_DWORD_FIELD_OP   (UINT16) 0x8a
1920Sstevel@tonic-gate #define AML_CREATE_WORD_FIELD_OP    (UINT16) 0x8b
1930Sstevel@tonic-gate #define AML_CREATE_BYTE_FIELD_OP    (UINT16) 0x8c
1940Sstevel@tonic-gate #define AML_CREATE_BIT_FIELD_OP     (UINT16) 0x8d
1950Sstevel@tonic-gate #define AML_TYPE_OP                 (UINT16) 0x8e
1960Sstevel@tonic-gate #define AML_CREATE_QWORD_FIELD_OP   (UINT16) 0x8f     /* ACPI 2.0 */
1970Sstevel@tonic-gate #define AML_LAND_OP                 (UINT16) 0x90
1980Sstevel@tonic-gate #define AML_LOR_OP                  (UINT16) 0x91
1990Sstevel@tonic-gate #define AML_LNOT_OP                 (UINT16) 0x92
2000Sstevel@tonic-gate #define AML_LEQUAL_OP               (UINT16) 0x93
2010Sstevel@tonic-gate #define AML_LGREATER_OP             (UINT16) 0x94
2020Sstevel@tonic-gate #define AML_LLESS_OP                (UINT16) 0x95
2030Sstevel@tonic-gate #define AML_TO_BUFFER_OP            (UINT16) 0x96     /* ACPI 2.0 */
2040Sstevel@tonic-gate #define AML_TO_DECSTRING_OP         (UINT16) 0x97     /* ACPI 2.0 */
2050Sstevel@tonic-gate #define AML_TO_HEXSTRING_OP         (UINT16) 0x98     /* ACPI 2.0 */
2060Sstevel@tonic-gate #define AML_TO_INTEGER_OP           (UINT16) 0x99     /* ACPI 2.0 */
2070Sstevel@tonic-gate #define AML_TO_STRING_OP            (UINT16) 0x9c     /* ACPI 2.0 */
2080Sstevel@tonic-gate #define AML_COPY_OP                 (UINT16) 0x9d     /* ACPI 2.0 */
2090Sstevel@tonic-gate #define AML_MID_OP                  (UINT16) 0x9e     /* ACPI 2.0 */
2100Sstevel@tonic-gate #define AML_CONTINUE_OP             (UINT16) 0x9f     /* ACPI 2.0 */
2110Sstevel@tonic-gate #define AML_IF_OP                   (UINT16) 0xa0
2120Sstevel@tonic-gate #define AML_ELSE_OP                 (UINT16) 0xa1
2130Sstevel@tonic-gate #define AML_WHILE_OP                (UINT16) 0xa2
2140Sstevel@tonic-gate #define AML_NOOP_OP                 (UINT16) 0xa3
2150Sstevel@tonic-gate #define AML_RETURN_OP               (UINT16) 0xa4
2160Sstevel@tonic-gate #define AML_BREAK_OP                (UINT16) 0xa5
2170Sstevel@tonic-gate #define AML_BREAK_POINT_OP          (UINT16) 0xcc
2180Sstevel@tonic-gate #define AML_ONES_OP                 (UINT16) 0xff
2190Sstevel@tonic-gate 
2200Sstevel@tonic-gate /* prefixed opcodes */
2210Sstevel@tonic-gate 
222347Smyers #define AML_EXTENDED_OPCODE         (UINT16) 0x5b00     /* prefix for 2-byte opcodes */
2230Sstevel@tonic-gate 
2240Sstevel@tonic-gate #define AML_MUTEX_OP                (UINT16) 0x5b01
2250Sstevel@tonic-gate #define AML_EVENT_OP                (UINT16) 0x5b02
2260Sstevel@tonic-gate #define AML_SHIFT_RIGHT_BIT_OP      (UINT16) 0x5b10
2270Sstevel@tonic-gate #define AML_SHIFT_LEFT_BIT_OP       (UINT16) 0x5b11
2280Sstevel@tonic-gate #define AML_COND_REF_OF_OP          (UINT16) 0x5b12
2290Sstevel@tonic-gate #define AML_CREATE_FIELD_OP         (UINT16) 0x5b13
2300Sstevel@tonic-gate #define AML_LOAD_TABLE_OP           (UINT16) 0x5b1f     /* ACPI 2.0 */
2310Sstevel@tonic-gate #define AML_LOAD_OP                 (UINT16) 0x5b20
2320Sstevel@tonic-gate #define AML_STALL_OP                (UINT16) 0x5b21
2330Sstevel@tonic-gate #define AML_SLEEP_OP                (UINT16) 0x5b22
2340Sstevel@tonic-gate #define AML_ACQUIRE_OP              (UINT16) 0x5b23
2350Sstevel@tonic-gate #define AML_SIGNAL_OP               (UINT16) 0x5b24
2360Sstevel@tonic-gate #define AML_WAIT_OP                 (UINT16) 0x5b25
2370Sstevel@tonic-gate #define AML_RESET_OP                (UINT16) 0x5b26
2380Sstevel@tonic-gate #define AML_RELEASE_OP              (UINT16) 0x5b27
2390Sstevel@tonic-gate #define AML_FROM_BCD_OP             (UINT16) 0x5b28
2400Sstevel@tonic-gate #define AML_TO_BCD_OP               (UINT16) 0x5b29
2410Sstevel@tonic-gate #define AML_UNLOAD_OP               (UINT16) 0x5b2a
2420Sstevel@tonic-gate #define AML_REVISION_OP             (UINT16) 0x5b30
2430Sstevel@tonic-gate #define AML_DEBUG_OP                (UINT16) 0x5b31
2440Sstevel@tonic-gate #define AML_FATAL_OP                (UINT16) 0x5b32
2450Sstevel@tonic-gate #define AML_TIMER_OP                (UINT16) 0x5b33     /* ACPI 3.0 */
2460Sstevel@tonic-gate #define AML_REGION_OP               (UINT16) 0x5b80
2470Sstevel@tonic-gate #define AML_FIELD_OP                (UINT16) 0x5b81
2480Sstevel@tonic-gate #define AML_DEVICE_OP               (UINT16) 0x5b82
2490Sstevel@tonic-gate #define AML_PROCESSOR_OP            (UINT16) 0x5b83
2500Sstevel@tonic-gate #define AML_POWER_RES_OP            (UINT16) 0x5b84
2510Sstevel@tonic-gate #define AML_THERMAL_ZONE_OP         (UINT16) 0x5b85
2520Sstevel@tonic-gate #define AML_INDEX_FIELD_OP          (UINT16) 0x5b86
2530Sstevel@tonic-gate #define AML_BANK_FIELD_OP           (UINT16) 0x5b87
2540Sstevel@tonic-gate #define AML_DATA_REGION_OP          (UINT16) 0x5b88     /* ACPI 2.0 */
2550Sstevel@tonic-gate 
2560Sstevel@tonic-gate 
257*2623Smyers /*
258*2623Smyers  * Combination opcodes (actually two one-byte opcodes)
259*2623Smyers  * Used by the disassembler and iASL compiler
260*2623Smyers  */
2610Sstevel@tonic-gate #define AML_LGREATEREQUAL_OP        (UINT16) 0x9295
2620Sstevel@tonic-gate #define AML_LLESSEQUAL_OP           (UINT16) 0x9294
2630Sstevel@tonic-gate #define AML_LNOTEQUAL_OP            (UINT16) 0x9293
2640Sstevel@tonic-gate 
2650Sstevel@tonic-gate 
2660Sstevel@tonic-gate /*
2670Sstevel@tonic-gate  * Internal opcodes
2680Sstevel@tonic-gate  * Use only "Unknown" AML opcodes, don't attempt to use
2690Sstevel@tonic-gate  * any valid ACPI ASCII values (A-Z, 0-9, '-')
2700Sstevel@tonic-gate  */
2710Sstevel@tonic-gate #define AML_INT_NAMEPATH_OP         (UINT16) 0x002d
2720Sstevel@tonic-gate #define AML_INT_NAMEDFIELD_OP       (UINT16) 0x0030
2730Sstevel@tonic-gate #define AML_INT_RESERVEDFIELD_OP    (UINT16) 0x0031
2740Sstevel@tonic-gate #define AML_INT_ACCESSFIELD_OP      (UINT16) 0x0032
2750Sstevel@tonic-gate #define AML_INT_BYTELIST_OP         (UINT16) 0x0033
2760Sstevel@tonic-gate #define AML_INT_STATICSTRING_OP     (UINT16) 0x0034
2770Sstevel@tonic-gate #define AML_INT_METHODCALL_OP       (UINT16) 0x0035
2780Sstevel@tonic-gate #define AML_INT_RETURN_VALUE_OP     (UINT16) 0x0036
2790Sstevel@tonic-gate #define AML_INT_EVAL_SUBTREE_OP     (UINT16) 0x0037
2800Sstevel@tonic-gate 
2810Sstevel@tonic-gate 
2820Sstevel@tonic-gate #define ARG_NONE                    0x0
2830Sstevel@tonic-gate 
2840Sstevel@tonic-gate /*
2850Sstevel@tonic-gate  * Argument types for the AML Parser
2860Sstevel@tonic-gate  * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
2870Sstevel@tonic-gate  * There can be up to 31 unique argument types
2880Sstevel@tonic-gate  * Zero is reserved as end-of-list indicator
2890Sstevel@tonic-gate  */
2900Sstevel@tonic-gate #define ARGP_BYTEDATA               0x01
2910Sstevel@tonic-gate #define ARGP_BYTELIST               0x02
2920Sstevel@tonic-gate #define ARGP_CHARLIST               0x03
2930Sstevel@tonic-gate #define ARGP_DATAOBJ                0x04
2940Sstevel@tonic-gate #define ARGP_DATAOBJLIST            0x05
2950Sstevel@tonic-gate #define ARGP_DWORDDATA              0x06
2960Sstevel@tonic-gate #define ARGP_FIELDLIST              0x07
2970Sstevel@tonic-gate #define ARGP_NAME                   0x08
2980Sstevel@tonic-gate #define ARGP_NAMESTRING             0x09
2990Sstevel@tonic-gate #define ARGP_OBJLIST                0x0A
3000Sstevel@tonic-gate #define ARGP_PKGLENGTH              0x0B
3010Sstevel@tonic-gate #define ARGP_SUPERNAME              0x0C
3020Sstevel@tonic-gate #define ARGP_TARGET                 0x0D
3030Sstevel@tonic-gate #define ARGP_TERMARG                0x0E
3040Sstevel@tonic-gate #define ARGP_TERMLIST               0x0F
3050Sstevel@tonic-gate #define ARGP_WORDDATA               0x10
3060Sstevel@tonic-gate #define ARGP_QWORDDATA              0x11
3070Sstevel@tonic-gate #define ARGP_SIMPLENAME             0x12
3080Sstevel@tonic-gate 
3090Sstevel@tonic-gate /*
3100Sstevel@tonic-gate  * Resolved argument types for the AML Interpreter
3110Sstevel@tonic-gate  * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
3120Sstevel@tonic-gate  * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
3130Sstevel@tonic-gate  *
3140Sstevel@tonic-gate  * Note1: These values are completely independent from the ACPI_TYPEs
3150Sstevel@tonic-gate  *        i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
3160Sstevel@tonic-gate  *
3170Sstevel@tonic-gate  * Note2: If and when 5 bits becomes insufficient, it would probably be best
3180Sstevel@tonic-gate  * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
3190Sstevel@tonic-gate  */
3200Sstevel@tonic-gate 
3210Sstevel@tonic-gate /* Single, simple types */
3220Sstevel@tonic-gate 
3230Sstevel@tonic-gate #define ARGI_ANYTYPE                0x01    /* Don't care */
3240Sstevel@tonic-gate #define ARGI_PACKAGE                0x02
3250Sstevel@tonic-gate #define ARGI_EVENT                  0x03
3260Sstevel@tonic-gate #define ARGI_MUTEX                  0x04
3270Sstevel@tonic-gate #define ARGI_DDBHANDLE              0x05
3280Sstevel@tonic-gate 
3290Sstevel@tonic-gate /* Interchangeable types (via implicit conversion) */
3300Sstevel@tonic-gate 
3310Sstevel@tonic-gate #define ARGI_INTEGER                0x06
3320Sstevel@tonic-gate #define ARGI_STRING                 0x07
3330Sstevel@tonic-gate #define ARGI_BUFFER                 0x08
3340Sstevel@tonic-gate #define ARGI_BUFFER_OR_STRING       0x09    /* Used by MID op only */
3350Sstevel@tonic-gate #define ARGI_COMPUTEDATA            0x0A    /* Buffer, String, or Integer */
3360Sstevel@tonic-gate 
3370Sstevel@tonic-gate /* Reference objects */
3380Sstevel@tonic-gate 
3390Sstevel@tonic-gate #define ARGI_INTEGER_REF            0x0B
3400Sstevel@tonic-gate #define ARGI_OBJECT_REF             0x0C
3410Sstevel@tonic-gate #define ARGI_DEVICE_REF             0x0D
3420Sstevel@tonic-gate #define ARGI_REFERENCE              0x0E
3430Sstevel@tonic-gate #define ARGI_TARGETREF              0x0F    /* Target, subject to implicit conversion */
3440Sstevel@tonic-gate #define ARGI_FIXED_TARGET           0x10    /* Target, no implicit conversion */
3450Sstevel@tonic-gate #define ARGI_SIMPLE_TARGET          0x11    /* Name, Local, Arg -- no implicit conversion */
3460Sstevel@tonic-gate 
3470Sstevel@tonic-gate /* Multiple/complex types */
3480Sstevel@tonic-gate 
3490Sstevel@tonic-gate #define ARGI_DATAOBJECT             0x12    /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
3500Sstevel@tonic-gate #define ARGI_COMPLEXOBJ             0x13    /* Buffer, String, or package (Used by INDEX op only) */
3510Sstevel@tonic-gate #define ARGI_REF_OR_STRING          0x14    /* Reference or String (Used by DEREFOF op only) */
3520Sstevel@tonic-gate #define ARGI_REGION_OR_FIELD        0x15    /* Used by LOAD op only */
3530Sstevel@tonic-gate #define ARGI_DATAREFOBJ             0x16
3540Sstevel@tonic-gate 
3550Sstevel@tonic-gate /* Note: types above can expand to 0x1F maximum */
3560Sstevel@tonic-gate 
3570Sstevel@tonic-gate #define ARGI_INVALID_OPCODE         0xFFFFFFFF
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate 
3600Sstevel@tonic-gate /*
3610Sstevel@tonic-gate  * hash offsets
3620Sstevel@tonic-gate  */
3630Sstevel@tonic-gate #define AML_EXTOP_HASH_OFFSET       22
3640Sstevel@tonic-gate #define AML_LNOT_HASH_OFFSET        19
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate 
3670Sstevel@tonic-gate /*
3680Sstevel@tonic-gate  * opcode groups and types
3690Sstevel@tonic-gate  */
3700Sstevel@tonic-gate #define OPGRP_NAMED                 0x01
3710Sstevel@tonic-gate #define OPGRP_FIELD                 0x02
3720Sstevel@tonic-gate #define OPGRP_BYTELIST              0x04
3730Sstevel@tonic-gate 
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate /*
3760Sstevel@tonic-gate  * Opcode information
3770Sstevel@tonic-gate  */
3780Sstevel@tonic-gate 
3790Sstevel@tonic-gate /* Opcode flags */
3800Sstevel@tonic-gate 
3810Sstevel@tonic-gate #define AML_LOGICAL                 0x0001
3820Sstevel@tonic-gate #define AML_LOGICAL_NUMERIC         0x0002
3830Sstevel@tonic-gate #define AML_MATH                    0x0004
3840Sstevel@tonic-gate #define AML_CREATE                  0x0008
3850Sstevel@tonic-gate #define AML_FIELD                   0x0010
3860Sstevel@tonic-gate #define AML_DEFER                   0x0020
3870Sstevel@tonic-gate #define AML_NAMED                   0x0040
3880Sstevel@tonic-gate #define AML_NSNODE                  0x0080
3890Sstevel@tonic-gate #define AML_NSOPCODE                0x0100
3900Sstevel@tonic-gate #define AML_NSOBJECT                0x0200
3910Sstevel@tonic-gate #define AML_HAS_RETVAL              0x0400
3920Sstevel@tonic-gate #define AML_HAS_TARGET              0x0800
3930Sstevel@tonic-gate #define AML_HAS_ARGS                0x1000
3940Sstevel@tonic-gate #define AML_CONSTANT                0x2000
3950Sstevel@tonic-gate #define AML_NO_OPERAND_RESOLVE      0x4000
3960Sstevel@tonic-gate 
3970Sstevel@tonic-gate /* Convenient flag groupings */
3980Sstevel@tonic-gate 
3990Sstevel@tonic-gate #define AML_FLAGS_EXEC_0A_0T_1R                                     AML_HAS_RETVAL
4000Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_0T_0R     AML_HAS_ARGS                                   /* Monadic1  */
4010Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Monadic2  */
4020Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_1T_0R     AML_HAS_ARGS | AML_HAS_TARGET
4030Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */
4040Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_0T_0R     AML_HAS_ARGS                                   /* Dyadic1   */
4050Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Dyadic2   */
4060Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R  */
4070Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_2T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
4080Sstevel@tonic-gate #define AML_FLAGS_EXEC_3A_0T_0R     AML_HAS_ARGS
4090Sstevel@tonic-gate #define AML_FLAGS_EXEC_3A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
4100Sstevel@tonic-gate #define AML_FLAGS_EXEC_6A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL
4110Sstevel@tonic-gate 
4120Sstevel@tonic-gate 
4130Sstevel@tonic-gate /*
4140Sstevel@tonic-gate  * The opcode Type is used in a dispatch table, do not change
4150Sstevel@tonic-gate  * without updating the table.
4160Sstevel@tonic-gate  */
4170Sstevel@tonic-gate #define AML_TYPE_EXEC_0A_0T_1R      0x00
4180Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_0T_0R      0x01 /* Monadic1  */
4190Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_0T_1R      0x02 /* Monadic2  */
4200Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_1T_0R      0x03
4210Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_1T_1R      0x04 /* Monadic2R */
4220Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_0T_0R      0x05 /* Dyadic1   */
4230Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_0T_1R      0x06 /* Dyadic2   */
4240Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_1T_1R      0x07 /* Dyadic2R  */
4250Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_2T_1R      0x08
4260Sstevel@tonic-gate #define AML_TYPE_EXEC_3A_0T_0R      0x09
4270Sstevel@tonic-gate #define AML_TYPE_EXEC_3A_1T_1R      0x0A
4280Sstevel@tonic-gate #define AML_TYPE_EXEC_6A_0T_1R      0x0B
4290Sstevel@tonic-gate /* End of types used in dispatch table */
4300Sstevel@tonic-gate 
4310Sstevel@tonic-gate #define AML_TYPE_LITERAL            0x0B
4320Sstevel@tonic-gate #define AML_TYPE_CONSTANT           0x0C
4330Sstevel@tonic-gate #define AML_TYPE_METHOD_ARGUMENT    0x0D
4340Sstevel@tonic-gate #define AML_TYPE_LOCAL_VARIABLE     0x0E
4350Sstevel@tonic-gate #define AML_TYPE_DATA_TERM          0x0F
4360Sstevel@tonic-gate 
4370Sstevel@tonic-gate /* Generic for an op that returns a value */
4380Sstevel@tonic-gate 
4390Sstevel@tonic-gate #define AML_TYPE_METHOD_CALL        0x10
4400Sstevel@tonic-gate 
4410Sstevel@tonic-gate /* Misc */
4420Sstevel@tonic-gate 
4430Sstevel@tonic-gate #define AML_TYPE_CREATE_FIELD       0x11
4440Sstevel@tonic-gate #define AML_TYPE_CREATE_OBJECT      0x12
4450Sstevel@tonic-gate #define AML_TYPE_CONTROL            0x13
4460Sstevel@tonic-gate #define AML_TYPE_NAMED_NO_OBJ       0x14
4470Sstevel@tonic-gate #define AML_TYPE_NAMED_FIELD        0x15
4480Sstevel@tonic-gate #define AML_TYPE_NAMED_SIMPLE       0x16
4490Sstevel@tonic-gate #define AML_TYPE_NAMED_COMPLEX      0x17
4500Sstevel@tonic-gate #define AML_TYPE_RETURN             0x18
4510Sstevel@tonic-gate 
4520Sstevel@tonic-gate #define AML_TYPE_UNDEFINED          0x19
4530Sstevel@tonic-gate #define AML_TYPE_BOGUS              0x1A
4540Sstevel@tonic-gate 
4550Sstevel@tonic-gate /* AML Package Length encodings */
4560Sstevel@tonic-gate 
4570Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE1      0x40
4580Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE2      0x4000
4590Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE3      0x400000
4600Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE4      0x40000000
4610Sstevel@tonic-gate 
4620Sstevel@tonic-gate /*
4630Sstevel@tonic-gate  * Opcode classes
4640Sstevel@tonic-gate  */
4650Sstevel@tonic-gate #define AML_CLASS_EXECUTE           0x00
4660Sstevel@tonic-gate #define AML_CLASS_CREATE            0x01
4670Sstevel@tonic-gate #define AML_CLASS_ARGUMENT          0x02
4680Sstevel@tonic-gate #define AML_CLASS_NAMED_OBJECT      0x03
4690Sstevel@tonic-gate #define AML_CLASS_CONTROL           0x04
4700Sstevel@tonic-gate #define AML_CLASS_ASCII             0x05
4710Sstevel@tonic-gate #define AML_CLASS_PREFIX            0x06
4720Sstevel@tonic-gate #define AML_CLASS_INTERNAL          0x07
4730Sstevel@tonic-gate #define AML_CLASS_RETURN_VALUE      0x08
4740Sstevel@tonic-gate #define AML_CLASS_METHOD_CALL       0x09
4750Sstevel@tonic-gate #define AML_CLASS_UNKNOWN           0x0A
4760Sstevel@tonic-gate 
4770Sstevel@tonic-gate 
4780Sstevel@tonic-gate /* Predefined Operation Region SpaceIDs */
4790Sstevel@tonic-gate 
4800Sstevel@tonic-gate typedef enum
4810Sstevel@tonic-gate {
4820Sstevel@tonic-gate     REGION_MEMORY                   = 0,
4830Sstevel@tonic-gate     REGION_IO,
4840Sstevel@tonic-gate     REGION_PCI_CONFIG,
4850Sstevel@tonic-gate     REGION_EC,
4860Sstevel@tonic-gate     REGION_SMBUS,
4870Sstevel@tonic-gate     REGION_CMOS,
4880Sstevel@tonic-gate     REGION_PCI_BAR,
4890Sstevel@tonic-gate     REGION_DATA_TABLE,              /* Internal use only */
4900Sstevel@tonic-gate     REGION_FIXED_HW                 = 0x7F
4910Sstevel@tonic-gate 
4920Sstevel@tonic-gate } AML_REGION_TYPES;
4930Sstevel@tonic-gate 
4940Sstevel@tonic-gate 
4950Sstevel@tonic-gate /* Comparison operation codes for MatchOp operator */
4960Sstevel@tonic-gate 
4970Sstevel@tonic-gate typedef enum
4980Sstevel@tonic-gate {
4990Sstevel@tonic-gate     MATCH_MTR                       = 0,
5000Sstevel@tonic-gate     MATCH_MEQ                       = 1,
5010Sstevel@tonic-gate     MATCH_MLE                       = 2,
5020Sstevel@tonic-gate     MATCH_MLT                       = 3,
5030Sstevel@tonic-gate     MATCH_MGE                       = 4,
5040Sstevel@tonic-gate     MATCH_MGT                       = 5
5050Sstevel@tonic-gate 
5060Sstevel@tonic-gate } AML_MATCH_OPERATOR;
5070Sstevel@tonic-gate 
5080Sstevel@tonic-gate #define MAX_MATCH_OPERATOR          5
5090Sstevel@tonic-gate 
5100Sstevel@tonic-gate 
5110Sstevel@tonic-gate /*
5120Sstevel@tonic-gate  * FieldFlags
5130Sstevel@tonic-gate  *
5140Sstevel@tonic-gate  * This byte is extracted from the AML and includes three separate
5150Sstevel@tonic-gate  * pieces of information about the field:
5160Sstevel@tonic-gate  * 1) The field access type
5170Sstevel@tonic-gate  * 2) The field update rule
5180Sstevel@tonic-gate  * 3) The lock rule for the field
5190Sstevel@tonic-gate  *
5200Sstevel@tonic-gate  * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.)
5210Sstevel@tonic-gate  *      04      : LockRule (1 == Lock)
5220Sstevel@tonic-gate  *      05 - 06 : UpdateRule
5230Sstevel@tonic-gate  */
5240Sstevel@tonic-gate #define AML_FIELD_ACCESS_TYPE_MASK  0x0F
5250Sstevel@tonic-gate #define AML_FIELD_LOCK_RULE_MASK    0x10
5260Sstevel@tonic-gate #define AML_FIELD_UPDATE_RULE_MASK  0x60
5270Sstevel@tonic-gate 
5280Sstevel@tonic-gate 
5290Sstevel@tonic-gate /* 1) Field Access Types */
5300Sstevel@tonic-gate 
5310Sstevel@tonic-gate typedef enum
5320Sstevel@tonic-gate {
5330Sstevel@tonic-gate     AML_FIELD_ACCESS_ANY            = 0x00,
5340Sstevel@tonic-gate     AML_FIELD_ACCESS_BYTE           = 0x01,
5350Sstevel@tonic-gate     AML_FIELD_ACCESS_WORD           = 0x02,
5360Sstevel@tonic-gate     AML_FIELD_ACCESS_DWORD          = 0x03,
5370Sstevel@tonic-gate     AML_FIELD_ACCESS_QWORD          = 0x04,    /* ACPI 2.0 */
5380Sstevel@tonic-gate     AML_FIELD_ACCESS_BUFFER         = 0x05     /* ACPI 2.0 */
5390Sstevel@tonic-gate 
5400Sstevel@tonic-gate } AML_ACCESS_TYPE;
5410Sstevel@tonic-gate 
5420Sstevel@tonic-gate 
5430Sstevel@tonic-gate /* 2) Field Lock Rules */
5440Sstevel@tonic-gate 
5450Sstevel@tonic-gate typedef enum
5460Sstevel@tonic-gate {
5470Sstevel@tonic-gate     AML_FIELD_LOCK_NEVER            = 0x00,
5480Sstevel@tonic-gate     AML_FIELD_LOCK_ALWAYS           = 0x10
5490Sstevel@tonic-gate 
5500Sstevel@tonic-gate } AML_LOCK_RULE;
5510Sstevel@tonic-gate 
5520Sstevel@tonic-gate 
5530Sstevel@tonic-gate /* 3) Field Update Rules */
5540Sstevel@tonic-gate 
5550Sstevel@tonic-gate typedef enum
5560Sstevel@tonic-gate {
5570Sstevel@tonic-gate     AML_FIELD_UPDATE_PRESERVE       = 0x00,
5580Sstevel@tonic-gate     AML_FIELD_UPDATE_WRITE_AS_ONES  = 0x20,
5590Sstevel@tonic-gate     AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
5600Sstevel@tonic-gate 
5610Sstevel@tonic-gate } AML_UPDATE_RULE;
5620Sstevel@tonic-gate 
5630Sstevel@tonic-gate 
5640Sstevel@tonic-gate /*
5650Sstevel@tonic-gate  * Field Access Attributes.
5660Sstevel@tonic-gate  * This byte is extracted from the AML via the
5670Sstevel@tonic-gate  * AccessAs keyword
5680Sstevel@tonic-gate  */
5690Sstevel@tonic-gate typedef enum
5700Sstevel@tonic-gate {
5710Sstevel@tonic-gate     AML_FIELD_ATTRIB_SMB_QUICK      = 0x02,
5720Sstevel@tonic-gate     AML_FIELD_ATTRIB_SMB_SEND_RCV   = 0x04,
5730Sstevel@tonic-gate     AML_FIELD_ATTRIB_SMB_BYTE       = 0x06,
5740Sstevel@tonic-gate     AML_FIELD_ATTRIB_SMB_WORD       = 0x08,
5750Sstevel@tonic-gate     AML_FIELD_ATTRIB_SMB_BLOCK      = 0x0A,
5760Sstevel@tonic-gate     AML_FIELD_ATTRIB_SMB_WORD_CALL  = 0x0C,
5770Sstevel@tonic-gate     AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D
5780Sstevel@tonic-gate 
5790Sstevel@tonic-gate } AML_ACCESS_ATTRIBUTE;
5800Sstevel@tonic-gate 
5810Sstevel@tonic-gate 
5820Sstevel@tonic-gate /* Bit fields in MethodFlags byte */
5830Sstevel@tonic-gate 
5840Sstevel@tonic-gate #define AML_METHOD_ARG_COUNT        0x07
5850Sstevel@tonic-gate #define AML_METHOD_SERIALIZED       0x08
5860Sstevel@tonic-gate #define AML_METHOD_SYNCH_LEVEL      0xF0
5870Sstevel@tonic-gate 
5880Sstevel@tonic-gate /* METHOD_FLAGS_ARG_COUNT is not used internally, define additional flags */
5890Sstevel@tonic-gate 
5900Sstevel@tonic-gate #define AML_METHOD_INTERNAL_ONLY    0x01
5910Sstevel@tonic-gate #define AML_METHOD_RESERVED1        0x02
5920Sstevel@tonic-gate #define AML_METHOD_RESERVED2        0x04
5930Sstevel@tonic-gate 
5940Sstevel@tonic-gate 
5950Sstevel@tonic-gate #endif /* __AMLCODE_H__ */
596