BPMP ABORT!

This commit is contained in:
souldbminersmwc authored and Lightos1 committed 2026-09-23 23:25:51 +02:00
1 parent 9428309ac3
commit ab60e55303
87 files changed
+553 -3213

No files matched your search

+1 -49
View File
@@ -34,7 +34,6 @@
#include <switch.h>
#include <tmp451.h>
#include "../bpmp/bpmp.hpp"
#include "../display/display_refresh_rate.hpp"
#include "../file/file_utils.hpp"
#include "../hos/apm_ext.h"
@@ -53,13 +52,7 @@
#include "../soc/dram_mrr.hpp"
namespace board {
u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr, fuseVirtAddr, sysVirtAddr, actmonVirtAddr, gpuVirtAddr, tmrVirtAddr;
consteval inline u32 PackCode(u32 r, u32 g, u32 b) {
return ((r & 0xF) << 8) | ((g & 0xF) << 4) | ((b & 0xF) << 0);
}
const u32 GpuPanic = PackCode(0xF, 0x7, 0x0);
const u32 CpuPanic = PackCode(0xF, 0x0, 0x0);
const u32 RamPanic = PackCode(0x0, 0xF, 0xF);
u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr, fuseVirtAddr;
HocClkSocType gSocType;
u8 gDramID;
@@ -160,16 +153,6 @@ namespace board {
rc = QueryMemoryMapping(&fuseVirtAddr, 0x7000F000, 0x1000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (fuse)");
rc = QueryMemoryMapping(&sysVirtAddr, 0x6000C000, 0x1000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (sys)");
actmonVirtAddr = sysVirtAddr + 0x800;
rc = QueryMemoryMapping(&gpuVirtAddr, 0x57000000, 0x1000000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (gpu)");
rc = QueryMemoryMapping(&tmrVirtAddr, 0x60005000, 0x1000);
ASSERT_RESULT_OK(rc, "QueryMemoryMapping (tmr)");
FetchHardwareInfos();
Result nvCheck = 1;
@@ -190,12 +173,6 @@ namespace board {
tsensor::InitializeSoctherm(); // SOCTHERM must be init before AOTAG
Result bpmpfwRc = bpmp::StartBpmfwExecution();
if (R_FAILED(bpmpfwRc)) {
file::utils::LogLine("[bpmp] StartBpmfwExecution failed: 0x%x", bpmpfwRc);
}
bpmp::StartSleepMonitorThread();
// PMC exosphere check
SecmonArgs args = {};
args.X[0] = 0xF0000002;
@@ -224,7 +201,6 @@ namespace board {
}
void Exit() {
bpmp::StopSleepMonitorThread();
if (HOSSVC_HAS_CLKRST) {
clkrstExit();
@@ -254,30 +230,6 @@ namespace board {
nvExit();
}
#define MMIO32(addr) (*reinterpret_cast<volatile u32 *>(addr))
NX_NORETURN void Panic(u32 c) {
SmcReadWriteRegister(0x7000EC40 /* PMC_BASE + APBDEV_PMC_SCRATCH200 */, ~0, c);
/* Write timer magic */
MMIO32(tmrVirtAddr + 0x18C) = 0xC45A;
/* Disable counters */
MMIO32(tmrVirtAddr + 0x188) = 0x2;
/* Start periodic timer */
MMIO32(tmrVirtAddr + 0x80) = 0xC0000000;
/* Set the reboot source to the timer */
MMIO32(tmrVirtAddr + 0x180) = 0x8019;
/* Enable counter */
MMIO32(tmrVirtAddr + 0x188) = 0x1;
/* Hang. */
for(;;)
;
}
HocClkSocType GetSocType() {
return gSocType;
}
+1 -5
View File
@@ -42,15 +42,12 @@
#define HOSSVC_HAS_TC (hosversionAtLeast(5, 0, 0))
namespace board {
extern u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr, fuseVirtAddr, sysVirtAddr, actmonVirtAddr, gpuVirtAddr;
extern u64 clkVirtAddr, dsiVirtAddr, apbVirtAddr, fuseVirtAddr;
extern HocClkSocType gSocType;
extern u8 gDramID;
extern HocClkConsoleType gConsoleType;
extern FuseData fuseData;
extern u8 speedoBracket;
extern const u32 GpuPanic;
extern const u32 CpuPanic;
extern const u32 RamPanic;
void Initialize();
void Exit();
@@ -62,6 +59,5 @@ namespace board {
bool IsDram8GB();
void SetDisplayRefreshDockedState(bool docked);
FuseData *GetFuseData();
NX_NORETURN void Panic(u32 c);
} // namespace board
@@ -28,15 +28,16 @@
#include <i2c.h>
#include <max17050.h>
#include <switch.h>
#include <t210.h>
#include <tmp451.h>
#include "../bpmp/bpmp.hpp"
#include "../display/display_refresh_rate.hpp"
#include "../file/config.hpp"
#include "../file/errors.hpp"
#include "../hos/apm_ext.h"
#include "../i2c/i2cDrv.h"
#include "../soc/gm20b.hpp"
#include "../soc/pllmb.hpp"
#include "board.hpp"
#include "board_name.hpp"
#include <ipc_server.h>
@@ -183,30 +184,13 @@ namespace board {
u32 hz = 0;
switch (module) {
case HocClkModule_CPU:
return bpmp::GetSharedInfo()->freqCpu * 1000;
case HocClkModule_GPU: {
constexpr u32 ClkOutEnbX = 0x280;
constexpr u32 RstDevicesX = 0x28C;
constexpr u32 GpuBit = (1u << 24);
const bool gpuEnabled = (*reinterpret_cast<volatile u32 *>(clkVirtAddr + ClkOutEnbX) & GpuBit) &&
!(*reinterpret_cast<volatile u32 *>(clkVirtAddr + RstDevicesX) & GpuBit);
if (!gpuEnabled) {
return 0;
}
const u32 coeff = *reinterpret_cast<volatile u32 *>(gpuVirtAddr + 0x137004);
const u32 divm = coeff & 0xFF;
const u32 divn = (coeff >> 8) & 0xFF;
const u32 divp = (coeff >> 16) & 0x3F;
if (divm == 0 || divp == 0) {
return 0;
}
return static_cast<u32>((static_cast<u64>(38400000) * divn) / (divm * divp) / 2);
}
return t210ClkCpuFreq();
case HocClkModule_GPU:
return t210ClkGpuFreq();
case HocClkModule_MEM:
return bpmp::GetSharedInfo()->freqMemPll * 1000;
return file::config::GetConfigValue(HocClkConfigValue_MemoryFrequencyMeasurementMode) == MemoryFrequencyMeasurementMode_PLL
? pllmb::getRamClockRatePLLMB()
: t210ClkMemFreq();
case HocClkModule_Display:
return GetDisplayRate(hz);
default:
@@ -33,9 +33,9 @@
#include <minIni.h>
#include <numeric>
#include <switch.h>
#include <t210.h>
#include <tmp451.h>
#include "../bpmp/bpmp.hpp"
#include "../hos/apm_ext.h"
#include "board.hpp"
#include "board_misc.hpp"
@@ -116,9 +116,9 @@ namespace board {
u32 GetPartLoad(HocClkPartLoad loadSource) {
switch (loadSource) {
case HocClkPartLoad_EMC:
return bpmp::GetSharedInfo()->emcLoadAll;
return t210EmcLoadAll();
case HocClkPartLoad_EMCCpu:
return bpmp::GetSharedInfo()->emcLoadCpu;
return t210EmcLoadCpu();
case HocClkPartLoad_GPU:
return gpuLoad;
case HocClkPartLoad_CPUMax:
@@ -130,13 +130,13 @@ namespace board {
case HocClkPartLoad_FAN:
return GetFanLevel();
case HocClkPartLoad_RamBWAll:
return bpmp::GetSharedInfo()->emcBwAll;
return t210EmcBwAll();
case HocClkPartLoad_RamBWCpu:
return bpmp::GetSharedInfo()->emcBwCpu;
return t210EmcBwCpu();
case HocClkPartLoad_RamBWGpu:
return bpmp::GetSharedInfo()->emcBwGpu;
return t210EmcBwGpu();
case HocClkPartLoad_RamBWPeak:
return static_cast<u32>((static_cast<u64>(bpmp::GetSharedInfo()->freqMem) * 16) / 1000);
return t210EmcBwPeak();
default:
ASSERT_ENUM_VALID(HocClkPartLoad, loadSource);
}