From 749e5147df668ab892f082dba54168dd593b5854 Mon Sep 17 00:00:00 2001 From: souldbminersmwc Date: Mon, 23 Feb 2026 18:44:10 -0500 Subject: [PATCH] ldr: add commented pll limit patch --- .../stratosphere/loader/source/oc/pcv/pcv.hpp | 4 +- .../loader/source/oc/pcv/pcv_erista.cpp | 44 ++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp index 112d2e4f..fbf78df3 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp @@ -214,8 +214,8 @@ namespace ams::ldr::hoc::pcv { static const u32 cpuVoltageThermalPattern[] = { 950, 1132, 0, 950, 1227, 0, 825, 1227, 15000, 825, 1170, 60000, 825, 1132, 80000 }; static_assert(sizeof(cpuVoltageThermalPattern) == 0x3c, "invalid cpuVoltageThermalPattern size"); - - constexpr u32 GpuClkPllLimit = 921'600'000; + constexpr u32 GpuClkPllLimit = 2'600'000; + constexpr u32 GpuClkPllMax = 921'600'000; constexpr u32 GpuVminOfficial = 810; static const u32 gpuVoltDvfsPattern[] = { 810, 1150, 1000, 100, 1000, 10, }; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp index 9cbfa54e..03b80814 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp @@ -167,20 +167,6 @@ namespace ams::ldr::hoc::pcv::erista { R_SUCCEED(); } - Result GpuFreqPllLimit(u32 *ptr) { - clk_pll_param *entry = reinterpret_cast(ptr); - - // All zero except for freq - for (size_t i = 1; i < sizeof(clk_pll_param) / sizeof(u32); i++) { - R_UNLESS(*(ptr + i) == 0, ldr::ResultInvalidGpuPllEntry()); - } - - // Double the max clk simply - u32 max_clk = entry->freq * 2; - entry->freq = max_clk; - R_SUCCEED(); - } - /* Note: This does not have proper timings, so base latency adjustment will not work. */ /* However, it may still achieve a slightly higher frequency, but not as much as it could be. */ /* I'm certainly not insane enough to attempt this pain again, so this will have to do *for now*. */ @@ -422,6 +408,33 @@ namespace ams::ldr::hoc::pcv::erista { R_SUCCEED(); } + Result GpuFreqPllMax(u32 *ptr) { + clk_pll_param *entry = reinterpret_cast(ptr); + + // All zero except for freq + for (size_t i = 1; i < sizeof(clk_pll_param) / sizeof(u32); i++) { + R_UNLESS(*(ptr + i) == 0, ldr::ResultInvalidGpuPllEntry()); + } + + // Double the max clk simply + u32 max_clk = entry->freq * 2; + entry->freq = max_clk; + R_SUCCEED(); + } + + // patch out 1305MHz limit on erista, don't use this! + // Result GpuFreqPllLimit(u32 *ptr) { + // u32 prev_freq = *(ptr - 1); + + // if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) { + // R_THROW(ldr::ResultInvalidGpuPllEntry()); + // } + + // PATCH_OFFSET(ptr, 3600000); + + // R_SUCCEED(); + // } + void Patch(uintptr_t mapped_nso, size_t nso_size) { PatcherEntry patches[] = { {"CPU Freq Table", CpuFreqCvbTable, 1, nullptr, static_cast(GetDvfsTableLastEntry(CpuCvbTableDefault)->freq)}, @@ -432,7 +445,8 @@ namespace ams::ldr::hoc::pcv::erista { {"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, 810}, {"GPU Freq Table", GpuFreqCvbTable, 1, nullptr, static_cast(GetDvfsTableLastEntry(GpuCvbTableDefault)->freq)}, {"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn}, - {"GPU Freq PLL", &GpuFreqPllLimit, 1, nullptr, GpuClkPllLimit}, + {"GPU PLL Max", &GpuFreqPllMax, 1, nullptr, GpuClkPllMax}, + // {"GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit}, {"MEM Freq Mtc", &MemFreqMtcTable, 0, nullptr, EmcClkOSLimit}, {"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit}, {"MEM Freq PLLM", &MemFreqPllmLimit, 2, nullptr, EmcClkPllmLimit},