]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/acpi/executer/exoparg1.c
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
[linux-2.6-omap-h63xx.git] / drivers / acpi / executer / exoparg1.c
index 252f10acbbccc3436a4def9c1ac305509fc6f0e1..f622f9eac8a1a85bfe0bfb4afbed5854b5435609 100644 (file)
@@ -6,7 +6,7 @@
  *****************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2007, R. Byron Moore
+ * Copyright (C) 2000 - 2008, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -121,6 +121,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state)
 
        if ((ACPI_FAILURE(status)) || walk_state->result_obj) {
                acpi_ut_remove_reference(return_desc);
+               walk_state->result_obj = NULL;
        } else {
                /* Save the return value */
 
@@ -739,26 +740,38 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                        value = acpi_gbl_integer_byte_width;
                        break;
 
-               case ACPI_TYPE_BUFFER:
-                       value = temp_desc->buffer.length;
-                       break;
-
                case ACPI_TYPE_STRING:
                        value = temp_desc->string.length;
                        break;
 
+               case ACPI_TYPE_BUFFER:
+
+                       /* Buffer arguments may not be evaluated at this point */
+
+                       status = acpi_ds_get_buffer_arguments(temp_desc);
+                       value = temp_desc->buffer.length;
+                       break;
+
                case ACPI_TYPE_PACKAGE:
+
+                       /* Package arguments may not be evaluated at this point */
+
+                       status = acpi_ds_get_package_arguments(temp_desc);
                        value = temp_desc->package.count;
                        break;
 
                default:
                        ACPI_ERROR((AE_INFO,
-                                   "Operand is not Buf/Int/Str/Pkg - found type %s",
+                                   "Operand must be Buffer/Integer/String/Package - found type %s",
                                    acpi_ut_get_type_name(type)));
                        status = AE_AML_OPERAND_TYPE;
                        goto cleanup;
                }
 
+               if (ACPI_FAILURE(status)) {
+                       goto cleanup;
+               }
+
                /*
                 * Now that we have the size of the object, create a result
                 * object to hold the value
@@ -812,16 +825,16 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                 *
                                 * Must resolve/dereference the local/arg reference first
                                 */
-                               switch (operand[0]->reference.opcode) {
-                               case AML_LOCAL_OP:
-                               case AML_ARG_OP:
+                               switch (operand[0]->reference.class) {
+                               case ACPI_REFCLASS_LOCAL:
+                               case ACPI_REFCLASS_ARG:
 
                                        /* Set Operand[0] to the value of the local/arg */
 
                                        status =
                                            acpi_ds_method_data_get_value
-                                           (operand[0]->reference.opcode,
-                                            operand[0]->reference.offset,
+                                           (operand[0]->reference.class,
+                                            operand[0]->reference.value,
                                             walk_state, &temp_desc);
                                        if (ACPI_FAILURE(status)) {
                                                goto cleanup;
@@ -835,7 +848,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                        operand[0] = temp_desc;
                                        break;
 
-                               case AML_REF_OF_OP:
+                               case ACPI_REFCLASS_REFOF:
 
                                        /* Get the object to which the reference refers */
 
@@ -915,8 +928,8 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                         * This must be a reference object produced by either the
                         * Index() or ref_of() operator
                         */
-                       switch (operand[0]->reference.opcode) {
-                       case AML_INDEX_OP:
+                       switch (operand[0]->reference.class) {
+                       case ACPI_REFCLASS_INDEX:
 
                                /*
                                 * The target type for the Index operator must be
@@ -952,7 +965,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                        return_desc->integer.value =
                                            temp_desc->buffer.
                                            pointer[operand[0]->reference.
-                                                   offset];
+                                                   value];
                                        break;
 
                                case ACPI_TYPE_PACKAGE:
@@ -972,7 +985,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                default:
 
                                        ACPI_ERROR((AE_INFO,
-                                                   "Unknown Index TargetType %X in obj %p",
+                                                   "Unknown Index TargetType %X in reference object %p",
                                                    operand[0]->reference.
                                                    target_type, operand[0]));
                                        status = AE_AML_OPERAND_TYPE;
@@ -980,7 +993,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
                                }
                                break;
 
-                       case AML_REF_OF_OP:
+                       case ACPI_REFCLASS_REFOF:
 
                                return_desc = operand[0]->reference.object;
 
@@ -1000,9 +1013,9 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state)
 
                        default:
                                ACPI_ERROR((AE_INFO,
-                                           "Unknown opcode in reference(%p) - %X",
+                                           "Unknown class in reference(%p) - %2.2X",
                                            operand[0],
-                                           operand[0]->reference.opcode));
+                                           operand[0]->reference.class));
 
                                status = AE_TYPE;
                                goto cleanup;