Clean up logging in scePowerSetClockFrequency

This commit is contained in:
Henrik Rydgård
2026-06-12 12:22:48 +02:00
parent 1d32f68869
commit 37e00f616e
3 changed files with 18 additions and 11 deletions
+8 -2
View File
@@ -61,10 +61,15 @@ static s64 idledCycles;
static s64 lastGlobalTimeTicks;
static s64 lastGlobalTimeUs;
void SetClockFrequencyHz(int cpuHz) {
bool SetClockFrequencyHz(int cpuHz) {
if (cpuHz <= 0) {
// Paranoid check, protecting against division by zero and similar nonsense.
return;
return true; // encourage logging
}
if (cpuHz == CPU_HZ) {
// Already at the correct frequency. Bail, false means we'll log at a lower level.
return false;
}
// When the mhz changes, we keep track of what "time" it was before hand.
@@ -76,6 +81,7 @@ void SetClockFrequencyHz(int cpuHz) {
// TODO: Rescale times of scheduled events?
__AudioCPUMHzChange();
return true;
}
int GetClockFrequencyHz() {
+1 -1
View File
@@ -126,7 +126,7 @@ namespace CoreTiming {
void DoState(PointerWrap &p);
void SetClockFrequencyHz(int cpuHz);
bool SetClockFrequencyHz(int cpuHz); // Return false if the frequency was already set.
int GetClockFrequencyHz();
// TODO: Add accessors?
+9 -8
View File
@@ -442,12 +442,6 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) {
if (busfreq == 0 || busfreq > 166) {
return hleLogWarning(Log::sceMisc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid bus frequency");
}
// TODO: More restrictions.
if (GetLockedCPUSpeedMhz() > 0) {
INFO_LOG(Log::HLE, "scePowerSetClockFrequency(%i,%i,%i): locked by user config at %i, %i, %i", pllfreq, cpufreq, busfreq, GetLockedCPUSpeedMhz(), GetLockedCPUSpeedMhz(), busFreq);
} else {
INFO_LOG(Log::HLE, "scePowerSetClockFrequency(%i,%i,%i)", pllfreq, cpufreq, busfreq);
}
// Only reschedules when the stepped PLL frequency changes.
// It seems like the busfreq parameter has no effect (but can cause errors.)
if (RealpllFreq != PowerPllMhzToHz(pllfreq)) {
@@ -471,8 +465,15 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) {
return hleDelayResult(hleNoLog(0), "scepower set clockFrequency", usec);
}
if (GetLockedCPUSpeedMhz() <= 0)
CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq));
if (GetLockedCPUSpeedMhz() <= 0) {
if (CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq))) {
return hleLogInfo(Log::HLE, 0);
} else {
return hleLogDebug(Log::HLE, 0);
}
} else {
return hleLogInfo(Log::HLE, 0, "locked by user config at %i, %i, %i", GetLockedCPUSpeedMhz(), GetLockedCPUSpeedMhz(), busFreq);
}
return hleNoLog(0);
}