diff options
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index 4b1c319d30c3..3babe1f1e912 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * acpi-cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.4 $) | 2 | * acpi-cpufreq.c - ACPI Processor P-States Driver |
3 | * | 3 | * |
4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> | 4 | * Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com> |
5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | 5 | * Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> |
@@ -36,16 +36,18 @@ | |||
36 | #include <linux/ftrace.h> | 36 | #include <linux/ftrace.h> |
37 | 37 | ||
38 | #include <linux/acpi.h> | 38 | #include <linux/acpi.h> |
39 | #include <linux/io.h> | ||
40 | #include <linux/delay.h> | ||
41 | #include <linux/uaccess.h> | ||
42 | |||
39 | #include <acpi/processor.h> | 43 | #include <acpi/processor.h> |
40 | 44 | ||
41 | #include <asm/io.h> | ||
42 | #include <asm/msr.h> | 45 | #include <asm/msr.h> |
43 | #include <asm/processor.h> | 46 | #include <asm/processor.h> |
44 | #include <asm/cpufeature.h> | 47 | #include <asm/cpufeature.h> |
45 | #include <asm/delay.h> | ||
46 | #include <asm/uaccess.h> | ||
47 | 48 | ||
48 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) | 49 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \ |
50 | "acpi-cpufreq", msg) | ||
49 | 51 | ||
50 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); | 52 | MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); |
51 | MODULE_DESCRIPTION("ACPI Processor P-States Driver"); | 53 | MODULE_DESCRIPTION("ACPI Processor P-States Driver"); |
@@ -95,7 +97,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data) | |||
95 | 97 | ||
96 | perf = data->acpi_data; | 98 | perf = data->acpi_data; |
97 | 99 | ||
98 | for (i=0; i<perf->state_count; i++) { | 100 | for (i = 0; i < perf->state_count; i++) { |
99 | if (value == perf->states[i].status) | 101 | if (value == perf->states[i].status) |
100 | return data->freq_table[i].frequency; | 102 | return data->freq_table[i].frequency; |
101 | } | 103 | } |
@@ -110,7 +112,7 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data) | |||
110 | msr &= INTEL_MSR_RANGE; | 112 | msr &= INTEL_MSR_RANGE; |
111 | perf = data->acpi_data; | 113 | perf = data->acpi_data; |
112 | 114 | ||
113 | for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { | 115 | for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { |
114 | if (msr == perf->states[data->freq_table[i].index].status) | 116 | if (msr == perf->states[data->freq_table[i].index].status) |
115 | return data->freq_table[i].frequency; | 117 | return data->freq_table[i].frequency; |
116 | } | 118 | } |
@@ -138,15 +140,13 @@ struct io_addr { | |||
138 | u8 bit_width; | 140 | u8 bit_width; |
139 | }; | 141 | }; |
140 | 142 | ||
141 | typedef union { | ||
142 | struct msr_addr msr; | ||
143 | struct io_addr io; | ||
144 | } drv_addr_union; | ||
145 | |||
146 | struct drv_cmd { | 143 | struct drv_cmd { |
147 | unsigned int type; | 144 | unsigned int type; |
148 | const struct cpumask *mask; | 145 | const struct cpumask *mask; |
149 | drv_addr_union addr; | 146 | union { |
147 | struct msr_addr msr; | ||
148 | struct io_addr io; | ||
149 | } addr; | ||
150 | u32 val; | 150 | u32 val; |
151 | }; | 151 | }; |
152 | 152 | ||
@@ -369,7 +369,7 @@ static unsigned int check_freqs(const struct cpumask *mask, unsigned int freq, | |||
369 | unsigned int cur_freq; | 369 | unsigned int cur_freq; |
370 | unsigned int i; | 370 | unsigned int i; |
371 | 371 | ||
372 | for (i=0; i<100; i++) { | 372 | for (i = 0; i < 100; i++) { |
373 | cur_freq = extract_freq(get_cur_val(mask), data); | 373 | cur_freq = extract_freq(get_cur_val(mask), data); |
374 | if (cur_freq == freq) | 374 | if (cur_freq == freq) |
375 | return 1; | 375 | return 1; |
@@ -494,7 +494,7 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu) | |||
494 | unsigned long freq; | 494 | unsigned long freq; |
495 | unsigned long freqn = perf->states[0].core_frequency * 1000; | 495 | unsigned long freqn = perf->states[0].core_frequency * 1000; |
496 | 496 | ||
497 | for (i=0; i<(perf->state_count-1); i++) { | 497 | for (i = 0; i < (perf->state_count-1); i++) { |
498 | freq = freqn; | 498 | freq = freqn; |
499 | freqn = perf->states[i+1].core_frequency * 1000; | 499 | freqn = perf->states[i+1].core_frequency * 1000; |
500 | if ((2 * cpu_khz) > (freqn + freq)) { | 500 | if ((2 * cpu_khz) > (freqn + freq)) { |
@@ -673,7 +673,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
673 | 673 | ||
674 | /* detect transition latency */ | 674 | /* detect transition latency */ |
675 | policy->cpuinfo.transition_latency = 0; | 675 | policy->cpuinfo.transition_latency = 0; |
676 | for (i=0; i<perf->state_count; i++) { | 676 | for (i = 0; i < perf->state_count; i++) { |
677 | if ((perf->states[i].transition_latency * 1000) > | 677 | if ((perf->states[i].transition_latency * 1000) > |
678 | policy->cpuinfo.transition_latency) | 678 | policy->cpuinfo.transition_latency) |
679 | policy->cpuinfo.transition_latency = | 679 | policy->cpuinfo.transition_latency = |
@@ -682,8 +682,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
682 | 682 | ||
683 | data->max_freq = perf->states[0].core_frequency * 1000; | 683 | data->max_freq = perf->states[0].core_frequency * 1000; |
684 | /* table init */ | 684 | /* table init */ |
685 | for (i=0; i<perf->state_count; i++) { | 685 | for (i = 0; i < perf->state_count; i++) { |
686 | if (i>0 && perf->states[i].core_frequency >= | 686 | if (i > 0 && perf->states[i].core_frequency >= |
687 | data->freq_table[valid_states-1].frequency / 1000) | 687 | data->freq_table[valid_states-1].frequency / 1000) |
688 | continue; | 688 | continue; |
689 | 689 | ||