clkmgr: (hack) prevent emc freq list mismatch with 64 lut freq hack
This commit is contained in:
1 parent
f9ed6c84b9
commit
dd59deeefa
3 files changed
+18
-2
No files matched your search
@@ -219,6 +219,18 @@ namespace kip {
|
|||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/* Hack: Get the actually applied and in use emc max clock for 64 lut freq hack. */
|
||||||
|
/* I hate this. */
|
||||||
|
/* Don't fetch frequency if it's already set or we would overwrite it. */
|
||||||
|
/* This technically only applies to Mariko *for now*. */
|
||||||
|
if (clockManager::patchedEmcMaxClock == 0) {
|
||||||
|
if (board::GetSocType() == HocClkSocType_Mariko) {
|
||||||
|
clockManager::patchedEmcMaxClock = cust_get_mariko_emc_max(&table);
|
||||||
|
} else {
|
||||||
|
clockManager::patchedEmcMaxClock = cust_get_erista_emc_max(&table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip") != config::GetConfigValue(KipCrc32) &&
|
if ((u64)crc32::checksum_file("sdmc:/atmosphere/kips/hoc.kip") != config::GetConfigValue(KipCrc32) &&
|
||||||
!config::GetConfigValue(HocClkConfigValue_IsFirstLoad)) {
|
!config::GetConfigValue(HocClkConfigValue_IsFirstLoad)) {
|
||||||
MigrateKipData(cust_get_cust_rev(&table), cust_get_kip_version(&table));
|
MigrateKipData(cust_get_cust_rev(&table), cust_get_kip_version(&table));
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ namespace clockManager {
|
|||||||
LockableMutex gContextMutex;
|
LockableMutex gContextMutex;
|
||||||
HocClkContext gContext = {};
|
HocClkContext gContext = {};
|
||||||
FreqTable gFreqTable[HocClkModule_EnumMax];
|
FreqTable gFreqTable[HocClkModule_EnumMax];
|
||||||
|
/* Hack: Fixes emc 64 lut freq list hack edge case. */
|
||||||
|
/* The clock in the config may differ from the actual max clock, so it's read out from the kip before migration or any other potential overwrite. */
|
||||||
|
u32 patchedEmcMaxClock = {};
|
||||||
std::uint64_t gLastTempLogNs = 0;
|
std::uint64_t gLastTempLogNs = 0;
|
||||||
std::uint64_t gLastFreqLogNs = 0;
|
std::uint64_t gLastFreqLogNs = 0;
|
||||||
std::uint64_t gLastPowerLogNs = 0;
|
std::uint64_t gLastPowerLogNs = 0;
|
||||||
@@ -297,7 +300,7 @@ namespace clockManager {
|
|||||||
|
|
||||||
/* Since it is a pain to patch the vtables in ipc we can just hack the freqs in. You can still set them. */
|
/* Since it is a pain to patch the vtables in ipc we can just hack the freqs in. You can still set them. */
|
||||||
constexpr u64 EmcClkOSLimitHz = 1600000ULL * 1000; // 1600 MHz
|
constexpr u64 EmcClkOSLimitHz = 1600000ULL * 1000; // 1600 MHz
|
||||||
const u64 maxHz = static_cast<u64>(config::GetConfigValue(KipConfigValue_marikoEmcMaxClock)) * 1000;
|
const u64 maxHz = patchedEmcMaxClock * 1000;
|
||||||
if (module == HocClkModule_MEM && board::GetSocType() == HocClkSocType_Mariko &&
|
if (module == HocClkModule_MEM && board::GetSocType() == HocClkSocType_Mariko &&
|
||||||
kip::kipAvailable && maxHz >= EmcClkOSLimitHz &&
|
kip::kipAvailable && maxHz >= EmcClkOSLimitHz &&
|
||||||
config::GetConfigValue(KipConfigValue_stepMode) == 4 /* 33 MHz */) {
|
config::GetConfigValue(KipConfigValue_stepMode) == 4 /* 33 MHz */) {
|
||||||
@@ -819,7 +822,7 @@ namespace clockManager {
|
|||||||
gContext.isDram8GB = board::IsDram8GB();
|
gContext.isDram8GB = board::IsDram8GB();
|
||||||
gContext.consoleType = board::GetConsoleType();
|
gContext.consoleType = board::GetConsoleType();
|
||||||
gContext.isFirstLoad = config::GetConfigValue(HocClkConfigValue_IsFirstLoad);
|
gContext.isFirstLoad = config::GetConfigValue(HocClkConfigValue_IsFirstLoad);
|
||||||
|
|
||||||
board::SetGpuSchedulingMode((GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling),
|
board::SetGpuSchedulingMode((GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling),
|
||||||
(GpuSchedulingOverrideMethod)config::GetConfigValue(HocClkConfigValue_GPUSchedulingMethod));
|
(GpuSchedulingOverrideMethod)config::GetConfigValue(HocClkConfigValue_GPUSchedulingMethod));
|
||||||
gContext.gpuSchedulingMode = (GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling);
|
gContext.gpuSchedulingMode = (GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling);
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ namespace clockManager {
|
|||||||
extern LockableMutex gContextMutex;
|
extern LockableMutex gContextMutex;
|
||||||
extern HocClkContext gContext;
|
extern HocClkContext gContext;
|
||||||
extern FreqTable gFreqTable[HocClkModule_EnumMax];
|
extern FreqTable gFreqTable[HocClkModule_EnumMax];
|
||||||
|
extern u32 patchedEmcMaxClock;
|
||||||
extern std::uint64_t gLastTempLogNs;
|
extern std::uint64_t gLastTempLogNs;
|
||||||
extern std::uint64_t gLastFreqLogNs;
|
extern std::uint64_t gLastFreqLogNs;
|
||||||
extern std::uint64_t gLastPowerLogNs;
|
extern std::uint64_t gLastPowerLogNs;
|
||||||
|
|||||||
Reference in new issue
Block a user