patch-2.4.10 linux/drivers/acpi/parser/psparse.c

Next file: linux/drivers/acpi/parser/psscope.c
Previous file: linux/drivers/acpi/parser/psopcode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.9/linux/drivers/acpi/parser/psparse.c linux/drivers/acpi/parser/psparse.c
@@ -1,7 +1,7 @@
 /******************************************************************************
  *
  * Module Name: psparse - Parser top level AML parse routines
- *              $Revision: 85 $
+ *              $Revision: 96 $
  *
  *****************************************************************************/
 
@@ -51,13 +51,13 @@
 
 /*******************************************************************************
  *
- * FUNCTION:    Acpi_ps_peek_opcode
+ * FUNCTION:    Acpi_ps_get_opcode_size
  *
- * PARAMETERS:  None
+ * PARAMETERS:  Opcode          - An AML opcode
  *
- * RETURN:      Status
+ * RETURN:      Size of the opcode, in bytes (1 or 2)
  *
- * DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
+ * DESCRIPTION: Get the size of the current opcode.
  *
  ******************************************************************************/
 
@@ -92,7 +92,7 @@
 
 u16
 acpi_ps_peek_opcode (
-	ACPI_PARSE_STATE        *parser_state)
+	acpi_parse_state        *parser_state)
 {
 	u8                      *aml;
 	u16                     opcode;
@@ -118,7 +118,6 @@
 	 *
 	 *     extended Opcode, !=, <=, or >=
 	 */
-
 	if (opcode == AML_EXTOP) {
 		/* Extended opcode */
 
@@ -145,17 +144,20 @@
  *
  ******************************************************************************/
 
-ACPI_PARSE_STATE *
+acpi_parse_state *
 acpi_ps_create_state (
 	u8                      *aml,
 	u32                     aml_size)
 {
-	ACPI_PARSE_STATE        *parser_state;
+	acpi_parse_state        *parser_state;
+
 
+	FUNCTION_TRACE ("Ps_create_state");
 
-	parser_state = acpi_ut_callocate (sizeof (ACPI_PARSE_STATE));
+
+	parser_state = ACPI_MEM_CALLOCATE (sizeof (acpi_parse_state));
 	if (!parser_state) {
-		return (NULL);
+		return_PTR (NULL);
 	}
 
 	parser_state->aml      = aml;
@@ -164,7 +166,7 @@
 	parser_state->aml_start = aml;
 
 
-	return (parser_state);
+	return_PTR (parser_state);
 }
 
 
@@ -188,19 +190,21 @@
 
 #ifdef PARSER_ONLY
 
-ACPI_STATUS
+acpi_status
 acpi_ps_find_object (
 	u16                     opcode,
-	ACPI_PARSE_OBJECT       *op,
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_PARSE_OBJECT       **out_op)
+	acpi_parse_object       *op,
+	acpi_walk_state         *walk_state,
+	acpi_parse_object       **out_op)
 {
 	NATIVE_CHAR             *path;
+	const acpi_opcode_info  *op_info;
 
 
 	/* We are only interested in opcodes that have an associated name */
 
-	if (!acpi_ps_is_named_op (opcode)) {
+	op_info = acpi_ps_get_opcode_info (opcode);
+	if (!(op_info->flags & AML_NAMED)) {
 		*out_op = op;
 		return (AE_OK);
 	}
@@ -237,16 +241,19 @@
 
 static u8
 acpi_ps_complete_this_op (
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_PARSE_OBJECT       *op)
+	acpi_walk_state         *walk_state,
+	acpi_parse_object       *op)
 {
 #ifndef PARSER_ONLY
-	ACPI_PARSE_OBJECT       *prev;
-	ACPI_PARSE_OBJECT       *next;
-	ACPI_OPCODE_INFO        *op_info;
-	ACPI_OPCODE_INFO        *parent_info;
+	acpi_parse_object       *prev;
+	acpi_parse_object       *next;
+	const acpi_opcode_info  *op_info;
+	const acpi_opcode_info  *parent_info;
 	u32                     opcode_class;
-	ACPI_PARSE_OBJECT       *replacement_op = NULL;
+	acpi_parse_object       *replacement_op = NULL;
+
+
+	FUNCTION_TRACE_PTR ("Ps_complete_this_op", op);
 
 
 	op_info     = acpi_ps_get_opcode_info (op->opcode);
@@ -269,7 +276,6 @@
 			 * Check if we need to replace the operator and its subtree
 			 * with a return value op (placeholder op)
 			 */
-
 			parent_info = acpi_ps_get_opcode_info (op->parent->opcode);
 
 			switch (ACPI_GET_OP_CLASS (parent_info)) {
@@ -282,7 +288,6 @@
 				 * These opcodes contain Term_arg operands. The current
 				 * op must be replace by a placeholder return op
 				 */
-
 				if ((op->parent->opcode == AML_REGION_OP)               ||
 					(op->parent->opcode == AML_CREATE_FIELD_OP)         ||
 					(op->parent->opcode == AML_CREATE_BIT_FIELD_OP)     ||
@@ -292,7 +297,7 @@
 					(op->parent->opcode == AML_CREATE_QWORD_FIELD_OP)) {
 					replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
 					if (!replacement_op) {
-						return (FALSE);
+						return_VALUE (FALSE);
 					}
 				}
 
@@ -301,7 +306,7 @@
 			default:
 				replacement_op = acpi_ps_alloc_op (AML_INT_RETURN_VALUE_OP);
 				if (!replacement_op) {
-					return (FALSE);
+					return_VALUE (FALSE);
 				}
 			}
 
@@ -351,10 +356,10 @@
 
 		acpi_ps_delete_parse_tree (op);
 
-		return (TRUE);
+		return_VALUE (TRUE);
 	}
 
-	return (FALSE);
+	return_VALUE (FALSE);
 
 #else
 	return (FALSE);
@@ -374,18 +379,21 @@
  *
  ******************************************************************************/
 
-static ACPI_STATUS
+static acpi_status
 acpi_ps_next_parse_state (
-	ACPI_WALK_STATE         *walk_state,
-	ACPI_PARSE_OBJECT       *op,
-	ACPI_STATUS             callback_status)
+	acpi_walk_state         *walk_state,
+	acpi_parse_object       *op,
+	acpi_status             callback_status)
 {
-	ACPI_PARSE_STATE        *parser_state = walk_state->parser_state;
-	ACPI_STATUS             status = AE_CTRL_PENDING;
+	acpi_parse_state        *parser_state = walk_state->parser_state;
+	acpi_status             status = AE_CTRL_PENDING;
 	u8                      *start;
 	u32                     package_length;
 
 
+	FUNCTION_TRACE_PTR ("Ps_next_parse_state", op);
+
+
 	switch (callback_status) {
 	case AE_CTRL_TERMINATE:
 
@@ -393,7 +401,6 @@
 		 * A control method was terminated via a RETURN statement.
 		 * The walk of this method is complete.
 		 */
-
 		parser_state->aml = parser_state->aml_end;
 		status = AE_CTRL_TERMINATE;
 		break;
@@ -401,13 +408,11 @@
 
 	case AE_CTRL_PENDING:
 
-			/*
-			 * Predicate of a WHILE was true and the loop just completed an
-			 * execution.  Go back to the start of the loop and reevaluate the
-			 * predicate.
-			 */
-/*            Walk_state->Control_state->Common.State =
-					CONTROL_PREDICATE_EXECUTING;*/
+		/*
+		 * Predicate of a WHILE was true and the loop just completed an
+		 * execution.  Go back to the start of the loop and reevaluate the
+		 * predicate.
+		 */
 
 		/* TBD: How to handle a break within a while. */
 		/* This code attempts it */
@@ -417,13 +422,13 @@
 
 
 	case AE_CTRL_TRUE:
-			/*
-			 * Predicate of an IF was true, and we are at the matching ELSE.
-			 * Just close out this package
-			 *
-			 * Note: Parser_state->Aml is modified by the package length procedure
-			 * TBD: [Investigate] perhaps it shouldn't, too much trouble
-			 */
+		/*
+		 * Predicate of an IF was true, and we are at the matching ELSE.
+		 * Just close out this package
+		 *
+		 * Note: Parser_state->Aml is modified by the package length procedure
+		 * TBD: [Investigate] perhaps it shouldn't, too much trouble
+		 */
 		start = parser_state->aml;
 		package_length = acpi_ps_get_next_package_length (parser_state);
 		parser_state->aml = start + package_length;
@@ -439,7 +444,6 @@
 		 * this branch of the tree) and continue execution at the parent
 		 * level.
 		 */
-
 		parser_state->aml = parser_state->scope->parse_scope.pkg_end;
 
 		/* In the case of a BREAK, just force a predicate (if any) to FALSE */
@@ -473,8 +477,7 @@
 		break;
 	}
 
-
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 
@@ -491,24 +494,27 @@
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ps_parse_loop (
-	ACPI_WALK_STATE         *walk_state)
+	acpi_walk_state         *walk_state)
 {
-	ACPI_STATUS             status = AE_OK;
-	ACPI_PARSE_OBJECT       *op = NULL;     /* current op */
-	ACPI_OPCODE_INFO        *op_info;
-	ACPI_PARSE_OBJECT       *arg = NULL;
-	ACPI_PARSE2_OBJECT      *deferred_op;
+	acpi_status             status = AE_OK;
+	acpi_parse_object       *op = NULL;     /* current op */
+	const acpi_opcode_info  *op_info;
+	acpi_parse_object       *arg = NULL;
+	acpi_parse2_object      *deferred_op;
 	u32                     arg_count;      /* push for fixed or var args */
 	u32                     arg_types = 0;
 	u32                     aml_offset;
 	u16                     opcode;
-	ACPI_PARSE_OBJECT       pre_op;
-	ACPI_PARSE_STATE        *parser_state;
+	acpi_parse_object       pre_op;
+	acpi_parse_state        *parser_state;
 	u8                      *aml_op_start;
 
 
+	FUNCTION_TRACE_PTR ("Ps_parse_loop", walk_state);
+
+
 	parser_state = walk_state->parser_state;
 
 #ifndef PARSER_ONLY
@@ -531,17 +537,25 @@
 				 * A predicate was just completed, get the value of the
 				 * predicate and branch based on that value
 				 */
-
 				status = acpi_ds_get_predicate_value (walk_state, NULL, TRUE);
 				if (ACPI_FAILURE (status) &&
 					((status & AE_CODE_MASK) != AE_CODE_CONTROL)) {
-					return (status);
+					if (status == AE_AML_NO_RETURN_VALUE) {
+						ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+							"Invoked method did not return a value, %s\n",
+							acpi_format_exception (status)));
+
+					}
+					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Get_predicate Failed, %s\n",
+						acpi_format_exception (status)));
+					return_ACPI_STATUS (status);
 				}
 
 				status = acpi_ps_next_parse_state (walk_state, op, status);
 			}
 
 			acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+			ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
 		}
 
 		else if (walk_state->prev_op) {
@@ -570,7 +584,6 @@
 			 * 2) A name string
 			 * 3) An unknown/invalid opcode
 			 */
