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

📄 dswstate.c

📁 内核linux2.4.20,可跟rtlinux3.2打补丁 组成实时linux系统,编译内核
💻 C
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************** * * Module Name: dswstate - Dispatcher parse tree walk management routines *              $Revision: 54 $ * *****************************************************************************//* *  Copyright (C) 2000, 2001 R. Byron Moore * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */#include "acpi.h"#include "amlcode.h"#include "acparser.h"#include "acdispat.h"#include "acnamesp.h"#include "acinterp.h"#define _COMPONENT          ACPI_DISPATCHER	 MODULE_NAME         ("dswstate")/******************************************************************************* * * FUNCTION:    Acpi_ds_result_insert * * PARAMETERS:  Object              - Object to push *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Push an object onto this walk's result stack * ******************************************************************************/acpi_statusacpi_ds_result_insert (	void                    *object,	u32                     index,	acpi_walk_state         *walk_state){	acpi_generic_state      *state;	PROC_NAME ("Ds_result_insert");	state = walk_state->results;	if (!state) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",			walk_state));		return (AE_NOT_EXIST);	}	if (index >= OBJ_NUM_OPERANDS) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Index out of range: %X Obj=%p State=%p Num=%X\n",			index, object, walk_state, state->results.num_results));		return (AE_BAD_PARAMETER);	}	if (!object) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Null Object! Index=%X Obj=%p State=%p Num=%X\n",			index, object, walk_state, state->results.num_results));		return (AE_BAD_PARAMETER);	}	state->results.obj_desc [index] = object;	state->results.num_results++;	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,		"Obj=%p [%s] State=%p Num=%X Cur=%X\n",		object, object ? acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type) : "NULL",		walk_state, state->results.num_results, walk_state->current_result));	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_result_remove * * PARAMETERS:  Object              - Where to return the popped object *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Pop an object off the bottom of this walk's result stack.  In *              other words, this is a FIFO. * ******************************************************************************/acpi_statusacpi_ds_result_remove (	acpi_operand_object     **object,	u32                     index,	acpi_walk_state         *walk_state){	acpi_generic_state      *state;	PROC_NAME ("Ds_result_remove");	state = walk_state->results;	if (!state) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",			walk_state));		return (AE_NOT_EXIST);	}	if (index >= OBJ_NUM_OPERANDS) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Index out of range: %X State=%p Num=%X\n",			index, walk_state, state->results.num_results));	}	/* Check for a valid result object */	if (!state->results.obj_desc [index]) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Null operand! State=%p #Ops=%X, Index=%X\n",			walk_state, state->results.num_results, index));		return (AE_AML_NO_RETURN_VALUE);	}	/* Remove the object */	state->results.num_results--;	*object = state->results.obj_desc [index];	state->results.obj_desc [index] = NULL;	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,		"Obj=%p [%s] Index=%X State=%p Num=%X\n",		*object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL",		index, walk_state, state->results.num_results));	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_result_pop * * PARAMETERS:  Object              - Where to return the popped object *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Pop an object off the bottom of this walk's result stack.  In *              other words, this is a FIFO. * ******************************************************************************/acpi_statusacpi_ds_result_pop (	acpi_operand_object     **object,	acpi_walk_state         *walk_state){	u32                     index;	acpi_generic_state      *state;	PROC_NAME ("Ds_result_pop");	state = walk_state->results;	if (!state) {		return (AE_OK);	}	if (!state->results.num_results) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",			walk_state));		return (AE_AML_NO_RETURN_VALUE);	}	/* Remove top element */	state->results.num_results--;	for (index = OBJ_NUM_OPERANDS; index; index--) {		/* Check for a valid result object */		if (state->results.obj_desc [index -1]) {			*object = state->results.obj_desc [index -1];			state->results.obj_desc [index -1] = NULL;			ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",				*object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL",				index -1, walk_state, state->results.num_results));			return (AE_OK);		}	}	ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state));	return (AE_AML_NO_RETURN_VALUE);}/******************************************************************************* * * FUNCTION:    Acpi_ds_result_pop_from_bottom * * PARAMETERS:  Object              - Where to return the popped object *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Pop an object off the bottom of this walk's result stack.  In *              other words, this is a FIFO. * ******************************************************************************/acpi_statusacpi_ds_result_pop_from_bottom (	acpi_operand_object     **object,	acpi_walk_state         *walk_state){	u32                     index;	acpi_generic_state      *state;	PROC_NAME ("Ds_result_pop_from_bottom");	state = walk_state->results;	if (!state) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Warning: No result object pushed! State=%p\n", walk_state));		return (AE_NOT_EXIST);	}	if (!state->results.num_results) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", walk_state));		return (AE_AML_NO_RETURN_VALUE);	}	/* Remove Bottom element */	*object = state->results.obj_desc [0];	/* Push entire stack down one element */	for (index = 0; index < state->results.num_results; index++) {		state->results.obj_desc [index] = state->results.obj_desc [index + 1];	}	state->results.num_results--;	/* Check for a valid result object */	if (!*object) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",			walk_state, state->results.num_results, index));		return (AE_AML_NO_RETURN_VALUE);	}	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",		*object, (*object) ? acpi_ut_get_type_name ((*object)->common.type) : "NULL",		state, walk_state));	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_result_push * * PARAMETERS:  Object              - Where to return the popped object *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Push an object onto the current result stack * ******************************************************************************/acpi_statusacpi_ds_result_push (	acpi_operand_object     *object,	acpi_walk_state         *walk_state){	acpi_generic_state      *state;	PROC_NAME ("Ds_result_push");	state = walk_state->results;	if (!state) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result stack frame\n"));		return (AE_AML_INTERNAL);	}	if (state->results.num_results == OBJ_NUM_OPERANDS) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Result stack overflow: Obj=%p State=%p Num=%X\n",			object, walk_state, state->results.num_results));		return (AE_STACK_OVERFLOW);	}	if (!object) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n",			object, walk_state, state->results.num_results));		return (AE_BAD_PARAMETER);	}	state->results.obj_desc [state->results.num_results] = object;	state->results.num_results++;	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",		object, object ? acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type) : "NULL",		walk_state, state->results.num_results, walk_state->current_result));	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_result_stack_push * * PARAMETERS:  Object              - Object to push *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: * ******************************************************************************/acpi_statusacpi_ds_result_stack_push (	acpi_walk_state         *walk_state){	acpi_generic_state      *state;	PROC_NAME ("Ds_result_stack_push");	state = acpi_ut_create_generic_state ();	if (!state) {		return (AE_NO_MEMORY);	}	state->common.data_type = ACPI_DESC_TYPE_STATE_RESULT;	acpi_ut_push_generic_state (&walk_state->results, state);	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",		state, walk_state));	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_result_stack_pop * * PARAMETERS:  Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: * ******************************************************************************/acpi_statusacpi_ds_result_stack_pop (	acpi_walk_state         *walk_state){	acpi_generic_state      *state;	PROC_NAME ("Ds_result_stack_pop");	/* Check for stack underflow */	if (walk_state->results == NULL) {		ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",			walk_state));		return (AE_AML_NO_OPERAND);	}	state = acpi_ut_pop_generic_state (&walk_state->results);	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,		"Result=%p Remaining_results=%X State=%p\n",		state, state->results.num_results, walk_state));	acpi_ut_delete_generic_state (state);	return (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_obj_stack_delete_all * * PARAMETERS:  Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Clear the object stack by deleting all objects that are on it. *              Should be used with great care, if at all! * ******************************************************************************/acpi_statusacpi_ds_obj_stack_delete_all (	acpi_walk_state         *walk_state){	u32                     i;	FUNCTION_TRACE_PTR ("Ds_obj_stack_delete_all", walk_state);	/* The stack size is configurable, but fixed */	for (i = 0; i < OBJ_NUM_OPERANDS; i++) {		if (walk_state->operands[i]) {			acpi_ut_remove_reference (walk_state->operands[i]);			walk_state->operands[i] = NULL;		}	}	return_ACPI_STATUS (AE_OK);}/******************************************************************************* * * FUNCTION:    Acpi_ds_obj_stack_push * * PARAMETERS:  Object              - Object to push *              Walk_state          - Current Walk state * * RETURN:      Status * * DESCRIPTION: Push an object onto this walk's object/operand stack * ******************************************************************************/acpi_statusacpi_ds_obj_stack_push (	void                    *object,	acpi_walk_state         *walk_state){	PROC_NAME ("Ds_obj_stack_push");	/* Check for stack overflow */	if (walk_state->num_operands >= OBJ_NUM_OPERANDS) {		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"overflow! Obj=%p State=%p #Ops=%X\n",			object, walk_state, walk_state->num_operands));		return (AE_STACK_OVERFLOW);	}	/* Put the object onto the stack */	walk_state->operands [walk_state->num_operands] = object;	walk_state->num_operands++;	ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",			  object, acpi_ut_get_type_name (((acpi_operand_object *) object)->common.type),			  walk_state, walk_state->num_operands));	return (AE_OK);}#if 0/******************************************************************************* * * FUNCTION:    Acpi_ds_obj_stack_pop_object * * 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_object (	acpi_operand_object     **object,	acpi_walk_state         *walk_state){	PROC_NAME ("Ds_obj_stack_pop_object");	/* Check for stack underflow */

⌨️ 快捷键说明

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