1433d6423SLionel Sambuc /****************************************************************************** 2433d6423SLionel Sambuc * 3433d6423SLionel Sambuc * Name: amlcode.h - Definitions for AML, as included in "definition blocks" 4433d6423SLionel Sambuc * Declarations and definitions contained herein are derived 5433d6423SLionel Sambuc * directly from the ACPI specification. 6433d6423SLionel Sambuc * 7433d6423SLionel Sambuc *****************************************************************************/ 8433d6423SLionel Sambuc 9*29492bb7SDavid van Moolenbroek /* 10*29492bb7SDavid van Moolenbroek * Copyright (C) 2000 - 2014, Intel Corp. 11433d6423SLionel Sambuc * All rights reserved. 12433d6423SLionel Sambuc * 13*29492bb7SDavid van Moolenbroek * Redistribution and use in source and binary forms, with or without 14*29492bb7SDavid van Moolenbroek * modification, are permitted provided that the following conditions 15*29492bb7SDavid van Moolenbroek * are met: 16*29492bb7SDavid van Moolenbroek * 1. Redistributions of source code must retain the above copyright 17*29492bb7SDavid van Moolenbroek * notice, this list of conditions, and the following disclaimer, 18*29492bb7SDavid van Moolenbroek * without modification. 19*29492bb7SDavid van Moolenbroek * 2. Redistributions in binary form must reproduce at minimum a disclaimer 20*29492bb7SDavid van Moolenbroek * substantially similar to the "NO WARRANTY" disclaimer below 21*29492bb7SDavid van Moolenbroek * ("Disclaimer") and any redistribution must be conditioned upon 22*29492bb7SDavid van Moolenbroek * including a substantially similar Disclaimer requirement for further 23*29492bb7SDavid van Moolenbroek * binary redistribution. 24*29492bb7SDavid van Moolenbroek * 3. Neither the names of the above-listed copyright holders nor the names 25*29492bb7SDavid van Moolenbroek * of any contributors may be used to endorse or promote products derived 26*29492bb7SDavid van Moolenbroek * from this software without specific prior written permission. 27433d6423SLionel Sambuc * 28*29492bb7SDavid van Moolenbroek * Alternatively, this software may be distributed under the terms of the 29*29492bb7SDavid van Moolenbroek * GNU General Public License ("GPL") version 2 as published by the Free 30*29492bb7SDavid van Moolenbroek * Software Foundation. 31433d6423SLionel Sambuc * 32*29492bb7SDavid van Moolenbroek * NO WARRANTY 33*29492bb7SDavid van Moolenbroek * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 34*29492bb7SDavid van Moolenbroek * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 35*29492bb7SDavid van Moolenbroek * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 36*29492bb7SDavid van Moolenbroek * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 37*29492bb7SDavid van Moolenbroek * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 38*29492bb7SDavid van Moolenbroek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 39*29492bb7SDavid van Moolenbroek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 40*29492bb7SDavid van Moolenbroek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 41*29492bb7SDavid van Moolenbroek * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 42*29492bb7SDavid van Moolenbroek * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 43*29492bb7SDavid van Moolenbroek * POSSIBILITY OF SUCH DAMAGES. 44*29492bb7SDavid van Moolenbroek */ 45433d6423SLionel Sambuc 46433d6423SLionel Sambuc #ifndef __AMLCODE_H__ 47433d6423SLionel Sambuc #define __AMLCODE_H__ 48433d6423SLionel Sambuc 49433d6423SLionel Sambuc /* primary opcodes */ 50433d6423SLionel Sambuc 51433d6423SLionel Sambuc #define AML_NULL_CHAR (UINT16) 0x00 52433d6423SLionel Sambuc 53433d6423SLionel Sambuc #define AML_ZERO_OP (UINT16) 0x00 54433d6423SLionel Sambuc #define AML_ONE_OP (UINT16) 0x01 55433d6423SLionel Sambuc #define AML_UNASSIGNED (UINT16) 0x02 56433d6423SLionel Sambuc #define AML_ALIAS_OP (UINT16) 0x06 57433d6423SLionel Sambuc #define AML_NAME_OP (UINT16) 0x08 58433d6423SLionel Sambuc #define AML_BYTE_OP (UINT16) 0x0a 59433d6423SLionel Sambuc #define AML_WORD_OP (UINT16) 0x0b 60433d6423SLionel Sambuc #define AML_DWORD_OP (UINT16) 0x0c 61433d6423SLionel Sambuc #define AML_STRING_OP (UINT16) 0x0d 62433d6423SLionel Sambuc #define AML_QWORD_OP (UINT16) 0x0e /* ACPI 2.0 */ 63433d6423SLionel Sambuc #define AML_SCOPE_OP (UINT16) 0x10 64433d6423SLionel Sambuc #define AML_BUFFER_OP (UINT16) 0x11 65433d6423SLionel Sambuc #define AML_PACKAGE_OP (UINT16) 0x12 66433d6423SLionel Sambuc #define AML_VAR_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */ 67433d6423SLionel Sambuc #define AML_METHOD_OP (UINT16) 0x14 68433d6423SLionel Sambuc #define AML_DUAL_NAME_PREFIX (UINT16) 0x2e 69433d6423SLionel Sambuc #define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f 70433d6423SLionel Sambuc #define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30 71433d6423SLionel Sambuc #define AML_NAME_CHAR_FIRST (UINT16) 0x41 72433d6423SLionel Sambuc #define AML_EXTENDED_OP_PREFIX (UINT16) 0x5b 73433d6423SLionel Sambuc #define AML_ROOT_PREFIX (UINT16) 0x5c 74433d6423SLionel Sambuc #define AML_PARENT_PREFIX (UINT16) 0x5e 75433d6423SLionel Sambuc #define AML_LOCAL_OP (UINT16) 0x60 76433d6423SLionel Sambuc #define AML_LOCAL0 (UINT16) 0x60 77433d6423SLionel Sambuc #define AML_LOCAL1 (UINT16) 0x61 78433d6423SLionel Sambuc #define AML_LOCAL2 (UINT16) 0x62 79433d6423SLionel Sambuc #define AML_LOCAL3 (UINT16) 0x63 80433d6423SLionel Sambuc #define AML_LOCAL4 (UINT16) 0x64 81433d6423SLionel Sambuc #define AML_LOCAL5 (UINT16) 0x65 82433d6423SLionel Sambuc #define AML_LOCAL6 (UINT16) 0x66 83433d6423SLionel Sambuc #define AML_LOCAL7 (UINT16) 0x67 84433d6423SLionel Sambuc #define AML_ARG_OP (UINT16) 0x68 85433d6423SLionel Sambuc #define AML_ARG0 (UINT16) 0x68 86433d6423SLionel Sambuc #define AML_ARG1 (UINT16) 0x69 87433d6423SLionel Sambuc #define AML_ARG2 (UINT16) 0x6a 88433d6423SLionel Sambuc #define AML_ARG3 (UINT16) 0x6b 89433d6423SLionel Sambuc #define AML_ARG4 (UINT16) 0x6c 90433d6423SLionel Sambuc #define AML_ARG5 (UINT16) 0x6d 91433d6423SLionel Sambuc #define AML_ARG6 (UINT16) 0x6e 92433d6423SLionel Sambuc #define AML_STORE_OP (UINT16) 0x70 93433d6423SLionel Sambuc #define AML_REF_OF_OP (UINT16) 0x71 94433d6423SLionel Sambuc #define AML_ADD_OP (UINT16) 0x72 95433d6423SLionel Sambuc #define AML_CONCAT_OP (UINT16) 0x73 96433d6423SLionel Sambuc #define AML_SUBTRACT_OP (UINT16) 0x74 97433d6423SLionel Sambuc #define AML_INCREMENT_OP (UINT16) 0x75 98433d6423SLionel Sambuc #define AML_DECREMENT_OP (UINT16) 0x76 99433d6423SLionel Sambuc #define AML_MULTIPLY_OP (UINT16) 0x77 100433d6423SLionel Sambuc #define AML_DIVIDE_OP (UINT16) 0x78 101433d6423SLionel Sambuc #define AML_SHIFT_LEFT_OP (UINT16) 0x79 102433d6423SLionel Sambuc #define AML_SHIFT_RIGHT_OP (UINT16) 0x7a 103433d6423SLionel Sambuc #define AML_BIT_AND_OP (UINT16) 0x7b 104433d6423SLionel Sambuc #define AML_BIT_NAND_OP (UINT16) 0x7c 105433d6423SLionel Sambuc #define AML_BIT_OR_OP (UINT16) 0x7d 106433d6423SLionel Sambuc #define AML_BIT_NOR_OP (UINT16) 0x7e 107433d6423SLionel Sambuc #define AML_BIT_XOR_OP (UINT16) 0x7f 108433d6423SLionel Sambuc #define AML_BIT_NOT_OP (UINT16) 0x80 109433d6423SLionel Sambuc #define AML_FIND_SET_LEFT_BIT_OP (UINT16) 0x81 110433d6423SLionel Sambuc #define AML_FIND_SET_RIGHT_BIT_OP (UINT16) 0x82 111433d6423SLionel Sambuc #define AML_DEREF_OF_OP (UINT16) 0x83 112433d6423SLionel Sambuc #define AML_CONCAT_RES_OP (UINT16) 0x84 /* ACPI 2.0 */ 113433d6423SLionel Sambuc #define AML_MOD_OP (UINT16) 0x85 /* ACPI 2.0 */ 114433d6423SLionel Sambuc #define AML_NOTIFY_OP (UINT16) 0x86 115433d6423SLionel Sambuc #define AML_SIZE_OF_OP (UINT16) 0x87 116433d6423SLionel Sambuc #define AML_INDEX_OP (UINT16) 0x88 117433d6423SLionel Sambuc #define AML_MATCH_OP (UINT16) 0x89 118433d6423SLionel Sambuc #define AML_CREATE_DWORD_FIELD_OP (UINT16) 0x8a 119433d6423SLionel Sambuc #define AML_CREATE_WORD_FIELD_OP (UINT16) 0x8b 120433d6423SLionel Sambuc #define AML_CREATE_BYTE_FIELD_OP (UINT16) 0x8c 121433d6423SLionel Sambuc #define AML_CREATE_BIT_FIELD_OP (UINT16) 0x8d 122433d6423SLionel Sambuc #define AML_TYPE_OP (UINT16) 0x8e 123433d6423SLionel Sambuc #define AML_CREATE_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */ 124433d6423SLionel Sambuc #define AML_LAND_OP (UINT16) 0x90 125433d6423SLionel Sambuc #define AML_LOR_OP (UINT16) 0x91 126433d6423SLionel Sambuc #define AML_LNOT_OP (UINT16) 0x92 127433d6423SLionel Sambuc #define AML_LEQUAL_OP (UINT16) 0x93 128433d6423SLionel Sambuc #define AML_LGREATER_OP (UINT16) 0x94 129433d6423SLionel Sambuc #define AML_LLESS_OP (UINT16) 0x95 130433d6423SLionel Sambuc #define AML_TO_BUFFER_OP (UINT16) 0x96 /* ACPI 2.0 */ 131433d6423SLionel Sambuc #define AML_TO_DECSTRING_OP (UINT16) 0x97 /* ACPI 2.0 */ 132433d6423SLionel Sambuc #define AML_TO_HEXSTRING_OP (UINT16) 0x98 /* ACPI 2.0 */ 133433d6423SLionel Sambuc #define AML_TO_INTEGER_OP (UINT16) 0x99 /* ACPI 2.0 */ 134433d6423SLionel Sambuc #define AML_TO_STRING_OP (UINT16) 0x9c /* ACPI 2.0 */ 135433d6423SLionel Sambuc #define AML_COPY_OP (UINT16) 0x9d /* ACPI 2.0 */ 136433d6423SLionel Sambuc #define AML_MID_OP (UINT16) 0x9e /* ACPI 2.0 */ 137433d6423SLionel Sambuc #define AML_CONTINUE_OP (UINT16) 0x9f /* ACPI 2.0 */ 138433d6423SLionel Sambuc #define AML_IF_OP (UINT16) 0xa0 139433d6423SLionel Sambuc #define AML_ELSE_OP (UINT16) 0xa1 140433d6423SLionel Sambuc #define AML_WHILE_OP (UINT16) 0xa2 141433d6423SLionel Sambuc #define AML_NOOP_OP (UINT16) 0xa3 142433d6423SLionel Sambuc #define AML_RETURN_OP (UINT16) 0xa4 143433d6423SLionel Sambuc #define AML_BREAK_OP (UINT16) 0xa5 144433d6423SLionel Sambuc #define AML_BREAK_POINT_OP (UINT16) 0xcc 145433d6423SLionel Sambuc #define AML_ONES_OP (UINT16) 0xff 146433d6423SLionel Sambuc 147433d6423SLionel Sambuc /* prefixed opcodes */ 148433d6423SLionel Sambuc 149433d6423SLionel Sambuc #define AML_EXTENDED_OPCODE (UINT16) 0x5b00 /* prefix for 2-byte opcodes */ 150433d6423SLionel Sambuc 151433d6423SLionel Sambuc #define AML_MUTEX_OP (UINT16) 0x5b01 152433d6423SLionel Sambuc #define AML_EVENT_OP (UINT16) 0x5b02 153433d6423SLionel Sambuc #define AML_SHIFT_RIGHT_BIT_OP (UINT16) 0x5b10 154433d6423SLionel Sambuc #define AML_SHIFT_LEFT_BIT_OP (UINT16) 0x5b11 155433d6423SLionel Sambuc #define AML_COND_REF_OF_OP (UINT16) 0x5b12 156433d6423SLionel Sambuc #define AML_CREATE_FIELD_OP (UINT16) 0x5b13 157433d6423SLionel Sambuc #define AML_LOAD_TABLE_OP (UINT16) 0x5b1f /* ACPI 2.0 */ 158433d6423SLionel Sambuc #define AML_LOAD_OP (UINT16) 0x5b20 159433d6423SLionel Sambuc #define AML_STALL_OP (UINT16) 0x5b21 160433d6423SLionel Sambuc #define AML_SLEEP_OP (UINT16) 0x5b22 161433d6423SLionel Sambuc #define AML_ACQUIRE_OP (UINT16) 0x5b23 162433d6423SLionel Sambuc #define AML_SIGNAL_OP (UINT16) 0x5b24 163433d6423SLionel Sambuc #define AML_WAIT_OP (UINT16) 0x5b25 164433d6423SLionel Sambuc #define AML_RESET_OP (UINT16) 0x5b26 165433d6423SLionel Sambuc #define AML_RELEASE_OP (UINT16) 0x5b27 166433d6423SLionel Sambuc #define AML_FROM_BCD_OP (UINT16) 0x5b28 167433d6423SLionel Sambuc #define AML_TO_BCD_OP (UINT16) 0x5b29 168433d6423SLionel Sambuc #define AML_UNLOAD_OP (UINT16) 0x5b2a 169433d6423SLionel Sambuc #define AML_REVISION_OP (UINT16) 0x5b30 170433d6423SLionel Sambuc #define AML_DEBUG_OP (UINT16) 0x5b31 171433d6423SLionel Sambuc #define AML_FATAL_OP (UINT16) 0x5b32 172433d6423SLionel Sambuc #define AML_TIMER_OP (UINT16) 0x5b33 /* ACPI 3.0 */ 173433d6423SLionel Sambuc #define AML_REGION_OP (UINT16) 0x5b80 174433d6423SLionel Sambuc #define AML_FIELD_OP (UINT16) 0x5b81 175433d6423SLionel Sambuc #define AML_DEVICE_OP (UINT16) 0x5b82 176433d6423SLionel Sambuc #define AML_PROCESSOR_OP (UINT16) 0x5b83 177433d6423SLionel Sambuc #define AML_POWER_RES_OP (UINT16) 0x5b84 178433d6423SLionel Sambuc #define AML_THERMAL_ZONE_OP (UINT16) 0x5b85 179433d6423SLionel Sambuc #define AML_INDEX_FIELD_OP (UINT16) 0x5b86 180433d6423SLionel Sambuc #define AML_BANK_FIELD_OP (UINT16) 0x5b87 181433d6423SLionel Sambuc #define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */ 182433d6423SLionel Sambuc 183433d6423SLionel Sambuc 184433d6423SLionel Sambuc /* 185433d6423SLionel Sambuc * Combination opcodes (actually two one-byte opcodes) 186433d6423SLionel Sambuc * Used by the disassembler and iASL compiler 187433d6423SLionel Sambuc */ 188433d6423SLionel Sambuc #define AML_LGREATEREQUAL_OP (UINT16) 0x9295 189433d6423SLionel Sambuc #define AML_LLESSEQUAL_OP (UINT16) 0x9294 190433d6423SLionel Sambuc #define AML_LNOTEQUAL_OP (UINT16) 0x9293 191433d6423SLionel Sambuc 192433d6423SLionel Sambuc 193433d6423SLionel Sambuc /* 194*29492bb7SDavid van Moolenbroek * Opcodes for "Field" operators 195*29492bb7SDavid van Moolenbroek */ 196*29492bb7SDavid van Moolenbroek #define AML_FIELD_OFFSET_OP (UINT8) 0x00 197*29492bb7SDavid van Moolenbroek #define AML_FIELD_ACCESS_OP (UINT8) 0x01 198*29492bb7SDavid van Moolenbroek #define AML_FIELD_CONNECTION_OP (UINT8) 0x02 /* ACPI 5.0 */ 199*29492bb7SDavid van Moolenbroek #define AML_FIELD_EXT_ACCESS_OP (UINT8) 0x03 /* ACPI 5.0 */ 200*29492bb7SDavid van Moolenbroek 201*29492bb7SDavid van Moolenbroek 202*29492bb7SDavid van Moolenbroek /* 203433d6423SLionel Sambuc * Internal opcodes 204433d6423SLionel Sambuc * Use only "Unknown" AML opcodes, don't attempt to use 205433d6423SLionel Sambuc * any valid ACPI ASCII values (A-Z, 0-9, '-') 206433d6423SLionel Sambuc */ 207433d6423SLionel Sambuc #define AML_INT_NAMEPATH_OP (UINT16) 0x002d 208433d6423SLionel Sambuc #define AML_INT_NAMEDFIELD_OP (UINT16) 0x0030 209433d6423SLionel Sambuc #define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031 210433d6423SLionel Sambuc #define AML_INT_ACCESSFIELD_OP (UINT16) 0x0032 211433d6423SLionel Sambuc #define AML_INT_BYTELIST_OP (UINT16) 0x0033 212433d6423SLionel Sambuc #define AML_INT_STATICSTRING_OP (UINT16) 0x0034 213433d6423SLionel Sambuc #define AML_INT_METHODCALL_OP (UINT16) 0x0035 214433d6423SLionel Sambuc #define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036 215433d6423SLionel Sambuc #define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037 216*29492bb7SDavid van Moolenbroek #define AML_INT_CONNECTION_OP (UINT16) 0x0038 217*29492bb7SDavid van Moolenbroek #define AML_INT_EXTACCESSFIELD_OP (UINT16) 0x0039 218433d6423SLionel Sambuc 219433d6423SLionel Sambuc #define ARG_NONE 0x0 220433d6423SLionel Sambuc 221433d6423SLionel Sambuc /* 222433d6423SLionel Sambuc * Argument types for the AML Parser 223433d6423SLionel Sambuc * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. 224433d6423SLionel Sambuc * There can be up to 31 unique argument types 225433d6423SLionel Sambuc * Zero is reserved as end-of-list indicator 226433d6423SLionel Sambuc */ 227433d6423SLionel Sambuc #define ARGP_BYTEDATA 0x01 228433d6423SLionel Sambuc #define ARGP_BYTELIST 0x02 229433d6423SLionel Sambuc #define ARGP_CHARLIST 0x03 230433d6423SLionel Sambuc #define ARGP_DATAOBJ 0x04 231433d6423SLionel Sambuc #define ARGP_DATAOBJLIST 0x05 232433d6423SLionel Sambuc #define ARGP_DWORDDATA 0x06 233433d6423SLionel Sambuc #define ARGP_FIELDLIST 0x07 234433d6423SLionel Sambuc #define ARGP_NAME 0x08 235433d6423SLionel Sambuc #define ARGP_NAMESTRING 0x09 236433d6423SLionel Sambuc #define ARGP_OBJLIST 0x0A 237433d6423SLionel Sambuc #define ARGP_PKGLENGTH 0x0B 238433d6423SLionel Sambuc #define ARGP_SUPERNAME 0x0C 239433d6423SLionel Sambuc #define ARGP_TARGET 0x0D 240433d6423SLionel Sambuc #define ARGP_TERMARG 0x0E 241433d6423SLionel Sambuc #define ARGP_TERMLIST 0x0F 242433d6423SLionel Sambuc #define ARGP_WORDDATA 0x10 243433d6423SLionel Sambuc #define ARGP_QWORDDATA 0x11 244433d6423SLionel Sambuc #define ARGP_SIMPLENAME 0x12 245433d6423SLionel Sambuc 246433d6423SLionel Sambuc /* 247433d6423SLionel Sambuc * Resolved argument types for the AML Interpreter 248433d6423SLionel Sambuc * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. 249433d6423SLionel Sambuc * There can be up to 31 unique argument types (0 is end-of-arg-list indicator) 250433d6423SLionel Sambuc * 251433d6423SLionel Sambuc * Note1: These values are completely independent from the ACPI_TYPEs 252433d6423SLionel Sambuc * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER 253433d6423SLionel Sambuc * 254433d6423SLionel Sambuc * Note2: If and when 5 bits becomes insufficient, it would probably be best 255433d6423SLionel Sambuc * to convert to a 6-byte array of argument types, allowing 8 bits per argument. 256433d6423SLionel Sambuc */ 257433d6423SLionel Sambuc 258433d6423SLionel Sambuc /* Single, simple types */ 259433d6423SLionel Sambuc 260433d6423SLionel Sambuc #define ARGI_ANYTYPE 0x01 /* Don't care */ 261433d6423SLionel Sambuc #define ARGI_PACKAGE 0x02 262433d6423SLionel Sambuc #define ARGI_EVENT 0x03 263433d6423SLionel Sambuc #define ARGI_MUTEX 0x04 264433d6423SLionel Sambuc #define ARGI_DDBHANDLE 0x05 265433d6423SLionel Sambuc 266433d6423SLionel Sambuc /* Interchangeable types (via implicit conversion) */ 267433d6423SLionel Sambuc 268433d6423SLionel Sambuc #define ARGI_INTEGER 0x06 269433d6423SLionel Sambuc #define ARGI_STRING 0x07 270433d6423SLionel Sambuc #define ARGI_BUFFER 0x08 271433d6423SLionel Sambuc #define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ 272433d6423SLionel Sambuc #define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ 273433d6423SLionel Sambuc 274433d6423SLionel Sambuc /* Reference objects */ 275433d6423SLionel Sambuc 276433d6423SLionel Sambuc #define ARGI_INTEGER_REF 0x0B 277433d6423SLionel Sambuc #define ARGI_OBJECT_REF 0x0C 278433d6423SLionel Sambuc #define ARGI_DEVICE_REF 0x0D 279433d6423SLionel Sambuc #define ARGI_REFERENCE 0x0E 280433d6423SLionel Sambuc #define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ 281433d6423SLionel Sambuc #define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ 282433d6423SLionel Sambuc #define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ 283433d6423SLionel Sambuc 284433d6423SLionel Sambuc /* Multiple/complex types */ 285433d6423SLionel Sambuc 286433d6423SLionel Sambuc #define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/ 287433d6423SLionel Sambuc #define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ 288433d6423SLionel Sambuc #define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ 289433d6423SLionel Sambuc #define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */ 290433d6423SLionel Sambuc #define ARGI_DATAREFOBJ 0x16 291433d6423SLionel Sambuc 292433d6423SLionel Sambuc /* Note: types above can expand to 0x1F maximum */ 293433d6423SLionel Sambuc 294433d6423SLionel Sambuc #define ARGI_INVALID_OPCODE 0xFFFFFFFF 295433d6423SLionel Sambuc 296433d6423SLionel Sambuc 297433d6423SLionel Sambuc /* 298433d6423SLionel Sambuc * hash offsets 299433d6423SLionel Sambuc */ 300433d6423SLionel Sambuc #define AML_EXTOP_HASH_OFFSET 22 301433d6423SLionel Sambuc #define AML_LNOT_HASH_OFFSET 19 302433d6423SLionel Sambuc 303433d6423SLionel Sambuc 304433d6423SLionel Sambuc /* 305433d6423SLionel Sambuc * opcode groups and types 306433d6423SLionel Sambuc */ 307433d6423SLionel Sambuc #define OPGRP_NAMED 0x01 308433d6423SLionel Sambuc #define OPGRP_FIELD 0x02 309433d6423SLionel Sambuc #define OPGRP_BYTELIST 0x04 310433d6423SLionel Sambuc 311433d6423SLionel Sambuc 312433d6423SLionel Sambuc /* 313433d6423SLionel Sambuc * Opcode information 314433d6423SLionel Sambuc */ 315433d6423SLionel Sambuc 316433d6423SLionel Sambuc /* Opcode flags */ 317433d6423SLionel Sambuc 318433d6423SLionel Sambuc #define AML_LOGICAL 0x0001 319433d6423SLionel Sambuc #define AML_LOGICAL_NUMERIC 0x0002 320433d6423SLionel Sambuc #define AML_MATH 0x0004 321433d6423SLionel Sambuc #define AML_CREATE 0x0008 322433d6423SLionel Sambuc #define AML_FIELD 0x0010 323433d6423SLionel Sambuc #define AML_DEFER 0x0020 324433d6423SLionel Sambuc #define AML_NAMED 0x0040 325433d6423SLionel Sambuc #define AML_NSNODE 0x0080 326433d6423SLionel Sambuc #define AML_NSOPCODE 0x0100 327433d6423SLionel Sambuc #define AML_NSOBJECT 0x0200 328433d6423SLionel Sambuc #define AML_HAS_RETVAL 0x0400 329433d6423SLionel Sambuc #define AML_HAS_TARGET 0x0800 330433d6423SLionel Sambuc #define AML_HAS_ARGS 0x1000 331433d6423SLionel Sambuc #define AML_CONSTANT 0x2000 332433d6423SLionel Sambuc #define AML_NO_OPERAND_RESOLVE 0x4000 333433d6423SLionel Sambuc 334433d6423SLionel Sambuc /* Convenient flag groupings */ 335433d6423SLionel Sambuc 336433d6423SLionel Sambuc #define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL 337433d6423SLionel Sambuc #define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ 338433d6423SLionel Sambuc #define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ 339433d6423SLionel Sambuc #define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET 340433d6423SLionel Sambuc #define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */ 341433d6423SLionel Sambuc #define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ 342433d6423SLionel Sambuc #define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ 343433d6423SLionel Sambuc #define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R */ 344433d6423SLionel Sambuc #define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL 345433d6423SLionel Sambuc #define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS 346433d6423SLionel Sambuc #define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL 347433d6423SLionel Sambuc #define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL 348433d6423SLionel Sambuc 349433d6423SLionel Sambuc 350433d6423SLionel Sambuc /* 351433d6423SLionel Sambuc * The opcode Type is used in a dispatch table, do not change 352433d6423SLionel Sambuc * without updating the table. 353433d6423SLionel Sambuc */ 354433d6423SLionel Sambuc #define AML_TYPE_EXEC_0A_0T_1R 0x00 355433d6423SLionel Sambuc #define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ 356433d6423SLionel Sambuc #define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ 357433d6423SLionel Sambuc #define AML_TYPE_EXEC_1A_1T_0R 0x03 358433d6423SLionel Sambuc #define AML_TYPE_EXEC_1A_1T_1R 0x04 /* Monadic2R */ 359433d6423SLionel Sambuc #define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ 360433d6423SLionel Sambuc #define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ 361433d6423SLionel Sambuc #define AML_TYPE_EXEC_2A_1T_1R 0x07 /* Dyadic2R */ 362433d6423SLionel Sambuc #define AML_TYPE_EXEC_2A_2T_1R 0x08 363433d6423SLionel Sambuc #define AML_TYPE_EXEC_3A_0T_0R 0x09 364433d6423SLionel Sambuc #define AML_TYPE_EXEC_3A_1T_1R 0x0A 365433d6423SLionel Sambuc #define AML_TYPE_EXEC_6A_0T_1R 0x0B 366433d6423SLionel Sambuc /* End of types used in dispatch table */ 367433d6423SLionel Sambuc 368433d6423SLionel Sambuc #define AML_TYPE_LITERAL 0x0B 369433d6423SLionel Sambuc #define AML_TYPE_CONSTANT 0x0C 370433d6423SLionel Sambuc #define AML_TYPE_METHOD_ARGUMENT 0x0D 371433d6423SLionel Sambuc #define AML_TYPE_LOCAL_VARIABLE 0x0E 372433d6423SLionel Sambuc #define AML_TYPE_DATA_TERM 0x0F 373433d6423SLionel Sambuc 374433d6423SLionel Sambuc /* Generic for an op that returns a value */ 375433d6423SLionel Sambuc 376433d6423SLionel Sambuc #define AML_TYPE_METHOD_CALL 0x10 377433d6423SLionel Sambuc 378433d6423SLionel Sambuc /* Misc */ 379433d6423SLionel Sambuc 380433d6423SLionel Sambuc #define AML_TYPE_CREATE_FIELD 0x11 381433d6423SLionel Sambuc #define AML_TYPE_CREATE_OBJECT 0x12 382433d6423SLionel Sambuc #define AML_TYPE_CONTROL 0x13 383433d6423SLionel Sambuc #define AML_TYPE_NAMED_NO_OBJ 0x14 384433d6423SLionel Sambuc #define AML_TYPE_NAMED_FIELD 0x15 385433d6423SLionel Sambuc #define AML_TYPE_NAMED_SIMPLE 0x16 386433d6423SLionel Sambuc #define AML_TYPE_NAMED_COMPLEX 0x17 387433d6423SLionel Sambuc #define AML_TYPE_RETURN 0x18 388433d6423SLionel Sambuc 389433d6423SLionel Sambuc #define AML_TYPE_UNDEFINED 0x19 390433d6423SLionel Sambuc #define AML_TYPE_BOGUS 0x1A 391433d6423SLionel Sambuc 392433d6423SLionel Sambuc /* AML Package Length encodings */ 393433d6423SLionel Sambuc 394433d6423SLionel Sambuc #define ACPI_AML_PACKAGE_TYPE1 0x40 395433d6423SLionel Sambuc #define ACPI_AML_PACKAGE_TYPE2 0x4000 396433d6423SLionel Sambuc #define ACPI_AML_PACKAGE_TYPE3 0x400000 397433d6423SLionel Sambuc #define ACPI_AML_PACKAGE_TYPE4 0x40000000 398433d6423SLionel Sambuc 399433d6423SLionel Sambuc /* 400433d6423SLionel Sambuc * Opcode classes 401433d6423SLionel Sambuc */ 402433d6423SLionel Sambuc #define AML_CLASS_EXECUTE 0x00 403433d6423SLionel Sambuc #define AML_CLASS_CREATE 0x01 404433d6423SLionel Sambuc #define AML_CLASS_ARGUMENT 0x02 405433d6423SLionel Sambuc #define AML_CLASS_NAMED_OBJECT 0x03 406433d6423SLionel Sambuc #define AML_CLASS_CONTROL 0x04 407433d6423SLionel Sambuc #define AML_CLASS_ASCII 0x05 408433d6423SLionel Sambuc #define AML_CLASS_PREFIX 0x06 409433d6423SLionel Sambuc #define AML_CLASS_INTERNAL 0x07 410433d6423SLionel Sambuc #define AML_CLASS_RETURN_VALUE 0x08 411433d6423SLionel Sambuc #define AML_CLASS_METHOD_CALL 0x09 412433d6423SLionel Sambuc #define AML_CLASS_UNKNOWN 0x0A 413433d6423SLionel Sambuc 414433d6423SLionel Sambuc 415433d6423SLionel Sambuc /* Comparison operation codes for MatchOp operator */ 416433d6423SLionel Sambuc 417433d6423SLionel Sambuc typedef enum 418433d6423SLionel Sambuc { 419433d6423SLionel Sambuc MATCH_MTR = 0, 420433d6423SLionel Sambuc MATCH_MEQ = 1, 421433d6423SLionel Sambuc MATCH_MLE = 2, 422433d6423SLionel Sambuc MATCH_MLT = 3, 423433d6423SLionel Sambuc MATCH_MGE = 4, 424433d6423SLionel Sambuc MATCH_MGT = 5 425433d6423SLionel Sambuc 426433d6423SLionel Sambuc } AML_MATCH_OPERATOR; 427433d6423SLionel Sambuc 428433d6423SLionel Sambuc #define MAX_MATCH_OPERATOR 5 429433d6423SLionel Sambuc 430433d6423SLionel Sambuc 431433d6423SLionel Sambuc /* 432433d6423SLionel Sambuc * FieldFlags 433433d6423SLionel Sambuc * 434433d6423SLionel Sambuc * This byte is extracted from the AML and includes three separate 435433d6423SLionel Sambuc * pieces of information about the field: 436433d6423SLionel Sambuc * 1) The field access type 437433d6423SLionel Sambuc * 2) The field update rule 438433d6423SLionel Sambuc * 3) The lock rule for the field 439433d6423SLionel Sambuc * 440433d6423SLionel Sambuc * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.) 441433d6423SLionel Sambuc * 04 : LockRule (1 == Lock) 442433d6423SLionel Sambuc * 05 - 06 : UpdateRule 443433d6423SLionel Sambuc */ 444433d6423SLionel Sambuc #define AML_FIELD_ACCESS_TYPE_MASK 0x0F 445433d6423SLionel Sambuc #define AML_FIELD_LOCK_RULE_MASK 0x10 446433d6423SLionel Sambuc #define AML_FIELD_UPDATE_RULE_MASK 0x60 447433d6423SLionel Sambuc 448433d6423SLionel Sambuc 449433d6423SLionel Sambuc /* 1) Field Access Types */ 450433d6423SLionel Sambuc 451433d6423SLionel Sambuc typedef enum 452433d6423SLionel Sambuc { 453433d6423SLionel Sambuc AML_FIELD_ACCESS_ANY = 0x00, 454433d6423SLionel Sambuc AML_FIELD_ACCESS_BYTE = 0x01, 455433d6423SLionel Sambuc AML_FIELD_ACCESS_WORD = 0x02, 456433d6423SLionel Sambuc AML_FIELD_ACCESS_DWORD = 0x03, 457433d6423SLionel Sambuc AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ 458433d6423SLionel Sambuc AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ 459433d6423SLionel Sambuc 460433d6423SLionel Sambuc } AML_ACCESS_TYPE; 461433d6423SLionel Sambuc 462433d6423SLionel Sambuc 463433d6423SLionel Sambuc /* 2) Field Lock Rules */ 464433d6423SLionel Sambuc 465433d6423SLionel Sambuc typedef enum 466433d6423SLionel Sambuc { 467433d6423SLionel Sambuc AML_FIELD_LOCK_NEVER = 0x00, 468433d6423SLionel Sambuc AML_FIELD_LOCK_ALWAYS = 0x10 469433d6423SLionel Sambuc 470433d6423SLionel Sambuc } AML_LOCK_RULE; 471433d6423SLionel Sambuc 472433d6423SLionel Sambuc 473433d6423SLionel Sambuc /* 3) Field Update Rules */ 474433d6423SLionel Sambuc 475433d6423SLionel Sambuc typedef enum 476433d6423SLionel Sambuc { 477433d6423SLionel Sambuc AML_FIELD_UPDATE_PRESERVE = 0x00, 478433d6423SLionel Sambuc AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, 479433d6423SLionel Sambuc AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 480433d6423SLionel Sambuc 481433d6423SLionel Sambuc } AML_UPDATE_RULE; 482433d6423SLionel Sambuc 483433d6423SLionel Sambuc 484433d6423SLionel Sambuc /* 485433d6423SLionel Sambuc * Field Access Attributes. 486433d6423SLionel Sambuc * This byte is extracted from the AML via the 487433d6423SLionel Sambuc * AccessAs keyword 488433d6423SLionel Sambuc */ 489433d6423SLionel Sambuc typedef enum 490433d6423SLionel Sambuc { 491*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_QUICK = 0x02, 492*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_SEND_RCV = 0x04, 493*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_BYTE = 0x06, 494*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_WORD = 0x08, 495*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_BLOCK = 0x0A, 496*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_MULTIBYTE = 0x0B, 497*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_WORD_CALL = 0x0C, 498*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_BLOCK_CALL = 0x0D, 499*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_RAW_BYTES = 0x0E, 500*29492bb7SDavid van Moolenbroek AML_FIELD_ATTRIB_RAW_PROCESS = 0x0F 501433d6423SLionel Sambuc 502433d6423SLionel Sambuc } AML_ACCESS_ATTRIBUTE; 503433d6423SLionel Sambuc 504433d6423SLionel Sambuc 505*29492bb7SDavid van Moolenbroek /* Bit fields in the AML MethodFlags byte */ 506433d6423SLionel Sambuc 507433d6423SLionel Sambuc #define AML_METHOD_ARG_COUNT 0x07 508433d6423SLionel Sambuc #define AML_METHOD_SERIALIZED 0x08 509433d6423SLionel Sambuc #define AML_METHOD_SYNC_LEVEL 0xF0 510433d6423SLionel Sambuc 511433d6423SLionel Sambuc 512433d6423SLionel Sambuc #endif /* __AMLCODE_H__ */ 513