Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
psopcode.c
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Module Name: psopcode - Parser/Interpreter opcode information table
4  *
5  *****************************************************************************/
6 
7 /*
8  * Copyright (C) 2000 - 2012, Intel Corp.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  * notice, this list of conditions, and the following disclaimer,
16  * without modification.
17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18  * substantially similar to the "NO WARRANTY" disclaimer below
19  * ("Disclaimer") and any redistribution must be conditioned upon
20  * including a substantially similar Disclaimer requirement for further
21  * binary redistribution.
22  * 3. Neither the names of the above-listed copyright holders nor the names
23  * of any contributors may be used to endorse or promote products derived
24  * from this software without specific prior written permission.
25  *
26  * Alternatively, this software may be distributed under the terms of the
27  * GNU General Public License ("GPL") version 2 as published by the Free
28  * Software Foundation.
29  *
30  * NO WARRANTY
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGES.
42  */
43 
44 #include <acpi/acpi.h>
45 #include "accommon.h"
46 #include "acparser.h"
47 #include "acopcode.h"
48 #include "amlcode.h"
49 
50 #define _COMPONENT ACPI_PARSER
51 ACPI_MODULE_NAME("psopcode")
52 
53 static const u8 acpi_gbl_argument_count[] =
54  { 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 6 };
55 
56 /*******************************************************************************
57  *
58  * NAME: acpi_gbl_aml_op_info
59  *
60  * DESCRIPTION: Opcode table. Each entry contains <opcode, type, name, operands>
61  * The name is a simple ascii string, the operand specifier is an
62  * ascii string with one letter per operand. The letter specifies
63  * the operand type.
64  *
65  ******************************************************************************/
66 
67 /*
68  * Summary of opcode types/flags
69  *
70 
71  Opcodes that have associated namespace objects (AML_NSOBJECT flag)
72 
73  AML_SCOPE_OP
74  AML_DEVICE_OP
75  AML_THERMAL_ZONE_OP
76  AML_METHOD_OP
77  AML_POWER_RES_OP
78  AML_PROCESSOR_OP
79  AML_FIELD_OP
80  AML_INDEX_FIELD_OP
81  AML_BANK_FIELD_OP
82  AML_NAME_OP
83  AML_ALIAS_OP
84  AML_MUTEX_OP
85  AML_EVENT_OP
86  AML_REGION_OP
87  AML_CREATE_FIELD_OP
88  AML_CREATE_BIT_FIELD_OP
89  AML_CREATE_BYTE_FIELD_OP
90  AML_CREATE_WORD_FIELD_OP
91  AML_CREATE_DWORD_FIELD_OP
92  AML_CREATE_QWORD_FIELD_OP
93  AML_INT_NAMEDFIELD_OP
94  AML_INT_METHODCALL_OP
95  AML_INT_NAMEPATH_OP
96 
97  Opcodes that are "namespace" opcodes (AML_NSOPCODE flag)
98 
99  AML_SCOPE_OP
100  AML_DEVICE_OP
101  AML_THERMAL_ZONE_OP
102  AML_METHOD_OP
103  AML_POWER_RES_OP
104  AML_PROCESSOR_OP
105  AML_FIELD_OP
106  AML_INDEX_FIELD_OP
107  AML_BANK_FIELD_OP
108  AML_NAME_OP
109  AML_ALIAS_OP
110  AML_MUTEX_OP
111  AML_EVENT_OP
112  AML_REGION_OP
113  AML_INT_NAMEDFIELD_OP
114 
115  Opcodes that have an associated namespace node (AML_NSNODE flag)
116 
117  AML_SCOPE_OP
118  AML_DEVICE_OP
119  AML_THERMAL_ZONE_OP
120  AML_METHOD_OP
121  AML_POWER_RES_OP
122  AML_PROCESSOR_OP
123  AML_NAME_OP
124  AML_ALIAS_OP
125  AML_MUTEX_OP
126  AML_EVENT_OP
127  AML_REGION_OP
128  AML_CREATE_FIELD_OP
129  AML_CREATE_BIT_FIELD_OP
130  AML_CREATE_BYTE_FIELD_OP
131  AML_CREATE_WORD_FIELD_OP
132  AML_CREATE_DWORD_FIELD_OP
133  AML_CREATE_QWORD_FIELD_OP
134  AML_INT_NAMEDFIELD_OP
135  AML_INT_METHODCALL_OP
136  AML_INT_NAMEPATH_OP
137 
138  Opcodes that define named ACPI objects (AML_NAMED flag)
139 
140  AML_SCOPE_OP
141  AML_DEVICE_OP
142  AML_THERMAL_ZONE_OP
143  AML_METHOD_OP
144  AML_POWER_RES_OP
145  AML_PROCESSOR_OP
146  AML_NAME_OP
147  AML_ALIAS_OP
148  AML_MUTEX_OP
149  AML_EVENT_OP
150  AML_REGION_OP
151  AML_INT_NAMEDFIELD_OP
152 
153  Opcodes that contain executable AML as part of the definition that
154  must be deferred until needed
155 
156  AML_METHOD_OP
157  AML_VAR_PACKAGE_OP
158  AML_CREATE_FIELD_OP
159  AML_CREATE_BIT_FIELD_OP
160  AML_CREATE_BYTE_FIELD_OP
161  AML_CREATE_WORD_FIELD_OP
162  AML_CREATE_DWORD_FIELD_OP
163  AML_CREATE_QWORD_FIELD_OP
164  AML_REGION_OP
165  AML_BUFFER_OP
166 
167  Field opcodes
168 
169  AML_CREATE_FIELD_OP
170  AML_FIELD_OP
171  AML_INDEX_FIELD_OP
172  AML_BANK_FIELD_OP
173 
174  Field "Create" opcodes
175 
176  AML_CREATE_FIELD_OP
177  AML_CREATE_BIT_FIELD_OP
178  AML_CREATE_BYTE_FIELD_OP
179  AML_CREATE_WORD_FIELD_OP
180  AML_CREATE_DWORD_FIELD_OP
181  AML_CREATE_QWORD_FIELD_OP
182 
183  ******************************************************************************/
184 
185 /*
186  * Master Opcode information table. A summary of everything we know about each
187  * opcode, all in one place.
188  */
191 /* Index Name Parser Args Interpreter Args ObjectType Class Type Flags */
192 
197 /* 02 */ ACPI_OP("Alias", ARGP_ALIAS_OP, ARGI_ALIAS_OP,
206 /* 04 */ ACPI_OP("ByteConst", ARGP_BYTE_OP, ARGI_BYTE_OP,
209 /* 05 */ ACPI_OP("WordConst", ARGP_WORD_OP, ARGI_WORD_OP,
212 /* 06 */ ACPI_OP("DwordConst", ARGP_DWORD_OP, ARGI_DWORD_OP,
215 /* 07 */ ACPI_OP("String", ARGP_STRING_OP, ARGI_STRING_OP,
218 /* 08 */ ACPI_OP("Scope", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
223 /* 09 */ ACPI_OP("Buffer", ARGP_BUFFER_OP, ARGI_BUFFER_OP,
227 /* 0A */ ACPI_OP("Package", ARGP_PACKAGE_OP, ARGI_PACKAGE_OP,
231 /* 0B */ ACPI_OP("Method", ARGP_METHOD_OP, ARGI_METHOD_OP,
236 /* 0C */ ACPI_OP("Local0", ARGP_LOCAL0, ARGI_LOCAL0,
239 /* 0D */ ACPI_OP("Local1", ARGP_LOCAL1, ARGI_LOCAL1,
242 /* 0E */ ACPI_OP("Local2", ARGP_LOCAL2, ARGI_LOCAL2,
245 /* 0F */ ACPI_OP("Local3", ARGP_LOCAL3, ARGI_LOCAL3,
248 /* 10 */ ACPI_OP("Local4", ARGP_LOCAL4, ARGI_LOCAL4,
251 /* 11 */ ACPI_OP("Local5", ARGP_LOCAL5, ARGI_LOCAL5,
254 /* 12 */ ACPI_OP("Local6", ARGP_LOCAL6, ARGI_LOCAL6,
257 /* 13 */ ACPI_OP("Local7", ARGP_LOCAL7, ARGI_LOCAL7,
260 /* 14 */ ACPI_OP("Arg0", ARGP_ARG0, ARGI_ARG0,
263 /* 15 */ ACPI_OP("Arg1", ARGP_ARG1, ARGI_ARG1,
266 /* 16 */ ACPI_OP("Arg2", ARGP_ARG2, ARGI_ARG2,
269 /* 17 */ ACPI_OP("Arg3", ARGP_ARG3, ARGI_ARG3,
272 /* 18 */ ACPI_OP("Arg4", ARGP_ARG4, ARGI_ARG4,
275 /* 19 */ ACPI_OP("Arg5", ARGP_ARG5, ARGI_ARG5,
278 /* 1A */ ACPI_OP("Arg6", ARGP_ARG6, ARGI_ARG6,
287 /* 1D */ ACPI_OP("Add", ARGP_ADD_OP, ARGI_ADD_OP, ACPI_TYPE_ANY,
290 /* 1E */ ACPI_OP("Concatenate", ARGP_CONCAT_OP, ARGI_CONCAT_OP,
294 /* 1F */ ACPI_OP("Subtract", ARGP_SUBTRACT_OP, ARGI_SUBTRACT_OP,
298 /* 20 */ ACPI_OP("Increment", ARGP_INCREMENT_OP, ARGI_INCREMENT_OP,
302 /* 21 */ ACPI_OP("Decrement", ARGP_DECREMENT_OP, ARGI_DECREMENT_OP,
306 /* 22 */ ACPI_OP("Multiply", ARGP_MULTIPLY_OP, ARGI_MULTIPLY_OP,
310 /* 23 */ ACPI_OP("Divide", ARGP_DIVIDE_OP, ARGI_DIVIDE_OP,
314 /* 24 */ ACPI_OP("ShiftLeft", ARGP_SHIFT_LEFT_OP, ARGI_SHIFT_LEFT_OP,
318 /* 25 */ ACPI_OP("ShiftRight", ARGP_SHIFT_RIGHT_OP, ARGI_SHIFT_RIGHT_OP,
325 /* 27 */ ACPI_OP("NAnd", ARGP_BIT_NAND_OP, ARGI_BIT_NAND_OP,
341 /* 2C */ ACPI_OP("FindSetLeftBit", ARGP_FIND_SET_LEFT_BIT_OP,
345 /* 2D */ ACPI_OP("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,
349 /* 2E */ ACPI_OP("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP,
352 /* 2F */ ACPI_OP("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP,
355 /* 30 */ ACPI_OP("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP,
365 /* 33 */ ACPI_OP("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,
371 /* 34 */ ACPI_OP("CreateWordField", ARGP_CREATE_WORD_FIELD_OP,
377 /* 35 */ ACPI_OP("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP,
383 /* 36 */ ACPI_OP("CreateBitField", ARGP_CREATE_BIT_FIELD_OP,
389 /* 37 */ ACPI_OP("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP,
396 /* 39 */ ACPI_OP("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY,
402 /* 3B */ ACPI_OP("LEqual", ARGP_LEQUAL_OP, ARGI_LEQUAL_OP,
406 /* 3C */ ACPI_OP("LGreater", ARGP_LGREATER_OP, ARGI_LGREATER_OP,
413 /* 3E */ ACPI_OP("If", ARGP_IF_OP, ARGI_IF_OP, ACPI_TYPE_ANY,
421 /* 42 */ ACPI_OP("Return", ARGP_RETURN_OP, ARGI_RETURN_OP,
426 /* 44 */ ACPI_OP("BreakPoint", ARGP_BREAK_POINT_OP, ARGI_BREAK_POINT_OP,
430 
431 /* Prefixed opcodes (Two-byte opcodes with a prefix op) */
432 
440 /* 48 */ ACPI_OP("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP,
443 /* 49 */ ACPI_OP("CreateField", ARGP_CREATE_FIELD_OP,
457 /* 4D */ ACPI_OP("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP,
460 /* 4E */ ACPI_OP("Signal", ARGP_SIGNAL_OP, ARGI_SIGNAL_OP,
469 /* 51 */ ACPI_OP("Release", ARGP_RELEASE_OP, ARGI_RELEASE_OP,
472 /* 52 */ ACPI_OP("FromBCD", ARGP_FROM_BCD_OP, ARGI_FROM_BCD_OP,
479 /* 54 */ ACPI_OP("Unload", ARGP_UNLOAD_OP, ARGI_UNLOAD_OP,
482 /* 55 */ ACPI_OP("Revision", ARGP_REVISION_OP, ARGI_REVISION_OP,
484  AML_TYPE_CONSTANT, 0),
485 /* 56 */ ACPI_OP("Debug", ARGP_DEBUG_OP, ARGI_DEBUG_OP,
487  AML_TYPE_CONSTANT, 0),
491 /* 58 */ ACPI_OP("OperationRegion", ARGP_REGION_OP, ARGI_REGION_OP,
499 /* 5A */ ACPI_OP("Device", ARGP_DEVICE_OP, ARGI_DEVICE_OP,
504 /* 5B */ ACPI_OP("Processor", ARGP_PROCESSOR_OP, ARGI_PROCESSOR_OP,
509 /* 5C */ ACPI_OP("PowerResource", ARGP_POWER_RES_OP, ARGI_POWER_RES_OP,
514 /* 5D */ ACPI_OP("ThermalZone", ARGP_THERMAL_ZONE_OP,
519 /* 5E */ ACPI_OP("IndexField", ARGP_INDEX_FIELD_OP, ARGI_INDEX_FIELD_OP,
523 /* 5F */ ACPI_OP("BankField", ARGP_BANK_FIELD_OP, ARGI_BANK_FIELD_OP,
527  AML_DEFER),
528 
529 /* Internal opcodes that map to invalid AML opcodes */
530 
531 /* 60 */ ACPI_OP("LNotEqual", ARGP_LNOTEQUAL_OP, ARGI_LNOTEQUAL_OP,
534 /* 61 */ ACPI_OP("LLessEqual", ARGP_LLESSEQUAL_OP, ARGI_LLESSEQUAL_OP,
537 /* 62 */ ACPI_OP("LGreaterEqual", ARGP_LGREATEREQUAL_OP,
541 /* 63 */ ACPI_OP("-NamePath-", ARGP_NAMEPATH_OP, ARGI_NAMEPATH_OP,
544 /* 64 */ ACPI_OP("-MethodCall-", ARGP_METHODCALL_OP, ARGI_METHODCALL_OP,
548 /* 65 */ ACPI_OP("-ByteList-", ARGP_BYTELIST_OP, ARGI_BYTELIST_OP,
550  AML_TYPE_LITERAL, 0),
551 /* 66 */ ACPI_OP("-ReservedField-", ARGP_RESERVEDFIELD_OP,
554 /* 67 */ ACPI_OP("-NamedField-", ARGP_NAMEDFIELD_OP, ARGI_NAMEDFIELD_OP,
558 /* 68 */ ACPI_OP("-AccessField-", ARGP_ACCESSFIELD_OP,
561 /* 69 */ ACPI_OP("-StaticString", ARGP_STATICSTRING_OP,
564 /* 6A */ ACPI_OP("-Return Value-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
567 /* 6B */ ACPI_OP("-UNKNOWN_OP-", ARG_NONE, ARG_NONE, ACPI_TYPE_INVALID,
569 /* 6C */ ACPI_OP("-ASCII_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
571 /* 6D */ ACPI_OP("-PREFIX_ONLY-", ARG_NONE, ARG_NONE, ACPI_TYPE_ANY,
573 
574 /* ACPI 2.0 opcodes */
575 
576 /* 6E */ ACPI_OP("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP,
579  /* 6F */ ACPI_OP("Package", /* Var */ ARGP_VAR_PACKAGE_OP,
583 /* 70 */ ACPI_OP("ConcatenateResTemplate", ARGP_CONCAT_RES_OP,
587 /* 71 */ ACPI_OP("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY,
590 /* 72 */ ACPI_OP("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,
596 /* 73 */ ACPI_OP("ToBuffer", ARGP_TO_BUFFER_OP, ARGI_TO_BUFFER_OP,
600 /* 74 */ ACPI_OP("ToDecimalString", ARGP_TO_DEC_STR_OP,
604 /* 75 */ ACPI_OP("ToHexString", ARGP_TO_HEX_STR_OP, ARGI_TO_HEX_STR_OP,
608 /* 76 */ ACPI_OP("ToInteger", ARGP_TO_INTEGER_OP, ARGI_TO_INTEGER_OP,
612 /* 77 */ ACPI_OP("ToString", ARGP_TO_STRING_OP, ARGI_TO_STRING_OP,
616 /* 78 */ ACPI_OP("CopyObject", ARGP_COPY_OP, ARGI_COPY_OP,
619 /* 79 */ ACPI_OP("Mid", ARGP_MID_OP, ARGI_MID_OP, ACPI_TYPE_ANY,
622 /* 7A */ ACPI_OP("Continue", ARGP_CONTINUE_OP, ARGI_CONTINUE_OP,
624 /* 7B */ ACPI_OP("LoadTable", ARGP_LOAD_TABLE_OP, ARGI_LOAD_TABLE_OP,
627 /* 7C */ ACPI_OP("DataTableRegion", ARGP_DATA_REGION_OP,
632 /* 7D */ ACPI_OP("[EvalSubTree]", ARGP_SCOPE_OP, ARGI_SCOPE_OP,
636 
637 /* ACPI 3.0 opcodes */
638 
642 
643 /* ACPI 5.0 opcodes */
644 
645 /* 7F */ ACPI_OP("-ConnectField-", ARGP_CONNECTFIELD_OP,
648 /* 80 */ ACPI_OP("-ExtAccessField-", ARGP_CONNECTFIELD_OP,
651 
652 
653 };
654 
655 /*
656  * This table is directly indexed by the opcodes, and returns an
657  * index into the table above
658  */
659 static const u8 acpi_gbl_short_op_index[256] = {
660 /* 0 1 2 3 4 5 6 7 */
661 /* 8 9 A B C D E F */
662 /* 0x00 */ 0x00, 0x01, _UNK, _UNK, _UNK, _UNK, 0x02, _UNK,
663 /* 0x08 */ 0x03, _UNK, 0x04, 0x05, 0x06, 0x07, 0x6E, _UNK,
664 /* 0x10 */ 0x08, 0x09, 0x0a, 0x6F, 0x0b, _UNK, _UNK, _UNK,
665 /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
666 /* 0x20 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
667 /* 0x28 */ _UNK, _UNK, _UNK, _UNK, _UNK, 0x63, _PFX, _PFX,
668 /* 0x30 */ 0x67, 0x66, 0x68, 0x65, 0x69, 0x64, 0x6A, 0x7D,
669 /* 0x38 */ 0x7F, 0x80, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
670 /* 0x40 */ _UNK, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
671 /* 0x48 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
672 /* 0x50 */ _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC, _ASC,
673 /* 0x58 */ _ASC, _ASC, _ASC, _UNK, _PFX, _UNK, _PFX, _ASC,
674 /* 0x60 */ 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13,
675 /* 0x68 */ 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, _UNK,
676 /* 0x70 */ 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22,
677 /* 0x78 */ 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a,
678 /* 0x80 */ 0x2b, 0x2c, 0x2d, 0x2e, 0x70, 0x71, 0x2f, 0x30,
679 /* 0x88 */ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x72,
680 /* 0x90 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x73, 0x74,
681 /* 0x98 */ 0x75, 0x76, _UNK, _UNK, 0x77, 0x78, 0x79, 0x7A,
682 /* 0xA0 */ 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x60, 0x61,
683 /* 0xA8 */ 0x62, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
684 /* 0xB0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
685 /* 0xB8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
686 /* 0xC0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
687 /* 0xC8 */ _UNK, _UNK, _UNK, _UNK, 0x44, _UNK, _UNK, _UNK,
688 /* 0xD0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
689 /* 0xD8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
690 /* 0xE0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
691 /* 0xE8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
692 /* 0xF0 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
693 /* 0xF8 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x45,
694 };
695 
696 /*
697  * This table is indexed by the second opcode of the extended opcode
698  * pair. It returns an index into the opcode table (acpi_gbl_aml_op_info)
699  */
700 static const u8 acpi_gbl_long_op_index[NUM_EXTENDED_OPCODE] = {
701 /* 0 1 2 3 4 5 6 7 */
702 /* 8 9 A B C D E F */
703 /* 0x00 */ _UNK, 0x46, 0x47, _UNK, _UNK, _UNK, _UNK, _UNK,
704 /* 0x08 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
705 /* 0x10 */ _UNK, _UNK, 0x48, 0x49, _UNK, _UNK, _UNK, _UNK,
706 /* 0x18 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, 0x7B,
707 /* 0x20 */ 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51,
708 /* 0x28 */ 0x52, 0x53, 0x54, _UNK, _UNK, _UNK, _UNK, _UNK,
709 /* 0x30 */ 0x55, 0x56, 0x57, 0x7e, _UNK, _UNK, _UNK, _UNK,
710 /* 0x38 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
711 /* 0x40 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
712 /* 0x48 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
713 /* 0x50 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
714 /* 0x58 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
715 /* 0x60 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
716 /* 0x68 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
717 /* 0x70 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
718 /* 0x78 */ _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK, _UNK,
719 /* 0x80 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
720 /* 0x88 */ 0x7C,
721 };
722 
723 /*******************************************************************************
724  *
725  * FUNCTION: acpi_ps_get_opcode_info
726  *
727  * PARAMETERS: opcode - The AML opcode
728  *
729  * RETURN: A pointer to the info about the opcode.
730  *
731  * DESCRIPTION: Find AML opcode description based on the opcode.
732  * NOTE: This procedure must ALWAYS return a valid pointer!
733  *
734  ******************************************************************************/
735 
737 {
738  ACPI_FUNCTION_NAME(ps_get_opcode_info);
739 
740  /*
741  * Detect normal 8-bit opcode or extended 16-bit opcode
742  */
743  if (!(opcode & 0xFF00)) {
744 
745  /* Simple (8-bit) opcode: 0-255, can't index beyond table */
746 
747  return (&acpi_gbl_aml_op_info
748  [acpi_gbl_short_op_index[(u8) opcode]]);
749  }
750 
751  if (((opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
752  (((u8) opcode) <= MAX_EXTENDED_OPCODE)) {
753 
754  /* Valid extended (16-bit) opcode */
755 
756  return (&acpi_gbl_aml_op_info
757  [acpi_gbl_long_op_index[(u8) opcode]]);
758  }
759 
760  /* Unknown AML opcode */
761 
763  "Unknown AML opcode [%4.4X]\n", opcode));
764 
765  return (&acpi_gbl_aml_op_info[_UNK]);
766 }
767 
768 /*******************************************************************************
769  *
770  * FUNCTION: acpi_ps_get_opcode_name
771  *
772  * PARAMETERS: opcode - The AML opcode
773  *
774  * RETURN: A pointer to the name of the opcode (ASCII String)
775  * Note: Never returns NULL.
776  *
777  * DESCRIPTION: Translate an opcode into a human-readable string
778  *
779  ******************************************************************************/
780 
782 {
783 #if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUG_OUTPUT)
784 
785  const struct acpi_opcode_info *op;
786 
787  op = acpi_ps_get_opcode_info(opcode);
788 
789  /* Always guaranteed to return a valid pointer */
790 
791  return (op->name);
792 
793 #else
794  return ("OpcodeName unavailable");
795 
796 #endif
797 }
798 
799 /*******************************************************************************
800  *
801  * FUNCTION: acpi_ps_get_argument_count
802  *
803  * PARAMETERS: op_type - Type associated with the AML opcode
804  *
805  * RETURN: Argument count
806  *
807  * DESCRIPTION: Obtain the number of expected arguments for an AML opcode
808  *
809  ******************************************************************************/
810 
812 {
813 
814  if (op_type <= AML_TYPE_EXEC_6A_0T_1R) {
815  return (acpi_gbl_argument_count[op_type]);
816  }
817 
818  return (0);
819 }