From 04c3c485a1189857e7bc47c1c4bc796215b2474c Mon Sep 17 00:00:00 2001 From: Sam DEMEULEMEESTER Date: Thu, 17 Mar 2022 02:12:40 +0100 Subject: [PATCH] Minor fixes on previously added temperature code --- system/pci.c | 6 +----- system/temperature.c | 7 ++----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/system/pci.c b/system/pci.c index 67e9583..1b280a8 100644 --- a/system/pci.c +++ b/system/pci.c @@ -246,17 +246,13 @@ void pci_config_write32(int bus, int dev, int func, int reg, uint32_t value) uint32_t amd_smn_read(uint32_t adr) { - pci_config_write32(0, 0, 0, 0x60, adr); return pci_config_read32(0, 0, 0, 0x64); - } void amd_smn_write(uint32_t adr, uint32_t data) { - pci_config_write32(0, 0, 0, 0x60, adr); pci_config_write32(0, 0, 0, 0x64, data); - -} \ No newline at end of file +} diff --git a/system/temperature.c b/system/temperature.c index d97fd30..d36f979 100644 --- a/system/temperature.c +++ b/system/temperature.c @@ -61,18 +61,15 @@ int get_cpu_temperature(void) } else if (cpuid_info.vendor_id.str[0] == 'A' && cpuid_info.version.extendedFamily >= 8) { // Grab CPU Temp. for ZEN CPUs using SNM - uint32_t tval = amd_smn_read(SMN_THM_TCON_CUR_TMP); - float offset; + float offset = 0; - if((tval >> 19) & 0x01) - { + if((tval >> 19) & 0x01) { offset = -49.0f; } return offset + 0.125f * (float)((tval >> 21) & 0x7FF); - } return 0;