amlcode.h revision 217365
138889Sjdp/****************************************************************************** 238889Sjdp * 338889Sjdp * Name: amlcode.h - Definitions for AML, as included in "definition blocks" 438889Sjdp * Declarations and definitions contained herein are derived 538889Sjdp * directly from the ACPI specification. 638889Sjdp * 760484Sobrien *****************************************************************************/ 838889Sjdp 960484Sobrien/* 1038889Sjdp * Copyright (C) 2000 - 2011, Intel Corp. 1138889Sjdp * All rights reserved. 1238889Sjdp * 1338889Sjdp * Redistribution and use in source and binary forms, with or without 1438889Sjdp * modification, are permitted provided that the following conditions 1577298Sobrien * are met: 1677298Sobrien * 1. Redistributions of source code must retain the above copyright 1777298Sobrien * notice, this list of conditions, and the following disclaimer, 1838889Sjdp * without modification. 1938889Sjdp * 2. Redistributions in binary form must reproduce at minimum a disclaimer 2038889Sjdp * substantially similar to the "NO WARRANTY" disclaimer below 2138889Sjdp * ("Disclaimer") and any redistribution must be conditioned upon 2238889Sjdp * including a substantially similar Disclaimer requirement for further 2338889Sjdp * binary redistribution. 2438889Sjdp * 3. Neither the names of the above-listed copyright holders nor the names 2538889Sjdp * of any contributors may be used to endorse or promote products derived 2638889Sjdp * from this software without specific prior written permission. 2738889Sjdp * 2889857Sobrien * Alternatively, this software may be distributed under the terms of the 2938889Sjdp * GNU General Public License ("GPL") version 2 as published by the Free 3038889Sjdp * Software Foundation. 3138889Sjdp * 3277298Sobrien * NO WARRANTY 3389857Sobrien * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 3438889Sjdp * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 3589857Sobrien * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 3689857Sobrien * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3789857Sobrien * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 3838889Sjdp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 3938889Sjdp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4038889Sjdp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 4177298Sobrien * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 4289857Sobrien * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 4338889Sjdp * POSSIBILITY OF SUCH DAMAGES. 4489857Sobrien */ 4589857Sobrien 4638889Sjdp#ifndef __AMLCODE_H__ 4738889Sjdp#define __AMLCODE_H__ 4838889Sjdp 4938889Sjdp/* primary opcodes */ 5038889Sjdp 5138889Sjdp#define AML_NULL_CHAR (UINT16) 0x00 5238889Sjdp 5360484Sobrien#define AML_ZERO_OP (UINT16) 0x00 5477298Sobrien#define AML_ONE_OP (UINT16) 0x01 5538889Sjdp#define AML_UNASSIGNED (UINT16) 0x02 5660484Sobrien#define AML_ALIAS_OP (UINT16) 0x06 5760484Sobrien#define AML_NAME_OP (UINT16) 0x08 5838889Sjdp#define AML_BYTE_OP (UINT16) 0x0a 5938889Sjdp#define AML_WORD_OP (UINT16) 0x0b 6038889Sjdp#define AML_DWORD_OP (UINT16) 0x0c 6177298Sobrien#define AML_STRING_OP (UINT16) 0x0d 6260484Sobrien#define AML_QWORD_OP (UINT16) 0x0e /* ACPI 2.0 */ 6338889Sjdp#define AML_SCOPE_OP (UINT16) 0x10 6438889Sjdp#define AML_BUFFER_OP (UINT16) 0x11 6538889Sjdp#define AML_PACKAGE_OP (UINT16) 0x12 6638889Sjdp#define AML_VAR_PACKAGE_OP (UINT16) 0x13 /* ACPI 2.0 */ 6777298Sobrien#define AML_METHOD_OP (UINT16) 0x14 6877298Sobrien#define AML_DUAL_NAME_PREFIX (UINT16) 0x2e 6938889Sjdp#define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f 7038889Sjdp#define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30 7138889Sjdp#define AML_NAME_CHAR_FIRST (UINT16) 0x41 7238889Sjdp#define AML_EXTENDED_OP_PREFIX (UINT16) 0x5b 7360484Sobrien#define AML_ROOT_PREFIX (UINT16) 0x5c 7460484Sobrien#define AML_PARENT_PREFIX (UINT16) 0x5e 7589857Sobrien#define AML_LOCAL_OP (UINT16) 0x60 7691041Sobrien#define AML_LOCAL0 (UINT16) 0x60 7738889Sjdp#define AML_LOCAL1 (UINT16) 0x61 7889857Sobrien#define AML_LOCAL2 (UINT16) 0x62 7989857Sobrien#define AML_LOCAL3 (UINT16) 0x63 8060484Sobrien#define AML_LOCAL4 (UINT16) 0x64 8138889Sjdp#define AML_LOCAL5 (UINT16) 0x65 8238889Sjdp#define AML_LOCAL6 (UINT16) 0x66 8389857Sobrien#define AML_LOCAL7 (UINT16) 0x67 8438889Sjdp#define AML_ARG_OP (UINT16) 0x68 8538889Sjdp#define AML_ARG0 (UINT16) 0x68 8638889Sjdp#define AML_ARG1 (UINT16) 0x69 8777298Sobrien#define AML_ARG2 (UINT16) 0x6a 8860484Sobrien#define AML_ARG3 (UINT16) 0x6b 8938889Sjdp#define AML_ARG4 (UINT16) 0x6c 9038889Sjdp#define AML_ARG5 (UINT16) 0x6d 9138889Sjdp#define AML_ARG6 (UINT16) 0x6e 9238889Sjdp#define AML_STORE_OP (UINT16) 0x70 9389857Sobrien#define AML_REF_OF_OP (UINT16) 0x71 9438889Sjdp#define AML_ADD_OP (UINT16) 0x72 9538889Sjdp#define AML_CONCAT_OP (UINT16) 0x73 9638889Sjdp#define AML_SUBTRACT_OP (UINT16) 0x74 9738889Sjdp#define AML_INCREMENT_OP (UINT16) 0x75 9838889Sjdp#define AML_DECREMENT_OP (UINT16) 0x76 9938889Sjdp#define AML_MULTIPLY_OP (UINT16) 0x77 10038889Sjdp#define AML_DIVIDE_OP (UINT16) 0x78 10160484Sobrien#define AML_SHIFT_LEFT_OP (UINT16) 0x79 10277298Sobrien#define AML_SHIFT_RIGHT_OP (UINT16) 0x7a 10360484Sobrien#define AML_BIT_AND_OP (UINT16) 0x7b 10460484Sobrien#define AML_BIT_NAND_OP (UINT16) 0x7c 10560484Sobrien#define AML_BIT_OR_OP (UINT16) 0x7d 10638889Sjdp#define AML_BIT_NOR_OP (UINT16) 0x7e 10738889Sjdp#define AML_BIT_XOR_OP (UINT16) 0x7f 10838889Sjdp#define AML_BIT_NOT_OP (UINT16) 0x80 10977298Sobrien#define AML_FIND_SET_LEFT_BIT_OP (UINT16) 0x81 11060484Sobrien#define AML_FIND_SET_RIGHT_BIT_OP (UINT16) 0x82 11138889Sjdp#define AML_DEREF_OF_OP (UINT16) 0x83 11238889Sjdp#define AML_CONCAT_RES_OP (UINT16) 0x84 /* ACPI 2.0 */ 11338889Sjdp#define AML_MOD_OP (UINT16) 0x85 /* ACPI 2.0 */ 11438889Sjdp#define AML_NOTIFY_OP (UINT16) 0x86 11577298Sobrien#define AML_SIZE_OF_OP (UINT16) 0x87 11677298Sobrien#define AML_INDEX_OP (UINT16) 0x88 11738889Sjdp#define AML_MATCH_OP (UINT16) 0x89 11838889Sjdp#define AML_CREATE_DWORD_FIELD_OP (UINT16) 0x8a 11938889Sjdp#define AML_CREATE_WORD_FIELD_OP (UINT16) 0x8b 12038889Sjdp#define AML_CREATE_BYTE_FIELD_OP (UINT16) 0x8c 12160484Sobrien#define AML_CREATE_BIT_FIELD_OP (UINT16) 0x8d 12260484Sobrien#define AML_TYPE_OP (UINT16) 0x8e 12389857Sobrien#define AML_CREATE_QWORD_FIELD_OP (UINT16) 0x8f /* ACPI 2.0 */ 12491041Sobrien#define AML_LAND_OP (UINT16) 0x90 12538889Sjdp#define AML_LOR_OP (UINT16) 0x91 12689857Sobrien#define AML_LNOT_OP (UINT16) 0x92 12789857Sobrien#define AML_LEQUAL_OP (UINT16) 0x93 12860484Sobrien#define AML_LGREATER_OP (UINT16) 0x94 12938889Sjdp#define AML_LLESS_OP (UINT16) 0x95 13038889Sjdp#define AML_TO_BUFFER_OP (UINT16) 0x96 /* ACPI 2.0 */ 13189857Sobrien#define AML_TO_DECSTRING_OP (UINT16) 0x97 /* ACPI 2.0 */ 13238889Sjdp#define AML_TO_HEXSTRING_OP (UINT16) 0x98 /* ACPI 2.0 */ 13338889Sjdp#define AML_TO_INTEGER_OP (UINT16) 0x99 /* ACPI 2.0 */ 13438889Sjdp#define AML_TO_STRING_OP (UINT16) 0x9c /* ACPI 2.0 */ 13577298Sobrien#define AML_COPY_OP (UINT16) 0x9d /* ACPI 2.0 */ 13660484Sobrien#define AML_MID_OP (UINT16) 0x9e /* ACPI 2.0 */ 13738889Sjdp#define AML_CONTINUE_OP (UINT16) 0x9f /* ACPI 2.0 */ 13838889Sjdp#define AML_IF_OP (UINT16) 0xa0 13938889Sjdp#define AML_ELSE_OP (UINT16) 0xa1 14038889Sjdp#define AML_WHILE_OP (UINT16) 0xa2 14189857Sobrien#define AML_NOOP_OP (UINT16) 0xa3 14238889Sjdp#define AML_RETURN_OP (UINT16) 0xa4 14338889Sjdp#define AML_BREAK_OP (UINT16) 0xa5 14438889Sjdp#define AML_BREAK_POINT_OP (UINT16) 0xcc 14538889Sjdp#define AML_ONES_OP (UINT16) 0xff 14638889Sjdp 14738889Sjdp/* prefixed opcodes */ 14838889Sjdp 14977298Sobrien#define AML_EXTENDED_OPCODE (UINT16) 0x5b00 /* prefix for 2-byte opcodes */ 15038889Sjdp 15138889Sjdp#define AML_MUTEX_OP (UINT16) 0x5b01 15238889Sjdp#define AML_EVENT_OP (UINT16) 0x5b02 15338889Sjdp#define AML_SHIFT_RIGHT_BIT_OP (UINT16) 0x5b10 15438889Sjdp#define AML_SHIFT_LEFT_BIT_OP (UINT16) 0x5b11 15560484Sobrien#define AML_COND_REF_OF_OP (UINT16) 0x5b12 15638889Sjdp#define AML_CREATE_FIELD_OP (UINT16) 0x5b13 15738889Sjdp#define AML_LOAD_TABLE_OP (UINT16) 0x5b1f /* ACPI 2.0 */ 15838889Sjdp#define AML_LOAD_OP (UINT16) 0x5b20 15938889Sjdp#define AML_STALL_OP (UINT16) 0x5b21 16038889Sjdp#define AML_SLEEP_OP (UINT16) 0x5b22 16138889Sjdp#define AML_ACQUIRE_OP (UINT16) 0x5b23 16238889Sjdp#define AML_SIGNAL_OP (UINT16) 0x5b24 16338889Sjdp#define AML_WAIT_OP (UINT16) 0x5b25 16438889Sjdp#define AML_RESET_OP (UINT16) 0x5b26 16538889Sjdp#define AML_RELEASE_OP (UINT16) 0x5b27 16638889Sjdp#define AML_FROM_BCD_OP (UINT16) 0x5b28 16738889Sjdp#define AML_TO_BCD_OP (UINT16) 0x5b29 16838889Sjdp#define AML_UNLOAD_OP (UINT16) 0x5b2a 16938889Sjdp#define AML_REVISION_OP (UINT16) 0x5b30 17038889Sjdp#define AML_DEBUG_OP (UINT16) 0x5b31 17138889Sjdp#define AML_FATAL_OP (UINT16) 0x5b32 17238889Sjdp#define AML_TIMER_OP (UINT16) 0x5b33 /* ACPI 3.0 */ 17391041Sobrien#define AML_REGION_OP (UINT16) 0x5b80 17438889Sjdp#define AML_FIELD_OP (UINT16) 0x5b81 17538889Sjdp#define AML_DEVICE_OP (UINT16) 0x5b82 17638889Sjdp#define AML_PROCESSOR_OP (UINT16) 0x5b83 17738889Sjdp#define AML_POWER_RES_OP (UINT16) 0x5b84 17838889Sjdp#define AML_THERMAL_ZONE_OP (UINT16) 0x5b85 17938889Sjdp#define AML_INDEX_FIELD_OP (UINT16) 0x5b86 18077298Sobrien#define AML_BANK_FIELD_OP (UINT16) 0x5b87 18160484Sobrien#define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */ 18238889Sjdp 18338889Sjdp 18438889Sjdp/* 18538889Sjdp * Combination opcodes (actually two one-byte opcodes) 18638889Sjdp * Used by the disassembler and iASL compiler 18760484Sobrien */ 18838889Sjdp#define AML_LGREATEREQUAL_OP (UINT16) 0x9295 18938889Sjdp#define AML_LLESSEQUAL_OP (UINT16) 0x9294 19077298Sobrien#define AML_LNOTEQUAL_OP (UINT16) 0x9293 19138889Sjdp 19238889Sjdp 19360484Sobrien/* 19460484Sobrien * Internal opcodes 19560484Sobrien * Use only "Unknown" AML opcodes, don't attempt to use 19677298Sobrien * any valid ACPI ASCII values (A-Z, 0-9, '-') 19738889Sjdp */ 19860484Sobrien#define AML_INT_NAMEPATH_OP (UINT16) 0x002d 19960484Sobrien#define AML_INT_NAMEDFIELD_OP (UINT16) 0x0030 20038889Sjdp#define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031 20189857Sobrien#define AML_INT_ACCESSFIELD_OP (UINT16) 0x0032 20277298Sobrien#define AML_INT_BYTELIST_OP (UINT16) 0x0033 20360484Sobrien#define AML_INT_STATICSTRING_OP (UINT16) 0x0034 20438889Sjdp#define AML_INT_METHODCALL_OP (UINT16) 0x0035 20538889Sjdp#define AML_INT_RETURN_VALUE_OP (UINT16) 0x0036 20660484Sobrien#define AML_INT_EVAL_SUBTREE_OP (UINT16) 0x0037 20777298Sobrien 20838889Sjdp 20977298Sobrien#define ARG_NONE 0x0 21077298Sobrien 21138889Sjdp/* 21238889Sjdp * Argument types for the AML Parser 21338889Sjdp * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. 21438889Sjdp * There can be up to 31 unique argument types 21560484Sobrien * Zero is reserved as end-of-list indicator 21660484Sobrien */ 21789857Sobrien#define ARGP_BYTEDATA 0x01 21891041Sobrien#define ARGP_BYTELIST 0x02 21960484Sobrien#define ARGP_CHARLIST 0x03 22038889Sjdp#define ARGP_DATAOBJ 0x04 22189857Sobrien#define ARGP_DATAOBJLIST 0x05 22238889Sjdp#define ARGP_DWORDDATA 0x06 22377298Sobrien#define ARGP_FIELDLIST 0x07 22491041Sobrien#define ARGP_NAME 0x08 22589857Sobrien#define ARGP_NAMESTRING 0x09 22638889Sjdp#define ARGP_OBJLIST 0x0A 22738889Sjdp#define ARGP_PKGLENGTH 0x0B 22889857Sobrien#define ARGP_SUPERNAME 0x0C 22938889Sjdp#define ARGP_TARGET 0x0D 23038889Sjdp#define ARGP_TERMARG 0x0E 23189857Sobrien#define ARGP_TERMLIST 0x0F 23289857Sobrien#define ARGP_WORDDATA 0x10 23360484Sobrien#define ARGP_QWORDDATA 0x11 23460484Sobrien#define ARGP_SIMPLENAME 0x12 23538889Sjdp 23638889Sjdp/* 23738889Sjdp * Resolved argument types for the AML Interpreter 23838889Sjdp * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments. 23938889Sjdp * There can be up to 31 unique argument types (0 is end-of-arg-list indicator) 24038889Sjdp * 24138889Sjdp * Note1: These values are completely independent from the ACPI_TYPEs 24238889Sjdp * i.e., ARGI_INTEGER != ACPI_TYPE_INTEGER 24338889Sjdp * 24438889Sjdp * Note2: If and when 5 bits becomes insufficient, it would probably be best 24538889Sjdp * to convert to a 6-byte array of argument types, allowing 8 bits per argument. 24638889Sjdp */ 24738889Sjdp 24838889Sjdp/* Single, simple types */ 24938889Sjdp 25038889Sjdp#define ARGI_ANYTYPE 0x01 /* Don't care */ 25138889Sjdp#define ARGI_PACKAGE 0x02 25238889Sjdp#define ARGI_EVENT 0x03 25338889Sjdp#define ARGI_MUTEX 0x04 25438889Sjdp#define ARGI_DDBHANDLE 0x05 25538889Sjdp 25638889Sjdp/* Interchangeable types (via implicit conversion) */ 25738889Sjdp 25838889Sjdp#define ARGI_INTEGER 0x06 25938889Sjdp#define ARGI_STRING 0x07 26038889Sjdp#define ARGI_BUFFER 0x08 26138889Sjdp#define ARGI_BUFFER_OR_STRING 0x09 /* Used by MID op only */ 26238889Sjdp#define ARGI_COMPUTEDATA 0x0A /* Buffer, String, or Integer */ 26338889Sjdp 26489857Sobrien/* Reference objects */ 26538889Sjdp 26638889Sjdp#define ARGI_INTEGER_REF 0x0B 26738889Sjdp#define ARGI_OBJECT_REF 0x0C 26838889Sjdp#define ARGI_DEVICE_REF 0x0D 26960484Sobrien#define ARGI_REFERENCE 0x0E 27060484Sobrien#define ARGI_TARGETREF 0x0F /* Target, subject to implicit conversion */ 27138889Sjdp#define ARGI_FIXED_TARGET 0x10 /* Target, no implicit conversion */ 27238889Sjdp#define ARGI_SIMPLE_TARGET 0x11 /* Name, Local, Arg -- no implicit conversion */ 27360484Sobrien 27460484Sobrien/* Multiple/complex types */ 27560484Sobrien 27660484Sobrien#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/ 27760484Sobrien#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */ 27838889Sjdp#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */ 27938889Sjdp#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */ 28038889Sjdp#define ARGI_DATAREFOBJ 0x16 28138889Sjdp 28238889Sjdp/* Note: types above can expand to 0x1F maximum */ 28338889Sjdp 28438889Sjdp#define ARGI_INVALID_OPCODE 0xFFFFFFFF 28538889Sjdp 28638889Sjdp 28760484Sobrien/* 28860484Sobrien * hash offsets 28960484Sobrien */ 29060484Sobrien#define AML_EXTOP_HASH_OFFSET 22 29160484Sobrien#define AML_LNOT_HASH_OFFSET 19 29238889Sjdp 29338889Sjdp 29438889Sjdp/* 29538889Sjdp * opcode groups and types 29638889Sjdp */ 29777298Sobrien#define OPGRP_NAMED 0x01 29838889Sjdp#define OPGRP_FIELD 0x02 29938889Sjdp#define OPGRP_BYTELIST 0x04 30038889Sjdp 30138889Sjdp 30238889Sjdp/* 30360484Sobrien * Opcode information 30438889Sjdp */ 30538889Sjdp 30638889Sjdp/* Opcode flags */ 30738889Sjdp 30838889Sjdp#define AML_LOGICAL 0x0001 30938889Sjdp#define AML_LOGICAL_NUMERIC 0x0002 31038889Sjdp#define AML_MATH 0x0004 31138889Sjdp#define AML_CREATE 0x0008 31238889Sjdp#define AML_FIELD 0x0010 31338889Sjdp#define AML_DEFER 0x0020 31438889Sjdp#define AML_NAMED 0x0040 31538889Sjdp#define AML_NSNODE 0x0080 31638889Sjdp#define AML_NSOPCODE 0x0100 31738889Sjdp#define AML_NSOBJECT 0x0200 31838889Sjdp#define AML_HAS_RETVAL 0x0400 31938889Sjdp#define AML_HAS_TARGET 0x0800 32038889Sjdp#define AML_HAS_ARGS 0x1000 32191041Sobrien#define AML_CONSTANT 0x2000 32238889Sjdp#define AML_NO_OPERAND_RESOLVE 0x4000 32338889Sjdp 32438889Sjdp/* Convenient flag groupings */ 32538889Sjdp 32638889Sjdp#define AML_FLAGS_EXEC_0A_0T_1R AML_HAS_RETVAL 32738889Sjdp#define AML_FLAGS_EXEC_1A_0T_0R AML_HAS_ARGS /* Monadic1 */ 32877298Sobrien#define AML_FLAGS_EXEC_1A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Monadic2 */ 32960484Sobrien#define AML_FLAGS_EXEC_1A_1T_0R AML_HAS_ARGS | AML_HAS_TARGET 33038889Sjdp#define AML_FLAGS_EXEC_1A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */ 33138889Sjdp#define AML_FLAGS_EXEC_2A_0T_0R AML_HAS_ARGS /* Dyadic1 */ 33238889Sjdp#define AML_FLAGS_EXEC_2A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL /* Dyadic2 */ 33338889Sjdp#define AML_FLAGS_EXEC_2A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R */ 33438889Sjdp#define AML_FLAGS_EXEC_2A_2T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL 33560484Sobrien#define AML_FLAGS_EXEC_3A_0T_0R AML_HAS_ARGS 33638889Sjdp#define AML_FLAGS_EXEC_3A_1T_1R AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL 33738889Sjdp#define AML_FLAGS_EXEC_6A_0T_1R AML_HAS_ARGS | AML_HAS_RETVAL 33877298Sobrien 33938889Sjdp 34038889Sjdp/* 34160484Sobrien * The opcode Type is used in a dispatch table, do not change 34260484Sobrien * without updating the table. 34360484Sobrien */ 34477298Sobrien#define AML_TYPE_EXEC_0A_0T_1R 0x00 34538889Sjdp#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ 34660484Sobrien#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ 34760484Sobrien#define AML_TYPE_EXEC_1A_1T_0R 0x03 34838889Sjdp#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* Monadic2R */ 34989857Sobrien#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ 35077298Sobrien#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ 35160484Sobrien#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* Dyadic2R */ 35238889Sjdp#define AML_TYPE_EXEC_2A_2T_1R 0x08 35338889Sjdp#define AML_TYPE_EXEC_3A_0T_0R 0x09 35460484Sobrien#define AML_TYPE_EXEC_3A_1T_1R 0x0A 35538889Sjdp#define AML_TYPE_EXEC_6A_0T_1R 0x0B 35638889Sjdp/* End of types used in dispatch table */ 35777298Sobrien 35877298Sobrien#define AML_TYPE_LITERAL 0x0B 35938889Sjdp#define AML_TYPE_CONSTANT 0x0C 36038889Sjdp#define AML_TYPE_METHOD_ARGUMENT 0x0D 36138889Sjdp#define AML_TYPE_LOCAL_VARIABLE 0x0E 36260484Sobrien#define AML_TYPE_DATA_TERM 0x0F 36360484Sobrien 36489857Sobrien/* Generic for an op that returns a value */ 36591041Sobrien 36660484Sobrien#define AML_TYPE_METHOD_CALL 0x10 36738889Sjdp 36891041Sobrien/* Misc */ 36989857Sobrien 37038889Sjdp#define AML_TYPE_CREATE_FIELD 0x11 37177298Sobrien#define AML_TYPE_CREATE_OBJECT 0x12 37289857Sobrien#define AML_TYPE_CONTROL 0x13 37338889Sjdp#define AML_TYPE_NAMED_NO_OBJ 0x14 37438889Sjdp#define AML_TYPE_NAMED_FIELD 0x15 37589857Sobrien#define AML_TYPE_NAMED_SIMPLE 0x16 37638889Sjdp#define AML_TYPE_NAMED_COMPLEX 0x17 37738889Sjdp#define AML_TYPE_RETURN 0x18 37889857Sobrien 37989857Sobrien#define AML_TYPE_UNDEFINED 0x19 38060484Sobrien#define AML_TYPE_BOGUS 0x1A 38160484Sobrien 38238889Sjdp/* AML Package Length encodings */ 38338889Sjdp 38438889Sjdp#define ACPI_AML_PACKAGE_TYPE1 0x40 38538889Sjdp#define ACPI_AML_PACKAGE_TYPE2 0x4000 38638889Sjdp#define ACPI_AML_PACKAGE_TYPE3 0x400000 38738889Sjdp#define ACPI_AML_PACKAGE_TYPE4 0x40000000 38838889Sjdp 38938889Sjdp/* 39038889Sjdp * Opcode classes 39138889Sjdp */ 39238889Sjdp#define AML_CLASS_EXECUTE 0x00 39338889Sjdp#define AML_CLASS_CREATE 0x01 39438889Sjdp#define AML_CLASS_ARGUMENT 0x02 39538889Sjdp#define AML_CLASS_NAMED_OBJECT 0x03 39638889Sjdp#define AML_CLASS_CONTROL 0x04 39738889Sjdp#define AML_CLASS_ASCII 0x05 39838889Sjdp#define AML_CLASS_PREFIX 0x06 39938889Sjdp#define AML_CLASS_INTERNAL 0x07 40038889Sjdp#define AML_CLASS_RETURN_VALUE 0x08 40138889Sjdp#define AML_CLASS_METHOD_CALL 0x09 40238889Sjdp#define AML_CLASS_UNKNOWN 0x0A 40338889Sjdp 40438889Sjdp 40538889Sjdp/* Predefined Operation Region SpaceIDs */ 40638889Sjdp 40738889Sjdptypedef enum 40838889Sjdp{ 40938889Sjdp REGION_MEMORY = 0, 41038889Sjdp REGION_IO, 41189857Sobrien REGION_PCI_CONFIG, 41238889Sjdp REGION_EC, 41338889Sjdp REGION_SMBUS, 41438889Sjdp REGION_CMOS, 41538889Sjdp REGION_PCI_BAR, 41660484Sobrien REGION_IPMI, 41760484Sobrien REGION_DATA_TABLE, /* Internal use only */ 41838889Sjdp REGION_FIXED_HW = 0x7F 41938889Sjdp 42060484Sobrien} AML_REGION_TYPES; 42160484Sobrien 42260484Sobrien 42360484Sobrien/* Comparison operation codes for MatchOp operator */ 42438889Sjdp 42538889Sjdptypedef enum 42638889Sjdp{ 42738889Sjdp MATCH_MTR = 0, 42838889Sjdp MATCH_MEQ = 1, 42938889Sjdp MATCH_MLE = 2, 43038889Sjdp MATCH_MLT = 3, 43138889Sjdp MATCH_MGE = 4, 43238889Sjdp MATCH_MGT = 5 43360484Sobrien 43460484Sobrien} AML_MATCH_OPERATOR; 43560484Sobrien 43660484Sobrien#define MAX_MATCH_OPERATOR 5 43760484Sobrien 43838889Sjdp 43938889Sjdp/* 44038889Sjdp * FieldFlags 44138889Sjdp * 44238889Sjdp * This byte is extracted from the AML and includes three separate 44338889Sjdp * pieces of information about the field: 44438889Sjdp * 1) The field access type 44538889Sjdp * 2) The field update rule 44677298Sobrien * 3) The lock rule for the field 44738889Sjdp * 44877298Sobrien * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.) 44977298Sobrien * 04 : LockRule (1 == Lock) 45038889Sjdp * 05 - 06 : UpdateRule 45177298Sobrien */ 45277298Sobrien#define AML_FIELD_ACCESS_TYPE_MASK 0x0F 45338889Sjdp#define AML_FIELD_LOCK_RULE_MASK 0x10 45438889Sjdp#define AML_FIELD_UPDATE_RULE_MASK 0x60 45589857Sobrien 45691041Sobrien 45789857Sobrien/* 1) Field Access Types */ 45889857Sobrien 45938889Sjdptypedef enum 46038889Sjdp{ 46189857Sobrien AML_FIELD_ACCESS_ANY = 0x00, 46238889Sjdp AML_FIELD_ACCESS_BYTE = 0x01, 46378828Sobrien AML_FIELD_ACCESS_WORD = 0x02, 46478828Sobrien AML_FIELD_ACCESS_DWORD = 0x03, 46538889Sjdp AML_FIELD_ACCESS_QWORD = 0x04, /* ACPI 2.0 */ 46638889Sjdp AML_FIELD_ACCESS_BUFFER = 0x05 /* ACPI 2.0 */ 46738889Sjdp 46838889Sjdp} AML_ACCESS_TYPE; 46977298Sobrien 47038889Sjdp 47177298Sobrien/* 2) Field Lock Rules */ 47277298Sobrien 47338889Sjdptypedef enum 47477298Sobrien{ 47538889Sjdp AML_FIELD_LOCK_NEVER = 0x00, 47638889Sjdp AML_FIELD_LOCK_ALWAYS = 0x10 47789857Sobrien 47889857Sobrien} AML_LOCK_RULE; 47989857Sobrien 48091041Sobrien 48138889Sjdp/* 3) Field Update Rules */ 48238889Sjdp 48389857Sobrientypedef enum 48438889Sjdp{ 48538889Sjdp AML_FIELD_UPDATE_PRESERVE = 0x00, 48638889Sjdp AML_FIELD_UPDATE_WRITE_AS_ONES = 0x20, 48738889Sjdp AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40 48838889Sjdp 48938889Sjdp} AML_UPDATE_RULE; 49038889Sjdp 49138889Sjdp 49238889Sjdp/* 49360484Sobrien * Field Access Attributes. 49438889Sjdp * This byte is extracted from the AML via the 49538889Sjdp * AccessAs keyword 49638889Sjdp */ 49738889Sjdptypedef enum 49838889Sjdp{ 49938889Sjdp AML_FIELD_ATTRIB_SMB_QUICK = 0x02, 50038889Sjdp AML_FIELD_ATTRIB_SMB_SEND_RCV = 0x04, 50138889Sjdp AML_FIELD_ATTRIB_SMB_BYTE = 0x06, 50238889Sjdp AML_FIELD_ATTRIB_SMB_WORD = 0x08, 50360484Sobrien AML_FIELD_ATTRIB_SMB_BLOCK = 0x0A, 50438889Sjdp AML_FIELD_ATTRIB_SMB_WORD_CALL = 0x0C, 50538889Sjdp AML_FIELD_ATTRIB_SMB_BLOCK_CALL = 0x0D 50638889Sjdp 50738889Sjdp} AML_ACCESS_ATTRIBUTE; 50838889Sjdp 50938889Sjdp 51038889Sjdp/* Bit fields in the AML MethodFlags byte */ 51189857Sobrien 51238889Sjdp#define AML_METHOD_ARG_COUNT 0x07 51338889Sjdp#define AML_METHOD_SERIALIZED 0x08 51438889Sjdp#define AML_METHOD_SYNC_LEVEL 0xF0 51560484Sobrien 51638889Sjdp 51738889Sjdp#endif /* __AMLCODE_H__ */ 51878828Sobrien