From: Bruno Ducrot <ducrot@poupinou.org>
To: Nebojsa Trpkovic <trxman@gmail.com>
Cc: cpufreq@www.linux.org.uk
Subject: Re: powernow-k8 manual voltage selection ?
Date: Mon, 20 Dec 2004 17:58:08 +0100 [thread overview]
Message-ID: <20041220165808.GQ2140@poupinou.org> (raw)
In-Reply-To: <20041220164504.GP2140@poupinou.org>
[-- Attachment #1: Type: text/plain, Size: 330 bytes --]
On Mon, Dec 20, 2004 at 05:45:04PM +0100, Bruno Ducrot wrote:
>
> linux have been always conservative in mainline if running hardware
> out-of-spec AFAIK.
I forgot to attach this patch. You have to modify it to suit your
needs, though.
--
Bruno Ducrot
-- Which is worse: ignorance or apathy?
-- Don't know. Don't care.
[-- Attachment #2: powernow-k8.diff --]
[-- Type: text/plain, Size: 3028 bytes --]
--- linux-2.6/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 2004/08/24 13:49:16 1.1
+++ linux-2.6/arch/i386/kernel/cpu/cpufreq/powernow-k8.c 2004/08/25 11:01:56
@@ -47,6 +47,9 @@
static struct powernow_k8_data *powernow_data[NR_CPUS];
+
+#define OVERRIDE_MAX (3)
+
/* Return a frequency in MHz, given an input fid */
static u32 find_freq_from_fid(u32 fid)
{
@@ -794,6 +797,68 @@
static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) { return; }
#endif /* CONFIG_X86_POWERNOW_K8_ACPI */
+static int powernow_k8_cpu_init_override(struct powernow_k8_data *data)
+{
+ struct cpufreq_frequency_table *powernow_table;
+ u32 fid, vid;
+
+ /* fill in data->powernow_table */
+ powernow_table = kmalloc((sizeof(struct cpufreq_frequency_table)
+ * (OVERRIDE_MAX + 1)), GFP_KERNEL);
+ if (!powernow_table) {
+ dprintk(KERN_ERR PFX "powernow_table memory alloc failure\n");
+ goto err_out;
+ }
+
+ /* 2200 GHz 1.50V */
+ fid = 0xe;
+ vid = 2;
+ dprintk(KERN_INFO PFX " %d : fid 0x%x, vid 0x%x\n", i, fid, vid);
+ powernow_table[0].index = fid; /* lower 8 bits */
+ powernow_table[0].index |= (vid << 8); /* upper 8 bits */
+ powernow_table[0].frequency = find_khz_freq_from_fid(fid);
+
+ /* 2000 GHz 1.40V */
+ fid = 0xc;
+ vid = 6;
+ dprintk(KERN_INFO PFX " %d : fid 0x%x, vid 0x%x\n", i, fid, vid);
+ powernow_table[1].index = fid; /* lower 8 bits */
+ powernow_table[1].index |= (vid << 8); /* upper 8 bits */
+ powernow_table[1].frequency = find_khz_freq_from_fid(fid);
+
+ /* 1000 GHz 1.10V */
+ fid = 0x2;
+ vid = 0x12;
+ dprintk(KERN_INFO PFX " %d : fid 0x%x, vid 0x%x\n", i, fid, vid);
+ powernow_table[2].index = fid; /* lower 8 bits */
+ powernow_table[2].index |= (vid << 8); /* upper 8 bits */
+ powernow_table[2].frequency = find_khz_freq_from_fid(fid);
+
+ powernow_table[3].index = 0;
+ powernow_table[3].frequency = CPUFREQ_TABLE_END;
+
+ data->powernow_table = powernow_table;
+
+ /* fill in data */
+ data->numps = 3;
+ data->irt = 3;
+ data->rvo = 2;
+ data->plllock = 2;
+ data->vidmvs = 1;
+ data->vstable = 5;
+ data->acpi_data.state_count = 0;
+ print_basics(data);
+ return 0;
+
+err_out:
+ /*acpi_processor_unregister_performance(&data->acpi_data, data->cpu);*/
+
+ /* data->acpi_data.state_count informs us at ->exit() whether ACPI was used */
+ data->acpi_data.state_count = 0;
+
+ return -ENODEV;
+}
+
/* Take a frequency, and issue the fid/vid transition command */
static int transition_frequency(struct powernow_k8_data *data, unsigned int index)
{
@@ -942,6 +1007,13 @@
data->cpu = pol->cpu;
+ if (powernow_k8_cpu_init_override(data)) {
+ printk(KERN_ERR PFX "Oops, can't override the powernow table for cpu %d\n", pol->cpu);
+ kfree(data);
+ return -ENODEV;
+ } else
+ goto the_next;
+
if (powernow_k8_cpu_init_acpi(data)) {
/*
* Use the PSB BIOS structure. This is only availabe on
@@ -964,6 +1036,7 @@
return -ENODEV;
}
}
+the_next:
/* only run on specific CPU from here on */
oldmask = current->cpus_allowed;
[-- Attachment #3: Type: text/plain, Size: 143 bytes --]
_______________________________________________
Cpufreq mailing list
Cpufreq@www.linux.org.uk
http://www.linux.org.uk/mailman/listinfo/cpufreq
prev parent reply other threads:[~2004-12-20 16:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-19 1:15 powernow-k8 manual voltage selection ? Nebojsa Trpkovic
2004-12-20 14:12 ` Bruno Ducrot
2004-12-20 15:48 ` Nebojsa Trpkovic
2004-12-20 16:45 ` Bruno Ducrot
2004-12-20 16:58 ` Bruno Ducrot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20041220165808.GQ2140@poupinou.org \
--to=ducrot@poupinou.org \
--cc=cpufreq@www.linux.org.uk \
--cc=trxman@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox