Add true cpu cap

This commit is contained in:
Lightos1
2025-12-17 21:37:38 +01:00
parent c72a1f5f79
commit 9b9e72b9aa
4 changed files with 24 additions and 4 deletions

View File

@@ -29,9 +29,6 @@
namespace ams::ldr::oc {
//volatile EristaMtcTable EristaMtcTablePlaceholder = { .rev = ERISTA_MTC_MAGIC, };
//volatile MarikoMtcTable MarikoMtcTablePlaceholder = { .rev = MARIKO_MTC_MAGIC, };
volatile CustomizeTable C = {
.mtcConf = AUTO_ADJ_BL,
@@ -70,6 +67,12 @@ volatile CustomizeTable C = {
.marikoCpuHighVmin = 750,
.marikoCpuMaxVolt = 1120,
/* Supported values: 2397000, 2499000, 2601000, 2703000. */
/* 2499000 should be used with caution. */
/* 2601000 exceeds pmic limit on most consoles. */
/* 2703000 is potentially dangerous and not advised. */
.marikoCpuMaxClock = 2397000,
.eristaCpuBoostClock = 1785000, // Default boost clock
.marikoCpuBoostClock = 1963000, // Default boost clock

View File

@@ -86,6 +86,7 @@ typedef struct CustomizeTable {
u32 marikoCpuLowVmin;
u32 marikoCpuHighVmin;
u32 marikoCpuMaxVolt;
u32 marikoCpuMaxClock;
u32 eristaCpuBoostClock;
u32 marikoCpuBoostClock;

View File

@@ -60,6 +60,21 @@ namespace ams::ldr::oc::pcv {
constexpr s32 CpuVoltageSecondaryPatchOffsets[] = { -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
static_assert(sizeof(CpuVoltageSecondaryPatchValues) == sizeof(CpuVoltageSecondaryPatchOffsets), "Invalid secondary CpuVoltagePatch size");
constexpr u32 CapCpuClock() {
constexpr u32 AllowedCpuMaxFrequencies[] = { 2'397'000, 2'499'000, 2'601'000, 2'703'000, };
u32 cpuCap = AllowedCpuMaxFrequencies[0];
for (u32 freq : AllowedCpuMaxFrequencies) {
if (C.marikoCpuMaxClock >= freq) {
cpuCap = freq;
} else {
break;
}
}
return cpuCap;
}
constexpr cvb_entry_t GpuCvbTableDefault[] = {
// GPUB01_NA_CVB_TABLE
{ 76800, {}, { 610000, } },

View File

@@ -98,8 +98,9 @@ namespace ams::ldr::oc::pcv::mariko {
R_UNLESS(entry->min_mv == 250'000, ldr::ResultInvalidCpuFreqVddEntry());
R_UNLESS(entry->step_mv == 5000, ldr::ResultInvalidCpuFreqVddEntry());
R_UNLESS(entry->max_mv == 1525'000, ldr::ResultInvalidCpuFreqVddEntry());
if (C.marikoCpuUVHigh) {
PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTableSLT)->freq);
PATCH_OFFSET(ptr, CapCpuClock());
} else {
PATCH_OFFSET(ptr, GetDvfsTableLastEntry(C.marikoCpuDvfsTable)->freq);
}