/* Ensure that the bank_value is not beyond the capacity of the register */  
/* * Ensure that the bank_value is not beyond the capacity of * the register */ 
acpi_ex_field_datum_io (	union acpi_operand_object       *obj_desc,	u32                             field_datum_byte_offset,	acpi_integer                    *value,	u32                             read_write){	acpi_status                     status;	acpi_integer                    local_value;	ACPI_FUNCTION_TRACE_U32 ("ex_field_datum_io", field_datum_byte_offset);	if (read_write == ACPI_READ) {		if (!value) {			local_value = 0;			value = &local_value; /* To support reads without saving return value */		}		/* Clear the entire return buffer first, [Very Important!] */		*value = 0;	}	/*	 * The four types of fields are:	 *	 * buffer_field - Read/write from/to a Buffer	 * region_field - Read/write from/to a Operation Region.	 * bank_field  - Write to a Bank Register, then read/write from/to an op_region	 * index_field - Write to an Index Register, then read/write from/to a Data Register	 */	switch (ACPI_GET_OBJECT_TYPE (obj_desc)) {	case ACPI_TYPE_BUFFER_FIELD:		/*		 * If the buffer_field arguments have not been previously evaluated,		 * evaluate them now and save the results.		 */		if (!(obj_desc->common.flags & AOPOBJ_DATA_VALID)) {			status = acpi_ds_get_buffer_field_arguments (obj_desc);			if (ACPI_FAILURE (status)) {				return_ACPI_STATUS (status);			}		}		if (read_write == ACPI_READ) {			/*			 * Copy the data from the source buffer.			 * Length is the field width in bytes.			 */			ACPI_MEMCPY (value, (obj_desc->buffer_field.buffer_obj)->buffer.pointer					  + obj_desc->buffer_field.base_byte_offset					  + field_datum_byte_offset,					  obj_desc->common_field.access_byte_width);		}		else {			/*			 * Copy the data to the target buffer.			 * Length is the field width in bytes.			 */			ACPI_MEMCPY ((obj_desc->buffer_field.buffer_obj)->buffer.pointer					+ obj_desc->buffer_field.base_byte_offset					+ field_datum_byte_offset,					value, obj_desc->common_field.access_byte_width);		}		status = AE_OK;		break;	case ACPI_TYPE_LOCAL_BANK_FIELD:		/* Ensure that the bank_value is not beyond the capacity of the register */		if (acpi_ex_register_overflow (obj_desc->bank_field.bank_obj,				  (acpi_integer) obj_desc->bank_field.value)) {			return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);		}		/*		 * For bank_fields, we must write the bank_value to the bank_register		 * (itself a region_field) before we can access the data.		 */		status = acpi_ex_insert_into_field (obj_desc->bank_field.bank_obj,				 &obj_desc->bank_field.value,				 sizeof (obj_desc->bank_field.value));		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}		/*		 * Now that the Bank has been selected, fall through to the		 * region_field case and write the datum to the Operation Region		 */		/*lint -fallthrough */	case ACPI_TYPE_LOCAL_REGION_FIELD:		/*		 * For simple region_fields, we just directly access the owning		 * Operation Region.		 */		status = acpi_ex_access_region (obj_desc, field_datum_byte_offset, value,				  read_write);		break;	case ACPI_TYPE_LOCAL_INDEX_FIELD:		/* Ensure that the index_value is not beyond the capacity of the register */		if (acpi_ex_register_overflow (obj_desc->index_field.index_obj,				  (acpi_integer) obj_desc->index_field.value)) {			return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);		}		/* Write the index value to the index_register (itself a region_field) */		field_datum_byte_offset += obj_desc->index_field.value;		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,				"Write to Index Register: Value %8.8X\n",				field_datum_byte_offset));		status = acpi_ex_insert_into_field (obj_desc->index_field.index_obj,				 &field_datum_byte_offset,				 sizeof (field_datum_byte_offset));		if (ACPI_FAILURE (status)) {			return_ACPI_STATUS (status);		}		ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,				"I/O to Data Register: value_ptr %p\n",				value));		if (read_write == ACPI_READ) {			/* Read the datum from the data_register */			status = acpi_ex_extract_from_field (obj_desc->index_field.data_obj,					  value, sizeof (acpi_integer));		}		else {			/* Write the datum to the data_register */			status = acpi_ex_insert_into_field (obj_desc->index_field.data_obj,					  value, sizeof (acpi_integer));		}		break;	default:		ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n",			ACPI_GET_OBJECT_TYPE (obj_desc)));		status = AE_AML_INTERNAL;		break;	}	if (ACPI_SUCCESS (status)) {		if (read_write == ACPI_READ) {			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n",					   ACPI_FORMAT_UINT64 (*value),					   obj_desc->common_field.access_byte_width));		}		else {			ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n",					   ACPI_FORMAT_UINT64 (*value),					   obj_desc->common_field.access_byte_width));		}	}	return_ACPI_STATUS (status);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/44f6c01242da4e162f28d8e1216a8c7a91174605/exfldio.c/buggy/drivers/acpi/executer/exfldio.c