Commit d5eef605 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linux-dj.bkbits.net/cpufreq

into home.transmeta.com:/home/torvalds/v2.5/linux
parents ea9fcb21 9f43b3a6
......@@ -553,8 +553,9 @@ acpi_cpufreq_cpu_init (
{
unsigned int i;
unsigned int cpu = policy->cpu;
struct acpi_processor *pr = NULL;
struct acpi_processor *pr = NULL;
struct acpi_processor_performance *perf = &performance[policy->cpu];
struct acpi_device *device;
unsigned int result = 0;
ACPI_FUNCTION_TRACE("acpi_cpufreq_cpu_init");
......@@ -596,6 +597,17 @@ acpi_cpufreq_cpu_init (
acpi_cpufreq_add_file(pr);
if (acpi_bus_get_device(pr->handle, &device))
device = NULL;
printk(KERN_INFO "cpufreq: %s - ACPI performance management activated.\n",
device ? acpi_device_bid(device) : "CPU??");
for (i = 0; i < pr->performance->state_count; i++)
printk(KERN_INFO "cpufreq: %cP%d: %d MHz, %d mW, %d uS\n",
(i == pr->performance->state?'*':' '), i,
(u32) pr->performance->states[i].core_frequency,
(u32) pr->performance->states[i].power,
(u32) pr->performance->states[i].transition_latency);
return_VALUE(result);
}
......@@ -658,16 +670,21 @@ acpi_cpufreq_init (void)
/* test it on one CPU */
for (i=0; i<NR_CPUS; i++) {
if (cpu_online(i))
if (!cpu_online(i))
continue;
pr = performance[i].pr;
if (pr && pr->flags.performance)
goto found_capable_cpu;
}
result = -ENODEV;
goto err;
goto err0;
found_capable_cpu:
result = cpufreq_register_driver(&acpi_cpufreq_driver);
if (result)
goto err0;
perf = pr->performance;
current_state = perf->state;
......@@ -676,7 +693,7 @@ acpi_cpufreq_init (void)
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Disabled P-States due to failure while switching.\n"));
result = -ENODEV;
goto err;
goto err1;
}
}
......@@ -684,7 +701,7 @@ acpi_cpufreq_init (void)
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Disabled P-States due to failure while switching.\n"));
result = -ENODEV;
goto err;
goto err1;
}
if (current_state != 0) {
......@@ -692,18 +709,17 @@ acpi_cpufreq_init (void)
if (result) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Disabled P-States due to failure while switching.\n"));
result = -ENODEV;
goto err;
goto err1;
}
}
result = cpufreq_register_driver(&acpi_cpufreq_driver);
if (result)
goto err;
return_VALUE(0);
/* error handling */
err:
err1:
cpufreq_unregister_driver(&acpi_cpufreq_driver);
err0:
/* unregister struct acpi_processor_performance performance */
for (i=0; i<NR_CPUS; i++) {
if (performance[i].pr) {
......@@ -713,6 +729,8 @@ acpi_cpufreq_init (void)
}
}
kfree(performance);
printk(KERN_INFO "cpufreq: No CPUs supporting ACPI performance management found.\n");
return_VALUE(result);
}
......
......@@ -224,7 +224,6 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
static int longrun_cpu_init(struct cpufreq_policy *policy)
{
int result = 0;
struct cpuinfo_x86 *c = cpu_data;
/* capability check */
if (policy->cpu != 0)
......
......@@ -142,7 +142,6 @@ static int powernow_k6_target (struct cpufreq_policy *policy,
static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
{
struct cpuinfo_x86 *c = cpu_data;
unsigned int i;
if (policy->cpu != 0)
......
......@@ -208,13 +208,38 @@ static int get_ranges (unsigned char *pst)
}
static void change_FID(int fid)
{
union msr_fidvidctl fidvidctl;
if (fidvidctl.bits.FID != fid) {
rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
fidvidctl.bits.SGTC = latency;
fidvidctl.bits.FID = fid;
fidvidctl.bits.FIDC = 1;
wrmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
}
}
static void change_VID(int vid)
{
union msr_fidvidctl fidvidctl;
if (fidvidctl.bits.VID != vid) {
rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
fidvidctl.bits.VID = vid;
fidvidctl.bits.VIDC = 1;
wrmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
}
}
static void change_speed (unsigned int index)
{
u8 fid, vid;
struct cpufreq_freqs freqs;
union msr_fidvidstatus fidvidstatus;
union msr_fidvidctl fidvidctl;
/* fid are the lower 8 bits of the index we stored into
* the cpufreq frequency table in powernow_decode_bios,
......@@ -228,7 +253,6 @@ static void change_speed (unsigned int index)
rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
freqs.old = fsb * fid_codes[fidvidstatus.bits.CFID] * 100;
freqs.new = powernow_table[index].frequency;
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
......@@ -238,22 +262,16 @@ static void change_speed (unsigned int index)
if (have_a0 == 1) /* A0 errata 5 */
__asm__("\tcli\n");
/* First change the frequency. */
if (fidvidctl.bits.FID != fid) {
rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
fidvidctl.bits.SGTC = latency; /* Stop grant timeout counter */
fidvidctl.bits.FID = fid;
fidvidctl.bits.FIDC = 1;
wrmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
}
/* Now change voltage. */
if (fidvidctl.bits.VID != vid) {
rdmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
fidvidctl.bits.VID = vid;
fidvidctl.bits.VIDC = 1;
wrmsrl (MSR_K7_FID_VID_CTL, fidvidctl.val);
if (freqs.old > freqs.new) {
/* Going down, so change FID first */
change_FID(fid);
change_VID(vid);
} else {
/* Going up, so change VID first */
change_VID(fid);
change_FID(vid);
}
if (have_a0 == 1)
__asm__("\tsti\n");
......
......@@ -12,6 +12,8 @@
#include <linux/bootmem.h>
unsigned long dmi_broken;
EXPORT_SYMBOL(dmi_broken);
int is_sony_vaio_laptop;
int is_unsafe_smbus;
......
......@@ -85,7 +85,7 @@ static int acpi_processor_info_open_fs(struct inode *inode, struct file *file);
static int acpi_processor_throttling_open_fs(struct inode *inode, struct file *file);
static int acpi_processor_power_open_fs(struct inode *inode, struct file *file);
static int acpi_processor_limit_open_fs(struct inode *inode, struct file *file);
static int acpi_processor_get_limit_info(struct acpi_processor *pr);
static struct acpi_driver acpi_processor_driver = {
.name = ACPI_PROCESSOR_DRIVER_NAME,
......@@ -769,7 +769,9 @@ acpi_processor_get_platform_limit (
}
pr->performance_platform_limit = (int) ppc;
acpi_processor_get_limit_info(pr);
return_VALUE(0);
}
EXPORT_SYMBOL(acpi_processor_get_platform_limit);
......@@ -790,6 +792,7 @@ acpi_processor_register_performance (
return_VALUE(-EBUSY);
(*pr)->performance = performance;
performance->pr = *pr;
return 0;
}
EXPORT_SYMBOL(acpi_processor_register_performance);
......
......@@ -209,10 +209,7 @@ static int __init cpufreq_proc_init (void)
{
struct proc_dir_entry *entry = NULL;
if (!cpufreq_driver)
return -ENODEV;
/* are these acceptable values? */
/* are these acceptable values? */
entry = create_proc_entry("cpufreq", S_IFREG|S_IRUGO|S_IWUSR,
&proc_root);
......
......@@ -29,12 +29,9 @@
* level driver of CPUFreq support, and its locking mutex.
* cpu_max_freq is in kHz.
*/
struct cpufreq_driver *cpufreq_driver;
static struct cpufreq_driver *cpufreq_driver;
static DECLARE_MUTEX (cpufreq_driver_sem);
/* required for the proc interface, remove when that goes away */
EXPORT_SYMBOL_GPL(cpufreq_driver);
/**
* Two notifier lists: the "policy" list is involved in the
* validation process for a new CPU frequency policy; the
......@@ -54,10 +51,14 @@ static DECLARE_MUTEX (cpufreq_governor_sem);
static struct class_interface cpufreq_interface;
static int cpufreq_cpu_get(unsigned int cpu) {
static int cpufreq_cpu_get(unsigned int cpu)
{
if (cpu >= NR_CPUS)
return 0;
if (!cpufreq_driver)
return 0;
if (!try_module_get(cpufreq_driver->owner))
return 0;
......@@ -69,7 +70,8 @@ static int cpufreq_cpu_get(unsigned int cpu) {
return 1;
}
static void cpufreq_cpu_put(unsigned int cpu) {
static void cpufreq_cpu_put(unsigned int cpu)
{
kobject_put(&cpufreq_driver->policy[cpu].kobj);
module_put(cpufreq_driver->owner);
}
......@@ -81,7 +83,8 @@ static void cpufreq_cpu_put(unsigned int cpu) {
/**
* cpufreq_parse_governor - parse a governor string
*/
int cpufreq_parse_governor (char *str_governor, unsigned int *policy, struct cpufreq_governor **governor)
int cpufreq_parse_governor (char *str_governor, unsigned int *policy,
struct cpufreq_governor **governor)
{
if (!strnicmp(str_governor, "performance", CPUFREQ_NAME_LEN)) {
*policy = CPUFREQ_POLICY_PERFORMANCE;
......@@ -230,7 +233,8 @@ static ssize_t show_scaling_driver (struct cpufreq_policy * policy, char *buf)
/**
* show_scaling_available_governors - show the available CPUfreq governors
*/
static ssize_t show_scaling_available_governors(struct cpufreq_policy * policy, char *buf)
static ssize_t show_scaling_available_governors (struct cpufreq_policy * policy,
char *buf)
{
ssize_t i = 0;
struct cpufreq_governor *t;
......
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