diff options
Diffstat (limited to 'arch/x86/kernel/cpu/cpufreq/speedstep-smi.c')
-rw-r--r-- | arch/x86/kernel/cpu/cpufreq/speedstep-smi.c | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c index f2b5a621d27b..8a85c93bd62a 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c | |||
@@ -63,7 +63,7 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { | |||
63 | */ | 63 | */ |
64 | static int speedstep_smi_ownership (void) | 64 | static int speedstep_smi_ownership (void) |
65 | { | 65 | { |
66 | u32 command, result, magic; | 66 | u32 command, result, magic, dummy; |
67 | u32 function = GET_SPEEDSTEP_OWNER; | 67 | u32 function = GET_SPEEDSTEP_OWNER; |
68 | unsigned char magic_data[] = "Copyright (c) 1999 Intel Corporation"; | 68 | unsigned char magic_data[] = "Copyright (c) 1999 Intel Corporation"; |
69 | 69 | ||
@@ -73,8 +73,11 @@ static int speedstep_smi_ownership (void) | |||
73 | dprintk("trying to obtain ownership with command %x at port %x\n", command, smi_port); | 73 | dprintk("trying to obtain ownership with command %x at port %x\n", command, smi_port); |
74 | 74 | ||
75 | __asm__ __volatile__( | 75 | __asm__ __volatile__( |
76 | "push %%ebp\n" | ||
76 | "out %%al, (%%dx)\n" | 77 | "out %%al, (%%dx)\n" |
77 | : "=D" (result) | 78 | "pop %%ebp\n" |
79 | : "=D" (result), "=a" (dummy), "=b" (dummy), "=c" (dummy), "=d" (dummy), | ||
80 | "=S" (dummy) | ||
78 | : "a" (command), "b" (function), "c" (0), "d" (smi_port), | 81 | : "a" (command), "b" (function), "c" (0), "d" (smi_port), |
79 | "D" (0), "S" (magic) | 82 | "D" (0), "S" (magic) |
80 | : "memory" | 83 | : "memory" |
@@ -96,7 +99,7 @@ static int speedstep_smi_ownership (void) | |||
96 | */ | 99 | */ |
97 | static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high) | 100 | static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high) |
98 | { | 101 | { |
99 | u32 command, result = 0, edi, high_mhz, low_mhz; | 102 | u32 command, result = 0, edi, high_mhz, low_mhz, dummy; |
100 | u32 state=0; | 103 | u32 state=0; |
101 | u32 function = GET_SPEEDSTEP_FREQS; | 104 | u32 function = GET_SPEEDSTEP_FREQS; |
102 | 105 | ||
@@ -109,10 +112,12 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high) | |||
109 | 112 | ||
110 | dprintk("trying to determine frequencies with command %x at port %x\n", command, smi_port); | 113 | dprintk("trying to determine frequencies with command %x at port %x\n", command, smi_port); |
111 | 114 | ||
112 | __asm__ __volatile__("movl $0, %%edi\n" | 115 | __asm__ __volatile__( |
116 | "push %%ebp\n" | ||
113 | "out %%al, (%%dx)\n" | 117 | "out %%al, (%%dx)\n" |
114 | : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi) | 118 | "pop %%ebp" |
115 | : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0) | 119 | : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi), "=S" (dummy) |
120 | : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0), "D" (0) | ||
116 | ); | 121 | ); |
117 | 122 | ||
118 | dprintk("result %x, low_freq %u, high_freq %u\n", result, low_mhz, high_mhz); | 123 | dprintk("result %x, low_freq %u, high_freq %u\n", result, low_mhz, high_mhz); |
@@ -135,16 +140,18 @@ static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high) | |||
135 | static int speedstep_get_state (void) | 140 | static int speedstep_get_state (void) |
136 | { | 141 | { |
137 | u32 function=GET_SPEEDSTEP_STATE; | 142 | u32 function=GET_SPEEDSTEP_STATE; |
138 | u32 result, state, edi, command; | 143 | u32 result, state, edi, command, dummy; |
139 | 144 | ||
140 | command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff); | 145 | command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff); |
141 | 146 | ||
142 | dprintk("trying to determine current setting with command %x at port %x\n", command, smi_port); | 147 | dprintk("trying to determine current setting with command %x at port %x\n", command, smi_port); |
143 | 148 | ||
144 | __asm__ __volatile__("movl $0, %%edi\n" | 149 | __asm__ __volatile__( |
150 | "push %%ebp\n" | ||
145 | "out %%al, (%%dx)\n" | 151 | "out %%al, (%%dx)\n" |
146 | : "=a" (result), "=b" (state), "=D" (edi) | 152 | "pop %%ebp\n" |
147 | : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0) | 153 | : "=a" (result), "=b" (state), "=D" (edi), "=c" (dummy), "=d" (dummy), "=S" (dummy) |
154 | : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0), "D" (0) | ||
148 | ); | 155 | ); |
149 | 156 | ||
150 | dprintk("state is %x, result is %x\n", state, result); | 157 | dprintk("state is %x, result is %x\n", state, result); |
@@ -160,7 +167,7 @@ static int speedstep_get_state (void) | |||
160 | */ | 167 | */ |
161 | static void speedstep_set_state (unsigned int state) | 168 | static void speedstep_set_state (unsigned int state) |
162 | { | 169 | { |
163 | unsigned int result = 0, command, new_state; | 170 | unsigned int result = 0, command, new_state, dummy; |
164 | unsigned long flags; | 171 | unsigned long flags; |
165 | unsigned int function=SET_SPEEDSTEP_STATE; | 172 | unsigned int function=SET_SPEEDSTEP_STATE; |
166 | unsigned int retry = 0; | 173 | unsigned int retry = 0; |
@@ -182,10 +189,12 @@ static void speedstep_set_state (unsigned int state) | |||
182 | } | 189 | } |
183 | retry++; | 190 | retry++; |
184 | __asm__ __volatile__( | 191 | __asm__ __volatile__( |
185 | "movl $0, %%edi\n" | 192 | "push %%ebp\n" |
186 | "out %%al, (%%dx)\n" | 193 | "out %%al, (%%dx)\n" |
187 | : "=b" (new_state), "=D" (result) | 194 | "pop %%ebp" |
188 | : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0) | 195 | : "=b" (new_state), "=D" (result), "=c" (dummy), "=a" (dummy), |
196 | "=d" (dummy), "=S" (dummy) | ||
197 | : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0), "D" (0) | ||
189 | ); | 198 | ); |
190 | } while ((new_state != state) && (retry <= SMI_TRIES)); | 199 | } while ((new_state != state) && (retry <= SMI_TRIES)); |
191 | 200 | ||
@@ -195,7 +204,7 @@ static void speedstep_set_state (unsigned int state) | |||
195 | if (new_state == state) { | 204 | if (new_state == state) { |
196 | dprintk("change to %u MHz succeeded after %u tries with result %u\n", (speedstep_freqs[new_state].frequency / 1000), retry, result); | 205 | dprintk("change to %u MHz succeeded after %u tries with result %u\n", (speedstep_freqs[new_state].frequency / 1000), retry, result); |
197 | } else { | 206 | } else { |
198 | printk(KERN_ERR "cpufreq: change failed with new_state %u and result %u\n", new_state, result); | 207 | printk(KERN_ERR "cpufreq: change to state %u failed with new_state %u and result %u\n", state, new_state, result); |
199 | } | 208 | } |
200 | 209 | ||
201 | return; | 210 | return; |