staticint get_did(union core_pstate pstate)
{ int t;
/* Fam 1Ah onward do not use did */ if (cpupower_cpu_info.family >= 0x1A) return0;
if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF)
t = pstate.pstatedef.did; elseif (cpupower_cpu_info.family == 0x12)
t = pstate.val & 0xf; else
t = pstate.pstate.did;
return t;
}
staticint get_cof(union core_pstate pstate)
{ int t; int fid, did, cof = 0;
did = get_did(pstate); if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) { if (cpupower_cpu_info.family >= 0x1A) {
fid = pstate.pstatedef2.fid; if (fid > 0x0f)
cof = (fid * 5);
} else {
fid = pstate.pstatedef.fid;
cof = 200 * fid / did;
}
} else {
t = 0x10;
fid = pstate.pstate.fid; if (cpupower_cpu_info.family == 0x11)
t = 0x8;
cof = (100 * (fid + t)) >> did;
} return cof;
}
/* Needs: *cpu->thecputhatgetsevaluated *boost_states->howmuchbooststatesthemachinessupport * *Fillsup: *pstates->apointertoanarrayofsizeMAX_HW_PSTATES *mustbeinitializedwithzeros. *AllavailableHWpstates(includingbooststates) *no->amountofpstatesabovearraygotfilledupwith * *returnszeroonsuccess,-1onfailure
*/ int decode_pstates(unsignedint cpu, int boost_states, unsignedlong *pstates, int *no)
{ int i, psmax; union core_pstate pstate; unsignedlonglong val;
/* Only read out frequencies from HW if HW Pstate is supported, *otherwisefrequenciesareexportedviaACPItables.
*/ if (!(cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_HW_PSTATE)) return -1;
if (read_msr(cpu, MSR_AMD_PSTATE_LIMIT, &val)) return -1;
psmax = (val >> 4) & 0x7;
psmax += boost_states; for (i = 0; i <= psmax; i++) { if (i >= MAX_HW_PSTATES) {
fprintf(stderr, "HW pstates [%d] exceeding max [%d]\n",
psmax, MAX_HW_PSTATES); return -1;
} if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val)) return -1;
/* The enabled bit (bit 63) is common for all families */ if (!pstate.pstatedef.en) continue;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.