]> err.no Git - linux-2.6/commitdiff
ACPICA: Eliminate control method 2-pass parse/execute.
authorValery Podrezov <valery.a.podrezov@intel.com>
Fri, 2 Feb 2007 16:48:21 +0000 (19:48 +0300)
committerLen Brown <len.brown@intel.com>
Sat, 3 Feb 2007 02:14:27 +0000 (21:14 -0500)
Completed an AML interpreter performance enhancement for control method
execution. Previously a 2-pass parse/execution, control methods are now
completely parsed and executed in single pass. This improves overall
interpreter performance by ~25%, reduces code size, and reduces CPU stack use.

Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/dispatcher/dsmethod.c
drivers/acpi/parser/psloop.c
drivers/acpi/parser/psxface.c

index cf888add31917aa25a68429e46f700ebe0e462fa..aa60dca1f8aa012d901865865173709b0296057d 100644 (file)
@@ -327,7 +327,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
        ACPI_FUNCTION_TRACE_PTR(ds_call_control_method, this_walk_state);
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                         "Execute method %p, currentstate=%p\n",
+                         "Calling method %p, currentstate=%p\n",
                          this_walk_state->prev_op, this_walk_state));
 
        /*
@@ -351,49 +351,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
                return_ACPI_STATUS(status);
        }
 
-       /*
-        * 1) Parse the method. All "normal" methods are parsed for each execution.
-        * Internal methods (_OSI, etc.) do not require parsing.
-        */
-       if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {
-
-               /* Create a new walk state for the parse */
-
-               next_walk_state =
-                   acpi_ds_create_walk_state(obj_desc->method.owner_id, op,
-                                             obj_desc, NULL);
-               if (!next_walk_state) {
-                       status = AE_NO_MEMORY;
-                       goto cleanup;
-               }
-
-               /* Create and init a parse tree root */
-
-               op = acpi_ps_create_scope_op();
-               if (!op) {
-                       status = AE_NO_MEMORY;
-                       goto cleanup;
-               }
-
-               status = acpi_ds_init_aml_walk(next_walk_state, op, method_node,
-                                              obj_desc->method.aml_start,
-                                              obj_desc->method.aml_length,
-                                              NULL, 1);
-               if (ACPI_FAILURE(status)) {
-                       acpi_ps_delete_parse_tree(op);
-                       goto cleanup;
-               }
-
-               /* Begin AML parse (deletes next_walk_state) */
-
-               status = acpi_ps_parse_aml(next_walk_state);
-               acpi_ps_delete_parse_tree(op);
-               if (ACPI_FAILURE(status)) {
-                       goto cleanup;
-               }
-       }
-
-       /* 2) Begin method execution. Create a new walk state */
+       /* Begin method parse/execution. Create a new walk state */
 
        next_walk_state = acpi_ds_create_walk_state(obj_desc->method.owner_id,
                                                    NULL, obj_desc, thread);
@@ -445,8 +403,8 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
        this_walk_state->num_operands = 0;
 
        ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,
-                         "Starting nested execution, newstate=%p\n",
-                         next_walk_state));
+                         "**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
+                         method_node->name.ascii, next_walk_state));
 
        /* Invoke an internal method if necessary */
 
index a83be52018564b0feed24723708b6b1ed7b2fd45..881687ca3154a23ef94a4900c485978ff617985a 100644 (file)
@@ -226,7 +226,7 @@ acpi_ps_build_named_op(struct acpi_walk_state *walk_state,
                return_ACPI_STATUS(status);
        }
 
-       if (!op) {
+       if (!*op) {
                return_ACPI_STATUS(AE_CTRL_PARSE_CONTINUE);
        }
 
index 5d996c1140af39ac64b1e30d2a8ba711a7a34f23..9069c697cf1d3cc6d6fc713a4d36127a8352d34a 100644 (file)
@@ -54,8 +54,6 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info);
 
 static void acpi_ps_stop_trace(struct acpi_evaluate_info *info);
 
-static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info);
-
 static void
 acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action);
 
@@ -215,6 +213,8 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info)
 acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
 {
        acpi_status status;
+       union acpi_parse_object *op;
+       struct acpi_walk_state *walk_state;
 
        ACPI_FUNCTION_TRACE(ps_execute_method);
 
@@ -234,8 +234,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
        }
 
        /*
-        * The caller "owns" the parameters, so give each one an extra
-        * reference
+        * The caller "owns" the parameters, so give each one an extra reference
         */
        acpi_ps_update_parameter_list(info, REF_INCREMENT);
 