-
 			op_info = acpi_ps_get_opcode_info (opcode);
 			switch (ACPI_GET_OP_TYPE (op_info)) {
 			case ACPI_OP_TYPE_OPCODE:
@@ -587,7 +600,6 @@
 				 * Starts with a valid prefix or ASCII char, this is a name
 				 * string.  Convert the bare name string to a namepath.
 				 */
-
 				opcode = AML_INT_NAMEPATH_OP;
 				arg_types = ARGP_NAMESTRING;
 				break;
@@ -596,6 +608,12 @@
 
 				/* The opcode is unrecognized.  Just skip unknown opcodes */
 
+				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
+					"Found unknown opcode %lX at AML offset %X, ignoring\n",
+					opcode, aml_offset));
+
+				DUMP_BUFFER (parser_state->aml, 128);
+
 				/* Assume one-byte bad opcode */
 
 				parser_state->aml++;
@@ -605,7 +623,7 @@
 
 			/* Create Op structure and append to parent's argument list */
 
-			if (acpi_ps_is_named_op (opcode)) {
+			if (op_info->flags & AML_NAMED) {
 				pre_op.value.arg = NULL;
 				pre_op.opcode = opcode;
 
@@ -647,24 +665,22 @@
 
 
 				if (op->opcode == AML_REGION_OP) {
-					deferred_op = acpi_ps_to_extended_op (op);
-					if (deferred_op) {
-						/*
-						 * Defer final parsing of an Operation_region body,
-						 * because we don't have enough info in the first pass
-						 * to parse it correctly (i.e., there may be method
-						 * calls within the Term_arg elements of the body.
-						 *
-						 * However, we must continue parsing because
-						 * the opregion is not a standalone package --
-						 * we don't know where the end is at this point.
-						 *
-						 * (Length is unknown until parse of the body complete)
-						 */
+					deferred_op = (acpi_parse2_object *) op;
 
-						deferred_op->data   = aml_op_start;
-						deferred_op->length = 0;
-					}
+					/*
+					 * Defer final parsing of an Operation_region body,
+					 * because we don't have enough info in the first pass
+					 * to parse it correctly (i.e., there may be method
+					 * calls within the Term_arg elements of the body.
+					 *
+					 * However, we must continue parsing because
+					 * the opregion is not a standalone package --
+					 * we don't know where the end is at this point.
+					 *
+					 * (Length is unknown until parse of the body complete)
+					 */
+					deferred_op->data   = aml_op_start;
+					deferred_op->length = 0;
 				}
 			}
 
@@ -672,23 +688,19 @@
 			else {
 				/* Not a named opcode, just allocate Op and append to parent */
 
+				op_info = acpi_ps_get_opcode_info (opcode);
 				op = acpi_ps_alloc_op (opcode);
 				if (!op) {
-					return (AE_NO_MEMORY);
+					return_ACPI_STATUS (AE_NO_MEMORY);
 				}
 
 
-				if ((op->opcode == AML_CREATE_FIELD_OP)        ||
-					(op->opcode == AML_CREATE_BIT_FIELD_OP)    ||
-					(op->opcode == AML_CREATE_BYTE_FIELD_OP)   ||
-					(op->opcode == AML_CREATE_WORD_FIELD_OP)   ||
-					(op->opcode == AML_CREATE_DWORD_FIELD_OP)  ||
-					(op->opcode == AML_CREATE_QWORD_FIELD_OP)) {
+				if (op_info->flags & AML_CREATE) {
 					/*
 					 * Backup to beginning of Create_xXXfield declaration
 					 * Body_length is unknown until we parse the body
 					 */
-					deferred_op = (ACPI_PARSE2_OBJECT *) op;
+					deferred_op = (acpi_parse2_object *) op;
 
 					deferred_op->data   = aml_op_start;
 					deferred_op->length = 0;
@@ -716,6 +728,11 @@
 
 			op->aml_offset = aml_offset;
 
+			if (op_info) {
+				ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+					"Op=%p Opcode=%4.4lX Aml %p Oft=%5.5lX\n",
+					 op, op->opcode, parser_state->aml, op->aml_offset));
+			}
 		}
 
 
@@ -731,6 +748,7 @@
 			case AML_BYTE_OP:       /* AML_BYTEDATA_ARG */
 			case AML_WORD_OP:       /* AML_WORDDATA_ARG */
 			case AML_DWORD_OP:      /* AML_DWORDATA_ARG */
+			case AML_QWORD_OP:      /* AML_QWORDATA_ARG */
 			case AML_STRING_OP:     /* AML_ASCIICHARLIST_ARG */
 
 				/* fill in constant or string argument directly */
@@ -767,26 +785,24 @@
 				/* For a method, save the length and address of the body */
 
 				if (op->opcode == AML_METHOD_OP) {
-					deferred_op = acpi_ps_to_extended_op (op);
-					if (deferred_op) {
-						/*
-						 * Skip parsing of control method or opregion body,
-						 * because we don't have enough info in the first pass
-						 * to parse them correctly.
-						 */
-
-						deferred_op->data   = parser_state->aml;
-						deferred_op->length = (u32) (parser_state->pkg_end -
-								   parser_state->aml);
-
-						/*
-						 * Skip body of method.  For Op_regions, we must continue
-						 * parsing because the opregion is not a standalone
-						 * package (We don't know where the end is).
-						 */
-						parser_state->aml   = parser_state->pkg_end;
-						arg_count           = 0;
-					}
+					deferred_op = (acpi_parse2_object *) op;
+
+					/*
+					 * Skip parsing of control method or opregion body,
+					 * because we don't have enough info in the first pass
+					 * to parse them correctly.
+					 */
+					deferred_op->data   = parser_state->aml;
+					deferred_op->length = (u32) (parser_state->pkg_end -
+							   parser_state->aml);
+
+					/*
+					 * Skip body of method.  For Op_regions, we must continue
+					 * parsing because the opregion is not a standalone
+					 * package (We don't know where the end is).
+					 */
+					parser_state->aml   = parser_state->pkg_end;
+					arg_count           = 0;
 				}
 
 				break;
@@ -800,42 +816,36 @@
 		if (!arg_count) {
 			/* completed Op, prepare for next */
 
-			if (acpi_ps_is_named_op (op->opcode)) {
+			op_info = acpi_ps_get_opcode_info (op->opcode);
+			if (op_info->flags & AML_NAMED) {
 				if (acpi_gbl_depth) {
 					acpi_gbl_depth--;
 				}
 
 				if (op->opcode == AML_REGION_OP) {
-					deferred_op = acpi_ps_to_extended_op (op);
-					if (deferred_op) {
-						/*
-						 * Skip parsing of control method or opregion body,
-						 * because we don't have enough info in the first pass
-						 * to parse them correctly.
-						 *
-						 * Completed parsing an Op_region declaration, we now
-						 * know the length.
-						 */
+					deferred_op = (acpi_parse2_object *) op;
 
-						deferred_op->length = (u32) (parser_state->aml -
-								   deferred_op->data);
-					}
+					/*
+					 * Skip parsing of control method or opregion body,
+					 * because we don't have enough info in the first pass
+					 * to parse them correctly.
+					 *
+					 * Completed parsing an Op_region declaration, we now
+					 * know the length.
+					 */
+					deferred_op->length = (u32) (parser_state->aml -
+							   deferred_op->data);
 				}
 			}
 
-			if ((op->opcode == AML_CREATE_FIELD_OP)         ||
-				(op->opcode == AML_CREATE_BIT_FIELD_OP)     ||
-				(op->opcode == AML_CREATE_BYTE_FIELD_OP)    ||
-				(op->opcode == AML_CREATE_WORD_FIELD_OP)    ||
-				(op->opcode == AML_CREATE_DWORD_FIELD_OP)   ||
-				(op->opcode == AML_CREATE_QWORD_FIELD_OP)) {
+			if (op_info->flags & AML_CREATE) {
 				/*
 				 * Backup to beginning of Create_xXXfield declaration (1 for
 				 * Opcode)
 				 *
 				 * Body_length is unknown until we parse the body
 				 */
-				deferred_op = (ACPI_PARSE2_OBJECT *) op;
+				deferred_op = (acpi_parse2_object *) op;
 				deferred_op->length = (u32) (parser_state->aml -
 						  deferred_op->data);
 			}
@@ -878,7 +888,7 @@
 				 */
 				walk_state->prev_op = op;
 				walk_state->prev_arg_types = arg_types;
-				return (status);
+				return_ACPI_STATUS (status);
 				break;
 
 
@@ -908,7 +918,7 @@
 					acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
 				} while (op);
 
-				return (status);
+				return_ACPI_STATUS (status);
 				break;
 
 
@@ -924,15 +934,15 @@
 				 * TEMP:
 				 */
 
-				return (status);
+				return_ACPI_STATUS (status);
 				break;
 			}
 
-
 			/* This scope complete? */
 
 			if (acpi_ps_has_completed_scope (parser_state)) {
 				acpi_ps_pop_scope (parser_state, &op, &arg_types, &arg_count);
+				ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", op));
 			}
 
 			else {
@@ -960,7 +970,7 @@
 	 * of open scopes (such as when several AML blocks are closed with
 	 * sequential closing braces).  We want to terminate each one cleanly.
 	 */
-
+	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Package complete at Op %p\n", op));
 	do {
 		if (op) {
 			if (walk_state->ascending_callback != NULL) {
@@ -984,12 +994,12 @@
 
 					} while (op);
 
-					return (status);
+					return_ACPI_STATUS (status);
 				}
 
 				else if (ACPI_FAILURE (status)) {
 					acpi_ps_complete_this_op (walk_state, op);
-					return (status);
+					return_ACPI_STATUS (status);
 				}
 			}
 
@@ -1000,7 +1010,7 @@
 
 	} while (op);
 
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 
@@ -1013,39 +1023,45 @@
  *              Aml             - Pointer to the raw AML code to parse
  *              Aml_size        - Length of the AML to parse
  *
+ *
  * RETURN:      Status
  *
  * DESCRIPTION: Parse raw AML and return a tree of ops
  *
  ******************************************************************************/
 
-ACPI_STATUS
+acpi_status
 acpi_ps_parse_aml (
-	ACPI_PARSE_OBJECT       *start_scope,
+	acpi_parse_object       *start_scope,
 	u8                      *aml,
 	u32                     aml_size,
 	u32                     parse_flags,
-	ACPI_NAMESPACE_NODE     *method_node,
-	ACPI_OPERAND_OBJECT     **params,
-	ACPI_OPERAND_OBJECT     **caller_return_desc,
-	ACPI_PARSE_DOWNWARDS    descending_callback,
-	ACPI_PARSE_UPWARDS      ascending_callback)
+	acpi_namespace_node     *method_node,
+	acpi_operand_object     **params,
+	acpi_operand_object     **caller_return_desc,
+	acpi_parse_downwards    descending_callback,
+	acpi_parse_upwards      ascending_callback)
 {
-	ACPI_STATUS             status;
-	ACPI_PARSE_STATE        *parser_state;
-	ACPI_WALK_STATE         *walk_state;
-	ACPI_WALK_LIST          walk_list;
-	ACPI_NAMESPACE_NODE     *node = NULL;
-	ACPI_WALK_LIST          *prev_walk_list = acpi_gbl_current_walk_list;
-	ACPI_OPERAND_OBJECT     *return_desc;
-	ACPI_OPERAND_OBJECT     *mth_desc = NULL;
+	acpi_status             status;
+	acpi_parse_state        *parser_state;
+	acpi_walk_state         *walk_state;
+	acpi_walk_list          walk_list;
+	acpi_walk_list          *prev_walk_list = acpi_gbl_current_walk_list;
+	acpi_operand_object     *return_desc;
+	acpi_operand_object     *mth_desc = NULL;
+
+
+	FUNCTION_TRACE ("Ps_parse_aml");
+
+	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with Scope=%p Aml=%p size=%lX\n",
+		start_scope, aml, aml_size));
 
 
 	/* Create and initialize a new parser state */
 
 	parser_state = acpi_ps_create_state (aml, aml_size);
 	if (!parser_state) {
-		return (AE_NO_MEMORY);
+		return_ACPI_STATUS (AE_NO_MEMORY);
 	}
 
 	acpi_ps_init_scope (parser_state, start_scope);
