loader: add static gpu table for mariko

This commit is contained in:
hanabbi
2023-07-04 11:30:34 +09:00
parent b391861750
commit 0b79b2060e
7 changed files with 58 additions and 3 deletions

View File

@@ -268,6 +268,26 @@ 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<EristaMtcTable *>(&EristaMtcTablePlaceholder),
//.marikoMtcTable = const_cast<MarikoMtcTable *>(&MarikoMtcTablePlaceholder),

View File

@@ -69,6 +69,7 @@ typedef struct CustomizeTable {
CustomizeGpuDvfsTable marikoGpuDvfsTable;
CustomizeGpuDvfsTable marikoGpuDvfsTableSLT;
CustomizeGpuDvfsTable marikoGpuDvfsTableHiOPT;
CustomizeGpuDvfsTable marikoGpuStaticTable;
//EristaMtcTable* eristaMtcTable;
//MarikoMtcTable* marikoMtcTable;
} CustomizeTable;

View File

@@ -105,8 +105,12 @@ void SafetyCheck() {
case 2:
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq);
break;
case 3:
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuStaticTable)->freq);
break;
default:
marikoGpuDvfsMaxFreq = static_cast<u32>(GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq);
break;
}
sValidator validators[] = {

View File

@@ -215,8 +215,29 @@ 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.marikoGpuUV ? (C.marikoGpuUV == 2 ? C.marikoGpuDvfsTableHiOPT : C.marikoGpuDvfsTableSLT) : C.marikoGpuDvfsTable) : C.eristaGpuDvfsTable);
cvb_entry_t* customize_table;
if (isMariko) {
switch (C.marikoGpuUV) {
case 0:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTable);
break;
case 1:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableSLT);
break;
case 2:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTableHiOPT);
break;
case 3:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuStaticTable);
break;
default:
customize_table = const_cast<cvb_entry_t *>(C.marikoGpuDvfsTable);
break;
}
} else {
customize_table = const_cast<cvb_entry_t *>(C.eristaGpuDvfsTable);
}
size_t default_entry_count = GetDvfsTableEntryCount(default_table);
size_t default_table_size = default_entry_count * sizeof(cvb_entry_t);
size_t customize_entry_count = GetDvfsTableEntryCount(customize_table);

View File

@@ -73,7 +73,12 @@ Result GpuFreqMaxAsm(u32* ptr32) {
case 2:
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTableHiOPT)->freq;
break;
default: max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq;
case 3:
max_clock = GetDvfsTableLastEntry(C.marikoGpuStaticTable)->freq;
break;
default:
max_clock = GetDvfsTableLastEntry(C.marikoGpuDvfsTable)->freq;
break;
}
u32 asm_patch[2] = {
asm_set_rd(asm_set_imm16(asm_pattern[0], max_clock), rd),

View File

@@ -315,6 +315,9 @@ 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;

View File

@@ -72,6 +72,7 @@ typedef struct CustTable {
CustomizeGpuDvfsTable marikoGpuDvfsTable;
CustomizeGpuDvfsTable marikoGpuDvfsTableSLT;
CustomizeGpuDvfsTable marikoGpuDvfsTableHiOPT;
CustomizeGpuDvfsTable marikoGpuStaticTable;
//void* eristaMtcTable;
//void* marikoMtcTable;
} CustTable;