From b839e338d6ed92d68324e0538a5bfa560945b231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Mon, 1 Mar 2010 22:12:29 +0000 Subject: [PATCH] Added support for Winbond W83687THF and improved report output for LPC detection. --- Hardware/LPC/Chip.cs | 1 + Hardware/LPC/LPCGroup.cs | 99 ++++++++++++++++++++++++++++++--- Hardware/LPC/LPCHardware.cs | 1 + Hardware/LPC/W836XX.cs | 5 +- Hardware/Mainboard/Mainboard.cs | 2 + Properties/AssemblyInfo.cs | 4 +- 6 files changed, 100 insertions(+), 12 deletions(-) diff --git a/Hardware/LPC/Chip.cs b/Hardware/LPC/Chip.cs index aef1f0a..7ccb1f0 100644 --- a/Hardware/LPC/Chip.cs +++ b/Hardware/LPC/Chip.cs @@ -18,6 +18,7 @@ namespace OpenHardwareMonitor.Hardware.LPC { W83627THF = 0x8283, W83667HG = 0xA510, W83667HGB = 0xB350, + W83687THF = 0x8541, F71862 = 0x0601, F71869 = 0x0814, F71882 = 0x0541, diff --git a/Hardware/LPC/LPCGroup.cs b/Hardware/LPC/LPCGroup.cs index ab7d619..cd14f67 100644 --- a/Hardware/LPC/LPCGroup.cs +++ b/Hardware/LPC/LPCGroup.cs @@ -42,7 +42,9 @@ using System.Threading; namespace OpenHardwareMonitor.Hardware.LPC { public class LPCGroup : IGroup { + private List hardware = new List(); + private StringBuilder report = new StringBuilder(); private Chip chip = Chip.Unknown; @@ -108,6 +110,15 @@ namespace OpenHardwareMonitor.Hardware.LPC { WinRing0.WriteIoPortByte(registerPort, 0xAA); } + // SMSC + private void SMSCEnter() { + WinRing0.WriteIoPortByte(registerPort, 0x55); + } + + private void SMSCExit() { + WinRing0.WriteIoPortByte(registerPort, 0xAA); + } + public LPCGroup() { if (!WinRing0.IsAvailable) return; @@ -167,6 +178,13 @@ namespace OpenHardwareMonitor.Hardware.LPC { logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN; break; } break; + case 0x85: + switch (revision) { + case 0x41: + chip = Chip.W83687THF; + logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN; + break; + } break; case 0x88: switch (revision & 0xF0) { case 0x60: @@ -203,7 +221,15 @@ namespace OpenHardwareMonitor.Hardware.LPC { break; } break; } - if (chip != Chip.Unknown) { + if (chip == Chip.Unknown) { + if (id != 0 && id != 0xff) { + WinbondFintekExit(); + + report.Append("Chip ID: Unknown Winbond / Fintek with ID 0x"); + report.AppendLine(((id << 8) | revision).ToString("X")); + report.AppendLine(); + } + } else { Select(logicalDeviceNumber); ushort address = ReadWord(BASE_ADDRESS_REGISTER); @@ -216,16 +242,31 @@ namespace OpenHardwareMonitor.Hardware.LPC { WinbondFintekExit(); - if (address != verify) + if (address != verify) { + report.Append("Chip ID: 0x"); + report.AppendLine(chip.ToString("X")); + report.Append("Chip revision: 0x"); + report.AppendLine(revision.ToString("X")); + report.AppendLine("Error: Address verification failed"); + report.AppendLine(); return; + } // some Fintek chips have address register offset 0x05 added already if ((address & 0x07) == 0x05) address &= 0xFFF8; - if (address < 0x100 || (address & 0xF007) != 0) + if (address < 0x100 || (address & 0xF007) != 0) { + report.Append("Chip ID: 0x"); + report.AppendLine(chip.ToString("X")); + report.Append("Chip revision: 0x"); + report.AppendLine(revision.ToString("X")); + report.Append("Error: Invalid address 0x"); + report.AppendLine(address.ToString("X")); + report.AppendLine(); return; - + } + switch (chip) { case Chip.W83627DHG: case Chip.W83627DHGP: @@ -234,6 +275,7 @@ namespace OpenHardwareMonitor.Hardware.LPC { case Chip.W83627THF: case Chip.W83667HG: case Chip.W83667HGB: + case Chip.W83687THF: W836XX w836XX = new W836XX(chip, revision, address); if (w836XX.IsAvailable) hardware.Add(w836XX); @@ -255,15 +297,23 @@ namespace OpenHardwareMonitor.Hardware.LPC { IT87Enter(); - switch (ReadWord(CHIP_ID_REGISTER)) { + ushort chipID = ReadWord(CHIP_ID_REGISTER); + switch (chipID) { case 0x8716: chip = Chip.IT8716F; break; case 0x8718: chip = Chip.IT8718F; break; case 0x8720: chip = Chip.IT8720F; break; - case 0x8726: chip = Chip.IT8726F; break; + case 0x8726: chip = Chip.IT8726F; break; default: chip = Chip.Unknown; break; } + if (chip == Chip.Unknown) { + if (chipID != 0 && chipID != 0xffff) { + IT87Exit(); - if (chip != Chip.Unknown) { + report.Append("Chip ID: Unknown ITE with ID 0x"); + report.AppendLine(chipID.ToString("X")); + report.AppendLine(); + } + } else { Select(IT87_ENVIRONMENT_CONTROLLER_LDN); ushort address = ReadWord(BASE_ADDRESS_REGISTER); Thread.Sleep(1); @@ -271,8 +321,14 @@ namespace OpenHardwareMonitor.Hardware.LPC { IT87Exit(); - if (address != verify || address < 0x100 || (address & 0xF007) != 0) + if (address != verify || address < 0x100 || (address & 0xF007) != 0) { + report.Append("Chip ID: 0x"); + report.AppendLine(chip.ToString("X")); + report.Append("Error: Invalid address 0x"); + report.AppendLine(address.ToString("X")); + report.AppendLine(); return; + } IT87XX it87 = new IT87XX(chip, address); if (it87.IsAvailable) @@ -280,6 +336,26 @@ namespace OpenHardwareMonitor.Hardware.LPC { return; } + + SMSCEnter(); + + chipID = ReadWord(CHIP_ID_REGISTER); + switch (chipID) { + default: chip = Chip.Unknown; break; + } + if (chip == Chip.Unknown) { + if (chipID != 0 && chipID != 0xffff) { + SMSCExit(); + + report.Append("Chip ID: Unknown SMSC with ID 0x"); + report.AppendLine(chipID.ToString("X")); + report.AppendLine(); + } + } else { + SMSCExit(); + + return; + } } } @@ -290,7 +366,12 @@ namespace OpenHardwareMonitor.Hardware.LPC { } public string GetReport() { - return null; + if (report.Length > 0) { + report.Insert(0, "LPCIO" + Environment.NewLine + + Environment.NewLine); + return report.ToString(); + } else + return null; } public void Close() { } diff --git a/Hardware/LPC/LPCHardware.cs b/Hardware/LPC/LPCHardware.cs index 052500a..02fb58d 100644 --- a/Hardware/LPC/LPCHardware.cs +++ b/Hardware/LPC/LPCHardware.cs @@ -66,6 +66,7 @@ namespace OpenHardwareMonitor.Hardware.LPC { case Chip.W83627THF: this.name = "Winbond W83627THF"; break; case Chip.W83667HG: this.name = "Winbond W83667HG"; break; case Chip.W83667HGB: this.name = "Winbond W83667HG-B"; break; + case Chip.W83687THF: this.name = "Winbond W83687THF"; break; } } diff --git a/Hardware/LPC/W836XX.cs b/Hardware/LPC/W836XX.cs index cccb57e..649d004 100644 --- a/Hardware/LPC/W836XX.cs +++ b/Hardware/LPC/W836XX.cs @@ -167,6 +167,7 @@ namespace OpenHardwareMonitor.Hardware.LPC { break; case Chip.W83627HF: case Chip.W83627THF: + case Chip.W83687THF: fanNames = new string[] { "System", "CPU", "Auxiliary" }; voltageGains = new float[] { 2, 1, 2, 1, 1, 1, 1, 2 }; voltages = new Sensor[3]; @@ -199,7 +200,9 @@ namespace OpenHardwareMonitor.Hardware.LPC { foreach (Sensor sensor in voltages) { if (sensor.Index < 7) { // two special VCore measurement modes for W83627THF - if (chip == Chip.W83627THF && sensor.Index == 0) { + if ((chip == Chip.W83627HF || chip == Chip.W83627THF || + chip == Chip.W83687THF) && sensor.Index == 0) + { byte vrmConfiguration = ReadByte(0, 0x18); int value = ReadByte(0, VOLTAGE_BASE_REG); if ((vrmConfiguration & 0x01) == 0) diff --git a/Hardware/Mainboard/Mainboard.cs b/Hardware/Mainboard/Mainboard.cs index 7d7b8b6..0a00651 100644 --- a/Hardware/Mainboard/Mainboard.cs +++ b/Hardware/Mainboard/Mainboard.cs @@ -84,6 +84,8 @@ namespace OpenHardwareMonitor.Hardware.Mainboard { r.AppendLine(); r.Append(smbios.GetReport()); + r.Append(lpcGroup.GetReport()); + return r.ToString(); } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index c4148db..04857da 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -69,5 +69,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.24.1")] -[assembly: AssemblyFileVersion("0.1.24.1")] +[assembly: AssemblyVersion("0.1.24.3")] +[assembly: AssemblyFileVersion("0.1.24.3")]