]> err.no Git - linux-2.6/blobdiff - drivers/acpi/dispatcher/dswload.c
When a merge does not work automatically, git prevents
[linux-2.6] / drivers / acpi / dispatcher / dswload.c
index d11620018421486f1559c3fc4be1afbd7578a8ef..9100c0bda4701a1560e6157f33bd6d3b86757079 100644 (file)
@@ -50,7 +50,7 @@
 #include <acpi/acnamesp.h>
 #include <acpi/acevents.h>
 
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
 #include <acpi/acdisasm.h>
 #endif
 
@@ -145,15 +145,6 @@ acpi_ds_load1_begin_op (
 
        if (op) {
                if (!(walk_state->op_info->flags & AML_NAMED)) {
-#if 0
-                       if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
-                               (walk_state->op_info->class == AML_CLASS_CONTROL)) {
-                               acpi_os_printf ("\n\n***EXECUTABLE OPCODE %s***\n\n",
-                                       walk_state->op_info->name);
-                               *out_op = op;
-                               return (AE_CTRL_SKIP);
-                       }
-#endif
                        *out_op = op;
                        return (AE_OK);
                }
@@ -185,7 +176,7 @@ acpi_ds_load1_begin_op (
                 */
                status = acpi_ns_lookup (walk_state->scope_info, path, object_type,
                                  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, walk_state, &(node));
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
                if (status == AE_NOT_FOUND) {
                        /*
                         * Table disassembly:
@@ -486,11 +477,31 @@ acpi_ds_load2_begin_op (
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", op, walk_state));
 
        if (op) {
+               if ((walk_state->control_state) &&
+                       (walk_state->control_state->common.state ==
+                               ACPI_CONTROL_CONDITIONAL_EXECUTING)) {
+                       /* We are executing a while loop outside of a method */
+
+                       status = acpi_ds_exec_begin_op (walk_state, out_op);
+                       return_ACPI_STATUS (status);
+               }
+
                /* We only care about Namespace opcodes here */
 
                if ((!(walk_state->op_info->flags & AML_NSOPCODE) &&
                          (walk_state->opcode != AML_INT_NAMEPATH_OP)) ||
                        (!(walk_state->op_info->flags & AML_NAMED))) {
+                       if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+                               (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+                               ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                                       "Begin/EXEC: %s (fl %8.8X)\n", walk_state->op_info->name,
+                                       walk_state->op_info->flags));
+
+                               /* Executing a type1 or type2 opcode outside of a method */
+
+                               status = acpi_ds_exec_begin_op (walk_state, out_op);
+                               return_ACPI_STATUS (status);
+                       }
                        return_ACPI_STATUS (AE_OK);
                }
 
@@ -558,7 +569,7 @@ acpi_ds_load2_begin_op (
                                  ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
                                  walk_state, &(node));
                if (ACPI_FAILURE (status)) {
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
                        if (status == AE_NOT_FOUND) {
                                status = AE_OK;
                        }
@@ -651,8 +662,10 @@ acpi_ds_load2_begin_op (
                        break;
                }
 
+               /* Add new entry into namespace */
+
                status = acpi_ns_lookup (walk_state->scope_info, buffer_ptr, object_type,
-                                 ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH,
+                                 ACPI_IMODE_LOAD_PASS2, ACPI_NS_NO_UPSEARCH,
                                  walk_state, &(node));
                break;
        }
@@ -662,7 +675,6 @@ acpi_ds_load2_begin_op (
                return_ACPI_STATUS (status);
        }
 
-
        if (!op) {
                /* Create a new op */
 
@@ -676,9 +688,7 @@ acpi_ds_load2_begin_op (
                if (node) {
                        op->named.name = node->name.integer;
                }
-               if (out_op) {
-                       *out_op = op;
-               }
+               *out_op = op;
        }
 
        /*
@@ -725,9 +735,24 @@ acpi_ds_load2_end_op (
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
                        walk_state->op_info->name, op, walk_state));
 
-       /* Only interested in opcodes that have namespace objects */
+       /* Check if opcode had an associated namespace object */
 
        if (!(walk_state->op_info->flags & AML_NSOBJECT)) {
+#ifndef ACPI_NO_METHOD_EXECUTION
+               /* No namespace object. Executable opcode? */
+
+               if ((walk_state->op_info->class == AML_CLASS_EXECUTE) ||
+                       (walk_state->op_info->class == AML_CLASS_CONTROL)) {
+                       ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+                               "End/EXEC:   %s (fl %8.8X)\n", walk_state->op_info->name,
+                               walk_state->op_info->flags));
+
+                       /* Executing a type1 or type2 opcode outside of a method */
+
+                       status = acpi_ds_exec_end_op (walk_state);
+                       return_ACPI_STATUS (status);
+               }
+#endif
                return_ACPI_STATUS (AE_OK);
        }
 
@@ -736,7 +761,6 @@ acpi_ds_load2_end_op (
                        "Ending scope Op=%p State=%p\n", op, walk_state));
        }
 
-
        object_type = walk_state->op_info->object_type;
 
        /*
@@ -959,6 +983,7 @@ acpi_ds_load2_end_op (
                                  ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
                                  walk_state, &(new_node));
                if (ACPI_SUCCESS (status)) {
+
                        /*
                         * Make sure that what we found is indeed a method
                         * We didn't search for a method on purpose, to see if the name