xref: /titanic_50/usr/src/uts/intel/sys/acpi/amlcode.h (revision 385cc6b4ad1792caef3f84eb61eed3f27085801f)
17c478bd9Sstevel@tonic-gate /******************************************************************************
27c478bd9Sstevel@tonic-gate  *
37c478bd9Sstevel@tonic-gate  * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
47c478bd9Sstevel@tonic-gate  *                   Declarations and definitions contained herein are derived
57c478bd9Sstevel@tonic-gate  *                   directly from the ACPI specification.
67c478bd9Sstevel@tonic-gate  *
77c478bd9Sstevel@tonic-gate  *****************************************************************************/
87c478bd9Sstevel@tonic-gate 
926f3cdf0SGordon Ross /*
10*385cc6b4SJerry Jelinek  * Copyright (C) 2000 - 2016, Intel Corp.
117c478bd9Sstevel@tonic-gate  * All rights reserved.
127c478bd9Sstevel@tonic-gate  *
1326f3cdf0SGordon Ross  * Redistribution and use in source and binary forms, with or without
1426f3cdf0SGordon Ross  * modification, are permitted provided that the following conditions
1526f3cdf0SGordon Ross  * are met:
1626f3cdf0SGordon Ross  * 1. Redistributions of source code must retain the above copyright
1726f3cdf0SGordon Ross  *    notice, this list of conditions, and the following disclaimer,
1826f3cdf0SGordon Ross  *    without modification.
1926f3cdf0SGordon Ross  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
2026f3cdf0SGordon Ross  *    substantially similar to the "NO WARRANTY" disclaimer below
2126f3cdf0SGordon Ross  *    ("Disclaimer") and any redistribution must be conditioned upon
2226f3cdf0SGordon Ross  *    including a substantially similar Disclaimer requirement for further
2326f3cdf0SGordon Ross  *    binary redistribution.
2426f3cdf0SGordon Ross  * 3. Neither the names of the above-listed copyright holders nor the names
2526f3cdf0SGordon Ross  *    of any contributors may be used to endorse or promote products derived
2626f3cdf0SGordon Ross  *    from this software without specific prior written permission.
277c478bd9Sstevel@tonic-gate  *
2826f3cdf0SGordon Ross  * Alternatively, this software may be distributed under the terms of the
2926f3cdf0SGordon Ross  * GNU General Public License ("GPL") version 2 as published by the Free
3026f3cdf0SGordon Ross  * Software Foundation.
317c478bd9Sstevel@tonic-gate  *
3226f3cdf0SGordon Ross  * NO WARRANTY
3326f3cdf0SGordon Ross  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
3426f3cdf0SGordon Ross  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3526f3cdf0SGordon Ross  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
3626f3cdf0SGordon Ross  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3726f3cdf0SGordon Ross  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3826f3cdf0SGordon Ross  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3926f3cdf0SGordon Ross  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4026f3cdf0SGordon Ross  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
4126f3cdf0SGordon Ross  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4226f3cdf0SGordon Ross  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4326f3cdf0SGordon Ross  * POSSIBILITY OF SUCH DAMAGES.
4426f3cdf0SGordon Ross  */
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifndef __AMLCODE_H__
477c478bd9Sstevel@tonic-gate #define __AMLCODE_H__
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /* primary opcodes */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate #define AML_NULL_CHAR               (UINT16) 0x00
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #define AML_ZERO_OP                 (UINT16) 0x00
547c478bd9Sstevel@tonic-gate #define AML_ONE_OP                  (UINT16) 0x01
557c478bd9Sstevel@tonic-gate #define AML_UNASSIGNED              (UINT16) 0x02
567c478bd9Sstevel@tonic-gate #define AML_ALIAS_OP                (UINT16) 0x06
577c478bd9Sstevel@tonic-gate #define AML_NAME_OP                 (UINT16) 0x08
587c478bd9Sstevel@tonic-gate #define AML_BYTE_OP                 (UINT16) 0x0a
597c478bd9Sstevel@tonic-gate #define AML_WORD_OP                 (UINT16) 0x0b
607c478bd9Sstevel@tonic-gate #define AML_DWORD_OP                (UINT16) 0x0c
617c478bd9Sstevel@tonic-gate #define AML_STRING_OP               (UINT16) 0x0d
627c478bd9Sstevel@tonic-gate #define AML_QWORD_OP                (UINT16) 0x0e     /* ACPI 2.0 */
637c478bd9Sstevel@tonic-gate #define AML_SCOPE_OP                (UINT16) 0x10
647c478bd9Sstevel@tonic-gate #define AML_BUFFER_OP               (UINT16) 0x11
657c478bd9Sstevel@tonic-gate #define AML_PACKAGE_OP              (UINT16) 0x12
667c478bd9Sstevel@tonic-gate #define AML_VAR_PACKAGE_OP          (UINT16) 0x13     /* ACPI 2.0 */
677c478bd9Sstevel@tonic-gate #define AML_METHOD_OP               (UINT16) 0x14
68*385cc6b4SJerry Jelinek #define AML_EXTERNAL_OP             (UINT16) 0x15     /* ACPI 6.0 */
697c478bd9Sstevel@tonic-gate #define AML_DUAL_NAME_PREFIX        (UINT16) 0x2e
707c478bd9Sstevel@tonic-gate #define AML_MULTI_NAME_PREFIX_OP    (UINT16) 0x2f
717c478bd9Sstevel@tonic-gate #define AML_NAME_CHAR_SUBSEQ        (UINT16) 0x30
727c478bd9Sstevel@tonic-gate #define AML_NAME_CHAR_FIRST         (UINT16) 0x41
73450d6964Smyers #define AML_EXTENDED_OP_PREFIX      (UINT16) 0x5b
747c478bd9Sstevel@tonic-gate #define AML_ROOT_PREFIX             (UINT16) 0x5c
757c478bd9Sstevel@tonic-gate #define AML_PARENT_PREFIX           (UINT16) 0x5e
767c478bd9Sstevel@tonic-gate #define AML_LOCAL_OP                (UINT16) 0x60
777c478bd9Sstevel@tonic-gate #define AML_LOCAL0                  (UINT16) 0x60
787c478bd9Sstevel@tonic-gate #define AML_LOCAL1                  (UINT16) 0x61
797c478bd9Sstevel@tonic-gate #define AML_LOCAL2                  (UINT16) 0x62
807c478bd9Sstevel@tonic-gate #define AML_LOCAL3                  (UINT16) 0x63
817c478bd9Sstevel@tonic-gate #define AML_LOCAL4                  (UINT16) 0x64
827c478bd9Sstevel@tonic-gate #define AML_LOCAL5                  (UINT16) 0x65
837c478bd9Sstevel@tonic-gate #define AML_LOCAL6                  (UINT16) 0x66
847c478bd9Sstevel@tonic-gate #define AML_LOCAL7                  (UINT16) 0x67
857c478bd9Sstevel@tonic-gate #define AML_ARG_OP                  (UINT16) 0x68
867c478bd9Sstevel@tonic-gate #define AML_ARG0                    (UINT16) 0x68
877c478bd9Sstevel@tonic-gate #define AML_ARG1                    (UINT16) 0x69
887c478bd9Sstevel@tonic-gate #define AML_ARG2                    (UINT16) 0x6a
897c478bd9Sstevel@tonic-gate #define AML_ARG3                    (UINT16) 0x6b
907c478bd9Sstevel@tonic-gate #define AML_ARG4                    (UINT16) 0x6c
917c478bd9Sstevel@tonic-gate #define AML_ARG5                    (UINT16) 0x6d
927c478bd9Sstevel@tonic-gate #define AML_ARG6                    (UINT16) 0x6e
937c478bd9Sstevel@tonic-gate #define AML_STORE_OP                (UINT16) 0x70
947c478bd9Sstevel@tonic-gate #define AML_REF_OF_OP               (UINT16) 0x71
957c478bd9Sstevel@tonic-gate #define AML_ADD_OP                  (UINT16) 0x72
967c478bd9Sstevel@tonic-gate #define AML_CONCAT_OP               (UINT16) 0x73
977c478bd9Sstevel@tonic-gate #define AML_SUBTRACT_OP             (UINT16) 0x74
987c478bd9Sstevel@tonic-gate #define AML_INCREMENT_OP            (UINT16) 0x75
997c478bd9Sstevel@tonic-gate #define AML_DECREMENT_OP            (UINT16) 0x76
1007c478bd9Sstevel@tonic-gate #define AML_MULTIPLY_OP             (UINT16) 0x77
1017c478bd9Sstevel@tonic-gate #define AML_DIVIDE_OP               (UINT16) 0x78
1027c478bd9Sstevel@tonic-gate #define AML_SHIFT_LEFT_OP           (UINT16) 0x79
1037c478bd9Sstevel@tonic-gate #define AML_SHIFT_RIGHT_OP          (UINT16) 0x7a
1047c478bd9Sstevel@tonic-gate #define AML_BIT_AND_OP              (UINT16) 0x7b
1057c478bd9Sstevel@tonic-gate #define AML_BIT_NAND_OP             (UINT16) 0x7c
1067c478bd9Sstevel@tonic-gate #define AML_BIT_OR_OP               (UINT16) 0x7d
1077c478bd9Sstevel@tonic-gate #define AML_BIT_NOR_OP              (UINT16) 0x7e
1087c478bd9Sstevel@tonic-gate #define AML_BIT_XOR_OP              (UINT16) 0x7f
1097c478bd9Sstevel@tonic-gate #define AML_BIT_NOT_OP              (UINT16) 0x80
1107c478bd9Sstevel@tonic-gate #define AML_FIND_SET_LEFT_BIT_OP    (UINT16) 0x81
1117c478bd9Sstevel@tonic-gate #define AML_FIND_SET_RIGHT_BIT_OP   (UINT16) 0x82
1127c478bd9Sstevel@tonic-gate #define AML_DEREF_OF_OP             (UINT16) 0x83
1137c478bd9Sstevel@tonic-gate #define AML_CONCAT_RES_OP           (UINT16) 0x84     /* ACPI 2.0 */
1147c478bd9Sstevel@tonic-gate #define AML_MOD_OP                  (UINT16) 0x85     /* ACPI 2.0 */
1157c478bd9Sstevel@tonic-gate #define AML_NOTIFY_OP               (UINT16) 0x86
1167c478bd9Sstevel@tonic-gate #define AML_SIZE_OF_OP              (UINT16) 0x87
1177c478bd9Sstevel@tonic-gate #define AML_INDEX_OP                (UINT16) 0x88
1187c478bd9Sstevel@tonic-gate #define AML_MATCH_OP                (UINT16) 0x89
1197c478bd9Sstevel@tonic-gate #define AML_CREATE_DWORD_FIELD_OP   (UINT16) 0x8a
1207c478bd9Sstevel@tonic-gate #define AML_CREATE_WORD_FIELD_OP    (UINT16) 0x8b
1217c478bd9Sstevel@tonic-gate #define AML_CREATE_BYTE_FIELD_OP    (UINT16) 0x8c
1227c478bd9Sstevel@tonic-gate #define AML_CREATE_BIT_FIELD_OP     (UINT16) 0x8d
123*385cc6b4SJerry Jelinek #define AML_OBJECT_TYPE_OP          (UINT16) 0x8e
1247c478bd9Sstevel@tonic-gate #define AML_CREATE_QWORD_FIELD_OP   (UINT16) 0x8f     /* ACPI 2.0 */
1257c478bd9Sstevel@tonic-gate #define AML_LAND_OP                 (UINT16) 0x90
1267c478bd9Sstevel@tonic-gate #define AML_LOR_OP                  (UINT16) 0x91
1277c478bd9Sstevel@tonic-gate #define AML_LNOT_OP                 (UINT16) 0x92
1287c478bd9Sstevel@tonic-gate #define AML_LEQUAL_OP               (UINT16) 0x93
1297c478bd9Sstevel@tonic-gate #define AML_LGREATER_OP             (UINT16) 0x94
1307c478bd9Sstevel@tonic-gate #define AML_LLESS_OP                (UINT16) 0x95
1317c478bd9Sstevel@tonic-gate #define AML_TO_BUFFER_OP            (UINT16) 0x96     /* ACPI 2.0 */
1327c478bd9Sstevel@tonic-gate #define AML_TO_DECSTRING_OP         (UINT16) 0x97     /* ACPI 2.0 */
1337c478bd9Sstevel@tonic-gate #define AML_TO_HEXSTRING_OP         (UINT16) 0x98     /* ACPI 2.0 */
1347c478bd9Sstevel@tonic-gate #define AML_TO_INTEGER_OP           (UINT16) 0x99     /* ACPI 2.0 */
1357c478bd9Sstevel@tonic-gate #define AML_TO_STRING_OP            (UINT16) 0x9c     /* ACPI 2.0 */
1367c478bd9Sstevel@tonic-gate #define AML_COPY_OP                 (UINT16) 0x9d     /* ACPI 2.0 */
1377c478bd9Sstevel@tonic-gate #define AML_MID_OP                  (UINT16) 0x9e     /* ACPI 2.0 */
1387c478bd9Sstevel@tonic-gate #define AML_CONTINUE_OP             (UINT16) 0x9f     /* ACPI 2.0 */
1397c478bd9Sstevel@tonic-gate #define AML_IF_OP                   (UINT16) 0xa0
1407c478bd9Sstevel@tonic-gate #define AML_ELSE_OP                 (UINT16) 0xa1
1417c478bd9Sstevel@tonic-gate #define AML_WHILE_OP                (UINT16) 0xa2
1427c478bd9Sstevel@tonic-gate #define AML_NOOP_OP                 (UINT16) 0xa3
1437c478bd9Sstevel@tonic-gate #define AML_RETURN_OP               (UINT16) 0xa4
1447c478bd9Sstevel@tonic-gate #define AML_BREAK_OP                (UINT16) 0xa5
1457c478bd9Sstevel@tonic-gate #define AML_BREAK_POINT_OP          (UINT16) 0xcc
1467c478bd9Sstevel@tonic-gate #define AML_ONES_OP                 (UINT16) 0xff
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate /* prefixed opcodes */
1497c478bd9Sstevel@tonic-gate 
150450d6964Smyers #define AML_EXTENDED_OPCODE         (UINT16) 0x5b00     /* prefix for 2-byte opcodes */
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate #define AML_MUTEX_OP                (UINT16) 0x5b01
1537c478bd9Sstevel@tonic-gate #define AML_EVENT_OP                (UINT16) 0x5b02
1547c478bd9Sstevel@tonic-gate #define AML_SHIFT_RIGHT_BIT_OP      (UINT16) 0x5b10
1557c478bd9Sstevel@tonic-gate #define AML_SHIFT_LEFT_BIT_OP       (UINT16) 0x5b11
1567c478bd9Sstevel@tonic-gate #define AML_COND_REF_OF_OP          (UINT16) 0x5b12
1577c478bd9Sstevel@tonic-gate #define AML_CREATE_FIELD_OP         (UINT16) 0x5b13
1587c478bd9Sstevel@tonic-gate #define AML_LOAD_TABLE_OP           (UINT16) 0x5b1f     /* ACPI 2.0 */
1597c478bd9Sstevel@tonic-gate #define AML_LOAD_OP                 (UINT16) 0x5b20
1607c478bd9Sstevel@tonic-gate #define AML_STALL_OP                (UINT16) 0x5b21
1617c478bd9Sstevel@tonic-gate #define AML_SLEEP_OP                (UINT16) 0x5b22
1627c478bd9Sstevel@tonic-gate #define AML_ACQUIRE_OP              (UINT16) 0x5b23
1637c478bd9Sstevel@tonic-gate #define AML_SIGNAL_OP               (UINT16) 0x5b24
1647c478bd9Sstevel@tonic-gate #define AML_WAIT_OP                 (UINT16) 0x5b25
1657c478bd9Sstevel@tonic-gate #define AML_RESET_OP                (UINT16) 0x5b26
1667c478bd9Sstevel@tonic-gate #define AML_RELEASE_OP              (UINT16) 0x5b27
1677c478bd9Sstevel@tonic-gate #define AML_FROM_BCD_OP             (UINT16) 0x5b28
1687c478bd9Sstevel@tonic-gate #define AML_TO_BCD_OP               (UINT16) 0x5b29
1697c478bd9Sstevel@tonic-gate #define AML_UNLOAD_OP               (UINT16) 0x5b2a
1707c478bd9Sstevel@tonic-gate #define AML_REVISION_OP             (UINT16) 0x5b30
1717c478bd9Sstevel@tonic-gate #define AML_DEBUG_OP                (UINT16) 0x5b31
1727c478bd9Sstevel@tonic-gate #define AML_FATAL_OP                (UINT16) 0x5b32
1737c478bd9Sstevel@tonic-gate #define AML_TIMER_OP                (UINT16) 0x5b33     /* ACPI 3.0 */
1747c478bd9Sstevel@tonic-gate #define AML_REGION_OP               (UINT16) 0x5b80
1757c478bd9Sstevel@tonic-gate #define AML_FIELD_OP                (UINT16) 0x5b81
1767c478bd9Sstevel@tonic-gate #define AML_DEVICE_OP               (UINT16) 0x5b82
1777c478bd9Sstevel@tonic-gate #define AML_PROCESSOR_OP            (UINT16) 0x5b83
1787c478bd9Sstevel@tonic-gate #define AML_POWER_RES_OP            (UINT16) 0x5b84
1797c478bd9Sstevel@tonic-gate #define AML_THERMAL_ZONE_OP         (UINT16) 0x5b85
1807c478bd9Sstevel@tonic-gate #define AML_INDEX_FIELD_OP          (UINT16) 0x5b86
1817c478bd9Sstevel@tonic-gate #define AML_BANK_FIELD_OP           (UINT16) 0x5b87
1827c478bd9Sstevel@tonic-gate #define AML_DATA_REGION_OP          (UINT16) 0x5b88     /* ACPI 2.0 */
1837c478bd9Sstevel@tonic-gate 
1847c478bd9Sstevel@tonic-gate 
18527f7c583Smyers /*
18627f7c583Smyers  * Combination opcodes (actually two one-byte opcodes)
18727f7c583Smyers  * Used by the disassembler and iASL compiler
18827f7c583Smyers  */
1897c478bd9Sstevel@tonic-gate #define AML_LGREATEREQUAL_OP        (UINT16) 0x9295
1907c478bd9Sstevel@tonic-gate #define AML_LLESSEQUAL_OP           (UINT16) 0x9294
1917c478bd9Sstevel@tonic-gate #define AML_LNOTEQUAL_OP            (UINT16) 0x9293
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate /*
195*385cc6b4SJerry Jelinek  * Opcodes for "Field" operators
196*385cc6b4SJerry Jelinek  */
197*385cc6b4SJerry Jelinek #define AML_FIELD_OFFSET_OP         (UINT8) 0x00
198*385cc6b4SJerry Jelinek #define AML_FIELD_ACCESS_OP         (UINT8) 0x01
199*385cc6b4SJerry Jelinek #define AML_FIELD_CONNECTION_OP     (UINT8) 0x02        /* ACPI 5.0 */
200*385cc6b4SJerry Jelinek #define AML_FIELD_EXT_ACCESS_OP     (UINT8) 0x03        /* ACPI 5.0 */
201*385cc6b4SJerry Jelinek 
202*385cc6b4SJerry Jelinek 
203*385cc6b4SJerry Jelinek /*
2047c478bd9Sstevel@tonic-gate  * Internal opcodes
2057c478bd9Sstevel@tonic-gate  * Use only "Unknown" AML opcodes, don't attempt to use
2067c478bd9Sstevel@tonic-gate  * any valid ACPI ASCII values (A-Z, 0-9, '-')
2077c478bd9Sstevel@tonic-gate  */
2087c478bd9Sstevel@tonic-gate #define AML_INT_NAMEPATH_OP         (UINT16) 0x002d
2097c478bd9Sstevel@tonic-gate #define AML_INT_NAMEDFIELD_OP       (UINT16) 0x0030
2107c478bd9Sstevel@tonic-gate #define AML_INT_RESERVEDFIELD_OP    (UINT16) 0x0031
2117c478bd9Sstevel@tonic-gate #define AML_INT_ACCESSFIELD_OP      (UINT16) 0x0032
2127c478bd9Sstevel@tonic-gate #define AML_INT_BYTELIST_OP         (UINT16) 0x0033
2137c478bd9Sstevel@tonic-gate #define AML_INT_METHODCALL_OP       (UINT16) 0x0035
2147c478bd9Sstevel@tonic-gate #define AML_INT_RETURN_VALUE_OP     (UINT16) 0x0036
2157c478bd9Sstevel@tonic-gate #define AML_INT_EVAL_SUBTREE_OP     (UINT16) 0x0037
216*385cc6b4SJerry Jelinek #define AML_INT_CONNECTION_OP       (UINT16) 0x0038
217*385cc6b4SJerry Jelinek #define AML_INT_EXTACCESSFIELD_OP   (UINT16) 0x0039
2187c478bd9Sstevel@tonic-gate 
2197c478bd9Sstevel@tonic-gate #define ARG_NONE                    0x0
2207c478bd9Sstevel@tonic-gate 
2217c478bd9Sstevel@tonic-gate /*
2227c478bd9Sstevel@tonic-gate  * Argument types for the AML Parser
2237c478bd9Sstevel@tonic-gate  * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
2247c478bd9Sstevel@tonic-gate  * There can be up to 31 unique argument types
2257c478bd9Sstevel@tonic-gate  * Zero is reserved as end-of-list indicator
2267c478bd9Sstevel@tonic-gate  */
2277c478bd9Sstevel@tonic-gate #define ARGP_BYTEDATA               0x01
2287c478bd9Sstevel@tonic-gate #define ARGP_BYTELIST               0x02
2297c478bd9Sstevel@tonic-gate #define ARGP_CHARLIST               0x03
2307c478bd9Sstevel@tonic-gate #define ARGP_DATAOBJ                0x04
2317c478bd9Sstevel@tonic-gate #define ARGP_DATAOBJLIST            0x05
2327c478bd9Sstevel@tonic-gate #define ARGP_DWORDDATA              0x06
2337c478bd9Sstevel@tonic-gate #define ARGP_FIELDLIST              0x07
2347c478bd9Sstevel@tonic-gate #define ARGP_NAME                   0x08
2357c478bd9Sstevel@tonic-gate #define ARGP_NAMESTRING             0x09
2367c478bd9Sstevel@tonic-gate #define ARGP_OBJLIST                0x0A
2377c478bd9Sstevel@tonic-gate #define ARGP_PKGLENGTH              0x0B
2387c478bd9Sstevel@tonic-gate #define ARGP_SUPERNAME              0x0C
2397c478bd9Sstevel@tonic-gate #define ARGP_TARGET                 0x0D
2407c478bd9Sstevel@tonic-gate #define ARGP_TERMARG                0x0E
2417c478bd9Sstevel@tonic-gate #define ARGP_TERMLIST               0x0F
2427c478bd9Sstevel@tonic-gate #define ARGP_WORDDATA               0x10
2437c478bd9Sstevel@tonic-gate #define ARGP_QWORDDATA              0x11
244*385cc6b4SJerry Jelinek #define ARGP_SIMPLENAME             0x12 /* NameString | LocalTerm | ArgTerm */
245*385cc6b4SJerry Jelinek #define ARGP_NAME_OR_REF            0x13 /* For ObjectType only */
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate /*
2487c478bd9Sstevel@tonic-gate  * Resolved argument types for the AML Interpreter
2497c478bd9Sstevel@tonic-gate  * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
2507c478bd9Sstevel@tonic-gate  * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
2517c478bd9Sstevel@tonic-gate  *
2527c478bd9Sstevel@tonic-gate  * Note1: These values are completely independent from the ACPI_TYPEs
2537c478bd9Sstevel@tonic-gate  *        i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER
2547c478bd9Sstevel@tonic-gate  *
2557c478bd9Sstevel@tonic-gate  * Note2: If and when 5 bits becomes insufficient, it would probably be best
2567c478bd9Sstevel@tonic-gate  * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
2577c478bd9Sstevel@tonic-gate  */
2587c478bd9Sstevel@tonic-gate 
2597c478bd9Sstevel@tonic-gate /* Single, simple types */
2607c478bd9Sstevel@tonic-gate 
2617c478bd9Sstevel@tonic-gate #define ARGI_ANYTYPE                0x01    /* Don't care */
2627c478bd9Sstevel@tonic-gate #define ARGI_PACKAGE                0x02
2637c478bd9Sstevel@tonic-gate #define ARGI_EVENT                  0x03
2647c478bd9Sstevel@tonic-gate #define ARGI_MUTEX                  0x04
2657c478bd9Sstevel@tonic-gate #define ARGI_DDBHANDLE              0x05
2667c478bd9Sstevel@tonic-gate 
2677c478bd9Sstevel@tonic-gate /* Interchangeable types (via implicit conversion) */
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #define ARGI_INTEGER                0x06
2707c478bd9Sstevel@tonic-gate #define ARGI_STRING                 0x07
2717c478bd9Sstevel@tonic-gate #define ARGI_BUFFER                 0x08
2727c478bd9Sstevel@tonic-gate #define ARGI_BUFFER_OR_STRING       0x09    /* Used by MID op only */
2737c478bd9Sstevel@tonic-gate #define ARGI_COMPUTEDATA            0x0A    /* Buffer, String, or Integer */
2747c478bd9Sstevel@tonic-gate 
2757c478bd9Sstevel@tonic-gate /* Reference objects */
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate #define ARGI_INTEGER_REF            0x0B
2787c478bd9Sstevel@tonic-gate #define ARGI_OBJECT_REF             0x0C
2797c478bd9Sstevel@tonic-gate #define ARGI_DEVICE_REF             0x0D
2807c478bd9Sstevel@tonic-gate #define ARGI_REFERENCE              0x0E
2817c478bd9Sstevel@tonic-gate #define ARGI_TARGETREF              0x0F    /* Target, subject to implicit conversion */
2827c478bd9Sstevel@tonic-gate #define ARGI_FIXED_TARGET           0x10    /* Target, no implicit conversion */
2837c478bd9Sstevel@tonic-gate #define ARGI_SIMPLE_TARGET          0x11    /* Name, Local, Arg -- no implicit conversion */
284*385cc6b4SJerry Jelinek #define ARGI_STORE_TARGET           0x12    /* Target for store is TARGETREF + package objects */
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate /* Multiple/complex types */
2877c478bd9Sstevel@tonic-gate 
288*385cc6b4SJerry Jelinek #define ARGI_DATAOBJECT             0x13    /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
289*385cc6b4SJerry Jelinek #define ARGI_COMPLEXOBJ             0x14    /* Buffer, String, or package (Used by INDEX op only) */
290*385cc6b4SJerry Jelinek #define ARGI_REF_OR_STRING          0x15    /* Reference or String (Used by DEREFOF op only) */
291*385cc6b4SJerry Jelinek #define ARGI_REGION_OR_BUFFER       0x16    /* Used by LOAD op only */
292*385cc6b4SJerry Jelinek #define ARGI_DATAREFOBJ             0x17
2937c478bd9Sstevel@tonic-gate 
2947c478bd9Sstevel@tonic-gate /* Note: types above can expand to 0x1F maximum */
2957c478bd9Sstevel@tonic-gate 
2967c478bd9Sstevel@tonic-gate #define ARGI_INVALID_OPCODE         0xFFFFFFFF
2977c478bd9Sstevel@tonic-gate 
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate /*
3007c478bd9Sstevel@tonic-gate  * hash offsets
3017c478bd9Sstevel@tonic-gate  */
3027c478bd9Sstevel@tonic-gate #define AML_EXTOP_HASH_OFFSET       22
3037c478bd9Sstevel@tonic-gate #define AML_LNOT_HASH_OFFSET        19
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate 
3067c478bd9Sstevel@tonic-gate /*
3077c478bd9Sstevel@tonic-gate  * opcode groups and types
3087c478bd9Sstevel@tonic-gate  */
3097c478bd9Sstevel@tonic-gate #define OPGRP_NAMED                 0x01
3107c478bd9Sstevel@tonic-gate #define OPGRP_FIELD                 0x02
3117c478bd9Sstevel@tonic-gate #define OPGRP_BYTELIST              0x04
3127c478bd9Sstevel@tonic-gate 
3137c478bd9Sstevel@tonic-gate 
3147c478bd9Sstevel@tonic-gate /*
3157c478bd9Sstevel@tonic-gate  * Opcode information
3167c478bd9Sstevel@tonic-gate  */
3177c478bd9Sstevel@tonic-gate 
3187c478bd9Sstevel@tonic-gate /* Opcode flags */
3197c478bd9Sstevel@tonic-gate 
3207c478bd9Sstevel@tonic-gate #define AML_LOGICAL                 0x0001
3217c478bd9Sstevel@tonic-gate #define AML_LOGICAL_NUMERIC         0x0002
3227c478bd9Sstevel@tonic-gate #define AML_MATH                    0x0004
3237c478bd9Sstevel@tonic-gate #define AML_CREATE                  0x0008
3247c478bd9Sstevel@tonic-gate #define AML_FIELD                   0x0010
3257c478bd9Sstevel@tonic-gate #define AML_DEFER                   0x0020
3267c478bd9Sstevel@tonic-gate #define AML_NAMED                   0x0040
3277c478bd9Sstevel@tonic-gate #define AML_NSNODE                  0x0080
3287c478bd9Sstevel@tonic-gate #define AML_NSOPCODE                0x0100
3297c478bd9Sstevel@tonic-gate #define AML_NSOBJECT                0x0200
3307c478bd9Sstevel@tonic-gate #define AML_HAS_RETVAL              0x0400
3317c478bd9Sstevel@tonic-gate #define AML_HAS_TARGET              0x0800
3327c478bd9Sstevel@tonic-gate #define AML_HAS_ARGS                0x1000
3337c478bd9Sstevel@tonic-gate #define AML_CONSTANT                0x2000
3347c478bd9Sstevel@tonic-gate #define AML_NO_OPERAND_RESOLVE      0x4000
3357c478bd9Sstevel@tonic-gate 
3367c478bd9Sstevel@tonic-gate /* Convenient flag groupings */
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_0A_0T_1R                                     AML_HAS_RETVAL
3397c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_0T_0R     AML_HAS_ARGS                                   /* Monadic1  */
3407c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Monadic2  */
3417c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_1T_0R     AML_HAS_ARGS | AML_HAS_TARGET
3427c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_1A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */
3437c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_0T_0R     AML_HAS_ARGS                                   /* Dyadic1   */
3447c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Dyadic2   */
3457c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R  */
3467c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_2A_2T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
3477c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_3A_0T_0R     AML_HAS_ARGS
3487c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_3A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
3497c478bd9Sstevel@tonic-gate #define AML_FLAGS_EXEC_6A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL
3507c478bd9Sstevel@tonic-gate 
3517c478bd9Sstevel@tonic-gate 
3527c478bd9Sstevel@tonic-gate /*
3537c478bd9Sstevel@tonic-gate  * The opcode Type is used in a dispatch table, do not change
3547c478bd9Sstevel@tonic-gate  * without updating the table.
3557c478bd9Sstevel@tonic-gate  */
3567c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_0A_0T_1R      0x00
3577c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_0T_0R      0x01 /* Monadic1  */
3587c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_0T_1R      0x02 /* Monadic2  */
3597c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_1T_0R      0x03
3607c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_1A_1T_1R      0x04 /* Monadic2R */
3617c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_0T_0R      0x05 /* Dyadic1   */
3627c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_0T_1R      0x06 /* Dyadic2   */
3637c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_1T_1R      0x07 /* Dyadic2R  */
3647c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_2A_2T_1R      0x08
3657c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_3A_0T_0R      0x09
3667c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_3A_1T_1R      0x0A
3677c478bd9Sstevel@tonic-gate #define AML_TYPE_EXEC_6A_0T_1R      0x0B
3687c478bd9Sstevel@tonic-gate /* End of types used in dispatch table */
3697c478bd9Sstevel@tonic-gate 
3707c478bd9Sstevel@tonic-gate #define AML_TYPE_LITERAL            0x0B
3717c478bd9Sstevel@tonic-gate #define AML_TYPE_CONSTANT           0x0C
3727c478bd9Sstevel@tonic-gate #define AML_TYPE_METHOD_ARGUMENT    0x0D
3737c478bd9Sstevel@tonic-gate #define AML_TYPE_LOCAL_VARIABLE     0x0E
3747c478bd9Sstevel@tonic-gate #define AML_TYPE_DATA_TERM          0x0F
3757c478bd9Sstevel@tonic-gate 
3767c478bd9Sstevel@tonic-gate /* Generic for an op that returns a value */
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate #define AML_TYPE_METHOD_CALL        0x10
3797c478bd9Sstevel@tonic-gate 
3807c478bd9Sstevel@tonic-gate /* Misc */
3817c478bd9Sstevel@tonic-gate 
3827c478bd9Sstevel@tonic-gate #define AML_TYPE_CREATE_FIELD       0x11
3837c478bd9Sstevel@tonic-gate #define AML_TYPE_CREATE_OBJECT      0x12
3847c478bd9Sstevel@tonic-gate #define AML_TYPE_CONTROL            0x13
3857c478bd9Sstevel@tonic-gate #define AML_TYPE_NAMED_NO_OBJ       0x14
3867c478bd9Sstevel@tonic-gate #define AML_TYPE_NAMED_FIELD        0x15
3877c478bd9Sstevel@tonic-gate #define AML_TYPE_NAMED_SIMPLE       0x16
3887c478bd9Sstevel@tonic-gate #define AML_TYPE_NAMED_COMPLEX      0x17
3897c478bd9Sstevel@tonic-gate #define AML_TYPE_RETURN             0x18
3907c478bd9Sstevel@tonic-gate 
3917c478bd9Sstevel@tonic-gate #define AML_TYPE_UNDEFINED          0x19
3927c478bd9Sstevel@tonic-gate #define AML_TYPE_BOGUS              0x1A
3937c478bd9Sstevel@tonic-gate 
3947c478bd9Sstevel@tonic-gate /* AML Package Length encodings */
3957c478bd9Sstevel@tonic-gate 
3967c478bd9Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE1      0x40
3977c478bd9Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE2      0x4000
3987c478bd9Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE3      0x400000
3997c478bd9Sstevel@tonic-gate #define ACPI_AML_PACKAGE_TYPE4      0x40000000
4007c478bd9Sstevel@tonic-gate 
4017c478bd9Sstevel@tonic-gate /*
4027c478bd9Sstevel@tonic-gate  * Opcode classes
4037c478bd9Sstevel@tonic-gate  */
4047c478bd9Sstevel@tonic-gate #define AML_CLASS_EXECUTE           0x00
4057c478bd9Sstevel@tonic-gate #define AML_CLASS_CREATE            0x01
4067c478bd9Sstevel@tonic-gate #define AML_CLASS_ARGUMENT          0x02
4077c478bd9Sstevel@tonic-gate #define AML_CLASS_NAMED_OBJECT      0x03
4087c478bd9Sstevel@tonic-gate #define AML_CLASS_CONTROL           0x04
4097c478bd9Sstevel@tonic-gate #define AML_CLASS_ASCII             0x05
4107c478bd9Sstevel@tonic-gate #define AML_CLASS_PREFIX            0x06
4117c478bd9Sstevel@tonic-gate #define AML_CLASS_INTERNAL          0x07
4127c478bd9Sstevel@tonic-gate #define AML_CLASS_RETURN_VALUE      0x08
4137c478bd9Sstevel@tonic-gate #define AML_CLASS_METHOD_CALL       0x09
4147c478bd9Sstevel@tonic-gate #define AML_CLASS_UNKNOWN           0x0A
4157c478bd9Sstevel@tonic-gate 
4167c478bd9Sstevel@tonic-gate 
4177c478bd9Sstevel@tonic-gate /* Comparison operation codes for MatchOp operator */
4187c478bd9Sstevel@tonic-gate 
4197c478bd9Sstevel@tonic-gate typedef enum
4207c478bd9Sstevel@tonic-gate {
4217c478bd9Sstevel@tonic-gate     MATCH_MTR                       = 0,
4227c478bd9Sstevel@tonic-gate     MATCH_MEQ                       = 1,
4237c478bd9Sstevel@tonic-gate     MATCH_MLE                       = 2,
4247c478bd9Sstevel@tonic-gate     MATCH_MLT                       = 3,
4257c478bd9Sstevel@tonic-gate     MATCH_MGE                       = 4,
4267c478bd9Sstevel@tonic-gate     MATCH_MGT                       = 5
4277c478bd9Sstevel@tonic-gate 
4287c478bd9Sstevel@tonic-gate } AML_MATCH_OPERATOR;
4297c478bd9Sstevel@tonic-gate 
4307c478bd9Sstevel@tonic-gate #define MAX_MATCH_OPERATOR          5
4317c478bd9Sstevel@tonic-gate 
4327c478bd9Sstevel@tonic-gate 
4337c478bd9Sstevel@tonic-gate /*
4347c478bd9Sstevel@tonic-gate  * FieldFlags
4357c478bd9Sstevel@tonic-gate  *
4367c478bd9Sstevel@tonic-gate  * This byte is extracted from the AML and includes three separate
4377c478bd9Sstevel@tonic-gate  * pieces of information about the field:
4387c478bd9Sstevel@tonic-gate  * 1) The field access type
4397c478bd9Sstevel@tonic-gate  * 2) The field update rule
4407c478bd9Sstevel@tonic-gate  * 3) The lock rule for the field
4417c478bd9Sstevel@tonic-gate  *
4427c478bd9Sstevel@tonic-gate  * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.)
4437c478bd9Sstevel@tonic-gate  *      04      : LockRule (1 == Lock)
4447c478bd9Sstevel@tonic-gate  *      05 - 06 : UpdateRule
4457c478bd9Sstevel@tonic-gate  */
4467c478bd9Sstevel@tonic-gate #define AML_FIELD_ACCESS_TYPE_MASK  0x0F
4477c478bd9Sstevel@tonic-gate #define AML_FIELD_LOCK_RULE_MASK    0x10
4487c478bd9Sstevel@tonic-gate #define AML_FIELD_UPDATE_RULE_MASK  0x60
4497c478bd9Sstevel@tonic-gate 
4507c478bd9Sstevel@tonic-gate 
4517c478bd9Sstevel@tonic-gate /* 1) Field Access Types */
4527c478bd9Sstevel@tonic-gate 
4537c478bd9Sstevel@tonic-gate typedef enum
4547c478bd9Sstevel@tonic-gate {
4557c478bd9Sstevel@tonic-gate     AML_FIELD_ACCESS_ANY            = 0x00,
4567c478bd9Sstevel@tonic-gate     AML_FIELD_ACCESS_BYTE           = 0x01,
4577c478bd9Sstevel@tonic-gate     AML_FIELD_ACCESS_WORD           = 0x02,
4587c478bd9Sstevel@tonic-gate     AML_FIELD_ACCESS_DWORD          = 0x03,
4597c478bd9Sstevel@tonic-gate     AML_FIELD_ACCESS_QWORD          = 0x04,    /* ACPI 2.0 */
4607c478bd9Sstevel@tonic-gate     AML_FIELD_ACCESS_BUFFER         = 0x05     /* ACPI 2.0 */
4617c478bd9Sstevel@tonic-gate 
4627c478bd9Sstevel@tonic-gate } AML_ACCESS_TYPE;
4637c478bd9Sstevel@tonic-gate 
4647c478bd9Sstevel@tonic-gate 
4657c478bd9Sstevel@tonic-gate /* 2) Field Lock Rules */
4667c478bd9Sstevel@tonic-gate 
4677c478bd9Sstevel@tonic-gate typedef enum
4687c478bd9Sstevel@tonic-gate {
4697c478bd9Sstevel@tonic-gate     AML_FIELD_LOCK_NEVER            = 0x00,
4707c478bd9Sstevel@tonic-gate     AML_FIELD_LOCK_ALWAYS           = 0x10
4717c478bd9Sstevel@tonic-gate 
4727c478bd9Sstevel@tonic-gate } AML_LOCK_RULE;
4737c478bd9Sstevel@tonic-gate 
4747c478bd9Sstevel@tonic-gate 
4757c478bd9Sstevel@tonic-gate /* 3) Field Update Rules */
4767c478bd9Sstevel@tonic-gate 
4777c478bd9Sstevel@tonic-gate typedef enum
4787c478bd9Sstevel@tonic-gate {
4797c478bd9Sstevel@tonic-gate     AML_FIELD_UPDATE_PRESERVE       = 0x00,
4807c478bd9Sstevel@tonic-gate     AML_FIELD_UPDATE_WRITE_AS_ONES  = 0x20,
4817c478bd9Sstevel@tonic-gate     AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
4827c478bd9Sstevel@tonic-gate 
4837c478bd9Sstevel@tonic-gate } AML_UPDATE_RULE;
4847c478bd9Sstevel@tonic-gate 
4857c478bd9Sstevel@tonic-gate 
4867c478bd9Sstevel@tonic-gate /*
4877c478bd9Sstevel@tonic-gate  * Field Access Attributes.
4887c478bd9Sstevel@tonic-gate  * This byte is extracted from the AML via the
4897c478bd9Sstevel@tonic-gate  * AccessAs keyword
4907c478bd9Sstevel@tonic-gate  */
4917c478bd9Sstevel@tonic-gate typedef enum
4927c478bd9Sstevel@tonic-gate {
493*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_QUICK          = 0x02,
494*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_SEND_RCV       = 0x04,
495*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_BYTE           = 0x06,
496*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_WORD           = 0x08,
497*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_BLOCK          = 0x0A,
498*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_MULTIBYTE      = 0x0B,
499*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_WORD_CALL      = 0x0C,
500*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_BLOCK_CALL     = 0x0D,
501*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_RAW_BYTES      = 0x0E,
502*385cc6b4SJerry Jelinek     AML_FIELD_ATTRIB_RAW_PROCESS    = 0x0F
5037c478bd9Sstevel@tonic-gate 
5047c478bd9Sstevel@tonic-gate } AML_ACCESS_ATTRIBUTE;
5057c478bd9Sstevel@tonic-gate 
5067c478bd9Sstevel@tonic-gate 
50726f3cdf0SGordon Ross /* Bit fields in the AML MethodFlags byte */
5087c478bd9Sstevel@tonic-gate 
5097c478bd9Sstevel@tonic-gate #define AML_METHOD_ARG_COUNT        0x07
5107c478bd9Sstevel@tonic-gate #define AML_METHOD_SERIALIZED       0x08
511aa2aa9a6SDana Myers #define AML_METHOD_SYNC_LEVEL       0xF0
5127c478bd9Sstevel@tonic-gate 
5137c478bd9Sstevel@tonic-gate 
5147c478bd9Sstevel@tonic-gate #endif /* __AMLCODE_H__ */
515