@@ -244,30 +243,50 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info)
        acpi_ps_start_trace(info);
 
        /*
-        * 1) Perform the first pass parse of the method to enter any
-        *    named objects that it creates into the namespace
+        * Execute the method. Performs parse simultaneously
         */
        ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                         "**** Begin Method Parse **** Entry=%p obj=%p\n",
-                         info->resolved_node, info->obj_desc));
+                         "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
+                         info->resolved_node->name.ascii, info->resolved_node,
+                         info->obj_desc));
 
-       info->pass_number = 1;
-       status = acpi_ps_execute_pass(info);
-       if (ACPI_FAILURE(status)) {
+       /* Create and init a Root Node */
+
+       op = acpi_ps_create_scope_op();
+       if (!op) {
+               status = AE_NO_MEMORY;
                goto cleanup;
        }
 
-       /*
-        * 2) Execute the method. Performs second pass parse simultaneously
-        */
-       ACPI_DEBUG_PRINT((ACPI_DB_PARSE,
-                         "**** Begin Method Execution **** Entry=%p obj=%p\n",
-                         info->resolved_node, info->obj_desc));
+       /* Create and initialize a new walk state */
 
        info->pass_number = 3;
-       status = acpi_ps_execute_pass(info);
+       walk_state =
+           acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
+                                     NULL, NULL);
+       if (!walk_state) {
+               status = AE_NO_MEMORY;
+               goto cleanup;
+       }
+
+       status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
+                                      info->obj_desc->method.aml_start,
+                                      info->obj_desc->method.aml_length, info,
+                                      info->pass_number);
+       if (ACPI_FAILURE(status)) {
+               acpi_ds_delete_walk_state(walk_state);
+               goto cleanup;
+       }
+
+       /* Parse the AML */
+
+       status = acpi_ps_parse_aml(walk_state);
+
+       /* walk_state was deleted by parse_aml */
 
       cleanup:
+       acpi_ps_delete_parse_tree(op);
+
        /* End optional tracing */
 
        acpi_ps_stop_trace(info);
@@ -330,62 +349,3 @@ acpi_ps_update_parameter_list(struct acpi_evaluate_info *info, u16 action)
                }
        }
 }
-
-/*******************************************************************************
- *
- * FUNCTION:    acpi_ps_execute_pass
- *
- * PARAMETERS:  Info            - See struct acpi_evaluate_info
- *                                (Used: pass_number, Node, and obj_desc)
- *
- * RETURN:      Status
- *
- * DESCRIPTION: Single AML pass: Parse or Execute a control method
- *
- ******************************************************************************/
-
-static acpi_status acpi_ps_execute_pass(struct acpi_evaluate_info *info)
-{
-       acpi_status status;
-       union acpi_parse_object *op;
-       struct acpi_walk_state *walk_state;
-
-       ACPI_FUNCTION_TRACE(ps_execute_pass);
-
-       /* Create and init a Root Node */
-
-       op = acpi_ps_create_scope_op();
-       if (!op) {
-               return_ACPI_STATUS(AE_NO_MEMORY);
-       }
-
-       /* Create and initialize a new walk state */
-
-       walk_state =
-           acpi_ds_create_walk_state(info->obj_desc->method.owner_id, NULL,
-                                     NULL, NULL);
-       if (!walk_state) {
-               status = AE_NO_MEMORY;
-               goto cleanup;
-       }
-
-       status = acpi_ds_init_aml_walk(walk_state, op, info->resolved_node,
-                                      info->obj_desc->method.aml_start,
-                                      info->obj_desc->method.aml_length,
-                                      info->pass_number == 1 ? NULL : info,
-                                      info->pass_number);
-       if (ACPI_FAILURE(status)) {
-               acpi_ds_delete_walk_state(walk_state);
-               goto cleanup;
-       }
-
-       /* Parse the AML */
-
-       status = acpi_ps_parse_aml(walk_state);
-
-       /* Walk state was deleted by parse_aml */
-
-      cleanup:
-       acpi_ps_delete_parse_tree(op);
-       return_ACPI_STATUS(status);
-}