Hardware/Mainboard/SuperIOHardware.cs
author paulwerelds
Sat, 16 Oct 2010 18:26:47 +0000
changeset 226 1e8e0c82c1f5
parent 220 e51749b206ee
child 228 458a6c3de579
permissions -rw-r--r--
AnkhSVN fails, TortoiseSVN to the rescue..
     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     public SuperIOHardware(Mainboard mainboard, ISuperIO superIO, 
    54       Manufacturer manufacturer, Model model, ISettings settings) 
    55     {
    56       this.mainboard = mainboard;
    57       this.superIO = superIO;
    58       this.name = ChipName.GetName(superIO.Chip);
    59 
    60       List<Voltage> v = new List<Voltage>();
    61       List<Temperature> t = new List<Temperature>();
    62       List<Fan> f = new List<Fan>();
    63 
    64       switch (superIO.Chip) {
    65         case Chip.IT8712F:
    66         case Chip.IT8716F:
    67         case Chip.IT8718F:
    68         case Chip.IT8720F: 
    69         case Chip.IT8726F:
    70           switch (manufacturer) {
    71             case Manufacturer.ASUS:
    72               switch (model) {
    73                 case Model.Crosshair_III_Formula: // IT8720F
    74                   v.Add(new Voltage("VBat", 8));
    75                   t.Add(new Temperature("CPU", 0));
    76                   for (int i = 0; i < superIO.Fans.Length; i++)
    77                     f.Add(new Fan("Fan #" + (i + 1), i));
    78                   break;
    79                 case Model.M2N_SLI_DELUXE:                
    80                   v.Add(new Voltage("CPU VCore", 0));
    81                   v.Add(new Voltage("+3.3V", 1));
    82                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
    83                   v.Add(new Voltage("+12V", 4, 30, 10));
    84                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
    85                   v.Add(new Voltage("VBat", 8));
    86                   t.Add(new Temperature("CPU", 0));
    87                   t.Add(new Temperature("Motherboard", 1));
    88                   f.Add(new Fan("CPU Fan", 0));
    89                   f.Add(new Fan("Chassis Fan #1", 1));
    90                   f.Add(new Fan("Power Fan", 2));
    91                   break;
    92                 case Model.M4A79XTD_EVO: // IT8720F           
    93                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
    94                   v.Add(new Voltage("VBat", 8));
    95                   t.Add(new Temperature("CPU", 0));
    96                   t.Add(new Temperature("Motherboard", 1));
    97                   f.Add(new Fan("CPU Fan", 0));
    98                   f.Add(new Fan("Chassis Fan #1", 1));
    99                   f.Add(new Fan("Chassis Fan #2", 2));
   100                   break;
   101                 default:
   102                   v.Add(new Voltage("CPU VCore", 0));
   103                   v.Add(new Voltage("Voltage #2", 1, true));
   104                   v.Add(new Voltage("Voltage #3", 2, true));
   105                   v.Add(new Voltage("Voltage #4", 3, true));
   106                   v.Add(new Voltage("Voltage #5", 4, true));
   107                   v.Add(new Voltage("Voltage #6", 5, true));
   108                   v.Add(new Voltage("Voltage #7", 6, true));
   109                   v.Add(new Voltage("Voltage #8", 7, true));
   110                   v.Add(new Voltage("VBat", 8));
   111                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   112                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   113                   for (int i = 0; i < superIO.Fans.Length; i++)
   114                     f.Add(new Fan("Fan #" + (i + 1), i));
   115                   break;
   116               }
   117               break;
   118 
   119             case Manufacturer.ASRock:
   120               switch (model) {
   121                 case Model.P55_Deluxe: // IT8720F
   122                   v.Add(new Voltage("CPU VCore", 0));
   123                   v.Add(new Voltage("+3.3V", 2));
   124                   v.Add(new Voltage("+12V", 4, 30, 10));
   125                   v.Add(new Voltage("+5V", 5, 6.8f, 10));
   126                   v.Add(new Voltage("VBat", 8));                  
   127                   t.Add(new Temperature("CPU", 0));
   128                   t.Add(new Temperature("Motherboard", 1));
   129                   f.Add(new Fan("CPU Fan", 0));
   130                   f.Add(new Fan("Chassis Fan #1", 1));
   131                   // fan channel 2 can connect to 3 different fan headers
   132                   // which fan is read is configured with gpio 83-85
   133                   break;
   134                 default:
   135                   v.Add(new Voltage("CPU VCore", 0));
   136                   v.Add(new Voltage("Voltage #2", 1, true));
   137                   v.Add(new Voltage("Voltage #3", 2, true));
   138                   v.Add(new Voltage("Voltage #4", 3, true));
   139                   v.Add(new Voltage("Voltage #5", 4, true));
   140                   v.Add(new Voltage("Voltage #6", 5, true));
   141                   v.Add(new Voltage("Voltage #7", 6, true));
   142                   v.Add(new Voltage("Voltage #8", 7, true));
   143                   v.Add(new Voltage("VBat", 8));
   144                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   145                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   146                   for (int i = 0; i < superIO.Fans.Length; i++)
   147                     f.Add(new Fan("Fan #" + (i + 1), i));
   148                   break;
   149               };
   150               break;
   151 
   152             case Manufacturer.DFI:
   153               switch (model) {
   154                 case Model.LP_BI_P45_T2RS_Elite: // IT8718F
   155                   v.Add(new Voltage("CPU VCore", 0));
   156                   v.Add(new Voltage("FSB VTT", 1));
   157                   v.Add(new Voltage("+3.3V", 2));
   158                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   159                   v.Add(new Voltage("+12V", 4, 30, 10));
   160                   v.Add(new Voltage("NB Core", 5));
   161                   v.Add(new Voltage("VDIMM", 6));
   162                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   163                   v.Add(new Voltage("VBat", 8));
   164                   t.Add(new Temperature("CPU", 0));
   165                   t.Add(new Temperature("System", 1));
   166                   t.Add(new Temperature("Chipset", 2));
   167                   f.Add(new Fan("Fan #1", 0));
   168                   f.Add(new Fan("Fan #2", 1));
   169                   f.Add(new Fan("Fan #3", 2));
   170                   break;
   171                 case Model.LP_DK_P55_T3eH9: // IT8720F
   172                   v.Add(new Voltage("CPU VCore", 0));
   173                   v.Add(new Voltage("VTT", 1));
   174                   v.Add(new Voltage("+3.3V", 2));
   175                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   176                   v.Add(new Voltage("+12V", 4, 30, 10));
   177                   v.Add(new Voltage("CPU PLL", 5));
   178                   v.Add(new Voltage("DRAM", 6));
   179                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   180                   v.Add(new Voltage("VBat", 8));
   181                   t.Add(new Temperature("Chipset", 0));
   182                   t.Add(new Temperature("CPU PWM", 1));
   183                   t.Add(new Temperature("CPU", 2));
   184                   f.Add(new Fan("Fan #1", 0));
   185                   f.Add(new Fan("Fan #2", 1));
   186                   f.Add(new Fan("Fan #3", 2));
   187                   break;
   188                 default:
   189                   v.Add(new Voltage("CPU VCore", 0));
   190                   v.Add(new Voltage("VTT", 1, true));
   191                   v.Add(new Voltage("+3.3V", 2, true));
   192                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   193                   v.Add(new Voltage("+12V", 4, 30, 10, 0, true));
   194                   v.Add(new Voltage("Voltage #6", 5, true));
   195                   v.Add(new Voltage("DRAM", 6, true));
   196                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
   197                   v.Add(new Voltage("VBat", 8));
   198                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   199                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   200                   for (int i = 0; i < superIO.Fans.Length; i++)
   201                     f.Add(new Fan("Fan #" + (i + 1), i));
   202                   break;
   203               }
   204               break;
   205 
   206             case Manufacturer.Gigabyte:
   207               switch (model) {
   208                 case Model._965P_S3: // IT8718F
   209                   v.Add(new Voltage("CPU VCore", 0));
   210                   v.Add(new Voltage("DRAM", 1));
   211                   v.Add(new Voltage("+3.3V", 2));
   212                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   213                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   214                   v.Add(new Voltage("VBat", 8));
   215                   t.Add(new Temperature("System", 0));
   216                   t.Add(new Temperature("CPU", 1));
   217                   f.Add(new Fan("CPU Fan", 0));
   218                   f.Add(new Fan("System Fan", 1));
   219                   break;
   220                 case Model.EP45_DS3R: // IT8718F
   221                 case Model.EP45_UD3R: 
   222                 case Model.X38_DS5:    
   223                   v.Add(new Voltage("CPU VCore", 0));
   224                   v.Add(new Voltage("DRAM", 1));
   225                   v.Add(new Voltage("+3.3V", 2));
   226                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   227                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   228                   v.Add(new Voltage("VBat", 8));
   229                   t.Add(new Temperature("System", 0));
   230                   t.Add(new Temperature("CPU", 1));
   231                   f.Add(new Fan("CPU Fan", 0));
   232                   f.Add(new Fan("System Fan #2", 1));
   233                   f.Add(new Fan("Power Fan", 2));
   234                   f.Add(new Fan("System Fan #1", 3));
   235                   break;
   236                 case Model.EX58_EXTREME: // IT8720F 
   237                   v.Add(new Voltage("CPU VCore", 0));
   238                   v.Add(new Voltage("DRAM", 1));
   239                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   240                   v.Add(new Voltage("VBat", 8));
   241                   t.Add(new Temperature("System", 0));
   242                   t.Add(new Temperature("CPU", 1));
   243                   t.Add(new Temperature("Northbridge", 2));
   244                   f.Add(new Fan("CPU Fan", 0));
   245                   f.Add(new Fan("System Fan #2", 1));
   246                   f.Add(new Fan("Power Fan", 2));
   247                   f.Add(new Fan("System Fan #1", 3));
   248                   break;
   249                 case Model.P35_DS3: // IT8718F 
   250                 case Model.P35_DS3L: // IT8718F
   251                   v.Add(new Voltage("CPU VCore", 0));
   252                   v.Add(new Voltage("DRAM", 1));
   253                   v.Add(new Voltage("+3.3V", 2));
   254                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   255                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   256                   v.Add(new Voltage("VBat", 8));
   257                   t.Add(new Temperature("System", 0));
   258                   t.Add(new Temperature("CPU", 1));
   259                   f.Add(new Fan("CPU Fan", 0));
   260                   f.Add(new Fan("System Fan #1", 1));
   261                   f.Add(new Fan("System Fan #2", 2));
   262                   f.Add(new Fan("Power Fan", 3));
   263                   break;
   264                 case Model.P55_UD4: // IT8720F
   265                 case Model.P55M_UD4: // IT8720F
   266                   v.Add(new Voltage("CPU VCore", 0));
   267                   v.Add(new Voltage("DRAM", 1));
   268                   v.Add(new Voltage("+3.3V", 2));
   269                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   270                   v.Add(new Voltage("+12V", 5, 27, 9.1f));
   271                   v.Add(new Voltage("VBat", 8));
   272                   t.Add(new Temperature("System", 0));
   273                   t.Add(new Temperature("CPU", 2));
   274                   f.Add(new Fan("CPU Fan", 0));
   275                   f.Add(new Fan("System Fan #2", 1));
   276                   f.Add(new Fan("Power Fan", 2));
   277                   f.Add(new Fan("System Fan #1", 3));
   278                   break;
   279                 case Model.GA_MA770T_UD3: // IT8720F
   280                   v.Add(new Voltage("CPU VCore", 0));
   281                   v.Add(new Voltage("DRAM", 1));
   282                   v.Add(new Voltage("+3.3V", 2));
   283                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   284                   v.Add(new Voltage("+12V", 4, 27, 9.1f));
   285                   v.Add(new Voltage("VBat", 8));
   286                   t.Add(new Temperature("System", 0));
   287                   t.Add(new Temperature("CPU", 1));
   288                   f.Add(new Fan("CPU Fan", 0));
   289                   f.Add(new Fan("System Fan #1", 1));
   290                   f.Add(new Fan("System Fan #2", 2));
   291                   f.Add(new Fan("Power Fan", 3));
   292                   break;
   293                 case Model.GA_MA785GMT_UD2H: // IT8718F
   294                   v.Add(new Voltage("CPU VCore", 0));
   295                   v.Add(new Voltage("DRAM", 1));
   296                   v.Add(new Voltage("+3.3V", 2));
   297                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   298                   v.Add(new Voltage("+12V", 4, 27, 9.1f));
   299                   v.Add(new Voltage("VBat", 8));
   300                   t.Add(new Temperature("System", 0));
   301                   t.Add(new Temperature("CPU", 1));
   302                   f.Add(new Fan("CPU Fan", 0));
   303                   f.Add(new Fan("System Fan", 1));
   304                   f.Add(new Fan("NB Fan", 2));
   305                   break;
   306                 case Model.X58A_UD3R: // IT8720F 
   307                   v.Add(new Voltage("CPU VCore", 0));
   308                   v.Add(new Voltage("DRAM", 1));
   309                   v.Add(new Voltage("+3.3V", 2));
   310                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   311                   v.Add(new Voltage("+12V", 5, 27, 9.1f));
   312                   v.Add(new Voltage("VBat", 8));
   313                   t.Add(new Temperature("System", 0));
   314                   t.Add(new Temperature("CPU", 1));
   315                   t.Add(new Temperature("Northbridge", 2));
   316                   f.Add(new Fan("CPU Fan", 0));
   317                   f.Add(new Fan("System Fan #2", 1));
   318                   f.Add(new Fan("Power Fan", 2));
   319                   f.Add(new Fan("System Fan #1", 3));
   320                   break;
   321                 default:
   322                   v.Add(new Voltage("CPU VCore", 0));
   323                   v.Add(new Voltage("DRAM", 1, true));
   324                   v.Add(new Voltage("+3.3V", 2, true));
   325                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   326                   v.Add(new Voltage("Voltage #5", 4, true));
   327                   v.Add(new Voltage("Voltage #6", 5, true));
   328                   v.Add(new Voltage("Voltage #7", 6, true));
   329                   v.Add(new Voltage("+12V", 7, 27, 9.1f, 0, true));
   330                   v.Add(new Voltage("VBat", 8));
   331                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   332                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   333                   for (int i = 0; i < superIO.Fans.Length; i++)
   334                     f.Add(new Fan("Fan #" + (i + 1), i));
   335                   break;
   336               }
   337               break;
   338 
   339             default:
   340               v.Add(new Voltage("CPU VCore", 0));
   341               v.Add(new Voltage("Voltage #2", 1, true));
   342               v.Add(new Voltage("Voltage #3", 2, true));
   343               v.Add(new Voltage("Voltage #4", 3, true));
   344               v.Add(new Voltage("Voltage #5", 4, true));
   345               v.Add(new Voltage("Voltage #6", 5, true));
   346               v.Add(new Voltage("Voltage #7", 6, true));
   347               v.Add(new Voltage("Voltage #8", 7, true));
   348               v.Add(new Voltage("VBat", 8));
   349               for (int i = 0; i < superIO.Temperatures.Length; i++)
   350                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   351               for (int i = 0; i < superIO.Fans.Length; i++)
   352                 f.Add(new Fan("Fan #" + (i + 1), i));
   353               break;
   354           }
   355           break;
   356 
   357         case Chip.IT8721F:
   358           switch (manufacturer) {
   359             case Manufacturer.ECS:
   360               switch (model) {
   361                 case Model.A890GXM_A: // IT8721F
   362                   v.Add(new Voltage("CPU VCore", 0));
   363                   v.Add(new Voltage("VDIMM", 1));
   364                   v.Add(new Voltage("NB Voltage", 2));
   365                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10));
   366                   // v.Add(new Voltage("VDIMM", 6, true));
   367                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   368                   v.Add(new Voltage("VBat", 8, 10, 10));
   369                   t.Add(new Temperature("CPU", 0));
   370                   t.Add(new Temperature("System", 1));
   371                   t.Add(new Temperature("Northbridge", 2));
   372                   f.Add(new Fan("CPU Fan", 0));
   373                   f.Add(new Fan("System Fan", 1));
   374                   f.Add(new Fan("Power Fan", 2));
   375                   break;
   376                 default:
   377                   v.Add(new Voltage("Voltage #1", 0, true));
   378                   v.Add(new Voltage("Voltage #2", 1, true));
   379                   v.Add(new Voltage("Voltage #3", 2, true));
   380                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
   381                   v.Add(new Voltage("Voltage #5", 4, true));
   382                   v.Add(new Voltage("Voltage #6", 5, true));
   383                   v.Add(new Voltage("Voltage #7", 6, true));
   384                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   385                   v.Add(new Voltage("VBat", 8, 10, 10));
   386                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   387                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   388                   for (int i = 0; i < superIO.Fans.Length; i++)
   389                     f.Add(new Fan("Fan #" + (i + 1), i));
   390                   break;
   391               }
   392               break;
   393             default:
   394               v.Add(new Voltage("Voltage #1", 0, true));
   395               v.Add(new Voltage("Voltage #2", 1, true));
   396               v.Add(new Voltage("Voltage #3", 2, true));
   397               v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
   398               v.Add(new Voltage("Voltage #5", 4, true));
   399               v.Add(new Voltage("Voltage #6", 5, true));
   400               v.Add(new Voltage("Voltage #7", 6, true));
   401               v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   402               v.Add(new Voltage("VBat", 8, 10, 10));
   403               for (int i = 0; i < superIO.Temperatures.Length; i++)
   404                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   405               for (int i = 0; i < superIO.Fans.Length; i++)
   406                 f.Add(new Fan("Fan #" + (i + 1), i));
   407               break;
   408           }
   409           break;
   410           
   411         case Chip.F71858:
   412           v.Add(new Voltage("VCC3V", 0, 150, 150));
   413           v.Add(new Voltage("VSB3V", 1, 150, 150));
   414           v.Add(new Voltage("Battery", 2, 150, 150));
   415           for (int i = 0; i < superIO.Temperatures.Length; i++)
   416             t.Add(new Temperature("Temperature #" + (i + 1), i));
   417           for (int i = 0; i < superIO.Fans.Length; i++)
   418             f.Add(new Fan("Fan #" + (i + 1), i));
   419           break;
   420         case Chip.F71862: 
   421         case Chip.F71869: 
   422         case Chip.F71882:
   423         case Chip.F71889ED: 
   424         case Chip.F71889F:
   425           switch (manufacturer) {
   426             case Manufacturer.EVGA:
   427               switch (model) {
   428                 case Model.X58_SLI_Classified: // F71882 
   429                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   430                   v.Add(new Voltage("CPU VCore", 1, 47, 100));
   431                   v.Add(new Voltage("DIMM", 2, 47, 100));
   432                   v.Add(new Voltage("CPU VTT", 3, 24, 100));
   433                   v.Add(new Voltage("IOH Vcore", 4, 24, 100));
   434                   v.Add(new Voltage("+5V", 5, 51, 12));
   435                   v.Add(new Voltage("+12V", 6, 56, 6.8f));
   436                   v.Add(new Voltage("3VSB", 7, 150, 150));
   437                   v.Add(new Voltage("VBat", 8, 150, 150));
   438                   t.Add(new Temperature("CPU", 0));
   439                   t.Add(new Temperature("VREG", 1));
   440                   t.Add(new Temperature("System", 2));
   441                   f.Add(new Fan("CPU Fan", 0));
   442                   f.Add(new Fan("Power Fan", 1));
   443                   f.Add(new Fan("Chassis Fan", 2));
   444                   break;
   445                 default:
   446                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   447                   v.Add(new Voltage("CPU VCore", 1));
   448                   v.Add(new Voltage("Voltage #3", 2, true));
   449                   v.Add(new Voltage("Voltage #4", 3, true));
   450                   v.Add(new Voltage("Voltage #5", 4, true));
   451                   v.Add(new Voltage("Voltage #6", 5, true));
   452                   v.Add(new Voltage("Voltage #7", 6, true));
   453                   v.Add(new Voltage("VSB3V", 7, 150, 150));
   454                   v.Add(new Voltage("VBat", 8, 150, 150));
   455                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   456                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   457                   for (int i = 0; i < superIO.Fans.Length; i++)
   458                     f.Add(new Fan("Fan #" + (i + 1), i));
   459                   break;
   460               }
   461               break;
   462             default:
   463               v.Add(new Voltage("VCC3V", 0, 150, 150));
   464               v.Add(new Voltage("CPU VCore", 1));
   465               v.Add(new Voltage("Voltage #3", 2, true));
   466               v.Add(new Voltage("Voltage #4", 3, true));
   467               v.Add(new Voltage("Voltage #5", 4, true));
   468               v.Add(new Voltage("Voltage #6", 5, true));
   469               v.Add(new Voltage("Voltage #7", 6, true));
   470               v.Add(new Voltage("VSB3V", 7, 150, 150));
   471               v.Add(new Voltage("VBat", 8, 150, 150));
   472               for (int i = 0; i < superIO.Temperatures.Length; i++)
   473                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   474               for (int i = 0; i < superIO.Fans.Length; i++)
   475                 f.Add(new Fan("Fan #" + (i + 1), i));
   476               break;
   477           }
   478           break;
   479 
   480         case Chip.W83627EHF:
   481           switch (manufacturer) {
   482             case Manufacturer.ASRock:
   483               switch (model) {
   484                 case Model.AOD790GX_128M: // W83627EHF
   485                   v.Add(new Voltage("CPU VCore", 0));
   486                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   487                   v.Add(new Voltage("+3.3V", 4, 10, 10));
   488                   v.Add(new Voltage("+5V", 5, 20, 10));
   489                   v.Add(new Voltage("+12V", 6, 28, 5));
   490                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   491                   v.Add(new Voltage("VBAT", 8, 34, 34));
   492                   t.Add(new Temperature("CPU", 0));
   493                   t.Add(new Temperature("Motherboard", 2));
   494                   f.Add(new Fan("CPU Fan", 0));
   495                   f.Add(new Fan("Chassis Fan", 1));                 
   496                   break;
   497                 default:
   498                   v.Add(new Voltage("CPU VCore", 0));
   499                   v.Add(new Voltage("Voltage #2", 1, true));
   500                   v.Add(new Voltage("AVCC", 2, 34, 34));
   501                   v.Add(new Voltage("3VCC", 3, 34, 34));
   502                   v.Add(new Voltage("Voltage #5", 4, true));
   503                   v.Add(new Voltage("Voltage #6", 5, true));
   504                   v.Add(new Voltage("Voltage #7", 6, true));
   505                   v.Add(new Voltage("3VSB", 7, 34, 34));
   506                   v.Add(new Voltage("VBAT", 8, 34, 34));
   507                   v.Add(new Voltage("Voltage #10", 9, true));
   508                   t.Add(new Temperature("CPU", 0));
   509                   t.Add(new Temperature("Auxiliary", 1));
   510                   t.Add(new Temperature("System", 2));
   511                   f.Add(new Fan("System Fan", 0));
   512                   f.Add(new Fan("CPU Fan", 1));
   513                   f.Add(new Fan("Auxiliary Fan", 2));
   514                   f.Add(new Fan("CPU Fan #2", 3));
   515                   f.Add(new Fan("Auxiliary Fan #2", 4));
   516                   break;
   517               } break;
   518             default:
   519               v.Add(new Voltage("CPU VCore", 0));
   520               v.Add(new Voltage("Voltage #2", 1, true));
   521               v.Add(new Voltage("AVCC", 2, 34, 34));
   522               v.Add(new Voltage("3VCC", 3, 34, 34));
   523               v.Add(new Voltage("Voltage #5", 4, true));
   524               v.Add(new Voltage("Voltage #6", 5, true));
   525               v.Add(new Voltage("Voltage #7", 6, true));
   526               v.Add(new Voltage("3VSB", 7, 34, 34));
   527               v.Add(new Voltage("VBAT", 8, 34, 34));
   528               v.Add(new Voltage("Voltage #10", 9, true));
   529               t.Add(new Temperature("CPU", 0));
   530               t.Add(new Temperature("Auxiliary", 1));
   531               t.Add(new Temperature("System", 2));
   532               f.Add(new Fan("System Fan", 0));
   533               f.Add(new Fan("CPU Fan", 1));
   534               f.Add(new Fan("Auxiliary Fan", 2));
   535               f.Add(new Fan("CPU Fan #2", 3));
   536               f.Add(new Fan("Auxiliary Fan #2", 4));
   537               break;
   538           }
   539           break;
   540         case Chip.W83627DHG: 
   541         case Chip.W83627DHGP:                      
   542         case Chip.W83667HG:
   543         case Chip.W83667HGB:
   544           switch (manufacturer) {
   545             case Manufacturer.ASRock:
   546               switch (model) {
   547                 case Model._880GMH_USB3: // W83627DHG-P
   548                   v.Add(new Voltage("CPU VCore", 0));
   549                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   550                   v.Add(new Voltage("+5V", 5, 15, 7.5f));
   551                   v.Add(new Voltage("+12V", 6, 56, 10));
   552                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   553                   v.Add(new Voltage("VBAT", 8, 34, 34));
   554                   t.Add(new Temperature("CPU", 0));
   555                   t.Add(new Temperature("Motherboard", 2));
   556                   f.Add(new Fan("Chassis Fan", 0));
   557                   f.Add(new Fan("CPU Fan", 1));
   558                   f.Add(new Fan("Power Fan", 2));
   559                   break;
   560                 default:
   561                   v.Add(new Voltage("CPU VCore", 0));
   562                   v.Add(new Voltage("Voltage #2", 1, true));
   563                   v.Add(new Voltage("AVCC", 2, 34, 34));
   564                   v.Add(new Voltage("3VCC", 3, 34, 34));
   565                   v.Add(new Voltage("Voltage #5", 4, true));
   566                   v.Add(new Voltage("Voltage #6", 5, true));
   567                   v.Add(new Voltage("Voltage #7", 6, true));
   568                   v.Add(new Voltage("3VSB", 7, 34, 34));
   569                   v.Add(new Voltage("VBAT", 8, 34, 34));
   570                   t.Add(new Temperature("CPU", 0));
   571                   t.Add(new Temperature("Auxiliary", 1));
   572                   t.Add(new Temperature("System", 2));
   573                   f.Add(new Fan("System Fan", 0));
   574                   f.Add(new Fan("CPU Fan", 1));
   575                   f.Add(new Fan("Auxiliary Fan", 2));
   576                   f.Add(new Fan("CPU Fan #2", 3));
   577                   f.Add(new Fan("Auxiliary Fan #2", 4));
   578                   break;
   579               }
   580               break;
   581             case Manufacturer.ASUS:
   582               switch (model) {
   583                 case Model.P6X58D_E: // W83667HG                 
   584                 case Model.Rampage_II_GENE: // W83667HG 
   585                   v.Add(new Voltage("CPU VCore", 0));
   586                   v.Add(new Voltage("+12V", 1, 11.5f, 1.91f));
   587                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   588                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   589                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   590                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   591                   v.Add(new Voltage("VBAT", 8, 34, 34));
   592                   t.Add(new Temperature("CPU", 0));
   593                   t.Add(new Temperature("Motherboard", 2));
   594                   f.Add(new Fan("Chassis Fan #1", 0));
   595                   f.Add(new Fan("CPU Fan", 1));
   596                   f.Add(new Fan("Power Fan", 2));
   597                   f.Add(new Fan("Chassis Fan #2", 3));
   598                   f.Add(new Fan("Chassis Fan #3", 4));
   599                   break;
   600                 case Model.Rampage_Extreme: // W83667HG 
   601                   v.Add(new Voltage("CPU VCore", 0));
   602                   v.Add(new Voltage("+12V", 1, 12, 2));
   603                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   604                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   605                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   606                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   607                   v.Add(new Voltage("VBAT", 8, 34, 34));
   608                   t.Add(new Temperature("CPU", 0));
   609                   t.Add(new Temperature("Motherboard", 2));
   610                   f.Add(new Fan("Chassis Fan #1", 0));
   611                   f.Add(new Fan("CPU Fan", 1));
   612                   f.Add(new Fan("Power Fan", 2));
   613                   f.Add(new Fan("Chassis Fan #2", 3));
   614                   f.Add(new Fan("Chassis Fan #3", 4));
   615                   break;
   616                 default:
   617                   v.Add(new Voltage("CPU VCore", 0));
   618                   v.Add(new Voltage("Voltage #2", 1, true));
   619                   v.Add(new Voltage("AVCC", 2, 34, 34));
   620                   v.Add(new Voltage("3VCC", 3, 34, 34));
   621                   v.Add(new Voltage("Voltage #5", 4, true));
   622                   v.Add(new Voltage("Voltage #6", 5, true));
   623                   v.Add(new Voltage("Voltage #7", 6, true));
   624                   v.Add(new Voltage("3VSB", 7, 34, 34));
   625                   v.Add(new Voltage("VBAT", 8, 34, 34));
   626                   t.Add(new Temperature("CPU", 0));
   627                   t.Add(new Temperature("Auxiliary", 1));
   628                   t.Add(new Temperature("System", 2));
   629                   f.Add(new Fan("System Fan", 0));
   630                   f.Add(new Fan("CPU Fan", 1));
   631                   f.Add(new Fan("Auxiliary Fan", 2));
   632                   f.Add(new Fan("CPU Fan #2", 3));
   633                   f.Add(new Fan("Auxiliary Fan #2", 4));
   634                   break;
   635               }
   636               break;
   637             default:
   638               v.Add(new Voltage("CPU VCore", 0));
   639               v.Add(new Voltage("Voltage #2", 1, true));
   640               v.Add(new Voltage("AVCC", 2, 34, 34));
   641               v.Add(new Voltage("3VCC", 3, 34, 34));
   642               v.Add(new Voltage("Voltage #5", 4, true));
   643               v.Add(new Voltage("Voltage #6", 5, true));
   644               v.Add(new Voltage("Voltage #7", 6, true));
   645               v.Add(new Voltage("3VSB", 7, 34, 34));
   646               v.Add(new Voltage("VBAT", 8, 34, 34));
   647               t.Add(new Temperature("CPU", 0));
   648               t.Add(new Temperature("Auxiliary", 1));
   649               t.Add(new Temperature("System", 2));
   650               f.Add(new Fan("System Fan", 0));
   651               f.Add(new Fan("CPU Fan", 1));
   652               f.Add(new Fan("Auxiliary Fan", 2));
   653               f.Add(new Fan("CPU Fan #2", 3));
   654               f.Add(new Fan("Auxiliary Fan #2", 4));
   655               break;
   656           } 
   657           break;
   658         case Chip.W83627HF: 
   659         case Chip.W83627THF: 
   660         case Chip.W83687THF:
   661           v.Add(new Voltage("CPU VCore", 0));
   662           v.Add(new Voltage("Voltage #2", 1, true));
   663           v.Add(new Voltage("Voltage #3", 2, true));
   664           v.Add(new Voltage("AVCC", 3, 34, 51));
   665           v.Add(new Voltage("Voltage #5", 4, true));
   666           v.Add(new Voltage("5VSB", 5, 34, 51));
   667           v.Add(new Voltage("VBAT", 6));
   668           t.Add(new Temperature("CPU", 0));
   669           t.Add(new Temperature("Auxiliary", 1));
   670           t.Add(new Temperature("System", 2));
   671           f.Add(new Fan("System Fan", 0));
   672           f.Add(new Fan("CPU Fan", 1));
   673           f.Add(new Fan("Auxiliary Fan", 2));
   674           break;
   675         default:
   676           for (int i = 0; i < superIO.Voltages.Length; i++)
   677             v.Add(new Voltage("Voltage #" + (i + 1), i, true));
   678           for (int i = 0; i < superIO.Temperatures.Length; i++)
   679             t.Add(new Temperature("Temperature #" + (i + 1), i));
   680           for (int i = 0; i < superIO.Fans.Length; i++)
   681             f.Add(new Fan("Fan #" + (i + 1), i));
   682           break;
   683       }
   684 
   685       const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
   686       foreach (Voltage voltage in v) 
   687         if (voltage.Index < superIO.Voltages.Length) {
   688           Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
   689             voltage.Hidden, SensorType.Voltage, this, new [] {
   690             new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
   691               formula, voltage.Ri),
   692             new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
   693               formula, voltage.Rf),
   694             new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
   695               formula, voltage.Vf)
   696             }, settings);
   697           voltages.Add(sensor);
   698       }
   699 
   700       foreach (Temperature temperature in t) 
   701         if (temperature.Index < superIO.Temperatures.Length) {
   702         Sensor sensor = new Sensor(temperature.Name, temperature.Index,
   703           SensorType.Temperature, this, new [] {
   704           new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
   705         }, settings);
   706         temperatures.Add(sensor);
   707       }
   708 
   709       foreach (Fan fan in f)
   710         if (fan.Index < superIO.Fans.Length) {
   711           Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
   712             this, settings);
   713           fans.Add(sensor);
   714         }
   715     }
   716 
   717     public override Identifier Identifier {
   718       get { 
   719         return new Identifier("lpc", 
   720           superIO.Chip.ToString().ToLower(CultureInfo.InvariantCulture)); 
   721       }
   722     }
   723 
   724     public override HardwareType HardwareType {
   725       get { return HardwareType.SuperIO; }
   726     }
   727 
   728     public override IHardware Parent {
   729       get { return mainboard; }
   730     }
   731 
   732     public override string Name {
   733       get { return name; }
   734     }
   735 
   736     public override string GetReport() {
   737       return superIO.GetReport();
   738     }
   739 
   740     public override void Update() {
   741       superIO.Update();
   742 
   743       foreach (Sensor sensor in voltages) {
   744         float? value = superIO.Voltages[sensor.Index];
   745         if (value.HasValue) {
   746           sensor.Value = value + (value - sensor.Parameters[2].Value) *
   747             sensor.Parameters[0].Value / sensor.Parameters[1].Value;
   748           ActivateSensor(sensor);
   749         }
   750       }
   751 
   752       foreach (Sensor sensor in temperatures) {
   753         float? value = superIO.Temperatures[sensor.Index];
   754         if (value.HasValue) {
   755           sensor.Value = value + sensor.Parameters[0].Value;
   756           ActivateSensor(sensor);
   757         }
   758       }
   759 
   760       foreach (Sensor sensor in fans) {
   761         float? value = superIO.Fans[sensor.Index];
   762         if (value.HasValue) {
   763           sensor.Value = value;
   764           if (value.Value > 0)
   765             ActivateSensor(sensor);
   766         }
   767       }
   768     }
   769 
   770     private class Voltage {
   771       public readonly string Name;
   772       public readonly int Index;
   773       public readonly float Ri;
   774       public readonly float Rf;
   775       public readonly float Vf;
   776       public readonly bool Hidden;
   777 
   778       public Voltage(string name, int index) :
   779         this(name, index, false) { }
   780       
   781       public Voltage(string name, int index, bool hidden) :
   782         this(name, index, 0, 1, 0, hidden) { }
   783       
   784       public Voltage(string name, int index, float ri, float rf) :
   785         this(name, index, ri, rf, 0, false) { }
   786       
   787       // float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
   788       
   789       public Voltage(string name, int index, 
   790         float ri, float rf, float vf, bool hidden) 
   791       {
   792         this.Name = name;
   793         this.Index = index;
   794         this.Ri = ri;
   795         this.Rf = rf;
   796         this.Vf = vf;
   797         this.Hidden = hidden;
   798       }
   799     }
   800 
   801     private class Temperature {
   802       public readonly string Name;
   803       public readonly int Index;
   804 
   805       public Temperature(string name, int index) {
   806         this.Name = name;
   807         this.Index = index;
   808       }
   809     }
   810 
   811     private class Fan {
   812       public readonly string Name;
   813       public readonly int Index;
   814 
   815       public Fan(string name, int index) {
   816         this.Name = name;
   817         this.Index = index;
   818       }
   819     }
   820   }
   821 }