patch-2.4.14 linux/drivers/acpi/parser/psxface.c

Next file: linux/drivers/acpi/resources/rsutils.c
Previous file: linux/drivers/acpi/parser/pswalk.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.13/linux/drivers/acpi/parser/psxface.c linux/drivers/acpi/parser/psxface.c
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psxface - Parser external interfaces
- *              $Revision: 47 $
+ *              $Revision: 52 $
  *
  *****************************************************************************/
 
@@ -64,6 +64,7 @@
 	acpi_operand_object     *obj_desc;
 	u32                     i;
 	acpi_parse_object       *op;
+	acpi_walk_state         *walk_state;
 
 
 	FUNCTION_TRACE ("Psx_execute");
@@ -98,11 +99,11 @@
 	}
 
 	/*
-	 * Perform the first pass parse of the method to enter any
+	 * 1) Perform the first pass parse of the method to enter any
 	 * named objects that it creates into the namespace
 	 */
 	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
-		"**** Begin Method Execution **** Entry=%p obj=%p\n",
+		"**** Begin Method Parse **** Entry=%p obj=%p\n",
 		method_node, obj_desc));
 
 	/* Create and init a Root Node */
@@ -112,13 +113,34 @@
 		return_ACPI_STATUS (AE_NO_MEMORY);
 	}
 
-	status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
-			  obj_desc->method.pcode_length,
-			  ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE,
-			  method_node, params, return_obj_desc,
-			  acpi_ds_load1_begin_op, acpi_ds_load1_end_op);
+	/* Create and initialize a new walk state */
+
+	walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+			   NULL, NULL, NULL);
+	if (!walk_state) {
+		return_ACPI_STATUS (AE_NO_MEMORY);
+	}
+
+	status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
+			  obj_desc->method.aml_length, NULL, NULL, 1);
+	if (ACPI_FAILURE (status)) {
+		/* TBD: delete walk state */
+		return_ACPI_STATUS (status);
+	}
+
+	/* Parse the AML */
+
+	status = acpi_ps_parse_aml (walk_state);
 	acpi_ps_delete_parse_tree (op);
 
+
+	/*
+	 * 2) Execute the method.  Performs second pass parse simultaneously
+	 */
+	ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+		"**** Begin Method Execution **** Entry=%p obj=%p\n",
+		method_node, obj_desc));
+
 	/* Create and init a Root Node */
 
 	op = acpi_ps_alloc_op (AML_SCOPE_OP);
@@ -126,20 +148,30 @@
 		return_ACPI_STATUS (AE_NO_MEMORY);
 	}
 
-
 	/* Init new op with the method name and pointer back to the NS node */
 
 	acpi_ps_set_name (op, method_node->name);
 	op->node = method_node;
 
+	/* Create and initialize a new walk state */
+
+	walk_state = acpi_ds_create_walk_state (TABLE_ID_DSDT,
+			   NULL, NULL, NULL);
+	if (!walk_state) {
+		return_ACPI_STATUS (AE_NO_MEMORY);
+	}
+
+	status = acpi_ds_init_aml_walk (walk_state, op, method_node, obj_desc->method.aml_start,
+			  obj_desc->method.aml_length, params, return_obj_desc, 3);
+	if (ACPI_FAILURE (status)) {
+		/* TBD: delete walk state */
+		return_ACPI_STATUS (status);
+	}
+
 	/*
 	 * The walk of the parse tree is where we actually execute the method
 	 */
-	status = acpi_ps_parse_aml (op, obj_desc->method.pcode,
-			  obj_desc->method.pcode_length,
-			  ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE,
-			  method_node, params, return_obj_desc,
-			  acpi_ds_exec_begin_op, acpi_ds_exec_end_op);
+	status = acpi_ps_parse_aml (walk_state);
 	acpi_ps_delete_parse_tree (op);
 
 	if (params) {
@@ -151,12 +183,18 @@
 	}
 
 
+	if (ACPI_FAILURE (status)) {
+		DUMP_PATHNAME (method_node, "Ps_execute: method failed -",
+			ACPI_LV_ERROR, _COMPONENT);
+	}
+
+
 	/*
 	 * If the method has returned an object, signal this to the caller with
 	 * a control exception code
 	 */
 	if (*return_obj_desc) {
-		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned Obj_desc=%X\n",
+		ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Method returned Obj_desc=%p\n",
 			*return_obj_desc));
 		DUMP_STACK_ENTRY (*return_obj_desc);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)