add wip erista vmax

This commit is contained in:
souldbminersmwc committed 2026-09-29 19:28:07 -04:00
1 parent c78010a1e5
commit 8953cedd50
12 files changed
+86 -17

No files matched your search

@@ -115,6 +115,7 @@ volatile CustomizeTable C = {
.eristaGpuUV = 0,
.eristaGpuVmin = 810,
.eristaGpuVmax = 1050, /* unused for now*/
.marikoGpuUV = 2,
/* Vmin past 795mV won't work due boot voltage being 800mV. */
@@ -118,7 +118,8 @@ struct CustomizeTable {
u32 eristaGpuUV;
u32 eristaGpuVmin;
u32 eristaGpuVmax;
u32 marikoGpuUV;
u32 marikoGpuVmin;
u32 marikoGpuVmax;
@@ -93,6 +93,7 @@ namespace ams::ldr {
R_DEFINE_ERROR_RESULT(HookUnavailable, 1030);
R_DEFINE_ERROR_RESULT(InvalidNvsrvDevTable, 1031);
R_DEFINE_ERROR_RESULT(InvalidForceVerbosityPattern, 1032);
R_DEFINE_ERROR_RESULT(InvalidGpuRgltrPattern, 1033);
}
namespace ams::ldr::hoc {
@@ -60,10 +60,11 @@ namespace ams::ldr::hoc::pcv::erista {
{"CPU Volt Dfll", &CpuVoltDfll, 1, nullptr, CpuTune0Low },
{"GPU Volt DVFS", &GpuVoltDVFS, 1, nullptr, GpuVminOfficial },
{"GPU Volt Thermals", &GpuVoltThermals, 1, nullptr, GpuVminOfficial },
// {"GPU Rgltr Max Vlt", &GpuRgltrMax, 2, nullptr, MaxGpuRgltrVolt },
{"GPU Freq Table", GpuFreqCvbTable<false>, 1, nullptr, GpuCvbDefaultMaxFreq },
{"GPU Freq Asm", &GpuFreqMaxAsm, 2, &GpuMaxClockPatternFn },
{"GPU PLL Max", &GpuFreqPllMax, 1, nullptr, GpuClkPllMax },
// {"GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
{"GPU PLL Limit", &GpuFreqPllLimit, 4, nullptr, GpuClkPllLimit },
{"MEM Table Asm", &MemMtcTableAsm, 4, &MemMtcGetGetTablePatternFn },
{"MEM Freq Mtc", &MemFreqMtcTable, 1, nullptr, EmcClkOSLimit },
{"MEM Freq Max", &MemFreqMax, 0, nullptr, EmcClkOSLimit },
@@ -34,6 +34,10 @@ namespace ams::ldr::hoc::pcv::erista {
PATCH_OFFSET(ptr, C.eristaGpuVmin);
}
// if(C.eristaGpuVmax) {
// PATCH_OFFSET(ptr + 1, C.eristaGpuVmax);
// }
R_SUCCEED();
}
@@ -50,6 +54,15 @@ namespace ams::ldr::hoc::pcv::erista {
PATCH_OFFSET(ptr + 12, C.eristaGpuVmin);
}
// if(C.eristaGpuVmax) {
// PATCH_OFFSET(ptr - 2, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 1, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 4, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 7, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 10, C.eristaGpuVmax);
// PATCH_OFFSET(ptr + 13, C.eristaGpuVmax);
// }
R_SUCCEED();
}
@@ -107,17 +120,34 @@ namespace ams::ldr::hoc::pcv::erista {
R_SUCCEED();
}
// patch out 1305MHz limit on erista, don't use this!
// Result GpuFreqPllLimit(u32 *ptr) {
// u32 prev_freq = *(ptr - 1);
/* Not strictly needed but there for completeness. Table will limit far before this */
Result GpuFreqPllLimit(u32 *ptr) {
u32 prev_freq = *(ptr - 1);
// if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
// R_THROW(ldr::ResultInvalidGpuPllEntry());
if (prev_freq != 128000 && prev_freq != 1300000 && prev_freq != 76800) {
R_THROW(ldr::ResultInvalidGpuPllEntry());
}
PATCH_OFFSET(ptr, 3600000);
R_SUCCEED();
}
// Result GpuRgltrMax(u32* ptr) {
// /* Confirm that we are in the correct struct */
// if (std::memcmp(ptr - 5, GpuRgltrVoltPattern, sizeof(GpuRgltrVoltPattern))) {
// R_THROW(ldr::ResultInvalidGpuRgltrPattern());
// }
// PATCH_OFFSET(ptr, 3600000);
// /* Ensure that the max voltage is actually present before patching it */
// if(C.eristaGpuVmax) {
// /* Rgltr Vmax is in uV for some reason? */
// PATCH_OFFSET(ptr, C.eristaGpuVmax * 1000);
// } else {
// /* Lower the default max for safety */
// PATCH_OFFSET(ptr, MaxGoodGpuRgltrVolt);
// }
// R_SUCCEED();
// }
}
@@ -71,12 +71,26 @@ namespace ams::ldr::hoc::pcv::erista {
{ },
};
// constexpr u32 MaxGpuRgltrVolt = 1150'000; // 1.15V
// constexpr u32 MaxGoodGpuRgltrVolt = 1050'000; // NVIDIA rating
// // 0x20 byte struct (8xu32), RgltrEntry. TODO: determine what the other values are
// inline constexpr u32 GpuRgltrVoltPattern[] = {
// 0x2, // unknown, -5
// 0x0, // padding
// 6250, // Step
// 0x0, // padding
// 618750, // Min volt?
// 1150000, // max volt, anchor
// 0x0, // padding
// 1000000, // unknown
// };
// static_assert(sizeof(GpuRgltrVoltPattern) == (sizeof(u32) * 8), "Invalid GpuRgltrVoltPattern");
Result GpuVoltDVFS(u32 *ptr);
Result GpuVoltThermals(u32 *ptr);
Result GpuFreqMaxAsm(u32 *ptr32);
Result GpuFreqPllMax(u32 *ptr);
// patch out 1305MHz limit on erista, don't use this!
// Result GpuFreqPllLimit(u32 *ptr);
Result GpuFreqPllLimit(u32 *ptr);
// Result GpuRgltrMax(u32* ptr);
}
@@ -161,6 +161,7 @@ namespace ams::ldr::hoc::pcv {
{ eristaGpuDvfsMaxFreq, 768'000, 1152'000, panic::Gpu, },
{ marikoGpuDvfsMaxFreq, 768'000, 1574'400, panic::Gpu, },
{ C.marikoGpuVmax, 800, 995, panic::Gpu, }, /* Official GPU vMax is 1050mV */
{ C.eristaGpuVmax, 800, 1050, panic::Gpu },
};
for (auto &v : validators) {