status = -ENODEV; 
status = -EFAULT; 
static int acpi_processor_get_power_info_cst(struct acpi_processor *pr){	acpi_status status = 0;	acpi_integer count;	int i;	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };	union acpi_object *cst;	ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_cst");	if (nocst)		return_VALUE(-ENODEV);	pr->power.count = 0;	for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++)		memset(&(pr->power.states[i]), 0,		       sizeof(struct acpi_processor_cx));	status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer);	if (ACPI_FAILURE(status)) {		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No _CST, giving up\n"));		return_VALUE(-ENODEV);	}	cst = (union acpi_object *)buffer.pointer;	/* There must be at least 2 elements */	if (!cst || (cst->type != ACPI_TYPE_PACKAGE) || cst->package.count < 2) {		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,				  "not enough elements in _CST\n"));		status = -EFAULT;		goto end;	}	count = cst->package.elements[0].integer.value;	/* Validate number of power states. */	if (count < 1 || count != cst->package.count - 1) {		ACPI_DEBUG_PRINT((ACPI_DB_ERROR,				  "count given by _CST is not valid\n"));		status = -EFAULT;		goto end;	}	/* We support up to ACPI_PROCESSOR_MAX_POWER. */	if (count > ACPI_PROCESSOR_MAX_POWER) {		printk(KERN_WARNING		       "Limiting number of power states to max (%d)\n",		       ACPI_PROCESSOR_MAX_POWER);		printk(KERN_WARNING		       "Please increase ACPI_PROCESSOR_MAX_POWER if needed.\n");		count = ACPI_PROCESSOR_MAX_POWER;	}	/* Tell driver that at least _CST is supported. */	pr->flags.has_cst = 1;	for (i = 1; i <= count; i++) {		union acpi_object *element;		union acpi_object *obj;		struct acpi_power_register *reg;		struct acpi_processor_cx cx;		memset(&cx, 0, sizeof(cx));		element = (union acpi_object *)&(cst->package.elements[i]);		if (element->type != ACPI_TYPE_PACKAGE)			continue;		if (element->package.count != 4)			continue;		obj = (union acpi_object *)&(element->package.elements[0]);		if (obj->type != ACPI_TYPE_BUFFER)			continue;		reg = (struct acpi_power_register *)obj->buffer.pointer;		if (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO &&		    (reg->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE))			continue;		cx.address = (reg->space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) ?		    0 : reg->address;		/* There should be an easy way to extract an integer... */		obj = (union acpi_object *)&(element->package.elements[1]);		if (obj->type != ACPI_TYPE_INTEGER)			continue;		cx.type = obj->integer.value;		if ((cx.type != ACPI_STATE_C1) &&		    (reg->space_id != ACPI_ADR_SPACE_SYSTEM_IO))			continue;		if ((cx.type < ACPI_STATE_C1) || (cx.type > ACPI_STATE_C3))			continue;		obj = (union acpi_object *)&(element->package.elements[2]);		if (obj->type != ACPI_TYPE_INTEGER)			continue;		cx.latency = obj->integer.value;		obj = (union acpi_object *)&(element->package.elements[3]);		if (obj->type != ACPI_TYPE_INTEGER)			continue;		cx.power = obj->integer.value;		(pr->power.count)++;		memcpy(&(pr->power.states[pr->power.count]), &cx, sizeof(cx));	}	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d power states\n",			  pr->power.count));	/* Validate number of power states discovered */	if (pr->power.count < 2)		status = -ENODEV;      end:	acpi_os_free(buffer.pointer);	return_VALUE(status);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/6d93c64803a5fea84839789aae13290419c62d92/processor_idle.c/clean/drivers/acpi/processor_idle.c