| 1 |
|
| 2 |
|
| 3 |
#include <amdblocks/cpu.h> |
| 4 |
#include <soc/msr.h> |
| 5 |
#include <types.h> |
| 6 |
|
| 7 |
|
| 8 |
#define SERIAL_VID_3_DECODE_MICROVOLTS 5000 |
| 9 |
#define SERIAL_VID_3_BASE_MICROVOLTS 245000L |
| 10 |
|
| 11 |
uint32_t get_uvolts_from_vid(uint16_t core_vid) |
| 12 |
{ |
| 13 |
if (core_vid == 0x00) { |
| 14 |
|
| 15 |
return 0; |
| 16 |
} else { |
| 17 |
return SERIAL_VID_3_BASE_MICROVOLTS + |
| 18 |
(SERIAL_VID_3_DECODE_MICROVOLTS * core_vid); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
uint32_t get_pstate_core_uvolts(union pstate_msr pstate_reg) |
| 23 |
{ |
| 24 |
return get_uvolts_from_vid(pstate_reg.cpu_vid_0_7 | pstate_reg.cpu_vid_8 << 8); |
| 25 |
} |