feat: mariko gpu undervolt implementation

This commit is contained in:
hanabbi
2023-05-05 21:17:24 +09:00
parent b44b47fb42
commit df5448136b
5 changed files with 51 additions and 6 deletions

View File

@@ -87,6 +87,8 @@ volatile CustomizeTable C = {
*/
.marikoEmcVddqVolt = 0,
.marikoGpuUV = 0,
/* Advanced Settings:
* - Erista CPU DVFS Table:
*/
@@ -185,6 +187,45 @@ volatile CustomizeTable C = {
//{ 1305600, {}, { 1374130, -13725, -859, 0, 4442, 576 } },
},
/* .marikoGpuDvfsTableUV = {
{ 76800, {}, { 590000, } },
{ 153600, {}, { 590000, } },
{ 230400, {}, { 590000, } },
{ 307200, {}, { 590000, } },
{ 384000, {}, { 590000, } },
{ 460800, {}, { 590000, } },
{ 537600, {}, { 590000, } },
{ 614400, {}, { 590000, } },
{ 691200, {}, { 838712, -7304, -552, 1785, -56250, -450 } },
{ 768000, {}, { 880210, -7955, -584, 0, -42735, 8775 } },
{ 844800, {}, { 926398, -8892, -602, -900, -5760, -20925 } },
{ 921600, {}, { 970060, -10108, -614, -2685, 22620, -2925 } },
{ 998400, {}, { 1065665, -16075, -497, -2685, 48195, 2025 } },
{ 1075200, {}, { 1132576, -16093, -648, 0, 16155, 9000 } },
{ 1152000, {}, { 1180029, -14534, -830, 0, 22035, 24750 } },
{ 1228800, {}, { 1248293, -16383, -859, 0, 55830, 70425 } },
}, */
.marikoGpuDvfsTableUV = {
{ 76800, {}, { 590000, 0, 0, 0, 0, 0 } },
{ 153600, {}, { 590000, 0, 0, 0, 0, 0 } },
{ 230400, {}, { 590000, 0, 0, 0, 0, 0 } },
{ 307200, {}, { 590000, 0, 0, 0, 0, 0 } },
{ 384000, {}, { 590000, 0, 0, 0, 0, 0 } },
{ 460800, {}, { 795089, -11096, -163, 298, -10421, 162 } },
{ 537600, {}, { 795089, -11096, -163, 298, -10421, 162 } },
{ 614400, {}, { 820606, -6285, -452, 238, -6182, 81 } },
{ 691200, {}, { 846289, -4565, -552, 119, -3958, -2 } },
{ 768000, {}, { 888720, -5110, -584, 0, -2849, 39 } },
{ 844800, {}, { 936634, -6089, -602, -60, -99, -93 } },
{ 921600, {}, { 982562, -7373, -614, -179, 1797, -13 } },
{ 998400, {}, { 1090179, -14125, -497, -179, 3518, 9 } },
{ 1075200, {}, { 1155798, -13465, -648, 0, 1077, 40 } },
{ 1152000, {}, { 1198568, -10904, -830, 0, 1469, 110 } },
{ 1228800, {}, { 1269988, -12707, -859, 0, 3722, 313 } },
{ 1267200, {}, { 1308155, -13694, -867, 0, 3681, 559 } },
},
.eristaMtcTable = const_cast<EristaMtcTable *>(&EristaMtcTablePlaceholder),
.marikoMtcTable = const_cast<MarikoMtcTable *>(&MarikoMtcTablePlaceholder),

View File

@@ -51,15 +51,17 @@ typedef struct CustomizeTable {
u32 marikoCpuMaxVolt;
u32 marikoEmcMaxClock;
u32 marikoEmcVddqVolt;
u32 marikoGpuUV;
CustomizeCpuDvfsTable eristaCpuDvfsTable;
CustomizeCpuDvfsTable marikoCpuDvfsTable;
CustomizeGpuDvfsTable eristaGpuDvfsTable;
CustomizeGpuDvfsTable marikoGpuDvfsTable;
CustomizeGpuDvfsTable marikoGpuDvfsTableUV;
EristaMtcTable* eristaMtcTable;
MarikoMtcTable* marikoMtcTable;
} CustomizeTable;
static_assert(sizeof(CustomizeTable) == sizeof(u8) * 4 + sizeof(u32) * 9 + sizeof(CustomizeCpuDvfsTable) * 4 + sizeof(void*) * 2);
static_assert(sizeof(CustomizeTable) == 7000);
//static_assert(sizeof(CustomizeTable) == sizeof(u8) * 4 + sizeof(u32) * 10 + sizeof(CustomizeCpuDvfsTable) * 5 + sizeof(void*) * 2);
//static_assert(sizeof(CustomizeTable) == 7000);
extern volatile CustomizeTable C;

View File

@@ -210,7 +210,7 @@ Result CpuFreqCvbTable(u32* ptr) {
template<bool isMariko>
Result GpuFreqCvbTable(u32* ptr) {
cvb_entry_t* default_table = isMariko ? (cvb_entry_t *)(&mariko::GpuCvbTableDefault) : (cvb_entry_t *)(&erista::GpuCvbTableDefault);
cvb_entry_t* customize_table = const_cast<cvb_entry_t *>(isMariko ? C.marikoGpuDvfsTable : C.eristaGpuDvfsTable);
cvb_entry_t* customize_table = const_cast<cvb_entry_t *>(isMariko ? (C.marikoGpuUV ? C.marikoGpuDvfsTableUV : C.marikoGpuDvfsTable) : C.eristaGpuDvfsTable);
size_t default_entry_count = GetDvfsTableEntryCount(default_table);
size_t default_table_size = default_entry_count * sizeof(cvb_entry_t);

View File

@@ -305,7 +305,7 @@ Result FileUtils::CustParser(const char* filepath, size_t filesize) {
}
cpu_dvfs_table = &table.marikoCpuDvfsTable;
gpu_dvfs_table = &table.marikoGpuDvfsTable;
gpu_dvfs_table = !table.marikoGpuUV ? &table.marikoGpuDvfsTable : &table.marikoGpuDvfsTableUV;
} else {
if (table.eristaEmcMaxClock)
Clocks::maxMemFreq = table.eristaEmcMaxClock * 1000;

View File

@@ -56,15 +56,17 @@ typedef struct CustTable {
u32 marikoCpuMaxVolt;
u32 marikoEmcMaxClock;
u32 marikoEmcVddqVolt;
u32 marikoGpuUV;
CustomizeCpuDvfsTable eristaCpuDvfsTable;
CustomizeCpuDvfsTable marikoCpuDvfsTable;
CustomizeGpuDvfsTable eristaGpuDvfsTable;
CustomizeGpuDvfsTable marikoGpuDvfsTable;
CustomizeGpuDvfsTable marikoGpuDvfsTableUV;
void* eristaMtcTable;
void* marikoMtcTable;
} CustTable;
static_assert(sizeof(CustTable) == sizeof(u8) * 4 + sizeof(u32) * 9 + sizeof(CustomizeCpuDvfsTable) * 4 + sizeof(void*) * 2);
static_assert(sizeof(CustTable) == 7000);
//static_assert(sizeof(CustTable) == sizeof(u8) * 4 + sizeof(u32) * 9 + sizeof(CustomizeCpuDvfsTable) * 4 + sizeof(void*) * 2);
//static_assert(sizeof(CustTable) == 7000);
class FileUtils
{