diff --git a/x86_64/corefreqd.c b/x86_64/corefreqd.c index 6fd7ade6..94a2e31d 100644 --- a/x86_64/corefreqd.c +++ b/x86_64/corefreqd.c @@ -784,6 +784,50 @@ static void (*ComputeVoltage_AMD_RMB_Matrix[4])(struct FLIP_FLOP*, [FORMULA_SCOPE_PKG ] = ComputeVoltage_AMD_RMB_PerPkg }; +static void ComputeVoltage_AMD_19_61h( struct FLIP_FLOP *CFlip, + RO(SHM_STRUCT) *RO(Shm), + unsigned int cpu ) +{ + COMPUTE_VOLTAGE(AMD_19_61h, + CFlip->Voltage.Vcore, + CFlip->Voltage.VID); + + Core_ComputeVoltageLimits(&RO(Shm)->Cpu[cpu], CFlip); +} + +#define ComputeVoltage_AMD_19_61h_PerSMT ComputeVoltage_AMD_19_61h + +static void ComputeVoltage_AMD_19_61h_PerCore( struct FLIP_FLOP *CFlip, + RO(SHM_STRUCT) *RO(Shm), + unsigned int cpu ) +{ + if ((RO(Shm)->Cpu[cpu].Topology.ThreadID == 0) + || (RO(Shm)->Cpu[cpu].Topology.ThreadID == -1)) + { + ComputeVoltage_AMD_19_61h(CFlip, RO(Shm), cpu); + } +} + +static void ComputeVoltage_AMD_19_61h_PerPkg( struct FLIP_FLOP *CFlip, + RO(SHM_STRUCT) *RO(Shm), + unsigned int cpu ) +{ + if (cpu == RO(Shm)->Proc.Service.Core) + { + ComputeVoltage_AMD_19_61h(CFlip, RO(Shm), cpu); + } +} + +static void (*ComputeVoltage_AMD_19_61h_Matrix[4])(struct FLIP_FLOP*, + RO(SHM_STRUCT)*, + unsigned int) = \ +{ + [FORMULA_SCOPE_NONE] = ComputeVoltage_None, + [FORMULA_SCOPE_SMT ] = ComputeVoltage_AMD_19_61h_PerSMT, + [FORMULA_SCOPE_CORE] = ComputeVoltage_AMD_19_61h_PerCore, + [FORMULA_SCOPE_PKG ] = ComputeVoltage_AMD_19_61h_PerPkg +}; + static void ComputeVoltage_Winbond_IO( struct FLIP_FLOP *CFlip, RO(SHM_STRUCT) *RO(Shm), unsigned int cpu ) @@ -1058,6 +1102,9 @@ static void *Core_Cycle(void *arg) case VOLTAGE_KIND_AMD_RMB: ComputeVoltageFormula = ComputeVoltage_AMD_RMB_Matrix; break; + case VOLTAGE_KIND_AMD_19_61h: + ComputeVoltageFormula = ComputeVoltage_AMD_19_61h_Matrix; + break; case VOLTAGE_KIND_WINBOND_IO: ComputeVoltageFormula = ComputeVoltage_Winbond_IO_Matrix; break; @@ -8658,6 +8705,17 @@ static void Pkg_ComputeVoltage_AMD_RMB(struct PKG_FLIP_FLOP *PFlip) PFlip->Voltage.VID.SOC); } +static void Pkg_ComputeVoltage_AMD_19_61h(struct PKG_FLIP_FLOP *PFlip) +{ + COMPUTE_VOLTAGE(AMD_19_61h, + PFlip->Voltage.CPU, + PFlip->Voltage.VID.CPU); +/*TODO + COMPUTE_VOLTAGE(AMD_19_61h, + PFlip->Voltage.SOC, + PFlip->Voltage.VID.SOC); */ +} + static void Pkg_ComputeVoltage_Winbond_IO(struct PKG_FLIP_FLOP *PFlip) { /* Winbond W83627EHF/EF, W83627EHG,EG */ COMPUTE_VOLTAGE(WINBOND_IO, @@ -8814,6 +8872,9 @@ REASON_CODE Core_Manager(REF *Ref) case VOLTAGE_KIND_AMD_RMB: Pkg_ComputeVoltageFormula = Pkg_ComputeVoltage_AMD_RMB; break; + case VOLTAGE_KIND_AMD_19_61h: + Pkg_ComputeVoltageFormula = Pkg_ComputeVoltage_AMD_19_61h; + break; case VOLTAGE_KIND_WINBOND_IO: Pkg_ComputeVoltageFormula = Pkg_ComputeVoltage_Winbond_IO; break; diff --git a/x86_64/corefreqk.h b/x86_64/corefreqk.h index 3a5c497f..c81651c0 100644 --- a/x86_64/corefreqk.h +++ b/x86_64/corefreqk.h @@ -11962,7 +11962,7 @@ static ARCH Arch[ARCHITECTURES] = { .ClockMod = ClockMod_AMD_Zen, .TurboClock = TurboClock_AMD_Zen, .thermalFormula = THERMAL_FORMULA_AMD_ZEN4, - .voltageFormula = VOLTAGE_FORMULA_AMD_ZEN4, + .voltageFormula = VOLTAGE_FORMULA_AMD_19_61h, .powerFormula = POWER_FORMULA_AMD_19h, .PCI_ids = PCI_AMD_19h_ids, .Uncore = { diff --git a/x86_64/coretypes.h b/x86_64/coretypes.h index 2338c8cc..d6228364 100644 --- a/x86_64/coretypes.h +++ b/x86_64/coretypes.h @@ -581,6 +581,7 @@ enum VOLTAGE_KIND { VOLTAGE_KIND_AMD_15h = 0b000001000001000000000000, VOLTAGE_KIND_AMD_17h = 0b000100000001000000000000, VOLTAGE_KIND_AMD_RMB = 0b000010000001000000000000, + VOLTAGE_KIND_AMD_19_61h = 0b000000100001000000000000, VOLTAGE_KIND_WINBOND_IO = 0b001000000000000000000000, VOLTAGE_KIND_ITETECH_IO = 0b010000000000000000000000 }; @@ -600,6 +601,7 @@ VOLTAGE_FORMULA_AMD_15h =(VOLTAGE_KIND_AMD_15h << 8) | FORMULA_SCOPE_SMT, VOLTAGE_FORMULA_AMD_17h =(VOLTAGE_KIND_AMD_17h << 8) | FORMULA_SCOPE_SMT, VOLTAGE_FORMULA_AMD_RMB =(VOLTAGE_KIND_AMD_RMB << 8) | FORMULA_SCOPE_PKG, VOLTAGE_FORMULA_AMD_ZEN4 =(VOLTAGE_KIND_AMD_RMB << 8) | FORMULA_SCOPE_SMT, +VOLTAGE_FORMULA_AMD_19_61h =(VOLTAGE_KIND_AMD_19_61h << 8) | FORMULA_SCOPE_SMT, VOLTAGE_FORMULA_WINBOND_IO =(VOLTAGE_KIND_WINBOND_IO << 8) | FORMULA_SCOPE_PKG, VOLTAGE_FORMULA_ITETECH_IO =(VOLTAGE_KIND_ITETECH_IO << 8) | FORMULA_SCOPE_PKG }; @@ -776,6 +778,9 @@ POWER_FORMULA_AMD_17h =(POWER_KIND_AMD_17h << 8) | FORMULA_SCOPE_CORE #define COMPUTE_VOLTAGE_AMD_RMB(Vcore, VID) \ (Vcore = 0.00625 * (double) (VID)) +#define COMPUTE_VOLTAGE_AMD_19_61h(Vcore, VID) \ + ( Vcore = 2.09 - ((0.005 * (double) (VID)) + 0.245) ) + #define COMPUTE_VOLTAGE_WINBOND_IO(Vcore, VID) \ (Vcore = (double) (VID) * 0.008)