From 63f7e86de081771887aa9a8a63255feb411972e3 Mon Sep 17 00:00:00 2001 From: hanabbi Date: Thu, 6 Jul 2023 01:35:41 +0900 Subject: [PATCH] loader: remove static table and patch coefficients instead --- .../loader/source/oc/customize.cpp | 20 ------------------- .../loader/source/oc/customize.hpp | 1 - .../stratosphere/loader/source/oc/pcv/pcv.cpp | 3 --- .../stratosphere/loader/source/oc/pcv/pcv.hpp | 10 ++++++---- .../loader/source/oc/pcv/pcv_mariko.cpp | 3 --- .../sys-clk-OC/sysmodule/src/file_utils.cpp | 3 --- Source/sys-clk-OC/sysmodule/src/file_utils.h | 1 - 7 files changed, 6 insertions(+), 35 deletions(-) diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp index 45c07283..475765b6 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.cpp @@ -270,26 +270,6 @@ volatile CustomizeTable C = { { 1267200, {}, { 1286399, -17475, -867, 0, 3681, 559 } }, }, -.marikoGpuStaticTable = { - { 76800, {}, { 610000, } }, - { 153600, {}, { 610000, } }, - { 230400, {}, { 610000, } }, - { 307200, {}, { 610000, } }, - { 384000, {}, { 610000, } }, - { 460800, {}, { 610000, } }, - { 537600, {}, { 610000, } }, - { 614400, {}, { 610000, } }, - { 691200, {}, { 610000, } }, - { 768000, {}, { 610000, } }, - { 844800, {}, { 610000, } }, - { 921600, {}, { 610000, } }, - { 998400, {}, { 610000, } }, - { 1075200, {}, { 610000, } }, - { 1152000, {}, { 610000, } }, - { 1228800, {}, { 610000, } }, - { 1267200, {}, { 610000, } }, -}, - //.eristaMtcTable = const_cast(&EristaMtcTablePlaceholder), //.marikoMtcTable = const_cast(&MarikoMtcTablePlaceholder), diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp index 1285b74e..85d53bb3 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/customize.hpp @@ -70,7 +70,6 @@ typedef struct CustomizeTable { CustomizeGpuDvfsTable marikoGpuDvfsTable; CustomizeGpuDvfsTable marikoGpuDvfsTableSLT; CustomizeGpuDvfsTable marikoGpuDvfsTableHiOPT; - CustomizeGpuDvfsTable marikoGpuStaticTable; //EristaMtcTable* eristaMtcTable; //MarikoMtcTable* marikoMtcTable; } CustomizeTable; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp index efa490b1..710d7772 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.cpp @@ -105,9 +105,6 @@ void SafetyCheck() { case 2: marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq); break; - case 3: - marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuStaticTable)->freq); - break; default: marikoGpuDvfsMaxFreq = static_cast(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq); break; diff --git a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp index 429aef41..eccc00e2 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv.hpp @@ -227,9 +227,6 @@ Result GpuFreqCvbTable(u32* ptr) { case 2: customize_table = const_cast(C.marikoGpuDvfsTableHiOPT); break; - case 3: - customize_table = const_cast(C.marikoGpuStaticTable); - break; default: customize_table = const_cast(C.marikoGpuDvfsTable); break; @@ -252,10 +249,15 @@ Result GpuFreqCvbTable(u32* ptr) { std::memcpy(gpu_cvb_table_head, (void*)customize_table, customize_table_size); // Patch GPU volt - if (C.marikoGpuUV == 3) { + if (isMariko && C.marikoGpuUV == 3) { cvb_entry_t* entry = static_cast(gpu_cvb_table_head); for (size_t i = 0; i < customize_entry_count; i++) { PATCH_OFFSET(&(entry->cvb_pll_param.c0), C.marikoGpuVoltArray[i] * 1000); + PATCH_OFFSET(&(entry->cvb_pll_param.c1), 0); + PATCH_OFFSET(&(entry->cvb_pll_param.c2), 0); + PATCH_OFFSET(&(entry->cvb_pll_param.c3), 0); + PATCH_OFFSET(&(entry->cvb_pll_param.c4), 0); + PATCH_OFFSET(&(entry->cvb_pll_param.c5), 0); entry++; } } 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 394f5117..add4a2da 100644 --- a/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp +++ b/Source/Atmosphere/stratosphere/loader/source/oc/pcv/pcv_mariko.cpp @@ -73,9 +73,6 @@ Result GpuFreqMaxAsm(u32* ptr32) { case 2: max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq; break; - case 3: - max_clock = GetDvfsTableLastEntry(C.marikoGpuStaticTable)->freq; - break; default: max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq; break; diff --git a/Source/sys-clk-OC/sysmodule/src/file_utils.cpp b/Source/sys-clk-OC/sysmodule/src/file_utils.cpp index 975493c9..9cadebb6 100644 --- a/Source/sys-clk-OC/sysmodule/src/file_utils.cpp +++ b/Source/sys-clk-OC/sysmodule/src/file_utils.cpp @@ -315,9 +315,6 @@ Result FileUtils::CustParser(const char* filepath, size_t filesize) { case 2: gpu_dvfs_table = &table.marikoGpuDvfsTableHiOPT; break; - case 3: - gpu_dvfs_table = &table.marikoGpuStaticTable; - break; default: gpu_dvfs_table = &table.marikoGpuDvfsTable; break; diff --git a/Source/sys-clk-OC/sysmodule/src/file_utils.h b/Source/sys-clk-OC/sysmodule/src/file_utils.h index 27a496f1..001a7571 100644 --- a/Source/sys-clk-OC/sysmodule/src/file_utils.h +++ b/Source/sys-clk-OC/sysmodule/src/file_utils.h @@ -73,7 +73,6 @@ typedef struct CustTable { CustomizeGpuDvfsTable marikoGpuDvfsTable; CustomizeGpuDvfsTable marikoGpuDvfsTableSLT; CustomizeGpuDvfsTable marikoGpuDvfsTableHiOPT; - CustomizeGpuDvfsTable marikoGpuStaticTable; //void* eristaMtcTable; //void* marikoMtcTable; } CustTable;