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

📄 exoparg1.c

📁 linux-2.4.29操作系统的源码
💻 C
📖 第 1 页 / 共 2 页
字号:
		status = acpi_ex_convert_to_string (operand[0], &return_desc, 10, ACPI_UINT32_MAX, walk_state);		break;	case AML_TO_HEXSTRING_OP:       /* to_hex_string (Data, Result) */		status = acpi_ex_convert_to_string (operand[0], &return_desc, 16, ACPI_UINT32_MAX, walk_state);		break;	case AML_TO_BUFFER_OP:          /* to_buffer (Data, Result) */		status = acpi_ex_convert_to_buffer (operand[0], &return_desc, walk_state);		break;	case AML_TO_INTEGER_OP:         /* to_integer (Data, Result) */		status = acpi_ex_convert_to_integer (operand[0], &return_desc, walk_state);		break;	case AML_SHIFT_LEFT_BIT_OP:     /*  shift_left_bit (Source, bit_num) */	case AML_SHIFT_RIGHT_BIT_OP:    /*  shift_right_bit (Source, bit_num) */		/*		 * These are two obsolete opcodes		 */		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s is obsolete and not implemented\n",				  acpi_ps_get_opcode_name (walk_state->opcode)));		status = AE_SUPPORT;		goto cleanup;	default:                        /* Unknown opcode */		ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_1T_1R: Unknown opcode %X\n",			walk_state->opcode));		status = AE_AML_BAD_OPCODE;		goto cleanup;	}	/*	 * Store the return value computed above into the target object	 */	status = acpi_ex_store (return_desc, operand[1], walk_state);cleanup:	if (!walk_state->result_obj) {		walk_state->result_obj = return_desc;	}	/* Delete return object on error */	if (ACPI_FAILURE (status)) {		acpi_ut_remove_reference (return_desc);	}	return_ACPI_STATUS (status);}/******************************************************************************* * * FUNCTION:    acpi_ex_opcode_1A_0T_1R * * PARAMETERS:  walk_state          - Current state (contains AML opcode) * * RETURN:      Status * * DESCRIPTION: Execute opcode with one argument, no target, and a return value * ******************************************************************************/acpi_statusacpi_ex_opcode_1A_0T_1R (	struct acpi_walk_state          *walk_state){	union acpi_operand_object       **operand = &walk_state->operands[0];	union acpi_operand_object       *temp_desc;	union acpi_operand_object       *return_desc = NULL;	acpi_status                     status = AE_OK;	u32                             type;	acpi_integer                    value;	ACPI_FUNCTION_TRACE_STR ("ex_opcode_1A_0T_1R", acpi_ps_get_opcode_name (walk_state->opcode));	/* Examine the AML opcode */	switch (walk_state->opcode) {	case AML_LNOT_OP:               /* LNot (Operand) */		return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);		if (!return_desc) {			status = AE_NO_MEMORY;			goto cleanup;		}		return_desc->integer.value = !operand[0]->integer.value;		break;	case AML_DECREMENT_OP:          /* Decrement (Operand)  */	case AML_INCREMENT_OP:          /* Increment (Operand)  */		/*		 * Since we are expecting a Reference operand, it		 * can be either a NS Node or an internal object.		 */		return_desc = operand[0];		if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_OPERAND) {			/* Internal reference object - prevent deletion */			acpi_ut_add_reference (return_desc);		}		/*		 * Convert the return_desc Reference to a Number		 * (This removes a reference on the return_desc object)		 */		status = acpi_ex_resolve_operands (AML_LNOT_OP, &return_desc, walk_state);		if (ACPI_FAILURE (status)) {			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",				acpi_ps_get_opcode_name (walk_state->opcode), acpi_format_exception(status)));			goto cleanup;		}		/*		 * return_desc is now guaranteed to be an Integer object		 * Do the actual increment or decrement		 */		if (AML_INCREMENT_OP == walk_state->opcode) {			return_desc->integer.value++;		}		else {			return_desc->integer.value--;		}		/* Store the result back in the original descriptor */		status = acpi_ex_store (return_desc, operand[0], walk_state);		break;	case AML_TYPE_OP:               /* object_type (source_object) */		/* Get the type of the base object */		status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, NULL);		if (ACPI_FAILURE (status)) {			goto cleanup;		}		/* Allocate a descriptor to hold the type. */		return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);		if (!return_desc) {			status = AE_NO_MEMORY;			goto cleanup;		}		return_desc->integer.value = type;		break;	case AML_SIZE_OF_OP:            /* size_of (source_object) */		/* Get the base object */		status = acpi_ex_resolve_multiple (walk_state, operand[0], &type, &temp_desc);		if (ACPI_FAILURE (status)) {			goto cleanup;		}		/*		 * Type is guaranteed to be a buffer, string, or package at this		 * point (even if the original operand was an object reference, it		 * will be resolved and typechecked during operand resolution.)		 */		switch (type) {		case ACPI_TYPE_BUFFER:			value = temp_desc->buffer.length;			break;		case ACPI_TYPE_STRING:			value = temp_desc->string.length;			break;		case ACPI_TYPE_PACKAGE:			value = temp_desc->package.count;			break;		default:			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "size_of, Not Buf/Str/Pkg - found type %s\n",				acpi_ut_get_type_name (type)));			status = AE_AML_OPERAND_TYPE;			goto cleanup;		}		/*		 * Now that we have the size of the object, create a result		 * object to hold the value		 */		return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);		if (!return_desc) {			status = AE_NO_MEMORY;			goto cleanup;		}		return_desc->integer.value = value;		break;	case AML_REF_OF_OP:             /* ref_of (source_object) */		status = acpi_ex_get_object_reference (operand[0], &return_desc, walk_state);		if (ACPI_FAILURE (status)) {			goto cleanup;		}		break;	case AML_DEREF_OF_OP:           /* deref_of (obj_reference | String) */		/* Check for a method local or argument, or standalone String */		if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) != ACPI_DESC_TYPE_NAMED) {			switch (ACPI_GET_OBJECT_TYPE (operand[0])) {			case ACPI_TYPE_LOCAL_REFERENCE:				/*				 * This is a deref_of (local_x | arg_x)				 *				 * Must resolve/dereference the local/arg reference first				 */				switch (operand[0]->reference.opcode) {				case AML_LOCAL_OP:				case AML_ARG_OP:					/* Set Operand[0] to the value of the local/arg */					status = acpi_ds_method_data_get_value (operand[0]->reference.opcode,							 operand[0]->reference.offset, walk_state, &temp_desc);					if (ACPI_FAILURE (status)) {						goto cleanup;					}					/*					 * Delete our reference to the input object and					 * point to the object just retrieved					 */					acpi_ut_remove_reference (operand[0]);					operand[0] = temp_desc;					break;				case AML_REF_OF_OP:					/* Get the object to which the reference refers */					temp_desc = operand[0]->reference.object;					acpi_ut_remove_reference (operand[0]);					operand[0] = temp_desc;					break;				default:					/* Must be an Index op - handled below */					break;				}				break;			case ACPI_TYPE_STRING:				/*				 * This is a deref_of (String). The string is a reference to a named ACPI object.				 *				 * 1) Find the owning Node				 * 2) Dereference the node to an actual object.  Could be a Field, so we nee				 *    to resolve the node to a value.				 */				status = acpi_ns_get_node_by_path (operand[0]->string.pointer,						  walk_state->scope_info->scope.node, ACPI_NS_SEARCH_PARENT,						  ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc));				if (ACPI_FAILURE (status)) {					goto cleanup;				}				status = acpi_ex_resolve_node_to_value (						  ACPI_CAST_INDIRECT_PTR (struct acpi_namespace_node, &return_desc), walk_state);				goto cleanup;			default:				status = AE_AML_OPERAND_TYPE;				goto cleanup;			}		}		/* Operand[0] may have changed from the code above */		if (ACPI_GET_DESCRIPTOR_TYPE (operand[0]) == ACPI_DESC_TYPE_NAMED) {			/*			 * This is a deref_of (object_reference)			 * Get the actual object from the Node (This is the dereference).			 * -- This case may only happen when a local_x or arg_x is dereferenced above.			 */			return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) operand[0]);		}		else {			/*			 * This must be a reference object produced by either the Index() or			 * ref_of() operator			 */			switch (operand[0]->reference.opcode) {			case AML_INDEX_OP:				/*				 * The target type for the Index operator must be				 * either a Buffer or a Package				 */				switch (operand[0]->reference.target_type) {				case ACPI_TYPE_BUFFER_FIELD:					temp_desc = operand[0]->reference.object;					/*					 * Create a new object that contains one element of the					 * buffer -- the element pointed to by the index.					 *					 * NOTE: index into a buffer is NOT a pointer to a					 * sub-buffer of the main buffer, it is only a pointer to a					 * single element (byte) of the buffer!					 */					return_desc = acpi_ut_create_internal_object (ACPI_TYPE_INTEGER);					if (!return_desc) {						status = AE_NO_MEMORY;						goto cleanup;					}					/*					 * Since we are returning the value of the buffer at the					 * indexed location, we don't need to add an additional					 * reference to the buffer itself.					 */					return_desc->integer.value =						temp_desc->buffer.pointer[operand[0]->reference.offset];					break;				case ACPI_TYPE_PACKAGE:					/*					 * Return the referenced element of the package.  We must add					 * another reference to the referenced object, however.					 */					return_desc = *(operand[0]->reference.where);					if (!return_desc) {						/*						 * We can't return a NULL dereferenced value.  This is						 * an uninitialized package element and is thus a						 * severe error.						 */						ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "NULL package element obj %p\n",							operand[0]));						status = AE_AML_UNINITIALIZED_ELEMENT;						goto cleanup;					}					acpi_ut_add_reference (return_desc);					break;				default:					ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Index target_type %X in obj %p\n",						operand[0]->reference.target_type, operand[0]));					status = AE_AML_OPERAND_TYPE;					goto cleanup;				}				break;			case AML_REF_OF_OP:				return_desc = operand[0]->reference.object;				if (ACPI_GET_DESCRIPTOR_TYPE (return_desc) == ACPI_DESC_TYPE_NAMED) {					return_desc = acpi_ns_get_attached_object ((struct acpi_namespace_node *) return_desc);				}				/* Add another reference to the object! */				acpi_ut_add_reference (return_desc);				break;			default:				ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode in ref(%p) - %X\n",					operand[0], operand[0]->reference.opcode));				status = AE_TYPE;				goto cleanup;			}		}		break;	default:		ACPI_REPORT_ERROR (("acpi_ex_opcode_1A_0T_1R: Unknown opcode %X\n",			walk_state->opcode));		status = AE_AML_BAD_OPCODE;		goto cleanup;	}cleanup:	/* Delete return object on error */	if (ACPI_FAILURE (status)) {		acpi_ut_remove_reference (return_desc);	}	walk_state->result_obj = return_desc;	return_ACPI_STATUS (status);}

⌨️ 快捷键说明

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