 /* * the first call to ->target() should result in us actually * writing something to the appropriate registers. */ data->resume = 1;  
acpi_cpufreq_cpu_init (	struct cpufreq_policy   *policy){	unsigned int		i;	unsigned int		cpu = policy->cpu;	struct cpufreq_acpi_io	*data;	unsigned int		result = 0;	union acpi_object		arg0 = {ACPI_TYPE_BUFFER};	u32				arg0_buf[3];	struct acpi_object_list 	arg_list = {1, &arg0};	dprintk("acpi_cpufreq_cpu_init\n");	/* setup arg_list for _PDC settings */        arg0.buffer.length = 12;        arg0.buffer.pointer = (u8 *) arg0_buf;	data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);	if (!data)		return (-ENOMEM);	memset(data, 0, sizeof(struct cpufreq_acpi_io));	acpi_io_data[cpu] = data;	acpi_processor_cpu_init_pdc(&data->acpi_data, cpu, &arg_list);	result = acpi_processor_register_performance(&data->acpi_data, cpu);	data->acpi_data.pdc = NULL;	if (result)		goto err_free;	if (is_const_loops_cpu(cpu)) {		acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;	}	/* capability check */	if (data->acpi_data.state_count <= 1) {		dprintk("No P-States\n");		result = -ENODEV;		goto err_unreg;	}	if ((data->acpi_data.control_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO) ||	    (data->acpi_data.status_register.space_id != ACPI_ADR_SPACE_SYSTEM_IO)) {		dprintk("Unsupported address space [%d, %d]\n",			(u32) (data->acpi_data.control_register.space_id),			(u32) (data->acpi_data.status_register.space_id));		result = -ENODEV;		goto err_unreg;	}	/* alloc freq_table */	data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * (data->acpi_data.state_count + 1), GFP_KERNEL);	if (!data->freq_table) {		result = -ENOMEM;		goto err_unreg;	}	/* detect transition latency */	policy->cpuinfo.transition_latency = 0;	for (i=0; i<data->acpi_data.state_count; i++) {		if ((data->acpi_data.states[i].transition_latency * 1000) > policy->cpuinfo.transition_latency)			policy->cpuinfo.transition_latency = data->acpi_data.states[i].transition_latency * 1000;	}	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;	/* The current speed is unknown and not detectable by ACPI...  */	policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);	/* table init */	for (i=0; i<=data->acpi_data.state_count; i++)	{		data->freq_table[i].index = i;		if (i<data->acpi_data.state_count)			data->freq_table[i].frequency = data->acpi_data.states[i].core_frequency * 1000;		else			data->freq_table[i].frequency = CPUFREQ_TABLE_END;	}	result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);	if (result) {		goto err_freqfree;	}	/* notify BIOS that we exist */	acpi_processor_notify_smm(THIS_MODULE);	printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management activated.\n",	       cpu);	for (i = 0; i < data->acpi_data.state_count; i++)		dprintk("     %cP%d: %d MHz, %d mW, %d uS\n",			(i == data->acpi_data.state?'*':' '), i,			(u32) data->acpi_data.states[i].core_frequency,			(u32) data->acpi_data.states[i].power,			(u32) data->acpi_data.states[i].transition_latency);	cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu);	return (result); err_freqfree:	kfree(data->freq_table); err_unreg:	acpi_processor_unregister_performance(&data->acpi_data, cpu); err_free:	kfree(data);	acpi_io_data[cpu] = NULL;	return (result);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/4b31e77455b868b43e665edceb111c9a330c8e0f/acpi-cpufreq.c/clean/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c