hocclk: add support for FW <10.0.0

This commit is contained in:
souldbminersmwc
2026-04-06 16:52:18 -04:00
parent 803a838b35
commit dc63dfdca2
6 changed files with 60 additions and 12 deletions

View File

@@ -145,13 +145,13 @@ namespace board {
StartMiscThread(pwmCheck, &iCon);
u64 clkVirtAddr, dsiVirtAddr, outsize;
u64 clkVirtAddr, dsiVirtAddr;
rc = svcQueryMemoryMapping(&clkVirtAddr, &outsize, 0x60006000, 0x1000);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (clk)");
rc = QueryMemoryMapping(&clkVirtAddr, 0x60006000, 0x1000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (clk)");
rc = svcQueryMemoryMapping(&dsiVirtAddr, &outsize, 0x54300000, 0x40000);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (dsi)");
rc = QueryMemoryMapping(&dsiVirtAddr, 0x54300000, 0x40000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (dsi)");
display::DisplayRefreshConfig cfg = {.clkVirtAddr = clkVirtAddr, .dsiVirtAddr = dsiVirtAddr, .isLite = (GetConsoleType() == HocClkConsoleType_Hoag), .isRetroSUPER = integrations::GetRETROSuperStatus()};
display::Initialize(&cfg);

View File

@@ -35,7 +35,7 @@
#include "board_sensor.hpp"
#include "board_volt.hpp"
#include "board_profile.hpp"
#include "../globals.hpp"
#define HOSSVC_HAS_CLKRST (hosversionAtLeast(8,0,0))
#define HOSSVC_HAS_TC (hosversionAtLeast(5,0,0))

View File

@@ -87,9 +87,8 @@ namespace board {
}
void CacheDfllData() {
u64 temp;
Result rc = svcQueryMemoryMapping(&cldvfs, &temp, CLDVFS_REGION_BASE, CLDVFS_REGION_SIZE);
ASSERT_RESULT_OK(rc, "svcQueryMemoryMapping (cldvfs)");
Result rc = QueryMemoryMapping(&cldvfs, CLDVFS_REGION_BASE, CLDVFS_REGION_SIZE);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (cldvfs)");
if (GetSocType() == HocClkSocType_Erista) {
cachedTune.tune0Low = *reinterpret_cast<u32 *>(cldvfs + CL_DVFS_TUNE0_0);

View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "globals.hpp"
Result QueryMemoryMapping(u64* virtaddr, u64 physaddr, u64 size) {
if(hosversionAtLeast(10,0,0))
{
u64 out_size;
return svcQueryMemoryMapping(virtaddr, &out_size, physaddr, size);
}
else
{
return svcLegacyQueryIoMapping(virtaddr, physaddr, size);
}
}

View File

@@ -0,0 +1,20 @@
/*
* Copyright (c) Souldbminer and Horizon OC Contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <switch.h>
Result QueryMemoryMapping(u64* virtaddr, u64 physaddr, u64 size);

View File

@@ -25,7 +25,7 @@
#include "soctherm.hpp"
#include "board/board.hpp"
#include "file_utils.hpp"
#include "globals.hpp"
namespace soctherm {
namespace {
@@ -440,8 +440,7 @@ namespace soctherm {
}
Result MapAddress(u64 &va, const u64 &physAddr, const char *name) {
u64 outSize;
Result mapResult = svcQueryMemoryMapping(&va, &outSize, physAddr, 0x1000);
Result mapResult = QueryMemoryMapping(&va, physAddr, 0x1000);
if (R_FAILED(mapResult)) {
fileUtils::LogLine("[Soctherm] Failed to map %s! %u", name, R_DESCRIPTION(mapResult));
}