Extended the ITE super I/O voltage reading by adding hidden voltage sensors for unknown channels. Added a few known DFI and Gigabyte mainboard voltage configurations.
authormoel.mich
Mon, 24 May 2010 15:27:46 +0000
changeset 1262354fdb91ac4
parent 125 b1278888d9a9
child 127 76aaf45a01c7
Extended the ITE super I/O voltage reading by adding hidden voltage sensors for unknown channels. Added a few known DFI and Gigabyte mainboard voltage configurations.
GUI/MainForm.cs
GUI/SensorNode.cs
Hardware/ATI/ATIGPU.cs
Hardware/LPC/IT87XX.cs
Hardware/LPC/LPCIO.cs
Hardware/Mainboard/Mainboard.cs
Hardware/Mainboard/Manufacturer.cs
Hardware/Mainboard/Model.cs
Hardware/Mainboard/SMBIOS.cs
OpenHardwareMonitor.csproj
     1.1 --- a/GUI/MainForm.cs	Sat May 22 15:51:59 2010 +0000
     1.2 +++ b/GUI/MainForm.cs	Mon May 24 15:27:46 2010 +0000
     1.3 @@ -158,10 +158,8 @@
     1.4        // Hide the system tray and auto startup menu items on Unix
     1.5        int p = (int)System.Environment.OSVersion.Platform;
     1.6        if ((p == 4) || (p == 128)) {
     1.7 -        startMinMenuItem.Visible = false;
     1.8          minTrayMenuItem.Visible = false;
     1.9          startupMenuItem.Visible = false;
    1.10 -        separatorMenuItem.Visible = false;
    1.11        }
    1.12        
    1.13        if (startMinMenuItem.Checked) {
     2.1 --- a/GUI/SensorNode.cs	Sat May 22 15:51:59 2010 +0000
     2.2 +++ b/GUI/SensorNode.cs	Mon May 24 15:27:46 2010 +0000
     2.3 @@ -73,7 +73,7 @@
     2.4  
     2.5        bool hidden = Config.Get(new Identifier(sensor.Identifier, 
     2.6          "hidden").ToString(), sensor.IsDefaultHidden);
     2.7 -      IsVisible = !hidden;
     2.8 +      base.IsVisible = !hidden;
     2.9      }
    2.10  
    2.11      public override string Text {
     3.1 --- a/Hardware/ATI/ATIGPU.cs	Sat May 22 15:51:59 2010 +0000
     3.2 +++ b/Hardware/ATI/ATIGPU.cs	Mon May 24 15:27:46 2010 +0000
     3.3 @@ -135,7 +135,7 @@
     3.4            ActivateSensor(coreVoltage);
     3.5          }
     3.6  
     3.7 -        coreLoad.Value = adlp.ActivityPercent;                        
     3.8 +        coreLoad.Value = Math.Min(adlp.ActivityPercent, 100);                        
     3.9          ActivateSensor(coreLoad);
    3.10        } else {
    3.11          DeactivateSensor(coreClock);
     4.1 --- a/Hardware/LPC/IT87XX.cs	Sat May 22 15:51:59 2010 +0000
     4.2 +++ b/Hardware/LPC/IT87XX.cs	Mon May 24 15:27:46 2010 +0000
     4.3 @@ -49,10 +49,9 @@
     4.4      private readonly ushort addressReg;
     4.5      private readonly ushort dataReg;
     4.6  
     4.7 -    private Sensor[] temperatures;
     4.8 +    private List<Sensor> voltages = new List<Sensor>(9);    
     4.9 +    private List<Sensor> temperatures = new List<Sensor>(3);    
    4.10      private Sensor[] fans;
    4.11 -    private Sensor[] voltages;
    4.12 -    private float[] voltageGains;
    4.13     
    4.14      // Consts
    4.15      private const byte ITE_VENDOR_ID = 0x90;
    4.16 @@ -79,7 +78,8 @@
    4.17        return value;
    4.18      }
    4.19  
    4.20 -    public IT87XX(Chip chip, ushort address) : base (chip) {
    4.21 +    public IT87XX(Chip chip, ushort address, Mainboard.Manufacturer 
    4.22 +      mainboardManufacturer, Mainboard.Model mainboardModel) : base (chip) {
    4.23        
    4.24        this.address = address;
    4.25        this.addressReg = (ushort)(address + ADDRESS_REGISTER_OFFSET);
    4.26 @@ -97,23 +97,125 @@
    4.27        if (!valid)
    4.28          return;
    4.29  
    4.30 -      temperatures = new Sensor[3];
    4.31 -      for (int i = 0; i < temperatures.Length; i++) 
    4.32 -        temperatures[i] = new Sensor("Temperature #" + (i + 1), i, null,
    4.33 -          SensorType.Temperature, this, new ParameterDescription[] {
    4.34 +      string[] temperatureLabels;
    4.35 +      List<Voltage> voltageConfigs = new List<Voltage>();
    4.36 +      switch (mainboardManufacturer) {
    4.37 +        case Mainboard.Manufacturer.DFI:
    4.38 +          switch (mainboardModel) {
    4.39 +            case Mainboard.Model.LP_BI_P45_T2RS_Elite:
    4.40 +              voltageConfigs.Add(new Voltage("CPU VCore", 0));
    4.41 +              voltageConfigs.Add(new Voltage("FSB VTT", 1));
    4.42 +              voltageConfigs.Add(new Voltage("+3.3V", 2));
    4.43 +              voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
    4.44 +              voltageConfigs.Add(new Voltage("+12V", 4, 30, 10, 0));
    4.45 +              voltageConfigs.Add(new Voltage("NB Core", 5));
    4.46 +              voltageConfigs.Add(new Voltage("VDIMM", 6));
    4.47 +              voltageConfigs.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0));
    4.48 +              voltageConfigs.Add(new Voltage("VBat", 8));
    4.49 +              temperatureLabels = new string[] {
    4.50 +                "CPU", "System", "Chipset" };
    4.51 +              break;
    4.52 +            case Mainboard.Model.LP_DK_P55_T3eH9:
    4.53 +              voltageConfigs.Add(new Voltage("CPU VCore", 0));
    4.54 +              voltageConfigs.Add(new Voltage("VTT", 1));
    4.55 +              voltageConfigs.Add(new Voltage("+3.3V", 2));
    4.56 +              voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
    4.57 +              voltageConfigs.Add(new Voltage("+12V", 4, 30, 10, 0));
    4.58 +              voltageConfigs.Add(new Voltage("CPU PLL", 5));
    4.59 +              voltageConfigs.Add(new Voltage("DRAM", 6));
    4.60 +              voltageConfigs.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0));
    4.61 +              voltageConfigs.Add(new Voltage("VBat", 8));
    4.62 +              temperatureLabels = new string[] {
    4.63 +                "Chipset", "CPU PWM", "CPU" };
    4.64 +              break;
    4.65 +            default:
    4.66 +              voltageConfigs.Add(new Voltage("CPU VCore", 0));
    4.67 +              voltageConfigs.Add(new Voltage("VTT", 1, true));
    4.68 +              voltageConfigs.Add(new Voltage("+3.3V", 2, true));
    4.69 +              voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
    4.70 +              voltageConfigs.Add(new Voltage("+12V", 4, 30, 10, 0, true));
    4.71 +              voltageConfigs.Add(new Voltage("Voltage #6", 5, true));
    4.72 +              voltageConfigs.Add(new Voltage("DRAM", 6, true));
    4.73 +              voltageConfigs.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
    4.74 +              voltageConfigs.Add(new Voltage("VBat", 8));
    4.75 +              temperatureLabels = new string[] {
    4.76 +                "Temperature #1", "Temperature #2", "Temperature #3" };
    4.77 +              break;
    4.78 +          }
    4.79 +          break;
    4.80 +
    4.81 +        case Mainboard.Manufacturer.Gigabyte:
    4.82 +          switch (mainboardModel) {            
    4.83 +            case Mainboard.Model.EP45_DS3R:
    4.84 +            case Mainboard.Model.P35_DS3:
    4.85 +              voltageConfigs.Add(new Voltage("CPU VCore", 0));
    4.86 +              voltageConfigs.Add(new Voltage("DRAM", 1));
    4.87 +              voltageConfigs.Add(new Voltage("+3.3V", 2));
    4.88 +              voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
    4.89 +              voltageConfigs.Add(new Voltage("+12V", 7, 27, 9.1f, 0));
    4.90 +              voltageConfigs.Add(new Voltage("VBat", 8));    
    4.91 +              break;
    4.92 +            case Mainboard.Model.GA_MA785GMT_UD2H:
    4.93 +              voltageConfigs.Add(new Voltage("CPU VCore", 0));
    4.94 +              voltageConfigs.Add(new Voltage("DRAM", 1));
    4.95 +              voltageConfigs.Add(new Voltage("+3.3V", 2));
    4.96 +              voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0));
    4.97 +              voltageConfigs.Add(new Voltage("+12V", 4, 27, 9.1f, 0));
    4.98 +              voltageConfigs.Add(new Voltage("VBat", 8));   
    4.99 +              break;
   4.100 +            default:
   4.101 +              voltageConfigs.Add(new Voltage("CPU VCore", 0));
   4.102 +              voltageConfigs.Add(new Voltage("DRAM", 1, true));
   4.103 +              voltageConfigs.Add(new Voltage("+3.3V", 2, true));              
   4.104 +              voltageConfigs.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   4.105 +              voltageConfigs.Add(new Voltage("Voltage #5", 4, true));
   4.106 +              voltageConfigs.Add(new Voltage("Voltage #6", 5, true));
   4.107 +              voltageConfigs.Add(new Voltage("Voltage #7", 6, true));
   4.108 +              voltageConfigs.Add(new Voltage("+12V", 7, 27, 9.1f, 0, true));
   4.109 +              voltageConfigs.Add(new Voltage("VBat", 8));              
   4.110 +              break;
   4.111 +          }
   4.112 +          temperatureLabels = new string[] { "System", "CPU" };
   4.113 +          break; 
   4.114 +
   4.115 +        default:
   4.116 +          voltageConfigs.Add(new Voltage("CPU VCore", 0));
   4.117 +          voltageConfigs.Add(new Voltage("Voltage #2", 1, true));
   4.118 +          voltageConfigs.Add(new Voltage("Voltage #3", 2, true));
   4.119 +          voltageConfigs.Add(new Voltage("Voltage #4", 3, true));
   4.120 +          voltageConfigs.Add(new Voltage("Voltage #5", 4, true));
   4.121 +          voltageConfigs.Add(new Voltage("Voltage #6", 5, true));
   4.122 +          voltageConfigs.Add(new Voltage("Voltage #7", 6, true));
   4.123 +          voltageConfigs.Add(new Voltage("Voltage #8", 7, true));
   4.124 +          voltageConfigs.Add(new Voltage("VBat", 8));
   4.125 +          temperatureLabels = new string[] {
   4.126 +            "Temperature #1", "Temperature #2", "Temperature #3" };
   4.127 +          break;
   4.128 +      }
   4.129 +
   4.130 +      string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
   4.131 +      foreach (Voltage voltage in voltageConfigs)
   4.132 +        voltages.Add(new Sensor(voltage.Name, voltage.Index, voltage.Hidden, 
   4.133 +          null, SensorType.Voltage, this, new ParameterDescription[] {
   4.134 +          new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
   4.135 +            formula, voltage.Ri),
   4.136 +          new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
   4.137 +            formula, voltage.Rf),
   4.138 +          new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
   4.139 +            formula, voltage.Vf)
   4.140 +          }));  
   4.141 +
   4.142 +      for (int i = 0; i < temperatureLabels.Length; i++)
   4.143 +        if (temperatureLabels[i] != null) {
   4.144 +          temperatures.Add(new Sensor(temperatureLabels[i], i, null,
   4.145 +            SensorType.Temperature, this, new ParameterDescription[] {
   4.146              new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
   4.147 -          });
   4.148 +          }));
   4.149 +        }
   4.150  
   4.151        fans = new Sensor[5];
   4.152        for (int i = 0; i < fans.Length; i++)
   4.153 -        fans[i] = new Sensor("Fan #" + (i + 1), i, SensorType.Fan, this);
   4.154 -
   4.155 -      voltageGains = new float[] { 
   4.156 -        1, 1, 1, (6.8f / 10 + 1), 1, 1, 1, 1, 1 };
   4.157 -
   4.158 -      voltages = new Sensor[2];
   4.159 -      voltages[0] = new Sensor("CPU VCore", 0, SensorType.Voltage, this);
   4.160 -      voltages[1] = new Sensor("Battery", 8, SensorType.Voltage, this);           
   4.161 +        fans[i] = new Sensor("Fan #" + (i + 1), i, SensorType.Fan, this);           
   4.162  
   4.163        available = true;
   4.164      }
   4.165 @@ -158,13 +260,14 @@
   4.166  
   4.167        foreach (Sensor sensor in voltages) {
   4.168          bool valid;
   4.169 -        int value = ReadByte(
   4.170 -          (byte)(VOLTAGE_BASE_REG + sensor.Index), out valid);
   4.171 +        float value = 0.001f * ((int)ReadByte(
   4.172 +          (byte)(VOLTAGE_BASE_REG + sensor.Index), out valid) << 4);
   4.173          if (!valid)
   4.174            continue;
   4.175  
   4.176 -        sensor.Value = voltageGains[sensor.Index] * 0.001f * (value << 4);
   4.177 -        if (sensor.Value > 0)
   4.178 +        sensor.Value = value + (value - sensor.Parameters[2].Value) *
   4.179 +          sensor.Parameters[0].Value / sensor.Parameters[1].Value;
   4.180 +        if (value > 0)
   4.181            ActivateSensor(sensor);        
   4.182        }
   4.183  
   4.184 @@ -197,6 +300,35 @@
   4.185            sensor.Value = null;
   4.186          }
   4.187        }      
   4.188 -    }   
   4.189 +    }
   4.190 +
   4.191 +    private class Voltage {
   4.192 +      public readonly string Name;
   4.193 +      public readonly int Index;
   4.194 +      public readonly float Ri;
   4.195 +      public readonly float Rf;
   4.196 +      public readonly float Vf;
   4.197 +      public readonly bool Hidden;
   4.198 +
   4.199 +      public Voltage(string name, int index) :
   4.200 +        this(name, index, 0, 1, 0, false) { }
   4.201 +
   4.202 +      public Voltage(string name, int index, bool hidden) :
   4.203 +        this(name, index, 0, 1, 0, hidden) { }
   4.204 +
   4.205 +      public Voltage(string name, int index, float ri, float rf, float vf) :
   4.206 +        this(name, index, ri, rf, vf, false) { }
   4.207 +
   4.208 +      public Voltage(string name, int index, float ri, float rf, float vf, 
   4.209 +        bool hidden) 
   4.210 +      {
   4.211 +        this.Name = name;
   4.212 +        this.Index = index;
   4.213 +        this.Ri = ri;
   4.214 +        this.Rf = rf;
   4.215 +        this.Vf = vf;
   4.216 +        this.Hidden = hidden;
   4.217 +      }
   4.218 +    }
   4.219    }
   4.220  }
     5.1 --- a/Hardware/LPC/LPCIO.cs	Sat May 22 15:51:59 2010 +0000
     5.2 +++ b/Hardware/LPC/LPCIO.cs	Mon May 24 15:27:46 2010 +0000
     5.3 @@ -119,7 +119,9 @@
     5.4        WinRing0.WriteIoPortByte(registerPort, 0xAA);
     5.5      }
     5.6  
     5.7 -    public LPCIO() {
     5.8 +    public LPCIO(Mainboard.Manufacturer mainboardManufacturer, 
     5.9 +      Mainboard.Model mainboardModel) 
    5.10 +    {
    5.11        if (!WinRing0.IsAvailable)
    5.12          return;
    5.13  
    5.14 @@ -351,7 +353,8 @@
    5.15              return;
    5.16            }
    5.17  
    5.18 -          IT87XX it87 = new IT87XX(chip, address);
    5.19 +          IT87XX it87 = new IT87XX(chip, address, mainboardManufacturer, 
    5.20 +            mainboardModel);
    5.21            if (it87.IsAvailable)
    5.22              hardware.Add(it87);
    5.23  
     6.1 --- a/Hardware/Mainboard/Mainboard.cs	Sat May 22 15:51:59 2010 +0000
     6.2 +++ b/Hardware/Mainboard/Mainboard.cs	Mon May 24 15:27:46 2010 +0000
     6.3 @@ -55,7 +55,7 @@
     6.4        if (smbios.Board != null) {
     6.5          if (smbios.Board.ProductName != null
     6.6            && smbios.Board.ProductName != "") {
     6.7 -          if (smbios.Board.Manufacturer == Manufacturer.Unkown)
     6.8 +          if (smbios.Board.Manufacturer == Manufacturer.Unknown)
     6.9              this.name = smbios.Board.ProductName;
    6.10            else
    6.11              this.name = smbios.Board.Manufacturer + " " +
    6.12 @@ -64,11 +64,13 @@
    6.13            this.name = smbios.Board.Manufacturer.ToString();
    6.14          }
    6.15        } else {
    6.16 -        this.name = Manufacturer.Unkown.ToString();
    6.17 +        this.name = Manufacturer.Unknown.ToString();
    6.18        }
    6.19  
    6.20        this.icon = Utilities.EmbeddedResources.GetImage("mainboard.png");
    6.21 -      this.lpcGroup = new LPCIO();
    6.22 +      this.lpcGroup = new LPCIO(
    6.23 +        smbios.Board != null ? smbios.Board.Manufacturer : Manufacturer.Unknown,
    6.24 +        smbios.Board != null ? smbios.Board.Model : Model.Unknown);
    6.25      }
    6.26  
    6.27      public string Name {
     7.1 --- a/Hardware/Mainboard/Manufacturer.cs	Sat May 22 15:51:59 2010 +0000
     7.2 +++ b/Hardware/Mainboard/Manufacturer.cs	Mon May 24 15:27:46 2010 +0000
     7.3 @@ -47,7 +47,7 @@
     7.4      Gigabyte,
     7.5      IBM,
     7.6      MSI,
     7.7 -    Unkown    
     7.8 +    Unknown    
     7.9    }
    7.10  
    7.11  }
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/Hardware/Mainboard/Model.cs	Mon May 24 15:27:46 2010 +0000
     8.3 @@ -0,0 +1,20 @@
     8.4 +using System;
     8.5 +using System.Collections.Generic;
     8.6 +using System.Text;
     8.7 +
     8.8 +namespace OpenHardwareMonitor.Hardware.Mainboard {
     8.9 +
    8.10 +  public enum Model {
    8.11 +    // DFI
    8.12 +    LP_BI_P45_T2RS_Elite,
    8.13 +    LP_DK_P55_T3eH9,    
    8.14 +
    8.15 +    // Gigabyte
    8.16 +    EP45_DS3R,
    8.17 +    GA_MA785GMT_UD2H,
    8.18 +    P35_DS3,
    8.19 +
    8.20 +    // Unknown
    8.21 +    Unknown    
    8.22 +  }
    8.23 +}
     9.1 --- a/Hardware/Mainboard/SMBIOS.cs	Sat May 22 15:51:59 2010 +0000
     9.2 +++ b/Hardware/Mainboard/SMBIOS.cs	Mon May 24 15:27:46 2010 +0000
     9.3 @@ -193,6 +193,7 @@
     9.4        private string version;
     9.5        private string serialNumber;
     9.6        private Manufacturer manufacturer;
     9.7 +      private Model model;
     9.8  
     9.9        public BaseBoardInformation(byte type, ushort handle, byte[] data,
    9.10          string[] strings)
    9.11 @@ -219,7 +220,22 @@
    9.12            case "MICRO-STAR INTERNATIONAL CO.,LTD":
    9.13              manufacturer = Manufacturer.MSI; break;
    9.14            default:
    9.15 -            manufacturer = Manufacturer.Unkown; break;
    9.16 +            manufacturer = Manufacturer.Unknown; break;
    9.17 +        }
    9.18 +
    9.19 +        switch (productName) {
    9.20 +          case "LP BI P45-T2RS Elite":
    9.21 +            model = Model.LP_BI_P45_T2RS_Elite; break;
    9.22 +          case "LP DK P55-T3eH9":
    9.23 +            model = Model.LP_DK_P55_T3eH9; break;
    9.24 +          case "EP45-DS3R":
    9.25 +            model = Model.EP45_DS3R; break;
    9.26 +          case "GA-MA785GMT-UD2H":
    9.27 +            model = Model.GA_MA785GMT_UD2H; break;
    9.28 +          case "P35-DS3":
    9.29 +            model = Model.P35_DS3; break;
    9.30 +          default:
    9.31 +            model = Model.Unknown; break;
    9.32          }
    9.33        }
    9.34  
    9.35 @@ -233,6 +249,8 @@
    9.36  
    9.37        public Manufacturer Manufacturer { get { return manufacturer; } }
    9.38  
    9.39 +      public Model Model { get { return model; } }
    9.40 +
    9.41      }
    9.42    }
    9.43  }
    10.1 --- a/OpenHardwareMonitor.csproj	Sat May 22 15:51:59 2010 +0000
    10.2 +++ b/OpenHardwareMonitor.csproj	Mon May 24 15:27:46 2010 +0000
    10.3 @@ -99,6 +99,7 @@
    10.4      <Compile Include="Hardware\LPC\LPCHardware.cs" />
    10.5      <Compile Include="Hardware\Mainboard\Mainboard.cs" />
    10.6      <Compile Include="Hardware\Mainboard\MainboardGroup.cs" />
    10.7 +    <Compile Include="Hardware\Mainboard\Model.cs" />
    10.8      <Compile Include="Hardware\Mainboard\Manufacturer.cs" />
    10.9      <Compile Include="Hardware\Parameter.cs" />
   10.10      <Compile Include="Hardware\Mainboard\SMBIOS.cs" />