move AOTAG to BPMP

This commit is contained in:
souldbminersmwc committed 2026-08-26 15:29:41 -04:00
1 parent 0262236d2c
commit 3141d0ea2e
4 files changed
+62 -19

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2014 - 2017, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) Souldbminer, Lightos 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/>.
*
*/
#pragma once
#include "regs.hpp"
#include <hocclk/bpmp.h>
namespace aotag {
constexpr u32 PmcBase = 0x7000E400;
constexpr u32 PmcTsensorStatus1 = 0x4AC;
constexpr u32 Status1ValidBit = (1u << 31);
constexpr u32 Status1AbsShift = 8;
constexpr u32 Status1AbsMask = 0xFF;
constexpr u32 Status1FracBit = (1u << 7);
constexpr u32 Status1SignBit = (1u << 0);
constexpr s32 InvalidSentinel = -125;
inline void Update(HocClkBpmpSharedInfo &info) {
const u32 regval = MMIO32(PmcBase + PmcTsensorStatus1);
if (!(regval & Status1ValidBit)) {
info.tempAO = InvalidSentinel;
return;
}
const u32 abs = (regval >> Status1AbsShift) & Status1AbsMask;
const bool frac = (regval & Status1FracBit) != 0;
const bool negative = (regval & Status1SignBit) != 0;
s32 temp = static_cast<s32>(abs) * 1000 + (frac ? 500 : 0);
if (negative) {
temp = -temp;
}
info.tempAO = temp;
}
} // namespace aotag
+2
View File
@@ -19,6 +19,7 @@
#include <string.h>
#include "actmon.hpp"
#include "aotag.hpp"
#include "bpmp_mmu.hpp"
#include "freq.hpp"
#include "libc_platform.hpp"
@@ -53,6 +54,7 @@ void MainLoop(HocClkBpmpSharedInfo &info) {
freq::Update(info);
actmon::Update(info);
aotag::Update(info);
msleep(250);
}
+1 -1
View File
@@ -41,7 +41,7 @@ typedef struct {
u32 emcBwCpu;
u32 emcBwGpu;
u32 exitRequested; // Request BPMP-FW to shutdown for sleep mode
u32 reserved[1];
s32 tempAO;
} HocClkBpmpSharedInfo;
static_assert(sizeof(HocClkBpmpSharedInfo) == 0x3C);
+2 -18
View File
@@ -22,6 +22,7 @@
#include <notification.h>
#include "../bpmp/bpmp.hpp"
#include "../file/file_utils.hpp"
#include "../mapping/mem_map.hpp"
#include "aotag.hpp"
@@ -214,24 +215,7 @@ namespace tsensor {
return -126;
}
u32 regval = 0, abs = 0, fraction = 0, valid = 0, sign = 0;
s32 temp = 0;
regval = ReadPmcReg(PMC_TSENSOR_STATUS1);
valid = REG_GET(regval, STATUS1_TEMP_VALID);
if (!valid) {
return -125;
}
abs = REG_GET(regval, STATUS1_TEMP_ABS);
fraction = REG_GET(regval, STATUS1_TEMP_FRAC);
sign = REG_GET(regval, STATUS1_TEMP_SIGN);
temp = (abs * 1000) + (fraction * 500);
if (sign) {
temp = (-1) * (temp);
}
return temp;
return bpmp::GetSharedInfo()->tempAO;
}
bool IsInitialized() {