You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq: (35 commits)
[CPUFREQ] Prevent p4-clockmod from auto-binding to the ondemand governor.
[CPUFREQ] Make cpufreq-nforce2 less obnoxious
[CPUFREQ] p4-clockmod reports wrong frequency.
[CPUFREQ] powernow-k8: Use a common exit path.
[CPUFREQ] Change link order of x86 cpufreq modules
[CPUFREQ] conservative: remove 10x from def_sampling_rate
[CPUFREQ] conservative: fixup governor to function more like ondemand logic
[CPUFREQ] conservative: fix dbs_cpufreq_notifier so freq is not locked
[CPUFREQ] conservative: amend author's email address
[CPUFREQ] Use swap() in longhaul.c
[CPUFREQ] checkpatch cleanups for acpi-cpufreq
[CPUFREQ] powernow-k8: Only print error message once, not per core.
[CPUFREQ] ondemand/conservative: sanitize sampling_rate restrictions
[CPUFREQ] ondemand/conservative: deprecate sampling_rate{min,max}
[CPUFREQ] powernow-k8: Always compile powernow-k8 driver with ACPI support
[CPUFREQ] Introduce /sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_transition_latency
[CPUFREQ] checkpatch cleanups for powernow-k8
[CPUFREQ] checkpatch cleanups for ondemand governor.
[CPUFREQ] checkpatch cleanups for powernow-k7
[CPUFREQ] checkpatch cleanups for speedstep related drivers.
...
This commit is contained in:
@@ -117,10 +117,28 @@ accessible parameters:
|
||||
sampling_rate: measured in uS (10^-6 seconds), this is how often you
|
||||
want the kernel to look at the CPU usage and to make decisions on
|
||||
what to do about the frequency. Typically this is set to values of
|
||||
around '10000' or more.
|
||||
around '10000' or more. It's default value is (cmp. with users-guide.txt):
|
||||
transition_latency * 1000
|
||||
The lowest value you can set is:
|
||||
transition_latency * 100 or it may get restricted to a value where it
|
||||
makes not sense for the kernel anymore to poll that often which depends
|
||||
on your HZ config variable (HZ=1000: max=20000us, HZ=250: max=5000).
|
||||
Be aware that transition latency is in ns and sampling_rate is in us, so you
|
||||
get the same sysfs value by default.
|
||||
Sampling rate should always get adjusted considering the transition latency
|
||||
To set the sampling rate 750 times as high as the transition latency
|
||||
in the bash (as said, 1000 is default), do:
|
||||
echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) \
|
||||
>ondemand/sampling_rate
|
||||
|
||||
show_sampling_rate_(min|max): the minimum and maximum sampling rates
|
||||
available that you may set 'sampling_rate' to.
|
||||
show_sampling_rate_(min|max): THIS INTERFACE IS DEPRECATED, DON'T USE IT.
|
||||
You can use wider ranges now and the general
|
||||
cpuinfo_transition_latency variable (cmp. with user-guide.txt) can be
|
||||
used to obtain exactly the same info:
|
||||
show_sampling_rate_min = transtition_latency * 500 / 1000
|
||||
show_sampling_rate_max = transtition_latency * 500000 / 1000
|
||||
(divided by 1000 is to illustrate that sampling rate is in us and
|
||||
transition latency is exported ns).
|
||||
|
||||
up_threshold: defines what the average CPU usage between the samplings
|
||||
of 'sampling_rate' needs to be for the kernel to make a decision on
|
||||
|
||||
@@ -152,6 +152,18 @@ cpuinfo_min_freq : this file shows the minimum operating
|
||||
frequency the processor can run at(in kHz)
|
||||
cpuinfo_max_freq : this file shows the maximum operating
|
||||
frequency the processor can run at(in kHz)
|
||||
cpuinfo_transition_latency The time it takes on this CPU to
|
||||
switch between two frequencies in nano
|
||||
seconds. If unknown or known to be
|
||||
that high that the driver does not
|
||||
work with the ondemand governor, -1
|
||||
(CPUFREQ_ETERNAL) will be returned.
|
||||
Using this information can be useful
|
||||
to choose an appropriate polling
|
||||
frequency for a kernel governor or
|
||||
userspace daemon. Make sure to not
|
||||
switch the frequency too often
|
||||
resulting in performance loss.
|
||||
scaling_driver : this file shows what cpufreq driver is
|
||||
used to set the frequency on this CPU
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ unsigned long native_calibrate_tsc(void);
|
||||
|
||||
#ifdef CONFIG_X86_32
|
||||
extern int timer_ack;
|
||||
#endif
|
||||
extern int recalibrate_cpu_khz(void);
|
||||
#endif /* CONFIG_X86_32 */
|
||||
|
||||
extern int no_timer_check;
|
||||
|
||||
|
||||
@@ -87,30 +87,15 @@ config X86_POWERNOW_K7_ACPI
|
||||
config X86_POWERNOW_K8
|
||||
tristate "AMD Opteron/Athlon64 PowerNow!"
|
||||
select CPU_FREQ_TABLE
|
||||
depends on ACPI && ACPI_PROCESSOR
|
||||
help
|
||||
This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
|
||||
This adds the CPUFreq driver for K8/K10 Opteron/Athlon64 processors.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called powernow-k8.
|
||||
|
||||
For details, take a look at <file:Documentation/cpu-freq/>.
|
||||
|
||||
If in doubt, say N.
|
||||
|
||||
config X86_POWERNOW_K8_ACPI
|
||||
bool
|
||||
prompt "ACPI Support" if X86_32
|
||||
depends on ACPI && X86_POWERNOW_K8 && ACPI_PROCESSOR
|
||||
depends on !(X86_POWERNOW_K8 = y && ACPI_PROCESSOR = m)
|
||||
default y
|
||||
help
|
||||
This provides access to the K8s Processor Performance States via ACPI.
|
||||
This driver is probably required for CPUFreq to work with multi-socket and
|
||||
SMP systems. It is not required on at least some single-socket yet
|
||||
multi-core systems, even if SMP is enabled.
|
||||
|
||||
It is safe to say Y here.
|
||||
|
||||
config X86_GX_SUSPMOD
|
||||
tristate "Cyrix MediaGX/NatSemi Geode Suspend Modulation"
|
||||
depends on X86_32 && PCI
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
# Link order matters. K8 is preferred to ACPI because of firmware bugs in early
|
||||
# K8 systems. ACPI is preferred to all other hardware-specific drivers.
|
||||
# speedstep-* is preferred over p4-clockmod.
|
||||
|
||||
obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o
|
||||
obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o
|
||||
obj-$(CONFIG_X86_POWERNOW_K6) += powernow-k6.o
|
||||
obj-$(CONFIG_X86_POWERNOW_K7) += powernow-k7.o
|
||||
obj-$(CONFIG_X86_POWERNOW_K8) += powernow-k8.o
|
||||
obj-$(CONFIG_X86_LONGHAUL) += longhaul.o
|
||||
obj-$(CONFIG_X86_E_POWERSAVER) += e_powersaver.o
|
||||
obj-$(CONFIG_ELAN_CPUFREQ) += elanfreq.o
|
||||
@@ -10,7 +15,6 @@ obj-$(CONFIG_X86_GX_SUSPMOD) += gx-suspmod.o
|
||||
obj-$(CONFIG_X86_SPEEDSTEP_ICH) += speedstep-ich.o
|
||||
obj-$(CONFIG_X86_SPEEDSTEP_LIB) += speedstep-lib.o
|
||||
obj-$(CONFIG_X86_SPEEDSTEP_SMI) += speedstep-smi.o
|
||||
obj-$(CONFIG_X86_ACPI_CPUFREQ) += acpi-cpufreq.o
|
||||
obj-$(CONFIG_X86_SPEEDSTEP_CENTRINO) += speedstep-centrino.o
|
||||
obj-$(CONFIG_X86_P4_CLOCKMOD) += p4-clockmod.o
|
||||
obj-$(CONFIG_X86_CPUFREQ_NFORCE2) += cpufreq-nforce2.o
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* acpi-cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.4 $)
|
||||
* acpi-cpufreq.c - ACPI Processor P-States Driver
|
||||
*
|
||||
* Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
|
||||
* Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
||||
@@ -36,16 +36,18 @@
|
||||
#include <linux/ftrace.h>
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/uaccess.h>
|
||||
|
||||
#include <acpi/processor.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/msr.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/cpufeature.h>
|
||||
#include <asm/delay.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg)
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"acpi-cpufreq", msg)
|
||||
|
||||
MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
|
||||
MODULE_DESCRIPTION("ACPI Processor P-States Driver");
|
||||
@@ -95,7 +97,7 @@ static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
|
||||
|
||||
perf = data->acpi_data;
|
||||
|
||||
for (i=0; i<perf->state_count; i++) {
|
||||
for (i = 0; i < perf->state_count; i++) {
|
||||
if (value == perf->states[i].status)
|
||||
return data->freq_table[i].frequency;
|
||||
}
|
||||
@@ -110,7 +112,7 @@ static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
|
||||
msr &= INTEL_MSR_RANGE;
|
||||
perf = data->acpi_data;
|
||||
|
||||
for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
|
||||
for (i = 0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
|
||||
if (msr == perf->states[data->freq_table[i].index].status)
|
||||
return data->freq_table[i].frequency;
|
||||
}
|
||||
@@ -138,15 +140,13 @@ struct io_addr {
|
||||
u8 bit_width;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct msr_addr msr;
|
||||
struct io_addr io;
|
||||
} drv_addr_union;
|
||||
|
||||
struct drv_cmd {
|
||||
unsigned int type;
|
||||
const struct cpumask *mask;
|
||||
drv_addr_union addr;
|
||||
union {
|
||||
struct msr_addr msr;
|
||||
struct io_addr io;
|
||||
} addr;
|
||||
u32 val;
|
||||
};
|
||||
|
||||
@@ -369,7 +369,7 @@ static unsigned int check_freqs(const struct cpumask *mask, unsigned int freq,
|
||||
unsigned int cur_freq;
|
||||
unsigned int i;
|
||||
|
||||
for (i=0; i<100; i++) {
|
||||
for (i = 0; i < 100; i++) {
|
||||
cur_freq = extract_freq(get_cur_val(mask), data);
|
||||
if (cur_freq == freq)
|
||||
return 1;
|
||||
@@ -494,7 +494,7 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
|
||||
unsigned long freq;
|
||||
unsigned long freqn = perf->states[0].core_frequency * 1000;
|
||||
|
||||
for (i=0; i<(perf->state_count-1); i++) {
|
||||
for (i = 0; i < (perf->state_count-1); i++) {
|
||||
freq = freqn;
|
||||
freqn = perf->states[i+1].core_frequency * 1000;
|
||||
if ((2 * cpu_khz) > (freqn + freq)) {
|
||||
@@ -673,7 +673,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
|
||||
/* detect transition latency */
|
||||
policy->cpuinfo.transition_latency = 0;
|
||||
for (i=0; i<perf->state_count; i++) {
|
||||
for (i = 0; i < perf->state_count; i++) {
|
||||
if ((perf->states[i].transition_latency * 1000) >
|
||||
policy->cpuinfo.transition_latency)
|
||||
policy->cpuinfo.transition_latency =
|
||||
@@ -682,8 +682,8 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
|
||||
data->max_freq = perf->states[0].core_frequency * 1000;
|
||||
/* table init */
|
||||
for (i=0; i<perf->state_count; i++) {
|
||||
if (i>0 && perf->states[i].core_frequency >=
|
||||
for (i = 0; i < perf->state_count; i++) {
|
||||
if (i > 0 && perf->states[i].core_frequency >=
|
||||
data->freq_table[valid_states-1].frequency / 1000)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
* nforce2_chipset:
|
||||
* FSB is changed using the chipset
|
||||
*/
|
||||
static struct pci_dev *nforce2_chipset_dev;
|
||||
static struct pci_dev *nforce2_dev;
|
||||
|
||||
/* fid:
|
||||
* multiplier * 10
|
||||
@@ -56,7 +56,9 @@ MODULE_PARM_DESC(fid, "CPU multiplier to use (11.5 = 115)");
|
||||
MODULE_PARM_DESC(min_fsb,
|
||||
"Minimum FSB to use, if not defined: current FSB - 50");
|
||||
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "cpufreq-nforce2", msg)
|
||||
#define PFX "cpufreq-nforce2: "
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"cpufreq-nforce2", msg)
|
||||
|
||||
/**
|
||||
* nforce2_calc_fsb - calculate FSB
|
||||
@@ -118,11 +120,11 @@ static void nforce2_write_pll(int pll)
|
||||
int temp;
|
||||
|
||||
/* Set the pll addr. to 0x00 */
|
||||
pci_write_config_dword(nforce2_chipset_dev, NFORCE2_PLLADR, 0);
|
||||
pci_write_config_dword(nforce2_dev, NFORCE2_PLLADR, 0);
|
||||
|
||||
/* Now write the value in all 64 registers */
|
||||
for (temp = 0; temp <= 0x3f; temp++)
|
||||
pci_write_config_dword(nforce2_chipset_dev, NFORCE2_PLLREG, pll);
|
||||
pci_write_config_dword(nforce2_dev, NFORCE2_PLLREG, pll);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -139,8 +141,8 @@ static unsigned int nforce2_fsb_read(int bootfsb)
|
||||
u32 fsb, temp = 0;
|
||||
|
||||
/* Get chipset boot FSB from subdevice 5 (FSB at boot-time) */
|
||||
nforce2_sub5 = pci_get_subsys(PCI_VENDOR_ID_NVIDIA,
|
||||
0x01EF, PCI_ANY_ID, PCI_ANY_ID, NULL);
|
||||
nforce2_sub5 = pci_get_subsys(PCI_VENDOR_ID_NVIDIA, 0x01EF,
|
||||
PCI_ANY_ID, PCI_ANY_ID, NULL);
|
||||
if (!nforce2_sub5)
|
||||
return 0;
|
||||
|
||||
@@ -148,13 +150,13 @@ static unsigned int nforce2_fsb_read(int bootfsb)
|
||||
fsb /= 1000000;
|
||||
|
||||
/* Check if PLL register is already set */
|
||||
pci_read_config_byte(nforce2_chipset_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
|
||||
pci_read_config_byte(nforce2_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
|
||||
|
||||
if (bootfsb || !temp)
|
||||
return fsb;
|
||||
|
||||
/* Use PLL register FSB value */
|
||||
pci_read_config_dword(nforce2_chipset_dev, NFORCE2_PLLREG, &temp);
|
||||
pci_read_config_dword(nforce2_dev, NFORCE2_PLLREG, &temp);
|
||||
fsb = nforce2_calc_fsb(temp);
|
||||
|
||||
return fsb;
|
||||
@@ -174,18 +176,18 @@ static int nforce2_set_fsb(unsigned int fsb)
|
||||
int pll = 0;
|
||||
|
||||
if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) {
|
||||
printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb);
|
||||
printk(KERN_ERR PFX "FSB %d is out of range!\n", fsb);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
tfsb = nforce2_fsb_read(0);
|
||||
if (!tfsb) {
|
||||
printk(KERN_ERR "cpufreq: Error while reading the FSB\n");
|
||||
printk(KERN_ERR PFX "Error while reading the FSB\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* First write? Then set actual value */
|
||||
pci_read_config_byte(nforce2_chipset_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
|
||||
pci_read_config_byte(nforce2_dev, NFORCE2_PLLENABLE, (u8 *)&temp);
|
||||
if (!temp) {
|
||||
pll = nforce2_calc_pll(tfsb);
|
||||
|
||||
@@ -197,7 +199,7 @@ static int nforce2_set_fsb(unsigned int fsb)
|
||||
|
||||
/* Enable write access */
|
||||
temp = 0x01;
|
||||
pci_write_config_byte(nforce2_chipset_dev, NFORCE2_PLLENABLE, (u8)temp);
|
||||
pci_write_config_byte(nforce2_dev, NFORCE2_PLLENABLE, (u8)temp);
|
||||
|
||||
diff = tfsb - fsb;
|
||||
|
||||
@@ -222,7 +224,7 @@ static int nforce2_set_fsb(unsigned int fsb)
|
||||
}
|
||||
|
||||
temp = 0x40;
|
||||
pci_write_config_byte(nforce2_chipset_dev, NFORCE2_PLLADR, (u8)temp);
|
||||
pci_write_config_byte(nforce2_dev, NFORCE2_PLLADR, (u8)temp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -244,7 +246,8 @@ static unsigned int nforce2_get(unsigned int cpu)
|
||||
* nforce2_target - set a new CPUFreq policy
|
||||
* @policy: new policy
|
||||
* @target_freq: the target frequency
|
||||
* @relation: how that frequency relates to achieved frequency (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
|
||||
* @relation: how that frequency relates to achieved frequency
|
||||
* (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
|
||||
*
|
||||
* Sets a new CPUFreq policy.
|
||||
*/
|
||||
@@ -276,7 +279,7 @@ static int nforce2_target(struct cpufreq_policy *policy,
|
||||
/* local_irq_save(flags); */
|
||||
|
||||
if (nforce2_set_fsb(target_fsb) < 0)
|
||||
printk(KERN_ERR "cpufreq: Changing FSB to %d failed\n",
|
||||
printk(KERN_ERR PFX "Changing FSB to %d failed\n",
|
||||
target_fsb);
|
||||
else
|
||||
dprintk("Changed FSB successfully to %d\n",
|
||||
@@ -327,8 +330,8 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy)
|
||||
/* FIX: Get FID from CPU */
|
||||
if (!fid) {
|
||||
if (!cpu_khz) {
|
||||
printk(KERN_WARNING
|
||||
"cpufreq: cpu_khz not set, can't calculate multiplier!\n");
|
||||
printk(KERN_WARNING PFX
|
||||
"cpu_khz not set, can't calculate multiplier!\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -343,7 +346,7 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy)
|
||||
}
|
||||
}
|
||||
|
||||
printk(KERN_INFO "cpufreq: FSB currently at %i MHz, FID %d.%d\n", fsb,
|
||||
printk(KERN_INFO PFX "FSB currently at %i MHz, FID %d.%d\n", fsb,
|
||||
fid / 10, fid % 10);
|
||||
|
||||
/* Set maximum FSB to FSB at boot time */
|
||||
@@ -392,17 +395,18 @@ static struct cpufreq_driver nforce2_driver = {
|
||||
*/
|
||||
static unsigned int nforce2_detect_chipset(void)
|
||||
{
|
||||
nforce2_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_NVIDIA,
|
||||
nforce2_dev = pci_get_subsys(PCI_VENDOR_ID_NVIDIA,
|
||||
PCI_DEVICE_ID_NVIDIA_NFORCE2,
|
||||
PCI_ANY_ID, PCI_ANY_ID, NULL);
|
||||
|
||||
if (nforce2_chipset_dev == NULL)
|
||||
if (nforce2_dev == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
printk(KERN_INFO "cpufreq: Detected nForce2 chipset revision %X\n",
|
||||
nforce2_chipset_dev->revision);
|
||||
printk(KERN_INFO
|
||||
"cpufreq: FSB changing is maybe unstable and can lead to crashes and data loss.\n");
|
||||
printk(KERN_INFO PFX "Detected nForce2 chipset revision %X\n",
|
||||
nforce2_dev->revision);
|
||||
printk(KERN_INFO PFX
|
||||
"FSB changing is maybe unstable and can lead to "
|
||||
"crashes and data loss.\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -420,7 +424,7 @@ static int __init nforce2_init(void)
|
||||
|
||||
/* detect chipset */
|
||||
if (nforce2_detect_chipset()) {
|
||||
printk(KERN_ERR "cpufreq: No nForce2 chipset.\n");
|
||||
printk(KERN_INFO PFX "No nForce2 chipset.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <asm/msr.h>
|
||||
#include <asm/tsc.h>
|
||||
#include <asm/timex.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/delay.h>
|
||||
|
||||
#define EPS_BRAND_C7M 0
|
||||
#define EPS_BRAND_C7 1
|
||||
@@ -184,7 +184,7 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
|
||||
break;
|
||||
}
|
||||
|
||||
switch(brand) {
|
||||
switch (brand) {
|
||||
case EPS_BRAND_C7M:
|
||||
printk(KERN_CONT "C7-M\n");
|
||||
break;
|
||||
@@ -218,17 +218,20 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
|
||||
/* Print voltage and multiplier */
|
||||
rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
|
||||
current_voltage = lo & 0xff;
|
||||
printk(KERN_INFO "eps: Current voltage = %dmV\n", current_voltage * 16 + 700);
|
||||
printk(KERN_INFO "eps: Current voltage = %dmV\n",
|
||||
current_voltage * 16 + 700);
|
||||
current_multiplier = (lo >> 8) & 0xff;
|
||||
printk(KERN_INFO "eps: Current multiplier = %d\n", current_multiplier);
|
||||
|
||||
/* Print limits */
|
||||
max_voltage = hi & 0xff;
|
||||
printk(KERN_INFO "eps: Highest voltage = %dmV\n", max_voltage * 16 + 700);
|
||||
printk(KERN_INFO "eps: Highest voltage = %dmV\n",
|
||||
max_voltage * 16 + 700);
|
||||
max_multiplier = (hi >> 8) & 0xff;
|
||||
printk(KERN_INFO "eps: Highest multiplier = %d\n", max_multiplier);
|
||||
min_voltage = (hi >> 16) & 0xff;
|
||||
printk(KERN_INFO "eps: Lowest voltage = %dmV\n", min_voltage * 16 + 700);
|
||||
printk(KERN_INFO "eps: Lowest voltage = %dmV\n",
|
||||
min_voltage * 16 + 700);
|
||||
min_multiplier = (hi >> 24) & 0xff;
|
||||
printk(KERN_INFO "eps: Lowest multiplier = %d\n", min_multiplier);
|
||||
|
||||
@@ -318,7 +321,7 @@ static int eps_cpu_exit(struct cpufreq_policy *policy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct freq_attr* eps_attr[] = {
|
||||
static struct freq_attr *eps_attr[] = {
|
||||
&cpufreq_freq_attr_scaling_available_freqs,
|
||||
NULL,
|
||||
};
|
||||
@@ -356,7 +359,7 @@ static void __exit eps_exit(void)
|
||||
cpufreq_unregister_driver(&eps_driver);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Rafa³ Bilski <rafalbilski@interia.pl>");
|
||||
MODULE_AUTHOR("Rafal Bilski <rafalbilski@interia.pl>");
|
||||
MODULE_DESCRIPTION("Enhanced PowerSaver driver for VIA C7 CPU's.");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
@@ -184,7 +184,8 @@ static int elanfreq_target(struct cpufreq_policy *policy,
|
||||
{
|
||||
unsigned int newstate = 0;
|
||||
|
||||
if (cpufreq_frequency_table_target(policy, &elanfreq_table[0], target_freq, relation, &newstate))
|
||||
if (cpufreq_frequency_table_target(policy, &elanfreq_table[0],
|
||||
target_freq, relation, &newstate))
|
||||
return -EINVAL;
|
||||
|
||||
elanfreq_set_cpu_state(newstate);
|
||||
@@ -301,7 +302,8 @@ static void __exit elanfreq_exit(void)
|
||||
module_param(max_freq, int, 0444);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Robert Schwebel <r.schwebel@pengutronix.de>, Sven Geggus <sven@geggus.net>");
|
||||
MODULE_AUTHOR("Robert Schwebel <r.schwebel@pengutronix.de>, "
|
||||
"Sven Geggus <sven@geggus.net>");
|
||||
MODULE_DESCRIPTION("cpufreq driver for AMD's Elan CPUs");
|
||||
|
||||
module_init(elanfreq_init);
|
||||
|
||||
@@ -79,8 +79,9 @@
|
||||
#include <linux/smp.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/errno.h>
|
||||
|
||||
#include <asm/processor-cyrix.h>
|
||||
#include <asm/errno.h>
|
||||
|
||||
/* PCI config registers, all at F0 */
|
||||
#define PCI_PMER1 0x80 /* power management enable register 1 */
|
||||
@@ -122,8 +123,8 @@ static struct gxfreq_params *gx_params;
|
||||
static int stock_freq;
|
||||
|
||||
/* PCI bus clock - defaults to 30.000 if cpu_khz is not available */
|
||||
static int pci_busclk = 0;
|
||||
module_param (pci_busclk, int, 0444);
|
||||
static int pci_busclk;
|
||||
module_param(pci_busclk, int, 0444);
|
||||
|
||||
/* maximum duration for which the cpu may be suspended
|
||||
* (32us * MAX_DURATION). If no parameter is given, this defaults
|
||||
@@ -132,7 +133,7 @@ module_param (pci_busclk, int, 0444);
|
||||
* is suspended -- processing power is just 0.39% of what it used to be,
|
||||
* though. 781.25 kHz(!) for a 200 MHz processor -- wow. */
|
||||
static int max_duration = 255;
|
||||
module_param (max_duration, int, 0444);
|
||||
module_param(max_duration, int, 0444);
|
||||
|
||||
/* For the default policy, we want at least some processing power
|
||||
* - let's say 5%. (min = maxfreq / POLICY_MIN_DIV)
|
||||
@@ -140,7 +141,8 @@ module_param (max_duration, int, 0444);
|
||||
#define POLICY_MIN_DIV 20
|
||||
|
||||
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "gx-suspmod", msg)
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"gx-suspmod", msg)
|
||||
|
||||
/**
|
||||
* we can detect a core multipiler from dir0_lsb
|
||||
@@ -166,12 +168,20 @@ static int gx_freq_mult[16] = {
|
||||
* Low Level chipset interface *
|
||||
****************************************************************/
|
||||
static struct pci_device_id gx_chipset_tbl[] __initdata = {
|
||||
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5510, PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
|
||||
PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520,
|
||||
PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5510,
|
||||
PCI_ANY_ID, PCI_ANY_ID },
|
||||
{ 0, },
|
||||
};
|
||||
|
||||
static void gx_write_byte(int reg, int value)
|
||||
{
|
||||
pci_write_config_byte(gx_params->cs55x0, reg, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* gx_detect_chipset:
|
||||
*
|
||||
@@ -200,7 +210,8 @@ static __init struct pci_dev *gx_detect_chipset(void)
|
||||
/**
|
||||
* gx_get_cpuspeed:
|
||||
*
|
||||
* Finds out at which efficient frequency the Cyrix MediaGX/NatSemi Geode CPU runs.
|
||||
* Finds out at which efficient frequency the Cyrix MediaGX/NatSemi
|
||||
* Geode CPU runs.
|
||||
*/
|
||||
static unsigned int gx_get_cpuspeed(unsigned int cpu)
|
||||
{
|
||||
@@ -217,17 +228,18 @@ static unsigned int gx_get_cpuspeed(unsigned int cpu)
|
||||
*
|
||||
**/
|
||||
|
||||
static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration, u8 *off_duration)
|
||||
static unsigned int gx_validate_speed(unsigned int khz, u8 *on_duration,
|
||||
u8 *off_duration)
|
||||
{
|
||||
unsigned int i;
|
||||
u8 tmp_on, tmp_off;
|
||||
int old_tmp_freq = stock_freq;
|
||||
int tmp_freq;
|
||||
|
||||
*off_duration=1;
|
||||
*on_duration=0;
|
||||
*off_duration = 1;
|
||||
*on_duration = 0;
|
||||
|
||||
for (i=max_duration; i>0; i--) {
|
||||
for (i = max_duration; i > 0; i--) {
|
||||
tmp_off = ((khz * i) / stock_freq) & 0xff;
|
||||
tmp_on = i - tmp_off;
|
||||
tmp_freq = (stock_freq * tmp_off) / i;
|
||||
@@ -259,26 +271,34 @@ static void gx_set_cpuspeed(unsigned int khz)
|
||||
freqs.cpu = 0;
|
||||
freqs.old = gx_get_cpuspeed(0);
|
||||
|
||||
new_khz = gx_validate_speed(khz, &gx_params->on_duration, &gx_params->off_duration);
|
||||
new_khz = gx_validate_speed(khz, &gx_params->on_duration,
|
||||
&gx_params->off_duration);
|
||||
|
||||
freqs.new = new_khz;
|
||||
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
|
||||
local_irq_save(flags);
|
||||
|
||||
if (new_khz != stock_freq) { /* if new khz == 100% of CPU speed, it is special case */
|
||||
|
||||
|
||||
if (new_khz != stock_freq) {
|
||||
/* if new khz == 100% of CPU speed, it is special case */
|
||||
switch (gx_params->cs55x0->device) {
|
||||
case PCI_DEVICE_ID_CYRIX_5530_LEGACY:
|
||||
pmer1 = gx_params->pci_pmer1 | IRQ_SPDUP | VID_SPDUP;
|
||||
/* FIXME: need to test other values -- Zwane,Miura */
|
||||
pci_write_config_byte(gx_params->cs55x0, PCI_IRQTC, 4); /* typical 2 to 4ms */
|
||||
pci_write_config_byte(gx_params->cs55x0, PCI_VIDTC, 100);/* typical 50 to 100ms */
|
||||
pci_write_config_byte(gx_params->cs55x0, PCI_PMER1, pmer1);
|
||||
/* typical 2 to 4ms */
|
||||
gx_write_byte(PCI_IRQTC, 4);
|
||||
/* typical 50 to 100ms */
|
||||
gx_write_byte(PCI_VIDTC, 100);
|
||||
gx_write_byte(PCI_PMER1, pmer1);
|
||||
|
||||
if (gx_params->cs55x0->revision < 0x10) { /* CS5530(rev 1.2, 1.3) */
|
||||
suscfg = gx_params->pci_suscfg | SUSMOD;
|
||||
} else { /* CS5530A,B.. */
|
||||
suscfg = gx_params->pci_suscfg | SUSMOD | PWRSVE;
|
||||
if (gx_params->cs55x0->revision < 0x10) {
|
||||
/* CS5530(rev 1.2, 1.3) */
|
||||
suscfg = gx_params->pci_suscfg|SUSMOD;
|
||||
} else {
|
||||
/* CS5530A,B.. */
|
||||
suscfg = gx_params->pci_suscfg|SUSMOD|PWRSVE;
|
||||
}
|
||||
break;
|
||||
case PCI_DEVICE_ID_CYRIX_5520:
|
||||
@@ -294,13 +314,13 @@ static void gx_set_cpuspeed(unsigned int khz)
|
||||
suscfg = gx_params->pci_suscfg & ~(SUSMOD);
|
||||
gx_params->off_duration = 0;
|
||||
gx_params->on_duration = 0;
|
||||
dprintk("suspend modulation disabled: cpu runs 100 percent speed.\n");
|
||||
dprintk("suspend modulation disabled: cpu runs 100%% speed.\n");
|
||||
}
|
||||
|
||||
pci_write_config_byte(gx_params->cs55x0, PCI_MODOFF, gx_params->off_duration);
|
||||
pci_write_config_byte(gx_params->cs55x0, PCI_MODON, gx_params->on_duration);
|
||||
gx_write_byte(PCI_MODOFF, gx_params->off_duration);
|
||||
gx_write_byte(PCI_MODON, gx_params->on_duration);
|
||||
|
||||
pci_write_config_byte(gx_params->cs55x0, PCI_SUSCFG, suscfg);
|
||||
gx_write_byte(PCI_SUSCFG, suscfg);
|
||||
pci_read_config_byte(gx_params->cs55x0, PCI_SUSCFG, &suscfg);
|
||||
|
||||
local_irq_restore(flags);
|
||||
@@ -334,7 +354,8 @@ static int cpufreq_gx_verify(struct cpufreq_policy *policy)
|
||||
return -EINVAL;
|
||||
|
||||
policy->cpu = 0;
|
||||
cpufreq_verify_within_limits(policy, (stock_freq / max_duration), stock_freq);
|
||||
cpufreq_verify_within_limits(policy, (stock_freq / max_duration),
|
||||
stock_freq);
|
||||
|
||||
/* it needs to be assured that at least one supported frequency is
|
||||
* within policy->min and policy->max. If it is not, policy->max
|
||||
@@ -354,7 +375,8 @@ static int cpufreq_gx_verify(struct cpufreq_policy *policy)
|
||||
policy->max = tmp_freq;
|
||||
if (policy->max < policy->min)
|
||||
policy->max = policy->min;
|
||||
cpufreq_verify_within_limits(policy, (stock_freq / max_duration), stock_freq);
|
||||
cpufreq_verify_within_limits(policy, (stock_freq / max_duration),
|
||||
stock_freq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -398,18 +420,18 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy)
|
||||
return -ENODEV;
|
||||
|
||||
/* determine maximum frequency */
|
||||
if (pci_busclk) {
|
||||
if (pci_busclk)
|
||||
maxfreq = pci_busclk * gx_freq_mult[getCx86(CX86_DIR1) & 0x0f];
|
||||
} else if (cpu_khz) {
|
||||
else if (cpu_khz)
|
||||
maxfreq = cpu_khz;
|
||||
} else {
|
||||
else
|
||||
maxfreq = 30000 * gx_freq_mult[getCx86(CX86_DIR1) & 0x0f];
|
||||
}
|
||||
|
||||
stock_freq = maxfreq;
|
||||
curfreq = gx_get_cpuspeed(0);
|
||||
|
||||
dprintk("cpu max frequency is %d.\n", maxfreq);
|
||||
dprintk("cpu current frequency is %dkHz.\n",curfreq);
|
||||
dprintk("cpu current frequency is %dkHz.\n", curfreq);
|
||||
|
||||
/* setup basic struct for cpufreq API */
|
||||
policy->cpu = 0;
|
||||
@@ -447,7 +469,8 @@ static int __init cpufreq_gx_init(void)
|
||||
struct pci_dev *gx_pci;
|
||||
|
||||
/* Test if we have the right hardware */
|
||||
if ((gx_pci = gx_detect_chipset()) == NULL)
|
||||
gx_pci = gx_detect_chipset();
|
||||
if (gx_pci == NULL)
|
||||
return -ENODEV;
|
||||
|
||||
/* check whether module parameters are sane */
|
||||
@@ -468,9 +491,11 @@ static int __init cpufreq_gx_init(void)
|
||||
pci_read_config_byte(params->cs55x0, PCI_PMER1, &(params->pci_pmer1));
|
||||
pci_read_config_byte(params->cs55x0, PCI_PMER2, &(params->pci_pmer2));
|
||||
pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration));
|
||||
pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration));
|
||||
pci_read_config_byte(params->cs55x0, PCI_MODOFF,
|
||||
&(params->off_duration));
|
||||
|
||||
if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) {
|
||||
ret = cpufreq_register_driver(&gx_suspmod_driver);
|
||||
if (ret) {
|
||||
kfree(params);
|
||||
return ret; /* register error! */
|
||||
}
|
||||
@@ -485,9 +510,9 @@ static void __exit cpufreq_gx_exit(void)
|
||||
kfree(gx_params);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR ("Hiroshi Miura <miura@da-cha.org>");
|
||||
MODULE_DESCRIPTION ("Cpufreq driver for Cyrix MediaGX and NatSemi Geode");
|
||||
MODULE_LICENSE ("GPL");
|
||||
MODULE_AUTHOR("Hiroshi Miura <miura@da-cha.org>");
|
||||
MODULE_DESCRIPTION("Cpufreq driver for Cyrix MediaGX and NatSemi Geode");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_init(cpufreq_gx_init);
|
||||
module_exit(cpufreq_gx_exit);
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <asm/msr.h>
|
||||
#include <asm/timex.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/acpi.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <acpi/processor.h>
|
||||
|
||||
#include "longhaul.h"
|
||||
@@ -58,7 +58,7 @@
|
||||
#define USE_NORTHBRIDGE (1 << 2)
|
||||
|
||||
static int cpu_model;
|
||||
static unsigned int numscales=16;
|
||||
static unsigned int numscales = 16;
|
||||
static unsigned int fsb;
|
||||
|
||||
static const struct mV_pos *vrm_mV_table;
|
||||
@@ -67,8 +67,8 @@ static const unsigned char *mV_vrm_table;
|
||||
static unsigned int highest_speed, lowest_speed; /* kHz */
|
||||
static unsigned int minmult, maxmult;
|
||||
static int can_scale_voltage;
|
||||
static struct acpi_processor *pr = NULL;
|
||||
static struct acpi_processor_cx *cx = NULL;
|
||||
static struct acpi_processor *pr;
|
||||
static struct acpi_processor_cx *cx;
|
||||
static u32 acpi_regs_addr;
|
||||
static u8 longhaul_flags;
|
||||
static unsigned int longhaul_index;
|
||||
@@ -78,12 +78,13 @@ static int scale_voltage;
|
||||
static int disable_acpi_c3;
|
||||
static int revid_errata;
|
||||
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "longhaul", msg)
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"longhaul", msg)
|
||||
|
||||
|
||||
/* Clock ratios multiplied by 10 */
|
||||
static int clock_ratio[32];
|
||||
static int eblcr_table[32];
|
||||
static int mults[32];
|
||||
static int eblcr[32];
|
||||
static int longhaul_version;
|
||||
static struct cpufreq_frequency_table *longhaul_table;
|
||||
|
||||
@@ -93,7 +94,7 @@ static char speedbuffer[8];
|
||||
static char *print_speed(int speed)
|
||||
{
|
||||
if (speed < 1000) {
|
||||
snprintf(speedbuffer, sizeof(speedbuffer),"%dMHz", speed);
|
||||
snprintf(speedbuffer, sizeof(speedbuffer), "%dMHz", speed);
|
||||
return speedbuffer;
|
||||
}
|
||||
|
||||
@@ -122,27 +123,28 @@ static unsigned int calc_speed(int mult)
|
||||
|
||||
static int longhaul_get_cpu_mult(void)
|
||||
{
|
||||
unsigned long invalue=0,lo, hi;
|
||||
unsigned long invalue = 0, lo, hi;
|
||||
|
||||
rdmsr (MSR_IA32_EBL_CR_POWERON, lo, hi);
|
||||
invalue = (lo & (1<<22|1<<23|1<<24|1<<25)) >>22;
|
||||
if (longhaul_version==TYPE_LONGHAUL_V2 || longhaul_version==TYPE_POWERSAVER) {
|
||||
rdmsr(MSR_IA32_EBL_CR_POWERON, lo, hi);
|
||||
invalue = (lo & (1<<22|1<<23|1<<24|1<<25))>>22;
|
||||
if (longhaul_version == TYPE_LONGHAUL_V2 ||
|
||||
longhaul_version == TYPE_POWERSAVER) {
|
||||
if (lo & (1<<27))
|
||||
invalue+=16;
|
||||
invalue += 16;
|
||||
}
|
||||
return eblcr_table[invalue];
|
||||
return eblcr[invalue];
|
||||
}
|
||||
|
||||
/* For processor with BCR2 MSR */
|
||||
|
||||
static void do_longhaul1(unsigned int clock_ratio_index)
|
||||
static void do_longhaul1(unsigned int mults_index)
|
||||
{
|
||||
union msr_bcr2 bcr2;
|
||||
|
||||
rdmsrl(MSR_VIA_BCR2, bcr2.val);
|
||||
/* Enable software clock multiplier */
|
||||
bcr2.bits.ESOFTBF = 1;
|
||||
bcr2.bits.CLOCKMUL = clock_ratio_index & 0xff;
|
||||
bcr2.bits.CLOCKMUL = mults_index & 0xff;
|
||||
|
||||
/* Sync to timer tick */
|
||||
safe_halt();
|
||||
@@ -161,7 +163,7 @@ static void do_longhaul1(unsigned int clock_ratio_index)
|
||||
|
||||
/* For processor with Longhaul MSR */
|
||||
|
||||
static void do_powersaver(int cx_address, unsigned int clock_ratio_index,
|
||||
static void do_powersaver(int cx_address, unsigned int mults_index,
|
||||
unsigned int dir)
|
||||
{
|
||||
union msr_longhaul longhaul;
|
||||
@@ -173,11 +175,11 @@ static void do_powersaver(int cx_address, unsigned int clock_ratio_index,
|
||||
longhaul.bits.RevisionKey = longhaul.bits.RevisionID;
|
||||
else
|
||||
longhaul.bits.RevisionKey = 0;
|
||||
longhaul.bits.SoftBusRatio = clock_ratio_index & 0xf;
|
||||
longhaul.bits.SoftBusRatio4 = (clock_ratio_index & 0x10) >> 4;
|
||||
longhaul.bits.SoftBusRatio = mults_index & 0xf;
|
||||
longhaul.bits.SoftBusRatio4 = (mults_index & 0x10) >> 4;
|
||||
/* Setup new voltage */
|
||||
if (can_scale_voltage)
|
||||
longhaul.bits.SoftVID = (clock_ratio_index >> 8) & 0x1f;
|
||||
longhaul.bits.SoftVID = (mults_index >> 8) & 0x1f;
|
||||
/* Sync to timer tick */
|
||||
safe_halt();
|
||||
/* Raise voltage if necessary */
|
||||
@@ -240,14 +242,14 @@ static void do_powersaver(int cx_address, unsigned int clock_ratio_index,
|
||||
|
||||
/**
|
||||
* longhaul_set_cpu_frequency()
|
||||
* @clock_ratio_index : bitpattern of the new multiplier.
|
||||
* @mults_index : bitpattern of the new multiplier.
|
||||
*
|
||||
* Sets a new clock ratio.
|
||||
*/
|
||||
|
||||
static void longhaul_setstate(unsigned int table_index)
|
||||
{
|
||||
unsigned int clock_ratio_index;
|
||||
unsigned int mults_index;
|
||||
int speed, mult;
|
||||
struct cpufreq_freqs freqs;
|
||||
unsigned long flags;
|
||||
@@ -256,9 +258,9 @@ static void longhaul_setstate(unsigned int table_index)
|
||||
u32 bm_timeout = 1000;
|
||||
unsigned int dir = 0;
|
||||
|
||||
clock_ratio_index = longhaul_table[table_index].index;
|
||||
mults_index = longhaul_table[table_index].index;
|
||||
/* Safety precautions */
|
||||
mult = clock_ratio[clock_ratio_index & 0x1f];
|
||||
mult = mults[mults_index & 0x1f];
|
||||
if (mult == -1)
|
||||
return;
|
||||
speed = calc_speed(mult);
|
||||
@@ -274,7 +276,7 @@ static void longhaul_setstate(unsigned int table_index)
|
||||
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
|
||||
|
||||
dprintk ("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n",
|
||||
dprintk("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n",
|
||||
fsb, mult/10, mult%10, print_speed(speed/1000));
|
||||
retry_loop:
|
||||
preempt_disable();
|
||||
@@ -282,8 +284,8 @@ retry_loop:
|
||||
|
||||
pic2_mask = inb(0xA1);
|
||||
pic1_mask = inb(0x21); /* works on C3. save mask. */
|
||||
outb(0xFF,0xA1); /* Overkill */
|
||||
outb(0xFE,0x21); /* TMR0 only */
|
||||
outb(0xFF, 0xA1); /* Overkill */
|
||||
outb(0xFE, 0x21); /* TMR0 only */
|
||||
|
||||
/* Wait while PCI bus is busy. */
|
||||
if (acpi_regs_addr && (longhaul_flags & USE_NORTHBRIDGE
|
||||
@@ -312,7 +314,7 @@ retry_loop:
|
||||
* Software controlled multipliers only.
|
||||
*/
|
||||
case TYPE_LONGHAUL_V1:
|
||||
do_longhaul1(clock_ratio_index);
|
||||
do_longhaul1(mults_index);
|
||||
break;
|
||||
|
||||
/*
|
||||
@@ -327,9 +329,9 @@ retry_loop:
|
||||
if (longhaul_flags & USE_ACPI_C3) {
|
||||
/* Don't allow wakeup */
|
||||
acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
|
||||
do_powersaver(cx->address, clock_ratio_index, dir);
|
||||
do_powersaver(cx->address, mults_index, dir);
|
||||
} else {
|
||||
do_powersaver(0, clock_ratio_index, dir);
|
||||
do_powersaver(0, mults_index, dir);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -341,8 +343,8 @@ retry_loop:
|
||||
/* Enable bus master arbitration */
|
||||
acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
|
||||
}
|
||||
outb(pic2_mask,0xA1); /* restore mask */
|
||||
outb(pic1_mask,0x21);
|
||||
outb(pic2_mask, 0xA1); /* restore mask */
|
||||
outb(pic1_mask, 0x21);
|
||||
|
||||
local_irq_restore(flags);
|
||||
preempt_enable();
|
||||
@@ -392,7 +394,8 @@ retry_loop:
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
|
||||
|
||||
if (!bm_timeout)
|
||||
printk(KERN_INFO PFX "Warning: Timeout while waiting for idle PCI bus.\n");
|
||||
printk(KERN_INFO PFX "Warning: Timeout while waiting for "
|
||||
"idle PCI bus.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -458,31 +461,32 @@ static int __init longhaul_get_ranges(void)
|
||||
break;
|
||||
}
|
||||
|
||||
dprintk ("MinMult:%d.%dx MaxMult:%d.%dx\n",
|
||||
dprintk("MinMult:%d.%dx MaxMult:%d.%dx\n",
|
||||
minmult/10, minmult%10, maxmult/10, maxmult%10);
|
||||
|
||||
highest_speed = calc_speed(maxmult);
|
||||
lowest_speed = calc_speed(minmult);
|
||||
dprintk ("FSB:%dMHz Lowest speed: %s Highest speed:%s\n", fsb,
|
||||
dprintk("FSB:%dMHz Lowest speed: %s Highest speed:%s\n", fsb,
|
||||
print_speed(lowest_speed/1000),
|
||||
print_speed(highest_speed/1000));
|
||||
|
||||
if (lowest_speed == highest_speed) {
|
||||
printk (KERN_INFO PFX "highestspeed == lowest, aborting.\n");
|
||||
printk(KERN_INFO PFX "highestspeed == lowest, aborting.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (lowest_speed > highest_speed) {
|
||||
printk (KERN_INFO PFX "nonsense! lowest (%d > %d) !\n",
|
||||
printk(KERN_INFO PFX "nonsense! lowest (%d > %d) !\n",
|
||||
lowest_speed, highest_speed);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
longhaul_table = kmalloc((numscales + 1) * sizeof(struct cpufreq_frequency_table), GFP_KERNEL);
|
||||
if(!longhaul_table)
|
||||
longhaul_table = kmalloc((numscales + 1) * sizeof(*longhaul_table),
|
||||
GFP_KERNEL);
|
||||
if (!longhaul_table)
|
||||
return -ENOMEM;
|
||||
|
||||
for (j = 0; j < numscales; j++) {
|
||||
ratio = clock_ratio[j];
|
||||
ratio = mults[j];
|
||||
if (ratio == -1)
|
||||
continue;
|
||||
if (ratio > maxmult || ratio < minmult)
|
||||
@@ -507,13 +511,10 @@ static int __init longhaul_get_ranges(void)
|
||||
}
|
||||
}
|
||||
if (min_i != j) {
|
||||
unsigned int temp;
|
||||
temp = longhaul_table[j].frequency;
|
||||
longhaul_table[j].frequency = longhaul_table[min_i].frequency;
|
||||
longhaul_table[min_i].frequency = temp;
|
||||
temp = longhaul_table[j].index;
|
||||
longhaul_table[j].index = longhaul_table[min_i].index;
|
||||
longhaul_table[min_i].index = temp;
|
||||
swap(longhaul_table[j].frequency,
|
||||
longhaul_table[min_i].frequency);
|
||||
swap(longhaul_table[j].index,
|
||||
longhaul_table[min_i].index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +522,7 @@ static int __init longhaul_get_ranges(void)
|
||||
|
||||
/* Find index we are running on */
|
||||
for (j = 0; j < k; j++) {
|
||||
if (clock_ratio[longhaul_table[j].index & 0x1f] == mult) {
|
||||
if (mults[longhaul_table[j].index & 0x1f] == mult) {
|
||||
longhaul_index = j;
|
||||
break;
|
||||
}
|
||||
@@ -559,20 +560,22 @@ static void __init longhaul_setup_voltagescaling(void)
|
||||
maxvid = vrm_mV_table[longhaul.bits.MaximumVID];
|
||||
|
||||
if (minvid.mV == 0 || maxvid.mV == 0 || minvid.mV > maxvid.mV) {
|
||||
printk (KERN_INFO PFX "Bogus values Min:%d.%03d Max:%d.%03d. "
|
||||
printk(KERN_INFO PFX "Bogus values Min:%d.%03d Max:%d.%03d. "
|
||||
"Voltage scaling disabled.\n",
|
||||
minvid.mV/1000, minvid.mV%1000, maxvid.mV/1000, maxvid.mV%1000);
|
||||
minvid.mV/1000, minvid.mV%1000,
|
||||
maxvid.mV/1000, maxvid.mV%1000);
|
||||
return;
|
||||
}
|
||||
|
||||
if (minvid.mV == maxvid.mV) {
|
||||
printk (KERN_INFO PFX "Claims to support voltage scaling but min & max are "
|
||||
"both %d.%03d. Voltage scaling disabled\n",
|
||||
printk(KERN_INFO PFX "Claims to support voltage scaling but "
|
||||
"min & max are both %d.%03d. "
|
||||
"Voltage scaling disabled\n",
|
||||
maxvid.mV/1000, maxvid.mV%1000);
|
||||
return;
|
||||
}
|
||||
|
||||
/* How many voltage steps */
|
||||
/* How many voltage steps*/
|
||||
numvscales = maxvid.pos - minvid.pos + 1;
|
||||
printk(KERN_INFO PFX
|
||||
"Max VID=%d.%03d "
|
||||
@@ -586,7 +589,7 @@ static void __init longhaul_setup_voltagescaling(void)
|
||||
j = longhaul.bits.MinMHzBR;
|
||||
if (longhaul.bits.MinMHzBR4)
|
||||
j += 16;
|
||||
min_vid_speed = eblcr_table[j];
|
||||
min_vid_speed = eblcr[j];
|
||||
if (min_vid_speed == -1)
|
||||
return;
|
||||
switch (longhaul.bits.MinMHzFSB) {
|
||||
@@ -617,7 +620,8 @@ static void __init longhaul_setup_voltagescaling(void)
|
||||
pos = minvid.pos;
|
||||
longhaul_table[j].index |= mV_vrm_table[pos] << 8;
|
||||
vid = vrm_mV_table[mV_vrm_table[pos]];
|
||||
printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n", speed, j, vid.mV);
|
||||
printk(KERN_INFO PFX "f: %d kHz, index: %d, vid: %d mV\n",
|
||||
speed, j, vid.mV);
|
||||
j++;
|
||||
}
|
||||
|
||||
@@ -640,7 +644,8 @@ static int longhaul_target(struct cpufreq_policy *policy,
|
||||
unsigned int dir = 0;
|
||||
u8 vid, current_vid;
|
||||
|
||||
if (cpufreq_frequency_table_target(policy, longhaul_table, target_freq, relation, &table_index))
|
||||
if (cpufreq_frequency_table_target(policy, longhaul_table, target_freq,
|
||||
relation, &table_index))
|
||||
return -EINVAL;
|
||||
|
||||
/* Don't set same frequency again */
|
||||
@@ -656,7 +661,8 @@ static int longhaul_target(struct cpufreq_policy *policy,
|
||||
* this in hardware, C3 is old and we need to do this
|
||||
* in software. */
|
||||
i = longhaul_index;
|
||||
current_vid = (longhaul_table[longhaul_index].index >> 8) & 0x1f;
|
||||
current_vid = (longhaul_table[longhaul_index].index >> 8);
|
||||
current_vid &= 0x1f;
|
||||
if (table_index > longhaul_index)
|
||||
dir = 1;
|
||||
while (i != table_index) {
|
||||
@@ -691,9 +697,9 @@ static acpi_status longhaul_walk_callback(acpi_handle obj_handle,
|
||||
{
|
||||
struct acpi_device *d;
|
||||
|
||||
if ( acpi_bus_get_device(obj_handle, &d) ) {
|
||||
if (acpi_bus_get_device(obj_handle, &d))
|
||||
return 0;
|
||||
}
|
||||
|
||||
*return_value = acpi_driver_data(d);
|
||||
return 1;
|
||||
}
|
||||
@@ -750,7 +756,7 @@ static int longhaul_setup_southbridge(void)
|
||||
/* Find VT8235 southbridge */
|
||||
dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL);
|
||||
if (dev == NULL)
|
||||
/* Find VT8237 southbridge */
|
||||
/* Find VT8237 southbridge */
|
||||
dev = pci_get_device(PCI_VENDOR_ID_VIA,
|
||||
PCI_DEVICE_ID_VIA_8237, NULL);
|
||||
if (dev != NULL) {
|
||||
@@ -769,7 +775,8 @@ static int longhaul_setup_southbridge(void)
|
||||
if (pci_cmd & 1 << 7) {
|
||||
pci_read_config_dword(dev, 0x88, &acpi_regs_addr);
|
||||
acpi_regs_addr &= 0xff00;
|
||||
printk(KERN_INFO PFX "ACPI I/O at 0x%x\n", acpi_regs_addr);
|
||||
printk(KERN_INFO PFX "ACPI I/O at 0x%x\n",
|
||||
acpi_regs_addr);
|
||||
}
|
||||
|
||||
pci_dev_put(dev);
|
||||
@@ -781,7 +788,7 @@ static int longhaul_setup_southbridge(void)
|
||||
static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpuinfo_x86 *c = &cpu_data(0);
|
||||
char *cpuname=NULL;
|
||||
char *cpuname = NULL;
|
||||
int ret;
|
||||
u32 lo, hi;
|
||||
|
||||
@@ -791,8 +798,8 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
|
||||
cpu_model = CPU_SAMUEL;
|
||||
cpuname = "C3 'Samuel' [C5A]";
|
||||
longhaul_version = TYPE_LONGHAUL_V1;
|
||||
memcpy (clock_ratio, samuel1_clock_ratio, sizeof(samuel1_clock_ratio));
|
||||
memcpy (eblcr_table, samuel1_eblcr, sizeof(samuel1_eblcr));
|
||||
memcpy(mults, samuel1_mults, sizeof(samuel1_mults));
|
||||
memcpy(eblcr, samuel1_eblcr, sizeof(samuel1_eblcr));
|
||||
break;
|
||||
|
||||
case 7:
|
||||
@@ -803,10 +810,8 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
|
||||
cpuname = "C3 'Samuel 2' [C5B]";
|
||||
/* Note, this is not a typo, early Samuel2's had
|
||||
* Samuel1 ratios. */
|
||||
memcpy(clock_ratio, samuel1_clock_ratio,
|
||||
sizeof(samuel1_clock_ratio));
|
||||
memcpy(eblcr_table, samuel2_eblcr,
|
||||
sizeof(samuel2_eblcr));
|
||||
memcpy(mults, samuel1_mults, sizeof(samuel1_mults));
|
||||
memcpy(eblcr, samuel2_eblcr, sizeof(samuel2_eblcr));
|
||||
break;
|
||||
case 1 ... 15:
|
||||
longhaul_version = TYPE_LONGHAUL_V1;
|
||||
@@ -817,10 +822,8 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
|
||||
cpu_model = CPU_EZRA;
|
||||
cpuname = "C3 'Ezra' [C5C]";
|
||||
}
|
||||
memcpy(clock_ratio, ezra_clock_ratio,
|
||||
sizeof(ezra_clock_ratio));
|
||||
memcpy(eblcr_table, ezra_eblcr,
|
||||
sizeof(ezra_eblcr));
|
||||
memcpy(mults, ezra_mults, sizeof(ezra_mults));
|
||||
memcpy(eblcr, ezra_eblcr, sizeof(ezra_eblcr));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -829,18 +832,16 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
|
||||
cpu_model = CPU_EZRA_T;
|
||||
cpuname = "C3 'Ezra-T' [C5M]";
|
||||
longhaul_version = TYPE_POWERSAVER;
|
||||
numscales=32;
|
||||
memcpy (clock_ratio, ezrat_clock_ratio, sizeof(ezrat_clock_ratio));
|
||||
memcpy (eblcr_table, ezrat_eblcr, sizeof(ezrat_eblcr));
|
||||
numscales = 32;
|
||||
memcpy(mults, ezrat_mults, sizeof(ezrat_mults));
|
||||
memcpy(eblcr, ezrat_eblcr, sizeof(ezrat_eblcr));
|
||||
break;
|
||||
|
||||
case 9:
|
||||
longhaul_version = TYPE_POWERSAVER;
|
||||
numscales = 32;
|
||||
memcpy(clock_ratio,
|
||||
nehemiah_clock_ratio,
|
||||
sizeof(nehemiah_clock_ratio));
|
||||
memcpy(eblcr_table, nehemiah_eblcr, sizeof(nehemiah_eblcr));
|
||||
memcpy(mults, nehemiah_mults, sizeof(nehemiah_mults));
|
||||
memcpy(eblcr, nehemiah_eblcr, sizeof(nehemiah_eblcr));
|
||||
switch (c->x86_mask) {
|
||||
case 0 ... 1:
|
||||
cpu_model = CPU_NEHEMIAH;
|
||||
@@ -869,14 +870,14 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
|
||||
longhaul_version = TYPE_LONGHAUL_V1;
|
||||
}
|
||||
|
||||
printk (KERN_INFO PFX "VIA %s CPU detected. ", cpuname);
|
||||
printk(KERN_INFO PFX "VIA %s CPU detected. ", cpuname);
|
||||
switch (longhaul_version) {
|
||||
case TYPE_LONGHAUL_V1:
|
||||
case TYPE_LONGHAUL_V2:
|
||||
printk ("Longhaul v%d supported.\n", longhaul_version);
|
||||
printk(KERN_CONT "Longhaul v%d supported.\n", longhaul_version);
|
||||
break;
|
||||
case TYPE_POWERSAVER:
|
||||
printk ("Powersaver supported.\n");
|
||||
printk(KERN_CONT "Powersaver supported.\n");
|
||||
break;
|
||||
};
|
||||
|
||||
@@ -940,7 +941,7 @@ static int __devexit longhaul_cpu_exit(struct cpufreq_policy *policy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct freq_attr* longhaul_attr[] = {
|
||||
static struct freq_attr *longhaul_attr[] = {
|
||||
&cpufreq_freq_attr_scaling_available_freqs,
|
||||
NULL,
|
||||
};
|
||||
@@ -966,13 +967,15 @@ static int __init longhaul_init(void)
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
if (num_online_cpus() > 1) {
|
||||
printk(KERN_ERR PFX "More than 1 CPU detected, longhaul disabled.\n");
|
||||
printk(KERN_ERR PFX "More than 1 CPU detected, "
|
||||
"longhaul disabled.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_X86_IO_APIC
|
||||
if (cpu_has_apic) {
|
||||
printk(KERN_ERR PFX "APIC detected. Longhaul is currently broken in this configuration.\n");
|
||||
printk(KERN_ERR PFX "APIC detected. Longhaul is currently "
|
||||
"broken in this configuration.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
#endif
|
||||
@@ -993,8 +996,8 @@ static void __exit longhaul_exit(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i < numscales; i++) {
|
||||
if (clock_ratio[i] == maxmult) {
|
||||
for (i = 0; i < numscales; i++) {
|
||||
if (mults[i] == maxmult) {
|
||||
longhaul_setstate(i);
|
||||
break;
|
||||
}
|
||||
@@ -1007,11 +1010,11 @@ static void __exit longhaul_exit(void)
|
||||
/* Even if BIOS is exporting ACPI C3 state, and it is used
|
||||
* with success when CPU is idle, this state doesn't
|
||||
* trigger frequency transition in some cases. */
|
||||
module_param (disable_acpi_c3, int, 0644);
|
||||
module_param(disable_acpi_c3, int, 0644);
|
||||
MODULE_PARM_DESC(disable_acpi_c3, "Don't use ACPI C3 support");
|
||||
/* Change CPU voltage with frequency. Very usefull to save
|
||||
* power, but most VIA C3 processors aren't supporting it. */
|
||||
module_param (scale_voltage, int, 0644);
|
||||
module_param(scale_voltage, int, 0644);
|
||||
MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor");
|
||||
/* Force revision key to 0 for processors which doesn't
|
||||
* support voltage scaling, but are introducing itself as
|
||||
@@ -1019,9 +1022,9 @@ MODULE_PARM_DESC(scale_voltage, "Scale voltage of processor");
|
||||
module_param(revid_errata, int, 0644);
|
||||
MODULE_PARM_DESC(revid_errata, "Ignore CPU Revision ID");
|
||||
|
||||
MODULE_AUTHOR ("Dave Jones <davej@redhat.com>");
|
||||
MODULE_DESCRIPTION ("Longhaul driver for VIA Cyrix processors.");
|
||||
MODULE_LICENSE ("GPL");
|
||||
MODULE_AUTHOR("Dave Jones <davej@redhat.com>");
|
||||
MODULE_DESCRIPTION("Longhaul driver for VIA Cyrix processors.");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
late_initcall(longhaul_init);
|
||||
module_exit(longhaul_exit);
|
||||
|
||||
@@ -49,14 +49,14 @@ union msr_longhaul {
|
||||
|
||||
/*
|
||||
* Clock ratio tables. Div/Mod by 10 to get ratio.
|
||||
* The eblcr ones specify the ratio read from the CPU.
|
||||
* The clock_ratio ones specify what to write to the CPU.
|
||||
* The eblcr values specify the ratio read from the CPU.
|
||||
* The mults values specify what to write to the CPU.
|
||||
*/
|
||||
|
||||
/*
|
||||
* VIA C3 Samuel 1 & Samuel 2 (stepping 0)
|
||||
*/
|
||||
static const int __initdata samuel1_clock_ratio[16] = {
|
||||
static const int __initdata samuel1_mults[16] = {
|
||||
-1, /* 0000 -> RESERVED */
|
||||
30, /* 0001 -> 3.0x */
|
||||
40, /* 0010 -> 4.0x */
|
||||
@@ -119,7 +119,7 @@ static const int __initdata samuel2_eblcr[16] = {
|
||||
/*
|
||||
* VIA C3 Ezra
|
||||
*/
|
||||
static const int __initdata ezra_clock_ratio[16] = {
|
||||
static const int __initdata ezra_mults[16] = {
|
||||
100, /* 0000 -> 10.0x */
|
||||
30, /* 0001 -> 3.0x */
|
||||
40, /* 0010 -> 4.0x */
|
||||
@@ -160,7 +160,7 @@ static const int __initdata ezra_eblcr[16] = {
|
||||
/*
|
||||
* VIA C3 (Ezra-T) [C5M].
|
||||
*/
|
||||
static const int __initdata ezrat_clock_ratio[32] = {
|
||||
static const int __initdata ezrat_mults[32] = {
|
||||
100, /* 0000 -> 10.0x */
|
||||
30, /* 0001 -> 3.0x */
|
||||
40, /* 0010 -> 4.0x */
|
||||
@@ -235,7 +235,7 @@ static const int __initdata ezrat_eblcr[32] = {
|
||||
/*
|
||||
* VIA C3 Nehemiah */
|
||||
|
||||
static const int __initdata nehemiah_clock_ratio[32] = {
|
||||
static const int __initdata nehemiah_mults[32] = {
|
||||
100, /* 0000 -> 10.0x */
|
||||
-1, /* 0001 -> 16.0x */
|
||||
40, /* 0010 -> 4.0x */
|
||||
|
||||
@@ -11,12 +11,13 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/timex.h>
|
||||
|
||||
#include <asm/msr.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/timex.h>
|
||||
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "longrun", msg)
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"longrun", msg)
|
||||
|
||||
static struct cpufreq_driver longrun_driver;
|
||||
|
||||
@@ -51,7 +52,7 @@ static void __init longrun_get_policy(struct cpufreq_policy *policy)
|
||||
msr_lo &= 0x0000007F;
|
||||
msr_hi &= 0x0000007F;
|
||||
|
||||
if ( longrun_high_freq <= longrun_low_freq ) {
|
||||
if (longrun_high_freq <= longrun_low_freq) {
|
||||
/* Assume degenerate Longrun table */
|
||||
policy->min = policy->max = longrun_high_freq;
|
||||
} else {
|
||||
@@ -79,7 +80,7 @@ static int longrun_set_policy(struct cpufreq_policy *policy)
|
||||
if (!policy)
|
||||
return -EINVAL;
|
||||
|
||||
if ( longrun_high_freq <= longrun_low_freq ) {
|
||||
if (longrun_high_freq <= longrun_low_freq) {
|
||||
/* Assume degenerate Longrun table */
|
||||
pctg_lo = pctg_hi = 100;
|
||||
} else {
|
||||
@@ -152,7 +153,7 @@ static unsigned int longrun_get(unsigned int cpu)
|
||||
cpuid(0x80860007, &eax, &ebx, &ecx, &edx);
|
||||
dprintk("cpuid eax is %u\n", eax);
|
||||
|
||||
return (eax * 1000);
|
||||
return eax * 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,7 +197,8 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
|
||||
rdmsr(MSR_TMTA_LRTI_VOLT_MHZ, msr_lo, msr_hi);
|
||||
*high_freq = msr_lo * 1000; /* to kHz */
|
||||
|
||||
dprintk("longrun table interface told %u - %u kHz\n", *low_freq, *high_freq);
|
||||
dprintk("longrun table interface told %u - %u kHz\n",
|
||||
*low_freq, *high_freq);
|
||||
|
||||
if (*low_freq > *high_freq)
|
||||
*low_freq = *high_freq;
|
||||
@@ -219,7 +221,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
|
||||
cpuid(0x80860007, &eax, &ebx, &ecx, &edx);
|
||||
/* try decreasing in 10% steps, some processors react only
|
||||
* on some barrier values */
|
||||
for (try_hi = 80; try_hi > 0 && ecx > 90; try_hi -=10) {
|
||||
for (try_hi = 80; try_hi > 0 && ecx > 90; try_hi -= 10) {
|
||||
/* set to 0 to try_hi perf_pctg */
|
||||
msr_lo &= 0xFFFFFF80;
|
||||
msr_hi &= 0xFFFFFF80;
|
||||
@@ -236,7 +238,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
|
||||
|
||||
/* performance_pctg = (current_freq - low_freq)/(high_freq - low_freq)
|
||||
* eqals
|
||||
* low_freq * ( 1 - perf_pctg) = (cur_freq - high_freq * perf_pctg)
|
||||
* low_freq * (1 - perf_pctg) = (cur_freq - high_freq * perf_pctg)
|
||||
*
|
||||
* high_freq * perf_pctg is stored tempoarily into "ebx".
|
||||
*/
|
||||
@@ -317,9 +319,10 @@ static void __exit longrun_exit(void)
|
||||
}
|
||||
|
||||
|
||||
MODULE_AUTHOR ("Dominik Brodowski <linux@brodo.de>");
|
||||
MODULE_DESCRIPTION ("LongRun driver for Transmeta Crusoe and Efficeon processors.");
|
||||
MODULE_LICENSE ("GPL");
|
||||
MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
|
||||
MODULE_DESCRIPTION("LongRun driver for Transmeta Crusoe and "
|
||||
"Efficeon processors.");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_init(longrun_init);
|
||||
module_exit(longrun_exit);
|
||||
|
||||
@@ -27,15 +27,17 @@
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/timex.h>
|
||||
|
||||
#include <asm/processor.h>
|
||||
#include <asm/msr.h>
|
||||
#include <asm/timex.h>
|
||||
#include <asm/timer.h>
|
||||
|
||||
#include "speedstep-lib.h"
|
||||
|
||||
#define PFX "p4-clockmod: "
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "p4-clockmod", msg)
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"p4-clockmod", msg)
|
||||
|
||||
/*
|
||||
* Duty Cycle (3bits), note DC_DISABLE is not specified in
|
||||
@@ -58,7 +60,8 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
|
||||
{
|
||||
u32 l, h;
|
||||
|
||||
if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV))
|
||||
if (!cpu_online(cpu) ||
|
||||
(newstate > DC_DISABLE) || (newstate == DC_RESV))
|
||||
return -EINVAL;
|
||||
|
||||
rdmsr_on_cpu(cpu, MSR_IA32_THERM_STATUS, &l, &h);
|
||||
@@ -66,7 +69,8 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
|
||||
if (l & 0x01)
|
||||
dprintk("CPU#%d currently thermal throttled\n", cpu);
|
||||
|
||||
if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT))
|
||||
if (has_N44_O17_errata[cpu] &&
|
||||
(newstate == DC_25PT || newstate == DC_DFLT))
|
||||
newstate = DC_38PT;
|
||||
|
||||
rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h);
|
||||
@@ -112,7 +116,8 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
|
||||
struct cpufreq_freqs freqs;
|
||||
int i;
|
||||
|
||||
if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate))
|
||||
if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0],
|
||||
target_freq, relation, &newstate))
|
||||
return -EINVAL;
|
||||
|
||||
freqs.old = cpufreq_p4_get(policy->cpu);
|
||||
@@ -127,7 +132,8 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
|
||||
}
|
||||
|
||||
/* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
|
||||
/* run on each logical CPU,
|
||||
* see section 13.15.3 of IA32 Intel Architecture Software
|
||||
* Developer's Manual, Volume 3
|
||||
*/
|
||||
for_each_cpu(i, policy->cpus)
|
||||
@@ -153,28 +159,30 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
|
||||
{
|
||||
if (c->x86 == 0x06) {
|
||||
if (cpu_has(c, X86_FEATURE_EST))
|
||||
printk(KERN_WARNING PFX "Warning: EST-capable CPU detected. "
|
||||
"The acpi-cpufreq module offers voltage scaling"
|
||||
" in addition of frequency scaling. You should use "
|
||||
"that instead of p4-clockmod, if possible.\n");
|
||||
printk(KERN_WARNING PFX "Warning: EST-capable CPU "
|
||||
"detected. The acpi-cpufreq module offers "
|
||||
"voltage scaling in addition of frequency "
|
||||
"scaling. You should use that instead of "
|
||||
"p4-clockmod, if possible.\n");
|
||||
switch (c->x86_model) {
|
||||
case 0x0E: /* Core */
|
||||
case 0x0F: /* Core Duo */
|
||||
case 0x16: /* Celeron Core */
|
||||
p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
|
||||
return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE);
|
||||
return speedstep_get_frequency(SPEEDSTEP_CPU_PCORE);
|
||||
case 0x0D: /* Pentium M (Dothan) */
|
||||
p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
|
||||
/* fall through */
|
||||
case 0x09: /* Pentium M (Banias) */
|
||||
return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PM);
|
||||
return speedstep_get_frequency(SPEEDSTEP_CPU_PM);
|
||||
}
|
||||
}
|
||||
|
||||
if (c->x86 != 0xF) {
|
||||
if (!cpu_has(c, X86_FEATURE_EST))
|
||||
printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. "
|
||||
"Please send an e-mail to <cpufreq@vger.kernel.org>\n");
|
||||
printk(KERN_WARNING PFX "Unknown CPU. "
|
||||
"Please send an e-mail to "
|
||||
"<cpufreq@vger.kernel.org>\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -182,16 +190,16 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
|
||||
* throttling is active or not. */
|
||||
p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
|
||||
|
||||
if (speedstep_detect_processor() == SPEEDSTEP_PROCESSOR_P4M) {
|
||||
if (speedstep_detect_processor() == SPEEDSTEP_CPU_P4M) {
|
||||
printk(KERN_WARNING PFX "Warning: Pentium 4-M detected. "
|
||||
"The speedstep-ich or acpi cpufreq modules offer "
|
||||
"voltage scaling in addition of frequency scaling. "
|
||||
"You should use either one instead of p4-clockmod, "
|
||||
"if possible.\n");
|
||||
return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_P4M);
|
||||
return speedstep_get_frequency(SPEEDSTEP_CPU_P4M);
|
||||
}
|
||||
|
||||
return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_P4D);
|
||||
return speedstep_get_frequency(SPEEDSTEP_CPU_P4D);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,14 +225,20 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
|
||||
dprintk("has errata -- disabling low frequencies\n");
|
||||
}
|
||||
|
||||
if (speedstep_detect_processor() == SPEEDSTEP_CPU_P4D &&
|
||||
c->x86_model < 2) {
|
||||
/* switch to maximum frequency and measure result */
|
||||
cpufreq_p4_setdc(policy->cpu, DC_DISABLE);
|
||||
recalibrate_cpu_khz();
|
||||
}
|
||||
/* get max frequency */
|
||||
stock_freq = cpufreq_p4_get_frequency(c);
|
||||
if (!stock_freq)
|
||||
return -EINVAL;
|
||||
|
||||
/* table init */
|
||||
for (i=1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) {
|
||||
if ((i<2) && (has_N44_O17_errata[policy->cpu]))
|
||||
for (i = 1; (p4clockmod_table[i].frequency != CPUFREQ_TABLE_END); i++) {
|
||||
if ((i < 2) && (has_N44_O17_errata[policy->cpu]))
|
||||
p4clockmod_table[i].frequency = CPUFREQ_ENTRY_INVALID;
|
||||
else
|
||||
p4clockmod_table[i].frequency = (stock_freq * i)/8;
|
||||
@@ -232,7 +246,10 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
|
||||
cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu);
|
||||
|
||||
/* cpuinfo and default policy values */
|
||||
policy->cpuinfo.transition_latency = 1000000; /* assumed */
|
||||
|
||||
/* the transition latency is set to be 1 higher than the maximum
|
||||
* transition latency of the ondemand governor */
|
||||
policy->cpuinfo.transition_latency = 10000001;
|
||||
policy->cur = stock_freq;
|
||||
|
||||
return cpufreq_frequency_table_cpuinfo(policy, &p4clockmod_table[0]);
|
||||
@@ -258,12 +275,12 @@ static unsigned int cpufreq_p4_get(unsigned int cpu)
|
||||
l = DC_DISABLE;
|
||||
|
||||
if (l != DC_DISABLE)
|
||||
return (stock_freq * l / 8);
|
||||
return stock_freq * l / 8;
|
||||
|
||||
return stock_freq;
|
||||
}
|
||||
|
||||
static struct freq_attr* p4clockmod_attr[] = {
|
||||
static struct freq_attr *p4clockmod_attr[] = {
|
||||
&cpufreq_freq_attr_scaling_available_freqs,
|
||||
NULL,
|
||||
};
|
||||
@@ -298,9 +315,10 @@ static int __init cpufreq_p4_init(void)
|
||||
|
||||
ret = cpufreq_register_driver(&p4clockmod_driver);
|
||||
if (!ret)
|
||||
printk(KERN_INFO PFX "P4/Xeon(TM) CPU On-Demand Clock Modulation available\n");
|
||||
printk(KERN_INFO PFX "P4/Xeon(TM) CPU On-Demand Clock "
|
||||
"Modulation available\n");
|
||||
|
||||
return (ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -310,9 +328,9 @@ static void __exit cpufreq_p4_exit(void)
|
||||
}
|
||||
|
||||
|
||||
MODULE_AUTHOR ("Zwane Mwaikambo <zwane@commfireservices.com>");
|
||||
MODULE_DESCRIPTION ("cpufreq driver for Pentium(TM) 4/Xeon(TM)");
|
||||
MODULE_LICENSE ("GPL");
|
||||
MODULE_AUTHOR("Zwane Mwaikambo <zwane@commfireservices.com>");
|
||||
MODULE_DESCRIPTION("cpufreq driver for Pentium(TM) 4/Xeon(TM)");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
late_initcall(cpufreq_p4_init);
|
||||
module_exit(cpufreq_p4_exit);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* This file was based upon code in Powertweak Linux (http://powertweak.sf.net)
|
||||
* (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pänkälä, Dominik Brodowski.
|
||||
* (C) 2000-2003 Dave Jones, Arjan van de Ven, Janne Pänkälä,
|
||||
* Dominik Brodowski.
|
||||
*
|
||||
* Licensed under the terms of the GNU GPL License version 2.
|
||||
*
|
||||
@@ -13,14 +14,15 @@
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <asm/msr.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/msr.h>
|
||||
|
||||
#define POWERNOW_IOPORT 0xfff0 /* it doesn't matter where, as long
|
||||
as it is unused */
|
||||
|
||||
#define PFX "powernow-k6: "
|
||||
static unsigned int busfreq; /* FSB, in 10 kHz */
|
||||
static unsigned int max_multiplier;
|
||||
|
||||
@@ -47,8 +49,8 @@ static struct cpufreq_frequency_table clock_ratio[] = {
|
||||
*/
|
||||
static int powernow_k6_get_cpu_multiplier(void)
|
||||
{
|
||||
u64 invalue = 0;
|
||||
u32 msrval;
|
||||
u64 invalue = 0;
|
||||
u32 msrval;
|
||||
|
||||
msrval = POWERNOW_IOPORT + 0x1;
|
||||
wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */
|
||||
@@ -68,12 +70,12 @@ static int powernow_k6_get_cpu_multiplier(void)
|
||||
*/
|
||||
static void powernow_k6_set_state(unsigned int best_i)
|
||||
{
|
||||
unsigned long outvalue = 0, invalue = 0;
|
||||
unsigned long msrval;
|
||||
struct cpufreq_freqs freqs;
|
||||
unsigned long outvalue = 0, invalue = 0;
|
||||
unsigned long msrval;
|
||||
struct cpufreq_freqs freqs;
|
||||
|
||||
if (clock_ratio[best_i].index > max_multiplier) {
|
||||
printk(KERN_ERR "cpufreq: invalid target frequency\n");
|
||||
printk(KERN_ERR PFX "invalid target frequency\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -119,7 +121,8 @@ static int powernow_k6_verify(struct cpufreq_policy *policy)
|
||||
* powernow_k6_setpolicy - sets a new CPUFreq policy
|
||||
* @policy: new policy
|
||||
* @target_freq: the target frequency
|
||||
* @relation: how that frequency relates to achieved frequency (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
|
||||
* @relation: how that frequency relates to achieved frequency
|
||||
* (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
|
||||
*
|
||||
* sets a new CPUFreq policy
|
||||
*/
|
||||
@@ -127,9 +130,10 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq,
|
||||
unsigned int relation)
|
||||
{
|
||||
unsigned int newstate = 0;
|
||||
unsigned int newstate = 0;
|
||||
|
||||
if (cpufreq_frequency_table_target(policy, &clock_ratio[0], target_freq, relation, &newstate))
|
||||
if (cpufreq_frequency_table_target(policy, &clock_ratio[0],
|
||||
target_freq, relation, &newstate))
|
||||
return -EINVAL;
|
||||
|
||||
powernow_k6_set_state(newstate);
|
||||
@@ -140,7 +144,7 @@ static int powernow_k6_target(struct cpufreq_policy *policy,
|
||||
|
||||
static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int i, f;
|
||||
int result;
|
||||
|
||||
if (policy->cpu != 0)
|
||||
@@ -152,10 +156,11 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
|
||||
|
||||
/* table init */
|
||||
for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
|
||||
if (clock_ratio[i].index > max_multiplier)
|
||||
f = clock_ratio[i].index;
|
||||
if (f > max_multiplier)
|
||||
clock_ratio[i].frequency = CPUFREQ_ENTRY_INVALID;
|
||||
else
|
||||
clock_ratio[i].frequency = busfreq * clock_ratio[i].index;
|
||||
clock_ratio[i].frequency = busfreq * f;
|
||||
}
|
||||
|
||||
/* cpuinfo and default policy values */
|
||||
@@ -185,7 +190,9 @@ static int powernow_k6_cpu_exit(struct cpufreq_policy *policy)
|
||||
|
||||
static unsigned int powernow_k6_get(unsigned int cpu)
|
||||
{
|
||||
return busfreq * powernow_k6_get_cpu_multiplier();
|
||||
unsigned int ret;
|
||||
ret = (busfreq * powernow_k6_get_cpu_multiplier());
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct freq_attr *powernow_k6_attr[] = {
|
||||
@@ -221,7 +228,7 @@ static int __init powernow_k6_init(void)
|
||||
return -ENODEV;
|
||||
|
||||
if (!request_region(POWERNOW_IOPORT, 16, "PowerNow!")) {
|
||||
printk("cpufreq: PowerNow IOPORT region already used.\n");
|
||||
printk(KERN_INFO PFX "PowerNow IOPORT region already used.\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -246,7 +253,8 @@ static void __exit powernow_k6_exit(void)
|
||||
}
|
||||
|
||||
|
||||
MODULE_AUTHOR("Arjan van de Ven, Dave Jones <davej@redhat.com>, Dominik Brodowski <linux@brodo.de>");
|
||||
MODULE_AUTHOR("Arjan van de Ven, Dave Jones <davej@redhat.com>, "
|
||||
"Dominik Brodowski <linux@brodo.de>");
|
||||
MODULE_DESCRIPTION("PowerNow! driver for AMD K6-2+ / K6-3+ processors.");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -45,11 +45,10 @@ struct powernow_k8_data {
|
||||
* frequency is in kHz */
|
||||
struct cpufreq_frequency_table *powernow_table;
|
||||
|
||||
#ifdef CONFIG_X86_POWERNOW_K8_ACPI
|
||||
/* the acpi table needs to be kept. it's only available if ACPI was
|
||||
* used to determine valid frequency/vid/fid states */
|
||||
struct acpi_processor_performance acpi_data;
|
||||
#endif
|
||||
|
||||
/* we need to keep track of associated cores, but let cpufreq
|
||||
* handle hotplug events - so just point at cpufreq pol->cpus
|
||||
* structure */
|
||||
@@ -222,10 +221,8 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
|
||||
|
||||
static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
|
||||
|
||||
#ifdef CONFIG_X86_POWERNOW_K8_ACPI
|
||||
static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
|
||||
static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
|
||||
|
||||
@@ -19,17 +19,19 @@
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <asm/msr.h>
|
||||
#include <asm/timex.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
#define MMCR_BASE 0xfffef000 /* The default base address */
|
||||
#define OFFS_CPUCTL 0x2 /* CPU Control Register */
|
||||
|
||||
static __u8 __iomem *cpuctl;
|
||||
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "sc520_freq", msg)
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"sc520_freq", msg)
|
||||
#define PFX "sc520_freq: "
|
||||
|
||||
static struct cpufreq_frequency_table sc520_freq_table[] = {
|
||||
{0x01, 100000},
|
||||
@@ -43,7 +45,8 @@ static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu)
|
||||
|
||||
switch (clockspeed_reg & 0x03) {
|
||||
default:
|
||||
printk(KERN_ERR "sc520_freq: error: cpuctl register has unexpected value %02x\n", clockspeed_reg);
|
||||
printk(KERN_ERR PFX "error: cpuctl register has unexpected "
|
||||
"value %02x\n", clockspeed_reg);
|
||||
case 0x01:
|
||||
return 100000;
|
||||
case 0x02:
|
||||
@@ -51,7 +54,7 @@ static unsigned int sc520_freq_get_cpu_frequency(unsigned int cpu)
|
||||
}
|
||||
}
|
||||
|
||||
static void sc520_freq_set_cpu_state (unsigned int state)
|
||||
static void sc520_freq_set_cpu_state(unsigned int state)
|
||||
{
|
||||
|
||||
struct cpufreq_freqs freqs;
|
||||
@@ -76,18 +79,19 @@ static void sc520_freq_set_cpu_state (unsigned int state)
|
||||
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
|
||||
};
|
||||
|
||||
static int sc520_freq_verify (struct cpufreq_policy *policy)
|
||||
static int sc520_freq_verify(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_frequency_table_verify(policy, &sc520_freq_table[0]);
|
||||
}
|
||||
|
||||
static int sc520_freq_target (struct cpufreq_policy *policy,
|
||||
static int sc520_freq_target(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq,
|
||||
unsigned int relation)
|
||||
{
|
||||
unsigned int newstate = 0;
|
||||
|
||||
if (cpufreq_frequency_table_target(policy, sc520_freq_table, target_freq, relation, &newstate))
|
||||
if (cpufreq_frequency_table_target(policy, sc520_freq_table,
|
||||
target_freq, relation, &newstate))
|
||||
return -EINVAL;
|
||||
|
||||
sc520_freq_set_cpu_state(newstate);
|
||||
@@ -116,7 +120,7 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy)
|
||||
|
||||
result = cpufreq_frequency_table_cpuinfo(policy, sc520_freq_table);
|
||||
if (result)
|
||||
return (result);
|
||||
return result;
|
||||
|
||||
cpufreq_frequency_table_get_attr(sc520_freq_table, policy->cpu);
|
||||
|
||||
@@ -131,7 +135,7 @@ static int sc520_freq_cpu_exit(struct cpufreq_policy *policy)
|
||||
}
|
||||
|
||||
|
||||
static struct freq_attr* sc520_freq_attr[] = {
|
||||
static struct freq_attr *sc520_freq_attr[] = {
|
||||
&cpufreq_freq_attr_scaling_available_freqs,
|
||||
NULL,
|
||||
};
|
||||
@@ -155,13 +159,13 @@ static int __init sc520_freq_init(void)
|
||||
int err;
|
||||
|
||||
/* Test if we have the right hardware */
|
||||
if(c->x86_vendor != X86_VENDOR_AMD ||
|
||||
c->x86 != 4 || c->x86_model != 9) {
|
||||
if (c->x86_vendor != X86_VENDOR_AMD ||
|
||||
c->x86 != 4 || c->x86_model != 9) {
|
||||
dprintk("no Elan SC520 processor found!\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
cpuctl = ioremap((unsigned long)(MMCR_BASE + OFFS_CPUCTL), 1);
|
||||
if(!cpuctl) {
|
||||
if (!cpuctl) {
|
||||
printk(KERN_ERR "sc520_freq: error: failed to remap memory\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ static struct pci_dev *speedstep_chipset_dev;
|
||||
|
||||
/* speedstep_processor
|
||||
*/
|
||||
static unsigned int speedstep_processor = 0;
|
||||
static unsigned int speedstep_processor;
|
||||
|
||||
static u32 pmbase;
|
||||
|
||||
@@ -54,7 +54,8 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
|
||||
};
|
||||
|
||||
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "speedstep-ich", msg)
|
||||
#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, \
|
||||
"speedstep-ich", msg)
|
||||
|
||||
|
||||
/**
|
||||
@@ -62,7 +63,7 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
|
||||
*
|
||||
* Returns: -ENODEV if no register could be found
|
||||
*/
|
||||
static int speedstep_find_register (void)
|
||||
static int speedstep_find_register(void)
|
||||
{
|
||||
if (!speedstep_chipset_dev)
|
||||
return -ENODEV;
|
||||
@@ -90,7 +91,7 @@ static int speedstep_find_register (void)
|
||||
*
|
||||
* Tries to change the SpeedStep state.
|
||||
*/
|
||||
static void speedstep_set_state (unsigned int state)
|
||||
static void speedstep_set_state(unsigned int state)
|
||||
{
|
||||
u8 pm2_blk;
|
||||
u8 value;
|
||||
@@ -133,11 +134,11 @@ static void speedstep_set_state (unsigned int state)
|
||||
|
||||
dprintk("read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value);
|
||||
|
||||
if (state == (value & 0x1)) {
|
||||
dprintk("change to %u MHz succeeded\n", (speedstep_get_processor_frequency(speedstep_processor) / 1000));
|
||||
} else {
|
||||
printk (KERN_ERR "cpufreq: change failed - I/O error\n");
|
||||
}
|
||||
if (state == (value & 0x1))
|
||||
dprintk("change to %u MHz succeeded\n",
|
||||
speedstep_get_frequency(speedstep_processor) / 1000);
|
||||
else
|
||||
printk(KERN_ERR "cpufreq: change failed - I/O error\n");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -149,7 +150,7 @@ static void speedstep_set_state (unsigned int state)
|
||||
* Tries to activate the SpeedStep status and control registers.
|
||||
* Returns -EINVAL on an unsupported chipset, and zero on success.
|
||||
*/
|
||||
static int speedstep_activate (void)
|
||||
static int speedstep_activate(void)
|
||||
{
|
||||
u16 value = 0;
|
||||
|
||||
@@ -175,20 +176,18 @@ static int speedstep_activate (void)
|
||||
* functions. Returns the SPEEDSTEP_CHIPSET_-number for the detected
|
||||
* chipset, or zero on failure.
|
||||
*/
|
||||
static unsigned int speedstep_detect_chipset (void)
|
||||
static unsigned int speedstep_detect_chipset(void)
|
||||
{
|
||||
speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
|
||||
PCI_DEVICE_ID_INTEL_82801DB_12,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID, PCI_ANY_ID,
|
||||
NULL);
|
||||
if (speedstep_chipset_dev)
|
||||
return 4; /* 4-M */
|
||||
|
||||
speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
|
||||
PCI_DEVICE_ID_INTEL_82801CA_12,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID, PCI_ANY_ID,
|
||||
NULL);
|
||||
if (speedstep_chipset_dev)
|
||||
return 3; /* 3-M */
|
||||
@@ -196,8 +195,7 @@ static unsigned int speedstep_detect_chipset (void)
|
||||
|
||||
speedstep_chipset_dev = pci_get_subsys(PCI_VENDOR_ID_INTEL,
|
||||
PCI_DEVICE_ID_INTEL_82801BA_10,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID, PCI_ANY_ID,
|
||||
NULL);
|
||||
if (speedstep_chipset_dev) {
|
||||
/* speedstep.c causes lockups on Dell Inspirons 8000 and
|
||||
@@ -208,8 +206,7 @@ static unsigned int speedstep_detect_chipset (void)
|
||||
|
||||
hostbridge = pci_get_subsys(PCI_VENDOR_ID_INTEL,
|
||||
PCI_DEVICE_ID_INTEL_82815_MC,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID,
|
||||
PCI_ANY_ID, PCI_ANY_ID,
|
||||
NULL);
|
||||
|
||||
if (!hostbridge)
|
||||
@@ -236,7 +233,7 @@ static unsigned int _speedstep_get(const struct cpumask *cpus)
|
||||
|
||||
cpus_allowed = current->cpus_allowed;
|
||||
set_cpus_allowed_ptr(current, cpus);
|
||||
speed = speedstep_get_processor_frequency(speedstep_processor);
|
||||
speed = speedstep_get_frequency(speedstep_processor);
|
||||
set_cpus_allowed_ptr(current, &cpus_allowed);
|
||||
dprintk("detected %u kHz as current frequency\n", speed);
|
||||
return speed;
|
||||
@@ -251,11 +248,12 @@ static unsigned int speedstep_get(unsigned int cpu)
|
||||
* speedstep_target - set a new CPUFreq policy
|
||||
* @policy: new policy
|
||||
* @target_freq: the target frequency
|
||||
* @relation: how that frequency relates to achieved frequency (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
|
||||
* @relation: how that frequency relates to achieved frequency
|
||||
* (CPUFREQ_RELATION_L or CPUFREQ_RELATION_H)
|
||||
*
|
||||
* Sets a new CPUFreq policy.
|
||||
*/
|
||||
static int speedstep_target (struct cpufreq_policy *policy,
|
||||
static int speedstep_target(struct cpufreq_policy *policy,
|
||||
unsigned int target_freq,
|
||||
unsigned int relation)
|
||||
{
|
||||
@@ -264,7 +262,8 @@ static int speedstep_target (struct cpufreq_policy *policy,
|
||||
cpumask_t cpus_allowed;
|
||||
int i;
|
||||
|
||||
if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
|
||||
if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0],
|
||||
target_freq, relation, &newstate))
|
||||
return -EINVAL;
|
||||
|
||||
freqs.old = _speedstep_get(policy->cpus);
|
||||
@@ -308,7 +307,7 @@ static int speedstep_target (struct cpufreq_policy *policy,
|
||||
* Limit must be within speedstep_low_freq and speedstep_high_freq, with
|
||||
* at least one border included.
|
||||
*/
|
||||
static int speedstep_verify (struct cpufreq_policy *policy)
|
||||
static int speedstep_verify(struct cpufreq_policy *policy)
|
||||
{
|
||||
return cpufreq_frequency_table_verify(policy, &speedstep_freqs[0]);
|
||||
}
|
||||
@@ -344,7 +343,8 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
|
||||
return -EIO;
|
||||
|
||||
dprintk("currently at %s speed setting - %i MHz\n",
|
||||
(speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high",
|
||||
(speed == speedstep_freqs[SPEEDSTEP_LOW].frequency)
|
||||
? "low" : "high",
|
||||
(speed / 1000));
|
||||
|
||||
/* cpuinfo and default policy values */
|
||||
@@ -352,9 +352,9 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
|
||||
|
||||
result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs);
|
||||
if (result)
|
||||
return (result);
|
||||
return result;
|
||||
|
||||
cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu);
|
||||
cpufreq_frequency_table_get_attr(speedstep_freqs, policy->cpu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -366,7 +366,7 @@ static int speedstep_cpu_exit(struct cpufreq_policy *policy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct freq_attr* speedstep_attr[] = {
|
||||
static struct freq_attr *speedstep_attr[] = {
|
||||
&cpufreq_freq_attr_scaling_available_freqs,
|
||||
NULL,
|
||||
};
|
||||
@@ -396,13 +396,15 @@ static int __init speedstep_init(void)
|
||||
/* detect processor */
|
||||
speedstep_processor = speedstep_detect_processor();
|
||||
if (!speedstep_processor) {
|
||||
dprintk("Intel(R) SpeedStep(TM) capable processor not found\n");
|
||||
dprintk("Intel(R) SpeedStep(TM) capable processor "
|
||||
"not found\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* detect chipset */
|
||||
if (!speedstep_detect_chipset()) {
|
||||
dprintk("Intel(R) SpeedStep(TM) for this chipset not (yet) available.\n");
|
||||
dprintk("Intel(R) SpeedStep(TM) for this chipset not "
|
||||
"(yet) available.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@@ -431,9 +433,11 @@ static void __exit speedstep_exit(void)
|
||||
}
|
||||
|
||||
|
||||
MODULE_AUTHOR ("Dave Jones <davej@redhat.com>, Dominik Brodowski <linux@brodo.de>");
|
||||
MODULE_DESCRIPTION ("Speedstep driver for Intel mobile processors on chipsets with ICH-M southbridges.");
|
||||
MODULE_LICENSE ("GPL");
|
||||
MODULE_AUTHOR("Dave Jones <davej@redhat.com>, "
|
||||
"Dominik Brodowski <linux@brodo.de>");
|
||||
MODULE_DESCRIPTION("Speedstep driver for Intel mobile processors on chipsets "
|
||||
"with ICH-M southbridges.");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
module_init(speedstep_init);
|
||||
module_exit(speedstep_exit);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user