mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-30 13:57:38 +00:00
A small correction for AMD K8 (family 0Fh) core temperature reading, and fan reading on older revision of IT8712F chips. This should fix Issue 42 and Issue 194.
This commit is contained in:
@@ -52,9 +52,9 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
private const byte MISCELLANEOUS_CONTROL_FUNCTION = 3;
|
||||
private const ushort MISCELLANEOUS_CONTROL_DEVICE_ID = 0x1103;
|
||||
private const uint THERMTRIP_STATUS_REGISTER = 0xE4;
|
||||
private const byte THERM_SENSE_CORE_SEL_CPU0 = 0x4;
|
||||
private const byte THERM_SENSE_CORE_SEL_CPU1 = 0x0;
|
||||
|
||||
private readonly byte thermSenseCoreSelCPU0;
|
||||
private readonly byte thermSenseCoreSelCPU1;
|
||||
private readonly uint miscellaneousControlAddress;
|
||||
|
||||
public AMD0FCPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
|
||||
@@ -67,6 +67,16 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
if (model >= 0x69 && model != 0xc1 && model != 0x6c && model != 0x7c)
|
||||
offset += 21;
|
||||
|
||||
if (model < 40) {
|
||||
// AMD Athlon 64 Processors
|
||||
thermSenseCoreSelCPU0 = 0x0;
|
||||
thermSenseCoreSelCPU1 = 0x4;
|
||||
} else {
|
||||
// AMD NPT Family 0Fh Revision F, G have the core selection swapped
|
||||
thermSenseCoreSelCPU0 = 0x4;
|
||||
thermSenseCoreSelCPU1 = 0x0;
|
||||
}
|
||||
|
||||
// check if processor supports a digital thermal sensor
|
||||
if (cpuid[0][0].ExtData.GetLength(0) > 7 &&
|
||||
(cpuid[0][0].ExtData[7, 3] & 1) != 0)
|
||||
@@ -122,7 +132,7 @@ namespace OpenHardwareMonitor.Hardware.CPU {
|
||||
for (uint i = 0; i < coreTemperatures.Length; i++) {
|
||||
if (Ring0.WritePciConfig(
|
||||
miscellaneousControlAddress, THERMTRIP_STATUS_REGISTER,
|
||||
i > 0 ? THERM_SENSE_CORE_SEL_CPU1 : THERM_SENSE_CORE_SEL_CPU0)) {
|
||||
i > 0 ? thermSenseCoreSelCPU1 : thermSenseCoreSelCPU0)) {
|
||||
uint value;
|
||||
if (Ring0.ReadPciConfig(
|
||||
miscellaneousControlAddress, THERMTRIP_STATUS_REGISTER,
|
||||
|
@@ -48,7 +48,8 @@ namespace OpenHardwareMonitor.Hardware {
|
||||
foreach (string line in lines) {
|
||||
string[] array = line.Split(new[] { ' ' },
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if (array.Length == 0)
|
||||
continue;
|
||||
if (Convert.ToInt32(array[0], 16) == (address & 0xFFF0))
|
||||
return Convert.ToByte(array[(address & 0x0F) + 1], 16);
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
private readonly float?[] fans = new float?[0];
|
||||
|
||||
private readonly float voltageGain;
|
||||
private readonly bool has16bitFanCounter;
|
||||
|
||||
// Consts
|
||||
private const byte ITE_VENDOR_ID = 0x90;
|
||||
@@ -68,7 +69,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
private const byte CONFIGURATION_REGISTER = 0x00;
|
||||
private const byte TEMPERATURE_BASE_REG = 0x29;
|
||||
private const byte VENDOR_ID_REGISTER = 0x58;
|
||||
private const byte FAN_TACHOMETER_16_BIT_ENABLE_REGISTER = 0x0c;
|
||||
private const byte FAN_TACHOMETER_DIVISOR_REGISTER = 0x0B;
|
||||
private readonly byte[] FAN_TACHOMETER_REG =
|
||||
new byte[] { 0x0d, 0x0e, 0x0f, 0x80, 0x82 };
|
||||
private readonly byte[] FAN_TACHOMETER_EXT_REG =
|
||||
@@ -134,6 +135,13 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
voltageGain = 0.016f;
|
||||
}
|
||||
|
||||
// older IT8721F revision do not have 16-bit fan counters
|
||||
if (chip == Chip.IT8712F && version < 8) {
|
||||
has16bitFanCounter = false;
|
||||
} else {
|
||||
has16bitFanCounter = true;
|
||||
}
|
||||
|
||||
// Set the number of GPIO sets
|
||||
switch (chip) {
|
||||
case Chip.IT8712F:
|
||||
@@ -236,6 +244,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
temperatures[i] = null;
|
||||
}
|
||||
|
||||
if (has16bitFanCounter) {
|
||||
for (int i = 0; i < fans.Length; i++) {
|
||||
bool valid;
|
||||
int value = ReadByte(FAN_TACHOMETER_REG[i], out valid);
|
||||
@@ -246,11 +255,33 @@ namespace OpenHardwareMonitor.Hardware.LPC {
|
||||
continue;
|
||||
|
||||
if (value > 0x3f) {
|
||||
fans[i] = (value < 0xffff) ? 1.35e6f / ((value) * 2) : 0;
|
||||
fans[i] = (value < 0xffff) ? 1.35e6f / (value * 2) : 0;
|
||||
} else {
|
||||
fans[i] = null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < fans.Length; i++) {
|
||||
bool valid;
|
||||
int value = ReadByte(FAN_TACHOMETER_REG[i], out valid);
|
||||
if (!valid)
|
||||
continue;
|
||||
|
||||
int divisor = 2;
|
||||
if (i < 2) {
|
||||
int divisors = ReadByte(FAN_TACHOMETER_DIVISOR_REGISTER, out valid);
|
||||
if (!valid)
|
||||
continue;
|
||||
divisor = 1 << ((divisors >> (3 * i)) & 0x7);
|
||||
}
|
||||
|
||||
if (value > 0) {
|
||||
fans[i] = (value < 0xff) ? 1.35e6f / (value * divisor) : 0;
|
||||
} else {
|
||||
fans[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ring0.ReleaseIsaBusMutex();
|
||||
}
|
||||
|
@@ -37,5 +37,5 @@
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyVersion("0.2.1.19")]
|
||||
[assembly: AssemblyInformationalVersion("0.2.1.19 Alpha")]
|
||||
[assembly: AssemblyVersion("0.2.1.20")]
|
||||
[assembly: AssemblyInformationalVersion("0.2.1.20 Alpha")]
|
Reference in New Issue
Block a user