2 * acpi-cpufreq.c - ACPI Processor P-States Driver
4 * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
5 * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * Copyright (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de>
7 * Copyright (C) 2006 Denis Sadykov <denis.m.sadykov@intel.com>
9 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or (at
14 * your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 #include <linux/kernel.h>
29 #include <linux/module.h>
30 #include <linux/init.h>
31 #include <linux/smp.h>
32 #include <linux/sched.h>
33 #include <linux/cpufreq.h>
34 #include <linux/compiler.h>
35 #include <linux/dmi.h>
36 #include <trace/power.h>
38 #include <linux/acpi.h>
40 #include <linux/delay.h>
41 #include <linux/uaccess.h>
43 #include <acpi/processor.h>
46 #include <asm/processor.h>
47 #include <asm/cpufeature.h>
49 #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
52 MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
53 MODULE_DESCRIPTION("ACPI Processor P-States Driver");
54 MODULE_LICENSE("GPL");
57 UNDEFINED_CAPABLE
= 0,
58 SYSTEM_INTEL_MSR_CAPABLE
,
62 #define INTEL_MSR_RANGE (0xffff)
63 #define CPUID_6_ECX_APERFMPERF_CAPABILITY (0x1)
65 struct acpi_cpufreq_data
{
66 struct acpi_processor_performance
*acpi_data
;
67 struct cpufreq_frequency_table
*freq_table
;
68 unsigned int max_freq
;
70 unsigned int cpu_feature
;
71 u64 saved_aperf
, saved_mperf
;
74 static DEFINE_PER_CPU(struct acpi_cpufreq_data
*, drv_data
);
76 DEFINE_TRACE(power_mark
);
78 /* acpi_perf_data is a pointer to percpu data. */
79 static struct acpi_processor_performance
*acpi_perf_data
;
81 static struct cpufreq_driver acpi_cpufreq_driver
;
83 static unsigned int acpi_pstate_strict
;
85 static int check_est_cpu(unsigned int cpuid
)
87 struct cpuinfo_x86
*cpu
= &cpu_data(cpuid
);
89 if (cpu
->x86_vendor
!= X86_VENDOR_INTEL
||
90 !cpu_has(cpu
, X86_FEATURE_EST
))
96 static unsigned extract_io(u32 value
, struct acpi_cpufreq_data
*data
)
98 struct acpi_processor_performance
*perf
;
101 perf
= data
->acpi_data
;
103 for (i
= 0; i
< perf
->state_count
; i
++) {
104 if (value
== perf
->states
[i
].status
)
105 return data
->freq_table
[i
].frequency
;
110 static unsigned extract_msr(u32 msr
, struct acpi_cpufreq_data
*data
)
113 struct acpi_processor_performance
*perf
;
115 msr
&= INTEL_MSR_RANGE
;
116 perf
= data
->acpi_data
;
118 for (i
= 0; data
->freq_table
[i
].frequency
!= CPUFREQ_TABLE_END
; i
++) {
119 if (msr
== perf
->states
[data
->freq_table
[i
].index
].status
)
120 return data
->freq_table
[i
].frequency
;
122 return data
->freq_table
[0].frequency
;
125 static unsigned extract_freq(u32 val
, struct acpi_cpufreq_data
*data
)
127 switch (data
->cpu_feature
) {
128 case SYSTEM_INTEL_MSR_CAPABLE
:
129 return extract_msr(val
, data
);
130 case SYSTEM_IO_CAPABLE
:
131 return extract_io(val
, data
);
148 const struct cpumask
*mask
;
156 /* Called via smp_call_function_single(), on the target CPU */
157 static void do_drv_read(void *_cmd
)
159 struct drv_cmd
*cmd
= _cmd
;
163 case SYSTEM_INTEL_MSR_CAPABLE
:
164 rdmsr(cmd
->addr
.msr
.reg
, cmd
->val
, h
);
166 case SYSTEM_IO_CAPABLE
:
167 acpi_os_read_port((acpi_io_address
)cmd
->addr
.io
.port
,
169 (u32
)cmd
->addr
.io
.bit_width
);
176 /* Called via smp_call_function_many(), on the target CPUs */
177 static void do_drv_write(void *_cmd
)
179 struct drv_cmd
*cmd
= _cmd
;
183 case SYSTEM_INTEL_MSR_CAPABLE
:
184 rdmsr(cmd
->addr
.msr
.reg
, lo
, hi
);
185 lo
= (lo
& ~INTEL_MSR_RANGE
) | (cmd
->val
& INTEL_MSR_RANGE
);
186 wrmsr(cmd
->addr
.msr
.reg
, lo
, hi
);
188 case SYSTEM_IO_CAPABLE
:
189 acpi_os_write_port((acpi_io_address
)cmd
->addr
.io
.port
,
191 (u32
)cmd
->addr
.io
.bit_width
);
198 static void drv_read(struct drv_cmd
*cmd
)
202 smp_call_function_single(cpumask_any(cmd
->mask
), do_drv_read
, cmd
, 1);
205 static void drv_write(struct drv_cmd
*cmd
)
207 smp_call_function_many(cmd
->mask
, do_drv_write
, cmd
, 1);
210 static u32
get_cur_val(const struct cpumask
*mask
)
212 struct acpi_processor_performance
*perf
;
215 if (unlikely(cpumask_empty(mask
)))
218 switch (per_cpu(drv_data
, cpumask_first(mask
))->cpu_feature
) {
219 case SYSTEM_INTEL_MSR_CAPABLE
:
220 cmd
.type
= SYSTEM_INTEL_MSR_CAPABLE
;
221 cmd
.addr
.msr
.reg
= MSR_IA32_PERF_STATUS
;
223 case SYSTEM_IO_CAPABLE
:
224 cmd
.type
= SYSTEM_IO_CAPABLE
;
225 perf
= per_cpu(drv_data
, cpumask_first(mask
))->acpi_data
;
226 cmd
.addr
.io
.port
= perf
->control_register
.address
;
227 cmd
.addr
.io
.bit_width
= perf
->control_register
.bit_width
;
236 dprintk("get_cur_val = %u\n", cmd
.val
);
251 /* Called via smp_call_function_single(), on the target CPU */
252 static void read_measured_perf_ctrs(void *_cur
)
254 struct perf_pair
*cur
= _cur
;
256 rdmsr(MSR_IA32_APERF
, cur
->aperf
.split
.lo
, cur
->aperf
.split
.hi
);
257 rdmsr(MSR_IA32_MPERF
, cur
->mperf
.split
.lo
, cur
->mperf
.split
.hi
);
261 * Return the measured active (C0) frequency on this CPU since last call
264 * Return: Average CPU frequency in terms of max frequency (zero on error)
266 * We use IA32_MPERF and IA32_APERF MSRs to get the measured performance
267 * over a period of time, while CPU is in C0 state.
268 * IA32_MPERF counts at the rate of max advertised frequency
269 * IA32_APERF counts at the rate of actual CPU frequency
270 * Only IA32_APERF/IA32_MPERF ratio is architecturally defined and
271 * no meaning should be associated with absolute values of these MSRs.
273 static unsigned int get_measured_perf(struct cpufreq_policy
*policy
,
276 struct perf_pair readin
, cur
;
277 unsigned int perf_percent
;
280 if (smp_call_function_single(cpu
, read_measured_perf_ctrs
, &readin
, 1))
283 cur
.aperf
.whole
= readin
.aperf
.whole
-
284 per_cpu(drv_data
, cpu
)->saved_aperf
;
285 cur
.mperf
.whole
= readin
.mperf
.whole
-
286 per_cpu(drv_data
, cpu
)->saved_mperf
;
287 per_cpu(drv_data
, cpu
)->saved_aperf
= readin
.aperf
.whole
;
288 per_cpu(drv_data
, cpu
)->saved_mperf
= readin
.mperf
.whole
;
292 * We dont want to do 64 bit divide with 32 bit kernel
293 * Get an approximate value. Return failure in case we cannot get
294 * an approximate value.
296 if (unlikely(cur
.aperf
.split
.hi
|| cur
.mperf
.split
.hi
)) {
300 h
= max_t(u32
, cur
.aperf
.split
.hi
, cur
.mperf
.split
.hi
);
301 shift_count
= fls(h
);
303 cur
.aperf
.whole
>>= shift_count
;
304 cur
.mperf
.whole
>>= shift_count
;
307 if (((unsigned long)(-1) / 100) < cur
.aperf
.split
.lo
) {
309 cur
.aperf
.split
.lo
>>= shift_count
;
310 cur
.mperf
.split
.lo
>>= shift_count
;
313 if (cur
.aperf
.split
.lo
&& cur
.mperf
.split
.lo
)
314 perf_percent
= (cur
.aperf
.split
.lo
* 100) / cur
.mperf
.split
.lo
;
319 if (unlikely(((unsigned long)(-1) / 100) < cur
.aperf
.whole
)) {
321 cur
.aperf
.whole
>>= shift_count
;
322 cur
.mperf
.whole
>>= shift_count
;
325 if (cur
.aperf
.whole
&& cur
.mperf
.whole
)
326 perf_percent
= (cur
.aperf
.whole
* 100) / cur
.mperf
.whole
;
332 retval
= per_cpu(drv_data
, policy
->cpu
)->max_freq
* perf_percent
/ 100;
337 static unsigned int get_cur_freq_on_cpu(unsigned int cpu
)
339 struct acpi_cpufreq_data
*data
= per_cpu(drv_data
, cpu
);
341 unsigned int cached_freq
;
343 dprintk("get_cur_freq_on_cpu (%d)\n", cpu
);
345 if (unlikely(data
== NULL
||
346 data
->acpi_data
== NULL
|| data
->freq_table
== NULL
)) {
350 cached_freq
= data
->freq_table
[data
->acpi_data
->state
].frequency
;
351 freq
= extract_freq(get_cur_val(cpumask_of(cpu
)), data
);
352 if (freq
!= cached_freq
) {
354 * The dreaded BIOS frequency change behind our back.
355 * Force set the frequency on next target call.
360 dprintk("cur freq = %u\n", freq
);
365 static unsigned int check_freqs(const struct cpumask
*mask
, unsigned int freq
,
366 struct acpi_cpufreq_data
*data
)
368 unsigned int cur_freq
;
371 for (i
= 0; i
< 100; i
++) {
372 cur_freq
= extract_freq(get_cur_val(mask
), data
);
373 if (cur_freq
== freq
)
380 static int acpi_cpufreq_target(struct cpufreq_policy
*policy
,
381 unsigned int target_freq
, unsigned int relation
)
383 struct acpi_cpufreq_data
*data
= per_cpu(drv_data
, policy
->cpu
);
384 struct acpi_processor_performance
*perf
;
385 struct cpufreq_freqs freqs
;
387 unsigned int next_state
= 0; /* Index into freq_table */
388 unsigned int next_perf_state
= 0; /* Index into perf table */
391 struct power_trace it
;
393 dprintk("acpi_cpufreq_target %d (%d)\n", target_freq
, policy
->cpu
);
395 if (unlikely(data
== NULL
||
396 data
->acpi_data
== NULL
|| data
->freq_table
== NULL
)) {
400 perf
= data
->acpi_data
;
401 result
= cpufreq_frequency_table_target(policy
,
404 relation
, &next_state
);
405 if (unlikely(result
)) {
410 next_perf_state
= data
->freq_table
[next_state
].index
;
411 if (perf
->state
== next_perf_state
) {
412 if (unlikely(data
->resume
)) {
413 dprintk("Called after resume, resetting to P%d\n",
417 dprintk("Already at target state (P%d)\n",
423 trace_power_mark(&it
, POWER_PSTATE
, next_perf_state
);
425 switch (data
->cpu_feature
) {
426 case SYSTEM_INTEL_MSR_CAPABLE
:
427 cmd
.type
= SYSTEM_INTEL_MSR_CAPABLE
;
428 cmd
.addr
.msr
.reg
= MSR_IA32_PERF_CTL
;
429 cmd
.val
= (u32
) perf
->states
[next_perf_state
].control
;
431 case SYSTEM_IO_CAPABLE
:
432 cmd
.type
= SYSTEM_IO_CAPABLE
;
433 cmd
.addr
.io
.port
= perf
->control_register
.address
;
434 cmd
.addr
.io
.bit_width
= perf
->control_register
.bit_width
;
435 cmd
.val
= (u32
) perf
->states
[next_perf_state
].control
;
442 /* cpufreq holds the hotplug lock, so we are safe from here on */
443 if (policy
->shared_type
!= CPUFREQ_SHARED_TYPE_ANY
)
444 cmd
.mask
= policy
->cpus
;
446 cmd
.mask
= cpumask_of(policy
->cpu
);
448 freqs
.old
= perf
->states
[perf
->state
].core_frequency
* 1000;
449 freqs
.new = data
->freq_table
[next_state
].frequency
;
450 for_each_cpu(i
, cmd
.mask
) {
452 cpufreq_notify_transition(&freqs
, CPUFREQ_PRECHANGE
);
457 if (acpi_pstate_strict
) {
458 if (!check_freqs(cmd
.mask
, freqs
.new, data
)) {
459 dprintk("acpi_cpufreq_target failed (%d)\n",
466 for_each_cpu(i
, cmd
.mask
) {
468 cpufreq_notify_transition(&freqs
, CPUFREQ_POSTCHANGE
);
470 perf
->state
= next_perf_state
;
476 static int acpi_cpufreq_verify(struct cpufreq_policy
*policy
)
478 struct acpi_cpufreq_data
*data
= per_cpu(drv_data
, policy
->cpu
);
480 dprintk("acpi_cpufreq_verify\n");
482 return cpufreq_frequency_table_verify(policy
, data
->freq_table
);
486 acpi_cpufreq_guess_freq(struct acpi_cpufreq_data
*data
, unsigned int cpu
)
488 struct acpi_processor_performance
*perf
= data
->acpi_data
;
491 /* search the closest match to cpu_khz */
494 unsigned long freqn
= perf
->states
[0].core_frequency
* 1000;
496 for (i
= 0; i
< (perf
->state_count
-1); i
++) {
498 freqn
= perf
->states
[i
+1].core_frequency
* 1000;
499 if ((2 * cpu_khz
) > (freqn
+ freq
)) {
504 perf
->state
= perf
->state_count
-1;
507 /* assume CPU is at P0... */
509 return perf
->states
[0].core_frequency
* 1000;
513 static void free_acpi_perf_data(void)
517 /* Freeing a NULL pointer is OK, and alloc_percpu zeroes. */
518 for_each_possible_cpu(i
)
519 free_cpumask_var(per_cpu_ptr(acpi_perf_data
, i
)
521 free_percpu(acpi_perf_data
);
525 * acpi_cpufreq_early_init - initialize ACPI P-States library
527 * Initialize the ACPI P-States library (drivers/acpi/processor_perflib.c)
528 * in order to determine correct frequency and voltage pairings. We can
529 * do _PDC and _PSD and find out the processor dependency for the
530 * actual init that will happen later...
532 static int __init
acpi_cpufreq_early_init(void)
535 dprintk("acpi_cpufreq_early_init\n");
537 acpi_perf_data
= alloc_percpu(struct acpi_processor_performance
);
538 if (!acpi_perf_data
) {
539 dprintk("Memory allocation error for acpi_perf_data.\n");
542 for_each_possible_cpu(i
) {
543 if (!alloc_cpumask_var_node(
544 &per_cpu_ptr(acpi_perf_data
, i
)->shared_cpu_map
,
545 GFP_KERNEL
, cpu_to_node(i
))) {
547 /* Freeing a NULL pointer is OK: alloc_percpu zeroes. */
548 free_acpi_perf_data();
553 /* Do initialization in ACPI core */
554 acpi_processor_preregister_performance(acpi_perf_data
);
560 * Some BIOSes do SW_ANY coordination internally, either set it up in hw
561 * or do it in BIOS firmware and won't inform about it to OS. If not
562 * detected, this has a side effect of making CPU run at a different speed
563 * than OS intended it to run at. Detect it and handle it cleanly.
565 static int bios_with_sw_any_bug
;
567 static int sw_any_bug_found(const struct dmi_system_id
*d
)
569 bios_with_sw_any_bug
= 1;
573 static const struct dmi_system_id sw_any_bug_dmi_table
[] = {
575 .callback
= sw_any_bug_found
,
576 .ident
= "Supermicro Server X6DLP",
578 DMI_MATCH(DMI_SYS_VENDOR
, "Supermicro"),
579 DMI_MATCH(DMI_BIOS_VERSION
, "080010"),
580 DMI_MATCH(DMI_PRODUCT_NAME
, "X6DLP"),
587 static int acpi_cpufreq_cpu_init(struct cpufreq_policy
*policy
)
590 unsigned int valid_states
= 0;
591 unsigned int cpu
= policy
->cpu
;
592 struct acpi_cpufreq_data
*data
;
593 unsigned int result
= 0;
594 struct cpuinfo_x86
*c
= &cpu_data(policy
->cpu
);
595 struct acpi_processor_performance
*perf
;
597 dprintk("acpi_cpufreq_cpu_init\n");
599 data
= kzalloc(sizeof(struct acpi_cpufreq_data
), GFP_KERNEL
);
603 data
->acpi_data
= per_cpu_ptr(acpi_perf_data
, cpu
);
604 per_cpu(drv_data
, cpu
) = data
;
606 if (cpu_has(c
, X86_FEATURE_CONSTANT_TSC
))
607 acpi_cpufreq_driver
.flags
|= CPUFREQ_CONST_LOOPS
;
609 result
= acpi_processor_register_performance(data
->acpi_data
, cpu
);
613 perf
= data
->acpi_data
;
614 policy
->shared_type
= perf
->shared_type
;
617 * Will let policy->cpus know about dependency only when software
618 * coordination is required.
620 if (policy
->shared_type
== CPUFREQ_SHARED_TYPE_ALL
||
621 policy
->shared_type
== CPUFREQ_SHARED_TYPE_ANY
) {
622 cpumask_copy(policy
->cpus
, perf
->shared_cpu_map
);
624 cpumask_copy(policy
->related_cpus
, perf
->shared_cpu_map
);
627 dmi_check_system(sw_any_bug_dmi_table
);
628 if (bios_with_sw_any_bug
&& cpumask_weight(policy
->cpus
) == 1) {
629 policy
->shared_type
= CPUFREQ_SHARED_TYPE_ALL
;
630 cpumask_copy(policy
->cpus
, cpu_core_mask(cpu
));
634 /* capability check */
635 if (perf
->state_count
<= 1) {
636 dprintk("No P-States\n");
641 if (perf
->control_register
.space_id
!= perf
->status_register
.space_id
) {
646 switch (perf
->control_register
.space_id
) {
647 case ACPI_ADR_SPACE_SYSTEM_IO
:
648 dprintk("SYSTEM IO addr space\n");
649 data
->cpu_feature
= SYSTEM_IO_CAPABLE
;
651 case ACPI_ADR_SPACE_FIXED_HARDWARE
:
652 dprintk("HARDWARE addr space\n");
653 if (!check_est_cpu(cpu
)) {
657 data
->cpu_feature
= SYSTEM_INTEL_MSR_CAPABLE
;
660 dprintk("Unknown addr space %d\n",
661 (u32
) (perf
->control_register
.space_id
));
666 data
->freq_table
= kmalloc(sizeof(struct cpufreq_frequency_table
) *
667 (perf
->state_count
+1), GFP_KERNEL
);
668 if (!data
->freq_table
) {
673 /* detect transition latency */
674 policy
->cpuinfo
.transition_latency
= 0;
675 for (i
= 0; i
< perf
->state_count
; i
++) {
676 if ((perf
->states
[i
].transition_latency
* 1000) >
677 policy
->cpuinfo
.transition_latency
)
678 policy
->cpuinfo
.transition_latency
=
679 perf
->states
[i
].transition_latency
* 1000;
682 /* Check for high latency (>20uS) from buggy BIOSes, like on T42 */
683 if (perf
->control_register
.space_id
== ACPI_ADR_SPACE_FIXED_HARDWARE
&&
684 policy
->cpuinfo
.transition_latency
> 20 * 1000) {
685 static int print_once
;
686 policy
->cpuinfo
.transition_latency
= 20 * 1000;
689 printk(KERN_INFO
"Capping off P-state tranision latency"
694 data
->max_freq
= perf
->states
[0].core_frequency
* 1000;
696 for (i
= 0; i
< perf
->state_count
; i
++) {
697 if (i
> 0 && perf
->states
[i
].core_frequency
>=
698 data
->freq_table
[valid_states
-1].frequency
/ 1000)
701 data
->freq_table
[valid_states
].index
= i
;
702 data
->freq_table
[valid_states
].frequency
=
703 perf
->states
[i
].core_frequency
* 1000;
706 data
->freq_table
[valid_states
].frequency
= CPUFREQ_TABLE_END
;
709 result
= cpufreq_frequency_table_cpuinfo(policy
, data
->freq_table
);
713 switch (perf
->control_register
.space_id
) {
714 case ACPI_ADR_SPACE_SYSTEM_IO
:
715 /* Current speed is unknown and not detectable by IO port */
716 policy
->cur
= acpi_cpufreq_guess_freq(data
, policy
->cpu
);
718 case ACPI_ADR_SPACE_FIXED_HARDWARE
:
719 acpi_cpufreq_driver
.get
= get_cur_freq_on_cpu
;
720 policy
->cur
= get_cur_freq_on_cpu(cpu
);
726 /* notify BIOS that we exist */
727 acpi_processor_notify_smm(THIS_MODULE
);
729 /* Check for APERF/MPERF support in hardware */
730 if (c
->x86_vendor
== X86_VENDOR_INTEL
&& c
->cpuid_level
>= 6) {
733 if (ecx
& CPUID_6_ECX_APERFMPERF_CAPABILITY
)
734 acpi_cpufreq_driver
.getavg
= get_measured_perf
;
737 dprintk("CPU%u - ACPI performance management activated.\n", cpu
);
738 for (i
= 0; i
< perf
->state_count
; i
++)
739 dprintk(" %cP%d: %d MHz, %d mW, %d uS\n",
740 (i
== perf
->state
? '*' : ' '), i
,
741 (u32
) perf
->states
[i
].core_frequency
,
742 (u32
) perf
->states
[i
].power
,
743 (u32
) perf
->states
[i
].transition_latency
);
745 cpufreq_frequency_table_get_attr(data
->freq_table
, policy
->cpu
);
748 * the first call to ->target() should result in us actually
749 * writing something to the appropriate registers.
756 kfree(data
->freq_table
);
758 acpi_processor_unregister_performance(perf
, cpu
);
761 per_cpu(drv_data
, cpu
) = NULL
;
766 static int acpi_cpufreq_cpu_exit(struct cpufreq_policy
*policy
)
768 struct acpi_cpufreq_data
*data
= per_cpu(drv_data
, policy
->cpu
);
770 dprintk("acpi_cpufreq_cpu_exit\n");
773 cpufreq_frequency_table_put_attr(policy
->cpu
);
774 per_cpu(drv_data
, policy
->cpu
) = NULL
;
775 acpi_processor_unregister_performance(data
->acpi_data
,
783 static int acpi_cpufreq_resume(struct cpufreq_policy
*policy
)
785 struct acpi_cpufreq_data
*data
= per_cpu(drv_data
, policy
->cpu
);
787 dprintk("acpi_cpufreq_resume\n");
794 static struct freq_attr
*acpi_cpufreq_attr
[] = {
795 &cpufreq_freq_attr_scaling_available_freqs
,
799 static struct cpufreq_driver acpi_cpufreq_driver
= {
800 .verify
= acpi_cpufreq_verify
,
801 .target
= acpi_cpufreq_target
,
802 .init
= acpi_cpufreq_cpu_init
,
803 .exit
= acpi_cpufreq_cpu_exit
,
804 .resume
= acpi_cpufreq_resume
,
805 .name
= "acpi-cpufreq",
806 .owner
= THIS_MODULE
,
807 .attr
= acpi_cpufreq_attr
,
810 static int __init
acpi_cpufreq_init(void)
817 dprintk("acpi_cpufreq_init\n");
819 ret
= acpi_cpufreq_early_init();
823 ret
= cpufreq_register_driver(&acpi_cpufreq_driver
);
825 free_acpi_perf_data();
830 static void __exit
acpi_cpufreq_exit(void)
832 dprintk("acpi_cpufreq_exit\n");
834 cpufreq_unregister_driver(&acpi_cpufreq_driver
);
836 free_percpu(acpi_perf_data
);
839 module_param(acpi_pstate_strict
, uint
, 0644);
840 MODULE_PARM_DESC(acpi_pstate_strict
,
841 "value 0 or non-zero. non-zero -> strict ACPI checks are "
842 "performed during frequency changes.");
844 late_initcall(acpi_cpufreq_init
);
845 module_exit(acpi_cpufreq_exit
);
847 MODULE_ALIAS("acpi");