Commit c1d5f036 authored by Dave Jones's avatar Dave Jones

Merge tetrachloride.(none):/mnt/raid/src/kernel/2.5/trees/bk-linus

into tetrachloride.(none):/mnt/raid/src/kernel/2.5/trees/cpufreq
parents 3a2b9514 b28888b3
...@@ -1526,6 +1526,7 @@ E: davej@suse.de ...@@ -1526,6 +1526,7 @@ E: davej@suse.de
W: http://www.codemonkey.org.uk W: http://www.codemonkey.org.uk
D: x86 errata/setup maintenance. D: x86 errata/setup maintenance.
D: AGPGART driver. D: AGPGART driver.
D: CPUFREQ maintenance.
D: Backport/Forwardport merge monkey. D: Backport/Forwardport merge monkey.
D: Various Janitor work. D: Various Janitor work.
S: c/o SuSE Linux UK Ltd S: c/o SuSE Linux UK Ltd
......
...@@ -73,9 +73,9 @@ The phase is specified in the second argument to the notifier. ...@@ -73,9 +73,9 @@ The phase is specified in the second argument to the notifier.
The third argument, a void *pointer, points to a struct cpufreq_policy The third argument, a void *pointer, points to a struct cpufreq_policy
consisting of five values: cpu, min, max, policy and max_cpu_freq. min consisting of five values: cpu, min, max, policy and max_cpu_freq. min
and max are the lower and upper frequencies (in kHz) of the new and max are the lower and upper frequencies (in kHz) of the new
policy, policy the new policy, cpu the number of the affected CPU or policy, policy the new policy, cpu the number of the affected CPU; and
CPUFREQ_ALL_CPUS for all CPUs; and max_cpu_freq the maximum supported max_cpu_freq the maximum supported CPU frequency. This value is given
CPU frequency. This value is given for informational purposes only. for informational purposes only.
2.2 CPUFreq transition notifiers 2.2 CPUFreq transition notifiers
...@@ -89,6 +89,6 @@ CPUFREQ_POSTCHANGE. ...@@ -89,6 +89,6 @@ CPUFREQ_POSTCHANGE.
The third argument is a struct cpufreq_freqs with the following The third argument is a struct cpufreq_freqs with the following
values: values:
cpu - number of the affected CPU or CPUFREQ_ALL_CPUS cpu - number of the affected CPU
old - old frequency old - old frequency
new - new frequency new - new frequency
...@@ -41,16 +41,17 @@ on what is necessary: ...@@ -41,16 +41,17 @@ on what is necessary:
1.1 Initialization 1.1 Initialization
------------------ ------------------
First of all, in an __initcall level 7 or later (preferrably First of all, in an __initcall level 7 (module_init()) or later
module_init() so that your driver is modularized) function check function check whether this kernel runs on the right CPU and the right
whether this kernel runs on the right CPU and the right chipset. If chipset. If so, register a struct cpufreq_driver with the CPUfreq core
so, register a struct cpufreq_driver with the CPUfreq core using using cpufreq_register_driver()
cpufreq_register_driver()
What shall this struct cpufreq_driver contain? What shall this struct cpufreq_driver contain?
cpufreq_driver.name - The name of this driver. cpufreq_driver.name - The name of this driver.
cpufreq_driver.owner - THIS_MODULE;
cpufreq_driver.init - A pointer to the per-CPU initialization cpufreq_driver.init - A pointer to the per-CPU initialization
function. function.
...@@ -76,8 +77,7 @@ cpufreq driver registers itself, the per-CPU initialization function ...@@ -76,8 +77,7 @@ cpufreq driver registers itself, the per-CPU initialization function
cpufreq_driver.init is called. It takes a struct cpufreq_policy cpufreq_driver.init is called. It takes a struct cpufreq_policy
*policy as argument. What to do now? *policy as argument. What to do now?
If necessary, activate the CPUfreq support on your CPU (unlock that If necessary, activate the CPUfreq support on your CPU.
register etc.).
Then, the driver must fill in the following values: Then, the driver must fill in the following values:
......
...@@ -135,21 +135,21 @@ CPUfreq core to ensure proper locking. ...@@ -135,21 +135,21 @@ CPUfreq core to ensure proper locking.
The CPUfreq governor may call the CPU processor driver using one of The CPUfreq governor may call the CPU processor driver using one of
these two functions: these two functions:
inline int cpufreq_driver_target(struct cpufreq_policy *policy, int cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
inline int cpufreq_driver_target_l(struct cpufreq_policy *policy, int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
target_freq must be within policy->min and policy->max, of course. target_freq must be within policy->min and policy->max, of course.
What's the difference between these two functions? When your governor What's the difference between these two functions? When your governor
still is in a direct code path of a call to governor->governor, the still is in a direct code path of a call to governor->governor, the
cpufreq_driver_sem lock is still held in the cpufreq core, and there's per-CPU cpufreq lock is still held in the cpufreq core, and there's
no need to lock it again (in fact, this would cause a deadlock). So no need to lock it again (in fact, this would cause a deadlock). So
use cpufreq_driver_target only in these cases. In all other cases (for use __cpufreq_driver_target only in these cases. In all other cases
example, when there's a "daemonized" function that wakes up every (for example, when there's a "daemonized" function that wakes up
second), use cpufreq_driver_target_l to lock the cpufreq_driver_sem every second), use cpufreq_driver_target to lock the cpufreq per-CPU
before the command is passed to the cpufreq processor driver. lock before the command is passed to the cpufreq processor driver.
...@@ -132,7 +132,7 @@ the processor shall run at. ...@@ -132,7 +132,7 @@ the processor shall run at.
The preferred interface is located in the sysfs filesystem. If you The preferred interface is located in the sysfs filesystem. If you
mounted it at /sys, the cpufreq interface is located in a subdirectory mounted it at /sys, the cpufreq interface is located in a subdirectory
"cpufreq" within the cpu-device directory "cpufreq" within the cpu-device directory
(e.g. /sys/class/cpu/cpu0/cpufreq/ for the first CPU). (e.g. /sys/devices/system/cpu/cpu0/cpufreq/ for the first CPU).
cpuinfo_min_freq : this file shows the minimum operating cpuinfo_min_freq : this file shows the minimum operating
frequency the processor can run at(in kHz) frequency the processor can run at(in kHz)
......
...@@ -431,9 +431,11 @@ W: http://www.fi.muni.cz/~kas/cosa/ ...@@ -431,9 +431,11 @@ W: http://www.fi.muni.cz/~kas/cosa/
S: Maintained S: Maintained
CPU FREQUENCY DRIVERS CPU FREQUENCY DRIVERS
L: cpufreq@www.linux.org.uk P: Dave Jones
W: http://www.brodo.de/cpufreq/ M: davej@codemonkey.org.uk
S: Maintained L: cpufreq@www.linux.org.uk
W: http://www.codemonkey.org.uk/cpufreq/
S: Maintained
CPUID/MSR DRIVER CPUID/MSR DRIVER
P: H. Peter Anvin P: H. Peter Anvin
......
...@@ -288,10 +288,23 @@ void __init identify_cpu(struct cpuinfo_x86 *c) ...@@ -288,10 +288,23 @@ void __init identify_cpu(struct cpuinfo_x86 *c)
c->x86 = 3; c->x86 = 3;
} }
if (this_cpu->c_identify) generic_identify(c);
printk(KERN_DEBUG "CPU: After generic identify, caps: %08lx %08lx %08lx %08lx\n",
c->x86_capability[0],
c->x86_capability[1],
c->x86_capability[2],
c->x86_capability[3]);
if (this_cpu->c_identify) {
this_cpu->c_identify(c); this_cpu->c_identify(c);
else
generic_identify(c); printk(KERN_DEBUG "CPU: After vendor identify, caps: %08lx %08lx %08lx %08lx\n",
c->x86_capability[0],
c->x86_capability[1],
c->x86_capability[2],
c->x86_capability[3]);
}
/* /*
* Vendor-specific initialization. In this section we * Vendor-specific initialization. In this section we
...@@ -341,7 +354,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c) ...@@ -341,7 +354,7 @@ void __init identify_cpu(struct cpuinfo_x86 *c)
/* Now the feature flags better reflect actual CPU features! */ /* Now the feature flags better reflect actual CPU features! */
printk(KERN_DEBUG "CPU: After generic, caps: %08lx %08lx %08lx %08lx\n", printk(KERN_DEBUG "CPU: After all inits, caps: %08lx %08lx %08lx %08lx\n",
c->x86_capability[0], c->x86_capability[0],
c->x86_capability[1], c->x86_capability[1],
c->x86_capability[2], c->x86_capability[2],
......
...@@ -380,7 +380,7 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) ...@@ -380,7 +380,7 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
static int static int
acpi_processor_write_performance ( acpi_processor_write_performance (
struct file *file, struct file *file,
const char *buffer, const char __user *buffer,
size_t count, size_t count,
loff_t *data) loff_t *data)
{ {
......
This diff is collapsed.
/*
* longhaul.h
* (C) 2003 Dave Jones.
*
* Licensed under the terms of the GNU GPL License version 2.
*
* VIA-specific information
*/
union msr_bcr2 {
struct {
unsigned Reseved:19, // 18:0
ESOFTBF:1, // 19
Reserved2:3, // 22:20
CLOCKMUL:4, // 26:23
Reserved3:5; // 31:27
} bits;
unsigned long val;
};
union msr_longhaul {
struct {
unsigned RevisionID:4, // 3:0
RevisionKey:4, // 7:4
EnableSoftBusRatio:1, // 8
EnableSoftVID:1, // 9
EnableSoftBSEL:1, // 10
Reserved:3, // 11:13
SoftBusRatio4:1, // 14
VRMRev:1, // 15
SoftBusRatio:4, // 19:16
SoftVID:5, // 24:20
Reserved2:3, // 27:25
SoftBSEL:2, // 29:28
Reserved3:2, // 31:30
MaxMHzBR:4, // 35:32
MaximumVID:5, // 40:36
MaxMHzFSB:2, // 42:41
MaxMHzBR4:1, // 43
Reserved4:4, // 47:44
MinMHzBR:4, // 51:48
MinimumVID:5, // 56:52
MinMHzFSB:2, // 58:57
MinMHzBR4:1, // 59
Reserved5:4; // 63:60
} bits;
unsigned long long val;
};
/* /*
* $Id: longrun.c,v 1.25 2003/02/28 16:03:50 db Exp $
*
* (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
* *
* Licensed under the terms of the GNU GPL License version 2. * Licensed under the terms of the GNU GPL License version 2.
...@@ -123,7 +121,7 @@ static int longrun_verify_policy(struct cpufreq_policy *policy) ...@@ -123,7 +121,7 @@ static int longrun_verify_policy(struct cpufreq_policy *policy)
policy->cpuinfo.max_freq); policy->cpuinfo.max_freq);
if (policy->policy == CPUFREQ_POLICY_GOVERNOR) if (policy->policy == CPUFREQ_POLICY_GOVERNOR)
policy->policy = longrun_driver.policy[0].policy; return -EINVAL;
return 0; return 0;
} }
......
/* /*
* $Id: powernow-k6.c,v 1.48 2003/02/22 10:23:46 db Exp $ * This file was based upon code in Powertweak Linux (http://powertweak.sf.net)
* This file was part of Powertweak Linux (http://powertweak.sf.net)
* and is shared with the Linux Kernel module.
*
* (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pnkl, Dominik Brodowski. * (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pnkl, Dominik Brodowski.
* *
* Licensed under the terms of the GNU GPL License version 2. * Licensed under the terms of the GNU GPL License version 2.
......
/* /*
* $Id: powernow-k7.c,v 1.34 2003/02/22 10:23:46 db Exp $ * AMD K7 Powernow driver.
*
* (C) 2003 Dave Jones <davej@suse.de> * (C) 2003 Dave Jones <davej@suse.de>
* *
* Licensed under the terms of the GNU GPL License version 2. * Licensed under the terms of the GNU GPL License version 2.
...@@ -85,27 +84,6 @@ static unsigned int latency; ...@@ -85,27 +84,6 @@ static unsigned int latency;
static char have_a0; static char have_a0;
#ifndef rdmsrl
#define rdmsrl(msr,val) do {unsigned long l__,h__; \
rdmsr (msr, l__, h__); \
val = l__; \
val |= ((u64)h__<<32); \
} while(0)
#endif
#ifndef wrmsrl
static void wrmsrl (u32 msr, u64 val)
{
u32 lo, hi;
lo = (u32) val;
hi = val >> 32;
wrmsr (msr, lo, hi);
}
#endif
static int check_powernow(void) static int check_powernow(void)
{ {
struct cpuinfo_x86 *c = cpu_data; struct cpuinfo_x86 *c = cpu_data;
...@@ -240,6 +218,7 @@ static void change_speed (unsigned int index) ...@@ -240,6 +218,7 @@ static void change_speed (unsigned int index)
u8 fid, vid; u8 fid, vid;
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
union msr_fidvidstatus fidvidstatus; union msr_fidvidstatus fidvidstatus;
int cfid;
/* fid are the lower 8 bits of the index we stored into /* fid are the lower 8 bits of the index we stored into
* the cpufreq frequency table in powernow_decode_bios, * the cpufreq frequency table in powernow_decode_bios,
...@@ -251,8 +230,9 @@ static void change_speed (unsigned int index) ...@@ -251,8 +230,9 @@ static void change_speed (unsigned int index)
freqs.cpu = 0; freqs.cpu = 0;
cfid = fidvidstatus.bits.CFID;
rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val); rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
freqs.old = fsb * fid_codes[fidvidstatus.bits.CFID] * 100; freqs.old = fsb * fid_codes[cfid] * 100;
freqs.new = powernow_table[index].frequency; freqs.new = powernow_table[index].frequency;
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
......
...@@ -8,14 +8,6 @@ ...@@ -8,14 +8,6 @@
* *
*/ */
#ifndef MSR_K7_FID_VID_CTL
#define MSR_K7_FID_VID_CTL 0xc0010041
#endif
#ifndef MSR_K7_FID_VID_STATUS
#define MSR_K7_FID_VID_STATUS 0xc0010042
#endif
union msr_fidvidctl { union msr_fidvidctl {
struct { struct {
unsigned FID:5, // 4:0 unsigned FID:5, // 4:0
......
...@@ -82,7 +82,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify) ...@@ -82,7 +82,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
return; return;
freqs.old = speedstep_get_processor_frequency(speedstep_processor); freqs.old = speedstep_get_processor_frequency(speedstep_processor);
freqs.new = speedstep_freqs[SPEEDSTEP_LOW].frequency; freqs.new = speedstep_freqs[state].frequency;
freqs.cpu = 0; /* speedstep.c is UP only driver */ freqs.cpu = 0; /* speedstep.c is UP only driver */
if (notify) if (notify)
...@@ -137,7 +137,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify) ...@@ -137,7 +137,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value); dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value);
if (state == (value & 0x1)) { if (state == (value & 0x1)) {
dprintk (KERN_INFO "cpufreq: change to %u MHz succeeded\n", (freqs.new / 1000)); dprintk (KERN_INFO "cpufreq: change to %u MHz succeeded\n", (speedstep_get_processor_frequency(speedstep_processor) / 1000));
} else { } else {
printk (KERN_ERR "cpufreq: change failed - I/O error\n"); printk (KERN_ERR "cpufreq: change failed - I/O error\n");
} }
...@@ -295,7 +295,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) ...@@ -295,7 +295,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
return -EIO; return -EIO;
dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n", dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n",
(speed == speedstep_low_freq) ? "low" : "high", (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high",
(speed / 1000)); (speed / 1000));
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
......
...@@ -158,7 +158,7 @@ EXPORT_SYMBOL(cpufreq_get); ...@@ -158,7 +158,7 @@ EXPORT_SYMBOL(cpufreq_get);
/*********************** cpufreq_sysctl interface ********************/ /*********************** cpufreq_sysctl interface ********************/
static int static int
cpufreq_procctl(ctl_table *ctl, int write, struct file *filp, cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
void *buffer, size_t *lenp) void __user *buffer, size_t *lenp)
{ {
char buf[16], *p; char buf[16], *p;
int cpu = (int) ctl->extra1; int cpu = (int) ctl->extra1;
...@@ -195,9 +195,9 @@ cpufreq_procctl(ctl_table *ctl, int write, struct file *filp, ...@@ -195,9 +195,9 @@ cpufreq_procctl(ctl_table *ctl, int write, struct file *filp,
} }
static int static int
cpufreq_sysctl(ctl_table *table, int *name, int nlen, cpufreq_sysctl(ctl_table *table, int __user *name, int nlen,
void *oldval, size_t *oldlenp, void __user *oldval, size_t __user *oldlenp,
void *newval, size_t newlen, void **context) void __user *newval, size_t newlen, void **context)
{ {
int cpu = (int) table->extra1; int cpu = (int) table->extra1;
...@@ -524,10 +524,10 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, ...@@ -524,10 +524,10 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
cpu_min_freq[cpu] = policy->min; cpu_min_freq[cpu] = policy->min;
cpu_max_freq[cpu] = policy->max; cpu_max_freq[cpu] = policy->max;
if (policy->max < cpu_cur_freq[cpu]) if (policy->max < cpu_cur_freq[cpu])
cpufreq_driver_target(&current_policy[cpu], policy->max, __cpufreq_driver_target(&current_policy[cpu], policy->max,
CPUFREQ_RELATION_H); CPUFREQ_RELATION_H);
else if (policy->min > cpu_cur_freq[cpu]) else if (policy->min > cpu_cur_freq[cpu])
cpufreq_driver_target(&current_policy[cpu], policy->min, __cpufreq_driver_target(&current_policy[cpu], policy->min,
CPUFREQ_RELATION_L); CPUFREQ_RELATION_L);
memcpy (&current_policy[cpu], policy, sizeof(struct cpufreq_policy)); memcpy (&current_policy[cpu], policy, sizeof(struct cpufreq_policy));
up(&userspace_sem); up(&userspace_sem);
......
...@@ -8,15 +8,30 @@ ...@@ -8,15 +8,30 @@
*/ */
#define rdmsr(msr,val1,val2) \ #define rdmsr(msr,val1,val2) \
__asm__ __volatile__("rdmsr" \ __asm__ __volatile__("rdmsr" \
: "=a" (val1), "=d" (val2) \ : "=a" (val1), "=d" (val2) \
: "c" (msr)) : "c" (msr))
#define wrmsr(msr,val1,val2) \ #define wrmsr(msr,val1,val2) \
__asm__ __volatile__("wrmsr" \ __asm__ __volatile__("wrmsr" \
: /* no outputs */ \ : /* no outputs */ \
: "c" (msr), "a" (val1), "d" (val2)) : "c" (msr), "a" (val1), "d" (val2))
#define rdmsrl(msr,val) do { \
unsigned long l__,h__; \
rdmsr (msr, l__, h__); \
val = l__; \
val |= ((u64)h__<<32); \
} while(0)
static inline void wrmsrl (unsigned long msr, unsigned long long val)
{
unsigned long lo, hi;
lo = (unsigned long) val;
hi = val >> 32;
wrmsr (msr, lo, hi);
}
#define rdtsc(low,high) \ #define rdtsc(low,high) \
__asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high)) __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high))
...@@ -200,7 +215,7 @@ ...@@ -200,7 +215,7 @@
#define MSR_K7_HWCR 0xC0010015 #define MSR_K7_HWCR 0xC0010015
#define MSR_K7_CLK_CTL 0xC001001b #define MSR_K7_CLK_CTL 0xC001001b
#define MSR_K7_FID_VID_CTL 0xC0010041 #define MSR_K7_FID_VID_CTL 0xC0010041
#define MSR_K7_VID_STATUS 0xC0010042 #define MSR_K7_FID_VID_STATUS 0xC0010042
/* Centaur-Hauls/IDT defined MSRs. */ /* Centaur-Hauls/IDT defined MSRs. */
#define MSR_IDT_FCR1 0x107 #define MSR_IDT_FCR1 0x107
......
...@@ -137,9 +137,13 @@ struct cpufreq_governor { ...@@ -137,9 +137,13 @@ struct cpufreq_governor {
/* pass a target to the cpufreq driver /* pass a target to the cpufreq driver
*/ */
inline int cpufreq_driver_target(struct cpufreq_policy *policy, extern int cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation);
/* pass an event to the cpufreq governor */ /* pass an event to the cpufreq governor */
int cpufreq_governor(unsigned int cpu, unsigned int event); int cpufreq_governor(unsigned int cpu, unsigned int event);
...@@ -160,8 +164,6 @@ struct cpufreq_driver { ...@@ -160,8 +164,6 @@ struct cpufreq_driver {
struct module *owner; struct module *owner;
char name[CPUFREQ_NAME_LEN]; char name[CPUFREQ_NAME_LEN];
struct cpufreq_policy *policy;
/* needed by all drivers */ /* needed by all drivers */
int (*init) (struct cpufreq_policy *policy); int (*init) (struct cpufreq_policy *policy);
int (*verify) (struct cpufreq_policy *policy); int (*verify) (struct cpufreq_policy *policy);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment