File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -1018,6 +1018,40 @@ void GetCPUProperties (void)
10181018 }
10191019 break ;
10201020
1021+ case 0x1A : // and 1Ah Ryzen
1022+ {
1023+
1024+ UINT64 cofvid = 0 , msr_min = 0 ;
1025+ UINT64 cpuMult;
1026+ UINT64 CpuFid;
1027+
1028+ msr_min = AsmReadMsr64 (K10_COFVID_LIMIT);
1029+ msr_min = AsmReadMsr64 (K10_PSTATE_STATUS + (RShiftU64 (msr_min, 4 ) & 0x7 ));
1030+ gCPUStructure .MinRatio = ((UINT32)DivU64x32 (((msr_min & 0xFF )), (RShiftU64 (msr_min, 8 ) & 0x3f )))*20 ;
1031+
1032+ cofvid = AsmReadMsr64 (K10_PSTATE_STATUS);
1033+ CpuFid = bitfield (cofvid, 11 , 0 );
1034+
1035+ // On AMD Family 1Ah and later, if the Frequency ID (FID) exceeds 0x0f,
1036+ // the core frequency is scaled by a factor of 5. This scaling behavior
1037+ // is based on Linux kernel logic for handling higher frequency multipliers
1038+ // in newer AMD CPUs, where the FID no longer directly correlates to the
1039+ // bus ratio.
1040+ if (CpuFid > 0x0f ) {
1041+ CpuFid *= 5 ;
1042+ }
1043+
1044+ cpuMult = (UINT8)(CpuFid);
1045+ currcoef = (INTN)cpuMult;
1046+ gCPUStructure .MaxRatio = (UINT32)cpuMult;
1047+
1048+ cpuMultN2 = (cofvid & (UINT64)bit (0 ));
1049+ currdiv = cpuMultN2;
1050+ cpudid_zen = (UINT32)(RShiftU64 (cofvid, 8 ) & 0xff ); // for mult
1051+
1052+ }
1053+ break ;
1054+
10211055 default :
10221056 {
10231057 gCPUStructure .MaxRatio = (UINT32)DivU64x32 (gCPUStructure .TSCFrequency , (200 * Mega));// hz / (200 * Mega);
You can’t perform that action at this time.
0 commit comments