soctherm coldboot fix

This commit is contained in:
souldbminersmwc committed 2026-08-25 18:54:58 -04:00
1 parent b8f728ac0a
commit 1b9156fbd6
3 files changed
+40 -18

No files matched your search

Binary file not shown.
+24 -9
View File
@@ -32,6 +32,21 @@ namespace {
} // namespace
void MainLoop(HocClkBpmpSharedInfo &info) {
for (;;) {
const u32 temp1 = MMIO32(SocthermBase + SocthermSensorTemp1);
const u32 temp2 = MMIO32(SocthermBase + SocthermSensorTemp2);
info.tempCpu = TranslateSocthermTemp(static_cast<u16>(temp1 >> 16));
info.tempGpu = TranslateSocthermTemp(static_cast<u16>(temp1));
info.tempMem = TranslateSocthermTemp(static_cast<u16>(temp2 >> 16));
info.tempPllx = TranslateSocthermTemp(static_cast<u16>(temp2));
// printf("tmr=%u\n", MMIO32(TmrBase + TimerUsCntr1Us));
msleep(500);
//printf("[hoc-bpmpfw]: Done logging\n");
}
}
extern "C" void main() {
InitializeLibc();
@@ -42,15 +57,15 @@ extern "C" void main() {
info.status = 0;
info.magic = HOCCLK_BPMP_MAGIC; // written last
for (;;) {
const u32 temp1 = MMIO32(SocthermBase + SocthermSensorTemp1);
const u32 temp2 = MMIO32(SocthermBase + SocthermSensorTemp2);
/* If the main loop exits then it is a panic or invalid state */
MainLoop(info);
info.tempCpu = TranslateSocthermTemp(static_cast<u16>(temp1 >> 16));
info.tempGpu = TranslateSocthermTemp(static_cast<u16>(temp1));
info.tempMem = TranslateSocthermTemp(static_cast<u16>(temp2 >> 16));
info.tempPllx = TranslateSocthermTemp(static_cast<u16>(temp2));
printf("[hoc-bpmpfw]: PANIC\n");
/* Clear the magic so sysmodule knows of a panic */
info.magic = 0x0;
usleep(250000); // 250ms
}
/* Give a panic code */
info.status = ~0;
for(;;)
;
}
+16 -9
View File
@@ -29,21 +29,28 @@ constexpr u32 FlowCtlrBase = 0x60007000;
constexpr u32 FlowCtlrHaltCopEvents = 0x004;
constexpr u32 HaltModeWaitEvent = (2u << 29);
constexpr u32 HaltUsec = (0u << 24);
constexpr u32 HaltMsec = (1u << 24);
constexpr u32 HaltUsec = (1u << 25);
constexpr u32 HaltMaxCnt = 0xFF;
[[maybe_unused]] inline void FlowCtlrHaltUsec(u32 usec) {
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltUsec | (usec & 0xFFFFFFu);
[[maybe_unused]] inline void usleep(u32 us) {
while (us) {
const u32 delay = (us > HaltMaxCnt) ? HaltMaxCnt : us;
us -= delay;
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltUsec | delay;
}
}
[[maybe_unused]] inline void msleep(u32 ms) {
while (ms) {
const u32 delay = (ms > HaltMaxCnt) ? HaltMaxCnt : ms;
ms -= delay;
MMIO32(FlowCtlrBase + FlowCtlrHaltCopEvents) = HaltModeWaitEvent | HaltMsec | delay;
}
}
constexpr u32 TmrBase = 0x60005000;
constexpr u32 TimerUsCntr1Us = 0x10;
[[maybe_unused]] inline void usleep(u32 us) {
const u32 start = MMIO32(TmrBase + TimerUsCntr1Us);
while ((MMIO32(TmrBase + TimerUsCntr1Us) - start) <= us)
;
}
constexpr u32 UartBBase = 0x70006040;
constexpr u32 UartThr = 0x00;
constexpr u32 UartLsr = 0x14;