If you have an Athlon64 or a Turion processor and you running with
either GENERIC i386 or amd64 and don't see the following or a 
similar line in your demsg:

cpu0: Cool`n'Quiet K8 2412 Mhz: speeds: 2400 2200 2000 1800 1000 Mhz

It would be greatly appereciated if you could test the following diff
which may allow you to use the hw.setperf mechanism on you machine. If
you lacked it before this diff and now have it please mail me a dmesg.

This patch is not a panacea some machines simply dont support the legacy
method I just want to see if it helps any at all.

Thanks, 
        gwk


Index: sys/arch/i386/i386/powernow-k8.c
===================================================================
RCS file: /cvs/src/sys/arch/i386/i386/powernow-k8.c,v
retrieving revision 1.18
diff -u -p -r1.18 powernow-k8.c
--- sys/arch/i386/i386/powernow-k8.c    19 Oct 2006 19:29:04 -0000      1.18
+++ sys/arch/i386/i386/powernow-k8.c    6 Dec 2006 23:51:09 -0000
@@ -366,11 +366,15 @@ k8_powernow_init(void)
        cpuid(0x80000007, regs);
        if (!(regs[3] & AMD_PN_FID_VID))
                return;
+       
+       /* Extended CPUID signature value */
+       cpuid(0x80000001, regs);
 
        cstate = malloc(sizeof(struct k8pnow_cpu_state), M_DEVBUF, M_NOWAIT);
        if (!cstate)
                return;
 
+       cstate->n_states = 0;
        status = rdmsr(MSR_AMDK7_FIDVID_STATUS);
        maxfid = PN8_STA_MFID(status);
        maxvid = PN8_STA_MVID(status);
@@ -385,20 +389,20 @@ k8_powernow_init(void)
        else
                techname = "Cool'n'Quiet K8";
 
-       if (k8pnow_states(cstate, ci->ci_signature, maxfid, maxvid)) {
-               if (cstate->n_states) {
-                       printf("%s: %s %d MHz: speeds:",
-                           ci->ci_dev.dv_xname, techname, pentium_mhz);
-                       for (i = cstate->n_states; i > 0; i--) {
-                               state = &cstate->state_table[i-1];
-                               printf(" %d", state->freq);
-                       }
-                       printf(" MHz\n");
-                       k8pnow_current_state = cstate;
-                       cpu_setperf = k8_powernow_setperf;
-                       setperf_prio = 1;
-                       return;
+       if (!k8pnow_states(cstate, ci->ci_signature, maxfid, maxvid))
+               k8pnow_states(cstate, regs[0], maxfid, maxvid);
+       if (cstate->n_states) {
+               printf("%s: %s %d MHz: speeds:",
+                   ci->ci_dev.dv_xname, techname, pentium_mhz);
+               for (i = cstate->n_states; i > 0; i--) {
+                       state = &cstate->state_table[i-1];
+                       printf(" %d", state->freq);
                }
+               printf(" MHz\n");
+               k8pnow_current_state = cstate;
+               cpu_setperf = k8_powernow_setperf;
+               setperf_prio = 1;
+               return;
        }
        free(cstate, M_DEVBUF);
 }
Index: sys/arch/amd64/amd64/powernow-k8.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/powernow-k8.c,v
retrieving revision 1.12
diff -u -p -r1.12 powernow-k8.c
--- sys/arch/amd64/amd64/powernow-k8.c  19 Oct 2006 10:55:56 -0000      1.12
+++ sys/arch/amd64/amd64/powernow-k8.c  6 Dec 2006 23:51:58 -0000
@@ -341,6 +341,7 @@ k8_powernow_init(void)
 {
        uint64_t status;
        u_int maxfid, maxvid, i;
+       u_int32_t extcpuid, dummy;
        struct k8pnow_cpu_state *cstate;
        struct k8pnow_state *state;
        struct cpu_info * ci;
@@ -354,6 +355,7 @@ k8_powernow_init(void)
        if (!cstate)
                return;
 
+       cstate->n_states = 0;
        status = rdmsr(MSR_AMDK7_FIDVID_STATUS);
        maxfid = PN8_STA_MFID(status);
        maxvid = PN8_STA_MVID(status);
@@ -368,20 +370,23 @@ k8_powernow_init(void)
        else
                techname = "Cool`n'Quiet K8";
 
-       if (k8pnow_states(cstate, ci->ci_signature, maxfid, maxvid)) {
-               if (cstate->n_states) {
-                       printf("%s: %s %d MHz: speeds:",
-                           ci->ci_dev->dv_xname, techname, cpuspeed);
-                       for(i = cstate->n_states; i > 0; i--) {
-                               state = &cstate->state_table[i-1];
-                               printf(" %d", state->freq);
-                       }
-                       printf(" MHz\n");
-                       k8pnow_current_state = cstate;
-                       cpu_setperf = k8_powernow_setperf;
-                       setperf_prio = 1;
-                       return;
+       /* Extended CPUID signature value */
+       CPUID(0x80000001, extcpuid, dummy, dummy, dummy);
+
+       if (!k8pnow_states(cstate, ci->ci_signature, maxfid, maxvid))
+               k8pnow_states(cstate, extcpuid, maxfid, maxvid);
+       if (cstate->n_states) {
+               printf("%s: %s %d MHz: speeds:",
+                   ci->ci_dev->dv_xname, techname, cpuspeed);
+               for (i = cstate->n_states; i > 0; i--) {
+                       state = &cstate->state_table[i-1];
+                       printf(" %d", state->freq);
                }
+               printf(" MHz\n");
+               k8pnow_current_state = cstate;
+               cpu_setperf = k8_powernow_setperf;
+               setperf_prio = 1;
+               return;
        }
        free(cstate, M_DEVBUF);
 }

Reply via email to