Public multiple ram freqs for erista

First ever release of public multiple ram freqs
You get three extra frequencies on erista
This commit is contained in:
souldbminersmwc
2025-09-23 16:28:54 -04:00
parent ddb5878639
commit 7a83309c83
5 changed files with 47 additions and 22 deletions

View File

@@ -161,7 +161,7 @@ void SafetyCheck() {
{ C.commonCpuBoostClock, 1020'000, 3000'000, true },
{ C.commonEmcMemVolt, 1100'000, 1500'000 }, // Official burst vmax for the RAMs
{ C.eristaCpuMaxVolt, 1100, 1300 },
{ C.eristaEmcMaxClock, 1600'000, 2600'200 },
{ C.eristaEmcClock3, 1600'000, 2600'200 },
{ C.marikoCpuMaxVolt, 1100, 1300 },
{ C.marikoEmcMaxClock, 1600'000, 3500'000 },
{ C.marikoEmcVddqVolt, 550'000, 700'000 },

View File

@@ -246,7 +246,7 @@
{
u32 khz_list[] = {1600000, 1331200, 1065600, 800000, 665600, 408000, 204000, 102000, 68000, 40800};
u32 khz_list_size = sizeof(khz_list) / sizeof(u32);
// Generate list for mtc table pointers
EristaMtcTable *table_list[khz_list_size];
for (u32 i = 0; i < khz_list_size; i++)
@@ -256,32 +256,49 @@
R_UNLESS(table_list[i]->rate_khz == khz_list[i], ldr::ResultInvalidMtcTable());
R_UNLESS(table_list[i]->rev == MTC_TABLE_REV, ldr::ResultInvalidMtcTable());
}
if (C.eristaEmcMaxClock <= EmcClkOSLimit)
if (C.eristaEmcClock1 <= EmcClkOSLimit ||
C.eristaEmcClock2 <= EmcClkOSLimit ||
C.eristaEmcClock3 <= EmcClkOSLimit)
R_SKIP();
// Make room for new mtc table, discarding useless 40.8 MHz table
// 40800 overwritten by 68000, ..., 1331200 overwritten by 1600000, leaving table_list[0] not overwritten
for (u32 i = khz_list_size - 1; i > 0; i--)
std::memcpy(static_cast<void *>(table_list[i]), static_cast<void *>(table_list[i - 1]), sizeof(EristaMtcTable));
// Make room for three new mtc tables, discarding useless 40.8, 68.0, and 102 MHz tables
for (u32 i = khz_list_size - 1; i > 2; i--)
std::memcpy(static_cast<void *>(table_list[i]),
static_cast<void *>(table_list[i - 3]),
sizeof(EristaMtcTable));
// Adjust all three new tables
MemMtcTableAutoAdjust(table_list[0]);
PATCH_OFFSET(ptr, C.eristaEmcMaxClock);
MemMtcTableAutoAdjust(table_list[1]);
MemMtcTableAutoAdjust(table_list[2]);
// Patch pointers for 3 custom clocks
u32 *patch_ptr1 = ptr;
u32 *patch_ptr2 = ptr - sizeof(EristaMtcTable) / sizeof(u32);
u32 *patch_ptr3 = ptr - 2 * (sizeof(EristaMtcTable) / sizeof(u32));
if (C.eristaEmcClock3 > EmcClkOSLimit)
PATCH_OFFSET(patch_ptr1, C.eristaEmcClock3);
if (C.eristaEmcClock2 > EmcClkOSLimit)
PATCH_OFFSET(patch_ptr2, C.eristaEmcClock2);
if (C.eristaEmcClock3 > EmcClkOSLimit)
PATCH_OFFSET(patch_ptr3, C.eristaEmcClock1);
// Handle customize table replacement
// if (C.mtcConf == CUSTOMIZED_ALL) {
// MemMtcCustomizeTable(table_list[0], const_cast<EristaMtcTable *>(C.eristaMtcTable));
//}
R_SUCCEED();
}
}
Result MemFreqMax(u32 *ptr)
{
if (C.eristaEmcMaxClock <= EmcClkOSLimit)
if (C.eristaEmcClock3 <= EmcClkOSLimit)
R_SKIP();
PATCH_OFFSET(ptr, C.eristaEmcMaxClock);
PATCH_OFFSET(ptr, C.eristaEmcClock3);
R_SUCCEED();
}