FreeBSD Bugzilla – Attachment 173900 Details for
Bug 212020
Add powerd(8) support for newer AMD CPUs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to add powerd/cpufreq support for newer AMD CPUs.
amd_cpufreq.patch (text/plain), 2.77 KB, created by
Anthony Jenkins
on 2016-08-21 00:58:34 UTC
(
hide
)
Description:
Patch to add powerd/cpufreq support for newer AMD CPUs.
Filename:
MIME Type:
Creator:
Anthony Jenkins
Created:
2016-08-21 00:58:34 UTC
Size:
2.77 KB
patch
obsolete
>diff --git a/sys/x86/cpufreq/hwpstate.c b/sys/x86/cpufreq/hwpstate.c >index d4c70b7..326d967 100644 >--- a/sys/x86/cpufreq/hwpstate.c >+++ b/sys/x86/cpufreq/hwpstate.c >@@ -408,25 +408,27 @@ hwpstate_get_info_from_msr(device_t dev) > hwpstate_set = sc->hwpstate_settings; > for (i = 0; i < sc->cfnum; i++) { > msr = rdmsr(MSR_AMD_10H_11H_CONFIG + i); >- if ((msr & ((uint64_t)1 << 63)) != ((uint64_t)1 << 63)) { >+ if ((msr & ((uint64_t)1 << 63)) == 0) { > HWPSTATE_DEBUG(dev, "msr is not valid.\n"); > return (ENXIO); > } > did = AMD_10H_11H_CUR_DID(msr); > fid = AMD_10H_11H_CUR_FID(msr); >+ /* fid/did to frequency */ > switch(family) { > case 0x11: >- /* fid/did to frequency */ >- hwpstate_set[i].freq = 100 * (fid + 0x08) / (1 << did); >+ hwpstate_set[i].freq = (100 * (fid + 0x08)) >> did; > break; > case 0x10: >- /* fid/did to frequency */ >- hwpstate_set[i].freq = 100 * (fid + 0x10) / (1 << did); >+ case 0x12: >+ case 0x14: >+ case 0x15: >+ case 0x16: >+ hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did; > break; > default: >- HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family %d CPU's are not implemented yet. sorry.\n", family); >+ HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family 0x%02x CPU's are not implemented yet. sorry.\n", family); > return (ENXIO); >- break; > } > hwpstate_set[i].pstate_id = i; > /* There was volts calculation, but deleted it. */ >diff --git a/sys/x86/cpufreq/powernow.c b/sys/x86/cpufreq/powernow.c >index cc62e87..355bde8 100644 >--- a/sys/x86/cpufreq/powernow.c >+++ b/sys/x86/cpufreq/powernow.c >@@ -866,17 +866,22 @@ static void > pn_identify(driver_t *driver, device_t parent) > { > >- if ((amd_pminfo & AMDPM_FID) == 0 || (amd_pminfo & AMDPM_VID) == 0) >+ if ((amd_pminfo & AMDPM_FID) == 0 || (amd_pminfo & AMDPM_VID) == 0) { >+ printf("powernow: pn_identify: amd_pminfo=0x%04x .\n", amd_pminfo); > return; >+ } > switch (cpu_id & 0xf00) { > case 0x600: > case 0xf00: > break; > default: >+ printf("powernow: pn_identify: cpu_id=0x%04x.\n", cpu_id); > return; > } >- if (device_find_child(parent, "powernow", -1) != NULL) >+ if (device_find_child(parent, "powernow", -1) != NULL) { >+ printf("powernow: pn_identify: No \"powernow\"device found.\n"); > return; >+ } > if (BUS_ADD_CHILD(parent, 10, "powernow", -1) == NULL) > device_printf(parent, "powernow: add child failed\n"); > } >@@ -895,8 +900,10 @@ pn_probe(device_t dev) > status = rdmsr(MSR_AMDK7_FIDVID_STATUS); > > pc = cpu_get_pcpu(dev); >- if (pc == NULL) >+ if (pc == NULL) { >+ printf("powernow: cpu_get_pcpu() returned NULL.\n"); > return (ENODEV); >+ } > > cpu_est_clockrate(pc->pc_cpuid, &rate); > >@@ -936,6 +943,7 @@ pn_probe(device_t dev) > device_set_desc(dev, "Cool`n'Quiet K8"); > break; > default: >+ printf("powernow: cpuid 0x%04x & 0xf00 not matched.\n", cpu_id); > return (ENODEV); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 212020
: 173900