@@ -1086,7 +1102,7 @@
 
 		status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);
 		if (ACPI_FAILURE (status)) {
-			return (status);
+			return_ACPI_STATUS (status);
 		}
 
 		/* Init arguments if this is a control method */
@@ -1098,14 +1114,12 @@
 	else {
 		/* Setup the current scope */
 
-		node = parser_state->start_op->node;
-		parser_state->start_node = node;
-
-		if (node) {
+		parser_state->start_node = parser_state->start_op->node;
+		if (parser_state->start_node) {
 			/* Push start scope on scope stack and make it current  */
 
-			status = acpi_ds_scope_stack_push (node, node->type,
-					   walk_state);
+			status = acpi_ds_scope_stack_push (parser_state->start_node,
+					  parser_state->start_node->type, walk_state);
 			if (ACPI_FAILURE (status)) {
 				goto cleanup;
 			}
@@ -1113,32 +1127,32 @@
 		}
 	}
 
-
-	status = AE_OK;
-
 	/*
 	 * Execute the walk loop as long as there is a valid Walk State.  This
 	 * handles nested control method invocations without recursion.
 	 */
+	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", walk_state));
 
+	status = AE_OK;
 	while (walk_state) {
 		if (ACPI_SUCCESS (status)) {
 			status = acpi_ps_parse_loop (walk_state);
 		}
 
+		ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+			"Completed one call to walk loop, State=%p\n", walk_state));
+
 		if (status == AE_CTRL_TRANSFER) {
 			/*
 			 * A method call was detected.
 			 * Transfer control to the called control method
 			 */
-
 			status = acpi_ds_call_control_method (&walk_list, walk_state, NULL);
 
 			/*
 			 * If the transfer to the new method method call worked, a new walk
 			 * state was created -- get it
 			 */
-
 			walk_state = acpi_ds_get_current_walk_state (&walk_list);
 			continue;
 		}
