Skip to content

Commit

Permalink
[AMD][Family 19h] New voltage formula assigned to model 61h
Browse files Browse the repository at this point in the history
* Vcore activated
* Voltage SoC deactivated
  • Loading branch information
cyring committed Jun 30, 2024
1 parent c0d1a68 commit 2ded4e4
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
61 changes: 61 additions & 0 deletions x86_64/corefreqd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion x86_64/corefreqk.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
5 changes: 5 additions & 0 deletions x86_64/coretypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand All @@ -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
};
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 2ded4e4

Please sign in to comment.