Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
Add Comment
Please, Sign In to add comment