@@ -1149,13 +1163,15 @@
 
 		/* We are done with this walk, move on to the parent if any */
 
-
 		walk_state = acpi_ds_pop_walk_state (&walk_list);
 
 		/* Extract return value before we delete Walk_state */
 
 		return_desc = walk_state->return_desc;
 
+		ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Return_value=%p, State=%p\n",
+			walk_state->return_desc, walk_state));
+
 		/* Reset the current scope to the beginning of scope stack */
 
 		acpi_ds_scope_stack_clear (walk_state);
@@ -1164,18 +1180,17 @@
 		 * If we just returned from the execution of a control method,
 		 * there's lots of cleanup to do
 		 */
-
 		if ((walk_state->parse_flags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) {
 			acpi_ds_terminate_control_method (walk_state);
 		}
 
-		 /* Delete this walk state and all linked control states */
+		/* Delete this walk state and all linked control states */
 
 		acpi_ps_cleanup_scope (walk_state->parser_state);
-		acpi_ut_free (walk_state->parser_state);
+		ACPI_MEM_FREE (walk_state->parser_state);
 		acpi_ds_delete_walk_state (walk_state);
 
-	   /* Check if we have restarted a preempted walk */
+		/* Check if we have restarted a preempted walk */
 
 		walk_state = acpi_ds_get_current_walk_state (&walk_list);
 		if (walk_state &&
@@ -1186,7 +1201,6 @@
 			 * If the method returned value is not used by the parent,
 			 * The object is deleted
 			 */
-
 			acpi_ds_restart_control_method (walk_state, return_desc);
 			walk_state->walk_type |= WALK_METHOD_RESTART;
 		}
@@ -1195,7 +1209,6 @@
 		 * Just completed a 1st-level method, save the final internal return
 		 * value (if any)
 		 */
-
 		else if (caller_return_desc) {
 			*caller_return_desc = return_desc; /* NULL if no return value */
 		}
@@ -1210,9 +1223,9 @@
 
 	/* Normal exit */
 
-	acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *) &walk_list.acquired_mutex_list);
+	acpi_ex_release_all_mutexes ((acpi_operand_object *) &walk_list.acquired_mutex_list);
 	acpi_gbl_current_walk_list = prev_walk_list;
-	return (status);
+	return_ACPI_STATUS (status);
 
 
 cleanup:
@@ -1221,12 +1234,12 @@
 
 	acpi_ds_delete_walk_state (walk_state);
 	acpi_ps_cleanup_scope (parser_state);
-	acpi_ut_free (parser_state);
+	ACPI_MEM_FREE (parser_state);
 
-	acpi_ex_release_all_mutexes ((ACPI_OPERAND_OBJECT *)&walk_list.acquired_mutex_list);
+	acpi_ex_release_all_mutexes ((acpi_operand_object *)&walk_list.acquired_mutex_list);
 	acpi_gbl_current_walk_list = prev_walk_list;
 
-	return (status);
+	return_ACPI_STATUS (status);
 }
 
 

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