/* Increment reference count by the ref count of the parent package -1 */ 
/* Increment ref count by the ref count of the parent package-1 */ 
acpi_ex_store_object_to_index (	union acpi_operand_object       *source_desc,	union acpi_operand_object       *index_desc,	struct acpi_walk_state          *walk_state){	acpi_status                     status = AE_OK;	union acpi_operand_object       *obj_desc;	union acpi_operand_object       *new_desc;	u8                              value = 0;	u32                             i;	ACPI_FUNCTION_TRACE ("ex_store_object_to_index");	/*	 * Destination must be a reference pointer, and	 * must point to either a buffer or a package	 */	switch (index_desc->reference.target_type) {	case ACPI_TYPE_PACKAGE:		/*		 * Storing to a package element. Copy the object and replace		 * any existing object with the new object. No implicit		 * conversion is performed.		 *		 * The object at *(index_desc->Reference.Where) is the		 * element within the package that is to be modified.		 * The parent package object is at index_desc->Reference.Object		 */		obj_desc = *(index_desc->reference.where);		status = acpi_ut_copy_iobject_to_iobject (source_desc, &new_desc, walk_state);		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}		if (obj_desc) {			/* Decrement reference count by the ref count of the parent package */			for (i = 0; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) {				acpi_ut_remove_reference (obj_desc);			}		}		*(index_desc->reference.where) = new_desc;		/* Increment reference count by the ref count of the parent package -1 */		for (i = 1; i < ((union acpi_operand_object *) index_desc->reference.object)->common.reference_count; i++) {			acpi_ut_add_reference (new_desc);		}		break;	case ACPI_TYPE_BUFFER_FIELD:		/*		 * Store into a Buffer or String (not actually a real buffer_field)		 * at a location defined by an Index.		 *		 * The first 8-bit element of the source object is written to the		 * 8-bit Buffer location defined by the Index destination object,		 * according to the ACPI 2.0 specification.		 */		/*		 * Make sure the target is a Buffer or String. An error should		 * not happen here, since the reference_object was constructed		 * by the INDEX_OP code.		 */		obj_desc = index_desc->reference.object;		if ((ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_BUFFER) &&			(ACPI_GET_OBJECT_TYPE (obj_desc) != ACPI_TYPE_STRING)) {			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);		}		/*		 * The assignment of the individual elements will be slightly		 * different for each source type.		 */		switch (ACPI_GET_OBJECT_TYPE (source_desc)) {		case ACPI_TYPE_INTEGER:			/* Use the least-significant byte of the integer */			value = (u8) (source_desc->integer.value);			break;		case ACPI_TYPE_BUFFER:		case ACPI_TYPE_STRING:			/* Note: Takes advantage of common string/buffer fields */			value = source_desc->buffer.pointer[0];			break;		default:			/* All other types are invalid */			ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,				"Source must be Integer/Buffer/String type, not %s\n",				acpi_ut_get_object_type_name (source_desc)));			return_ACPI_STATUS (AE_AML_OPERAND_TYPE);		}		/* Store the source value into the target buffer byte */		obj_desc->buffer.pointer[index_desc->reference.offset] = value;		break;	default:		ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,			"Target is not a Package or buffer_field\n"));		status = AE_AML_OPERAND_TYPE;		break;	}	return_ACPI_STATUS (status);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/44f6c01242da4e162f28d8e1216a8c7a91174605/exstore.c/clean/drivers/acpi/executer/exstore.c