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