⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsmethod.c

📁 h内核
💻 C
📖 第 1 页 / 共 2 页
字号:
			  this_walk_state->method_node);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	if (!(obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY)) {		/* 1) Parse: Create a new walk state for the preempting walk */		next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,				  op, obj_desc, NULL);		if (!next_walk_state) {			return_ACPI_STATUS (AE_NO_MEMORY);		}		/* Create and init a Root Node */		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_ds_delete_walk_state (next_walk_state);			goto cleanup;		}		/* Begin AML parse */		status = acpi_ps_parse_aml (next_walk_state);		acpi_ps_delete_parse_tree (op);	}	/* 2) Execute: Create a new state for the preempting walk */	next_walk_state = acpi_ds_create_walk_state (obj_desc->method.owning_id,			  NULL, obj_desc, thread);	if (!next_walk_state) {		status = AE_NO_MEMORY;		goto cleanup;	}	/*	 * The resolved arguments were put on the previous walk state's operand	 * stack.  Operands on the previous walk state stack always	 * start at index 0.	 * Null terminate the list of arguments	 */	this_walk_state->operands [this_walk_state->num_operands] = NULL;	info.parameters = &this_walk_state->operands[0];	info.parameter_type = ACPI_PARAM_ARGS;	status = acpi_ds_init_aml_walk (next_walk_state, NULL, method_node,			  obj_desc->method.aml_start, obj_desc->method.aml_length,			  &info, 3);	if (ACPI_FAILURE (status)) {		goto cleanup;	}	/*	 * Delete the operands on the previous walkstate operand stack	 * (they were copied to new objects)	 */	for (i = 0; i < obj_desc->method.param_count; i++) {		acpi_ut_remove_reference (this_walk_state->operands [i]);		this_walk_state->operands [i] = NULL;	}	/* Clear the operand stack */	this_walk_state->num_operands = 0;	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,		"Starting nested execution, newstate=%p\n", next_walk_state));	if (obj_desc->method.method_flags & AML_METHOD_INTERNAL_ONLY) {		status = obj_desc->method.implementation (next_walk_state);		return_ACPI_STATUS (status);	}	return_ACPI_STATUS (AE_OK);	/* On error, we must delete the new walk state */cleanup:	if (next_walk_state && (next_walk_state->method_desc)) {		/* Decrement the thread count on the method parse tree */	   next_walk_state->method_desc->method.thread_count--;	}	(void) acpi_ds_terminate_control_method (next_walk_state);	acpi_ds_delete_walk_state (next_walk_state);	return_ACPI_STATUS (status);}/******************************************************************************* * * FUNCTION:    acpi_ds_restart_control_method * * PARAMETERS:  walk_state          - State for preempted method (caller) *              return_desc         - Return value from the called method * * RETURN:      Status * * DESCRIPTION: Restart a method that was preempted by another (nested) method *              invocation.  Handle the return value (if any) from the callee. * ******************************************************************************/acpi_statusacpi_ds_restart_control_method (	struct acpi_walk_state          *walk_state,	union acpi_operand_object       *return_desc){	acpi_status                     status;	ACPI_FUNCTION_TRACE_PTR ("ds_restart_control_method", walk_state);	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,		"****Restart [%4.4s] Op %p return_value_from_callee %p\n",		(char *) &walk_state->method_node->name, walk_state->method_call_op,		return_desc));	ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,		"    return_from_this_method_used?=%X res_stack %p Walk %p\n",		walk_state->return_used,		walk_state->results, walk_state));	/* Did the called method return a value? */	if (return_desc) {		/* Are we actually going to use the return value? */		if (walk_state->return_used) {			/* Save the return value from the previous method */			status = acpi_ds_result_push (return_desc, walk_state);			if (ACPI_FAILURE (status)) {				acpi_ut_remove_reference (return_desc);				return_ACPI_STATUS (status);			}			/*			 * Save as THIS method's return value in case it is returned			 * immediately to yet another method			 */			walk_state->return_desc = return_desc;		}		else {			/*			 * Delete the return value if it will not be used by the			 * calling method			 */			acpi_ut_remove_reference (return_desc);		}	}	return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION:    acpi_ds_terminate_control_method * * PARAMETERS:  walk_state          - State of the method * * RETURN:      Status * * DESCRIPTION: Terminate a control method.  Delete everything that the method *              created, delete all locals and arguments, and delete the parse *              tree if requested. * ******************************************************************************/acpi_statusacpi_ds_terminate_control_method (	struct acpi_walk_state          *walk_state){	union acpi_operand_object       *obj_desc;	struct acpi_namespace_node      *method_node;	acpi_status                     status;	ACPI_FUNCTION_TRACE_PTR ("ds_terminate_control_method", walk_state);	if (!walk_state) {		return (AE_BAD_PARAMETER);	}	/* The current method object was saved in the walk state */	obj_desc = walk_state->method_desc;	if (!obj_desc) {		return_ACPI_STATUS (AE_OK);	}	/* Delete all arguments and locals */	acpi_ds_method_data_delete_all (walk_state);	/*	 * Lock the parser while we terminate this method.	 * If this is the last thread executing the method,	 * we have additional cleanup to perform	 */	status = acpi_ut_acquire_mutex (ACPI_MTX_PARSER);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	/* Signal completion of the execution of this method if necessary */	if (walk_state->method_desc->method.semaphore) {		status = acpi_os_signal_semaphore (				  walk_state->method_desc->method.semaphore, 1);		if (ACPI_FAILURE (status)) {			ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));			status = AE_OK;			/* Ignore error and continue cleanup */		}	}	if (walk_state->method_desc->method.thread_count) {		ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,			"*** Not deleting method namespace, there are still %d threads\n",			walk_state->method_desc->method.thread_count));	}	if (!walk_state->method_desc->method.thread_count) {		/*		 * Support to dynamically change a method from not_serialized to		 * Serialized if it appears that the method is written foolishly and		 * does not support multiple thread execution.  The best example of this		 * is if such a method creates namespace objects and blocks.  A second		 * thread will fail with an AE_ALREADY_EXISTS exception		 *		 * This code is here because we must wait until the last thread exits		 * before creating the synchronization semaphore.		 */		if ((walk_state->method_desc->method.concurrency == 1) &&			(!walk_state->method_desc->method.semaphore)) {			status = acpi_os_create_semaphore (1,					 1,					 &walk_state->method_desc->method.semaphore);		}		/*		 * There are no more threads executing this method.  Perform		 * additional cleanup.		 *		 * The method Node is stored in the walk state		 */		method_node = walk_state->method_node;		/*		 * Delete any namespace entries created immediately underneath		 * the method		 */		status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE);		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}		if (method_node->child) {			acpi_ns_delete_namespace_subtree (method_node);		}		/*		 * Delete any namespace entries created anywhere else within		 * the namespace		 */		acpi_ns_delete_namespace_by_owner (walk_state->method_desc->method.owning_id);		status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE);		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}	}	status = acpi_ut_release_mutex (ACPI_MTX_PARSER);	return_ACPI_STATUS (status);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -