Re: [PATCH 4/10 -tip] x86: check_powernow() for K7 user ofAdvanced Power Management features

From: Jaswinder Singh Rajput
Date: Tue May 12 2009 - 15:08:26 EST


On Tue, 2009-05-12 at 21:10 +0530, Jaswinder Singh Rajput wrote:
> use X86_FEATURE_FID and X86_FEATURE_VID to determine K7 PowerNOW.
>
> Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@xxxxxxxxx>
> ---
> arch/x86/kernel/cpu/cpufreq/powernow-k7.c | 16 ++++++----------
> 1 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
> index 3c28ccd..1f35474 100644
> --- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
> +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
> @@ -118,7 +118,6 @@ static int check_fsb(unsigned int fsbspeed)
> static int check_powernow(void)
> {
> struct cpuinfo_x86 *c = &cpu_data(0);
> - unsigned int maxei, eax, ebx, ecx, edx;
>
> if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 6)) {
> #ifdef MODULE
> @@ -128,9 +127,8 @@ static int check_powernow(void)
> return 0;
> }
>
> - /* Get maximum capabilities */
> - maxei = cpuid_eax(0x80000000);
> - if (maxei < 0x80000007) { /* Any powernow info ? */
> + /* Advanced Power Management capabilities */
> + if (c->x86_capability[9]) { /* Any powernow info ? */

[PATCH -tip] x86: check_powernow() for K7 user of Advanced Power Management features

use X86_FEATURE_POWER_MGMT, X86_FEATURE_FID and X86_FEATURE_VID
to determine K7 PowerNOW.

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@xxxxxxxxx>
---
arch/x86/kernel/cpu/cpufreq/powernow-k7.c | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
index 3c28ccd..965f235 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
@@ -118,7 +118,6 @@ static int check_fsb(unsigned int fsbspeed)
static int check_powernow(void)
{
struct cpuinfo_x86 *c = &cpu_data(0);
- unsigned int maxei, eax, ebx, ecx, edx;

if ((c->x86_vendor != X86_VENDOR_AMD) || (c->x86 != 6)) {
#ifdef MODULE
@@ -128,9 +127,8 @@ static int check_powernow(void)
return 0;
}

- /* Get maximum capabilities */
- maxei = cpuid_eax(0x80000000);
- if (maxei < 0x80000007) { /* Any powernow info ? */
+ /* Advanced Power Management capabilities */
+ if (!cpu_has(c, X86_FEATURE_POWER_MGMT)) { /* Any powernow info */
#ifdef MODULE
printk(KERN_INFO PFX "No powernow capabilities detected\n");
#endif
@@ -143,23 +141,21 @@ static int check_powernow(void)
have_a0 = 1;
}

- cpuid(0x80000007, &eax, &ebx, &ecx, &edx);
-
/* Check we can actually do something before we say anything.*/
- if (!(edx & (1 << 1 | 1 << 2)))
+ if (!cpu_has(c, X86_FEATURE_FID) && !cpu_has(c, X86_FEATURE_VID))
return 0;

printk(KERN_INFO PFX "PowerNOW! Technology present. Can scale: ");

- if (edx & 1 << 1) {
+ if (cpu_has(c, X86_FEATURE_FID)) {
printk("frequency");
can_scale_bus = 1;
}

- if ((edx & (1 << 1 | 1 << 2)) == 0x6)
+ if (cpu_has(c, X86_FEATURE_FID) && cpu_has(c, X86_FEATURE_VID))
printk(" and ");

- if (edx & 1 << 2) {
+ if (cpu_has(c, X86_FEATURE_VID)) {
printk("voltage");
can_scale_vid = 1;
}
--
1.6.0.6



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/