linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / acpi / executer / exoparg2.c
index 7d2cbc1..e263a5d 100644 (file)
@@ -92,7 +92,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
        u32 value;
        acpi_status status = AE_OK;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_0R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_0R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Examine the opcode */
@@ -121,7 +121,7 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
 #ifdef ACPI_GPE_NOTIFY_CHECK
                /*
                 * GPE method wake/notify check.  Here, we want to ensure that we
-                * don't receive any "DeviceWake" Notifies from a GPE _Lxx or _Exx
+                * don't receive any "device_wake" Notifies from a GPE _Lxx or _Exx
                 * GPE method during system runtime.  If we do, the GPE is marked
                 * as "wake-only" and disabled.
                 *
@@ -138,7 +138,6 @@ acpi_status acpi_ex_opcode_2A_0T_0R(struct acpi_walk_state *walk_state)
                            acpi_ev_check_for_wake_only_gpe(walk_state->
                                                            gpe_event_info);
                        if (ACPI_FAILURE(status)) {
-
                                /* AE_WAKE_ONLY_GPE only error, means ignore this notify */
 
                                return_ACPI_STATUS(AE_OK)
@@ -186,7 +185,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
        union acpi_operand_object *return_desc2 = NULL;
        acpi_status status;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_2T_1R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_2T_1R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Execute the opcode */
@@ -253,7 +252,6 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state)
        acpi_ut_remove_reference(return_desc2);
 
        if (ACPI_FAILURE(status)) {
-
                /* Delete the return object */
 
                acpi_ut_remove_reference(return_desc1);
@@ -283,13 +281,12 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        acpi_size length;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_1T_1R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_1T_1R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Execute the opcode */
 
        if (walk_state->op_info->flags & AML_MATH) {
-
                /* All simple math opcodes (add, etc.) */
 
                return_desc = acpi_ut_create_internal_object(ACPI_TYPE_INTEGER);
@@ -386,70 +383,54 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
                        goto cleanup;
                }
 
-               /* Initialize the Index reference object */
-
                index = operand[1]->integer.value;
-               return_desc->reference.offset = (u32) index;
-               return_desc->reference.opcode = AML_INDEX_OP;
 
-               /*
-                * At this point, the Source operand is a String, Buffer, or Package.
-                * Verify that the index is within range.
-                */
-               switch (ACPI_GET_OBJECT_TYPE(operand[0])) {
-               case ACPI_TYPE_STRING:
+               /* At this point, the Source operand is a Package, Buffer, or String */
 
-                       if (index >= operand[0]->string.length) {
-                               status = AE_AML_STRING_LIMIT;
-                       }
-
-                       return_desc->reference.target_type =
-                           ACPI_TYPE_BUFFER_FIELD;
-                       break;
-
-               case ACPI_TYPE_BUFFER:
-
-                       if (index >= operand[0]->buffer.length) {
-                               status = AE_AML_BUFFER_LIMIT;
-                       }
-
-                       return_desc->reference.target_type =
-                           ACPI_TYPE_BUFFER_FIELD;
-                       break;
-
-               case ACPI_TYPE_PACKAGE:
+               if (ACPI_GET_OBJECT_TYPE(operand[0]) == ACPI_TYPE_PACKAGE) {
+                       /* Object to be indexed is a Package */
 
                        if (index >= operand[0]->package.count) {
+                               ACPI_ERROR((AE_INFO,
+                                           "Index value (%X%8.8X) beyond package end (%X)",
+                                           ACPI_FORMAT_UINT64(index),
+                                           operand[0]->package.count));
                                status = AE_AML_PACKAGE_LIMIT;
+                               goto cleanup;
                        }
 
                        return_desc->reference.target_type = ACPI_TYPE_PACKAGE;
+                       return_desc->reference.object = operand[0];
                        return_desc->reference.where =
                            &operand[0]->package.elements[index];
-                       break;
-
-               default:
-
-                       status = AE_AML_INTERNAL;
-                       goto cleanup;
-               }
+               } else {
+                       /* Object to be indexed is a Buffer/String */
 
-               /* Failure means that the Index was beyond the end of the object */
+                       if (index >= operand[0]->buffer.length) {
+                               ACPI_ERROR((AE_INFO,
+                                           "Index value (%X%8.8X) beyond end of buffer (%X)",
+                                           ACPI_FORMAT_UINT64(index),
+                                           operand[0]->buffer.length));
+                               status = AE_AML_BUFFER_LIMIT;
+                               goto cleanup;
+                       }
 
-               if (ACPI_FAILURE(status)) {
-                       ACPI_EXCEPTION((AE_INFO, status,
-                                       "Index (%X%8.8X) is beyond end of object",
-                                       ACPI_FORMAT_UINT64(index)));
-                       goto cleanup;
+                       return_desc->reference.target_type =
+                           ACPI_TYPE_BUFFER_FIELD;
+                       return_desc->reference.object = operand[0];
                }
 
                /*
-                * Save the target object and add a reference to it for the life
-                * of the index
+                * Add a reference to the target package/buffer/string for the life
+                * of the index.
                 */
-               return_desc->reference.object = operand[0];
                acpi_ut_add_reference(operand[0]);
 
+               /* Complete the Index reference object */
+
+               return_desc->reference.opcode = AML_INDEX_OP;
+               return_desc->reference.offset = (u32) index;
+
                /* Store the reference to the Target */
 
                status = acpi_ex_store(return_desc, operand[2], walk_state);
@@ -514,7 +495,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
        acpi_status status = AE_OK;
        u8 logical_result = FALSE;
 
-       ACPI_FUNCTION_TRACE_STR(ex_opcode_2A_0T_1R,
+       ACPI_FUNCTION_TRACE_STR("ex_opcode_2A_0T_1R",
                                acpi_ps_get_opcode_name(walk_state->opcode));
 
        /* Create the internal return object */
@@ -528,7 +509,6 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
        /* Execute the Opcode */
 
        if (walk_state->op_info->flags & AML_LOGICAL_NUMERIC) {
-
                /* logical_op (Operand0, Operand1) */
 
                status = acpi_ex_do_logical_numeric_op(walk_state->opcode,
@@ -538,7 +518,6 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state)
                                                       value, &logical_result);
                goto store_logical_result;
        } else if (walk_state->op_info->flags & AML_LOGICAL) {
-
                /* logical_op (Operand0, Operand1) */
 
                status = acpi_ex_do_logical_op(walk_state->opcode, operand[0],