hocclk: better HW info reading
This commit is contained in:
@@ -42,10 +42,8 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
HocClkConsoleType_Icosa = 0, // V1
|
||||
HocClkConsoleType_Copper, // Unreleased Erista
|
||||
HocClkConsoleType_Hoag, // Lite
|
||||
HocClkConsoleType_Iowa, // V2
|
||||
HocClkConsoleType_Calcio, // Unreleased Mariko
|
||||
HocClkConsoleType_Hoag, // Lite
|
||||
HocClkConsoleType_Aula, // OLED
|
||||
HocClkConsoleType_EnumMax,
|
||||
} HocClkConsoleType;
|
||||
@@ -347,6 +345,23 @@ static inline const char* hocClkFormatVoltage(HocClkVoltage voltage, bool pretty
|
||||
}
|
||||
}
|
||||
|
||||
static inline const char* hocClkFormatConsoleType(HocClkConsoleType consoleType, bool pretty)
|
||||
{
|
||||
switch(consoleType)
|
||||
{
|
||||
case HocClkConsoleType_Icosa:
|
||||
return pretty ? "Icosa (V1)" : "icosa";
|
||||
case HocClkConsoleType_Iowa:
|
||||
return pretty ? "Iowa (V2)" : "iowa";
|
||||
case HocClkConsoleType_Hoag:
|
||||
return pretty ? "Hoag (Lite)" : "hoag";
|
||||
case HocClkConsoleType_Aula:
|
||||
return pretty ? "Aula (OLED)" : "aula";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
// static inline const char* hocClkFormatPanel(HocClkDisplayPanel panel, bool pretty)
|
||||
// {
|
||||
// switch(panel)
|
||||
|
||||
@@ -74,6 +74,7 @@ typedef struct {
|
||||
u8 maxDisplayFreq;
|
||||
u8 dramID;
|
||||
bool isDram8GB;
|
||||
HocClkConsoleType consoleType;
|
||||
|
||||
// FPS / Resolution
|
||||
u8 fps;
|
||||
@@ -82,7 +83,7 @@ typedef struct {
|
||||
u16 kipVersion;
|
||||
|
||||
// Reserved for future use
|
||||
u8 reserved[0x363];
|
||||
u8 reserved[0x35B];
|
||||
} HocClkContext;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -40,6 +40,7 @@ tsl::elm::ListItem* ramBWItemGpu = NULL;
|
||||
tsl::elm::ListItem* ramBWItemMax = NULL;
|
||||
tsl::elm::ListItem* bqtempitem = NULL;
|
||||
tsl::elm::ListItem* aotagTempItem = NULL;
|
||||
tsl::elm::ListItem* cTypeItem = NULL;
|
||||
|
||||
ImageElement* CatImage = NULL;
|
||||
HideableCategoryHeader* CatHeader = NULL;
|
||||
@@ -57,8 +58,13 @@ AboutGui::~AboutGui()
|
||||
|
||||
void AboutGui::listUI()
|
||||
{
|
||||
BaseMenuGui::refresh();
|
||||
|
||||
if (!this->context)
|
||||
return;
|
||||
|
||||
this->listElement->addItem(
|
||||
new tsl::elm::CategoryHeader("Voltages and Temps")
|
||||
new tsl::elm::CategoryHeader("Voltages")
|
||||
);
|
||||
|
||||
ramVoltItem =
|
||||
@@ -71,9 +77,12 @@ void AboutGui::listUI()
|
||||
new tsl::elm::ListItem("Display Voltage:");
|
||||
this->listElement->addItem(dispVoltItem);
|
||||
|
||||
this->listElement->addItem(
|
||||
new tsl::elm::CategoryHeader("Temperatures")
|
||||
);
|
||||
eristaPLLXItem =
|
||||
new tsl::elm::ListItem("PLLX Temp:");
|
||||
if(IsErista()) {
|
||||
if(this->context->temps[HocClkThermalSensor_AO] > 0) { // Only show if the value is valid (not -126, which means not patched)
|
||||
this->listElement->addItem(eristaPLLXItem);
|
||||
}
|
||||
|
||||
@@ -107,8 +116,13 @@ void AboutGui::listUI()
|
||||
|
||||
|
||||
this->listElement->addItem(
|
||||
new tsl::elm::CategoryHeader("HW Info")
|
||||
new tsl::elm::CategoryHeader("Hardware Info")
|
||||
);
|
||||
|
||||
cTypeItem =
|
||||
new tsl::elm::ListItem("Console Type:");
|
||||
this->listElement->addItem(cTypeItem);
|
||||
|
||||
SpeedoItem =
|
||||
new tsl::elm::ListItem("Speedo:");
|
||||
this->listElement->addItem(SpeedoItem);
|
||||
@@ -118,7 +132,7 @@ void AboutGui::listUI()
|
||||
this->listElement->addItem(IddqItem);
|
||||
|
||||
DramModule =
|
||||
new tsl::elm::ListItem("Module: ");
|
||||
new tsl::elm::ListItem("DRAM Module: ");
|
||||
this->listElement->addItem(DramModule);
|
||||
|
||||
waferCordsItem =
|
||||
@@ -380,13 +394,11 @@ void AboutGui::refresh()
|
||||
sprintf(strings[2], "X: %u Y: %u", this->context->waferX, this->context->waferY);
|
||||
waferCordsItem->setValue(strings[2]);
|
||||
|
||||
if(IsErista()) {
|
||||
u32 millis = context->temps[HocClkThermalSensor_PLLX];
|
||||
sprintf(strings[3], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||
eristaPLLXItem->setValue(strings[3]);
|
||||
}
|
||||
s32 millis = context->temps[HocClkThermalSensor_PLLX];
|
||||
sprintf(strings[3], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||
eristaPLLXItem->setValue(strings[3]);
|
||||
|
||||
s32 millis = context->temps[HocClkThermalSensor_AO];
|
||||
millis = context->temps[HocClkThermalSensor_AO];
|
||||
if(millis > 0) {
|
||||
sprintf(strings[11], "%u.%u °C", millis / 1000U, (millis % 1000U) / 100U);
|
||||
} else if (millis == -125) {
|
||||
@@ -433,4 +445,6 @@ void AboutGui::refresh()
|
||||
|
||||
bqtempitem->setValue(strings[10]);
|
||||
|
||||
cTypeItem->setValue(hocClkFormatConsoleType(this->context->consoleType, true));
|
||||
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@
|
||||
#include "../file_utils.hpp"
|
||||
namespace board {
|
||||
|
||||
u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr;
|
||||
u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr, fuseVirtAddr;
|
||||
|
||||
HocClkSocType gSocType;
|
||||
u8 gDramID;
|
||||
HocClkConsoleType gConsoleType = HocClkConsoleType_Iowa;
|
||||
HocClkConsoleType gConsoleType = HocClkConsoleType_Icosa;
|
||||
FuseData fuseData;
|
||||
u8 speedoBracket;
|
||||
PwmChannelSession iCon;
|
||||
@@ -57,36 +57,47 @@ namespace board {
|
||||
u32 fd = 0, fd2 = 0;
|
||||
|
||||
#define PMC_BASE 0x7000E400
|
||||
|
||||
#define APB_MISC_GP_HIDREV 0x804
|
||||
#define GP_HIDREV_MAJOR_T210 0x1
|
||||
#define GP_HIDREV_MAJOR_T210B01 0x2
|
||||
#define APB_BASE 0x70000000
|
||||
#define FUSE_RESERVED_ODMX(x) (0x1C8 + 4 * (x))
|
||||
#define FUSE_CACHE_OFFSET 0x800
|
||||
void FetchHardwareInfos() {
|
||||
ReadFuses(fuseData);
|
||||
SetGpuBracket(fuseData.gpuSpeedo, speedoBracket);
|
||||
|
||||
u64 sku = 0, dramID = 0;
|
||||
Result rc = splInitialize();
|
||||
ASSERT_RESULT_OK(rc, "splInitialize");
|
||||
|
||||
rc = splGetConfig(SplConfigItem_HardwareType, &sku);
|
||||
ASSERT_RESULT_OK(rc, "splGetConfig");
|
||||
|
||||
rc = splGetConfig(SplConfigItem_DramId, &dramID);
|
||||
ASSERT_RESULT_OK(rc, "splGetConfig");
|
||||
gDramID = dramID;
|
||||
splExit();
|
||||
|
||||
switch(sku) {
|
||||
case 2 ... 5:
|
||||
gSocType = HocClkSocType_Mariko;
|
||||
break;
|
||||
default:
|
||||
gSocType = HocClkSocType_Erista;
|
||||
u32 hidrev = *(u32*)(apbVirtAddr + APB_MISC_GP_HIDREV);
|
||||
if (((hidrev >> 4) & 0xF) >= GP_HIDREV_MAJOR_T210B01) {
|
||||
gSocType = HocClkSocType_Mariko;
|
||||
CacheGpuVoltTable();
|
||||
} else {
|
||||
gSocType = HocClkSocType_Erista;
|
||||
}
|
||||
|
||||
u32 odm4 = *(u32*)(fuseVirtAddr + FUSE_CACHE_OFFSET + FUSE_RESERVED_ODMX(4));
|
||||
|
||||
if (gSocType == HocClkSocType_Mariko) {
|
||||
CacheGpuVoltTable();
|
||||
switch ((odm4 & 0xF0000) >> 16) {
|
||||
case 2:
|
||||
gConsoleType = HocClkConsoleType_Hoag;
|
||||
break;
|
||||
case 4:
|
||||
gConsoleType = HocClkConsoleType_Aula;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
gConsoleType = HocClkConsoleType_Iowa;
|
||||
}
|
||||
} else {
|
||||
gConsoleType = HocClkConsoleType_Icosa;
|
||||
}
|
||||
|
||||
gConsoleType = static_cast<HocClkConsoleType>(sku);
|
||||
gDramID = (odm4 & 0xF8) >> 3;
|
||||
// Get extended dram id info.
|
||||
if (gSocType == HocClkSocType_Mariko) {
|
||||
gDramID |= (odm4 & 0x7000) >> 7;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: Check for config */
|
||||
@@ -118,6 +129,26 @@ namespace board {
|
||||
rc = tmp451Initialize();
|
||||
ASSERT_RESULT_OK(rc, "tmp451Initialize");
|
||||
|
||||
rc = rgltrInitialize();
|
||||
ASSERT_RESULT_OK(rc, "rgltrInitialize");
|
||||
|
||||
rc = pmdmntInitialize();
|
||||
ASSERT_RESULT_OK(rc, "pmdmntInitialize");
|
||||
|
||||
rc = QueryMemoryMapping(&clkVirtAddr, 0x60006000, 0x1000);
|
||||
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (clk)");
|
||||
|
||||
rc = QueryMemoryMapping(&dsiVirtAddr, 0x54300000, 0x40000);
|
||||
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (dsi)");
|
||||
|
||||
rc = QueryMemoryMapping(&apbVirtAddr, 0x70000000, 0x1000);
|
||||
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (apb)");
|
||||
|
||||
rc = QueryMemoryMapping(&fuseVirtAddr, 0x7000F000, 0x1000);
|
||||
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (fuse)");
|
||||
|
||||
FetchHardwareInfos();
|
||||
|
||||
Result nvCheck = 1;
|
||||
if (R_SUCCEEDED(nvInitialize())) {
|
||||
nvCheck = nvOpen(&fd, "/dev/nvhost-ctrl-gpu");
|
||||
@@ -130,18 +161,12 @@ namespace board {
|
||||
}
|
||||
}
|
||||
|
||||
rc = rgltrInitialize();
|
||||
ASSERT_RESULT_OK(rc, "rgltrInitialize");
|
||||
|
||||
rc = pmdmntInitialize();
|
||||
ASSERT_RESULT_OK(rc, "pmdmntInitialize");
|
||||
|
||||
StartLoad(nvCheck, fd);
|
||||
|
||||
batteryInfoInitialize();
|
||||
FetchHardwareInfos();
|
||||
|
||||
tsensor::InitializeSoctherm(); // SOCTHERM must be init before AOTAG
|
||||
|
||||
// PMC exosphere check
|
||||
SecmonArgs args = {};
|
||||
args.X[0] = 0xF0000002;
|
||||
@@ -159,15 +184,6 @@ namespace board {
|
||||
|
||||
StartMiscThread(pwmCheck, &iCon);
|
||||
|
||||
rc = QueryMemoryMapping(&clkVirtAddr, 0x60006000, 0x1000);
|
||||
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (clk)");
|
||||
|
||||
rc = QueryMemoryMapping(&dsiVirtAddr, 0x54300000, 0x40000);
|
||||
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (dsi)");
|
||||
|
||||
rc = QueryMemoryMapping(&apbVirtAddr, 0x70000000, 0x1000);
|
||||
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (apb)");
|
||||
|
||||
display::DisplayRefreshConfig cfg = {.clkVirtAddr = clkVirtAddr, .dsiVirtAddr = dsiVirtAddr, .isLite = (GetConsoleType() == HocClkConsoleType_Hoag), .isRetroSUPER = integrations::GetRETROSuperStatus()};
|
||||
display::Initialize(&cfg);
|
||||
|
||||
|
||||
@@ -40,7 +40,13 @@
|
||||
#define HOSSVC_HAS_TC (hosversionAtLeast(5,0,0))
|
||||
|
||||
namespace board {
|
||||
extern u64 clkVirtAddr, dsiVirtAddr;
|
||||
extern u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr, fuseVirtAddr;
|
||||
extern HocClkSocType gSocType;
|
||||
extern u8 gDramID;
|
||||
extern HocClkConsoleType gConsoleType;
|
||||
extern FuseData fuseData;
|
||||
extern u8 speedoBracket;
|
||||
|
||||
void Initialize();
|
||||
void Exit();
|
||||
HocClkSocType GetSocType();
|
||||
|
||||
@@ -623,6 +623,8 @@ namespace clockManager {
|
||||
|
||||
gContext.dramID = board::GetDramID();
|
||||
gContext.isDram8GB = board::IsDram8GB();
|
||||
gContext.consoleType = board::GetConsoleType();
|
||||
|
||||
board::SetGpuSchedulingMode((GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling), (GpuSchedulingOverrideMethod)config::GetConfigValue(HocClkConfigValue_GPUSchedulingMethod));
|
||||
gContext.gpuSchedulingMode = (GpuSchedulingMode)config::GetConfigValue(HocClkConfigValue_GPUScheduling);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user