1 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2 /******************************************************************************
4 * Module Name: exoparg1 - AML execution - opcodes with 1 argument
6 * Copyright (C) 2000 - 2019, Intel Corp.
8 *****************************************************************************/
10 #include <acpi/acpi.h>
18 #define _COMPONENT ACPI_EXECUTER
19 ACPI_MODULE_NAME("exoparg1")
22 * Naming convention for AML interpreter execution routines.
24 * The routines that begin execution of AML opcodes are named with a common
25 * convention based upon the number of arguments, the number of target operands,
26 * and whether or not a value is returned:
28 * AcpiExOpcode_xA_yT_zR
32 * xA - ARGUMENTS: The number of arguments (input operands) that are
33 * required for this opcode type (0 through 6 args).
34 * yT - TARGETS: The number of targets (output operands) that are required
35 * for this opcode type (0, 1, or 2 targets).
36 * zR - RETURN VALUE: Indicates whether this opcode type returns a value
37 * as the function return (0 or 1).
39 * The AcpiExOpcode* functions are called via the Dispatcher component with
40 * fully resolved operands.
42 /*******************************************************************************
44 * FUNCTION: acpi_ex_opcode_0A_0T_1R
46 * PARAMETERS: walk_state - Current state (contains AML opcode)
50 * DESCRIPTION: Execute operator with no operands, one return value
52 ******************************************************************************/
53 acpi_status
acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state
*walk_state
)
55 acpi_status status
= AE_OK
;
56 union acpi_operand_object
*return_desc
= NULL
;
58 ACPI_FUNCTION_TRACE_STR(ex_opcode_0A_0T_1R
,
59 acpi_ps_get_opcode_name(walk_state
->opcode
));
61 /* Examine the AML opcode */
63 switch (walk_state
->opcode
) {
64 case AML_TIMER_OP
: /* Timer () */
66 /* Create a return object of type Integer */
69 acpi_ut_create_integer_object(acpi_os_get_timer());
71 status
= AE_NO_MEMORY
;
76 default: /* Unknown opcode */
78 ACPI_ERROR((AE_INFO
, "Unknown AML opcode 0x%X",
80 status
= AE_AML_BAD_OPCODE
;
86 /* Delete return object on error */
88 if ((ACPI_FAILURE(status
)) || walk_state
->result_obj
) {
89 acpi_ut_remove_reference(return_desc
);
90 walk_state
->result_obj
= NULL
;
92 /* Save the return value */
94 walk_state
->result_obj
= return_desc
;
97 return_ACPI_STATUS(status
);
100 /*******************************************************************************
102 * FUNCTION: acpi_ex_opcode_1A_0T_0R
104 * PARAMETERS: walk_state - Current state (contains AML opcode)
108 * DESCRIPTION: Execute Type 1 monadic operator with numeric operand on
111 ******************************************************************************/
113 acpi_status
acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state
*walk_state
)
115 union acpi_operand_object
**operand
= &walk_state
->operands
[0];
116 acpi_status status
= AE_OK
;
118 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_0R
,
119 acpi_ps_get_opcode_name(walk_state
->opcode
));
121 /* Examine the AML opcode */
123 switch (walk_state
->opcode
) {
124 case AML_RELEASE_OP
: /* Release (mutex_object) */
126 status
= acpi_ex_release_mutex(operand
[0], walk_state
);
129 case AML_RESET_OP
: /* Reset (event_object) */
131 status
= acpi_ex_system_reset_event(operand
[0]);
134 case AML_SIGNAL_OP
: /* Signal (event_object) */
136 status
= acpi_ex_system_signal_event(operand
[0]);
139 case AML_SLEEP_OP
: /* Sleep (msec_time) */
141 status
= acpi_ex_system_do_sleep(operand
[0]->integer
.value
);
144 case AML_STALL_OP
: /* Stall (usec_time) */
147 acpi_ex_system_do_stall((u32
) operand
[0]->integer
.value
);
150 case AML_UNLOAD_OP
: /* Unload (Handle) */
152 status
= acpi_ex_unload_table(operand
[0]);
155 default: /* Unknown opcode */
157 ACPI_ERROR((AE_INFO
, "Unknown AML opcode 0x%X",
158 walk_state
->opcode
));
159 status
= AE_AML_BAD_OPCODE
;
163 return_ACPI_STATUS(status
);
166 /*******************************************************************************
168 * FUNCTION: acpi_ex_opcode_1A_1T_0R
170 * PARAMETERS: walk_state - Current state (contains AML opcode)
174 * DESCRIPTION: Execute opcode with one argument, one target, and no
177 ******************************************************************************/
179 acpi_status
acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state
*walk_state
)
181 acpi_status status
= AE_OK
;
182 union acpi_operand_object
**operand
= &walk_state
->operands
[0];
184 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_0R
,
185 acpi_ps_get_opcode_name(walk_state
->opcode
));
187 /* Examine the AML opcode */
189 switch (walk_state
->opcode
) {
192 status
= acpi_ex_load_op(operand
[0], operand
[1], walk_state
);
195 default: /* Unknown opcode */
197 ACPI_ERROR((AE_INFO
, "Unknown AML opcode 0x%X",
198 walk_state
->opcode
));
199 status
= AE_AML_BAD_OPCODE
;
205 return_ACPI_STATUS(status
);
208 /*******************************************************************************
210 * FUNCTION: acpi_ex_opcode_1A_1T_1R
212 * PARAMETERS: walk_state - Current state (contains AML opcode)
216 * DESCRIPTION: Execute opcode with one argument, one target, and a
219 ******************************************************************************/
221 acpi_status
acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state
*walk_state
)
223 acpi_status status
= AE_OK
;
224 union acpi_operand_object
**operand
= &walk_state
->operands
[0];
225 union acpi_operand_object
*return_desc
= NULL
;
226 union acpi_operand_object
*return_desc2
= NULL
;
232 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_1T_1R
,
233 acpi_ps_get_opcode_name(walk_state
->opcode
));
235 /* Examine the AML opcode */
237 switch (walk_state
->opcode
) {
239 case AML_FIND_SET_LEFT_BIT_OP
:
240 case AML_FIND_SET_RIGHT_BIT_OP
:
241 case AML_FROM_BCD_OP
:
243 case AML_CONDITIONAL_REF_OF_OP
:
245 /* Create a return object of type Integer for these opcodes */
247 return_desc
= acpi_ut_create_internal_object(ACPI_TYPE_INTEGER
);
249 status
= AE_NO_MEMORY
;
253 switch (walk_state
->opcode
) {
254 case AML_BIT_NOT_OP
: /* Not (Operand, Result) */
256 return_desc
->integer
.value
= ~operand
[0]->integer
.value
;
259 case AML_FIND_SET_LEFT_BIT_OP
: /* find_set_left_bit (Operand, Result) */
261 return_desc
->integer
.value
= operand
[0]->integer
.value
;
264 * Acpi specification describes Integer type as a little
265 * endian unsigned value, so this boundary condition is valid.
267 for (temp32
= 0; return_desc
->integer
.value
&&
268 temp32
< ACPI_INTEGER_BIT_SIZE
; ++temp32
) {
269 return_desc
->integer
.value
>>= 1;
272 return_desc
->integer
.value
= temp32
;
275 case AML_FIND_SET_RIGHT_BIT_OP
: /* find_set_right_bit (Operand, Result) */
277 return_desc
->integer
.value
= operand
[0]->integer
.value
;
280 * The Acpi specification describes Integer type as a little
281 * endian unsigned value, so this boundary condition is valid.
283 for (temp32
= 0; return_desc
->integer
.value
&&
284 temp32
< ACPI_INTEGER_BIT_SIZE
; ++temp32
) {
285 return_desc
->integer
.value
<<= 1;
288 /* Since the bit position is one-based, subtract from 33 (65) */
290 return_desc
->integer
.value
=
292 0 ? 0 : (ACPI_INTEGER_BIT_SIZE
+ 1) - temp32
;
295 case AML_FROM_BCD_OP
: /* from_bcd (BCDValue, Result) */
297 * The 64-bit ACPI integer can hold 16 4-bit BCD characters
298 * (if table is 32-bit, integer can hold 8 BCD characters)
299 * Convert each 4-bit BCD value
302 return_desc
->integer
.value
= 0;
303 digit
= operand
[0]->integer
.value
;
305 /* Convert each BCD digit (each is one nybble wide) */
308 (i
< acpi_gbl_integer_nybble_width
) && (digit
> 0);
311 /* Get the least significant 4-bit BCD digit */
313 temp32
= ((u32
) digit
) & 0xF;
315 /* Check the range of the digit */
319 "BCD digit too large (not decimal): 0x%X",
322 status
= AE_AML_NUMERIC_OVERFLOW
;
326 /* Sum the digit into the result with the current power of 10 */
328 return_desc
->integer
.value
+=
329 (((u64
) temp32
) * power_of_ten
);
331 /* Shift to next BCD digit */
335 /* Next power of 10 */
341 case AML_TO_BCD_OP
: /* to_bcd (Operand, Result) */
343 return_desc
->integer
.value
= 0;
344 digit
= operand
[0]->integer
.value
;
346 /* Each BCD digit is one nybble wide */
349 (i
< acpi_gbl_integer_nybble_width
) && (digit
> 0);
351 (void)acpi_ut_short_divide(digit
, 10, &digit
,
355 * Insert the BCD digit that resides in the
356 * remainder from above
358 return_desc
->integer
.value
|=
359 (((u64
) temp32
) << ACPI_MUL_4(i
));
362 /* Overflow if there is any data left in Digit */
366 "Integer too large to convert to BCD: 0x%8.8X%8.8X",
367 ACPI_FORMAT_UINT64(operand
[0]->
369 status
= AE_AML_NUMERIC_OVERFLOW
;
374 case AML_CONDITIONAL_REF_OF_OP
: /* cond_ref_of (source_object, Result) */
376 * This op is a little strange because the internal return value is
377 * different than the return value stored in the result descriptor
378 * (There are really two return values)
380 if ((struct acpi_namespace_node
*)operand
[0] ==
381 acpi_gbl_root_node
) {
383 * This means that the object does not exist in the namespace,
386 return_desc
->integer
.value
= 0;
390 /* Get the object reference, store it, and remove our reference */
392 status
= acpi_ex_get_object_reference(operand
[0],
395 if (ACPI_FAILURE(status
)) {
400 acpi_ex_store(return_desc2
, operand
[1], walk_state
);
401 acpi_ut_remove_reference(return_desc2
);
403 /* The object exists in the namespace, return TRUE */
405 return_desc
->integer
.value
= ACPI_UINT64_MAX
;
410 /* No other opcodes get here */
416 case AML_STORE_OP
: /* Store (Source, Target) */
418 * A store operand is typically a number, string, buffer or lvalue
419 * Be careful about deleting the source object,
420 * since the object itself may have been stored.
422 status
= acpi_ex_store(operand
[0], operand
[1], walk_state
);
423 if (ACPI_FAILURE(status
)) {
424 return_ACPI_STATUS(status
);
427 /* It is possible that the Store already produced a return object */
429 if (!walk_state
->result_obj
) {
431 * Normally, we would remove a reference on the Operand[0]
432 * parameter; But since it is being used as the internal return
433 * object (meaning we would normally increment it), the two
434 * cancel out, and we simply don't do anything.
436 walk_state
->result_obj
= operand
[0];
437 walk_state
->operands
[0] = NULL
; /* Prevent deletion */
439 return_ACPI_STATUS(status
);
444 case AML_COPY_OBJECT_OP
: /* copy_object (Source, Target) */
447 acpi_ut_copy_iobject_to_iobject(operand
[0], &return_desc
,
451 case AML_TO_DECIMAL_STRING_OP
: /* to_decimal_string (Data, Result) */
454 acpi_ex_convert_to_string(operand
[0], &return_desc
,
455 ACPI_EXPLICIT_CONVERT_DECIMAL
);
456 if (return_desc
== operand
[0]) {
458 /* No conversion performed, add ref to handle return value */
460 acpi_ut_add_reference(return_desc
);
464 case AML_TO_HEX_STRING_OP
: /* to_hex_string (Data, Result) */
467 acpi_ex_convert_to_string(operand
[0], &return_desc
,
468 ACPI_EXPLICIT_CONVERT_HEX
);
469 if (return_desc
== operand
[0]) {
471 /* No conversion performed, add ref to handle return value */
473 acpi_ut_add_reference(return_desc
);
477 case AML_TO_BUFFER_OP
: /* to_buffer (Data, Result) */
479 status
= acpi_ex_convert_to_buffer(operand
[0], &return_desc
);
480 if (return_desc
== operand
[0]) {
482 /* No conversion performed, add ref to handle return value */
484 acpi_ut_add_reference(return_desc
);
488 case AML_TO_INTEGER_OP
: /* to_integer (Data, Result) */
490 /* Perform "explicit" conversion */
493 acpi_ex_convert_to_integer(operand
[0], &return_desc
, 0);
494 if (return_desc
== operand
[0]) {
496 /* No conversion performed, add ref to handle return value */
498 acpi_ut_add_reference(return_desc
);
502 case AML_SHIFT_LEFT_BIT_OP
: /* shift_left_bit (Source, bit_num) */
503 case AML_SHIFT_RIGHT_BIT_OP
: /* shift_right_bit (Source, bit_num) */
505 /* These are two obsolete opcodes */
508 "%s is obsolete and not implemented",
509 acpi_ps_get_opcode_name(walk_state
->opcode
)));
513 default: /* Unknown opcode */
515 ACPI_ERROR((AE_INFO
, "Unknown AML opcode 0x%X",
516 walk_state
->opcode
));
517 status
= AE_AML_BAD_OPCODE
;
521 if (ACPI_SUCCESS(status
)) {
523 /* Store the return value computed above into the target object */
525 status
= acpi_ex_store(return_desc
, operand
[1], walk_state
);
530 /* Delete return object on error */
532 if (ACPI_FAILURE(status
)) {
533 acpi_ut_remove_reference(return_desc
);
536 /* Save return object on success */
538 else if (!walk_state
->result_obj
) {
539 walk_state
->result_obj
= return_desc
;
542 return_ACPI_STATUS(status
);
545 /*******************************************************************************
547 * FUNCTION: acpi_ex_opcode_1A_0T_1R
549 * PARAMETERS: walk_state - Current state (contains AML opcode)
553 * DESCRIPTION: Execute opcode with one argument, no target, and a return value
555 ******************************************************************************/
557 acpi_status
acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state
*walk_state
)
559 union acpi_operand_object
**operand
= &walk_state
->operands
[0];
560 union acpi_operand_object
*temp_desc
;
561 union acpi_operand_object
*return_desc
= NULL
;
562 acpi_status status
= AE_OK
;
566 ACPI_FUNCTION_TRACE_STR(ex_opcode_1A_0T_1R
,
567 acpi_ps_get_opcode_name(walk_state
->opcode
));
569 /* Examine the AML opcode */
571 switch (walk_state
->opcode
) {
572 case AML_LOGICAL_NOT_OP
: /* LNot (Operand) */
574 return_desc
= acpi_ut_create_integer_object((u64
) 0);
576 status
= AE_NO_MEMORY
;
581 * Set result to ONES (TRUE) if Value == 0. Note:
582 * return_desc->Integer.Value is initially == 0 (FALSE) from above.
584 if (!operand
[0]->integer
.value
) {
585 return_desc
->integer
.value
= ACPI_UINT64_MAX
;
589 case AML_DECREMENT_OP
: /* Decrement (Operand) */
590 case AML_INCREMENT_OP
: /* Increment (Operand) */
592 * Create a new integer. Can't just get the base integer and
593 * increment it because it may be an Arg or Field.
595 return_desc
= acpi_ut_create_internal_object(ACPI_TYPE_INTEGER
);
597 status
= AE_NO_MEMORY
;
602 * Since we are expecting a Reference operand, it can be either a
603 * NS Node or an internal object.
605 temp_desc
= operand
[0];
606 if (ACPI_GET_DESCRIPTOR_TYPE(temp_desc
) ==
607 ACPI_DESC_TYPE_OPERAND
) {
609 /* Internal reference object - prevent deletion */
611 acpi_ut_add_reference(temp_desc
);
615 * Convert the Reference operand to an Integer (This removes a
616 * reference on the Operand[0] object)
618 * NOTE: We use LNOT_OP here in order to force resolution of the
619 * reference operand to an actual integer.
621 status
= acpi_ex_resolve_operands(AML_LOGICAL_NOT_OP
,
622 &temp_desc
, walk_state
);
623 if (ACPI_FAILURE(status
)) {
624 ACPI_EXCEPTION((AE_INFO
, status
,
625 "While resolving operands for [%s]",
626 acpi_ps_get_opcode_name(walk_state
->
633 * temp_desc is now guaranteed to be an Integer object --
634 * Perform the actual increment or decrement
636 if (walk_state
->opcode
== AML_INCREMENT_OP
) {
637 return_desc
->integer
.value
=
638 temp_desc
->integer
.value
+ 1;
640 return_desc
->integer
.value
=
641 temp_desc
->integer
.value
- 1;
644 /* Finished with this Integer object */
646 acpi_ut_remove_reference(temp_desc
);
649 * Store the result back (indirectly) through the original
652 status
= acpi_ex_store(return_desc
, operand
[0], walk_state
);
655 case AML_OBJECT_TYPE_OP
: /* object_type (source_object) */
657 * Note: The operand is not resolved at this point because we want to
658 * get the associated object, not its value. For example, we don't
659 * want to resolve a field_unit to its value, we want the actual
663 /* Get the type of the base object */
666 acpi_ex_resolve_multiple(walk_state
, operand
[0], &type
,
668 if (ACPI_FAILURE(status
)) {
672 /* Allocate a descriptor to hold the type. */
674 return_desc
= acpi_ut_create_integer_object((u64
) type
);
676 status
= AE_NO_MEMORY
;
681 case AML_SIZE_OF_OP
: /* size_of (source_object) */
683 * Note: The operand is not resolved at this point because we want to
684 * get the associated object, not its value.
687 /* Get the base object */
690 acpi_ex_resolve_multiple(walk_state
, operand
[0], &type
,
692 if (ACPI_FAILURE(status
)) {
697 * The type of the base object must be integer, buffer, string, or
698 * package. All others are not supported.
700 * NOTE: Integer is not specifically supported by the ACPI spec,
701 * but is supported implicitly via implicit operand conversion.
702 * rather than bother with conversion, we just use the byte width
703 * global (4 or 8 bytes).
706 case ACPI_TYPE_INTEGER
:
708 value
= acpi_gbl_integer_byte_width
;
711 case ACPI_TYPE_STRING
:
713 value
= temp_desc
->string
.length
;
716 case ACPI_TYPE_BUFFER
:
718 /* Buffer arguments may not be evaluated at this point */
720 status
= acpi_ds_get_buffer_arguments(temp_desc
);
721 value
= temp_desc
->buffer
.length
;
724 case ACPI_TYPE_PACKAGE
:
726 /* Package arguments may not be evaluated at this point */
728 status
= acpi_ds_get_package_arguments(temp_desc
);
729 value
= temp_desc
->package
.count
;
735 "Operand must be Buffer/Integer/String/Package"
737 acpi_ut_get_type_name(type
)));
739 status
= AE_AML_OPERAND_TYPE
;
743 if (ACPI_FAILURE(status
)) {
748 * Now that we have the size of the object, create a result
749 * object to hold the value
751 return_desc
= acpi_ut_create_integer_object(value
);
753 status
= AE_NO_MEMORY
;
758 case AML_REF_OF_OP
: /* ref_of (source_object) */
761 acpi_ex_get_object_reference(operand
[0], &return_desc
,
763 if (ACPI_FAILURE(status
)) {
768 case AML_DEREF_OF_OP
: /* deref_of (obj_reference | String) */
770 /* Check for a method local or argument, or standalone String */
772 if (ACPI_GET_DESCRIPTOR_TYPE(operand
[0]) ==
773 ACPI_DESC_TYPE_NAMED
) {
775 acpi_ns_get_attached_object((struct
776 acpi_namespace_node
*)
779 && ((temp_desc
->common
.type
== ACPI_TYPE_STRING
)
780 || (temp_desc
->common
.type
==
781 ACPI_TYPE_LOCAL_REFERENCE
))) {
782 operand
[0] = temp_desc
;
783 acpi_ut_add_reference(temp_desc
);
785 status
= AE_AML_OPERAND_TYPE
;
789 switch ((operand
[0])->common
.type
) {
790 case ACPI_TYPE_LOCAL_REFERENCE
:
792 * This is a deref_of (local_x | arg_x)
794 * Must resolve/dereference the local/arg reference first
796 switch (operand
[0]->reference
.class) {
797 case ACPI_REFCLASS_LOCAL
:
798 case ACPI_REFCLASS_ARG
:
800 /* Set Operand[0] to the value of the local/arg */
803 acpi_ds_method_data_get_value
804 (operand
[0]->reference
.class,
805 operand
[0]->reference
.value
,
806 walk_state
, &temp_desc
);
807 if (ACPI_FAILURE(status
)) {
812 * Delete our reference to the input object and
813 * point to the object just retrieved
815 acpi_ut_remove_reference(operand
[0]);
816 operand
[0] = temp_desc
;
819 case ACPI_REFCLASS_REFOF
:
821 /* Get the object to which the reference refers */
824 operand
[0]->reference
.object
;
825 acpi_ut_remove_reference(operand
[0]);
826 operand
[0] = temp_desc
;
831 /* Must be an Index op - handled below */
836 case ACPI_TYPE_STRING
:
842 status
= AE_AML_OPERAND_TYPE
;
847 if (ACPI_GET_DESCRIPTOR_TYPE(operand
[0]) !=
848 ACPI_DESC_TYPE_NAMED
) {
849 if ((operand
[0])->common
.type
== ACPI_TYPE_STRING
) {
851 * This is a deref_of (String). The string is a reference
852 * to a named ACPI object.
854 * 1) Find the owning Node
855 * 2) Dereference the node to an actual object. Could be a
856 * Field, so we need to resolve the node to a value.
859 acpi_ns_get_node_unlocked(walk_state
->
864 ACPI_NS_SEARCH_PARENT
,
865 ACPI_CAST_INDIRECT_PTR
869 if (ACPI_FAILURE(status
)) {
874 acpi_ex_resolve_node_to_value
875 (ACPI_CAST_INDIRECT_PTR
876 (struct acpi_namespace_node
, &return_desc
),
882 /* Operand[0] may have changed from the code above */
884 if (ACPI_GET_DESCRIPTOR_TYPE(operand
[0]) ==
885 ACPI_DESC_TYPE_NAMED
) {
887 * This is a deref_of (object_reference)
888 * Get the actual object from the Node (This is the dereference).
889 * This case may only happen when a local_x or arg_x is
890 * dereferenced above, or for references to device and
893 switch (((struct acpi_namespace_node
*)operand
[0])->
895 case ACPI_TYPE_DEVICE
:
896 case ACPI_TYPE_THERMAL
:
898 /* These types have no node subobject, return the NS node */
900 return_desc
= operand
[0];
904 /* For most types, get the object attached to the node */
906 return_desc
= acpi_ns_get_attached_object((struct acpi_namespace_node
*)operand
[0]);
907 acpi_ut_add_reference(return_desc
);
912 * This must be a reference object produced by either the
913 * Index() or ref_of() operator
915 switch (operand
[0]->reference
.class) {
916 case ACPI_REFCLASS_INDEX
:
918 * The target type for the Index operator must be
919 * either a Buffer or a Package
921 switch (operand
[0]->reference
.target_type
) {
922 case ACPI_TYPE_BUFFER_FIELD
:
925 operand
[0]->reference
.object
;
928 * Create a new object that contains one element of the
929 * buffer -- the element pointed to by the index.
931 * NOTE: index into a buffer is NOT a pointer to a
932 * sub-buffer of the main buffer, it is only a pointer to a
933 * single element (byte) of the buffer!
935 * Since we are returning the value of the buffer at the
936 * indexed location, we don't need to add an additional
937 * reference to the buffer itself.
940 acpi_ut_create_integer_object((u64
)
941 temp_desc
->buffer
.pointer
[operand
[0]->reference
.value
]);
943 status
= AE_NO_MEMORY
;
948 case ACPI_TYPE_PACKAGE
:
950 * Return the referenced element of the package. We must
951 * add another reference to the referenced object, however.
954 *(operand
[0]->reference
.where
);
957 * Element is NULL, do not allow the dereference.
958 * This provides compatibility with other ACPI
962 (AE_AML_UNINITIALIZED_ELEMENT
);
965 acpi_ut_add_reference(return_desc
);
971 "Unknown Index TargetType 0x%X in reference object %p",
972 operand
[0]->reference
.
973 target_type
, operand
[0]));
975 status
= AE_AML_OPERAND_TYPE
;
980 case ACPI_REFCLASS_REFOF
:
982 return_desc
= operand
[0]->reference
.object
;
984 if (ACPI_GET_DESCRIPTOR_TYPE(return_desc
) ==
985 ACPI_DESC_TYPE_NAMED
) {
987 acpi_ns_get_attached_object((struct
997 * buffer_fields/field_units require additional resolution
999 switch (return_desc
->common
.type
) {
1000 case ACPI_TYPE_BUFFER_FIELD
:
1001 case ACPI_TYPE_LOCAL_REGION_FIELD
:
1002 case ACPI_TYPE_LOCAL_BANK_FIELD
:
1003 case ACPI_TYPE_LOCAL_INDEX_FIELD
:
1006 acpi_ex_read_data_from_field
1007 (walk_state
, return_desc
,
1009 if (ACPI_FAILURE(status
)) {
1013 return_desc
= temp_desc
;
1018 /* Add another reference to the object */
1020 acpi_ut_add_reference
1029 ACPI_ERROR((AE_INFO
,
1030 "Unknown class in reference(%p) - 0x%2.2X",
1032 operand
[0]->reference
.class));
1042 ACPI_ERROR((AE_INFO
, "Unknown AML opcode 0x%X",
1043 walk_state
->opcode
));
1045 status
= AE_AML_BAD_OPCODE
;
1051 /* Delete return object on error */
1053 if (ACPI_FAILURE(status
)) {
1054 acpi_ut_remove_reference(return_desc
);
1057 /* Save return object on success */
1060 walk_state
->result_obj
= return_desc
;
1063 return_ACPI_STATUS(status
);