diff options
Diffstat (limited to 'drivers/acpi/acpica/dsutils.c')
| -rw-r--r-- | drivers/acpi/acpica/dsutils.c | 75 | 
1 files changed, 37 insertions, 38 deletions
diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index 15135c25aa9..9f74795e226 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c @@ -5,7 +5,7 @@   ******************************************************************************/  /* - * Copyright (C) 2000 - 2010, Intel Corp. + * Copyright (C) 2000 - 2014, Intel Corp.   * All rights reserved.   *   * Redistribution and use in source and binary forms, with or without @@ -61,7 +61,7 @@ ACPI_MODULE_NAME("dsutils")   *   * RETURN:      None.   * - * DESCRIPTION: Clear and remove a reference on an implicit return value.  Used + * DESCRIPTION: Clear and remove a reference on an implicit return value. Used   *              to delete "stale" return values (if enabled, the return value   *              from every operator is saved at least momentarily, in case the   *              parent method exits.) @@ -107,7 +107,7 @@ void acpi_ds_clear_implicit_return(struct acpi_walk_state *walk_state)   *   * DESCRIPTION: Implements the optional "implicit return".  We save the result   *              of every ASL operator and control method invocation in case the - *              parent method exit.  Before storing a new return value, we + *              parent method exit. Before storing a new return value, we   *              delete the previous return value.   *   ******************************************************************************/ @@ -157,7 +157,7 @@ acpi_ds_do_implicit_return(union acpi_operand_object *return_desc,   *   * FUNCTION:    acpi_ds_is_result_used   * - * PARAMETERS:  Op                  - Current Op + * PARAMETERS:  op                  - Current Op   *              walk_state          - Current State   *   * RETURN:      TRUE if result is used, FALSE otherwise @@ -198,7 +198,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  	 *  	 * If there is no parent, or the parent is a scope_op, we are executing  	 * at the method level. An executing method typically has no parent, -	 * since each method is parsed separately.  A method invoked externally +	 * since each method is parsed separately. A method invoked externally  	 * via execute_control_method has a scope_op as the parent.  	 */  	if ((!op->common.parent) || @@ -223,7 +223,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  	}  	/* -	 * Decide what to do with the result based on the parent.  If +	 * Decide what to do with the result based on the parent. If  	 * the parent opcode will not use the result, delete the object.  	 * Otherwise leave it as is, it will be deleted when it is used  	 * as an operand later. @@ -240,7 +240,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  		case AML_IF_OP:  		case AML_WHILE_OP: -  			/*  			 * If we are executing the predicate AND this is the predicate op,  			 * we will use the return value @@ -254,7 +253,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  			break;  		default: +  			/* Ignore other control opcodes */ +  			break;  		} @@ -263,10 +264,9 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  		goto result_not_used;  	case AML_CLASS_CREATE: -  		/*  		 * These opcodes allow term_arg(s) as operands and therefore -		 * the operands can be method calls.  The result is used. +		 * the operands can be method calls. The result is used.  		 */  		goto result_used; @@ -284,7 +284,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  			AML_BANK_FIELD_OP)) {  			/*  			 * These opcodes allow term_arg(s) as operands and therefore -			 * the operands can be method calls.  The result is used. +			 * the operands can be method calls. The result is used.  			 */  			goto result_used;  		} @@ -292,7 +292,6 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  		goto result_not_used;  	default: -  		/*  		 * In all other cases. the parent will actually use the return  		 * object, so keep it. @@ -300,7 +299,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  		goto result_used;  	} -      result_used: +result_used:  	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,  			  "Result of [%s] used by Parent [%s] Op=%p\n",  			  acpi_ps_get_opcode_name(op->common.aml_opcode), @@ -309,7 +308,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op,  	return_UINT8(TRUE); -      result_not_used: +result_not_used:  	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH,  			  "Result of [%s] not used by Parent [%s] Op=%p\n",  			  acpi_ps_get_opcode_name(op->common.aml_opcode), @@ -323,15 +322,15 @@ acpi_ds_is_result_used(union acpi_parse_object * op,   *   * FUNCTION:    acpi_ds_delete_result_if_not_used   * - * PARAMETERS:  Op              - Current parse Op + * PARAMETERS:  op              - Current parse Op   *              result_obj      - Result of the operation   *              walk_state      - Current state   *   * RETURN:      Status   * - * DESCRIPTION: Used after interpretation of an opcode.  If there is an internal + * DESCRIPTION: Used after interpretation of an opcode. If there is an internal   *              result descriptor, check if the parent opcode will actually use - *              this result.  If not, delete the result now so that it will + *              this result. If not, delete the result now so that it will   *              not become orphaned.   *   ******************************************************************************/ @@ -376,7 +375,7 @@ acpi_ds_delete_result_if_not_used(union acpi_parse_object *op,   *   * RETURN:      Status   * - * DESCRIPTION: Resolve all operands to their values.  Used to prepare + * DESCRIPTION: Resolve all operands to their values. Used to prepare   *              arguments to a control method invocation (a call from one   *              method to another.)   * @@ -391,7 +390,7 @@ acpi_status acpi_ds_resolve_operands(struct acpi_walk_state *walk_state)  	/*  	 * Attempt to resolve each of the valid operands -	 * Method arguments are passed by reference, not by value.  This means +	 * Method arguments are passed by reference, not by value. This means  	 * that the actual objects are passed, not copies of the objects.  	 */  	for (i = 0; i < walk_state->num_operands; i++) { @@ -445,13 +444,13 @@ void acpi_ds_clear_operands(struct acpi_walk_state *walk_state)   * FUNCTION:    acpi_ds_create_operand   *   * PARAMETERS:  walk_state      - Current walk state - *              Arg             - Parse object for the argument + *              arg             - Parse object for the argument   *              arg_index       - Which argument (zero based)   *   * RETURN:      Status   *   * DESCRIPTION: Translate a parse tree object that is an argument to an AML - *              opcode to the equivalent interpreter object.  This may include + *              opcode to the equivalent interpreter object. This may include   *              looking up a name or entering a new name into the internal   *              namespace.   * @@ -496,9 +495,9 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,  		/*  		 * Special handling for buffer_field declarations. This is a deferred  		 * opcode that unfortunately defines the field name as the last -		 * parameter instead of the first.  We get here when we are performing +		 * parameter instead of the first. We get here when we are performing  		 * the deferred execution, so the actual name of the field is already -		 * in the namespace.  We don't want to attempt to look it up again +		 * in the namespace. We don't want to attempt to look it up again  		 * because we may be executing in a different scope than where the  		 * actual opcode exists.  		 */ @@ -560,7 +559,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,  					 * indicate this to the interpreter, set the  					 * object to the root  					 */ -					obj_desc = ACPI_CAST_PTR(union +					obj_desc = +					    ACPI_CAST_PTR(union  								 acpi_operand_object,  								 acpi_gbl_root_node);  					status = AE_OK; @@ -604,8 +604,8 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,  			/*  			 * If the name is null, this means that this is an  			 * optional result parameter that was not specified -			 * in the original ASL.  Create a Zero Constant for a -			 * placeholder.  (Store to a constant is a Noop.) +			 * in the original ASL. Create a Zero Constant for a +			 * placeholder. (Store to a constant is a Noop.)  			 */  			opcode = AML_ZERO_OP;	/* Has no arguments! */ @@ -727,32 +727,31 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state,  		index++;  	} -	index--; +	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, +			  "NumOperands %d, ArgCount %d, Index %d\n", +			  walk_state->num_operands, arg_count, index)); -	/* It is the appropriate order to get objects from the Result stack */ +	/* Create the interpreter arguments, in reverse order */ +	index--;  	for (i = 0; i < arg_count; i++) {  		arg = arguments[index]; - -		/* Force the filling of the operand stack in inverse order */ - -		walk_state->operand_index = (u8) index; +		walk_state->operand_index = (u8)index;  		status = acpi_ds_create_operand(walk_state, arg, index);  		if (ACPI_FAILURE(status)) {  			goto cleanup;  		} -		index--; -  		ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, -				  "Arg #%u (%p) done, Arg1=%p\n", index, arg, -				  first_arg)); +				  "Created Arg #%u (%p) %u args total\n", +				  index, arg, arg_count)); +		index--;  	}  	return_ACPI_STATUS(status); -      cleanup: +cleanup:  	/*  	 * We must undo everything done above; meaning that we must  	 * pop everything off of the operand stack and delete those @@ -851,7 +850,7 @@ acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state)  		goto exit;  	} -      push_result: +push_result:  	walk_state->result_obj = new_obj_desc; @@ -863,7 +862,7 @@ acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state)  		op->common.flags |= ACPI_PARSEOP_IN_STACK;  	} -      exit: +exit:  	return_ACPI_STATUS(status);  }  | 
