Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Tue, 21 Sep 2010 20:32:36 +0000
changeset 195 0ee888c485d5
parent 182 4801e9eaf979
child 202 551243a66b32
permissions -rw-r--r--
Refactored some of the hardware monitoring code and fixed a few code inspection warnings.
     1 /*
     2   
     3   Version: MPL 1.1/GPL 2.0/LGPL 2.1
     4 
     5   The contents of this file are subject to the Mozilla Public License Version
     6   1.1 (the "License"); you may not use this file except in compliance with
     7   the License. You may obtain a copy of the License at
     8  
     9   http://www.mozilla.org/MPL/
    10 
    11   Software distributed under the License is distributed on an "AS IS" basis,
    12   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
    13   for the specific language governing rights and limitations under the License.
    14 
    15   The Original Code is the Open Hardware Monitor code.
    16 
    17   The Initial Developer of the Original Code is 
    18   Michael Möller <m.moeller@gmx.ch>.
    19   Portions created by the Initial Developer are Copyright (C) 2009-2010
    20   the Initial Developer. All Rights Reserved.
    21 
    22   Contributor(s):
    23 
    24   Alternatively, the contents of this file may be used under the terms of
    25   either the GNU General Public License Version 2 or later (the "GPL"), or
    26   the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
    27   in which case the provisions of the GPL or the LGPL are applicable instead
    28   of those above. If you wish to allow use of your version of this file only
    29   under the terms of either the GPL or the LGPL, and not to allow others to
    30   use your version of this file under the terms of the MPL, indicate your
    31   decision by deleting the provisions above and replace them with the notice
    32   and other provisions required by the GPL or the LGPL. If you do not delete
    33   the provisions above, a recipient may use your version of this file under
    34   the terms of any one of the MPL, the GPL or the LGPL.
    35  
    36 */
    37 
    38 using System.Collections.Generic;
    39 using System.Globalization;
    40 using OpenHardwareMonitor.Hardware.LPC;
    41 
    42 namespace OpenHardwareMonitor.Hardware.Mainboard {
    43   internal class SuperIOHardware : Hardware {
    44 
    45     private readonly Mainboard mainboard;
    46     private readonly ISuperIO superIO;
    47     private readonly string name;
    48 
    49     private readonly List<Sensor> voltages = new List<Sensor>();
    50     private readonly List<Sensor> temperatures = new List<Sensor>();
    51     private readonly List<Sensor> fans = new List<Sensor>();
    52 
    53 
    54     public SuperIOHardware(Mainboard mainboard, ISuperIO superIO, 
    55       Manufacturer manufacturer, Model model, ISettings settings) 
    56     {
    57       this.mainboard = mainboard;
    58       this.superIO = superIO;
    59       this.name = ChipName.GetName(superIO.Chip);
    60 
    61       List<Voltage> v = new List<Voltage>();
    62       List<Temperature> t = new List<Temperature>();
    63       List<Fan> f = new List<Fan>();
    64 
    65       switch (superIO.Chip) {
    66         case Chip.IT8712F:
    67         case Chip.IT8716F:
    68         case Chip.IT8718F:
    69         case Chip.IT8720F: 
    70         case Chip.IT8726F:
    71           switch (manufacturer) {
    72             case Manufacturer.ASUS:
    73               switch (model) {
    74                 case Model.Crosshair_III_Formula: // IT8720F
    75                   v.Add(new Voltage("VBat", 8));
    76                   t.Add(new Temperature("CPU", 0));
    77                   for (int i = 0; i < superIO.Fans.Length; i++)
    78                     f.Add(new Fan("Fan #" + (i + 1), i));
    79                   break;
    80                 case Model.M2N_SLI_DELUXE:                
    81                   v.Add(new Voltage("CPU VCore", 0));
    82                   v.Add(new Voltage("+3.3V", 1));
    83                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
    84                   v.Add(new Voltage("+12V", 4, 30, 10));
    85                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
    86                   v.Add(new Voltage("VBat", 8));
    87                   t.Add(new Temperature("CPU", 0));
    88                   t.Add(new Temperature("Motherboard", 1));
    89                   f.Add(new Fan("CPU Fan", 0));
    90                   f.Add(new Fan("Chassis Fan #1", 1));
    91                   f.Add(new Fan("Power Fan", 2));
    92                   break;
    93                 case Model.M4A79XTD_EVO: // IT8720F           
    94                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
    95                   v.Add(new Voltage("VBat", 8));
    96                   t.Add(new Temperature("CPU", 0));
    97                   t.Add(new Temperature("Motherboard", 1));
    98                   f.Add(new Fan("CPU Fan", 0));
    99                   f.Add(new Fan("Chassis Fan #1", 1));
   100                   f.Add(new Fan("Chassis Fan #2", 2));
   101                   break;
   102                 default:
   103                   v.Add(new Voltage("CPU VCore", 0));
   104                   v.Add(new Voltage("Voltage #2", 1, true));
   105                   v.Add(new Voltage("Voltage #3", 2, true));
   106                   v.Add(new Voltage("Voltage #4", 3, true));
   107                   v.Add(new Voltage("Voltage #5", 4, true));
   108                   v.Add(new Voltage("Voltage #6", 5, true));
   109                   v.Add(new Voltage("Voltage #7", 6, true));
   110                   v.Add(new Voltage("Voltage #8", 7, true));
   111                   v.Add(new Voltage("VBat", 8));
   112                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   113                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   114                   for (int i = 0; i < superIO.Fans.Length; i++)
   115                     f.Add(new Fan("Fan #" + (i + 1), i));
   116                   break;
   117               }
   118               break;
   119             case Manufacturer.DFI:
   120               switch (model) {
   121                 case Model.LP_BI_P45_T2RS_Elite: // IT8718F
   122                   v.Add(new Voltage("CPU VCore", 0));
   123                   v.Add(new Voltage("FSB VTT", 1));
   124                   v.Add(new Voltage("+3.3V", 2));
   125                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   126                   v.Add(new Voltage("+12V", 4, 30, 10));
   127                   v.Add(new Voltage("NB Core", 5));
   128                   v.Add(new Voltage("VDIMM", 6));
   129                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   130                   v.Add(new Voltage("VBat", 8));
   131                   t.Add(new Temperature("CPU", 0));
   132                   t.Add(new Temperature("System", 1));
   133                   t.Add(new Temperature("Chipset", 2));
   134                   f.Add(new Fan("Fan #1", 0));
   135                   f.Add(new Fan("Fan #2", 1));
   136                   f.Add(new Fan("Fan #3", 2));
   137                   break;
   138                 case Model.LP_DK_P55_T3eH9: // IT8720F
   139                   v.Add(new Voltage("CPU VCore", 0));
   140                   v.Add(new Voltage("VTT", 1));
   141                   v.Add(new Voltage("+3.3V", 2));
   142                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   143                   v.Add(new Voltage("+12V", 4, 30, 10));
   144                   v.Add(new Voltage("CPU PLL", 5));
   145                   v.Add(new Voltage("DRAM", 6));
   146                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   147                   v.Add(new Voltage("VBat", 8));
   148                   t.Add(new Temperature("Chipset", 0));
   149                   t.Add(new Temperature("CPU PWM", 1));
   150                   t.Add(new Temperature("CPU", 2));
   151                   f.Add(new Fan("Fan #1", 0));
   152                   f.Add(new Fan("Fan #2", 1));
   153                   f.Add(new Fan("Fan #3", 2));
   154                   break;
   155                 default:
   156                   v.Add(new Voltage("CPU VCore", 0));
   157                   v.Add(new Voltage("VTT", 1, true));
   158                   v.Add(new Voltage("+3.3V", 2, true));
   159                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   160                   v.Add(new Voltage("+12V", 4, 30, 10, 0, true));
   161                   v.Add(new Voltage("Voltage #6", 5, true));
   162                   v.Add(new Voltage("DRAM", 6, true));
   163                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
   164                   v.Add(new Voltage("VBat", 8));
   165                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   166                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   167                   for (int i = 0; i < superIO.Fans.Length; i++)
   168                     f.Add(new Fan("Fan #" + (i + 1), i));
   169                   break;
   170               }
   171               break;
   172 
   173             case Manufacturer.Gigabyte:
   174               switch (model) {
   175                 case Model._965P_S3: // IT8718F
   176                   v.Add(new Voltage("CPU VCore", 0));
   177                   v.Add(new Voltage("DRAM", 1));
   178                   v.Add(new Voltage("+3.3V", 2));
   179                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   180                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   181                   v.Add(new Voltage("VBat", 8));
   182                   t.Add(new Temperature("System", 0));
   183                   t.Add(new Temperature("CPU", 1));
   184                   f.Add(new Fan("CPU Fan", 0));
   185                   f.Add(new Fan("System Fan", 1));
   186                   break;
   187                 case Model.EP45_DS3R: // IT8718F
   188                 case Model.EP45_UD3R: 
   189                 case Model.X38_DS5:    
   190                   v.Add(new Voltage("CPU VCore", 0));
   191                   v.Add(new Voltage("DRAM", 1));
   192                   v.Add(new Voltage("+3.3V", 2));
   193                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   194                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   195                   v.Add(new Voltage("VBat", 8));
   196                   t.Add(new Temperature("System", 0));
   197                   t.Add(new Temperature("CPU", 1));
   198                   f.Add(new Fan("CPU Fan", 0));
   199                   f.Add(new Fan("System Fan #2", 1));
   200                   f.Add(new Fan("Power Fan", 2));
   201                   f.Add(new Fan("System Fan #1", 3));
   202                   break;
   203                 case Model.EX58_EXTREME: // IT8720F 
   204                   v.Add(new Voltage("CPU VCore", 0));
   205                   v.Add(new Voltage("DRAM", 1));
   206                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   207                   v.Add(new Voltage("VBat", 8));
   208                   t.Add(new Temperature("System", 0));
   209                   t.Add(new Temperature("CPU", 1));
   210                   t.Add(new Temperature("Northbridge", 2));
   211                   f.Add(new Fan("CPU Fan", 0));
   212                   f.Add(new Fan("System Fan #2", 1));
   213                   f.Add(new Fan("Power Fan", 2));
   214                   f.Add(new Fan("System Fan #1", 3));
   215                   break;
   216                 case Model.P35_DS3: // IT8718F 
   217                 case Model.P35_DS3L: // IT8718F
   218                   v.Add(new Voltage("CPU VCore", 0));
   219                   v.Add(new Voltage("DRAM", 1));
   220                   v.Add(new Voltage("+3.3V", 2));
   221                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   222                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   223                   v.Add(new Voltage("VBat", 8));
   224                   t.Add(new Temperature("System", 0));
   225                   t.Add(new Temperature("CPU", 1));
   226                   f.Add(new Fan("CPU Fan", 0));
   227                   f.Add(new Fan("System Fan #1", 1));
   228                   f.Add(new Fan("System Fan #2", 2));
   229                   f.Add(new Fan("Power Fan", 3));
   230                   break;
   231                 case Model.P55_UD4: // IT8720F
   232                 case Model.P55M_UD4: // IT8720F
   233                   v.Add(new Voltage("CPU VCore", 0));
   234                   v.Add(new Voltage("DRAM", 1));
   235                   v.Add(new Voltage("+3.3V", 2));
   236                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   237                   v.Add(new Voltage("+12V", 5, 27, 9.1f));
   238                   v.Add(new Voltage("VBat", 8));
   239                   t.Add(new Temperature("System", 0));
   240                   t.Add(new Temperature("CPU", 2));
   241                   f.Add(new Fan("CPU Fan", 0));
   242                   f.Add(new Fan("System Fan #2", 1));
   243                   f.Add(new Fan("Power Fan", 2));
   244                   f.Add(new Fan("System Fan #1", 3));
   245                   break;
   246                 case Model.GA_MA770T_UD3: // IT8720F
   247                   v.Add(new Voltage("CPU VCore", 0));
   248                   v.Add(new Voltage("DRAM", 1));
   249                   v.Add(new Voltage("+3.3V", 2));
   250                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   251                   v.Add(new Voltage("+12V", 4, 27, 9.1f));
   252                   v.Add(new Voltage("VBat", 8));
   253                   t.Add(new Temperature("System", 0));
   254                   t.Add(new Temperature("CPU", 1));
   255                   f.Add(new Fan("CPU Fan", 0));
   256                   f.Add(new Fan("System Fan #1", 1));
   257                   f.Add(new Fan("System Fan #2", 2));
   258                   f.Add(new Fan("Power Fan", 3));
   259                   break;
   260                 case Model.GA_MA785GMT_UD2H: // IT8718F
   261                   v.Add(new Voltage("CPU VCore", 0));
   262                   v.Add(new Voltage("DRAM", 1));
   263                   v.Add(new Voltage("+3.3V", 2));
   264                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   265                   v.Add(new Voltage("+12V", 4, 27, 9.1f));
   266                   v.Add(new Voltage("VBat", 8));
   267                   t.Add(new Temperature("System", 0));
   268                   t.Add(new Temperature("CPU", 1));
   269                   f.Add(new Fan("CPU Fan", 0));
   270                   f.Add(new Fan("System Fan", 1));
   271                   f.Add(new Fan("NB Fan", 2));
   272                   break;
   273                 case Model.X58A_UD3R: // IT8720F 
   274                   v.Add(new Voltage("CPU VCore", 0));
   275                   v.Add(new Voltage("DRAM", 1));
   276                   v.Add(new Voltage("+3.3V", 2));
   277                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   278                   v.Add(new Voltage("+12V", 5, 27, 9.1f));
   279                   v.Add(new Voltage("VBat", 8));
   280                   t.Add(new Temperature("System", 0));
   281                   t.Add(new Temperature("CPU", 1));
   282                   t.Add(new Temperature("Northbridge", 2));
   283                   f.Add(new Fan("CPU Fan", 0));
   284                   f.Add(new Fan("System Fan #2", 1));
   285                   f.Add(new Fan("Power Fan", 2));
   286                   f.Add(new Fan("System Fan #1", 3));
   287                   break;
   288                 default:
   289                   v.Add(new Voltage("CPU VCore", 0));
   290                   v.Add(new Voltage("DRAM", 1, true));
   291                   v.Add(new Voltage("+3.3V", 2, true));
   292                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   293                   v.Add(new Voltage("Voltage #5", 4, true));
   294                   v.Add(new Voltage("Voltage #6", 5, true));
   295                   v.Add(new Voltage("Voltage #7", 6, true));
   296                   v.Add(new Voltage("+12V", 7, 27, 9.1f, 0, true));
   297                   v.Add(new Voltage("VBat", 8));
   298                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   299                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   300                   for (int i = 0; i < superIO.Fans.Length; i++)
   301                     f.Add(new Fan("Fan #" + (i + 1), i));
   302                   break;
   303               }
   304               break;
   305 
   306             default:
   307               v.Add(new Voltage("CPU VCore", 0));
   308               v.Add(new Voltage("Voltage #2", 1, true));
   309               v.Add(new Voltage("Voltage #3", 2, true));
   310               v.Add(new Voltage("Voltage #4", 3, true));
   311               v.Add(new Voltage("Voltage #5", 4, true));
   312               v.Add(new Voltage("Voltage #6", 5, true));
   313               v.Add(new Voltage("Voltage #7", 6, true));
   314               v.Add(new Voltage("Voltage #8", 7, true));
   315               v.Add(new Voltage("VBat", 8));
   316               for (int i = 0; i < superIO.Temperatures.Length; i++)
   317                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   318               for (int i = 0; i < superIO.Fans.Length; i++)
   319                 f.Add(new Fan("Fan #" + (i + 1), i));
   320               break;
   321           }
   322           break;
   323 
   324         case Chip.IT8721F:
   325           switch (manufacturer) {
   326             case Manufacturer.ECS:
   327               switch (model) {
   328                 case Model.A890GXM_A: // IT8721F
   329                   v.Add(new Voltage("CPU VCore", 0));
   330                   v.Add(new Voltage("VDIMM", 1));
   331                   v.Add(new Voltage("NB Voltage", 2));
   332                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10));
   333                   // v.Add(new Voltage("VDIMM", 6, true));
   334                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   335                   v.Add(new Voltage("VBat", 8, 10, 10));
   336                   t.Add(new Temperature("CPU", 0));
   337                   t.Add(new Temperature("System", 1));
   338                   t.Add(new Temperature("Northbridge", 2));
   339                   f.Add(new Fan("CPU Fan", 0));
   340                   f.Add(new Fan("System Fan", 1));
   341                   f.Add(new Fan("Power Fan", 2));
   342                   break;
   343                 default:
   344                   v.Add(new Voltage("Voltage #1", 0, true));
   345                   v.Add(new Voltage("Voltage #2", 1, true));
   346                   v.Add(new Voltage("Voltage #3", 2, true));
   347                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
   348                   v.Add(new Voltage("Voltage #5", 4, true));
   349                   v.Add(new Voltage("Voltage #6", 5, true));
   350                   v.Add(new Voltage("Voltage #7", 6, true));
   351                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   352                   v.Add(new Voltage("VBat", 8, 10, 10));
   353                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   354                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   355                   for (int i = 0; i < superIO.Fans.Length; i++)
   356                     f.Add(new Fan("Fan #" + (i + 1), i));
   357                   break;
   358               }
   359               break;
   360             default:
   361               v.Add(new Voltage("Voltage #1", 0, true));
   362               v.Add(new Voltage("Voltage #2", 1, true));
   363               v.Add(new Voltage("Voltage #3", 2, true));
   364               v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
   365               v.Add(new Voltage("Voltage #5", 4, true));
   366               v.Add(new Voltage("Voltage #6", 5, true));
   367               v.Add(new Voltage("Voltage #7", 6, true));
   368               v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   369               v.Add(new Voltage("VBat", 8, 10, 10));
   370               for (int i = 0; i < superIO.Temperatures.Length; i++)
   371                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   372               for (int i = 0; i < superIO.Fans.Length; i++)
   373                 f.Add(new Fan("Fan #" + (i + 1), i));
   374               break;
   375           }
   376           break;
   377           
   378         case Chip.F71858:
   379           v.Add(new Voltage("VCC3V", 0, 150, 150));
   380           v.Add(new Voltage("VSB3V", 1, 150, 150));
   381           v.Add(new Voltage("Battery", 2, 150, 150));
   382           for (int i = 0; i < superIO.Temperatures.Length; i++)
   383             t.Add(new Temperature("Temperature #" + (i + 1), i));
   384           for (int i = 0; i < superIO.Fans.Length; i++)
   385             f.Add(new Fan("Fan #" + (i + 1), i));
   386           break;
   387         case Chip.F71862: 
   388         case Chip.F71869: 
   389         case Chip.F71882:
   390         case Chip.F71889ED: 
   391         case Chip.F71889F:
   392           switch (manufacturer) {
   393             case Manufacturer.EVGA:
   394               switch (model) {
   395                 case Model.X58_SLI_Classified: // F71882 
   396                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   397                   v.Add(new Voltage("CPU VCore", 1, 47, 100));
   398                   v.Add(new Voltage("DIMM", 2, 47, 100));
   399                   v.Add(new Voltage("CPU VTT", 3, 24, 100));
   400                   v.Add(new Voltage("IOH Vcore", 4, 24, 100));
   401                   v.Add(new Voltage("+5V", 5, 51, 12));
   402                   v.Add(new Voltage("+12V", 6, 56, 6.8f));
   403                   v.Add(new Voltage("3VSB", 7, 150, 150));
   404                   v.Add(new Voltage("VBat", 8, 150, 150));
   405                   t.Add(new Temperature("CPU", 0));
   406                   t.Add(new Temperature("VREG", 1));
   407                   t.Add(new Temperature("System", 2));
   408                   f.Add(new Fan("CPU Fan", 0));
   409                   f.Add(new Fan("Power Fan", 1));
   410                   f.Add(new Fan("Chassis Fan", 2));
   411                   break;
   412                 default:
   413                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   414                   v.Add(new Voltage("CPU VCore", 1));
   415                   v.Add(new Voltage("Voltage #3", 2, true));
   416                   v.Add(new Voltage("Voltage #4", 3, true));
   417                   v.Add(new Voltage("Voltage #5", 4, true));
   418                   v.Add(new Voltage("Voltage #6", 5, true));
   419                   v.Add(new Voltage("Voltage #7", 6, true));
   420                   v.Add(new Voltage("VSB3V", 7, 150, 150));
   421                   v.Add(new Voltage("VBat", 8, 150, 150));
   422                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   423                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   424                   for (int i = 0; i < superIO.Fans.Length; i++)
   425                     f.Add(new Fan("Fan #" + (i + 1), i));
   426                   break;
   427               }
   428               break;
   429             default:
   430               v.Add(new Voltage("VCC3V", 0, 150, 150));
   431               v.Add(new Voltage("CPU VCore", 1));
   432               v.Add(new Voltage("Voltage #3", 2, true));
   433               v.Add(new Voltage("Voltage #4", 3, true));
   434               v.Add(new Voltage("Voltage #5", 4, true));
   435               v.Add(new Voltage("Voltage #6", 5, true));
   436               v.Add(new Voltage("Voltage #7", 6, true));
   437               v.Add(new Voltage("VSB3V", 7, 150, 150));
   438               v.Add(new Voltage("VBat", 8, 150, 150));
   439               for (int i = 0; i < superIO.Temperatures.Length; i++)
   440                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   441               for (int i = 0; i < superIO.Fans.Length; i++)
   442                 f.Add(new Fan("Fan #" + (i + 1), i));
   443               break;
   444           }
   445           break;
   446 
   447         case Chip.W83627EHF:          
   448           v.Add(new Voltage("CPU VCore", 0));
   449           v.Add(new Voltage("Voltage #2", 1, true));
   450           v.Add(new Voltage("AVCC", 2, 34, 34));
   451           v.Add(new Voltage("3VCC", 3, 34, 34));
   452           v.Add(new Voltage("Voltage #5", 4, true));
   453           v.Add(new Voltage("Voltage #6", 5, true));
   454           v.Add(new Voltage("Voltage #7", 6, true));
   455           v.Add(new Voltage("3VSB", 7, 34, 34));
   456           v.Add(new Voltage("VBAT", 8, 34, 34));
   457           v.Add(new Voltage("Voltage #10", 9, true));
   458           t.Add(new Temperature("CPU", 0));
   459           t.Add(new Temperature("Auxiliary", 1));
   460           t.Add(new Temperature("System", 2));
   461           f.Add(new Fan("System Fan", 0));
   462           f.Add(new Fan("CPU Fan", 1));
   463           f.Add(new Fan("Auxiliary Fan", 2));
   464           f.Add(new Fan("CPU Fan #2", 3));
   465           f.Add(new Fan("Auxiliary Fan #2", 4));
   466           break;
   467         case Chip.W83627DHG: 
   468         case Chip.W83627DHGP:                      
   469         case Chip.W83667HG:
   470         case Chip.W83667HGB:
   471           switch (manufacturer) {
   472             case Manufacturer.ASRock:
   473               switch (model) {
   474                 case Model._880GMH_USB3: // W83627DHG-P
   475                   v.Add(new Voltage("CPU VCore", 0));
   476                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   477                   v.Add(new Voltage("+5V", 5, 15, 7.5f));
   478                   v.Add(new Voltage("+12V", 6, 56, 10));
   479                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   480                   v.Add(new Voltage("VBAT", 8, 34, 34));
   481                   t.Add(new Temperature("CPU", 0));
   482                   t.Add(new Temperature("Motherboard", 2));
   483                   f.Add(new Fan("Chassis Fan", 0));
   484                   f.Add(new Fan("CPU Fan", 1));
   485                   f.Add(new Fan("Power Fan", 2));
   486                   break;
   487                 default:
   488                   v.Add(new Voltage("CPU VCore", 0));
   489                   v.Add(new Voltage("Voltage #2", 1, true));
   490                   v.Add(new Voltage("AVCC", 2, 34, 34));
   491                   v.Add(new Voltage("3VCC", 3, 34, 34));
   492                   v.Add(new Voltage("Voltage #5", 4, true));
   493                   v.Add(new Voltage("Voltage #6", 5, true));
   494                   v.Add(new Voltage("Voltage #7", 6, true));
   495                   v.Add(new Voltage("3VSB", 7, 34, 34));
   496                   v.Add(new Voltage("VBAT", 8, 34, 34));
   497                   t.Add(new Temperature("CPU", 0));
   498                   t.Add(new Temperature("Auxiliary", 1));
   499                   t.Add(new Temperature("System", 2));
   500                   f.Add(new Fan("System Fan", 0));
   501                   f.Add(new Fan("CPU Fan", 1));
   502                   f.Add(new Fan("Auxiliary Fan", 2));
   503                   f.Add(new Fan("CPU Fan #2", 3));
   504                   f.Add(new Fan("Auxiliary Fan #2", 4));
   505                   break;
   506               }
   507               break;
   508             case Manufacturer.ASUS:
   509               switch (model) {
   510                 case Model.P6X58D_E: // W83667HG                 
   511                 case Model.Rampage_II_GENE: // W83667HG 
   512                   v.Add(new Voltage("CPU VCore", 0));
   513                   v.Add(new Voltage("+12V", 1, 11.5f, 1.91f));
   514                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   515                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   516                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   517                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   518                   v.Add(new Voltage("VBAT", 8, 34, 34));
   519                   t.Add(new Temperature("CPU", 0));
   520                   t.Add(new Temperature("Motherboard", 2));
   521                   f.Add(new Fan("Chassis Fan #1", 0));
   522                   f.Add(new Fan("CPU Fan", 1));
   523                   f.Add(new Fan("Power Fan", 2));
   524                   f.Add(new Fan("Chassis Fan #2", 3));
   525                   f.Add(new Fan("Chassis Fan #3", 4));
   526                   break;
   527                 case Model.Rampage_Extreme: // W83667HG 
   528                   v.Add(new Voltage("CPU VCore", 0));
   529                   v.Add(new Voltage("+12V", 1, 12, 2));
   530                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   531                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   532                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   533                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   534                   v.Add(new Voltage("VBAT", 8, 34, 34));
   535                   t.Add(new Temperature("CPU", 0));
   536                   t.Add(new Temperature("Motherboard", 2));
   537                   f.Add(new Fan("Chassis Fan #1", 0));
   538                   f.Add(new Fan("CPU Fan", 1));
   539                   f.Add(new Fan("Power Fan", 2));
   540                   f.Add(new Fan("Chassis Fan #2", 3));
   541                   f.Add(new Fan("Chassis Fan #3", 4));
   542                   break;
   543                 default:
   544                   v.Add(new Voltage("CPU VCore", 0));
   545                   v.Add(new Voltage("Voltage #2", 1, true));
   546                   v.Add(new Voltage("AVCC", 2, 34, 34));
   547                   v.Add(new Voltage("3VCC", 3, 34, 34));
   548                   v.Add(new Voltage("Voltage #5", 4, true));
   549                   v.Add(new Voltage("Voltage #6", 5, true));
   550                   v.Add(new Voltage("Voltage #7", 6, true));
   551                   v.Add(new Voltage("3VSB", 7, 34, 34));
   552                   v.Add(new Voltage("VBAT", 8, 34, 34));
   553                   t.Add(new Temperature("CPU", 0));
   554                   t.Add(new Temperature("Auxiliary", 1));
   555                   t.Add(new Temperature("System", 2));
   556                   f.Add(new Fan("System Fan", 0));
   557                   f.Add(new Fan("CPU Fan", 1));
   558                   f.Add(new Fan("Auxiliary Fan", 2));
   559                   f.Add(new Fan("CPU Fan #2", 3));
   560                   f.Add(new Fan("Auxiliary Fan #2", 4));
   561                   break;
   562               }
   563               break;
   564             default:
   565               v.Add(new Voltage("CPU VCore", 0));
   566               v.Add(new Voltage("Voltage #2", 1, true));
   567               v.Add(new Voltage("AVCC", 2, 34, 34));
   568               v.Add(new Voltage("3VCC", 3, 34, 34));
   569               v.Add(new Voltage("Voltage #5", 4, true));
   570               v.Add(new Voltage("Voltage #6", 5, true));
   571               v.Add(new Voltage("Voltage #7", 6, true));
   572               v.Add(new Voltage("3VSB", 7, 34, 34));
   573               v.Add(new Voltage("VBAT", 8, 34, 34));
   574               t.Add(new Temperature("CPU", 0));
   575               t.Add(new Temperature("Auxiliary", 1));
   576               t.Add(new Temperature("System", 2));
   577               f.Add(new Fan("System Fan", 0));
   578               f.Add(new Fan("CPU Fan", 1));
   579               f.Add(new Fan("Auxiliary Fan", 2));
   580               f.Add(new Fan("CPU Fan #2", 3));
   581               f.Add(new Fan("Auxiliary Fan #2", 4));
   582               break;
   583           } 
   584           break;
   585         case Chip.W83627HF: 
   586         case Chip.W83627THF: 
   587         case Chip.W83687THF:
   588           v.Add(new Voltage("CPU VCore", 0));
   589           v.Add(new Voltage("Voltage #2", 1, true));
   590           v.Add(new Voltage("Voltage #3", 2, true));
   591           v.Add(new Voltage("AVCC", 3, 34, 51));
   592           v.Add(new Voltage("Voltage #5", 4, true));
   593           v.Add(new Voltage("5VSB", 5, 34, 51));
   594           v.Add(new Voltage("VBAT", 6));
   595           t.Add(new Temperature("CPU", 0));
   596           t.Add(new Temperature("Auxiliary", 1));
   597           t.Add(new Temperature("System", 2));
   598           f.Add(new Fan("System Fan", 0));
   599           f.Add(new Fan("CPU Fan", 1));
   600           f.Add(new Fan("Auxiliary Fan", 2));
   601           break;
   602         default:
   603           for (int i = 0; i < superIO.Voltages.Length; i++)
   604             v.Add(new Voltage("Voltage #" + (i + 1), i, true));
   605           for (int i = 0; i < superIO.Temperatures.Length; i++)
   606             t.Add(new Temperature("Temperature #" + (i + 1), i));
   607           for (int i = 0; i < superIO.Fans.Length; i++)
   608             f.Add(new Fan("Fan #" + (i + 1), i));
   609           break;
   610       }
   611 
   612       const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
   613       foreach (Voltage voltage in v) 
   614         if (voltage.Index < superIO.Voltages.Length) {
   615           Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
   616             voltage.Hidden, SensorType.Voltage, this, new [] {
   617             new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
   618               formula, voltage.Ri),
   619             new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
   620               formula, voltage.Rf),
   621             new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
   622               formula, voltage.Vf)
   623             }, settings);
   624           voltages.Add(sensor);
   625       }
   626 
   627       foreach (Temperature temperature in t) 
   628         if (temperature.Index < superIO.Temperatures.Length) {
   629         Sensor sensor = new Sensor(temperature.Name, temperature.Index,
   630           SensorType.Temperature, this, new [] {
   631           new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
   632         }, settings);
   633         temperatures.Add(sensor);
   634       }
   635 
   636       foreach (Fan fan in f)
   637         if (fan.Index < superIO.Fans.Length) {
   638           Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
   639             this, settings);
   640           fans.Add(sensor);
   641         }
   642     }
   643 
   644     public override Identifier Identifier {
   645       get { 
   646         return new Identifier("lpc", 
   647           superIO.Chip.ToString().ToLower(CultureInfo.InvariantCulture)); 
   648       }
   649     }
   650 
   651     public override HardwareType HardwareType {
   652       get { return HardwareType.SuperIO; }
   653     }
   654 
   655     public override IHardware Parent {
   656       get { return mainboard; }
   657     }
   658 
   659     public override string Name {
   660       get { return name; }
   661     }
   662 
   663     public override string GetReport() {
   664       return superIO.GetReport();
   665     }
   666 
   667     public override void Update() {
   668       superIO.Update();
   669 
   670       foreach (Sensor sensor in voltages) {
   671         float? value = superIO.Voltages[sensor.Index];
   672         if (value.HasValue) {
   673           sensor.Value = value + (value - sensor.Parameters[2].Value) *
   674             sensor.Parameters[0].Value / sensor.Parameters[1].Value;
   675           ActivateSensor(sensor);
   676         }
   677       }
   678 
   679       foreach (Sensor sensor in temperatures) {
   680         float? value = superIO.Temperatures[sensor.Index];
   681         if (value.HasValue) {
   682           sensor.Value = value + sensor.Parameters[0].Value;
   683           ActivateSensor(sensor);
   684         }
   685       }
   686 
   687       foreach (Sensor sensor in fans) {
   688         float? value = superIO.Fans[sensor.Index];
   689         if (value.HasValue) {
   690           sensor.Value = value;
   691           if (value.Value > 0)
   692             ActivateSensor(sensor);
   693         }
   694       }
   695     }
   696 
   697     private class Voltage {
   698       public readonly string Name;
   699       public readonly int Index;
   700       public readonly float Ri;
   701       public readonly float Rf;
   702       public readonly float Vf;
   703       public readonly bool Hidden;
   704 
   705       public Voltage(string name, int index, bool hidden) :
   706         this(name, index, 0, 1, 0, hidden) { }
   707 
   708       public Voltage(string name, int index, 
   709         float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
   710       {
   711         this.Name = name;
   712         this.Index = index;
   713         this.Ri = ri;
   714         this.Rf = rf;
   715         this.Vf = vf;
   716         this.Hidden = hidden;
   717       }
   718     }
   719 
   720     private class Temperature {
   721       public readonly string Name;
   722       public readonly int Index;
   723 
   724       public Temperature(string name, int index) {
   725         this.Name = name;
   726         this.Index = index;
   727       }
   728     }
   729 
   730     private class Fan {
   731       public readonly string Name;
   732       public readonly int Index;
   733 
   734       public Fan(string name, int index) {
   735         this.Name = name;
   736         this.Index = index;
   737       }
   738     }
   739   }
   740 }