1 #if defined(__i386__) || defined(__x86_64__)
11 #define MSR_AMD_PSTATE_STATUS 0xc0010063
12 #define MSR_AMD_PSTATE 0xc0010064
13 #define MSR_AMD_PSTATE_LIMIT 0xc0010061
29 unsigned long long val;
44 static int get_cof(
int family,
union msr_pstate pstate)
49 did = get_did(family, pstate);
52 fid = pstate.bits.fid;
56 return (100 * (fid + t)) >> did;
73 int boost_states,
unsigned long *pstates,
int *
no)
76 union msr_pstate pstate;
77 unsigned long long val;
83 if (cpu_family < 0x10 || cpu_family == 0x14)
86 if (read_msr(cpu, MSR_AMD_PSTATE_LIMIT, &val))
89 psmax = (val >> 4) & 0x7;
91 if (read_msr(cpu, MSR_AMD_PSTATE_STATUS, &val))
96 pscur += boost_states;
97 psmax += boost_states;
98 for (i = 0; i <= psmax; i++) {
100 fprintf(stderr,
"HW pstates [%d] exceeding max [%d]\n",
104 if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val))
106 pstates[
i] = get_cof(cpu_family, pstate);
112 int amd_pci_get_num_boost_states(
int *
active,
int *states)
114 struct pci_access *pci_acc;
118 *active = *states = 0;
120 device = pci_slot_func_init(&pci_acc, 0x18, 4);
125 val = pci_read_byte(device, 0x15c);
130 *states = (val >> 2) & 7;
132 pci_cleanup(pci_acc);