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 | /* |
| 9 | * Copyright (C) 2000 - 2005, R. Byron Moore |
| 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> |
| 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | #define _COMPONENT ACPI_EXECUTER |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 51 | ACPI_MODULE_NAME("exresop") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 53 | /* Local prototypes */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 54 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 55 | acpi_ex_check_object_type(acpi_object_type type_needed, |
| 56 | acpi_object_type this_type, void *object); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 57 | |
| 58 | /******************************************************************************* |
| 59 | * |
| 60 | * FUNCTION: acpi_ex_check_object_type |
| 61 | * |
| 62 | * PARAMETERS: type_needed Object type needed |
| 63 | * this_type Actual object type |
| 64 | * Object Object pointer |
| 65 | * |
| 66 | * RETURN: Status |
| 67 | * |
| 68 | * DESCRIPTION: Check required type against actual type |
| 69 | * |
| 70 | ******************************************************************************/ |
| 71 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 72 | static acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 73 | acpi_ex_check_object_type(acpi_object_type type_needed, |
| 74 | acpi_object_type this_type, void *object) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 76 | ACPI_FUNCTION_NAME("ex_check_object_type"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | |
| 78 | if (type_needed == ACPI_TYPE_ANY) { |
| 79 | /* All types OK, so we don't perform any typechecks */ |
| 80 | |
| 81 | return (AE_OK); |
| 82 | } |
| 83 | |
| 84 | if (type_needed == ACPI_TYPE_LOCAL_REFERENCE) { |
| 85 | /* |
| 86 | * Allow the AML "Constant" opcodes (Zero, One, etc.) to be reference |
| 87 | * objects and thus allow them to be targets. (As per the ACPI |
| 88 | * specification, a store to a constant is a noop.) |
| 89 | */ |
| 90 | if ((this_type == ACPI_TYPE_INTEGER) && |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 91 | (((union acpi_operand_object *)object)->common. |
| 92 | flags & AOPOBJ_AML_CONSTANT)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | return (AE_OK); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | if (type_needed != this_type) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 98 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 99 | "Needed [%s], found [%s] %p\n", |
| 100 | acpi_ut_get_type_name(type_needed), |
| 101 | acpi_ut_get_type_name(this_type), object)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
| 103 | return (AE_AML_OPERAND_TYPE); |
| 104 | } |
| 105 | |
| 106 | return (AE_OK); |
| 107 | } |
| 108 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | /******************************************************************************* |
| 110 | * |
| 111 | * FUNCTION: acpi_ex_resolve_operands |
| 112 | * |
| 113 | * PARAMETERS: Opcode - Opcode being interpreted |
| 114 | * stack_ptr - Pointer to the operand stack to be |
| 115 | * resolved |
| 116 | * walk_state - Current state |
| 117 | * |
| 118 | * RETURN: Status |
| 119 | * |
| 120 | * DESCRIPTION: Convert multiple input operands to the types required by the |
| 121 | * target operator. |
| 122 | * |
| 123 | * Each 5-bit group in arg_types represents one required |
| 124 | * operand and indicates the required Type. The corresponding operand |
| 125 | * will be converted to the required type if possible, otherwise we |
| 126 | * abort with an exception. |
| 127 | * |
| 128 | ******************************************************************************/ |
| 129 | |
| 130 | acpi_status |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 131 | acpi_ex_resolve_operands(u16 opcode, |
| 132 | union acpi_operand_object ** stack_ptr, |
| 133 | struct acpi_walk_state * walk_state) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 135 | union acpi_operand_object *obj_desc; |
| 136 | acpi_status status = AE_OK; |
| 137 | u8 object_type; |
| 138 | void *temp_node; |
| 139 | u32 arg_types; |
| 140 | const struct acpi_opcode_info *op_info; |
| 141 | u32 this_arg_type; |
| 142 | acpi_object_type type_needed; |
| 143 | u16 target_op = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 145 | ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 147 | op_info = acpi_ps_get_opcode_info(opcode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | if (op_info->class == AML_CLASS_UNKNOWN) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 149 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | arg_types = op_info->runtime_args; |
| 153 | if (arg_types == ARGI_INVALID_OPCODE) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 154 | ACPI_REPORT_ERROR(("resolve_operands: %X is not a valid AML opcode\n", opcode)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 156 | return_ACPI_STATUS(AE_AML_INTERNAL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | } |
| 158 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 159 | ACPI_DEBUG_PRINT((ACPI_DB_EXEC, |
Bob Moore | 50eca3e | 2005-09-30 19:03:00 -0400 | [diff] [blame^] | 160 | "Opcode %X [%s] required_operand_types=%8.8X\n", |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 161 | opcode, op_info->name, arg_types)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | |
| 163 | /* |
| 164 | * Normal exit is with (arg_types == 0) at end of argument list. |
| 165 | * Function will return an exception from within the loop upon |
| 166 | * finding an entry which is not (or cannot be converted |
| 167 | * to) the required type; if stack underflows; or upon |
| 168 | * finding a NULL stack entry (which should not happen). |
| 169 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 170 | while (GET_CURRENT_ARG_TYPE(arg_types)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | if (!stack_ptr || !*stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 172 | ACPI_REPORT_ERROR(("resolve_operands: Null stack entry at %p\n", stack_ptr)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 173 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 174 | return_ACPI_STATUS(AE_AML_INTERNAL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | /* Extract useful items */ |
| 178 | |
| 179 | obj_desc = *stack_ptr; |
| 180 | |
| 181 | /* Decode the descriptor type */ |
| 182 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 183 | switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 184 | case ACPI_DESC_TYPE_NAMED: |
| 185 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 186 | /* Namespace Node */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 187 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 188 | object_type = |
| 189 | ((struct acpi_namespace_node *)obj_desc)->type; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | break; |
| 191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | case ACPI_DESC_TYPE_OPERAND: |
| 193 | |
| 194 | /* ACPI internal object */ |
| 195 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 196 | object_type = ACPI_GET_OBJECT_TYPE(obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | |
| 198 | /* Check for bad acpi_object_type */ |
| 199 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 200 | if (!acpi_ut_valid_object_type(object_type)) { |
| 201 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 202 | "Bad operand object type [%X]\n", |
| 203 | object_type)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 205 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) { |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 209 | /* Decode the Reference */ |
| 210 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 211 | op_info = acpi_ps_get_opcode_info(opcode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | if (op_info->class == AML_CLASS_UNKNOWN) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 213 | return_ACPI_STATUS(AE_AML_BAD_OPCODE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | switch (obj_desc->reference.opcode) { |
| 217 | case AML_DEBUG_OP: |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 218 | target_op = AML_DEBUG_OP; |
| 219 | |
| 220 | /*lint -fallthrough */ |
| 221 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | case AML_NAME_OP: |
| 223 | case AML_INDEX_OP: |
| 224 | case AML_REF_OF_OP: |
| 225 | case AML_ARG_OP: |
| 226 | case AML_LOCAL_OP: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 227 | case AML_LOAD_OP: /* ddb_handle from LOAD_OP or LOAD_TABLE_OP */ |
| 228 | case AML_INT_NAMEPATH_OP: /* Reference to a named object */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 229 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 230 | ACPI_DEBUG_ONLY_MEMBERS(ACPI_DEBUG_PRINT |
| 231 | ((ACPI_DB_EXEC, |
| 232 | "Operand is a Reference, ref_opcode [%s]\n", |
| 233 | (acpi_ps_get_opcode_info |
| 234 | (obj_desc-> |
| 235 | reference. |
| 236 | opcode))-> |
| 237 | name))); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | break; |
| 239 | |
| 240 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 241 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 242 | "Operand is a Reference, Unknown Reference Opcode %X [%s]\n", |
| 243 | obj_desc->reference. |
| 244 | opcode, |
| 245 | (acpi_ps_get_opcode_info |
| 246 | (obj_desc->reference. |
| 247 | opcode))->name)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 249 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 250 | } |
| 251 | } |
| 252 | break; |
| 253 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | default: |
| 255 | |
| 256 | /* Invalid descriptor */ |
| 257 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 258 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 259 | "Invalid descriptor %p [%s]\n", |
| 260 | obj_desc, |
| 261 | acpi_ut_get_descriptor_name |
| 262 | (obj_desc))); |
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 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 267 | /* Get one argument type, point to the next */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 269 | this_arg_type = GET_CURRENT_ARG_TYPE(arg_types); |
| 270 | INCREMENT_ARG_LIST(arg_types); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 271 | |
| 272 | /* |
| 273 | * Handle cases where the object does not need to be |
| 274 | * resolved to a value |
| 275 | */ |
| 276 | switch (this_arg_type) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 277 | case ARGI_REF_OR_STRING: /* Can be a String or Reference */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 279 | if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
| 280 | ACPI_DESC_TYPE_OPERAND) |
| 281 | && (ACPI_GET_OBJECT_TYPE(obj_desc) == |
| 282 | ACPI_TYPE_STRING)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 283 | /* |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 284 | * String found - the string references a named object and |
| 285 | * must be resolved to a node |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 286 | */ |
| 287 | goto next_operand; |
| 288 | } |
| 289 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 290 | /* |
| 291 | * Else not a string - fall through to the normal Reference |
| 292 | * case below |
| 293 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | /*lint -fallthrough */ |
| 295 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 296 | case ARGI_REFERENCE: /* References: */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | case ARGI_INTEGER_REF: |
| 298 | case ARGI_OBJECT_REF: |
| 299 | case ARGI_DEVICE_REF: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 300 | case ARGI_TARGETREF: /* Allows implicit conversion rules before store */ |
| 301 | case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */ |
| 302 | case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 304 | /* |
| 305 | * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE |
| 306 | * A Namespace Node is OK as-is |
| 307 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 308 | if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) == |
| 309 | ACPI_DESC_TYPE_NAMED) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 310 | goto next_operand; |
| 311 | } |
| 312 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 313 | status = |
| 314 | acpi_ex_check_object_type(ACPI_TYPE_LOCAL_REFERENCE, |
| 315 | object_type, obj_desc); |
| 316 | if (ACPI_FAILURE(status)) { |
| 317 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 320 | if (obj_desc->reference.opcode == AML_NAME_OP) { |
| 321 | /* Convert a named reference to the actual named object */ |
| 322 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | temp_node = obj_desc->reference.object; |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 324 | acpi_ut_remove_reference(obj_desc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | (*stack_ptr) = temp_node; |
| 326 | } |
| 327 | goto next_operand; |
| 328 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 329 | case ARGI_DATAREFOBJ: /* Store operator only */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | |
| 331 | /* |
| 332 | * We don't want to resolve index_op reference objects during |
| 333 | * a store because this would be an implicit de_ref_of operation. |
| 334 | * Instead, we just want to store the reference object. |
| 335 | * -- All others must be resolved below. |
| 336 | */ |
| 337 | if ((opcode == AML_STORE_OP) && |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 338 | (ACPI_GET_OBJECT_TYPE(*stack_ptr) == |
| 339 | ACPI_TYPE_LOCAL_REFERENCE) |
| 340 | && ((*stack_ptr)->reference.opcode == |
| 341 | AML_INDEX_OP)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 342 | goto next_operand; |
| 343 | } |
| 344 | break; |
| 345 | |
| 346 | default: |
| 347 | /* All cases covered above */ |
| 348 | break; |
| 349 | } |
| 350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 351 | /* |
| 352 | * Resolve this object to a value |
| 353 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 354 | status = acpi_ex_resolve_to_value(stack_ptr, walk_state); |
| 355 | if (ACPI_FAILURE(status)) { |
| 356 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | /* Get the resolved object */ |
| 360 | |
| 361 | obj_desc = *stack_ptr; |
| 362 | |
| 363 | /* |
| 364 | * Check the resulting object (value) type |
| 365 | */ |
| 366 | switch (this_arg_type) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 367 | /* |
| 368 | * For the simple cases, only one type of resolved object |
| 369 | * is allowed |
| 370 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 371 | case ARGI_MUTEX: |
| 372 | |
| 373 | /* Need an operand of type ACPI_TYPE_MUTEX */ |
| 374 | |
| 375 | type_needed = ACPI_TYPE_MUTEX; |
| 376 | break; |
| 377 | |
| 378 | case ARGI_EVENT: |
| 379 | |
| 380 | /* Need an operand of type ACPI_TYPE_EVENT */ |
| 381 | |
| 382 | type_needed = ACPI_TYPE_EVENT; |
| 383 | break; |
| 384 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 385 | case ARGI_PACKAGE: /* Package */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | |
| 387 | /* Need an operand of type ACPI_TYPE_PACKAGE */ |
| 388 | |
| 389 | type_needed = ACPI_TYPE_PACKAGE; |
| 390 | break; |
| 391 | |
| 392 | case ARGI_ANYTYPE: |
| 393 | |
| 394 | /* Any operand type will do */ |
| 395 | |
| 396 | type_needed = ACPI_TYPE_ANY; |
| 397 | break; |
| 398 | |
| 399 | case ARGI_DDBHANDLE: |
| 400 | |
| 401 | /* Need an operand of type ACPI_TYPE_DDB_HANDLE */ |
| 402 | |
| 403 | type_needed = ACPI_TYPE_LOCAL_REFERENCE; |
| 404 | break; |
| 405 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 406 | /* |
| 407 | * The more complex cases allow multiple resolved object types |
| 408 | */ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 409 | case ARGI_INTEGER: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | |
| 411 | /* |
| 412 | * Need an operand of type ACPI_TYPE_INTEGER, |
| 413 | * But we can implicitly convert from a STRING or BUFFER |
| 414 | * Aka - "Implicit Source Operand Conversion" |
| 415 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 416 | status = |
| 417 | acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16); |
| 418 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | if (status == AE_TYPE) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 420 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 421 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
| 422 | acpi_ut_get_object_type_name |
| 423 | (obj_desc), |
| 424 | obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 425 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 426 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 427 | } |
| 428 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 429 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 431 | |
| 432 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 433 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 434 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | goto next_operand; |
| 436 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 437 | case ARGI_BUFFER: |
| 438 | |
| 439 | /* |
| 440 | * Need an operand of type ACPI_TYPE_BUFFER, |
| 441 | * But we can implicitly convert from a STRING or INTEGER |
| 442 | * Aka - "Implicit Source Operand Conversion" |
| 443 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 444 | status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr); |
| 445 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 446 | if (status == AE_TYPE) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 447 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 448 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
| 449 | acpi_ut_get_object_type_name |
| 450 | (obj_desc), |
| 451 | obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 453 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 454 | } |
| 455 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 456 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 458 | |
| 459 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 460 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 461 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 462 | goto next_operand; |
| 463 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 464 | case ARGI_STRING: |
| 465 | |
| 466 | /* |
| 467 | * Need an operand of type ACPI_TYPE_STRING, |
| 468 | * But we can implicitly convert from a BUFFER or INTEGER |
| 469 | * Aka - "Implicit Source Operand Conversion" |
| 470 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 471 | status = acpi_ex_convert_to_string(obj_desc, stack_ptr, |
| 472 | ACPI_IMPLICIT_CONVERT_HEX); |
| 473 | if (ACPI_FAILURE(status)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 474 | if (status == AE_TYPE) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 475 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 476 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
| 477 | acpi_ut_get_object_type_name |
| 478 | (obj_desc), |
| 479 | obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 480 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 481 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 482 | } |
| 483 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 484 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 485 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 486 | |
| 487 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 488 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 489 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 490 | goto next_operand; |
| 491 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | case ARGI_COMPUTEDATA: |
| 493 | |
| 494 | /* Need an operand of type INTEGER, STRING or BUFFER */ |
| 495 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 496 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | case ACPI_TYPE_INTEGER: |
| 498 | case ACPI_TYPE_STRING: |
| 499 | case ACPI_TYPE_BUFFER: |
| 500 | |
| 501 | /* Valid operand */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 502 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 503 | |
| 504 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 505 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 506 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
| 507 | acpi_ut_get_object_type_name |
| 508 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 510 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | } |
| 512 | goto next_operand; |
| 513 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 514 | case ARGI_BUFFER_OR_STRING: |
| 515 | |
| 516 | /* Need an operand of type STRING or BUFFER */ |
| 517 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 518 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 519 | case ACPI_TYPE_STRING: |
| 520 | case ACPI_TYPE_BUFFER: |
| 521 | |
| 522 | /* Valid operand */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 523 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 524 | |
| 525 | case ACPI_TYPE_INTEGER: |
| 526 | |
| 527 | /* Highest priority conversion is to type Buffer */ |
| 528 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 529 | status = |
| 530 | acpi_ex_convert_to_buffer(obj_desc, |
| 531 | stack_ptr); |
| 532 | if (ACPI_FAILURE(status)) { |
| 533 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 534 | } |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 535 | |
| 536 | if (obj_desc != *stack_ptr) { |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 537 | acpi_ut_remove_reference(obj_desc); |
Robert Moore | f9f4601 | 2005-07-08 00:00:00 -0400 | [diff] [blame] | 538 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 539 | break; |
| 540 | |
| 541 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 542 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 543 | "Needed [Integer/String/Buffer], found [%s] %p\n", |
| 544 | acpi_ut_get_object_type_name |
| 545 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 546 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 547 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | } |
| 549 | goto next_operand; |
| 550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 551 | case ARGI_DATAOBJECT: |
| 552 | /* |
| 553 | * ARGI_DATAOBJECT is only used by the size_of operator. |
| 554 | * Need a buffer, string, package, or ref_of reference. |
| 555 | * |
| 556 | * The only reference allowed here is a direct reference to |
| 557 | * a namespace node. |
| 558 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 559 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 560 | case ACPI_TYPE_PACKAGE: |
| 561 | case ACPI_TYPE_STRING: |
| 562 | case ACPI_TYPE_BUFFER: |
| 563 | case ACPI_TYPE_LOCAL_REFERENCE: |
| 564 | |
| 565 | /* Valid operand */ |
| 566 | break; |
| 567 | |
| 568 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 569 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 570 | "Needed [Buffer/String/Package/Reference], found [%s] %p\n", |
| 571 | acpi_ut_get_object_type_name |
| 572 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 573 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 574 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 575 | } |
| 576 | goto next_operand; |
| 577 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 578 | case ARGI_COMPLEXOBJ: |
| 579 | |
| 580 | /* Need a buffer or package or (ACPI 2.0) String */ |
| 581 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 582 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 583 | case ACPI_TYPE_PACKAGE: |
| 584 | case ACPI_TYPE_STRING: |
| 585 | case ACPI_TYPE_BUFFER: |
| 586 | |
| 587 | /* Valid operand */ |
| 588 | break; |
| 589 | |
| 590 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 591 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 592 | "Needed [Buffer/String/Package], found [%s] %p\n", |
| 593 | acpi_ut_get_object_type_name |
| 594 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 595 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 596 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | } |
| 598 | goto next_operand; |
| 599 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | case ARGI_REGION_OR_FIELD: |
| 601 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 602 | /* Need an operand of type REGION or a FIELD in a region */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 603 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 604 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 605 | case ACPI_TYPE_REGION: |
| 606 | case ACPI_TYPE_LOCAL_REGION_FIELD: |
| 607 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
| 608 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
| 609 | |
| 610 | /* Valid operand */ |
| 611 | break; |
| 612 | |
| 613 | default: |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 614 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 615 | "Needed [Region/region_field], found [%s] %p\n", |
| 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) { |
| 654 | /* Allow store of any object to the Debug object */ |
| 655 | |
| 656 | break; |
| 657 | } |
| 658 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 659 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 660 | "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p\n", |
| 661 | acpi_ut_get_object_type_name |
| 662 | (obj_desc), obj_desc)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 663 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 664 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 665 | } |
| 666 | goto next_operand; |
| 667 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 668 | default: |
| 669 | |
| 670 | /* Unknown type */ |
| 671 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 672 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
| 673 | "Internal - Unknown ARGI (required operand) type %X\n", |
| 674 | this_arg_type)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 676 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 677 | } |
| 678 | |
| 679 | /* |
| 680 | * Make sure that the original object was resolved to the |
| 681 | * required object type (Simple cases only). |
| 682 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 683 | status = acpi_ex_check_object_type(type_needed, |
| 684 | ACPI_GET_OBJECT_TYPE |
| 685 | (*stack_ptr), *stack_ptr); |
| 686 | if (ACPI_FAILURE(status)) { |
| 687 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 688 | } |
| 689 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 690 | next_operand: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 691 | /* |
| 692 | * If more operands needed, decrement stack_ptr to point |
| 693 | * to next operand on stack |
| 694 | */ |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 695 | if (GET_CURRENT_ARG_TYPE(arg_types)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 696 | stack_ptr--; |
| 697 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 698 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 700 | return_ACPI_STATUS(status); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | } |