Maximum RAM frequency will not be used automatically
This commit is contained in:
1 parent
69f7919c3c
commit
8285e84071
7 files changed
+32
-47
No files matched your search
@@ -30,19 +30,7 @@ Result CpuPtmBoost(perf_conf_entry* entry) {
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result MemPtmMax(perf_conf_entry* entry) {
|
||||
if (!C.marikoEmcMaxClock)
|
||||
R_SUCCEED();
|
||||
|
||||
u32 memPtmMax = C.marikoEmcMaxClock * 1000;
|
||||
|
||||
PatchOffset(&(entry->emc_freq_1), memPtmMax);
|
||||
PatchOffset(&(entry->emc_freq_2), memPtmMax);
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result MemPtmAlt(perf_conf_entry* entry) {
|
||||
Result MemPtm(perf_conf_entry* entry) {
|
||||
PatchOffset(&(entry->emc_freq_1), memPtmLimit);
|
||||
PatchOffset(&(entry->emc_freq_2), memPtmLimit);
|
||||
|
||||
@@ -89,8 +77,7 @@ void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
|
||||
PatcherEntry<perf_conf_entry> patches[] = {
|
||||
{ "CPU Ptm Boost", &CpuPtmBoost, 2, },
|
||||
{ "MEM Ptm Max", &MemPtmMax, 9, },
|
||||
{ "MEM Ptm Alt", &MemPtmAlt, 7, },
|
||||
{ "MEM Ptm", &MemPtm, 16, },
|
||||
};
|
||||
|
||||
for (u32 i = 0; i < entryCnt; i++) {
|
||||
@@ -115,11 +102,9 @@ void Patch(uintptr_t mapped_nso, size_t nso_size) {
|
||||
|
||||
switch (entry->emc_freq_1) {
|
||||
case memPtmLimit:
|
||||
patches[1].Apply(entry);
|
||||
break;
|
||||
case memPtmAlt:
|
||||
case memPtmClamp:
|
||||
patches[2].Apply(entry);
|
||||
patches[1].Apply(entry);
|
||||
break;
|
||||
default:
|
||||
LOGGING("%u (0x%08x) @%p", entry->emc_freq_1, entry->conf_id, &(entry->emc_freq_2));
|
||||
|
||||
@@ -11,22 +11,22 @@
|
||||
#include <sysclk/apm.h>
|
||||
|
||||
SysClkApmConfiguration sysclk_g_apm_configurations[] = {
|
||||
{0x00010000, 1020000000, 384000000, 1862400000},
|
||||
{0x00010001, 1020000000, 768000000, 1862400000},
|
||||
{0x00010002, 1224000000, 691200000, 1862400000},
|
||||
{0x00020000, 1020000000, 230400000, 1862400000},
|
||||
{0x00020001, 1020000000, 307200000, 1862400000},
|
||||
{0x00020002, 1224000000, 230400000, 1862400000},
|
||||
{0x00020003, 1020000000, 307200000, 1600000000},
|
||||
{0x00020004, 1020000000, 384000000, 1600000000},
|
||||
{0x00020005, 1020000000, 307200000, 1600000000},
|
||||
{0x00020006, 1020000000, 384000000, 1600000000},
|
||||
{0x92220007, 1020000000, 460800000, 1862400000},
|
||||
{0x92220008, 1020000000, 460800000, 1600000000},
|
||||
{0x92220009, 1785000000, 76800000, 1862400000},
|
||||
{0x9222000A, 1785000000, 76800000, 1600000000},
|
||||
{0x9222000B, 1020000000, 76800000, 1862400000},
|
||||
{0x9222000C, 1020000000, 76800000, 1600000000},
|
||||
{0x00010000, 1020000000, 384000000, 1600000000},
|
||||
{0x00010001, 1020000000, 768000000, 1600000000},
|
||||
{0x00010002, 1224000000, 691200000, 1600000000},
|
||||
{0x00020000, 1020000000, 230400000, 1600000000},
|
||||
{0x00020001, 1020000000, 307200000, 1600000000},
|
||||
{0x00020002, 1224000000, 230400000, 1600000000},
|
||||
{0x00020003, 1020000000, 307000000, 1331200000},
|
||||
{0x00020004, 1020000000, 384000000, 1331200000},
|
||||
{0x00020005, 1020000000, 307200000, 1065600000},
|
||||
{0x00020006, 1020000000, 384000000, 1065600000},
|
||||
{0x92220007, 1020000000, 460800000, 1600000000},
|
||||
{0x92220008, 1020000000, 460800000, 1331200000},
|
||||
{0x92220009, 1785000000, 76800000, 1600000000},
|
||||
{0x9222000A, 1785000000, 76800000, 1331200000},
|
||||
{0x9222000B, 1020000000, 76800000, 1600000000},
|
||||
{0x9222000C, 1020000000, 76800000, 1331200000},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
@@ -113,9 +113,7 @@ uint32_t ClockManager::GetHz(SysClkModule module)
|
||||
768'000'000 : 460'800'000;
|
||||
break;
|
||||
case SysClkModule_MEM:
|
||||
hz = (mode == ReverseNX_Docked ||
|
||||
this->oc->realProfile == SysClkProfile_Docked) ?
|
||||
Clocks::maxMemFreq : 1600'000'000;
|
||||
hz = MEM_CLOCK_DOCK;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -251,7 +251,7 @@ uint32_t Clocks::GetStockClock(SysClkApmConfiguration* apm, SysClkModule module)
|
||||
case SysClkModule_GPU:
|
||||
return apm->gpu_hz;
|
||||
case SysClkModule_MEM:
|
||||
return apm->mem_hz;
|
||||
return GetIsMariko() ? MEM_CLOCK_MARIKO_MIN : apm->mem_hz;
|
||||
default:
|
||||
ERROR_THROW("Unknown SysClkModule: %x", module);
|
||||
return 0;
|
||||
@@ -270,15 +270,15 @@ void Clocks::ResetToStock(unsigned int module)
|
||||
|
||||
if (module == SysClkModule_EnumMax || module == SysClkModule_CPU)
|
||||
{
|
||||
Clocks::SetHz(SysClkModule_CPU, apmConfiguration->cpu_hz);
|
||||
Clocks::SetHz(SysClkModule_CPU, GetStockClock(apmConfiguration, SysClkModule_CPU));
|
||||
}
|
||||
if (module == SysClkModule_EnumMax || module == SysClkModule_GPU)
|
||||
{
|
||||
Clocks::SetHz(SysClkModule_GPU, apmConfiguration->gpu_hz);
|
||||
Clocks::SetHz(SysClkModule_GPU, GetStockClock(apmConfiguration, SysClkModule_GPU));
|
||||
}
|
||||
if (module == SysClkModule_EnumMax || module == SysClkModule_MEM)
|
||||
{
|
||||
Clocks::SetHz(SysClkModule_MEM, apmConfiguration->mem_hz);
|
||||
Clocks::SetHz(SysClkModule_MEM, GetStockClock(apmConfiguration, SysClkModule_MEM));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -13,8 +13,10 @@
|
||||
#include <switch.h>
|
||||
#include <sysclk.h>
|
||||
|
||||
#define MAX_MEM_CLOCK 1862'400'000
|
||||
#define BOOST_THRESHOLD 95'0
|
||||
#define MAX_MEM_CLOCK 1862'400'000
|
||||
#define MEM_CLOCK_MARIKO_MIN 1600'000'000
|
||||
#define MEM_CLOCK_DOCK 1600'000'000
|
||||
#define BOOST_THRESHOLD 95'0
|
||||
|
||||
class Clocks
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
var __awaiter=this&&this.__awaiter||function(e,t,i,l){return new(i||(i=Promise))((function(a,n){function r(e){try{o(l.next(e))}catch(e){n(e)}}function s(e){try{o(l.throw(e))}catch(e){n(e)}}function o(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}o((l=l.apply(e,t||[])).next())}))};const CUST_REV=3;var buffer,CustPlatform;!function(e){e[e.Undefined=0]="Undefined",e[e.Erista=1]="Erista",e[e.Mariko=2]="Mariko",e[e.All=3]="All"}(CustPlatform||(CustPlatform={}));class CustEntry{constructor(e,t,i,l,a,n,r=[0,1e6],s=1,o=!0){this.id=e,this.name=t,this.platform=i,this.size=l,this.desc=a,this.defval=n,this.min=r[0],this.max=r[1],this.step=s,this.zeroable=o}validate(){let e=new ErrorToolTip(this.id);return e.clear(),Number.isNaN(this.value)||void 0===this.value?(e.setMsg("Invalid value: Not a number"),e.show(),!1):!(!this.zeroable||0!=this.value)||(this.value<this.min||this.value>this.max?(e.setMsg(`Expected range: [${this.min}, ${this.max}], got ${this.value}.`),e.show(),!1):this.value%this.step==0||(e.setMsg(`${this.value} % ${this.step} ≠ 0`),e.show(),!1))}getInputElement(){return document.getElementById(this.id)}updateValueFromElement(){this.value=Number(this.getInputElement().value)}isAvailableFor(e){return e===CustPlatform.Undefined||this.platform===e||this.platform===CustPlatform.All}createElement(){let e=this.getInputElement();if(!e){let t=document.createElement("div");t.classList.add("grid","cust-element"),e=document.createElement("input"),e.min=String(this.zeroable?0:this.min),e.max=String(this.max),e.id=this.id,e.type="number",e.step=String(this.step);let i=document.createElement("label");i.setAttribute("for",this.id),i.innerHTML=this.name,i.appendChild(e),t.appendChild(i);let l=document.createElement("blockquote");l.innerHTML=this.desc,l.setAttribute("for",this.id),t.appendChild(l),document.getElementById("form").appendChild(t),new ErrorToolTip(this.id).addChangeListener()}e.value=String(this.value)}setElementDefaultValue(){document.getElementById(this.id).value=String(this.defval)}removeElement(){let e=this.getInputElement();e&&e.parentElement.parentElement.remove()}showElement(){let e=this.getInputElement();e&&e.parentElement.parentElement.style.removeProperty("display")}hideElement(){let e=this.getInputElement();e&&e.parentElement.parentElement.style.setProperty("display","none")}}var CustTable=[new CustEntry("mtcConf","DRAM Timing",CustPlatform.Mariko,2,"<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li> <li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li> <li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.",0,[0,2],1),new CustEntry("marikoCpuMaxClock","Mariko CPU Max Clock in kHz",CustPlatform.Mariko,4,"<li>System default: 1785000</li> <li>2397000 might be unreachable for some SoCs.</li>",2397e3,[1785e3,3e6],1),new CustEntry("marikoCpuBoostClock","Mariko CPU Boost Clock in kHz",CustPlatform.Mariko,4,"<li>System default: 1785000</li> <li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li> <li>This will be set regardless of whether sys-clk is enabled.</li>",1785e3,[102e4,3e6],1,!1),new CustEntry("marikoCpuMaxVolt","Mariko CPU Max Voltage in mV",CustPlatform.Mariko,4,"<li>System default: 1120</li> <li>Acceptable range: 1100 ≤ x ≤ 1300</li>",1235,[1100,1300],5),new CustEntry("marikoGpuMaxClock","Mariko GPU Max Clock in kHz",CustPlatform.Mariko,4,"<li>System default: 921600</li> <li>Tegra X1+ official maximum: 1267200</li> <li>1305600 might be unreachable for some SoCs.</li>",1305600,[768e3,1536e3],100),new CustEntry("marikoEmcMaxClock","Mariko RAM Max Clock in kHz",CustPlatform.Mariko,4,"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li> <li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",1996800,[16e5,24e5],3200),new CustEntry("marikoEmcVddqVolt","EMC Vddq (Mariko Only) Voltage in uV",CustPlatform.Mariko,4,"<li>Acceptable range: 550000 ≤ x ≤ 650000</li> <li>Value should be divided evenly by 5000</li> <li>Default: 600000</li> <li>Not enabled by default.</li> <li>This will not work without sys-clk-OC.</li>",0,[55e4,65e4],5e3),new CustEntry("eristaCpuMaxVolt","Erista CPU Max Voltage in mV",CustPlatform.Erista,4,"<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",1235,[1100,1300],1),new CustEntry("eristaEmcMaxClock","Erista RAM Max Clock in kHz",CustPlatform.Erista,4,"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li> <li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",1862400,[16e5,24e5],3200),new CustEntry("commonEmcMemVolt","EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV",CustPlatform.AlLine truncated
|
||||
var __awaiter=this&&this.__awaiter||function(e,t,i,l){return new(i||(i=Promise))((function(a,n){function r(e){try{o(l.next(e))}catch(e){n(e)}}function s(e){try{o(l.throw(e))}catch(e){n(e)}}function o(e){var t;e.done?a(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,s)}o((l=l.apply(e,t||[])).next())}))};const CUST_REV=3;var buffer,CustPlatform;!function(e){e[e.Undefined=0]="Undefined",e[e.Erista=1]="Erista",e[e.Mariko=2]="Mariko",e[e.All=3]="All"}(CustPlatform||(CustPlatform={}));class CustEntry{constructor(e,t,i,l,a,n,r=[0,1e6],s=1,o=!0){this.id=e,this.name=t,this.platform=i,this.size=l,this.desc=a,this.defval=n,this.min=r[0],this.max=r[1],this.step=s,this.zeroable=o}validate(){let e=new ErrorToolTip(this.id);return e.clear(),Number.isNaN(this.value)||void 0===this.value?(e.setMsg("Invalid value: Not a number"),e.show(),!1):!(!this.zeroable||0!=this.value)||(this.value<this.min||this.value>this.max?(e.setMsg(`Expected range: [${this.min}, ${this.max}], got ${this.value}.`),e.show(),!1):this.value%this.step==0||(e.setMsg(`${this.value} % ${this.step} ≠ 0`),e.show(),!1))}getInputElement(){return document.getElementById(this.id)}updateValueFromElement(){this.value=Number(this.getInputElement().value)}isAvailableFor(e){return e===CustPlatform.Undefined||this.platform===e||this.platform===CustPlatform.All}createElement(){let e=this.getInputElement();if(!e){let t=document.createElement("div");t.classList.add("grid","cust-element"),e=document.createElement("input"),e.min=String(this.zeroable?0:this.min),e.max=String(this.max),e.id=this.id,e.type="number",e.step=String(this.step);let i=document.createElement("label");i.setAttribute("for",this.id),i.innerHTML=this.name,i.appendChild(e),t.appendChild(i);let l=document.createElement("blockquote");l.innerHTML=this.desc,l.setAttribute("for",this.id),t.appendChild(l),document.getElementById("form").appendChild(t),new ErrorToolTip(this.id).addChangeListener()}e.value=String(this.value)}setElementDefaultValue(){document.getElementById(this.id).value=String(this.defval)}removeElement(){let e=this.getInputElement();e&&e.parentElement.parentElement.remove()}showElement(){let e=this.getInputElement();e&&e.parentElement.parentElement.style.removeProperty("display")}hideElement(){let e=this.getInputElement();e&&e.parentElement.parentElement.style.setProperty("display","none")}}var CustTable=[new CustEntry("mtcConf","DRAM Timing",CustPlatform.Mariko,2,"<li><b>0</b>: AUTO_ADJ_MARIKO_SAFE: Auto adjust timings for LPDDR4 ≤3733 Mbps specs, 8Gb density. (Default)</li> <li><b>1</b>: AUTO_ADJ_MARIKO_4266: Auto adjust timings for LPDDR4X 4266 Mbps specs, 8Gb density.</li> <li><b>2</b>: NO_ADJ_ALL: No timing adjustment for both Erista and Mariko. Might achieve better performance on Mariko but lower maximum frequency is expected.",0,[0,2],1),new CustEntry("marikoCpuMaxClock","Mariko CPU Max Clock in kHz",CustPlatform.Mariko,4,"<li>System default: 1785000</li> <li>2397000 might be unreachable for some SoCs.</li>",2397e3,[1785e3,3e6],1),new CustEntry("marikoCpuBoostClock","Mariko CPU Boost Clock in kHz",CustPlatform.Mariko,4,"<li>System default: 1785000</li> <li>Boost clock will be applied when applications request higher CPU frequency for quicker loading.</li> <li>This will be set regardless of whether sys-clk is enabled.</li>",1785e3,[102e4,3e6],1,!1),new CustEntry("marikoCpuMaxVolt","Mariko CPU Max Voltage in mV",CustPlatform.Mariko,4,"<li>System default: 1120</li> <li>Acceptable range: 1100 ≤ x ≤ 1300</li>",1235,[1100,1300],5),new CustEntry("marikoGpuMaxClock","Mariko GPU Max Clock in kHz",CustPlatform.Mariko,4,"<li>System default: 921600</li> <li>Tegra X1+ official maximum: 1267200</li> <li>1305600 might be unreachable for some SoCs.</li>",1305600,[768e3,1536e3],100),new CustEntry("marikoEmcMaxClock","Mariko RAM Max Clock in kHz",CustPlatform.Mariko,4,"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li> <li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",1996800,[16e5,24e5],3200),new CustEntry("marikoEmcVddqVolt","EMC Vddq (Mariko Only) Voltage in uV",CustPlatform.Mariko,4,"<li>Acceptable range: 550000 ≤ x ≤ 650000</li> <li>Value should be divided evenly by 5000</li> <li>Default: 600000</li> <li>Not enabled by default.</li> <li>This will not work without sys-clk-OC.</li>",0,[55e4,65e4],5e3),new CustEntry("eristaCpuMaxVolt","Erista CPU Max Voltage in mV",CustPlatform.Erista,4,"<li>Acceptable range: 1100 ≤ x ≤ 1300</li>",1235,[1100,1300],1),new CustEntry("eristaEmcMaxClock","Erista RAM Max Clock in kHz",CustPlatform.Erista,4,"<li>Values should be ≥ 1600000, and divided evenly by 3200.</li> <li><b>WARNING:</b> RAM overclock could be UNSTABLE if timing parameters are not suitable for your DRAM</li>",1862400,[16e5,24e5],3200),new CustEntry("commonEmcMemVolt","EMC Vddq (Erista Only) & RAM Vdd2 Voltage in uV",CustPlatform.AlLine truncated
|
||||
+3
-3
@@ -392,9 +392,9 @@ function UpdateHTMLForm() {
|
||||
last_btn.removeAttribute("disabled");
|
||||
last_btn.addEventListener('click', () => {
|
||||
// Load last saved from localStorage
|
||||
JSON.parse(localStorage.getItem("last_saved")!)
|
||||
.filter((key: string) => key != "custRev")
|
||||
.forEach((key: string) => (document.getElementById(key) as HTMLInputElement).value = key);
|
||||
let dict = JSON.parse(localStorage.getItem("last_saved")!);
|
||||
delete dict["custRev"];
|
||||
dict.forEach((key: string) => (document.getElementById(key) as HTMLInputElement).value = key);
|
||||
});
|
||||
} else {
|
||||
last_btn.style.setProperty("display", "none");
|
||||
|
||||
Reference in new issue
Block a user