Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Fri, 22 Jun 2012 10:05:23 +0000
changeset 352 0899f651d5cf
parent 344 3145aadca3d2
child 353 b4e37f5b2669
permissions -rw-r--r--
Integrated the patch for Fintek F71808E super I/O support developed by Andrey Mushatov.
     1 /*
     2  
     3   This Source Code Form is subject to the terms of the Mozilla Public
     4   License, v. 2.0. If a copy of the MPL was not distributed with this
     5   file, You can obtain one at http://mozilla.org/MPL/2.0/.
     6  
     7   Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     8 	
     9 */
    10 
    11 using System;
    12 using System.Collections.Generic;
    13 using System.Globalization;
    14 using System.Threading;
    15 using OpenHardwareMonitor.Hardware.LPC;
    16 
    17 namespace OpenHardwareMonitor.Hardware.Mainboard {
    18   internal class SuperIOHardware : Hardware {
    19 
    20     private readonly Mainboard mainboard;
    21     private readonly ISuperIO superIO;
    22 
    23     private readonly List<Sensor> voltages = new List<Sensor>();
    24     private readonly List<Sensor> temperatures = new List<Sensor>();
    25     private readonly List<Sensor> fans = new List<Sensor>();
    26     private readonly List<Sensor> controls = new List<Sensor>();
    27 
    28     private delegate float? ReadValueDelegate(int index);
    29     private delegate void UpdateDelegate();
    30 
    31     // delegates for mainboard specific sensor reading code
    32     private readonly ReadValueDelegate readVoltage;
    33     private readonly ReadValueDelegate readTemperature;
    34     private readonly ReadValueDelegate readFan;
    35     private readonly ReadValueDelegate readControl;
    36 
    37     // delegate for post update mainboard specific code
    38     private readonly UpdateDelegate postUpdate;
    39 
    40     // mainboard specific mutex
    41     private readonly Mutex mutex;
    42 
    43     public SuperIOHardware(Mainboard mainboard, ISuperIO superIO, 
    44       Manufacturer manufacturer, Model model, ISettings settings) 
    45       : base(ChipName.GetName(superIO.Chip), new Identifier("lpc", 
    46         superIO.Chip.ToString().ToLower(CultureInfo.InvariantCulture)), 
    47         settings)
    48     {
    49       this.mainboard = mainboard;
    50       this.superIO = superIO;
    51 
    52       this.readVoltage = (index) => superIO.Voltages[index];
    53       this.readTemperature = (index) => superIO.Temperatures[index];
    54       this.readFan = (index) => superIO.Fans[index];
    55       this.readControl = (index) => superIO.Controls[index];
    56 
    57       this.postUpdate = () => { };
    58 
    59       List<Voltage> v = new List<Voltage>();
    60       List<Temperature> t = new List<Temperature>();
    61       List<Fan> f = new List<Fan>();
    62       List<Ctrl> c = new List<Ctrl>();
    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                   
   123                   v.Add(new Voltage("CPU VCore", 0));
   124                   v.Add(new Voltage("+3.3V", 2));
   125                   v.Add(new Voltage("+12V", 4, 30, 10));
   126                   v.Add(new Voltage("+5V", 5, 6.8f, 10));
   127                   v.Add(new Voltage("VBat", 8));                  
   128                   t.Add(new Temperature("CPU", 0));
   129                   t.Add(new Temperature("Motherboard", 1));
   130                   f.Add(new Fan("CPU Fan", 0));
   131                   f.Add(new Fan("Chassis Fan #1", 1));
   132 
   133                   // this mutex is also used by the official ASRock tool
   134                   mutex = new Mutex(false, "ASRockOCMark");
   135                   
   136                   bool exclusiveAccess = false;
   137                   try {
   138                     exclusiveAccess = mutex.WaitOne(10, false);
   139                   } catch (AbandonedMutexException) { } 
   140                     catch (InvalidOperationException) { }  
   141 
   142                   // only read additional fans if we get exclusive access
   143                   if (exclusiveAccess) {
   144 
   145                     f.Add(new Fan("Chassis Fan #2", 2));
   146                     f.Add(new Fan("Chassis Fan #3", 3));
   147                     f.Add(new Fan("Power Fan", 4));
   148 
   149                     readFan = (index) => {
   150                       if (index < 2) {
   151                         return superIO.Fans[index];
   152                       } else {
   153                         // get GPIO 80-87
   154                         byte? gpio = superIO.ReadGPIO(7);
   155                         if (!gpio.HasValue)
   156                           return null;
   157 
   158                         // read the last 3 fans based on GPIO 83-85
   159                         int[] masks = { 0x05, 0x03, 0x06 };
   160                         return (((gpio.Value >> 3) & 0x07) ==
   161                           masks[index - 2]) ? superIO.Fans[2] : null;
   162                       }
   163                     };
   164 
   165                     int fanIndex = 0;
   166                     postUpdate = () => {
   167                       // get GPIO 80-87
   168                       byte? gpio = superIO.ReadGPIO(7);
   169                       if (!gpio.HasValue)
   170                         return;
   171 
   172                       // prepare the GPIO 83-85 for the next update
   173                       int[] masks = { 0x05, 0x03, 0x06 };
   174                       superIO.WriteGPIO(7,
   175                         (byte)((gpio.Value & 0xC7) | (masks[fanIndex] << 3)));
   176                       fanIndex = (fanIndex + 1) % 3;
   177                     };
   178                   }
   179 
   180                   break;
   181                 default:
   182                   v.Add(new Voltage("CPU VCore", 0));
   183                   v.Add(new Voltage("Voltage #2", 1, true));
   184                   v.Add(new Voltage("Voltage #3", 2, true));
   185                   v.Add(new Voltage("Voltage #4", 3, true));
   186                   v.Add(new Voltage("Voltage #5", 4, true));
   187                   v.Add(new Voltage("Voltage #6", 5, true));
   188                   v.Add(new Voltage("Voltage #7", 6, true));
   189                   v.Add(new Voltage("Voltage #8", 7, true));
   190                   v.Add(new Voltage("VBat", 8));
   191                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   192                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   193                   for (int i = 0; i < superIO.Fans.Length; i++)
   194                     f.Add(new Fan("Fan #" + (i + 1), i));
   195                   break;
   196               };
   197               break;
   198 
   199             case Manufacturer.DFI:
   200               switch (model) {
   201                 case Model.LP_BI_P45_T2RS_Elite: // IT8718F
   202                   v.Add(new Voltage("CPU VCore", 0));
   203                   v.Add(new Voltage("FSB VTT", 1));
   204                   v.Add(new Voltage("+3.3V", 2));
   205                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   206                   v.Add(new Voltage("+12V", 4, 30, 10));
   207                   v.Add(new Voltage("NB Core", 5));
   208                   v.Add(new Voltage("VDIMM", 6));
   209                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   210                   v.Add(new Voltage("VBat", 8));
   211                   t.Add(new Temperature("CPU", 0));
   212                   t.Add(new Temperature("System", 1));
   213                   t.Add(new Temperature("Chipset", 2));
   214                   f.Add(new Fan("Fan #1", 0));
   215                   f.Add(new Fan("Fan #2", 1));
   216                   f.Add(new Fan("Fan #3", 2));
   217                   break;
   218                 case Model.LP_DK_P55_T3eH9: // IT8720F
   219                   v.Add(new Voltage("CPU VCore", 0));
   220                   v.Add(new Voltage("VTT", 1));
   221                   v.Add(new Voltage("+3.3V", 2));
   222                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   223                   v.Add(new Voltage("+12V", 4, 30, 10));
   224                   v.Add(new Voltage("CPU PLL", 5));
   225                   v.Add(new Voltage("DRAM", 6));
   226                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   227                   v.Add(new Voltage("VBat", 8));
   228                   t.Add(new Temperature("Chipset", 0));
   229                   t.Add(new Temperature("CPU PWM", 1));
   230                   t.Add(new Temperature("CPU", 2));
   231                   f.Add(new Fan("Fan #1", 0));
   232                   f.Add(new Fan("Fan #2", 1));
   233                   f.Add(new Fan("Fan #3", 2));
   234                   break;
   235                 default:
   236                   v.Add(new Voltage("CPU VCore", 0));
   237                   v.Add(new Voltage("VTT", 1, true));
   238                   v.Add(new Voltage("+3.3V", 2, true));
   239                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   240                   v.Add(new Voltage("+12V", 4, 30, 10, 0, true));
   241                   v.Add(new Voltage("Voltage #6", 5, true));
   242                   v.Add(new Voltage("DRAM", 6, true));
   243                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
   244                   v.Add(new Voltage("VBat", 8));
   245                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   246                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   247                   for (int i = 0; i < superIO.Fans.Length; i++)
   248                     f.Add(new Fan("Fan #" + (i + 1), i));
   249                   break;
   250               }
   251               break;
   252 
   253             case Manufacturer.Gigabyte:
   254               switch (model) {
   255                 case Model._965P_S3: // IT8718F
   256                   v.Add(new Voltage("CPU VCore", 0));
   257                   v.Add(new Voltage("DRAM", 1));
   258                   v.Add(new Voltage("+3.3V", 2));
   259                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   260                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   261                   v.Add(new Voltage("VBat", 8));
   262                   t.Add(new Temperature("System", 0));
   263                   t.Add(new Temperature("CPU", 1));
   264                   f.Add(new Fan("CPU Fan", 0));
   265                   f.Add(new Fan("System Fan", 1));
   266                   break;
   267                 case Model.EP45_DS3R: // IT8718F
   268                 case Model.EP45_UD3R: 
   269                 case Model.X38_DS5:    
   270                   v.Add(new Voltage("CPU VCore", 0));
   271                   v.Add(new Voltage("DRAM", 1));
   272                   v.Add(new Voltage("+3.3V", 2));
   273                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   274                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   275                   v.Add(new Voltage("VBat", 8));
   276                   t.Add(new Temperature("System", 0));
   277                   t.Add(new Temperature("CPU", 1));
   278                   f.Add(new Fan("CPU Fan", 0));
   279                   f.Add(new Fan("System Fan #2", 1));
   280                   f.Add(new Fan("Power Fan", 2));
   281                   f.Add(new Fan("System Fan #1", 3));
   282                   break;
   283                 case Model.EX58_EXTREME: // IT8720F 
   284                   v.Add(new Voltage("CPU VCore", 0));
   285                   v.Add(new Voltage("DRAM", 1));
   286                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   287                   v.Add(new Voltage("VBat", 8));
   288                   t.Add(new Temperature("System", 0));
   289                   t.Add(new Temperature("CPU", 1));
   290                   t.Add(new Temperature("Northbridge", 2));
   291                   f.Add(new Fan("CPU Fan", 0));
   292                   f.Add(new Fan("System Fan #2", 1));
   293                   f.Add(new Fan("Power Fan", 2));
   294                   f.Add(new Fan("System Fan #1", 3));
   295                   break;
   296                 case Model.P35_DS3: // IT8718F 
   297                 case Model.P35_DS3L: // IT8718F
   298                   v.Add(new Voltage("CPU VCore", 0));
   299                   v.Add(new Voltage("DRAM", 1));
   300                   v.Add(new Voltage("+3.3V", 2));
   301                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   302                   v.Add(new Voltage("+12V", 7, 27, 9.1f));
   303                   v.Add(new Voltage("VBat", 8));
   304                   t.Add(new Temperature("System", 0));
   305                   t.Add(new Temperature("CPU", 1));
   306                   f.Add(new Fan("CPU Fan", 0));
   307                   f.Add(new Fan("System Fan #1", 1));
   308                   f.Add(new Fan("System Fan #2", 2));
   309                   f.Add(new Fan("Power Fan", 3));
   310                   break;
   311                 case Model.P55_UD4: // IT8720F
   312                 case Model.P55M_UD4: // IT8720F
   313                   v.Add(new Voltage("CPU VCore", 0));
   314                   v.Add(new Voltage("DRAM", 1));
   315                   v.Add(new Voltage("+3.3V", 2));
   316                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   317                   v.Add(new Voltage("+12V", 5, 27, 9.1f));
   318                   v.Add(new Voltage("VBat", 8));
   319                   t.Add(new Temperature("System", 0));
   320                   t.Add(new Temperature("CPU", 2));
   321                   f.Add(new Fan("CPU Fan", 0));
   322                   f.Add(new Fan("System Fan #2", 1));
   323                   f.Add(new Fan("Power Fan", 2));
   324                   f.Add(new Fan("System Fan #1", 3));
   325                   break;
   326                 case Model.GA_MA770T_UD3: // IT8720F
   327                   v.Add(new Voltage("CPU VCore", 0));
   328                   v.Add(new Voltage("DRAM", 1));
   329                   v.Add(new Voltage("+3.3V", 2));
   330                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   331                   v.Add(new Voltage("+12V", 4, 27, 9.1f));
   332                   v.Add(new Voltage("VBat", 8));
   333                   t.Add(new Temperature("System", 0));
   334                   t.Add(new Temperature("CPU", 1));
   335                   f.Add(new Fan("CPU Fan", 0));
   336                   f.Add(new Fan("System Fan #1", 1));
   337                   f.Add(new Fan("System Fan #2", 2));
   338                   f.Add(new Fan("Power Fan", 3));
   339                   break;
   340                 case Model.GA_MA785GMT_UD2H: // IT8718F
   341                   v.Add(new Voltage("CPU VCore", 0));
   342                   v.Add(new Voltage("DRAM", 1));
   343                   v.Add(new Voltage("+3.3V", 2));
   344                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   345                   v.Add(new Voltage("+12V", 4, 27, 9.1f));
   346                   v.Add(new Voltage("VBat", 8));
   347                   t.Add(new Temperature("System", 0));
   348                   t.Add(new Temperature("CPU", 1));
   349                   f.Add(new Fan("CPU Fan", 0));
   350                   f.Add(new Fan("System Fan", 1));
   351                   f.Add(new Fan("NB Fan", 2));
   352                   break;
   353                 case Model.X58A_UD3R: // IT8720F 
   354                   v.Add(new Voltage("CPU VCore", 0));
   355                   v.Add(new Voltage("DRAM", 1));
   356                   v.Add(new Voltage("+3.3V", 2));
   357                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   358                   v.Add(new Voltage("+12V", 5, 27, 9.1f));
   359                   v.Add(new Voltage("VBat", 8));
   360                   t.Add(new Temperature("System", 0));
   361                   t.Add(new Temperature("CPU", 1));
   362                   t.Add(new Temperature("Northbridge", 2));
   363                   f.Add(new Fan("CPU Fan", 0));
   364                   f.Add(new Fan("System Fan #2", 1));
   365                   f.Add(new Fan("Power Fan", 2));
   366                   f.Add(new Fan("System Fan #1", 3));
   367                   break;
   368                 default:
   369                   v.Add(new Voltage("CPU VCore", 0));
   370                   v.Add(new Voltage("DRAM", 1, true));
   371                   v.Add(new Voltage("+3.3V", 2, true));
   372                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   373                   v.Add(new Voltage("Voltage #5", 4, true));
   374                   v.Add(new Voltage("Voltage #6", 5, true));
   375                   v.Add(new Voltage("Voltage #7", 6, true));
   376                   v.Add(new Voltage("Voltage #8", 7, true));
   377                   v.Add(new Voltage("VBat", 8));
   378                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   379                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   380                   for (int i = 0; i < superIO.Fans.Length; i++)
   381                     f.Add(new Fan("Fan #" + (i + 1), i));
   382                   break;
   383               }
   384               break;
   385 
   386             default:
   387               v.Add(new Voltage("CPU VCore", 0));
   388               v.Add(new Voltage("Voltage #2", 1, true));
   389               v.Add(new Voltage("Voltage #3", 2, true));
   390               v.Add(new Voltage("Voltage #4", 3, true));
   391               v.Add(new Voltage("Voltage #5", 4, true));
   392               v.Add(new Voltage("Voltage #6", 5, true));
   393               v.Add(new Voltage("Voltage #7", 6, true));
   394               v.Add(new Voltage("Voltage #8", 7, true));
   395               v.Add(new Voltage("VBat", 8));
   396               for (int i = 0; i < superIO.Temperatures.Length; i++)
   397                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   398               for (int i = 0; i < superIO.Fans.Length; i++)
   399                 f.Add(new Fan("Fan #" + (i + 1), i));
   400               break;
   401           }
   402           break;
   403 
   404         case Chip.IT8721F:
   405         case Chip.IT8728F:
   406         case Chip.IT8771E:
   407         case Chip.IT8772E:
   408           switch (manufacturer) {
   409             case Manufacturer.ECS:
   410               switch (model) {
   411                 case Model.A890GXM_A: // IT8721F
   412                   v.Add(new Voltage("CPU VCore", 0));
   413                   v.Add(new Voltage("VDIMM", 1));
   414                   v.Add(new Voltage("NB Voltage", 2));
   415                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10));
   416                   // v.Add(new Voltage("VDIMM", 6, true));
   417                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   418                   v.Add(new Voltage("VBat", 8, 10, 10));
   419                   t.Add(new Temperature("CPU", 0));
   420                   t.Add(new Temperature("System", 1));
   421                   t.Add(new Temperature("Northbridge", 2));
   422                   f.Add(new Fan("CPU Fan", 0));
   423                   f.Add(new Fan("System Fan", 1));
   424                   f.Add(new Fan("Power Fan", 2));
   425                   break;
   426                 default:
   427                   v.Add(new Voltage("Voltage #1", 0, true));
   428                   v.Add(new Voltage("Voltage #2", 1, true));
   429                   v.Add(new Voltage("Voltage #3", 2, true));
   430                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
   431                   v.Add(new Voltage("Voltage #5", 4, true));
   432                   v.Add(new Voltage("Voltage #6", 5, true));
   433                   v.Add(new Voltage("Voltage #7", 6, true));
   434                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   435                   v.Add(new Voltage("VBat", 8, 10, 10));
   436                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   437                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   438                   for (int i = 0; i < superIO.Fans.Length; i++)
   439                     f.Add(new Fan("Fan #" + (i + 1), i));
   440                   break;
   441               }
   442               break;
   443             case Manufacturer.Gigabyte:
   444               switch (model) {
   445                 case Model.P67A_UD4_B3: // IT8728F
   446                   v.Add(new Voltage("+12V", 0, 100, 10));
   447                   v.Add(new Voltage("+5V", 1, 15, 10));
   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("CPU VCore", 5));
   452                   v.Add(new Voltage("DRAM", 6));
   453                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   454                   v.Add(new Voltage("VBat", 8, 10, 10));
   455                   t.Add(new Temperature("System", 0));
   456                   t.Add(new Temperature("CPU", 2));
   457                   f.Add(new Fan("CPU Fan", 0));
   458                   f.Add(new Fan("System Fan #2", 1));
   459                   f.Add(new Fan("Power Fan", 2));
   460                   f.Add(new Fan("System Fan #1", 3));
   461                   break;
   462                 case Model.H67A_UD3H_B3: // IT8728F
   463                   v.Add(new Voltage("VTT", 0));
   464                   v.Add(new Voltage("+5V", 1, 15, 10));
   465                   v.Add(new Voltage("+12V", 2, 68, 22));
   466                   v.Add(new Voltage("Voltage #4", 3, true));
   467                   v.Add(new Voltage("Voltage #5", 4, true));
   468                   v.Add(new Voltage("CPU VCore", 5));
   469                   v.Add(new Voltage("DRAM", 6));
   470                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   471                   v.Add(new Voltage("VBat", 8, 10, 10));
   472                   t.Add(new Temperature("System", 0));
   473                   t.Add(new Temperature("CPU", 2));
   474                   f.Add(new Fan("CPU Fan", 0));
   475                   f.Add(new Fan("System Fan #1", 1));
   476                   f.Add(new Fan("Power Fan", 2));
   477                   f.Add(new Fan("System Fan #2", 3));
   478                   break;
   479                 case Model.Z68X_UD7_B3: // IT8728F
   480                   v.Add(new Voltage("VTT", 0));
   481                   v.Add(new Voltage("+3.3V", 1, 13.3f, 20.5f));
   482                   v.Add(new Voltage("+12V", 2, 68, 22));
   483                   v.Add(new Voltage("+5V", 3, 14.3f, 20));
   484                   v.Add(new Voltage("CPU VCore", 5));
   485                   v.Add(new Voltage("DRAM", 6));
   486                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   487                   v.Add(new Voltage("VBat", 8, 10, 10));
   488                   t.Add(new Temperature("System", 0));
   489                   t.Add(new Temperature("CPU", 1));
   490                   t.Add(new Temperature("System 3", 2));
   491                   f.Add(new Fan("CPU Fan", 0));
   492                   f.Add(new Fan("Power Fan", 1));
   493                   f.Add(new Fan("System Fan #1", 2));
   494                   f.Add(new Fan("System Fan #2", 3));
   495                   f.Add(new Fan("System Fan #3", 4));
   496                   break;
   497                 default:
   498                   v.Add(new Voltage("Voltage #1", 0, true));
   499                   v.Add(new Voltage("Voltage #2", 1, true));
   500                   v.Add(new Voltage("Voltage #3", 2, true));
   501                   v.Add(new Voltage("Voltage #4", 3, true));
   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("Standby +3.3V", 7, 10, 10, 0, true));
   506                   v.Add(new Voltage("VBat", 8, 10, 10));
   507                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   508                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   509                   for (int i = 0; i < superIO.Fans.Length; i++)
   510                     f.Add(new Fan("Fan #" + (i + 1), i));
   511                   break;
   512               }
   513               break;
   514             case Manufacturer.Shuttle:
   515               switch (model) {
   516                 case Model.FH67: // IT8772E 
   517                   v.Add(new Voltage("CPU VCore", 0));
   518                   v.Add(new Voltage("DRAM", 1));
   519                   v.Add(new Voltage("PCH VCCIO", 2));
   520                   v.Add(new Voltage("CPU VCCIO", 3));
   521                   v.Add(new Voltage("Graphic Voltage", 4));
   522                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   523                   v.Add(new Voltage("VBat", 8, 10, 10));
   524                   t.Add(new Temperature("System", 0));
   525                   t.Add(new Temperature("CPU", 1));                  
   526                   f.Add(new Fan("Fan #1", 0));
   527                   f.Add(new Fan("CPU Fan", 1));
   528                   break;
   529                 default:
   530                   v.Add(new Voltage("Voltage #1", 0, true));
   531                   v.Add(new Voltage("Voltage #2", 1, true));
   532                   v.Add(new Voltage("Voltage #3", 2, true));
   533                   v.Add(new Voltage("Voltage #4", 3, true));
   534                   v.Add(new Voltage("Voltage #5", 4, true));
   535                   v.Add(new Voltage("Voltage #6", 5, true));
   536                   v.Add(new Voltage("Voltage #7", 6, true));
   537                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   538                   v.Add(new Voltage("VBat", 8, 10, 10));
   539                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   540                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   541                   for (int i = 0; i < superIO.Fans.Length; i++)
   542                     f.Add(new Fan("Fan #" + (i + 1), i));
   543                   break;
   544               }
   545               break;
   546             default:
   547               v.Add(new Voltage("Voltage #1", 0, true));
   548               v.Add(new Voltage("Voltage #2", 1, true));
   549               v.Add(new Voltage("Voltage #3", 2, true));
   550               v.Add(new Voltage("Voltage #4", 3, true));
   551               v.Add(new Voltage("Voltage #5", 4, true));
   552               v.Add(new Voltage("Voltage #6", 5, true));
   553               v.Add(new Voltage("Voltage #7", 6, true));
   554               v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   555               v.Add(new Voltage("VBat", 8, 10, 10));
   556               for (int i = 0; i < superIO.Temperatures.Length; i++)
   557                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   558               for (int i = 0; i < superIO.Fans.Length; i++)
   559                 f.Add(new Fan("Fan #" + (i + 1), i));
   560               break;
   561           }
   562           break;
   563           
   564         case Chip.F71858:
   565           v.Add(new Voltage("VCC3V", 0, 150, 150));
   566           v.Add(new Voltage("VSB3V", 1, 150, 150));
   567           v.Add(new Voltage("Battery", 2, 150, 150));
   568           for (int i = 0; i < superIO.Temperatures.Length; i++)
   569             t.Add(new Temperature("Temperature #" + (i + 1), i));
   570           for (int i = 0; i < superIO.Fans.Length; i++)
   571             f.Add(new Fan("Fan #" + (i + 1), i));
   572           break;
   573         case Chip.F71862: 
   574         case Chip.F71869: 
   575         case Chip.F71882:
   576         case Chip.F71889AD: 
   577         case Chip.F71889ED: 
   578         case Chip.F71889F:
   579         case Chip.F71808E:
   580           switch (manufacturer) {
   581             case Manufacturer.EVGA:
   582               switch (model) {
   583                 case Model.X58_SLI_Classified: // F71882 
   584                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   585                   v.Add(new Voltage("CPU VCore", 1, 47, 100));
   586                   v.Add(new Voltage("DIMM", 2, 47, 100));
   587                   v.Add(new Voltage("CPU VTT", 3, 24, 100));
   588                   v.Add(new Voltage("IOH Vcore", 4, 24, 100));
   589                   v.Add(new Voltage("+5V", 5, 51, 12));
   590                   v.Add(new Voltage("+12V", 6, 56, 6.8f));
   591                   v.Add(new Voltage("3VSB", 7, 150, 150));
   592                   v.Add(new Voltage("VBat", 8, 150, 150));
   593                   t.Add(new Temperature("CPU", 0));
   594                   t.Add(new Temperature("VREG", 1));
   595                   t.Add(new Temperature("System", 2));
   596                   f.Add(new Fan("CPU Fan", 0));
   597                   f.Add(new Fan("Power Fan", 1));
   598                   f.Add(new Fan("Chassis Fan", 2));
   599                   break;
   600                 default:
   601                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   602                   v.Add(new Voltage("CPU VCore", 1));
   603                   v.Add(new Voltage("Voltage #3", 2, true));
   604                   v.Add(new Voltage("Voltage #4", 3, true));
   605                   v.Add(new Voltage("Voltage #5", 4, true));
   606                   v.Add(new Voltage("Voltage #6", 5, true));
   607                   v.Add(new Voltage("Voltage #7", 6, true));
   608                   v.Add(new Voltage("VSB3V", 7, 150, 150));
   609                   v.Add(new Voltage("VBat", 8, 150, 150));
   610                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   611                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   612                   for (int i = 0; i < superIO.Fans.Length; i++)
   613                     f.Add(new Fan("Fan #" + (i + 1), i));
   614                   break;
   615               }
   616               break;
   617             default:
   618               v.Add(new Voltage("VCC3V", 0, 150, 150));
   619               v.Add(new Voltage("CPU VCore", 1));
   620               v.Add(new Voltage("Voltage #3", 2, true));
   621               v.Add(new Voltage("Voltage #4", 3, true));
   622               v.Add(new Voltage("Voltage #5", 4, true));
   623               v.Add(new Voltage("Voltage #6", 5, true));
   624               if (superIO.Chip != Chip.F71808E) 
   625                   v.Add(new Voltage("Voltage #7", 6, true)); 
   626               v.Add(new Voltage("VSB3V", 7, 150, 150));
   627               v.Add(new Voltage("VBat", 8, 150, 150));
   628               for (int i = 0; i < superIO.Temperatures.Length; i++)
   629                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   630               for (int i = 0; i < superIO.Fans.Length; i++)
   631                 f.Add(new Fan("Fan #" + (i + 1), i));
   632               break;
   633           }
   634           break;
   635 
   636         case Chip.W83627EHF:
   637           switch (manufacturer) {
   638             case Manufacturer.ASRock:
   639               switch (model) {
   640                 case Model.AOD790GX_128M: // W83627EHF
   641                   v.Add(new Voltage("CPU VCore", 0));
   642                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   643                   v.Add(new Voltage("+3.3V", 4, 10, 10));
   644                   v.Add(new Voltage("+5V", 5, 20, 10));
   645                   v.Add(new Voltage("+12V", 6, 28, 5));
   646                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   647                   v.Add(new Voltage("VBAT", 8, 34, 34));
   648                   t.Add(new Temperature("CPU", 0));
   649                   t.Add(new Temperature("Motherboard", 2));
   650                   f.Add(new Fan("CPU Fan", 0));
   651                   f.Add(new Fan("Chassis Fan", 1));                 
   652                   break;
   653                 default:
   654                   v.Add(new Voltage("CPU VCore", 0));
   655                   v.Add(new Voltage("Voltage #2", 1, true));
   656                   v.Add(new Voltage("AVCC", 2, 34, 34));
   657                   v.Add(new Voltage("3VCC", 3, 34, 34));
   658                   v.Add(new Voltage("Voltage #5", 4, true));
   659                   v.Add(new Voltage("Voltage #6", 5, true));
   660                   v.Add(new Voltage("Voltage #7", 6, true));
   661                   v.Add(new Voltage("3VSB", 7, 34, 34));
   662                   v.Add(new Voltage("VBAT", 8, 34, 34));
   663                   v.Add(new Voltage("Voltage #10", 9, true));
   664                   t.Add(new Temperature("CPU", 0));
   665                   t.Add(new Temperature("Auxiliary", 1));
   666                   t.Add(new Temperature("System", 2));
   667                   f.Add(new Fan("System Fan", 0));
   668                   f.Add(new Fan("CPU Fan", 1));
   669                   f.Add(new Fan("Auxiliary Fan", 2));
   670                   f.Add(new Fan("CPU Fan #2", 3));
   671                   f.Add(new Fan("Auxiliary Fan #2", 4));
   672                   break;
   673               } break;
   674             default:
   675               v.Add(new Voltage("CPU VCore", 0));
   676               v.Add(new Voltage("Voltage #2", 1, true));
   677               v.Add(new Voltage("AVCC", 2, 34, 34));
   678               v.Add(new Voltage("3VCC", 3, 34, 34));
   679               v.Add(new Voltage("Voltage #5", 4, true));
   680               v.Add(new Voltage("Voltage #6", 5, true));
   681               v.Add(new Voltage("Voltage #7", 6, true));
   682               v.Add(new Voltage("3VSB", 7, 34, 34));
   683               v.Add(new Voltage("VBAT", 8, 34, 34));
   684               v.Add(new Voltage("Voltage #10", 9, true));
   685               t.Add(new Temperature("CPU", 0));
   686               t.Add(new Temperature("Auxiliary", 1));
   687               t.Add(new Temperature("System", 2));
   688               f.Add(new Fan("System Fan", 0));
   689               f.Add(new Fan("CPU Fan", 1));
   690               f.Add(new Fan("Auxiliary Fan", 2));
   691               f.Add(new Fan("CPU Fan #2", 3));
   692               f.Add(new Fan("Auxiliary Fan #2", 4));
   693               break;
   694           }
   695           break;
   696         case Chip.W83627DHG: 
   697         case Chip.W83627DHGP:                      
   698         case Chip.W83667HG:
   699         case Chip.W83667HGB:
   700           switch (manufacturer) {
   701             case Manufacturer.ASRock:
   702               switch (model) {
   703                 case Model._880GMH_USB3: // W83627DHG-P
   704                   v.Add(new Voltage("CPU VCore", 0));
   705                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   706                   v.Add(new Voltage("+5V", 5, 15, 7.5f));
   707                   v.Add(new Voltage("+12V", 6, 56, 10));
   708                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   709                   v.Add(new Voltage("VBAT", 8, 34, 34));
   710                   t.Add(new Temperature("CPU", 0));
   711                   t.Add(new Temperature("Motherboard", 2));
   712                   f.Add(new Fan("Chassis Fan", 0));
   713                   f.Add(new Fan("CPU Fan", 1));
   714                   f.Add(new Fan("Power Fan", 2));
   715                   break;
   716                 default:
   717                   v.Add(new Voltage("CPU VCore", 0));
   718                   v.Add(new Voltage("Voltage #2", 1, true));
   719                   v.Add(new Voltage("AVCC", 2, 34, 34));
   720                   v.Add(new Voltage("3VCC", 3, 34, 34));
   721                   v.Add(new Voltage("Voltage #5", 4, true));
   722                   v.Add(new Voltage("Voltage #6", 5, true));
   723                   v.Add(new Voltage("Voltage #7", 6, true));
   724                   v.Add(new Voltage("3VSB", 7, 34, 34));
   725                   v.Add(new Voltage("VBAT", 8, 34, 34));
   726                   t.Add(new Temperature("CPU", 0));
   727                   t.Add(new Temperature("Auxiliary", 1));
   728                   t.Add(new Temperature("System", 2));
   729                   f.Add(new Fan("System Fan", 0));
   730                   f.Add(new Fan("CPU Fan", 1));
   731                   f.Add(new Fan("Auxiliary Fan", 2));
   732                   f.Add(new Fan("CPU Fan #2", 3));
   733                   f.Add(new Fan("Auxiliary Fan #2", 4));
   734                   break;
   735               }
   736               break;
   737             case Manufacturer.ASUS:
   738               switch (model) {
   739                 case Model.P6T: // W83667HG
   740                 case Model.P6X58D_E: // W83667HG                 
   741                 case Model.Rampage_II_GENE: // W83667HG 
   742                   v.Add(new Voltage("CPU VCore", 0));
   743                   v.Add(new Voltage("+12V", 1, 11.5f, 1.91f));
   744                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   745                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   746                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   747                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   748                   v.Add(new Voltage("VBAT", 8, 34, 34));
   749                   t.Add(new Temperature("CPU", 0));
   750                   t.Add(new Temperature("Motherboard", 2));
   751                   f.Add(new Fan("Chassis Fan #1", 0));
   752                   f.Add(new Fan("CPU Fan", 1));
   753                   f.Add(new Fan("Power Fan", 2));
   754                   f.Add(new Fan("Chassis Fan #2", 3));
   755                   f.Add(new Fan("Chassis Fan #3", 4));
   756                   break;
   757                 case Model.Rampage_Extreme: // W83667HG 
   758                   v.Add(new Voltage("CPU VCore", 0));
   759                   v.Add(new Voltage("+12V", 1, 12, 2));
   760                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   761                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   762                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   763                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   764                   v.Add(new Voltage("VBAT", 8, 34, 34));
   765                   t.Add(new Temperature("CPU", 0));
   766                   t.Add(new Temperature("Motherboard", 2));
   767                   f.Add(new Fan("Chassis Fan #1", 0));
   768                   f.Add(new Fan("CPU Fan", 1));
   769                   f.Add(new Fan("Power Fan", 2));
   770                   f.Add(new Fan("Chassis Fan #2", 3));
   771                   f.Add(new Fan("Chassis Fan #3", 4));
   772                   break;
   773                 default:
   774                   v.Add(new Voltage("CPU VCore", 0));
   775                   v.Add(new Voltage("Voltage #2", 1, true));
   776                   v.Add(new Voltage("AVCC", 2, 34, 34));
   777                   v.Add(new Voltage("3VCC", 3, 34, 34));
   778                   v.Add(new Voltage("Voltage #5", 4, true));
   779                   v.Add(new Voltage("Voltage #6", 5, true));
   780                   v.Add(new Voltage("Voltage #7", 6, true));
   781                   v.Add(new Voltage("3VSB", 7, 34, 34));
   782                   v.Add(new Voltage("VBAT", 8, 34, 34));
   783                   t.Add(new Temperature("CPU", 0));
   784                   t.Add(new Temperature("Auxiliary", 1));
   785                   t.Add(new Temperature("System", 2));
   786                   f.Add(new Fan("System Fan", 0));
   787                   f.Add(new Fan("CPU Fan", 1));
   788                   f.Add(new Fan("Auxiliary Fan", 2));
   789                   f.Add(new Fan("CPU Fan #2", 3));
   790                   f.Add(new Fan("Auxiliary Fan #2", 4));
   791                   break;
   792               }
   793               break;
   794             default:
   795               v.Add(new Voltage("CPU VCore", 0));
   796               v.Add(new Voltage("Voltage #2", 1, true));
   797               v.Add(new Voltage("AVCC", 2, 34, 34));
   798               v.Add(new Voltage("3VCC", 3, 34, 34));
   799               v.Add(new Voltage("Voltage #5", 4, true));
   800               v.Add(new Voltage("Voltage #6", 5, true));
   801               v.Add(new Voltage("Voltage #7", 6, true));
   802               v.Add(new Voltage("3VSB", 7, 34, 34));
   803               v.Add(new Voltage("VBAT", 8, 34, 34));
   804               t.Add(new Temperature("CPU", 0));
   805               t.Add(new Temperature("Auxiliary", 1));
   806               t.Add(new Temperature("System", 2));
   807               f.Add(new Fan("System Fan", 0));
   808               f.Add(new Fan("CPU Fan", 1));
   809               f.Add(new Fan("Auxiliary Fan", 2));
   810               f.Add(new Fan("CPU Fan #2", 3));
   811               f.Add(new Fan("Auxiliary Fan #2", 4));
   812               break;
   813           } 
   814           break;
   815         case Chip.W83627HF: 
   816         case Chip.W83627THF: 
   817         case Chip.W83687THF:
   818           v.Add(new Voltage("CPU VCore", 0));
   819           v.Add(new Voltage("Voltage #2", 1, true));
   820           v.Add(new Voltage("Voltage #3", 2, true));
   821           v.Add(new Voltage("AVCC", 3, 34, 51));
   822           v.Add(new Voltage("Voltage #5", 4, true));
   823           v.Add(new Voltage("5VSB", 5, 34, 51));
   824           v.Add(new Voltage("VBAT", 6));
   825           t.Add(new Temperature("CPU", 0));
   826           t.Add(new Temperature("Auxiliary", 1));
   827           t.Add(new Temperature("System", 2));
   828           f.Add(new Fan("System Fan", 0));
   829           f.Add(new Fan("CPU Fan", 1));
   830           f.Add(new Fan("Auxiliary Fan", 2));
   831           break;
   832         case Chip.NCT6771F:
   833         case Chip.NCT6776F:
   834           switch (manufacturer) {
   835             case Manufacturer.ASUS:
   836               switch (model) {
   837                 case Model.P8P67: // NCT6776F
   838                 case Model.P8P67_EVO: // NCT6776F
   839                 case Model.P8P67_PRO: // NCT6776F
   840                   v.Add(new Voltage("CPU VCore", 0));
   841                   v.Add(new Voltage("+12V", 1, 11, 1));
   842                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   843                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   844                   v.Add(new Voltage("+5V", 4, 12, 3));
   845                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   846                   v.Add(new Voltage("VBAT", 8, 34, 34));
   847                   t.Add(new Temperature("CPU", 0));
   848                   t.Add(new Temperature("Auxiliary", 2));
   849                   t.Add(new Temperature("Motherboard", 3));
   850                   f.Add(new Fan("Chassis Fan #1", 0));
   851                   f.Add(new Fan("CPU Fan", 1));
   852                   f.Add(new Fan("Power Fan", 2));
   853                   f.Add(new Fan("Chassis Fan #2", 3));
   854                   c.Add(new Ctrl("Chassis Fan #2", 0));
   855                   c.Add(new Ctrl("CPU Fan", 1));
   856                   c.Add(new Ctrl("Chassis Fan #1", 2));
   857                   break;
   858                 case Model.P8P67_M_PRO: // NCT6776F
   859                   v.Add(new Voltage("CPU VCore", 0));
   860                   v.Add(new Voltage("+12V", 1, 11, 1));
   861                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   862                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   863                   v.Add(new Voltage("+5V", 4, 12, 3));
   864                   v.Add(new Voltage("Voltage #6", 5, true));
   865                   v.Add(new Voltage("Voltage #7", 6, true));
   866                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   867                   v.Add(new Voltage("VBAT", 8, 34, 34));
   868                   t.Add(new Temperature("CPU", 0));
   869                   t.Add(new Temperature("Motherboard", 3));
   870                   f.Add(new Fan("Chassis Fan #1", 0));
   871                   f.Add(new Fan("CPU Fan", 1));
   872                   f.Add(new Fan("Chassis Fan #2", 2));
   873                   f.Add(new Fan("Power Fan", 3));
   874                   f.Add(new Fan("Auxiliary Fan", 4));
   875                   break;
   876                 case Model.P8Z68_V_PRO: // NCT6776F
   877                   v.Add(new Voltage("CPU VCore", 0));
   878                   v.Add(new Voltage("+12V", 1, 11, 1));
   879                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   880                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   881                   v.Add(new Voltage("+5V", 4, 12, 3));
   882                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   883                   v.Add(new Voltage("VBAT", 8, 34, 34));
   884                   t.Add(new Temperature("CPU", 0));
   885                   t.Add(new Temperature("Auxiliary", 2));
   886                   t.Add(new Temperature("Motherboard", 3));
   887                   for (int i = 0; i < superIO.Fans.Length; i++)
   888                     f.Add(new Fan("Fan #" + (i + 1), i));
   889                   for (int i = 0; i < superIO.Controls.Length; i++)
   890                     c.Add(new Ctrl("Fan #" + (i + 1), i));
   891                   break;
   892                 case Model.P9X79: // NCT6776F
   893                   v.Add(new Voltage("CPU VCore", 0));
   894                   v.Add(new Voltage("+12V", 1, 11, 1));
   895                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   896                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   897                   v.Add(new Voltage("+5V", 4, 12, 3));
   898                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   899                   v.Add(new Voltage("VBAT", 8, 34, 34));
   900                   t.Add(new Temperature("CPU", 0));
   901                   t.Add(new Temperature("Motherboard", 3));
   902                   for (int i = 0; i < superIO.Fans.Length; i++)
   903                     f.Add(new Fan("Fan #" + (i + 1), i));
   904                   break;
   905                 default:
   906                   v.Add(new Voltage("CPU VCore", 0));
   907                   v.Add(new Voltage("Voltage #2", 1, true));
   908                   v.Add(new Voltage("AVCC", 2, 34, 34));
   909                   v.Add(new Voltage("3VCC", 3, 34, 34));
   910                   v.Add(new Voltage("Voltage #5", 4, true));
   911                   v.Add(new Voltage("Voltage #6", 5, true));
   912                   v.Add(new Voltage("Voltage #7", 6, true));
   913                   v.Add(new Voltage("3VSB", 7, 34, 34));
   914                   v.Add(new Voltage("VBAT", 8, 34, 34));
   915                   t.Add(new Temperature("CPU", 0));
   916                   t.Add(new Temperature("CPU", 1));
   917                   t.Add(new Temperature("Auxiliary", 2));
   918                   t.Add(new Temperature("System", 3));
   919                   for (int i = 0; i < superIO.Fans.Length; i++)
   920                     f.Add(new Fan("Fan #" + (i + 1), i));
   921                   break;
   922               }
   923               break;
   924             default:
   925               v.Add(new Voltage("CPU VCore", 0));
   926               v.Add(new Voltage("Voltage #2", 1, true));
   927               v.Add(new Voltage("AVCC", 2, 34, 34));
   928               v.Add(new Voltage("3VCC", 3, 34, 34));
   929               v.Add(new Voltage("Voltage #5", 4, true));
   930               v.Add(new Voltage("Voltage #6", 5, true));
   931               v.Add(new Voltage("Voltage #7", 6, true));
   932               v.Add(new Voltage("3VSB", 7, 34, 34));
   933               v.Add(new Voltage("VBAT", 8, 34, 34));
   934               t.Add(new Temperature("CPU", 0));
   935               t.Add(new Temperature("CPU", 1));
   936               t.Add(new Temperature("Auxiliary", 2));
   937               t.Add(new Temperature("System", 3));
   938               for (int i = 0; i < superIO.Fans.Length; i++)
   939                 f.Add(new Fan("Fan #" + (i + 1), i));
   940               break;
   941           }
   942           break;
   943         default:
   944           for (int i = 0; i < superIO.Voltages.Length; i++)
   945             v.Add(new Voltage("Voltage #" + (i + 1), i, true));
   946           for (int i = 0; i < superIO.Temperatures.Length; i++)
   947             t.Add(new Temperature("Temperature #" + (i + 1), i));
   948           for (int i = 0; i < superIO.Fans.Length; i++)
   949             f.Add(new Fan("Fan #" + (i + 1), i));
   950           for (int i = 0; i < superIO.Controls.Length; i++)
   951             c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   952           break;
   953       }
   954 
   955       const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
   956       foreach (Voltage voltage in v) 
   957         if (voltage.Index < superIO.Voltages.Length) {
   958           Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
   959             voltage.Hidden, SensorType.Voltage, this, new [] {
   960             new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
   961               formula, voltage.Ri),
   962             new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
   963               formula, voltage.Rf),
   964             new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
   965               formula, voltage.Vf)
   966             }, settings);
   967           voltages.Add(sensor);
   968       }
   969 
   970       foreach (Temperature temperature in t) 
   971         if (temperature.Index < superIO.Temperatures.Length) {
   972         Sensor sensor = new Sensor(temperature.Name, temperature.Index,
   973           SensorType.Temperature, this, new [] {
   974           new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
   975         }, settings);
   976         temperatures.Add(sensor);
   977       }
   978 
   979       foreach (Fan fan in f)
   980         if (fan.Index < superIO.Fans.Length) {
   981           Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
   982             this, settings);
   983           fans.Add(sensor);
   984         }
   985 
   986       foreach (Ctrl ctrl in c) {
   987         int index = ctrl.Index;
   988         if (index < superIO.Controls.Length) {
   989           Sensor sensor = new Sensor(ctrl.Name, index, SensorType.Control,
   990             this, settings);
   991           Control control = new Control(sensor, settings, 0, 100);
   992           control.ControlModeChanged += (cc) => {
   993             if (cc.ControlMode == ControlMode.Default) {
   994               superIO.SetControl(index, null);
   995             } else {
   996               superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
   997             }
   998           };
   999           control.SoftwareControlValueChanged += (cc) => {
  1000             if (cc.ControlMode == ControlMode.Software) 
  1001               superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
  1002           };
  1003           if (control.ControlMode == ControlMode.Software) 
  1004             superIO.SetControl(index, (byte)(control.SoftwareValue * 2.55));
  1005           sensor.Control = control;
  1006           controls.Add(sensor);
  1007         }
  1008       }
  1009     }
  1010 
  1011     public override HardwareType HardwareType {
  1012       get { return HardwareType.SuperIO; }
  1013     }
  1014 
  1015     public override IHardware Parent {
  1016       get { return mainboard; }
  1017     }
  1018 
  1019 
  1020     public override string GetReport() {
  1021       return superIO.GetReport();
  1022     }
  1023 
  1024     public override void Update() {
  1025       superIO.Update();
  1026 
  1027       foreach (Sensor sensor in voltages) {
  1028         float? value = readVoltage(sensor.Index);
  1029         if (value.HasValue) {
  1030           sensor.Value = value + (value - sensor.Parameters[2].Value) *
  1031             sensor.Parameters[0].Value / sensor.Parameters[1].Value;
  1032           ActivateSensor(sensor);
  1033         }
  1034       }
  1035 
  1036       foreach (Sensor sensor in temperatures) {
  1037         float? value = readTemperature(sensor.Index);
  1038         if (value.HasValue) {
  1039           sensor.Value = value + sensor.Parameters[0].Value;
  1040           ActivateSensor(sensor);
  1041         }
  1042       }
  1043 
  1044       foreach (Sensor sensor in fans) {
  1045         float? value = readFan(sensor.Index);
  1046         if (value.HasValue) {
  1047           sensor.Value = value;
  1048           if (value.Value > 0)
  1049             ActivateSensor(sensor);
  1050         }
  1051       }
  1052 
  1053       foreach (Sensor sensor in controls) {
  1054         float? value = readControl(sensor.Index);
  1055         if (value.HasValue) {
  1056           sensor.Value = value;
  1057           ActivateSensor(sensor);
  1058         }
  1059       }
  1060 
  1061       postUpdate();
  1062     }
  1063 
  1064     public override void Close() {
  1065       foreach (Sensor sensor in controls) {
  1066         // restore all controls back to default
  1067         superIO.SetControl(sensor.Index, null);
  1068       }
  1069       base.Close();
  1070     }
  1071 
  1072     private class Voltage {
  1073       public readonly string Name;
  1074       public readonly int Index;
  1075       public readonly float Ri;
  1076       public readonly float Rf;
  1077       public readonly float Vf;
  1078       public readonly bool Hidden;
  1079 
  1080       public Voltage(string name, int index) :
  1081         this(name, index, false) { }
  1082       
  1083       public Voltage(string name, int index, bool hidden) :
  1084         this(name, index, 0, 1, 0, hidden) { }
  1085       
  1086       public Voltage(string name, int index, float ri, float rf) :
  1087         this(name, index, ri, rf, 0, false) { }
  1088       
  1089       // float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
  1090       
  1091       public Voltage(string name, int index, 
  1092         float ri, float rf, float vf, bool hidden) 
  1093       {
  1094         this.Name = name;
  1095         this.Index = index;
  1096         this.Ri = ri;
  1097         this.Rf = rf;
  1098         this.Vf = vf;
  1099         this.Hidden = hidden;
  1100       }
  1101     }
  1102 
  1103     private class Temperature {
  1104       public readonly string Name;
  1105       public readonly int Index;
  1106 
  1107       public Temperature(string name, int index) {
  1108         this.Name = name;
  1109         this.Index = index;
  1110       }
  1111     }
  1112 
  1113     private class Fan {
  1114       public readonly string Name;
  1115       public readonly int Index;
  1116 
  1117       public Fan(string name, int index) {
  1118         this.Name = name;
  1119         this.Index = index;
  1120       }
  1121     }
  1122 
  1123     private class Ctrl {
  1124       public readonly string Name;
  1125       public readonly int Index;
  1126 
  1127       public Ctrl(string name, int index) {
  1128         this.Name = name;
  1129         this.Index = index;
  1130       }
  1131     }
  1132   }
  1133 }