[ACPI] ACPICA 20060113
[deliverable/linux.git] / drivers / acpi / executer / exresop.c
CommitLineData
1da177e4
LT
1
2/******************************************************************************
3 *
4 * Module Name: exresop - AML Interpreter operand/object resolution
5 *
6 *****************************************************************************/
7
8/*
4a90c7e8 9 * Copyright (C) 2000 - 2006, R. Byron Moore
1da177e4
LT
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
1da177e4
LT
45#include <acpi/acpi.h>
46#include <acpi/amlcode.h>
47#include <acpi/acparser.h>
48#include <acpi/acinterp.h>
49
1da177e4 50#define _COMPONENT ACPI_EXECUTER
4be44fcd 51ACPI_MODULE_NAME("exresop")
1da177e4 52
44f6c012 53/* Local prototypes */
44f6c012 54static acpi_status
4be44fcd
LB
55acpi_ex_check_object_type(acpi_object_type type_needed,
56 acpi_object_type this_type, void *object);
1da177e4
LT
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
44f6c012 72static acpi_status
4be44fcd
LB
73acpi_ex_check_object_type(acpi_object_type type_needed,
74 acpi_object_type this_type, void *object)
1da177e4 75{
4a90c7e8 76 ACPI_FUNCTION_ENTRY();
1da177e4
LT
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) &&
4be44fcd
LB
91 (((union acpi_operand_object *)object)->common.
92 flags & AOPOBJ_AML_CONSTANT)) {
1da177e4
LT
93 return (AE_OK);
94 }
95 }
96
97 if (type_needed != this_type) {
4a90c7e8
BM
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));
1da177e4
LT
101
102 return (AE_AML_OPERAND_TYPE);
103 }
104
105 return (AE_OK);
106}
107
1da177e4
LT
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
129acpi_status
4be44fcd
LB
130acpi_ex_resolve_operands(u16 opcode,
131 union acpi_operand_object ** stack_ptr,
132 struct acpi_walk_state * walk_state)
1da177e4 133{
4be44fcd
LB
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;
143
144 ACPI_FUNCTION_TRACE_U32("ex_resolve_operands", opcode);
145
146 op_info = acpi_ps_get_opcode_info(opcode);
1da177e4 147 if (op_info->class == AML_CLASS_UNKNOWN) {
4be44fcd 148 return_ACPI_STATUS(AE_AML_BAD_OPCODE);
1da177e4
LT
149 }
150
151 arg_types = op_info->runtime_args;
152 if (arg_types == ARGI_INVALID_OPCODE) {
4a90c7e8 153 ACPI_REPORT_ERROR(("Unknown AML opcode %X\n", opcode));
1da177e4 154
4be44fcd 155 return_ACPI_STATUS(AE_AML_INTERNAL);
1da177e4
LT
156 }
157
4be44fcd 158 ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
50eca3eb 159 "Opcode %X [%s] required_operand_types=%8.8X\n",
4be44fcd 160 opcode, op_info->name, arg_types));
1da177e4
LT
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 */
4be44fcd 169 while (GET_CURRENT_ARG_TYPE(arg_types)) {
1da177e4 170 if (!stack_ptr || !*stack_ptr) {
4a90c7e8
BM
171 ACPI_REPORT_ERROR(("Null stack entry at %p\n",
172 stack_ptr));
1da177e4 173
4be44fcd 174 return_ACPI_STATUS(AE_AML_INTERNAL);
1da177e4
LT
175 }
176
177 /* Extract useful items */
178
179 obj_desc = *stack_ptr;
180
181 /* Decode the descriptor type */
182
4be44fcd 183 switch (ACPI_GET_DESCRIPTOR_TYPE(obj_desc)) {
1da177e4
LT
184 case ACPI_DESC_TYPE_NAMED:
185
44f6c012 186 /* Namespace Node */
1da177e4 187
4be44fcd
LB
188 object_type =
189 ((struct acpi_namespace_node *)obj_desc)->type;
1da177e4
LT
190 break;
191
1da177e4
LT
192 case ACPI_DESC_TYPE_OPERAND:
193
194 /* ACPI internal object */
195
4be44fcd 196 object_type = ACPI_GET_OBJECT_TYPE(obj_desc);
1da177e4
LT
197
198 /* Check for bad acpi_object_type */
199
4be44fcd 200 if (!acpi_ut_valid_object_type(object_type)) {
4a90c7e8 201 ACPI_REPORT_ERROR(("Bad operand object type [%X]\n", object_type));
1da177e4 202
4be44fcd 203 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
204 }
205
206 if (object_type == (u8) ACPI_TYPE_LOCAL_REFERENCE) {
44f6c012
RM
207 /* Decode the Reference */
208
4be44fcd 209 op_info = acpi_ps_get_opcode_info(opcode);
1da177e4 210 if (op_info->class == AML_CLASS_UNKNOWN) {
4be44fcd 211 return_ACPI_STATUS(AE_AML_BAD_OPCODE);
1da177e4
LT
212 }
213
214 switch (obj_desc->reference.opcode) {
215 case AML_DEBUG_OP:
44f6c012
RM
216 target_op = AML_DEBUG_OP;
217
218 /*lint -fallthrough */
219
1da177e4
LT
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:
4be44fcd
LB
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 */
227
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)));
1da177e4
LT
236 break;
237
238 default:
4a90c7e8 239 ACPI_REPORT_ERROR(("Operand is a Reference, Unknown Reference Opcode: %X\n", obj_desc->reference.opcode));
4be44fcd
LB
240
241 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
242 }
243 }
244 break;
245
1da177e4
LT
246 default:
247
248 /* Invalid descriptor */
249
4a90c7e8
BM
250 ACPI_REPORT_ERROR(("Invalid descriptor %p [%s]\n",
251 obj_desc,
252 acpi_ut_get_descriptor_name
253 (obj_desc)));
1da177e4 254
4be44fcd 255 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
256 }
257
44f6c012 258 /* Get one argument type, point to the next */
1da177e4 259
4be44fcd
LB
260 this_arg_type = GET_CURRENT_ARG_TYPE(arg_types);
261 INCREMENT_ARG_LIST(arg_types);
1da177e4
LT
262
263 /*
264 * Handle cases where the object does not need to be
265 * resolved to a value
266 */
267 switch (this_arg_type) {
4be44fcd 268 case ARGI_REF_OR_STRING: /* Can be a String or Reference */
1da177e4 269
4be44fcd
LB
270 if ((ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
271 ACPI_DESC_TYPE_OPERAND)
272 && (ACPI_GET_OBJECT_TYPE(obj_desc) ==
273 ACPI_TYPE_STRING)) {
1da177e4 274 /*
44f6c012
RM
275 * String found - the string references a named object and
276 * must be resolved to a node
1da177e4
LT
277 */
278 goto next_operand;
279 }
280
44f6c012
RM
281 /*
282 * Else not a string - fall through to the normal Reference
283 * case below
284 */
1da177e4
LT
285 /*lint -fallthrough */
286
4be44fcd 287 case ARGI_REFERENCE: /* References: */
1da177e4
LT
288 case ARGI_INTEGER_REF:
289 case ARGI_OBJECT_REF:
290 case ARGI_DEVICE_REF:
4be44fcd
LB
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 */
1da177e4 294
44f6c012
RM
295 /*
296 * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
297 * A Namespace Node is OK as-is
298 */
4be44fcd
LB
299 if (ACPI_GET_DESCRIPTOR_TYPE(obj_desc) ==
300 ACPI_DESC_TYPE_NAMED) {
1da177e4
LT
301 goto next_operand;
302 }
303
4be44fcd
LB
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);
1da177e4
LT
309 }
310
44f6c012
RM
311 if (obj_desc->reference.opcode == AML_NAME_OP) {
312 /* Convert a named reference to the actual named object */
313
1da177e4 314 temp_node = obj_desc->reference.object;
4be44fcd 315 acpi_ut_remove_reference(obj_desc);
1da177e4
LT
316 (*stack_ptr) = temp_node;
317 }
318 goto next_operand;
319
4be44fcd 320 case ARGI_DATAREFOBJ: /* Store operator only */
1da177e4
LT
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) &&
4be44fcd
LB
329 (ACPI_GET_OBJECT_TYPE(*stack_ptr) ==
330 ACPI_TYPE_LOCAL_REFERENCE)
331 && ((*stack_ptr)->reference.opcode ==
332 AML_INDEX_OP)) {
1da177e4
LT
333 goto next_operand;
334 }
335 break;
336
337 default:
338 /* All cases covered above */
339 break;
340 }
341
1da177e4
LT
342 /*
343 * Resolve this object to a value
344 */
4be44fcd
LB
345 status = acpi_ex_resolve_to_value(stack_ptr, walk_state);
346 if (ACPI_FAILURE(status)) {
347 return_ACPI_STATUS(status);
1da177e4
LT
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) {
4be44fcd
LB
358 /*
359 * For the simple cases, only one type of resolved object
360 * is allowed
361 */
1da177e4
LT
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
4be44fcd 376 case ARGI_PACKAGE: /* Package */
1da177e4
LT
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
4be44fcd
LB
397 /*
398 * The more complex cases allow multiple resolved object types
399 */
44f6c012 400 case ARGI_INTEGER:
1da177e4
LT
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 */
4be44fcd
LB
407 status =
408 acpi_ex_convert_to_integer(obj_desc, stack_ptr, 16);
409 if (ACPI_FAILURE(status)) {
1da177e4 410 if (status == AE_TYPE) {
4a90c7e8 411 ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 412
4be44fcd 413 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
414 }
415
4be44fcd 416 return_ACPI_STATUS(status);
1da177e4 417 }
f9f4601f
RM
418
419 if (obj_desc != *stack_ptr) {
4be44fcd 420 acpi_ut_remove_reference(obj_desc);
f9f4601f 421 }
1da177e4
LT
422 goto next_operand;
423
1da177e4
LT
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 */
4be44fcd
LB
431 status = acpi_ex_convert_to_buffer(obj_desc, stack_ptr);
432 if (ACPI_FAILURE(status)) {
1da177e4 433 if (status == AE_TYPE) {
4a90c7e8 434 ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 435
4be44fcd 436 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
437 }
438
4be44fcd 439 return_ACPI_STATUS(status);
1da177e4 440 }
f9f4601f
RM
441
442 if (obj_desc != *stack_ptr) {
4be44fcd 443 acpi_ut_remove_reference(obj_desc);
f9f4601f 444 }
1da177e4
LT
445 goto next_operand;
446
1da177e4
LT
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 */
4be44fcd
LB
454 status = acpi_ex_convert_to_string(obj_desc, stack_ptr,
455 ACPI_IMPLICIT_CONVERT_HEX);
456 if (ACPI_FAILURE(status)) {
1da177e4 457 if (status == AE_TYPE) {
4a90c7e8 458 ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 459
4be44fcd 460 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
461 }
462
4be44fcd 463 return_ACPI_STATUS(status);
1da177e4 464 }
f9f4601f
RM
465
466 if (obj_desc != *stack_ptr) {
4be44fcd 467 acpi_ut_remove_reference(obj_desc);
f9f4601f 468 }
1da177e4
LT
469 goto next_operand;
470
1da177e4
LT
471 case ARGI_COMPUTEDATA:
472
473 /* Need an operand of type INTEGER, STRING or BUFFER */
474
4be44fcd 475 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
1da177e4
LT
476 case ACPI_TYPE_INTEGER:
477 case ACPI_TYPE_STRING:
478 case ACPI_TYPE_BUFFER:
479
480 /* Valid operand */
4be44fcd 481 break;
1da177e4
LT
482
483 default:
4a90c7e8 484 ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 485
4be44fcd 486 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
487 }
488 goto next_operand;
489
1da177e4
LT
490 case ARGI_BUFFER_OR_STRING:
491
492 /* Need an operand of type STRING or BUFFER */
493
4be44fcd 494 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
1da177e4
LT
495 case ACPI_TYPE_STRING:
496 case ACPI_TYPE_BUFFER:
497
498 /* Valid operand */
4be44fcd 499 break;
1da177e4
LT
500
501 case ACPI_TYPE_INTEGER:
502
503 /* Highest priority conversion is to type Buffer */
504
4be44fcd
LB
505 status =
506 acpi_ex_convert_to_buffer(obj_desc,
507 stack_ptr);
508 if (ACPI_FAILURE(status)) {
509 return_ACPI_STATUS(status);
1da177e4 510 }
f9f4601f
RM
511
512 if (obj_desc != *stack_ptr) {
4be44fcd 513 acpi_ut_remove_reference(obj_desc);
f9f4601f 514 }
1da177e4
LT
515 break;
516
517 default:
4a90c7e8 518 ACPI_REPORT_ERROR(("Needed [Integer/String/Buffer], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 519
4be44fcd 520 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
521 }
522 goto next_operand;
523
1da177e4
LT
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 */
4be44fcd 532 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
1da177e4
LT
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:
4a90c7e8 542 ACPI_REPORT_ERROR(("Needed [Buffer/String/Package/Reference], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 543
4be44fcd 544 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
545 }
546 goto next_operand;
547
1da177e4
LT
548 case ARGI_COMPLEXOBJ:
549
550 /* Need a buffer or package or (ACPI 2.0) String */
551
4be44fcd 552 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
1da177e4
LT
553 case ACPI_TYPE_PACKAGE:
554 case ACPI_TYPE_STRING:
555 case ACPI_TYPE_BUFFER:
556
557 /* Valid operand */
558 break;
559
560 default:
4a90c7e8 561 ACPI_REPORT_ERROR(("Needed [Buffer/String/Package], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 562
4be44fcd 563 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
564 }
565 goto next_operand;
566
1da177e4
LT
567 case ARGI_REGION_OR_FIELD:
568
44f6c012 569 /* Need an operand of type REGION or a FIELD in a region */
1da177e4 570
4be44fcd 571 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
1da177e4
LT
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:
4a90c7e8 581 ACPI_REPORT_ERROR(("Needed [Region/region_field], found [%s] %p\n", acpi_ut_get_object_type_name(obj_desc), obj_desc));
1da177e4 582
4be44fcd 583 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
584 }
585 goto next_operand;
586
1da177e4
LT
587 case ARGI_DATAREFOBJ:
588
589 /* Used by the Store() operator only */
590
4be44fcd 591 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
1da177e4
LT
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
44f6c012
RM
617 if (target_op == AML_DEBUG_OP) {
618 /* Allow store of any object to the Debug object */
619
620 break;
621 }
622
4a90c7e8 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));
1da177e4 624
4be44fcd 625 return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
1da177e4
LT
626 }
627 goto next_operand;
628
1da177e4
LT
629 default:
630
631 /* Unknown type */
632
4a90c7e8 633 ACPI_REPORT_ERROR(("Internal - Unknown ARGI (required operand) type %X\n", this_arg_type));
1da177e4 634
4be44fcd 635 return_ACPI_STATUS(AE_BAD_PARAMETER);
1da177e4
LT
636 }
637
638 /*
639 * Make sure that the original object was resolved to the
640 * required object type (Simple cases only).
641 */
4be44fcd
LB
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);
1da177e4
LT
647 }
648
4be44fcd 649 next_operand:
1da177e4
LT
650 /*
651 * If more operands needed, decrement stack_ptr to point
652 * to next operand on stack
653 */
4be44fcd 654 if (GET_CURRENT_ARG_TYPE(arg_types)) {
1da177e4
LT
655 stack_ptr--;
656 }
44f6c012 657 }
1da177e4 658
4be44fcd 659 return_ACPI_STATUS(status);
1da177e4 660}
This page took 0.076091 seconds and 5 git commands to generate.