diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp index 9c5c2a7b..db82062f 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/mtc_timing_value.hpp @@ -27,7 +27,8 @@ namespace ams::ldr::oc { #define FLOOR(A) std::floor(A) #define ROUND(A) std::lround(A) - #define PACK_U32(high, low) ((static_cast(high) << 16) | (static_cast(low) & 0xFFFF)) + #define PACK_U32(high, low) ((static_cast(high) << 16) | (static_cast(low) & 0xFFFF)) + #define PACK_U32_NIBBLE_HIGH_BYTE_LOW(high, low) ((static_cast(high & 0xF) << 28) | (static_cast(low) & 0xFF)) /* Primary timings. */ const std::array tRCD_values = { 18, 17, 16, 15, 14, 13, 12, 11 }; @@ -110,7 +111,7 @@ namespace ams::ldr::oc { const u32 einput = 5 + qpop - einput_duration; const u32 ibdly = 0x10000000 + FLOOR(MAX(RL_DBI - 1.9999956603408224, quse - 5.9999987787411175) + (-0.0011929079761504341 * ramFreqMhz)); const u32 qrst_duration = FLOOR((ramFreqMhz * 0.001477125119082522) + 4.272302254983803); - const u32 qrstLow = MAX((einput - qrst_duration) - 2, static_cast(0)); + const u32 qrstLow = MAX(static_cast(einput - qrst_duration - 2), static_cast(0)); const u32 qrst = PACK_U32(qrst_duration, qrstLow); const u32 qsafe = (einput_duration + 3) + MAX(MIN(qrstLow * rdv, qrst_duration + qrst_duration), einput); @@ -123,7 +124,11 @@ namespace ams::ldr::oc { const u32 wdv = WL; const u32 wsv = WL - 2; const u32 wev = 0xA + (WL - 14); - const u32 obdly = 0x10000000 + WL - MIN(static_cast(WL), 12 - (CEIL(-0.0003991 * ramFreqMhz) * 2)); + + const u32 obdlyHigh = 3 / FLOOR(MIN(static_cast(2), tCK_avg * (WL - 7))); + const u32 obdlyLow = WL - MIN(static_cast(WL), 12 - (CEIL(-0.0003991 * ramFreqMhz) * 2)); + + const u32 obdly = PACK_U32_NIBBLE_HIGH_BYTE_LOW(obdlyHigh, obdlyLow); inline u32 pdex2rw; inline u32 cke2pden; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp index f4df800e..e57ef3bf 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp @@ -168,7 +168,7 @@ void Patch(uintptr_t mapped_nso, size_t nso_size) { if (isMariko) mariko::Patch(mapped_nso, nso_size); else - mariko::Patch(mapped_nso, nso_size); + erista::Patch(mapped_nso, nso_size); #endif } 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 59344898..7f936a11 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_erista.cpp @@ -45,7 +45,6 @@ namespace ams::ldr::oc::pcv::erista { Result CpuVoltThermals(u32 *ptr) { if (std::memcmp(ptr - 6, cpuVoltageThermalPattern, sizeof(cpuVoltageThermalPattern))) { - // AMS_ABORT_UNLESS(0); R_THROW(ldr::ResultInvalidCpuMinVolt()); } @@ -67,7 +66,6 @@ namespace ams::ldr::oc::pcv::erista { Result CpuVoltDfll(u32* ptr) { cvb_cpu_dfll_data *entry = reinterpret_cast(ptr); - R_UNLESS(entry->tune0_low == 0x0000FFCF, ldr::ResultInvalidCpuVoltDfllEntry()); R_UNLESS(entry->tune0_high == 0x00000000, ldr::ResultInvalidCpuVoltDfllEntry()); R_UNLESS(entry->tune1_low == 0x012207FF, ldr::ResultInvalidCpuVoltDfllEntry()); 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 8d774c08..d9e1d793 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp @@ -489,7 +489,7 @@ namespace ams::ldr::oc::pcv::mariko { constexpr double MC_ARB_DIV = 4.0; constexpr u32 MC_ARB_SFA = 2; - table->burst_mc_regs.mc_emem_arb_cfg = C.marikoEmcMaxClock / (33.3 * 1000) / MC_ARB_DIV; + table->burst_mc_regs.mc_emem_arb_cfg = C.marikoEmcMaxClock / (33.3 * 1000) / MC_ARB_DIV; table->burst_mc_regs.mc_emem_arb_timing_rcd = CEIL(GET_CYCLE_CEIL(tRCD) / MC_ARB_DIV) - 2; table->burst_mc_regs.mc_emem_arb_timing_rp = CEIL(GET_CYCLE_CEIL(tRPpb) / MC_ARB_DIV) - 1; table->burst_mc_regs.mc_emem_arb_timing_rc = CEIL(GET_CYCLE_CEIL(tRC) / MC_ARB_DIV) - 1;