From 2a0dac43d3bde7e0a2608a86e05cb3971661f7c0 Mon Sep 17 00:00:00 2001 From: Lightos1 <124387232+Lightos1@users.noreply.github.com> Date: Tue, 2 Dec 2025 17:31:17 +0100 Subject: [PATCH] Add 1305 pll limit patch for mariko --- .../loader/source/oc/customize.cpp | 12 +++++++++--- .../loader/source/oc/customize.hpp | 4 +++- .../stratosphere/loader/source/oc/pcv/pcv.hpp | 3 ++- .../loader/source/oc/pcv/pcv_mariko.cpp | 19 +++++++++++++++---- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp index 2bef467b..b4ce5903 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp @@ -45,7 +45,7 @@ volatile CustomizeTable C = { .marikoCpuMaxVolt = 1185, -.marikoEmcMaxClock = 2700000, // Hynix NME and Samsung AM-MGCJ Rating (others are 4766MT, 2133MHz) +.marikoEmcMaxClock = 2133000, // Hynix NME and Samsung AM-MGCJ Rating (others are 4766MT, 2133MHz) .marikoEmcVddqVolt = 640000, @@ -86,6 +86,14 @@ volatile CustomizeTable C = { .marikoGpuVmin = 610, .marikoGpuVmax = 850, + +/* >1305 GPU unlock. */ +/* WARNING! This removes ALL gpu frequency limits and risks permanent hardware damage. */ +/* This setting is very dangerous and can damage your pmic, degrade your soc, damage the voltage rails and can cause various other damage. */ +/* Even with all of that said, if you still decide to use this despite all the warnings, use it at your own risk. */ +/* No warranty is provided in any way whatsoever. */ +.marikoGpuFullUnlock = DISABLED, + // NOTE: These tables should NOT BE USED and are only here as placeholders. Always try and find your own optimal tables. // Ensure the voltages actually increase or stay the sameot @@ -147,8 +155,6 @@ volatile CustomizeTable C = { 0 /* 1075 (Disabled by default) */, }, - - /* Advanced Settings: * - Erista CPU DVFS Table: */ diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp index 5cf29fd8..9f8e5149 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp @@ -85,6 +85,8 @@ typedef struct CustomizeTable { u32 marikoGpuVmin; u32 marikoGpuVmax; + u32 marikoGpuFullUnlock; + u32 marikoGpuVoltArray[24]; u32 eristaGpuVoltArray[27]; @@ -96,10 +98,10 @@ typedef struct CustomizeTable { CustomizeGpuDvfsTable eristaGpuDvfsTableSLT; CustomizeGpuDvfsTable eristaGpuDvfsTableHigh; - CustomizeGpuDvfsTable marikoGpuDvfsTable; CustomizeGpuDvfsTable marikoGpuDvfsTableSLT; CustomizeGpuDvfsTable marikoGpuDvfsTableHiOPT; + } CustomizeTable; extern volatile CustomizeTable C; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp index 33f8d72d..c08c7aad 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp @@ -94,7 +94,8 @@ namespace ams::ldr::oc::pcv {}, }; - constexpr u32 GpuClkPllLimit = 1300'000'000; + constexpr u32 GpuClkPllMax = 1300'000'000; + constexpr u32 GpuClkPllLimit = 2'600'000; /* GPU Max Clock asm Pattern: * diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp index 7a79e1f8..fb6a4cb1 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp @@ -204,7 +204,7 @@ namespace ams::ldr::oc::pcv::mariko { R_SUCCEED(); } - Result GpuFreqPllLimit(u32 *ptr) { + Result GpuFreqPllMax(u32 *ptr) { clk_pll_param *entry = reinterpret_cast(ptr); // All zero except for freq @@ -218,8 +218,18 @@ namespace ams::ldr::oc::pcv::mariko { R_SUCCEED(); } - Result GpuFreqMax(u32 *ptr) { - PATCH_OFFSET(ptr, 3600000); + Result GpuFreqPllLimit(u32 *ptr) { + u32 prev_freq = *(ptr - 1); + + if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) { + R_THROW(ldr::ResultInvalidGpuPllEntry()); + } + + if (C.marikoGpuFullUnlock) { + /* Removes all limits - dangerous. */ + *ptr = 3600000; + } + R_SUCCEED(); } @@ -840,7 +850,8 @@ namespace ams::ldr::oc::pcv::mariko { {"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, 0x0000FFCF}, {"GPU Freq Table", GpuFreqCvbTable, 1, nullptr, GpuCvbDefaultMaxFreq}, {"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 Dvb", &MemFreqDvbTable, 1, nullptr, EmcClkOSLimit}, {"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit},