*/
static int speedstep_smi_ownership (void)
{
- u32 command, result, magic;
- u32 function = GET_SPEEDSTEP_OWNER;
+ u32 command, result, magic;
+ u32 function = GET_SPEEDSTEP_OWNER;
unsigned char magic_data[] = "Copyright (c) 1999 Intel Corporation";
- command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
+ command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
magic = virt_to_phys(magic_data);
- __asm__ __volatile__(
- "out %%al, (%%dx)\n"
- : "=D" (result)
- : "a" (command), "b" (function), "c" (0), "d" (smi_port), "D" (0), "S" (magic)
- );
+ __asm__ __volatile__(
+ "out %%al, (%%dx)\n"
+ : "=D" (result)
+ : "a" (command), "b" (function), "c" (0), "d" (smi_port), "D" (0), "S" (magic)
+ );
- return result;
+ return result;
}
+
/**
* speedstep_smi_get_freqs - get SpeedStep preferred & current freq.
*
*/
static int speedstep_smi_get_freqs (unsigned int *low, unsigned int *high)
{
- u32 command, result, edi, high_mhz, low_mhz;
- u32 state=0;
- u32 function = GET_SPEEDSTEP_FREQS;
+ u32 command, result, edi, high_mhz, low_mhz;
+ u32 state=0;
+ u32 function = GET_SPEEDSTEP_FREQS;
- command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
+ command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
- __asm__ __volatile__("movl $0, %%edi\n"
- "out %%al, (%%dx)\n"
- : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi)
- : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
- );
+ __asm__ __volatile__("movl $0, %%edi\n"
+ "out %%al, (%%dx)\n"
+ : "=a" (result), "=b" (high_mhz), "=c" (low_mhz), "=d" (state), "=D" (edi)
+ : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
+ );
*high = high_mhz * 1000;
*low = low_mhz * 1000;
return result;
}
+
/**
* speedstep_get_state - set the SpeedStep state
* @state: processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
*/
static int speedstep_get_state (void)
{
- u32 function=GET_SPEEDSTEP_STATE;
- u32 result, state, edi, command;
+ u32 function=GET_SPEEDSTEP_STATE;
+ u32 result, state, edi, command;
- command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
+ command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
+
+ __asm__ __volatile__("movl $0, %%edi\n"
+ "out %%al, (%%dx)\n"
+ : "=a" (result), "=b" (state), "=D" (edi)
+ : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0)
+ );
- __asm__ __volatile__("movl $0, %%edi\n"
- "out %%al, (%%dx)\n"
- : "=a" (result), "=b" (state), "=D" (edi)
- : "a" (command), "b" (function), "c" (0), "d" (smi_port), "S" (0)
- );
-
return state;
}
*/
static void speedstep_set_state (unsigned int state, unsigned int notify)
{
- unsigned int old_state, result, command, new_state;
- unsigned long flags;
- struct cpufreq_freqs freqs;
- unsigned int function=SET_SPEEDSTEP_STATE;
+ unsigned int old_state, result, command, new_state;
+ unsigned long flags;
+ struct cpufreq_freqs freqs;
+ unsigned int function=SET_SPEEDSTEP_STATE;
if (state > 0x1)
return;
freqs.old = speedstep_freqs[old_state].frequency;
freqs.new = speedstep_freqs[state].frequency;
freqs.cpu = 0; /* speedstep.c is UP only driver */
-
+
if (old_state == state)
return;
/* Disable IRQs */
local_irq_save(flags);
- command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
- __asm__ __volatile__(
- "movl $0, %%edi\n"
- "out %%al, (%%dx)\n"
- : "=b" (new_state), "=D" (result)
- : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
- );
+ command = (smi_sig & 0xffffff00) | (smi_cmd & 0xff);
+ __asm__ __volatile__(
+ "movl $0, %%edi\n"
+ "out %%al, (%%dx)\n"
+ : "=b" (new_state), "=D" (result)
+ : "a" (command), "b" (function), "c" (state), "d" (smi_port), "S" (0)
+ );
/* enable IRQs */
local_irq_restore(flags);
* Sets a new CPUFreq policy/freq.
*/
static int speedstep_target (struct cpufreq_policy *policy,
- unsigned int target_freq,
- unsigned int relation)
+ unsigned int target_freq, unsigned int relation)
{
- unsigned int newstate = 0;
+ unsigned int newstate = 0;
if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
return -EINVAL;
static int speedstep_cpu_init(struct cpufreq_policy *policy)
{
- int result;
- unsigned int speed,state;
+ int result;
+ unsigned int speed,state;
/* capability check */
if (policy->cpu != 0)
/* detect low and high frequency */
result = speedstep_smi_get_freqs(&speedstep_freqs[SPEEDSTEP_LOW].frequency,
- &speedstep_freqs[SPEEDSTEP_HIGH].frequency);
+ &speedstep_freqs[SPEEDSTEP_HIGH].frequency);
if (result) {
/* fall back to speedstep_lib.c dection mechanism: try both states out */
unsigned int speedstep_processor = speedstep_detect_processor();
return -ENODEV;
result = speedstep_get_freqs(speedstep_processor,
- &speedstep_freqs[SPEEDSTEP_LOW].frequency,
- &speedstep_freqs[SPEEDSTEP_HIGH].frequency,
- &speedstep_set_state);
+ &speedstep_freqs[SPEEDSTEP_LOW].frequency,
+ &speedstep_freqs[SPEEDSTEP_HIGH].frequency,
+ &speedstep_set_state);
if (result) {
dprintk(KERN_INFO "speedstep-smi: could not detect two different speeds -- aborting.\n");
*/
static int __init speedstep_init(void)
{
-
dprintk("speedstep-smi: signature:0%.8lx, command:0lx%.8lx, event:0x%.8lx, perf_level:0x%.8lx.\n",
ist_info.signature, ist_info.command, ist_info.event, ist_info.perf_level);