amlcode.h revision 91116
1226048Sobrien/******************************************************************************
268349Sobrien *
3290152Sdelphij * Name: amlcode.h - Definitions for AML, as included in "definition blocks"
4186690Sobrien *                   Declarations and definitions contained herein are derived
5186690Sobrien *                   directly from the ACPI specification.
668349Sobrien *       $Revision: 66 $
768349Sobrien *
868349Sobrien *****************************************************************************/
968349Sobrien
1068349Sobrien/******************************************************************************
1168349Sobrien *
1268349Sobrien * 1. Copyright Notice
1368349Sobrien *
1468349Sobrien * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
1568349Sobrien * All rights reserved.
1668349Sobrien *
1768349Sobrien * 2. License
1868349Sobrien *
1968349Sobrien * 2.1. This is your license from Intel Corp. under its intellectual property
2068349Sobrien * rights.  You may have additional license terms from the party that provided
21267843Sdelphij * you this software, covering your right to use that party's intellectual
2268349Sobrien * property rights.
23267843Sdelphij *
24267843Sdelphij * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2568349Sobrien * copy of the source code appearing in this file ("Covered Code") an
26267843Sdelphij * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2768349Sobrien * base code distributed originally by Intel ("Original Intel Code") to copy,
28267843Sdelphij * make derivatives, distribute, use and display any portion of the Covered
29267843Sdelphij * Code in any form, with the right to sublicense such rights; and
3068349Sobrien *
31267843Sdelphij * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3268349Sobrien * license (with the right to sublicense), under only those claims of Intel
33267843Sdelphij * patents that are infringed by the Original Intel Code, to make, use, sell,
34267843Sdelphij * offer to sell, and import the Covered Code and derivative works thereof
3568349Sobrien * solely to the minimum extent necessary to exercise the above copyright
3668349Sobrien * license, and in no event shall the patent license extend to any additions
3768349Sobrien * to or modifications of the Original Intel Code.  No other license or right
38267843Sdelphij * is granted directly or by implication, estoppel or otherwise;
39284778Sdelphij *
40290152Sdelphij * The above copyright and patent license is granted only if the following
41284778Sdelphij * conditions are met:
42284778Sdelphij *
43284778Sdelphij * 3. Conditions
44267843Sdelphij *
45284778Sdelphij * 3.1. Redistribution of Source with Rights to Further Distribute Source.
46284778Sdelphij * Redistribution of source code of any substantial portion of the Covered
47267843Sdelphij * Code or modification with rights to further distribute source must include
48186690Sobrien * the above Copyright Notice, the above License, this list of Conditions,
49284778Sdelphij * and the following Disclaimer and Export Compliance provision.  In addition,
50267843Sdelphij * Licensee must cause all Covered Code to which Licensee contributes to
51284778Sdelphij * contain a file documenting the changes Licensee made to create that Covered
52284778Sdelphij * Code and the date of any change.  Licensee must include in that file the
53267843Sdelphij * documentation of any changes made by any predecessor Licensee.  Licensee
54186690Sobrien * must include a prominent statement that the modification is derived,
55284778Sdelphij * directly or indirectly, from Original Intel Code.
56267843Sdelphij *
57284778Sdelphij * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
58284778Sdelphij * Redistribution of source code of any substantial portion of the Covered
59267843Sdelphij * Code or modification without rights to further distribute source must
60186690Sobrien * include the following Disclaimer and Export Compliance provision in the
61284778Sdelphij * documentation and/or other materials provided with distribution.  In
62267843Sdelphij * addition, Licensee may not authorize further sublicense of source of any
63284778Sdelphij * portion of the Covered Code, and must include terms to the effect that the
64284778Sdelphij * license from Licensee to its licensee is limited to the intellectual
65267843Sdelphij * property embodied in the software Licensee provides to its licensee, and
66186690Sobrien * not to intellectual property embodied in modifications its licensee may
67284778Sdelphij * make.
68267843Sdelphij *
69284778Sdelphij * 3.3. Redistribution of Executable. Redistribution in executable form of any
70284778Sdelphij * substantial portion of the Covered Code or modification must reproduce the
71267843Sdelphij * above Copyright Notice, and the following Disclaimer and Export Compliance
72186690Sobrien * provision in the documentation and/or other materials provided with the
73284778Sdelphij * distribution.
74267843Sdelphij *
75284778Sdelphij * 3.4. Intel retains all right, title, and interest in and to the Original
76284778Sdelphij * Intel Code.
77267843Sdelphij *
78186690Sobrien * 3.5. Neither the name Intel nor any other trademark owned or controlled by
79284778Sdelphij * Intel shall be used in advertising or otherwise to promote the sale, use or
8069216Sobrien * other dealings in products derived from or relating to the Covered Code
81186690Sobrien * without prior written authorization from Intel.
8268349Sobrien *
8369216Sobrien * 4. Disclaimer and Export Compliance
8469216Sobrien *
8569216Sobrien * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8669216Sobrien * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8769216Sobrien * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8869216Sobrien * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8969216Sobrien * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
9069216Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
9169216Sobrien * PARTICULAR PURPOSE.
9269216Sobrien *
9369216Sobrien * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9468349Sobrien * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
95186690Sobrien * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9668349Sobrien * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
97186690Sobrien * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9868349Sobrien * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
99226048Sobrien * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
100226048Sobrien * LIMITED REMEDY.
101226048Sobrien *
102226048Sobrien * 4.3. Licensee shall not export, either directly or indirectly, any of this
103226048Sobrien * software or system incorporating such software without first obtaining any
104226048Sobrien * required license or other approval from the U. S. Department of Commerce or
105226048Sobrien * any other agency or department of the United States Government.  In the
106226048Sobrien * event Licensee exports any such software from the United States or
107226048Sobrien * re-exports any such software from a foreign destination, Licensee shall
108226048Sobrien * ensure that the distribution and export/re-export of the software is in
109226048Sobrien * compliance with all laws, regulations, orders, or other restrictions of the
110226048Sobrien * U.S. Export Administration Regulations. Licensee agrees that neither it nor
111226048Sobrien * any of its subsidiaries will export/re-export any technical data, process,
112226048Sobrien * software, or service, directly or indirectly, to any country for which the
113226048Sobrien * United States government or any agency thereof requires an export license,
114226048Sobrien * other governmental approval, or letter of assurance, without first obtaining
115226048Sobrien * such license, approval or letter.
116226048Sobrien *
117226048Sobrien *****************************************************************************/
11868349Sobrien
11968349Sobrien#ifndef __AMLCODE_H__
12068349Sobrien#define __AMLCODE_H__
12168349Sobrien
122186690Sobrien
123277592Sdelphij/* primary opcodes */
12468349Sobrien
125186690Sobrien#define AML_NULL_CHAR               (UINT16) 0x00
126276415Sdelphij
12768349Sobrien#define AML_ZERO_OP                 (UINT16) 0x00
128276415Sdelphij#define AML_ONE_OP                  (UINT16) 0x01
129276415Sdelphij#define AML_UNASSIGNED              (UINT16) 0x02
130276415Sdelphij#define AML_ALIAS_OP                (UINT16) 0x06
131276415Sdelphij#define AML_NAME_OP                 (UINT16) 0x08
132276415Sdelphij#define AML_BYTE_OP                 (UINT16) 0x0a
133277592Sdelphij#define AML_WORD_OP                 (UINT16) 0x0b
134277592Sdelphij#define AML_DWORD_OP                (UINT16) 0x0c
135277592Sdelphij#define AML_STRING_OP               (UINT16) 0x0d
136276415Sdelphij#define AML_QWORD_OP                (UINT16) 0x0e     /* ACPI 2.0 */
137276415Sdelphij#define AML_SCOPE_OP                (UINT16) 0x10
138276415Sdelphij#define AML_BUFFER_OP               (UINT16) 0x11
139277592Sdelphij#define AML_PACKAGE_OP              (UINT16) 0x12
140276415Sdelphij#define AML_VAR_PACKAGE_OP          (UINT16) 0x13     /* ACPI 2.0 */
141276415Sdelphij#define AML_METHOD_OP               (UINT16) 0x14
142277592Sdelphij#define AML_DUAL_NAME_PREFIX        (UINT16) 0x2e
143276415Sdelphij#define AML_MULTI_NAME_PREFIX_OP    (UINT16) 0x2f
144276415Sdelphij#define AML_NAME_CHAR_SUBSEQ        (UINT16) 0x30
145277592Sdelphij#define AML_NAME_CHAR_FIRST         (UINT16) 0x41
146276415Sdelphij#define AML_OP_PREFIX               (UINT16) 0x5b
147276415Sdelphij#define AML_ROOT_PREFIX             (UINT16) 0x5c
148276415Sdelphij#define AML_PARENT_PREFIX           (UINT16) 0x5e
149277592Sdelphij#define AML_LOCAL_OP                (UINT16) 0x60
150277592Sdelphij#define AML_LOCAL0                  (UINT16) 0x60
151277592Sdelphij#define AML_LOCAL1                  (UINT16) 0x61
152277592Sdelphij#define AML_LOCAL2                  (UINT16) 0x62
153277592Sdelphij#define AML_LOCAL3                  (UINT16) 0x63
154277592Sdelphij#define AML_LOCAL4                  (UINT16) 0x64
155277592Sdelphij#define AML_LOCAL5                  (UINT16) 0x65
156277592Sdelphij#define AML_LOCAL6                  (UINT16) 0x66
157277592Sdelphij#define AML_LOCAL7                  (UINT16) 0x67
158277592Sdelphij#define AML_ARG_OP                  (UINT16) 0x68
159277592Sdelphij#define AML_ARG0                    (UINT16) 0x68
160277592Sdelphij#define AML_ARG1                    (UINT16) 0x69
161277592Sdelphij#define AML_ARG2                    (UINT16) 0x6a
162277592Sdelphij#define AML_ARG3                    (UINT16) 0x6b
163277592Sdelphij#define AML_ARG4                    (UINT16) 0x6c
164277592Sdelphij#define AML_ARG5                    (UINT16) 0x6d
165277592Sdelphij#define AML_ARG6                    (UINT16) 0x6e
166277592Sdelphij#define AML_STORE_OP                (UINT16) 0x70
167277592Sdelphij#define AML_REF_OF_OP               (UINT16) 0x71
168277592Sdelphij#define AML_ADD_OP                  (UINT16) 0x72
169277592Sdelphij#define AML_CONCAT_OP               (UINT16) 0x73
170277592Sdelphij#define AML_SUBTRACT_OP             (UINT16) 0x74
171276415Sdelphij#define AML_INCREMENT_OP            (UINT16) 0x75
172277592Sdelphij#define AML_DECREMENT_OP            (UINT16) 0x76
173276415Sdelphij#define AML_MULTIPLY_OP             (UINT16) 0x77
174276415Sdelphij#define AML_DIVIDE_OP               (UINT16) 0x78
175284778Sdelphij#define AML_SHIFT_LEFT_OP           (UINT16) 0x79
176277592Sdelphij#define AML_SHIFT_RIGHT_OP          (UINT16) 0x7a
177277592Sdelphij#define AML_BIT_AND_OP              (UINT16) 0x7b
178277592Sdelphij#define AML_BIT_NAND_OP             (UINT16) 0x7c
179277592Sdelphij#define AML_BIT_OR_OP               (UINT16) 0x7d
180277592Sdelphij#define AML_BIT_NOR_OP              (UINT16) 0x7e
181277592Sdelphij#define AML_BIT_XOR_OP              (UINT16) 0x7f
182277592Sdelphij#define AML_BIT_NOT_OP              (UINT16) 0x80
183277592Sdelphij#define AML_FIND_SET_LEFT_BIT_OP    (UINT16) 0x81
184284778Sdelphij#define AML_FIND_SET_RIGHT_BIT_OP   (UINT16) 0x82
185277592Sdelphij#define AML_DEREF_OF_OP             (UINT16) 0x83
186276415Sdelphij#define AML_CONCAT_RES_OP           (UINT16) 0x84     /* ACPI 2.0 */
187276415Sdelphij#define AML_MOD_OP                  (UINT16) 0x85     /* ACPI 2.0 */
188276415Sdelphij#define AML_NOTIFY_OP               (UINT16) 0x86
189276415Sdelphij#define AML_SIZE_OF_OP              (UINT16) 0x87
190276415Sdelphij#define AML_INDEX_OP                (UINT16) 0x88
191276415Sdelphij#define AML_MATCH_OP                (UINT16) 0x89
192276415Sdelphij#define AML_CREATE_DWORD_FIELD_OP   (UINT16) 0x8a
193276415Sdelphij#define AML_CREATE_WORD_FIELD_OP    (UINT16) 0x8b
194276415Sdelphij#define AML_CREATE_BYTE_FIELD_OP    (UINT16) 0x8c
195276415Sdelphij#define AML_CREATE_BIT_FIELD_OP     (UINT16) 0x8d
196276415Sdelphij#define AML_TYPE_OP                 (UINT16) 0x8e
197276415Sdelphij#define AML_CREATE_QWORD_FIELD_OP   (UINT16) 0x8f     /* ACPI 2.0 */
198276415Sdelphij#define AML_LAND_OP                 (UINT16) 0x90
199277592Sdelphij#define AML_LOR_OP                  (UINT16) 0x91
200277592Sdelphij#define AML_LNOT_OP                 (UINT16) 0x92
201277592Sdelphij#define AML_LEQUAL_OP               (UINT16) 0x93
202277592Sdelphij#define AML_LGREATER_OP             (UINT16) 0x94
203277592Sdelphij#define AML_LLESS_OP                (UINT16) 0x95
204277592Sdelphij#define AML_TO_BUFFER_OP            (UINT16) 0x96     /* ACPI 2.0 */
205277592Sdelphij#define AML_TO_DECSTRING_OP         (UINT16) 0x97     /* ACPI 2.0 */
206277592Sdelphij#define AML_TO_HEXSTRING_OP         (UINT16) 0x98     /* ACPI 2.0 */
207276415Sdelphij#define AML_TO_INTEGER_OP           (UINT16) 0x99     /* ACPI 2.0 */
208276415Sdelphij#define AML_TO_STRING_OP            (UINT16) 0x9c     /* ACPI 2.0 */
209276415Sdelphij#define AML_COPY_OP                 (UINT16) 0x9d     /* ACPI 2.0 */
210277592Sdelphij#define AML_MID_OP                  (UINT16) 0x9e     /* ACPI 2.0 */
211277592Sdelphij#define AML_CONTINUE_OP             (UINT16) 0x9f     /* ACPI 2.0 */
212277592Sdelphij#define AML_IF_OP                   (UINT16) 0xa0
213277592Sdelphij#define AML_ELSE_OP                 (UINT16) 0xa1
214277592Sdelphij#define AML_WHILE_OP                (UINT16) 0xa2
215277592Sdelphij#define AML_NOOP_OP                 (UINT16) 0xa3
216277592Sdelphij#define AML_RETURN_OP               (UINT16) 0xa4
217277592Sdelphij#define AML_BREAK_OP                (UINT16) 0xa5
218277592Sdelphij#define AML_BREAK_POINT_OP          (UINT16) 0xcc
219276415Sdelphij#define AML_ONES_OP                 (UINT16) 0xff
220277592Sdelphij
221277592Sdelphij/* prefixed opcodes */
222277592Sdelphij
223277592Sdelphij#define AML_EXTOP                   (UINT16) 0x005b
224277592Sdelphij
225277592Sdelphij
226277592Sdelphij#define AML_MUTEX_OP                (UINT16) 0x5b01
227277592Sdelphij#define AML_EVENT_OP                (UINT16) 0x5b02
228277592Sdelphij#define AML_SHIFT_RIGHT_BIT_OP      (UINT16) 0x5b10
229277592Sdelphij#define AML_SHIFT_LEFT_BIT_OP       (UINT16) 0x5b11
230277592Sdelphij#define AML_COND_REF_OF_OP          (UINT16) 0x5b12
231277592Sdelphij#define AML_CREATE_FIELD_OP         (UINT16) 0x5b13
232277592Sdelphij#define AML_LOAD_TABLE_OP           (UINT16) 0x5b1f     /* ACPI 2.0 */
233277592Sdelphij#define AML_LOAD_OP                 (UINT16) 0x5b20
234277592Sdelphij#define AML_STALL_OP                (UINT16) 0x5b21
235277592Sdelphij#define AML_SLEEP_OP                (UINT16) 0x5b22
236276415Sdelphij#define AML_ACQUIRE_OP              (UINT16) 0x5b23
237276415Sdelphij#define AML_SIGNAL_OP               (UINT16) 0x5b24
238276415Sdelphij#define AML_WAIT_OP                 (UINT16) 0x5b25
239277592Sdelphij#define AML_RESET_OP                (UINT16) 0x5b26
240276415Sdelphij#define AML_RELEASE_OP              (UINT16) 0x5b27
241276415Sdelphij#define AML_FROM_BCD_OP             (UINT16) 0x5b28
242276415Sdelphij#define AML_TO_BCD_OP               (UINT16) 0x5b29
243277592Sdelphij#define AML_UNLOAD_OP               (UINT16) 0x5b2a
244277592Sdelphij#define AML_REVISION_OP             (UINT16) 0x5b30
245277592Sdelphij#define AML_DEBUG_OP                (UINT16) 0x5b31
246277592Sdelphij#define AML_FATAL_OP                (UINT16) 0x5b32
247277592Sdelphij#define AML_REGION_OP               (UINT16) 0x5b80
248277592Sdelphij#define AML_FIELD_OP                (UINT16) 0x5b81
249277592Sdelphij#define AML_DEVICE_OP               (UINT16) 0x5b82
250277592Sdelphij#define AML_PROCESSOR_OP            (UINT16) 0x5b83
251277592Sdelphij#define AML_POWER_RES_OP            (UINT16) 0x5b84
252277592Sdelphij#define AML_THERMAL_ZONE_OP         (UINT16) 0x5b85
253277592Sdelphij#define AML_INDEX_FIELD_OP          (UINT16) 0x5b86
254277592Sdelphij#define AML_BANK_FIELD_OP           (UINT16) 0x5b87
255277592Sdelphij#define AML_DATA_REGION_OP          (UINT16) 0x5b88     /* ACPI 2.0 */
256277592Sdelphij
257277592Sdelphij
258277592Sdelphij/* Bogus opcodes (they are actually two separate opcodes) */
259277592Sdelphij
260277592Sdelphij#define AML_LGREATEREQUAL_OP        (UINT16) 0x9295
261277592Sdelphij#define AML_LLESSEQUAL_OP           (UINT16) 0x9294
262277592Sdelphij#define AML_LNOTEQUAL_OP            (UINT16) 0x9293
263277592Sdelphij
264277592Sdelphij
265277592Sdelphij/*
266277592Sdelphij * Internal opcodes
267277592Sdelphij * Use only "Unknown" AML opcodes, don't attempt to use
268277592Sdelphij * any valid ACPI ASCII values (A-Z, 0-9, '-')
269277592Sdelphij */
270276415Sdelphij
271277592Sdelphij#define AML_INT_NAMEPATH_OP         (UINT16) 0x002d
272276415Sdelphij#define AML_INT_NAMEDFIELD_OP       (UINT16) 0x0030
273234250Sobrien#define AML_INT_RESERVEDFIELD_OP    (UINT16) 0x0031
274234250Sobrien#define AML_INT_ACCESSFIELD_OP      (UINT16) 0x0032
275234250Sobrien#define AML_INT_BYTELIST_OP         (UINT16) 0x0033
276234250Sobrien#define AML_INT_STATICSTRING_OP     (UINT16) 0x0034
277234250Sobrien#define AML_INT_METHODCALL_OP       (UINT16) 0x0035
27868349Sobrien#define AML_INT_RETURN_VALUE_OP     (UINT16) 0x0036
27968349Sobrien
28068349Sobrien
28168349Sobrien#define ARG_NONE                    0x0
28268349Sobrien
28368349Sobrien/*
284226048Sobrien * Argument types for the AML Parser
285186690Sobrien * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
286267843Sdelphij * There can be up to 31 unique argument types
287267843Sdelphij */
288186690Sobrien
289186690Sobrien#define ARGP_BYTEDATA               0x01
290186690Sobrien#define ARGP_BYTELIST               0x02
291186690Sobrien#define ARGP_CHARLIST               0x03
292186690Sobrien#define ARGP_DATAOBJ                0x04
293186690Sobrien#define ARGP_DATAOBJLIST            0x05
294186690Sobrien#define ARGP_DWORDDATA              0x06
295186690Sobrien#define ARGP_FIELDLIST              0x07
296186690Sobrien#define ARGP_NAME                   0x08
29768349Sobrien#define ARGP_NAMESTRING             0x09
298186690Sobrien#define ARGP_OBJLIST                0x0A
299186690Sobrien#define ARGP_PKGLENGTH              0x0B
300186690Sobrien#define ARGP_SUPERNAME              0x0C
301186690Sobrien#define ARGP_TARGET                 0x0D
302186690Sobrien#define ARGP_TERMARG                0x0E
303186690Sobrien#define ARGP_TERMLIST               0x0F
304186690Sobrien#define ARGP_WORDDATA               0x10
305186690Sobrien#define ARGP_QWORDDATA              0x11
306186690Sobrien#define ARGP_SIMPLENAME             0x12
307186690Sobrien
308186690Sobrien/*
309186690Sobrien * Resolved argument types for the AML Interpreter
310186690Sobrien * Each field in the ArgTypes UINT32 is 5 bits, allowing for a maximum of 6 arguments.
311186690Sobrien * There can be up to 31 unique argument types (0 is end-of-arg-list indicator)
312186690Sobrien *
313186690Sobrien * Note: If and when 5 bits becomes insufficient, it would probably be best
314186690Sobrien * to convert to a 6-byte array of argument types, allowing 8 bits per argument.
315186690Sobrien */
31668349Sobrien
31768349Sobrien/* "Standard" ACPI types are 1-15 (0x0F) */
318186690Sobrien
319191736Sobrien#define ARGI_INTEGER                ACPI_TYPE_INTEGER       /* 1 */
32068349Sobrien#define ARGI_STRING                 ACPI_TYPE_STRING        /* 2 */
32168349Sobrien#define ARGI_BUFFER                 ACPI_TYPE_BUFFER        /* 3 */
322267843Sdelphij#define ARGI_PACKAGE                ACPI_TYPE_PACKAGE       /* 4 */
323267843Sdelphij#define ARGI_EVENT                  ACPI_TYPE_EVENT
32468349Sobrien#define ARGI_MUTEX                  ACPI_TYPE_MUTEX
32568349Sobrien#define ARGI_REGION                 ACPI_TYPE_REGION
32668349Sobrien#define ARGI_DDBHANDLE              ACPI_TYPE_DDB_HANDLE
32768349Sobrien
32868349Sobrien/* Custom types are 0x10 through 0x1F */
32968349Sobrien
33068349Sobrien#define ARGI_IF                     0x10
33168349Sobrien#define ARGI_ANYOBJECT              0x11
33268349Sobrien#define ARGI_ANYTYPE                0x12
33368349Sobrien#define ARGI_COMPUTEDATA            0x13     /* Buffer, String, or Integer */
33468349Sobrien#define ARGI_DATAOBJECT             0x14     /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
33568349Sobrien#define ARGI_COMPLEXOBJ             0x15     /* Buffer, String, or package (Used by INDEX op only) */
33668349Sobrien#define ARGI_INTEGER_REF            0x16
33768349Sobrien#define ARGI_OBJECT_REF             0x17
33868349Sobrien#define ARGI_DEVICE_REF             0x18
33968349Sobrien#define ARGI_REFERENCE              0x19
34068349Sobrien#define ARGI_TARGETREF              0x1A     /* Target, subject to implicit conversion */
34168349Sobrien#define ARGI_FIXED_TARGET           0x1B     /* Target, no implicit conversion */
34268349Sobrien#define ARGI_SIMPLE_TARGET          0x1C     /* Name, Local, Arg -- no implicit conversion */
34368349Sobrien#define ARGI_BUFFERSTRING           0x1D
34468349Sobrien#define ARGI_REF_OR_STRING          0x1E     /* Reference or String (Used by DEREFOF op only) */
34568349Sobrien
34668349Sobrien#define ARGI_INVALID_OPCODE         0xFFFFFFFF
34768349Sobrien
34868349Sobrien
34968349Sobrien/*
35068349Sobrien * hash offsets
351186690Sobrien */
35268349Sobrien#define AML_EXTOP_HASH_OFFSET       22
35368349Sobrien#define AML_LNOT_HASH_OFFSET        19
35468349Sobrien
35568349Sobrien
35668349Sobrien/*
35768349Sobrien * opcode groups and types
35868349Sobrien */
35968349Sobrien
36068349Sobrien#define OPGRP_NAMED                 0x01
36168349Sobrien#define OPGRP_FIELD                 0x02
36268349Sobrien#define OPGRP_BYTELIST              0x04
36368349Sobrien
36468349Sobrien
36568349Sobrien/*
36668349Sobrien * Opcode information
36768349Sobrien */
36868349Sobrien
36968349Sobrien/* Opcode flags */
37068349Sobrien
37168349Sobrien#define AML_HAS_ARGS                0x0800
37268349Sobrien#define AML_HAS_TARGET              0x0400
37368349Sobrien#define AML_HAS_RETVAL              0x0200
37468349Sobrien#define AML_NSOBJECT                0x0100
37568349Sobrien#define AML_NSOPCODE                0x0080
37668349Sobrien#define AML_NSNODE                  0x0040
37768349Sobrien#define AML_NAMED                   0x0020
37868349Sobrien#define AML_DEFER                   0x0010
37968349Sobrien#define AML_FIELD                   0x0008
38068349Sobrien#define AML_CREATE                  0x0004
38168349Sobrien#define AML_MATH                    0x0002
38268349Sobrien#define AML_LOGICAL                 0x0001
383110949Sobrien
384110949Sobrien/* Convenient flag groupings */
38568349Sobrien
386267843Sdelphij#define AML_FLAGS_EXEC_1A_0T_0R     AML_HAS_ARGS                                   /* Monadic1  */
387267843Sdelphij#define AML_FLAGS_EXEC_1A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Monadic2  */
388267843Sdelphij#define AML_FLAGS_EXEC_1A_1T_0R     AML_HAS_ARGS | AML_HAS_TARGET
389267843Sdelphij#define AML_FLAGS_EXEC_1A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Monadic2R */
390267843Sdelphij#define AML_FLAGS_EXEC_2A_0T_0R     AML_HAS_ARGS                                   /* Dyadic1   */
391267843Sdelphij#define AML_FLAGS_EXEC_2A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL /* Dyadic2   */
392267843Sdelphij#define AML_FLAGS_EXEC_2A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL /* Dyadic2R  */
393267843Sdelphij#define AML_FLAGS_EXEC_2A_2T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
394267843Sdelphij#define AML_FLAGS_EXEC_3A_0T_0R     AML_HAS_ARGS
395267843Sdelphij#define AML_FLAGS_EXEC_3A_1T_1R     AML_HAS_ARGS | AML_HAS_TARGET | AML_HAS_RETVAL
396267843Sdelphij#define AML_FLAGS_EXEC_6A_0T_1R     AML_HAS_ARGS |                  AML_HAS_RETVAL
397267843Sdelphij
398267843Sdelphij
399267843Sdelphij/*
400267843Sdelphij * The opcode Type is used in a dispatch table, do not change
401267843Sdelphij * without updating the table.
402267843Sdelphij */
403267843Sdelphij#define AML_TYPE_EXEC_1A_0T_0R      0x00 /* Monadic1  */
404267843Sdelphij#define AML_TYPE_EXEC_1A_0T_1R      0x01 /* Monadic2  */
405267843Sdelphij#define AML_TYPE_EXEC_1A_1T_0R      0x02
406267843Sdelphij#define AML_TYPE_EXEC_1A_1T_1R      0x03 /* Monadic2R */
407267843Sdelphij#define AML_TYPE_EXEC_2A_0T_0R      0x04 /* Dyadic1   */
408267843Sdelphij#define AML_TYPE_EXEC_2A_0T_1R      0x05 /* Dyadic2   */
409267843Sdelphij#define AML_TYPE_EXEC_2A_1T_1R      0x06 /* Dyadic2R  */
410267843Sdelphij#define AML_TYPE_EXEC_2A_2T_1R      0x07
411267843Sdelphij#define AML_TYPE_EXEC_3A_0T_0R      0x08
412110949Sobrien#define AML_TYPE_EXEC_3A_1T_1R      0x09
413186690Sobrien#define AML_TYPE_EXEC_6A_0T_1R      0x0A
414267843Sdelphij/* End of types used in dispatch table */
415267843Sdelphij
416186690Sobrien#define AML_TYPE_LITERAL            0x0B
417186690Sobrien#define AML_TYPE_CONSTANT           0x0C
418186690Sobrien#define AML_TYPE_METHOD_ARGUMENT    0x0D
41968349Sobrien#define AML_TYPE_LOCAL_VARIABLE     0x0E
42068349Sobrien#define AML_TYPE_DATA_TERM          0x0F
421186690Sobrien
422186690Sobrien/* Generic for an op that returns a value */
42368349Sobrien
42468349Sobrien#define AML_TYPE_METHOD_CALL        0x10
425186690Sobrien
426186690Sobrien/* Misc */
42768349Sobrien
42868349Sobrien#define AML_TYPE_CREATE_FIELD       0x11
42968349Sobrien#define AML_TYPE_CONTROL            0x12
430267843Sdelphij#define AML_TYPE_NAMED_NO_OBJ       0x13
431267843Sdelphij#define AML_TYPE_NAMED_FIELD        0x14
432267843Sdelphij#define AML_TYPE_NAMED_SIMPLE       0x15
433267843Sdelphij#define AML_TYPE_NAMED_COMPLEX      0x16
434267843Sdelphij#define AML_TYPE_RETURN             0x17
435267843Sdelphij
436267843Sdelphij#define AML_TYPE_UNDEFINED          0x18
437267843Sdelphij#define AML_TYPE_BOGUS              0x19
438267843Sdelphij
439267843Sdelphij
440186690Sobrien/*
441186690Sobrien * Opcode classes
442186690Sobrien */
443186690Sobrien#define AML_CLASS_EXECUTE           0x00
444186690Sobrien#define AML_CLASS_CREATE            0x01
445133359Sobrien#define AML_CLASS_ARGUMENT          0x02
446133359Sobrien#define AML_CLASS_NAMED_OBJECT      0x03
447133359Sobrien#define AML_CLASS_CONTROL           0x04
448133359Sobrien#define AML_CLASS_ASCII             0x05
449133359Sobrien#define AML_CLASS_PREFIX            0x06
45068349Sobrien#define AML_CLASS_INTERNAL          0x07
45168349Sobrien#define AML_CLASS_RETURN_VALUE      0x08
45268349Sobrien#define AML_CLASS_METHOD_CALL       0x09
45368349Sobrien#define AML_CLASS_UNKNOWN           0x0A
454186690Sobrien
455234250Sobrien
45668349Sobrien/* Predefined Operation Region SpaceIDs */
45768349Sobrien
45868349Sobrientypedef enum
45968349Sobrien{
46068349Sobrien    REGION_MEMORY                   = 0,
46168349Sobrien    REGION_IO,
46268349Sobrien    REGION_PCI_CONFIG,
46368349Sobrien    REGION_EC,
46468349Sobrien    REGION_SMBUS,
46568349Sobrien    REGION_CMOS,
46668349Sobrien    REGION_PCI_BAR,
46768349Sobrien    REGION_DATA_TABLE,              /* Internal use only */
46868349Sobrien    REGION_FIXED_HW                 = 0x7F
46968349Sobrien
47068349Sobrien} AML_REGION_TYPES;
47168349Sobrien
47268349Sobrien
47368349Sobrien/* Comparison operation codes for MatchOp operator */
47468349Sobrien
47568349Sobrientypedef enum
47668349Sobrien{
47768349Sobrien    MATCH_MTR                       = 0,
47868349Sobrien    MATCH_MEQ                       = 1,
47968349Sobrien    MATCH_MLE                       = 2,
48068349Sobrien    MATCH_MLT                       = 3,
48168349Sobrien    MATCH_MGE                       = 4,
48268349Sobrien    MATCH_MGT                       = 5
48368349Sobrien
48468349Sobrien} AML_MATCH_OPERATOR;
48568349Sobrien
48668349Sobrien#define MAX_MATCH_OPERATOR          5
48768349Sobrien
48868349Sobrien
48968349Sobrien/*
49068349Sobrien * FieldFlags
49168349Sobrien *
49268349Sobrien * This byte is extracted from the AML and includes three separate
49368349Sobrien * pieces of information about the field:
49468349Sobrien * 1) The field access type
49568349Sobrien * 2) The field update rule
49668349Sobrien * 3) The lock rule for the field
49768349Sobrien *
49868349Sobrien * Bits 00 - 03 : AccessType (AnyAcc, ByteAcc, etc.)
49968349Sobrien *      04      : LockRule (1 == Lock)
50068349Sobrien *      05 - 06 : UpdateRule
50168349Sobrien */
50268349Sobrien#define AML_FIELD_ACCESS_TYPE_MASK  0x0F
50368349Sobrien#define AML_FIELD_LOCK_RULE_MASK    0x10
50468349Sobrien#define AML_FIELD_UPDATE_RULE_MASK  0x60
50568349Sobrien
50668349Sobrien
50768349Sobrien/* 1) Field Access Types */
50868349Sobrien
50968349Sobrientypedef enum
51068349Sobrien{
51168349Sobrien    AML_FIELD_ACCESS_ANY            = 0x00,
51268349Sobrien    AML_FIELD_ACCESS_BYTE           = 0x01,
51368349Sobrien    AML_FIELD_ACCESS_WORD           = 0x02,
51468349Sobrien    AML_FIELD_ACCESS_DWORD          = 0x03,
51568349Sobrien    AML_FIELD_ACCESS_QWORD          = 0x04,    /* ACPI 2.0 */
51668349Sobrien    AML_FIELD_ACCESS_BUFFER         = 0x05     /* ACPI 2.0 */
51768349Sobrien
51868349Sobrien} AML_ACCESS_TYPE;
51968349Sobrien
52068349Sobrien
52168349Sobrien/* 2) Field Lock Rules */
52284685Sobrien
52384685Sobrientypedef enum
52484685Sobrien{
52584685Sobrien    AML_FIELD_LOCK_NEVER            = 0x00,
52668349Sobrien    AML_FIELD_LOCK_ALWAYS           = 0x10
52768349Sobrien
52868349Sobrien} AML_LOCK_RULE;
52968349Sobrien
53068349Sobrien
53168349Sobrien/* 3) Field Update Rules */
53268349Sobrien
53368349Sobrientypedef enum
53468349Sobrien{
53568349Sobrien    AML_FIELD_UPDATE_PRESERVE       = 0x00,
53668349Sobrien    AML_FIELD_UPDATE_WRITE_AS_ONES  = 0x20,
53768349Sobrien    AML_FIELD_UPDATE_WRITE_AS_ZEROS = 0x40
53868349Sobrien
53968349Sobrien} AML_UPDATE_RULE;
54068349Sobrien
54168349Sobrien
54268349Sobrien/*
54368349Sobrien * Field Access Attributes.
54468349Sobrien * This byte is extracted from the AML via the
54568349Sobrien * AccessAs keyword
54668349Sobrien */
54768349Sobrientypedef enum
54868349Sobrien{
549186690Sobrien    AML_FIELD_ATTRIB_SMB_QUICK      = 0x02,
55074784Sobrien    AML_FIELD_ATTRIB_SMB_SEND_RCV   = 0x04,
551133359Sobrien    AML_FIELD_ATTRIB_SMB_BYTE       = 0x06,
55274784Sobrien    AML_FIELD_ATTRIB_SMB_WORD       = 0x08,
55374784Sobrien    AML_FIELD_ATTRIB_SMB_BLOCK      = 0x0A,
55474784Sobrien    AML_FIELD_ATTRIB_SMB_CALL       = 0x0E
555226048Sobrien
556226048Sobrien} AML_ACCESS_ATTRIBUTE;
557226048Sobrien
558226048Sobrien
559226048Sobrien/* bit fields in MethodFlags byte */
560226048Sobrien
561226048Sobrien#define METHOD_FLAGS_ARG_COUNT      0x07
562226048Sobrien#define METHOD_FLAGS_SERIALIZED     0x08
563226048Sobrien#define METHOD_FLAGS_SYNCH_LEVEL    0xF0
564226048Sobrien
565226048Sobrien
566226048Sobrien/* Array sizes.  Used for range checking also */
567226048Sobrien
568226048Sobrien#define NUM_ACCESS_TYPES            6
56974784Sobrien#define NUM_UPDATE_RULES            3
57074784Sobrien#define NUM_MATCH_OPS               7
57174784Sobrien#define NUM_OPCODES                 256
57274784Sobrien#define NUM_FIELD_NAMES             2
57374784Sobrien
57474784Sobrien
57574784Sobrien#endif /* __AMLCODE_H__ */
57674784Sobrien