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

📄 dswstate.c

📁 移植到2410开发板上的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
	if (walk_state->num_operands == 0) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Missing operand/stack empty! State=%p #Ops=%X\n",			walk_state, walk_state->num_operands));		*object = NULL;		return (AE_AML_NO_OPERAND);	}	/* Pop the stack */	walk_state->num_operands--;	/* Check for a valid operand */	if (!walk_state->operands [walk_state->num_operands]) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Null operand! State=%p #Ops=%X\n",			walk_state, walk_state->num_operands));		*object = NULL;		return (AE_AML_NO_OPERAND);	}	/* Get operand and set stack entry to null */	*object = walk_state->operands [walk_state->num_operands];	walk_state->operands [walk_state->num_operands] = NULL;	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",			  *object, acpi_ut_get_type_name ((*object)->common.type),			  walk_state, walk_state->num_operands));	return (AE_OK);}#endif/******************************************************************************* * * FUNCTION:    Acpi_ds_obj_stack_pop * * PARAMETERS:  Pop_count           - Number of objects/entries to pop *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Pop this walk's object stack.  Objects on the stack are NOT *              deleted by this routine. * ******************************************************************************/acpi_statusacpi_ds_obj_stack_pop (	u32                     pop_count,	acpi_walk_state         *walk_state){	u32                     i;	PROC_NAME ("Ds_obj_stack_pop");	for (i = 0; i < pop_count; i++) {		/* Check for stack underflow */		if (walk_state->num_operands == 0) {			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,				"Underflow! Count=%X State=%p #Ops=%X\n",				pop_count, walk_state, walk_state->num_operands));			return (AE_STACK_UNDERFLOW);		}		/* Just set the stack entry to null */		walk_state->num_operands--;		walk_state->operands [walk_state->num_operands] = NULL;	}	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",			  pop_count, walk_state, walk_state->num_operands));	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_obj_stack_pop_and_delete * * PARAMETERS:  Pop_count           - Number of objects/entries to pop *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Pop this walk's object stack and delete each object that is *              popped off. * ******************************************************************************/acpi_statusacpi_ds_obj_stack_pop_and_delete (	u32                     pop_count,	acpi_walk_state         *walk_state){	u32                     i;	acpi_operand_object     *obj_desc;	PROC_NAME ("Ds_obj_stack_pop_and_delete");	for (i = 0; i < pop_count; i++) {		/* Check for stack underflow */		if (walk_state->num_operands == 0) {			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,				"Underflow! Count=%X State=%p #Ops=%X\n",				pop_count, walk_state, walk_state->num_operands));			return (AE_STACK_UNDERFLOW);		}		/* Pop the stack and delete an object if present in this stack entry */		walk_state->num_operands--;		obj_desc = walk_state->operands [walk_state->num_operands];		if (obj_desc) {			acpi_ut_remove_reference (walk_state->operands [walk_state->num_operands]);			walk_state->operands [walk_state->num_operands] = NULL;		}	}	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",			  pop_count, walk_state, walk_state->num_operands));	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_obj_stack_get_value * * PARAMETERS:  Index               - Stack index whose value is desired.  Based *                                    on the top of the stack (index=0 == top) *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Retrieve an object from this walk's object stack.  Index must *              be within the range of the current stack pointer. * ******************************************************************************/void *acpi_ds_obj_stack_get_value (	u32                     index,	acpi_walk_state         *walk_state){	FUNCTION_TRACE_PTR ("Ds_obj_stack_get_value", walk_state);	/* Can't do it if the stack is empty */	if (walk_state->num_operands == 0) {		return_PTR (NULL);	}	/* or if the index is past the top of the stack */	if (index > (walk_state->num_operands - (u32) 1)) {		return_PTR (NULL);	}	return_PTR (walk_state->operands[(NATIVE_UINT)(walk_state->num_operands - 1) -			  index]);}/******************************************************************************* * * FUNCTION:    Acpi_ds_get_current_walk_state * * PARAMETERS:  Walk_list       - Get current active state for this walk list * * RETURN:      Pointer to the current walk state * * DESCRIPTION: Get the walk state that is at the head of the list (the "current" *              walk state. * ******************************************************************************/acpi_walk_state *acpi_ds_get_current_walk_state (	acpi_walk_list          *walk_list){	PROC_NAME ("Ds_get_current_walk_state");	ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Ds_get_current_walk_state, =%p\n",		walk_list->walk_state));	if (!walk_list) {		return (NULL);	}	return (walk_list->walk_state);}/******************************************************************************* * * FUNCTION:    Acpi_ds_push_walk_state * * PARAMETERS:  Walk_state      - State to push *              Walk_list       - The list that owns the walk stack * * RETURN:      None * * DESCRIPTION: Place the Walk_state at the head of the state list. * ******************************************************************************/voidacpi_ds_push_walk_state (	acpi_walk_state         *walk_state,	acpi_walk_list          *walk_list){	FUNCTION_TRACE ("Ds_push_walk_state");	walk_state->next    = walk_list->walk_state;	walk_list->walk_state = walk_state;	return_VOID;}/******************************************************************************* * * FUNCTION:    Acpi_ds_pop_walk_state * * PARAMETERS:  Walk_list       - The list that owns the walk stack * * RETURN:      A Walk_state object popped from the stack * * DESCRIPTION: Remove and return the walkstate object that is at the head of *              the walk stack for the given walk list.  NULL indicates that *              the list is empty. * ******************************************************************************/acpi_walk_state *acpi_ds_pop_walk_state (	acpi_walk_list          *walk_list){	acpi_walk_state         *walk_state;	FUNCTION_TRACE ("Ds_pop_walk_state");	walk_state = walk_list->walk_state;	if (walk_state) {		/* Next walk state becomes the current walk state */		walk_list->walk_state = walk_state->next;		/*		 * Don't clear the NEXT field, this serves as an indicator		 * that there is a parent WALK STATE		 *     Walk_state->Next = NULL;		 */	}	return_PTR (walk_state);}/******************************************************************************* * * FUNCTION:    Acpi_ds_create_walk_state * * PARAMETERS:  Origin          - Starting point for this walk *              Walk_list       - Owning walk list * * RETURN:      Pointer to the new walk state. * * DESCRIPTION: Allocate and initialize a new walk state.  The current walk state *              is set to this new state. * ******************************************************************************/acpi_walk_state *acpi_ds_create_walk_state (	acpi_owner_id           owner_id,	acpi_parse_object       *origin,	acpi_operand_object     *mth_desc,	acpi_walk_list          *walk_list){	acpi_walk_state         *walk_state;	acpi_status             status;	FUNCTION_TRACE ("Ds_create_walk_state");	walk_state = acpi_ut_acquire_from_cache (ACPI_MEM_LIST_WALK);	if (!walk_state) {		return_PTR (NULL);	}	walk_state->data_type       = ACPI_DESC_TYPE_WALK;	walk_state->owner_id        = owner_id;	walk_state->origin          = origin;	walk_state->method_desc     = mth_desc;	walk_state->walk_list       = walk_list;	/* Init the method args/local */#ifndef _ACPI_ASL_COMPILER	acpi_ds_method_data_init (walk_state);#endif	/* Create an initial result stack entry */	status = acpi_ds_result_stack_push (walk_state);	if (ACPI_FAILURE (status)) {		return_PTR (NULL);	}	/* Put the new state at the head of the walk list */	if (walk_list) {		acpi_ds_push_walk_state (walk_state, walk_list);	}	return_PTR (walk_state);}#ifndef _ACPI_ASL_COMPILER/******************************************************************************* * * FUNCTION:    Acpi_ds_init_aml_walk * * PARAMETERS:  Walk_state      - New state to be initialized * * RETURN:      None * * DESCRIPTION: Initialize a walk state for a pass 1 or 2 parse tree walk * ******************************************************************************/acpi_statusacpi_ds_init_aml_walk (	acpi_walk_state         *walk_state,	acpi_parse_object       *op,	acpi_namespace_node     *method_node,	u8                      *aml_start,	u32                     aml_length,	acpi_operand_object     **params,	acpi_operand_object     **return_obj_desc,	u32                     pass_number){	acpi_status             status;	acpi_parse_state        *parser_state = &walk_state->parser_state;	FUNCTION_TRACE ("Ds_init_aml_walk");	walk_state->parser_state.aml    =	walk_state->parser_state.aml_start = aml_start;	walk_state->parser_state.aml_end =	walk_state->parser_state.pkg_end = aml_start + aml_length;	/* The Next_op of the Next_walk will be the beginning of the method */	/* TBD: [Restructure] -- obsolete? */	walk_state->next_op             = NULL;	walk_state->params              = params;	walk_state->caller_return_desc  = return_obj_desc;	status = acpi_ps_init_scope (&walk_state->parser_state, op);	if (ACPI_FAILURE (status)) {		return_ACPI_STATUS (status);	}	if (method_node) {		walk_state->parser_state.start_node = method_node;		walk_state->walk_type               = WALK_METHOD;		walk_state->method_node             = method_node;		walk_state->method_desc             = acpi_ns_get_attached_object (method_node);		/* Push start scope on scope stack and make it current  */		status = acpi_ds_scope_stack_push (method_node, ACPI_TYPE_METHOD, walk_state);		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}		/* Init the method arguments */		acpi_ds_method_data_init_args (params, MTH_NUM_ARGS, walk_state);	}	else {		/* Setup the current scope */		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 (parser_state->start_node,					  parser_state->start_node->type, walk_state);			if (ACPI_FAILURE (status)) {				return_ACPI_STATUS (status);			}		}	}	acpi_ds_init_callbacks (walk_state, pass_number);	return_ACPI_STATUS (AE_OK);}#endif/******************************************************************************* * * FUNCTION:    Acpi_ds_delete_walk_state * * PARAMETERS:  Walk_state      - State to delete * * RETURN:      Status * * DESCRIPTION: Delete a walk state including all internal data structures * ******************************************************************************/voidacpi_ds_delete_walk_state (	acpi_walk_state         *walk_state){	acpi_generic_state      *state;	FUNCTION_TRACE_PTR ("Ds_delete_walk_state", walk_state);	if (!walk_state) {		return;	}	if (walk_state->data_type != ACPI_DESC_TYPE_WALK) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", walk_state));		return;	}	if (walk_state->parser_state.scope) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", walk_state));	}   /* Always must free any linked control states */	while (walk_state->control_state) {		state = walk_state->control_state;		walk_state->control_state = state->common.next;		acpi_ut_delete_generic_state (state);	}	/* Always must free any linked parse states */	while (walk_state->scope_info) {		state = walk_state->scope_info;		walk_state->scope_info = state->common.next;		acpi_ut_delete_generic_state (state);	}	/* Always must free any stacked result states */	while (walk_state->results) {		state = walk_state->results;		walk_state->results = state->common.next;		acpi_ut_delete_generic_state (state);	}	acpi_ut_release_to_cache (ACPI_MEM_LIST_WALK, walk_state);	return_VOID;}/****************************************************************************** * * FUNCTION:    Acpi_ds_delete_walk_state_cache * * PARAMETERS:  None * * RETURN:      Status * * DESCRIPTION: Purge the global state object cache.  Used during subsystem *              termination. * ******************************************************************************/voidacpi_ds_delete_walk_state_cache (	void){	FUNCTION_TRACE ("Ds_delete_walk_state_cache");	acpi_ut_delete_generic_cache (ACPI_MEM_LIST_WALK);	return_VOID;}

⌨️ 快捷键说明

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