Added support for Winbond W83627EHF, W83667HG, W83667HG-B mainboard chips.

This commit is contained in:
Michael Möller
2010-02-08 20:18:25 +00:00
parent ba97d6524f
commit 1fdd207910
12 changed files with 161 additions and 205 deletions
+1 -1
View File
@@ -319,7 +319,7 @@ namespace OpenHardwareMonitor.GUI {
} else {
Visible = true;
notifyIcon.Visible = false;
BringToFront();
Activate();
}
}
+4 -2
View File
@@ -38,6 +38,7 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Globalization;
using System.Text;
namespace OpenHardwareMonitor.Hardware {
@@ -133,7 +134,7 @@ namespace OpenHardwareMonitor.Hardware {
public void SaveReport(Version version) {
using (TextWriter w =
new StreamWriter("OpenHardwareMonitor.Report.txt")) {
new StreamWriter("OpenHardwareMonitor.Report.txt")) {
w.WriteLine();
w.WriteLine("Open Hardware Monitor Report");
@@ -152,7 +153,8 @@ namespace OpenHardwareMonitor.Hardware {
foreach (ISensor sensor in hardware.Sensors) {
w.WriteLine("| +- {0} : {1} : {2} : {3}",
new object[] { sensor.SensorType, sensor.Index, sensor.Name,
sensor.Value });
string.Format(CultureInfo.InvariantCulture, "{0}",
sensor.Value) });
}
}
}
+3
View File
@@ -13,7 +13,10 @@ namespace OpenHardwareMonitor.Hardware.LPC {
IT8726F = 0x8726,
W83627DHG = 0xA020,
W83627DHGP = 0xB070,
W83627EHF = 0x8860,
W83627HF = 0x5200,
W83667HG = 0xA510,
W83667HGB = 0xB350,
F71862 = 0x0601,
F71869 = 0x0814,
F71882 = 0x0541,
+2 -1
View File
@@ -136,7 +136,8 @@ namespace OpenHardwareMonitor.Hardware.LPC {
if (value > 0) {
sensor.Value = (value < 0x0fff) ? 1.5e6f / value : 0;
ActivateSensor(sensor);
if (sensor.Value > 0)
ActivateSensor(sensor);
} else {
DeactivateSensor(sensor);
}
+2 -1
View File
@@ -164,7 +164,8 @@ namespace OpenHardwareMonitor.Hardware.LPC {
if (value > 0) {
sensor.Value = (value < 0xffff) ? 1.35e6f / ((value) * 2) : 0;
ActivateSensor(sensor);
if (sensor.Value > 0)
ActivateSensor(sensor);
} else {
DeactivateSensor(sensor);
}
+41 -46
View File
@@ -75,6 +75,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
WinRing0.WriteIoPortByte(valuePort, logicalDeviceNumber);
}
// ITE
private const byte IT87_ENVIRONMENT_CONTROLLER_LDN = 0x04;
private void IT87Enter() {
@@ -93,7 +94,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
private const byte FINTEK_VENDOR_ID_REGISTER = 0x23;
private const ushort FINTEK_VENDOR_ID = 0x1934;
private const byte W83627_HARDWARE_MONITOR_LDN = 0x0B;
private const byte WINBOND_HARDWARE_MONITOR_LDN = 0x0B;
private const byte F71858_HARDWARE_MONITOR_LDN = 0x02;
private const byte FINTEK_HARDWARE_MONITOR_LDN = 0x04;
@@ -120,89 +121,80 @@ namespace OpenHardwareMonitor.Hardware.LPC {
byte logicalDeviceNumber;
byte id = ReadByte(CHIP_ID_REGISTER);
byte revision = ReadByte(CHIP_REVISION_REGISTER);
chip = Chip.Unknown;
logicalDeviceNumber = 0;
switch (id) {
case 0x05:
switch (revision) {
case 0x41:
chip = Chip.F71882;
logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
break;
break;
} break;
case 0x06:
switch (revision) {
case 0x01:
chip = Chip.F71862;
logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
break;
break;
} break;
case 0x07:
switch (revision) {
case 0x23:
chip = Chip.F71889;
logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
break;
break;
} break;
case 0x08:
switch (revision) {
case 0x14:
chip = Chip.F71869;
logicalDeviceNumber = FINTEK_HARDWARE_MONITOR_LDN;
break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
break;
break;
} break;
case 0x52:
switch (revision) {
case 0x17:
case 0x3A:
chip = Chip.W83627HF;
logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
break;
} break;
case 0x88:
switch (revision & 0xF0) {
case 0x60:
chip = Chip.W83627EHF;
logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
break;
} break;
case 0xA0:
switch (revision & 0xF0) {
case 0x20:
chip = Chip.W83627DHG;
logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
break;
} break;
case 0xA5:
switch (revision & 0xF0) {
case 0x10:
chip = Chip.W83667HG;
logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
break;
} break;
case 0xB0:
switch (revision & 0xF0) {
case 0x70:
chip = Chip.W83627DHGP;
logicalDeviceNumber = W83627_HARDWARE_MONITOR_LDN;
logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
break;
} break;
case 0xB3:
switch (revision & 0xF0) {
case 0x50:
chip = Chip.W83667HGB;
logicalDeviceNumber = WINBOND_HARDWARE_MONITOR_LDN;
break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
break;
} break;
default:
chip = Chip.Unknown;
logicalDeviceNumber = 0;
break;
} break;
}
if (chip != Chip.Unknown) {
@@ -217,16 +209,19 @@ namespace OpenHardwareMonitor.Hardware.LPC {
WinbondFintekExit();
if (address != verify || address == 0 || (address & 0xF007) != 0)
if (address != verify || address < 0x100 || (address & 0xF007) != 0)
return;
switch (chip) {
case Chip.W83627DHG:
case Chip.W83627DHGP:
case Chip.W83627EHF:
case Chip.W83627HF:
W83627 w83627 = new W83627(chip, revision, address);
if (w83627.IsAvailable)
hardware.Add(w83627);
case Chip.W83667HG:
case Chip.W83667HGB:
W836XX w836XX = new W836XX(chip, revision, address);
if (w836XX.IsAvailable)
hardware.Add(w836XX);
break;
case Chip.F71862:
case Chip.F71882:
@@ -261,7 +256,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
IT87Exit();
if (address != verify || address == 0 || (address & 0xF007) != 0)
if (address != verify || address < 0x100 || (address & 0xF007) != 0)
return;
IT87XX it87 = new IT87XX(chip, address);
+3
View File
@@ -61,7 +61,10 @@ namespace OpenHardwareMonitor.Hardware.LPC {
case Chip.IT8726F: this.name = "ITE IT8726F"; break;
case Chip.W83627DHG: this.name = "Winbond W83627DHG"; break;
case Chip.W83627DHGP: this.name = "Winbond W83627DHG-P"; break;
case Chip.W83627EHF: this.name = "Winbond W83627EHF"; break;
case Chip.W83627HF: this.name = "Winbond W83627HF"; break;
case Chip.W83667HG: this.name = "Winbond W83667HG"; break;
case Chip.W83667HGB: this.name = "Winbond W83667HG-B"; break;
}
}
+101 -17
View File
@@ -41,8 +41,13 @@ using System.Drawing;
using System.Text;
namespace OpenHardwareMonitor.Hardware.LPC {
public class W83627 : Winbond, IHardware {
public class W836XX : LPCHardware, IHardware {
private ushort address;
private byte revision;
private bool available;
private Sensor[] temperatures;
private Sensor[] fans;
private Sensor[] voltages;
@@ -50,10 +55,20 @@ namespace OpenHardwareMonitor.Hardware.LPC {
private float[] voltageGains;
private string[] fanNames;
// Consts
private const ushort WINBOND_VENDOR_ID = 0x5CA3;
private const byte HIGH_BYTE = 0x80;
// Hardware Monitor
private const byte ADDRESS_REGISTER_OFFSET = 0x05;
private const byte DATA_REGISTER_OFFSET = 0x06;
// Hardware Monitor Registers
private const byte VOLTAGE_BASE_REG = 0x20;
private const byte VOLTAGE_BASE_REG = 0x20;
private const byte BANK_SELECT_REGISTER = 0x04E;
private const byte VENDOR_ID_REGISTER = 0x4F;
private const byte TEMPERATURE_BASE_REG = 0x50;
private const byte TEMPERATURE_SYS_REG = 0x27;
private const byte TEMPERATURE_SYS_REG = 0x27;
private byte[] FAN_TACHO_REG = new byte[] { 0x28, 0x29, 0x2A, 0x3F, 0x53 };
private byte[] FAN_TACHO_BANK = new byte[] { 0, 0, 0, 0, 5 };
@@ -62,10 +77,25 @@ namespace OpenHardwareMonitor.Hardware.LPC {
private byte[] FAN_DIV_BIT1 = new byte[] { 37, 39, 31, 9, 11 };
private byte[] FAN_DIV_BIT2 = new byte[] { 5, 6, 7, 23, 15 };
public W83627(Chip chip, byte revision, ushort address)
: base(chip, revision, address)
private byte ReadByte(byte bank, byte register) {
WinRing0.WriteIoPortByte(
(ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
WinRing0.WriteIoPortByte(
(ushort)(address + DATA_REGISTER_OFFSET), bank);
WinRing0.WriteIoPortByte(
(ushort)(address + ADDRESS_REGISTER_OFFSET), register);
return WinRing0.ReadIoPortByte(
(ushort)(address + DATA_REGISTER_OFFSET));
}
public W836XX(Chip chip, byte revision, ushort address)
: base(chip)
{
this.address = address;
this.revision = revision;
available = IsWinbondVendor();
temperatures = new Sensor[3];
temperatures[0] = new Sensor("CPU", 0, SensorType.Temperature, this);
temperatures[1] = new Sensor("Auxiliary", 1, SensorType.Temperature, this);
@@ -73,10 +103,13 @@ namespace OpenHardwareMonitor.Hardware.LPC {
switch (chip) {
case Chip.W83627DHG:
case Chip.W83627DHGP:
fanNames = new string[] { "System", "CPU #1", "Auxiliary #1",
case Chip.W83627DHGP:
case Chip.W83627EHF:
case Chip.W83667HG:
case Chip.W83667HGB:
fanNames = new string[] { "System", "CPU", "Auxiliary",
"CPU #2", "Auxiliary #2" };
voltageGains = new float[] { 0.008f, 1, 1, 0.016f, 1, 1, 1, 0.016f };
voltageGains = new float[] { 1, 1, 1, 2, 1, 1, 1, 2 };
voltages = new Sensor[3];
voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
voltages[1] = new Sensor("+3.3V", 3, SensorType.Voltage, this);
@@ -84,7 +117,7 @@ namespace OpenHardwareMonitor.Hardware.LPC {
break;
case Chip.W83627HF:
fanNames = new string[] { "Fan #1", "Fan #2", "Fan #3" };
voltageGains = new float[] { 0.016f, 1, 0.016f, 1, 1, 1, 1, 0.016f };
voltageGains = new float[] { 2, 1, 2, 1, 1, 1, 1, 2 };
voltages = new Sensor[3];
voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
voltages[1] = new Sensor("+3.3V", 2, SensorType.Voltage, this);
@@ -97,13 +130,24 @@ namespace OpenHardwareMonitor.Hardware.LPC {
fans = new Sensor[fanNames.Length];
for (int i = 0; i < fanNames.Length; i++)
fans[i] = new Sensor(fanNames[i], i, SensorType.Fan, this);
}
}
public bool IsAvailable {
get { return available; }
}
private bool IsWinbondVendor() {
ushort vendorId =
(ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
ReadByte(0, VENDOR_ID_REGISTER));
return vendorId == WINBOND_VENDOR_ID;
}
public void Update() {
foreach (Sensor sensor in voltages) {
if (sensor.Index < 7) {
int value = ReadByte(0, (byte)(VOLTAGE_BASE_REG + sensor.Index));
sensor.Value = voltageGains[sensor.Index] * value;
sensor.Value = 0.008f * voltageGains[sensor.Index] * value;
if (sensor.Value > 0)
ActivateSensor(sensor);
else
@@ -112,8 +156,8 @@ namespace OpenHardwareMonitor.Hardware.LPC {
// Battery voltage
bool valid = (ReadByte(0, 0x5D) & 0x01) > 0;
if (valid) {
sensor.Value = voltageGains[sensor.Index] *
ReadByte(5, 0x51);
sensor.Value =
0.008f * voltageGains[sensor.Index] * ReadByte(5, 0x51);
ActivateSensor(sensor);
} else
DeactivateSensor(sensor);
@@ -147,9 +191,49 @@ namespace OpenHardwareMonitor.Hardware.LPC {
(((bits >> FAN_DIV_BIT1[sensor.Index]) & 1) << 1) |
((bits >> FAN_DIV_BIT0[sensor.Index]) & 1));
int divisor = 1 << divisorBits;
sensor.Value = (count < 0xff) ? 1.35e6f / (count * divisor) : 0;
ActivateSensor(sensor);
float value = (count < 0xff) ? 1.35e6f / (count * divisor) : 0;
sensor.Value = value;
if (value > 0)
ActivateSensor(sensor);
}
}
public string GetReport() {
StringBuilder r = new StringBuilder();
r.AppendLine("LPC " + this.GetType().Name);
r.AppendLine();
r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X"));
r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
r.AppendLine();
r.AppendLine("Hardware Monitor Registers");
r.AppendLine();
r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
r.AppendLine();
for (int i = 0; i < 0x7; i++) {
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
for (int j = 0; j <= 0xF; j++) {
r.Append(" ");
r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
}
r.AppendLine();
}
for (int k = 1; k <= 5; k++) {
r.AppendLine("Bank " + k);
for (int i = 0x5; i < 0x6; i++) {
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
for (int j = 0; j <= 0xF; j++) {
r.Append(" ");
r.Append(ReadByte((byte)(k),
(byte)((i << 4) | j)).ToString("X2"));
}
r.AppendLine();
}
}
r.AppendLine();
return r.ToString();
}
}
}
-132
View File
@@ -1,132 +0,0 @@
/*
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the License.
The Original Code is the Open Hardware Monitor code.
The Initial Developer of the Original Code is
Michael Möller <m.moeller@gmx.ch>.
Portions created by the Initial Developer are Copyright (C) 2009-2010
the Initial Developer. All Rights Reserved.
Contributor(s):
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
namespace OpenHardwareMonitor.Hardware.LPC {
public abstract class Winbond : LPCHardware {
private ushort address;
private byte revision;
private bool available;
// Consts
private const ushort WINBOND_VENDOR_ID = 0x5CA3;
private const byte HIGH_BYTE = 0x80;
// Hardware Monitor
private const byte ADDRESS_REGISTER_OFFSET = 0x05;
private const byte DATA_REGISTER_OFFSET = 0x06;
// Hardware Monitor Registers
private const byte BANK_SELECT_REGISTER = 0x04E;
private const byte VENDOR_ID_REGISTER = 0x4F;
protected byte ReadByte(byte bank, byte register) {
WinRing0.WriteIoPortByte(
(ushort)(address + ADDRESS_REGISTER_OFFSET), BANK_SELECT_REGISTER);
WinRing0.WriteIoPortByte(
(ushort)(address + DATA_REGISTER_OFFSET), bank);
WinRing0.WriteIoPortByte(
(ushort)(address + ADDRESS_REGISTER_OFFSET), register);
return WinRing0.ReadIoPortByte(
(ushort)(address + DATA_REGISTER_OFFSET));
}
private bool IsWinbondVendor() {
ushort vendorId =
(ushort)((ReadByte(HIGH_BYTE, VENDOR_ID_REGISTER) << 8) |
ReadByte(0, VENDOR_ID_REGISTER));
return vendorId == WINBOND_VENDOR_ID;
}
public Winbond(Chip chip, byte revision, ushort address)
: base(chip)
{
this.address = address;
this.revision = revision;
available = IsWinbondVendor();
}
public bool IsAvailable {
get { return available; }
}
public string GetReport() {
StringBuilder r = new StringBuilder();
r.AppendLine("LPC " + this.GetType().Name);
r.AppendLine();
r.Append("Chip ID: 0x"); r.AppendLine(chip.ToString("X"));
r.Append("Chip revision: 0x"); r.AppendLine(revision.ToString("X"));
r.Append("Base Adress: 0x"); r.AppendLine(address.ToString("X4"));
r.AppendLine();
r.AppendLine("Hardware Monitor Registers");
r.AppendLine();
r.AppendLine(" 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F");
r.AppendLine();
for (int i = 0; i < 0x7; i++) {
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
for (int j = 0; j <= 0xF; j++) {
r.Append(" ");
r.Append(ReadByte(0, (byte)((i << 4) | j)).ToString("X2"));
}
r.AppendLine();
}
for (int k = 1; k <= 5; k++) {
r.AppendLine("Bank " + k);
for (int i = 0x5; i < 0x6; i++) {
r.Append(" "); r.Append((i << 4).ToString("X2")); r.Append(" ");
for (int j = 0; j <= 0xF; j++) {
r.Append(" ");
r.Append(ReadByte((byte)(k),
(byte)((i << 4) | j)).ToString("X2"));
}
r.AppendLine();
}
}
r.AppendLine();
return r.ToString();
}
}
}
+1 -1
View File
@@ -62,7 +62,7 @@ namespace OpenHardwareMonitor.Hardware.TBalancer {
if (serialPort.IsOpen && serialPort.CDHolding &&
serialPort.CtsHolding) {
report.Append("Port name: "); report.AppendLine(portNames[i]);
report.Append("Port Name: "); report.AppendLine(portNames[i]);
serialPort.DiscardInBuffer();
serialPort.DiscardOutBuffer();
+1 -2
View File
@@ -69,9 +69,8 @@
<Compile Include="Hardware\LPC\Chip.cs" />
<Compile Include="Hardware\LPC\F718XX.cs" />
<Compile Include="Hardware\LPC\LPCHardware.cs" />
<Compile Include="Hardware\LPC\Winbond.cs" />
<Compile Include="Hardware\SMBIOS\SMBIOSGroup.cs" />
<Compile Include="Hardware\LPC\W83627.cs" />
<Compile Include="Hardware\LPC\W836XX.cs" />
<Compile Include="Hardware\Computer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="GUI\AboutBox.cs">
+2 -2
View File
@@ -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.15.0")]
[assembly: AssemblyFileVersion("0.1.15.0")]
[assembly: AssemblyVersion("0.1.16.0")]
[assembly: AssemblyFileVersion("0.1.16.0")]