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