Bug #2814 ยป pstate.patch
sys/platform/pc64/acpica/acpi_pstate_machdep.c | ||
---|---|---|
#define AMD_APMI_HWPSTATE 0x80
|
||
#define AMD_MSR_PSTATE_CSR_MASK 0x7ULL
|
||
#define AMD1X_MSR_PSTATE_LIMIT 0xc0010061
|
||
#define AMD1X_MSR_PSTATE_CTL 0xc0010062
|
||
#define AMD1X_MSR_PSTATE_ST 0xc0010063
|
||
#define AMD_MSR_PSTATE_EN 0x8000000000000000ULL
|
||
#define AMD10_MSR_PSTATE_START 0xc0010064
|
||
#define AMD10_MSR_PSTATE_COUNT 5
|
||
#define AMD0F_PST_CTL_FID(cval) (((cval) >> 0) & 0x3f)
|
||
#define AMD0F_PST_CTL_VID(cval) (((cval) >> 6) & 0x1f)
|
||
... | ... | |
static int
|
||
acpi_pst_amd10_check_pstates(const struct acpi_pstate *pstates, int npstates)
|
||
{
|
||
/* Only P0-P4 are supported */
|
||
if (npstates > AMD10_MSR_PSTATE_COUNT) {
|
||
kprintf("cpu%d: only P0-P4 is allowed\n", mycpuid);
|
||
return EINVAL;
|
||
}
|
||
uint64_t count;
|
||
count = rdmsr(AMD1X_MSR_PSTATE_LIMIT);
|
||
count = 1 + ((count >> 4) & 0x7);
|
||
return acpi_pst_amd1x_check_pstates(pstates, npstates,
|
||
AMD10_MSR_PSTATE_START,
|
||
AMD10_MSR_PSTATE_START + AMD10_MSR_PSTATE_COUNT);
|
||
AMD10_MSR_PSTATE_START + (uint32_t)count);
|
||
}
|
||
static int
|