Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | |
| 2 | /****************************************************************************** |
| 3 | * |
| 4 | * Module Name: exresop - AML Interpreter operand/object resolution |
| 5 | * |
| 6 | *****************************************************************************/ |
| 7 | |
| 8 | /* |
Len Brown | 75a44ce | 2008-04-23 23:00:13 -0400 | [diff] [blame] | 9 | * Copyright (C) 2000 - 2008, Intel Corp. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * All rights reserved. |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without |
| 13 | * modification, are permitted provided that the following conditions |
| 14 | * are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright |
| 16 | * notice, this list of conditions, and the following disclaimer, |
| 17 | * without modification. |
| 18 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
| 19 | * substantially similar to the "NO WARRANTY" disclaimer below |
| 20 | * ("Disclaimer") and any redistribution must be conditioned upon |
| 21 | * including a substantially similar Disclaimer requirement for further |
| 22 | * binary redistribution. |
| 23 | * 3. Neither the names of the above-listed copyright holders nor the names |
| 24 | * of any contributors may be used to endorse or promote products derived |
| 25 | * from this software without specific prior written permission. |
| 26 | * |
| 27 | * Alternatively, this software may be distributed under the terms of the |
| 28 | * GNU General Public License ("GPL") version 2 as published by the Free |
| 29 | * Software Foundation. |
| 30 | * |
| 31 | * NO WARRANTY |
| 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR |
| 35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 36 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 38 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 40 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 41 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 42 | * POSSIBILITY OF SUCH DAMAGES. |
| 43 | */ |
| 44 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | #include <acpi/acpi.h> |
| 46 | #include <acpi/amlcode.h> |
| 47 | #include <acpi/acparser.h> |
| 48 | #include <acpi/acinterp.h> |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 49 | #include <acpi/acnamesp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 51 | #define _COMPONENT ACPI_EXECUTER |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 52 | ACPI_MODULE_NAME("exresop") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 54 | /* Local prototypes */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 55 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 56 | acpi_ex_check_object_type(acpi_object_type type_needed, |
| 57 | acpi_object_type this_type, void *object); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | |
| 59 | /******************************************************************************* |
| 60 | * |
| 61 | * FUNCTION: acpi_ex_check_object_type |
| 62 | * |
| 63 | * PARAMETERS: type_needed Object type needed |
| 64 | * this_type Actual object type |
| 65 | * Object Object pointer |
| 66 | * |
| 67 | * RETURN: Status |
| 68 | * |
| 69 | * DESCRIPTION: Check required type against actual type |
| 70 | * |
| 71 | ******************************************************************************/ |
| 72 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 73 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 74 | acpi_ex_check_object_type(acpi_object_type type_needed, |
| 75 | acpi_object_type this_type, void *object) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 76 | { |
Bob Moore | 4a90c7e | 2006-01-13 16:22:00 -0500 | [diff] [blame] | 77 | ACPI_FUNCTION_ENTRY(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
| 79 | if (type_needed == ACPI_TYPE_ANY) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 80 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | /* All types OK, so we don't perform any typechecks */ |
| 82 | |
| 83 | return (AE_OK); |
| 84 | } |
| 85 | |
| 86 | if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) { |
| 87 | /* |
| 88 | * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference |
| 89 | * objects and thus allow them to be targets. (As per the ACPI |
| 90 | * specification, a store to a constant is a noop.) |
| 91 | */ |
| 92 | if ((this_type == ACPI_TYPE_INTEGER) && |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 93 | (((union acpi_operand_object *)object)->common. |
| 94 | flags & AOPOBJ_AML_CONSTANT)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | return (AE_OK); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | if (type_needed != this_type) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 100 | ACPI_ERROR((AE_INFO, |
| 101 | "Needed type [%s], found [%s] %p", |
| 102 | acpi_ut_get_type_name(type_needed), |
| 103 | acpi_ut_get_type_name(this_type), object)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 104 | |
| 105 | return (AE_AML_OPERAND_TYPE); |
| 106 | } |
| 107 | |
| 108 | return (AE_OK); |
| 109 | } |
| 110 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | /******************************************************************************* |
| 112 | * |
| 113 | * FUNCTION: acpi_ex_resolve_operands |
| 114 | * |
| 115 | * PARAMETERS: Opcode - Opcode being interpreted |
| 116 | * stack_ptr - Pointer to the operand stack to be |
| 117 | * resolved |
| 118 | * walk_state - Current state |
| 119 | * |
| 120 | * RETURN: Status |
| 121 | * |
| 122 | * DESCRIPTION: Convert multiple input operands to the types required by the |
| 123 | * target operator. |
| 124 | * |
| 125 | * Each 5-bit group in arg_types represents one required |
| 126 | * operand and indicates the required Type. The corresponding operand |
| 127 | * will be converted to the required type if possible, otherwise we |
| 128 | * abort with an exception. |
| 129 | * |
| 130 | ******************************************************************************/ |
| 131 | |
| 132 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 133 | acpi_ex_resolve_operands(u16 opcode, |
| 134 | union acpi_operand_object ** stack_ptr, |
| 135 | struct acpi_walk_state * walk_state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 137 | union acpi_operand_object *obj_desc; |
| 138 | acpi_status status = AE_OK; |
| 139 | u8 object_type; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 140 | u32 arg_types; |
| 141 | const struct acpi_opcode_info *op_info; |
| 142 | u32 this_arg_type; |
| 143 | acpi_object_type type_needed; |
| 144 | u16 target_op = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 146 | ACPI_FUNCTION_TRACE_U32(ex_resolve_operands, opcode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 148 | op_info = acpi_ps_get_opcode_info(opcode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | if (op_info->class == AML_CLASS_UNKNOWN) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 150 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | arg_types = op_info->runtime_args; |
| 154 | if (arg_types == ARGI_INVALID_OPCODE) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 155 | ACPI_ERROR((AE_INFO, "Unknown AML opcode %X", opcode)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 156 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 157 | return_ACPI_STATUS(AE_AML_INTERNAL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | } |
| 159 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 160 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 161 | "Opcode %X [%s] RequiredOperandTypes=%8.8X\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 162 | opcode, op_info->name, arg_types)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
| 164 | /* |
| 165 | * Normal exit is with (arg_types == 0) at end of argument list. |
| 166 | * Function will return an exception from within the loop upon |
| 167 | * finding an entry which is not (or cannot be converted |
| 168 | * to) the required type; if stack underflows; or upon |
| 169 | * finding a NULL stack entry (which should not happen). |
| 170 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 171 | while (GET_CURRENT_ARG_TYPE(arg_types)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 172 | if (!stack_ptr || !*stack_ptr) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 173 | ACPI_ERROR((AE_INFO, "Null stack entry at %p", |
| 174 | stack_ptr)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 176 | return_ACPI_STATUS(AE_AML_INTERNAL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | /* Extract useful items */ |
| 180 | |
| 181 | obj_desc = *stack_ptr; |
| 182 | |
| 183 | /* Decode the descriptor type */ |
| 184 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 185 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | case ACPI_DESC_TYPE_NAMED: |
| 187 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 188 | /* Namespace Node */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 189 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 190 | object_type = |
| 191 | ((struct acpi_namespace_node *)obj_desc)->type; |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 192 | |
| 193 | /* |
| 194 | * Resolve an alias object. The construction of these objects |
| 195 | * guarantees that there is only one level of alias indirection; |
| 196 | * thus, the attached object is always the aliased namespace node |
| 197 | */ |
| 198 | if (object_type == ACPI_TYPE_LOCAL_ALIAS) { |
| 199 | obj_desc = |
| 200 | acpi_ns_get_attached_object((struct |
| 201 | acpi_namespace_node |
| 202 | *)obj_desc); |
| 203 | *stack_ptr = obj_desc; |
| 204 | object_type = |
| 205 | ((struct acpi_namespace_node *)obj_desc)-> |
| 206 | type; |
| 207 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | break; |
| 209 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | case ACPI_DESC_TYPE_OPERAND: |
| 211 | |
| 212 | /* ACPI internal object */ |
| 213 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 214 | object_type = ACPI_GET_OBJECT_TYPE(obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | |
| 216 | /* Check for bad acpi_object_type */ |
| 217 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 218 | if (!acpi_ut_valid_object_type(object_type)) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 219 | ACPI_ERROR((AE_INFO, |
| 220 | "Bad operand object type [%X]", |
| 221 | object_type)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 223 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 227 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 228 | /* Decode the Reference */ |
| 229 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 230 | op_info = acpi_ps_get_opcode_info(opcode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | if (op_info->class == AML_CLASS_UNKNOWN) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 232 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | switch (obj_desc->reference.opcode) { |
| 236 | case AML_DEBUG_OP: |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 237 | target_op = AML_DEBUG_OP; |
| 238 | |
| 239 | /*lint -fallthrough */ |
| 240 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | case AML_INDEX_OP: |
| 242 | case AML_REF_OF_OP: |
| 243 | case AML_ARG_OP: |
| 244 | case AML_LOCAL_OP: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 245 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ |
| 246 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 248 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT |
| 249 | ((ACPI_DB_EXEC, |
Bob Moore | b229cf9 | 2006-04-21 17:15:00 -0400 | [diff] [blame] | 250 | "Operand is a Reference, RefOpcode [%s]\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 251 | (acpi_ps_get_opcode_info |
| 252 | (obj_desc-> |
| 253 | reference. |
| 254 | opcode))-> |
| 255 | name))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | break; |
| 257 | |
| 258 | default: |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 259 | ACPI_ERROR((AE_INFO, |
| 260 | "Operand is a Reference, Unknown Reference Opcode: %X", |
| 261 | obj_desc->reference. |
| 262 | opcode)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 264 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | } |
| 266 | } |
| 267 | break; |
| 268 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | default: |
| 270 | |
| 271 | /* Invalid descriptor */ |
| 272 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 273 | ACPI_ERROR((AE_INFO, |
| 274 | "Invalid descriptor %p [%s]", |
| 275 | obj_desc, |
| 276 | acpi_ut_get_descriptor_name(obj_desc))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 278 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 | } |
| 280 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 281 | /* Get one argument type, point to the next */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 282 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 283 | this_arg_type = GET_CURRENT_ARG_TYPE(arg_types); |
| 284 | INCREMENT_ARG_LIST(arg_types); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 285 | |
| 286 | /* |
| 287 | * Handle cases where the object does not need to be |
| 288 | * resolved to a value |
| 289 | */ |
| 290 | switch (this_arg_type) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 291 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 293 | if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
| 294 | ACPI_DESC_TYPE_OPERAND) |
| 295 | && (ACPI_GET_OBJECT_TYPE(obj_desc) == |
| 296 | ACPI_TYPE_STRING)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | /* |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 298 | * String found - the string references a named object and |
| 299 | * must be resolved to a node |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | */ |
| 301 | goto next_operand; |
| 302 | } |
| 303 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 304 | /* |
| 305 | * Else not a string - fall through to the normal Reference |
| 306 | * case below |
| 307 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | /*lint -fallthrough */ |
| 309 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 310 | case ARGI_REFERENCE: /* References: */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | case ARGI_INTEGER_REF: |
| 312 | case ARGI_OBJECT_REF: |
| 313 | case ARGI_DEVICE_REF: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 314 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ |
| 315 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ |
| 316 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 318 | /* |
| 319 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE |
| 320 | * A Namespace Node is OK as-is |
| 321 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 322 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
| 323 | ACPI_DESC_TYPE_NAMED) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 324 | goto next_operand; |
| 325 | } |
| 326 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 327 | status = |
| 328 | acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE, |
| 329 | object_type, obj_desc); |
| 330 | if (ACPI_FAILURE(status)) { |
| 331 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | goto next_operand; |
| 334 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 335 | case ARGI_DATAREFOBJ: /* Store operator only */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | |
| 337 | /* |
| 338 | * We don't want to resolve index_op reference objects during |
| 339 | * a store because this would be an implicit de_ref_of operation. |
| 340 | * Instead, we just want to store the reference object. |
| 341 | * -- All others must be resolved below. |
| 342 | */ |
| 343 | if ((opcode == AML_STORE_OP) && |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 344 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == |
| 345 | ACPI_TYPE_LOCAL_REFERENCE) |
Len Brown | fd35094 | 2007-05-09 23:34:35 -0400 | [diff] [blame] | 346 | && ((*stack_ptr)->reference.opcode == AML_INDEX_OP)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | goto next_operand; |
| 348 | } |
| 349 | break; |
| 350 | |
| 351 | default: |
| 352 | /* All cases covered above */ |
| 353 | break; |
| 354 | } |
| 355 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 356 | /* |
| 357 | * Resolve this object to a value |
| 358 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 359 | status = acpi_ex_resolve_to_value(stack_ptr, walk_state); |
| 360 | if (ACPI_FAILURE(status)) { |
| 361 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | } |
| 363 | |
| 364 | /* Get the resolved object */ |
| 365 | |
| 366 | obj_desc = *stack_ptr; |
| 367 | |
| 368 | /* |
| 369 | * Check the resulting object (value) type |
| 370 | */ |
| 371 | switch (this_arg_type) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 372 | /* |
| 373 | * For the simple cases, only one type of resolved object |
| 374 | * is allowed |
| 375 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | case ARGI_MUTEX: |
| 377 | |
| 378 | /* Need an operand of type ACPI_TYPE_MUTEX */ |
| 379 | |
| 380 | type_needed = ACPI_TYPE_MUTEX; |
| 381 | break; |
| 382 | |
| 383 | case ARGI_EVENT: |
| 384 | |
| 385 | /* Need an operand of type ACPI_TYPE_EVENT */ |
| 386 | |
| 387 | type_needed = ACPI_TYPE_EVENT; |
| 388 | break; |
| 389 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 390 | case ARGI_PACKAGE: /* Package */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 391 | |
| 392 | /* Need an operand of type ACPI_TYPE_PACKAGE */ |
| 393 | |
| 394 | type_needed = ACPI_TYPE_PACKAGE; |
| 395 | break; |
| 396 | |
| 397 | case ARGI_ANYTYPE: |
| 398 | |
| 399 | /* Any operand type will do */ |
| 400 | |
| 401 | type_needed = ACPI_TYPE_ANY; |
| 402 | break; |
| 403 | |
| 404 | case ARGI_DDBHANDLE: |
| 405 | |
| 406 | /* Need an operand of type ACPI_TYPE_DDB_HANDLE */ |
| 407 | |
| 408 | type_needed = ACPI_TYPE_LOCAL_REFERENCE; |
| 409 | break; |
| 410 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 411 | /* |
| 412 | * The more complex cases allow multiple resolved object types |
| 413 | */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 414 | case ARGI_INTEGER: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | |
| 416 | /* |
| 417 | * Need an operand of type ACPI_TYPE_INTEGER, |
| 418 | * But we can implicitly convert from a STRING or BUFFER |
| 419 | * Aka - "Implicit Source Operand Conversion" |
| 420 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 421 | status = |
| 422 | acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); |
| 423 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | if (status == AE_TYPE) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 425 | ACPI_ERROR((AE_INFO, |
| 426 | "Needed [Integer/String/Buffer], found [%s] %p", |
| 427 | acpi_ut_get_object_type_name |
| 428 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 429 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 430 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 431 | } |
| 432 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 433 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 434 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 435 | |
| 436 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 437 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 438 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 439 | goto next_operand; |
| 440 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 441 | case ARGI_BUFFER: |
| 442 | |
| 443 | /* |
| 444 | * Need an operand of type ACPI_TYPE_BUFFER, |
| 445 | * But we can implicitly convert from a STRING or INTEGER |
| 446 | * Aka - "Implicit Source Operand Conversion" |
| 447 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 448 | status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); |
| 449 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 450 | if (status == AE_TYPE) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 451 | ACPI_ERROR((AE_INFO, |
| 452 | "Needed [Integer/String/Buffer], found [%s] %p", |
| 453 | acpi_ut_get_object_type_name |
| 454 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 456 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | } |
| 458 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 459 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 460 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 461 | |
| 462 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 463 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 464 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | goto next_operand; |
| 466 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 467 | case ARGI_STRING: |
| 468 | |
| 469 | /* |
| 470 | * Need an operand of type ACPI_TYPE_STRING, |
| 471 | * But we can implicitly convert from a BUFFER or INTEGER |
| 472 | * Aka - "Implicit Source Operand Conversion" |
| 473 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 474 | status = acpi_ex_convert_to_string(obj_desc, stack_ptr, |
| 475 | ACPI_IMPLICIT_CONVERT_HEX); |
| 476 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 477 | if (status == AE_TYPE) { |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 478 | ACPI_ERROR((AE_INFO, |
| 479 | "Needed [Integer/String/Buffer], found [%s] %p", |
| 480 | acpi_ut_get_object_type_name |
| 481 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 483 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 484 | } |
| 485 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 486 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 487 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 488 | |
| 489 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 490 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 491 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | goto next_operand; |
| 493 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | case ARGI_COMPUTEDATA: |
| 495 | |
| 496 | /* Need an operand of type INTEGER, STRING or BUFFER */ |
| 497 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 498 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | case ACPI_TYPE_INTEGER: |
| 500 | case ACPI_TYPE_STRING: |
| 501 | case ACPI_TYPE_BUFFER: |
| 502 | |
| 503 | /* Valid operand */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 504 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | |
| 506 | default: |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 507 | ACPI_ERROR((AE_INFO, |
| 508 | "Needed [Integer/String/Buffer], found [%s] %p", |
| 509 | acpi_ut_get_object_type_name |
| 510 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 512 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | } |
| 514 | goto next_operand; |
| 515 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 516 | case ARGI_BUFFER_OR_STRING: |
| 517 | |
| 518 | /* Need an operand of type STRING or BUFFER */ |
| 519 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 520 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 521 | case ACPI_TYPE_STRING: |
| 522 | case ACPI_TYPE_BUFFER: |
| 523 | |
| 524 | /* Valid operand */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 525 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | |
| 527 | case ACPI_TYPE_INTEGER: |
| 528 | |
| 529 | /* Highest priority conversion is to type Buffer */ |
| 530 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 531 | status = |
| 532 | acpi_ex_convert_to_buffer(obj_desc, |
| 533 | stack_ptr); |
| 534 | if (ACPI_FAILURE(status)) { |
| 535 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 536 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 537 | |
| 538 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 539 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 540 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 541 | break; |
| 542 | |
| 543 | default: |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 544 | ACPI_ERROR((AE_INFO, |
| 545 | "Needed [Integer/String/Buffer], found [%s] %p", |
| 546 | acpi_ut_get_object_type_name |
| 547 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 549 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | } |
| 551 | goto next_operand; |
| 552 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 553 | case ARGI_DATAOBJECT: |
| 554 | /* |
| 555 | * ARGI_DATAOBJECT is only used by the size_of operator. |
| 556 | * Need a buffer, string, package, or ref_of reference. |
| 557 | * |
| 558 | * The only reference allowed here is a direct reference to |
| 559 | * a namespace node. |
| 560 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 561 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 562 | case ACPI_TYPE_PACKAGE: |
| 563 | case ACPI_TYPE_STRING: |
| 564 | case ACPI_TYPE_BUFFER: |
| 565 | case ACPI_TYPE_LOCAL_REFERENCE: |
| 566 | |
| 567 | /* Valid operand */ |
| 568 | break; |
| 569 | |
| 570 | default: |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 571 | ACPI_ERROR((AE_INFO, |
| 572 | "Needed [Buffer/String/Package/Reference], found [%s] %p", |
| 573 | acpi_ut_get_object_type_name |
| 574 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 576 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 577 | } |
| 578 | goto next_operand; |
| 579 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | case ARGI_COMPLEXOBJ: |
| 581 | |
| 582 | /* Need a buffer or package or (ACPI 2.0) String */ |
| 583 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 584 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 585 | case ACPI_TYPE_PACKAGE: |
| 586 | case ACPI_TYPE_STRING: |
| 587 | case ACPI_TYPE_BUFFER: |
| 588 | |
| 589 | /* Valid operand */ |
| 590 | break; |
| 591 | |
| 592 | default: |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 593 | ACPI_ERROR((AE_INFO, |
| 594 | "Needed [Buffer/String/Package], found [%s] %p", |
| 595 | acpi_ut_get_object_type_name |
| 596 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 598 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 599 | } |
| 600 | goto next_operand; |
| 601 | |
Alexey Starikovskiy | a6823e1 | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 602 | case ARGI_REGION_OR_BUFFER: /* Used by Load() only */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | |
Alexey Starikovskiy | a6823e1 | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 604 | /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 606 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Alexey Starikovskiy | a6823e1 | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 607 | case ACPI_TYPE_BUFFER: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 608 | case ACPI_TYPE_REGION: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 609 | |
| 610 | /* Valid operand */ |
| 611 | break; |
| 612 | |
| 613 | default: |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 614 | ACPI_ERROR((AE_INFO, |
Alexey Starikovskiy | a6823e1 | 2007-02-02 19:48:22 +0300 | [diff] [blame] | 615 | "Needed [Region/Buffer], found [%s] %p", |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 616 | acpi_ut_get_object_type_name |
| 617 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 618 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 619 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 620 | } |
| 621 | goto next_operand; |
| 622 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 623 | case ARGI_DATAREFOBJ: |
| 624 | |
| 625 | /* Used by the Store() operator only */ |
| 626 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 627 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | case ACPI_TYPE_INTEGER: |
| 629 | case ACPI_TYPE_PACKAGE: |
| 630 | case ACPI_TYPE_STRING: |
| 631 | case ACPI_TYPE_BUFFER: |
| 632 | case ACPI_TYPE_BUFFER_FIELD: |
| 633 | case ACPI_TYPE_LOCAL_REFERENCE: |
| 634 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
| 635 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
| 636 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
| 637 | case ACPI_TYPE_DDB_HANDLE: |
| 638 | |
| 639 | /* Valid operand */ |
| 640 | break; |
| 641 | |
| 642 | default: |
| 643 | |
| 644 | if (acpi_gbl_enable_interpreter_slack) { |
| 645 | /* |
| 646 | * Enable original behavior of Store(), allowing any and all |
| 647 | * objects as the source operand. The ACPI spec does not |
| 648 | * allow this, however. |
| 649 | */ |
| 650 | break; |
| 651 | } |
| 652 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 653 | if (target_op == AML_DEBUG_OP) { |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 654 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 655 | /* Allow store of any object to the Debug object */ |
| 656 | |
| 657 | break; |
| 658 | } |
| 659 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 660 | ACPI_ERROR((AE_INFO, |
| 661 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p", |
| 662 | acpi_ut_get_object_type_name |
| 663 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 665 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | } |
| 667 | goto next_operand; |
| 668 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 669 | default: |
| 670 | |
| 671 | /* Unknown type */ |
| 672 | |
Bob Moore | b8e4d89 | 2006-01-27 16:43:00 -0500 | [diff] [blame] | 673 | ACPI_ERROR((AE_INFO, |
| 674 | "Internal - Unknown ARGI (required operand) type %X", |
| 675 | this_arg_type)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 676 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 677 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 678 | } |
| 679 | |
| 680 | /* |
| 681 | * Make sure that the original object was resolved to the |
| 682 | * required object type (Simple cases only). |
| 683 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 684 | status = acpi_ex_check_object_type(type_needed, |
| 685 | ACPI_GET_OBJECT_TYPE |
| 686 | (*stack_ptr), *stack_ptr); |
| 687 | if (ACPI_FAILURE(status)) { |
| 688 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 689 | } |
| 690 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 691 | next_operand: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 692 | /* |
| 693 | * If more operands needed, decrement stack_ptr to point |
| 694 | * to next operand on stack |
| 695 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 696 | if (GET_CURRENT_ARG_TYPE(arg_types)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 697 | stack_ptr--; |
| 698 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 699 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 700 | |
Bob Moore | 71d993e | 2008-06-10 14:25:05 +0800 | [diff] [blame^] | 701 | ACPI_DUMP_OPERANDS(walk_state->operands, |
| 702 | acpi_ps_get_opcode_name(opcode), |
| 703 | walk_state->num_operands); |
| 704 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 705 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 706 | } |