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