Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Sun, 21 Jul 2013 14:17:11 +0000
changeset 413 362c5e77197d
parent 408 bbeb9004c491
child 416 f117373bd190
permissions -rw-r--r--
Added experimental support for the Nuvoton NCT6791D super I/O chip.
     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-2013 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.IT8705F:
    66         case Chip.IT8712F:
    67         case Chip.IT8716F:
    68         case Chip.IT8718F:
    69         case Chip.IT8720F: 
    70         case Chip.IT8726F:        
    71           switch (manufacturer) {
    72             case Manufacturer.ASUS:
    73               switch (model) {
    74                 case Model.Crosshair_III_Formula: // IT8720F
    75                   v.Add(new Voltage("VBat", 8));
    76                   t.Add(new Temperature("CPU", 0));
    77                   for (int i = 0; i < superIO.Fans.Length; i++)
    78                     f.Add(new Fan("Fan #" + (i + 1), i));
    79                   break;
    80                 case Model.M2N_SLI_DELUXE:                
    81                   v.Add(new Voltage("CPU VCore", 0));
    82                   v.Add(new Voltage("+3.3V", 1));
    83                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
    84                   v.Add(new Voltage("+12V", 4, 30, 10));
    85                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
    86                   v.Add(new Voltage("VBat", 8));
    87                   t.Add(new Temperature("CPU", 0));
    88                   t.Add(new Temperature("Motherboard", 1));
    89                   f.Add(new Fan("CPU Fan", 0));
    90                   f.Add(new Fan("Chassis Fan #1", 1));
    91                   f.Add(new Fan("Power Fan", 2));
    92                   break;
    93                 case Model.M4A79XTD_EVO: // IT8720F           
    94                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
    95                   v.Add(new Voltage("VBat", 8));
    96                   t.Add(new Temperature("CPU", 0));
    97                   t.Add(new Temperature("Motherboard", 1));
    98                   f.Add(new Fan("CPU Fan", 0));
    99                   f.Add(new Fan("Chassis Fan #1", 1));
   100                   f.Add(new Fan("Chassis Fan #2", 2));
   101                   break;
   102                 default:
   103                   v.Add(new Voltage("CPU VCore", 0));
   104                   v.Add(new Voltage("Voltage #2", 1, true));
   105                   v.Add(new Voltage("Voltage #3", 2, true));
   106                   v.Add(new Voltage("Voltage #4", 3, true));
   107                   v.Add(new Voltage("Voltage #5", 4, true));
   108                   v.Add(new Voltage("Voltage #6", 5, true));
   109                   v.Add(new Voltage("Voltage #7", 6, true));
   110                   v.Add(new Voltage("Voltage #8", 7, true));
   111                   v.Add(new Voltage("VBat", 8));
   112                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   113                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   114                   for (int i = 0; i < superIO.Fans.Length; i++)
   115                     f.Add(new Fan("Fan #" + (i + 1), i));
   116                   for (int i = 0; i < superIO.Controls.Length; i++)
   117                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   118                   break;
   119               }
   120               break;
   121 
   122             case Manufacturer.ASRock:
   123               switch (model) {
   124                 case Model.P55_Deluxe: // IT8720F
   125                   
   126                   v.Add(new Voltage("CPU VCore", 0));
   127                   v.Add(new Voltage("+3.3V", 2));
   128                   v.Add(new Voltage("+12V", 4, 30, 10));
   129                   v.Add(new Voltage("+5V", 5, 6.8f, 10));
   130                   v.Add(new Voltage("VBat", 8));                  
   131                   t.Add(new Temperature("CPU", 0));
   132                   t.Add(new Temperature("Motherboard", 1));
   133                   f.Add(new Fan("CPU Fan", 0));
   134                   f.Add(new Fan("Chassis Fan #1", 1));
   135 
   136                   // this mutex is also used by the official ASRock tool
   137                   mutex = new Mutex(false, "ASRockOCMark");
   138                   
   139                   bool exclusiveAccess = false;
   140                   try {
   141                     exclusiveAccess = mutex.WaitOne(10, false);
   142                   } catch (AbandonedMutexException) { } 
   143                     catch (InvalidOperationException) { }  
   144 
   145                   // only read additional fans if we get exclusive access
   146                   if (exclusiveAccess) {
   147 
   148                     f.Add(new Fan("Chassis Fan #2", 2));
   149                     f.Add(new Fan("Chassis Fan #3", 3));
   150                     f.Add(new Fan("Power Fan", 4));
   151 
   152                     readFan = (index) => {
   153                       if (index < 2) {
   154                         return superIO.Fans[index];
   155                       } else {
   156                         // get GPIO 80-87
   157                         byte? gpio = superIO.ReadGPIO(7);
   158                         if (!gpio.HasValue)
   159                           return null;
   160 
   161                         // read the last 3 fans based on GPIO 83-85
   162                         int[] masks = { 0x05, 0x03, 0x06 };
   163                         return (((gpio.Value >> 3) & 0x07) ==
   164                           masks[index - 2]) ? superIO.Fans[2] : null;
   165                       }
   166                     };
   167 
   168                     int fanIndex = 0;
   169                     postUpdate = () => {
   170                       // get GPIO 80-87
   171                       byte? gpio = superIO.ReadGPIO(7);
   172                       if (!gpio.HasValue)
   173                         return;
   174 
   175                       // prepare the GPIO 83-85 for the next update
   176                       int[] masks = { 0x05, 0x03, 0x06 };
   177                       superIO.WriteGPIO(7,
   178                         (byte)((gpio.Value & 0xC7) | (masks[fanIndex] << 3)));
   179                       fanIndex = (fanIndex + 1) % 3;
   180                     };
   181                   }
   182 
   183                   break;
   184                 default:
   185                   v.Add(new Voltage("CPU VCore", 0));
   186                   v.Add(new Voltage("Voltage #2", 1, true));
   187                   v.Add(new Voltage("Voltage #3", 2, true));
   188                   v.Add(new Voltage("Voltage #4", 3, true));
   189                   v.Add(new Voltage("Voltage #5", 4, true));
   190                   v.Add(new Voltage("Voltage #6", 5, true));
   191                   v.Add(new Voltage("Voltage #7", 6, true));
   192                   v.Add(new Voltage("Voltage #8", 7, true));
   193                   v.Add(new Voltage("VBat", 8));
   194                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   195                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   196                   for (int i = 0; i < superIO.Fans.Length; i++)
   197                     f.Add(new Fan("Fan #" + (i + 1), i));
   198                   break;
   199               };
   200               break;
   201 
   202             case Manufacturer.DFI:
   203               switch (model) {
   204                 case Model.LP_BI_P45_T2RS_Elite: // IT8718F
   205                   v.Add(new Voltage("CPU VCore", 0));
   206                   v.Add(new Voltage("FSB VTT", 1));
   207                   v.Add(new Voltage("+3.3V", 2));
   208                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   209                   v.Add(new Voltage("+12V", 4, 30, 10));
   210                   v.Add(new Voltage("NB Core", 5));
   211                   v.Add(new Voltage("VDIMM", 6));
   212                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   213                   v.Add(new Voltage("VBat", 8));
   214                   t.Add(new Temperature("CPU", 0));
   215                   t.Add(new Temperature("System", 1));
   216                   t.Add(new Temperature("Chipset", 2));
   217                   f.Add(new Fan("Fan #1", 0));
   218                   f.Add(new Fan("Fan #2", 1));
   219                   f.Add(new Fan("Fan #3", 2));
   220                   break;
   221                 case Model.LP_DK_P55_T3eH9: // IT8720F
   222                   v.Add(new Voltage("CPU VCore", 0));
   223                   v.Add(new Voltage("VTT", 1));
   224                   v.Add(new Voltage("+3.3V", 2));
   225                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   226                   v.Add(new Voltage("+12V", 4, 30, 10));
   227                   v.Add(new Voltage("CPU PLL", 5));
   228                   v.Add(new Voltage("DRAM", 6));
   229                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10));
   230                   v.Add(new Voltage("VBat", 8));
   231                   t.Add(new Temperature("Chipset", 0));
   232                   t.Add(new Temperature("CPU PWM", 1));
   233                   t.Add(new Temperature("CPU", 2));
   234                   f.Add(new Fan("Fan #1", 0));
   235                   f.Add(new Fan("Fan #2", 1));
   236                   f.Add(new Fan("Fan #3", 2));
   237                   break;
   238                 default:
   239                   v.Add(new Voltage("CPU VCore", 0));
   240                   v.Add(new Voltage("VTT", 1, true));
   241                   v.Add(new Voltage("+3.3V", 2, true));
   242                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   243                   v.Add(new Voltage("+12V", 4, 30, 10, 0, true));
   244                   v.Add(new Voltage("Voltage #6", 5, true));
   245                   v.Add(new Voltage("DRAM", 6, true));
   246                   v.Add(new Voltage("+5VSB", 7, 6.8f, 10, 0, true));
   247                   v.Add(new Voltage("VBat", 8));
   248                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   249                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   250                   for (int i = 0; i < superIO.Fans.Length; i++)
   251                     f.Add(new Fan("Fan #" + (i + 1), i));
   252                   for (int i = 0; i < superIO.Controls.Length; i++)
   253                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   254                   break;
   255               }
   256               break;
   257 
   258             case Manufacturer.Gigabyte:
   259               switch (model) {
   260                 case Model._965P_S3: // IT8718F
   261                   v.Add(new Voltage("CPU VCore", 0));
   262                   v.Add(new Voltage("DRAM", 1));
   263                   v.Add(new Voltage("+3.3V", 2));
   264                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   265                   v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
   266                   v.Add(new Voltage("VBat", 8));
   267                   t.Add(new Temperature("System", 0));
   268                   t.Add(new Temperature("CPU", 1));
   269                   f.Add(new Fan("CPU Fan", 0));
   270                   f.Add(new Fan("System Fan", 1));
   271                   break;
   272                 case Model.EP45_DS3R: // IT8718F
   273                 case Model.EP45_UD3R: 
   274                 case Model.X38_DS5:    
   275                   v.Add(new Voltage("CPU VCore", 0));
   276                   v.Add(new Voltage("DRAM", 1));
   277                   v.Add(new Voltage("+3.3V", 2));
   278                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   279                   v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
   280                   v.Add(new Voltage("VBat", 8));
   281                   t.Add(new Temperature("System", 0));
   282                   t.Add(new Temperature("CPU", 1));
   283                   f.Add(new Fan("CPU Fan", 0));
   284                   f.Add(new Fan("System Fan #2", 1));
   285                   f.Add(new Fan("Power Fan", 2));
   286                   f.Add(new Fan("System Fan #1", 3));
   287                   break;
   288                 case Model.EX58_EXTREME: // IT8720F                 
   289                   v.Add(new Voltage("CPU VCore", 0));
   290                   v.Add(new Voltage("DRAM", 1));
   291                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   292                   v.Add(new Voltage("VBat", 8));
   293                   t.Add(new Temperature("System", 0));
   294                   t.Add(new Temperature("CPU", 1));
   295                   t.Add(new Temperature("Northbridge", 2));
   296                   f.Add(new Fan("CPU Fan", 0));
   297                   f.Add(new Fan("System Fan #2", 1));
   298                   f.Add(new Fan("Power Fan", 2));
   299                   f.Add(new Fan("System Fan #1", 3));
   300                   break;
   301                 case Model.P35_DS3: // IT8718F 
   302                 case Model.P35_DS3L: // IT8718F
   303                   v.Add(new Voltage("CPU VCore", 0));
   304                   v.Add(new Voltage("DRAM", 1));
   305                   v.Add(new Voltage("+3.3V", 2));
   306                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   307                   v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
   308                   v.Add(new Voltage("VBat", 8));
   309                   t.Add(new Temperature("System", 0));
   310                   t.Add(new Temperature("CPU", 1));
   311                   f.Add(new Fan("CPU Fan", 0));
   312                   f.Add(new Fan("System Fan #1", 1));
   313                   f.Add(new Fan("System Fan #2", 2));
   314                   f.Add(new Fan("Power Fan", 3));
   315                   break;
   316                 case Model.P55_UD4: // IT8720F
   317                 case Model.P55A_UD3: // IT8720F
   318                 case Model.P55M_UD4: // IT8720F                
   319                 case Model.H55_USB3: // IT8720F
   320                 case Model.EX58_UD3R: // IT8720F 
   321                   v.Add(new Voltage("CPU VCore", 0));
   322                   v.Add(new Voltage("DRAM", 1));
   323                   v.Add(new Voltage("+3.3V", 2));
   324                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   325                   v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
   326                   v.Add(new Voltage("VBat", 8));
   327                   t.Add(new Temperature("System", 0));
   328                   t.Add(new Temperature("CPU", 2));
   329                   f.Add(new Fan("CPU Fan", 0));
   330                   f.Add(new Fan("System Fan #2", 1));
   331                   f.Add(new Fan("Power Fan", 2));
   332                   f.Add(new Fan("System Fan #1", 3));
   333                   break;
   334                 case Model.H55N_USB3: // IT8720F
   335                   v.Add(new Voltage("CPU VCore", 0));
   336                   v.Add(new Voltage("DRAM", 1));
   337                   v.Add(new Voltage("+3.3V", 2));
   338                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   339                   v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
   340                   v.Add(new Voltage("VBat", 8));
   341                   t.Add(new Temperature("System", 0));
   342                   t.Add(new Temperature("CPU", 2));
   343                   f.Add(new Fan("CPU Fan", 0));
   344                   f.Add(new Fan("System Fan", 1));
   345                   break;
   346                 case Model.G41M_Combo: // IT8718F
   347                 case Model.G41MT_S2: // IT8718F
   348                 case Model.G41MT_S2P: // IT8718F
   349                   v.Add(new Voltage("CPU VCore", 0));
   350                   v.Add(new Voltage("DRAM", 1));
   351                   v.Add(new Voltage("+3.3V", 2));
   352                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   353                   v.Add(new Voltage("+12V", 7, 24.3f, 8.2f));
   354                   v.Add(new Voltage("VBat", 8));
   355                   t.Add(new Temperature("CPU", 2));
   356                   f.Add(new Fan("CPU Fan", 0));
   357                   f.Add(new Fan("System Fan", 1));
   358                   break;
   359                 case Model.GA_970A_UD3: // IT8720F
   360                   v.Add(new Voltage("CPU VCore", 0));
   361                   v.Add(new Voltage("DRAM", 1));
   362                   v.Add(new Voltage("+3.3V", 2));
   363                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   364                   v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
   365                   v.Add(new Voltage("VBat", 8));
   366                   t.Add(new Temperature("System", 0));
   367                   t.Add(new Temperature("CPU", 1));
   368                   f.Add(new Fan("CPU Fan", 0));
   369                   f.Add(new Fan("System Fan #1", 1));
   370                   f.Add(new Fan("System Fan #2", 2));
   371                   f.Add(new Fan("Power Fan", 4));
   372                   c.Add(new Ctrl("PWM 1", 0));
   373                   c.Add(new Ctrl("PWM 2", 1));
   374                   c.Add(new Ctrl("PWM 3", 2));
   375                   break;
   376                 case Model.GA_MA770T_UD3: // IT8720F
   377                 case Model.GA_MA770T_UD3P: // IT8720F                
   378                 case Model.GA_MA790X_UD3P: // IT8720F
   379                   v.Add(new Voltage("CPU VCore", 0));
   380                   v.Add(new Voltage("DRAM", 1));
   381                   v.Add(new Voltage("+3.3V", 2));
   382                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   383                   v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
   384                   v.Add(new Voltage("VBat", 8));
   385                   t.Add(new Temperature("System", 0));
   386                   t.Add(new Temperature("CPU", 1));
   387                   f.Add(new Fan("CPU Fan", 0));
   388                   f.Add(new Fan("System Fan #1", 1));
   389                   f.Add(new Fan("System Fan #2", 2));
   390                   f.Add(new Fan("Power Fan", 3));
   391                   break;
   392                 case Model.GA_MA78LM_S2H: // IT8718F
   393                   v.Add(new Voltage("CPU VCore", 0));
   394                   v.Add(new Voltage("DRAM", 1));
   395                   v.Add(new Voltage("+3.3V", 2));
   396                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   397                   v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
   398                   v.Add(new Voltage("VBat", 8));
   399                   t.Add(new Temperature("System", 0));
   400                   t.Add(new Temperature("CPU", 1));
   401                   t.Add(new Temperature("VRM", 2));
   402                   f.Add(new Fan("CPU Fan", 0));
   403                   f.Add(new Fan("System Fan #1", 1));
   404                   f.Add(new Fan("System Fan #2", 2));
   405                   f.Add(new Fan("Power Fan", 3));
   406                   break;
   407                 case Model.GA_MA785GM_US2H: // IT8718F
   408                 case Model.GA_MA785GMT_UD2H: // IT8718F
   409                   v.Add(new Voltage("CPU VCore", 0));
   410                   v.Add(new Voltage("DRAM", 1));
   411                   v.Add(new Voltage("+3.3V", 2));
   412                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   413                   v.Add(new Voltage("+12V", 4, 24.3f, 8.2f));
   414                   v.Add(new Voltage("VBat", 8));
   415                   t.Add(new Temperature("System", 0));
   416                   t.Add(new Temperature("CPU", 1));
   417                   f.Add(new Fan("CPU Fan", 0));
   418                   f.Add(new Fan("System Fan", 1));
   419                   f.Add(new Fan("NB Fan", 2));
   420                   break;
   421                 case Model.X58A_UD3R: // IT8720F 
   422                   v.Add(new Voltage("CPU VCore", 0));
   423                   v.Add(new Voltage("DRAM", 1));
   424                   v.Add(new Voltage("+3.3V", 2));
   425                   v.Add(new Voltage("+5V", 3, 6.8f, 10));
   426                   v.Add(new Voltage("+12V", 5, 24.3f, 8.2f));
   427                   v.Add(new Voltage("VBat", 8));
   428                   t.Add(new Temperature("System", 0));
   429                   t.Add(new Temperature("CPU", 1));
   430                   t.Add(new Temperature("Northbridge", 2));
   431                   f.Add(new Fan("CPU Fan", 0));
   432                   f.Add(new Fan("System Fan #2", 1));
   433                   f.Add(new Fan("Power Fan", 2));
   434                   f.Add(new Fan("System Fan #1", 3));
   435                   break;
   436                 default:
   437                   v.Add(new Voltage("CPU VCore", 0));
   438                   v.Add(new Voltage("DRAM", 1, true));
   439                   v.Add(new Voltage("+3.3V", 2, true));
   440                   v.Add(new Voltage("+5V", 3, 6.8f, 10, 0, true));
   441                   v.Add(new Voltage("Voltage #5", 4, true));
   442                   v.Add(new Voltage("Voltage #6", 5, true));
   443                   v.Add(new Voltage("Voltage #7", 6, true));
   444                   v.Add(new Voltage("Voltage #8", 7, true));
   445                   v.Add(new Voltage("VBat", 8));
   446                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   447                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   448                   for (int i = 0; i < superIO.Fans.Length; i++)
   449                     f.Add(new Fan("Fan #" + (i + 1), i));
   450                   for (int i = 0; i < superIO.Controls.Length; i++)
   451                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   452                   break;
   453               }
   454               break;
   455 
   456             default:
   457               v.Add(new Voltage("CPU VCore", 0));
   458               v.Add(new Voltage("Voltage #2", 1, true));
   459               v.Add(new Voltage("Voltage #3", 2, true));
   460               v.Add(new Voltage("Voltage #4", 3, true));
   461               v.Add(new Voltage("Voltage #5", 4, true));
   462               v.Add(new Voltage("Voltage #6", 5, true));
   463               v.Add(new Voltage("Voltage #7", 6, true));
   464               v.Add(new Voltage("Voltage #8", 7, true));
   465               v.Add(new Voltage("VBat", 8));
   466               for (int i = 0; i < superIO.Temperatures.Length; i++)
   467                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   468               for (int i = 0; i < superIO.Fans.Length; i++)
   469                 f.Add(new Fan("Fan #" + (i + 1), i));
   470               for (int i = 0; i < superIO.Controls.Length; i++)
   471                 c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   472               break;
   473           }
   474           break;
   475 
   476         case Chip.IT8721F:
   477         case Chip.IT8728F:
   478         case Chip.IT8771E:
   479         case Chip.IT8772E:
   480           switch (manufacturer) {
   481             case Manufacturer.ECS:
   482               switch (model) {
   483                 case Model.A890GXM_A: // IT8721F
   484                   v.Add(new Voltage("CPU VCore", 0));
   485                   v.Add(new Voltage("VDIMM", 1));
   486                   v.Add(new Voltage("NB Voltage", 2));
   487                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10));
   488                   // v.Add(new Voltage("VDIMM", 6, true));
   489                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   490                   v.Add(new Voltage("VBat", 8, 10, 10));
   491                   t.Add(new Temperature("CPU", 0));
   492                   t.Add(new Temperature("System", 1));
   493                   t.Add(new Temperature("Northbridge", 2));
   494                   f.Add(new Fan("CPU Fan", 0));
   495                   f.Add(new Fan("System Fan", 1));
   496                   f.Add(new Fan("Power Fan", 2));
   497                   break;
   498                 default:
   499                   v.Add(new Voltage("Voltage #1", 0, true));
   500                   v.Add(new Voltage("Voltage #2", 1, true));
   501                   v.Add(new Voltage("Voltage #3", 2, true));
   502                   v.Add(new Voltage("Analog +3.3V", 3, 10, 10, 0, true));
   503                   v.Add(new Voltage("Voltage #5", 4, true));
   504                   v.Add(new Voltage("Voltage #6", 5, true));
   505                   v.Add(new Voltage("Voltage #7", 6, true));
   506                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   507                   v.Add(new Voltage("VBat", 8, 10, 10));
   508                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   509                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   510                   for (int i = 0; i < superIO.Fans.Length; i++)
   511                     f.Add(new Fan("Fan #" + (i + 1), i));
   512                   for (int i = 0; i < superIO.Controls.Length; i++)
   513                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   514                   break;
   515               }
   516               break;
   517             case Manufacturer.Gigabyte:
   518               switch (model) {
   519                 case Model.H61M_DS2_REV_1_2: // IT8728F
   520                 case Model.H61M_USB3_B3_REV_2_0: // IT8728F
   521                   v.Add(new Voltage("VTT", 0));
   522                   v.Add(new Voltage("+12V", 2, 30.9f, 10));
   523                   v.Add(new Voltage("CPU VCore", 5));
   524                   v.Add(new Voltage("DRAM", 6));
   525                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   526                   v.Add(new Voltage("VBat", 8, 10, 10));
   527                   t.Add(new Temperature("System", 0));
   528                   t.Add(new Temperature("CPU", 2));
   529                   f.Add(new Fan("CPU Fan", 0));
   530                   f.Add(new Fan("System Fan", 1));
   531                   break;
   532                 case Model.H67A_UD3H_B3: // IT8728F
   533                 case Model.H67A_USB3_B3: // IT8728F                
   534                   v.Add(new Voltage("VTT", 0));
   535                   v.Add(new Voltage("+5V", 1, 15, 10));
   536                   v.Add(new Voltage("+12V", 2, 30.9f, 10));
   537                   v.Add(new Voltage("CPU VCore", 5));
   538                   v.Add(new Voltage("DRAM", 6));
   539                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   540                   v.Add(new Voltage("VBat", 8, 10, 10));
   541                   t.Add(new Temperature("System", 0));
   542                   t.Add(new Temperature("CPU", 2));
   543                   f.Add(new Fan("CPU Fan", 0));
   544                   f.Add(new Fan("System Fan #1", 1));
   545                   f.Add(new Fan("Power Fan", 2));
   546                   f.Add(new Fan("System Fan #2", 3));
   547                   break;
   548                 case Model.Z68A_D3H_B3: // IT8728F
   549                   v.Add(new Voltage("VTT", 0));
   550                   v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
   551                   v.Add(new Voltage("+12V", 2, 30.9f, 10));
   552                   v.Add(new Voltage("+5V", 3, 7.15f, 10));
   553                   v.Add(new Voltage("CPU VCore", 5));
   554                   v.Add(new Voltage("DRAM", 6));
   555                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   556                   v.Add(new Voltage("VBat", 8, 10, 10));
   557                   t.Add(new Temperature("System", 0));
   558                   t.Add(new Temperature("CPU", 2));
   559                   f.Add(new Fan("CPU Fan", 0));
   560                   f.Add(new Fan("System Fan #1", 1));
   561                   f.Add(new Fan("Power Fan", 2));
   562                   f.Add(new Fan("System Fan #2", 3));
   563                   break;
   564                 case Model.P67A_UD3_B3: // IT8728F
   565                 case Model.P67A_UD3R_B3: // IT8728F
   566                 case Model.P67A_UD4_B3: // IT8728F                
   567                 case Model.Z68AP_D3: // IT8728F
   568                 case Model.Z68X_UD3H_B3: // IT8728F               
   569                   v.Add(new Voltage("VTT", 0));
   570                   v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
   571                   v.Add(new Voltage("+12V", 2, 30.9f, 10));
   572                   v.Add(new Voltage("+5V", 3, 7.15f, 10));
   573                   v.Add(new Voltage("CPU VCore", 5));
   574                   v.Add(new Voltage("DRAM", 6));
   575                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   576                   v.Add(new Voltage("VBat", 8, 10, 10));
   577                   t.Add(new Temperature("System", 0));
   578                   t.Add(new Temperature("CPU", 2));
   579                   f.Add(new Fan("CPU Fan", 0));
   580                   f.Add(new Fan("System Fan #2", 1));
   581                   f.Add(new Fan("Power Fan", 2));
   582                   f.Add(new Fan("System Fan #1", 3));
   583                   break;                
   584                 case Model.Z68X_UD7_B3: // IT8728F
   585                   v.Add(new Voltage("VTT", 0));
   586                   v.Add(new Voltage("+3.3V", 1, 6.49f, 10));
   587                   v.Add(new Voltage("+12V", 2, 30.9f, 10));
   588                   v.Add(new Voltage("+5V", 3, 7.15f, 10));
   589                   v.Add(new Voltage("CPU VCore", 5));
   590                   v.Add(new Voltage("DRAM", 6));
   591                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   592                   v.Add(new Voltage("VBat", 8, 10, 10));
   593                   t.Add(new Temperature("System", 0));
   594                   t.Add(new Temperature("CPU", 1));
   595                   t.Add(new Temperature("System 3", 2));
   596                   f.Add(new Fan("CPU Fan", 0));
   597                   f.Add(new Fan("Power Fan", 1));
   598                   f.Add(new Fan("System Fan #1", 2));
   599                   f.Add(new Fan("System Fan #2", 3));
   600                   f.Add(new Fan("System Fan #3", 4));
   601                   break;
   602                 default:
   603                   v.Add(new Voltage("Voltage #1", 0, true));
   604                   v.Add(new Voltage("Voltage #2", 1, true));
   605                   v.Add(new Voltage("Voltage #3", 2, true));
   606                   v.Add(new Voltage("Voltage #4", 3, true));
   607                   v.Add(new Voltage("Voltage #5", 4, true));
   608                   v.Add(new Voltage("Voltage #6", 5, true));
   609                   v.Add(new Voltage("Voltage #7", 6, true));
   610                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   611                   v.Add(new Voltage("VBat", 8, 10, 10));
   612                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   613                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   614                   for (int i = 0; i < superIO.Fans.Length; i++)
   615                     f.Add(new Fan("Fan #" + (i + 1), i));
   616                   for (int i = 0; i < superIO.Controls.Length; i++)
   617                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   618                   break;
   619               }
   620               break;
   621             case Manufacturer.Shuttle:
   622               switch (model) {
   623                 case Model.FH67: // IT8772E 
   624                   v.Add(new Voltage("CPU VCore", 0));
   625                   v.Add(new Voltage("DRAM", 1));
   626                   v.Add(new Voltage("PCH VCCIO", 2));
   627                   v.Add(new Voltage("CPU VCCIO", 3));
   628                   v.Add(new Voltage("Graphic Voltage", 4));
   629                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10));
   630                   v.Add(new Voltage("VBat", 8, 10, 10));
   631                   t.Add(new Temperature("System", 0));
   632                   t.Add(new Temperature("CPU", 1));                  
   633                   f.Add(new Fan("Fan #1", 0));
   634                   f.Add(new Fan("CPU Fan", 1));
   635                   break;
   636                 default:
   637                   v.Add(new Voltage("Voltage #1", 0, true));
   638                   v.Add(new Voltage("Voltage #2", 1, true));
   639                   v.Add(new Voltage("Voltage #3", 2, true));
   640                   v.Add(new Voltage("Voltage #4", 3, true));
   641                   v.Add(new Voltage("Voltage #5", 4, true));
   642                   v.Add(new Voltage("Voltage #6", 5, true));
   643                   v.Add(new Voltage("Voltage #7", 6, true));
   644                   v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   645                   v.Add(new Voltage("VBat", 8, 10, 10));
   646                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   647                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   648                   for (int i = 0; i < superIO.Fans.Length; i++)
   649                     f.Add(new Fan("Fan #" + (i + 1), i));
   650                   for (int i = 0; i < superIO.Controls.Length; i++)
   651                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   652                   break;
   653               }
   654               break;
   655             default:
   656               v.Add(new Voltage("Voltage #1", 0, true));
   657               v.Add(new Voltage("Voltage #2", 1, true));
   658               v.Add(new Voltage("Voltage #3", 2, true));
   659               v.Add(new Voltage("Voltage #4", 3, true));
   660               v.Add(new Voltage("Voltage #5", 4, true));
   661               v.Add(new Voltage("Voltage #6", 5, true));
   662               v.Add(new Voltage("Voltage #7", 6, true));
   663               v.Add(new Voltage("Standby +3.3V", 7, 10, 10, 0, true));
   664               v.Add(new Voltage("VBat", 8, 10, 10));
   665               for (int i = 0; i < superIO.Temperatures.Length; i++)
   666                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   667               for (int i = 0; i < superIO.Fans.Length; i++)
   668                 f.Add(new Fan("Fan #" + (i + 1), i));
   669               for (int i = 0; i < superIO.Controls.Length; i++)
   670                 c.Add(new Ctrl("Fan Control #" + (i + 1), i));
   671               break;
   672           }
   673           break;
   674           
   675         case Chip.F71858:
   676           v.Add(new Voltage("VCC3V", 0, 150, 150));
   677           v.Add(new Voltage("VSB3V", 1, 150, 150));
   678           v.Add(new Voltage("Battery", 2, 150, 150));
   679           for (int i = 0; i < superIO.Temperatures.Length; i++)
   680             t.Add(new Temperature("Temperature #" + (i + 1), i));
   681           for (int i = 0; i < superIO.Fans.Length; i++)
   682             f.Add(new Fan("Fan #" + (i + 1), i));
   683           break;
   684         case Chip.F71862: 
   685         case Chip.F71869:
   686         case Chip.F71869A:
   687         case Chip.F71882:
   688         case Chip.F71889AD: 
   689         case Chip.F71889ED: 
   690         case Chip.F71889F:
   691         case Chip.F71808E:
   692           switch (manufacturer) {
   693             case Manufacturer.EVGA:
   694               switch (model) {
   695                 case Model.X58_SLI_Classified: // F71882 
   696                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   697                   v.Add(new Voltage("CPU VCore", 1, 47, 100));
   698                   v.Add(new Voltage("DIMM", 2, 47, 100));
   699                   v.Add(new Voltage("CPU VTT", 3, 24, 100));
   700                   v.Add(new Voltage("IOH Vcore", 4, 24, 100));
   701                   v.Add(new Voltage("+5V", 5, 51, 12));
   702                   v.Add(new Voltage("+12V", 6, 56, 6.8f));
   703                   v.Add(new Voltage("3VSB", 7, 150, 150));
   704                   v.Add(new Voltage("VBat", 8, 150, 150));
   705                   t.Add(new Temperature("CPU", 0));
   706                   t.Add(new Temperature("VREG", 1));
   707                   t.Add(new Temperature("System", 2));
   708                   f.Add(new Fan("CPU Fan", 0));
   709                   f.Add(new Fan("Power Fan", 1));
   710                   f.Add(new Fan("Chassis Fan", 2));
   711                   break;
   712                 default:
   713                   v.Add(new Voltage("VCC3V", 0, 150, 150));
   714                   v.Add(new Voltage("CPU VCore", 1));
   715                   v.Add(new Voltage("Voltage #3", 2, true));
   716                   v.Add(new Voltage("Voltage #4", 3, true));
   717                   v.Add(new Voltage("Voltage #5", 4, true));
   718                   v.Add(new Voltage("Voltage #6", 5, true));
   719                   v.Add(new Voltage("Voltage #7", 6, true));
   720                   v.Add(new Voltage("VSB3V", 7, 150, 150));
   721                   v.Add(new Voltage("VBat", 8, 150, 150));
   722                   for (int i = 0; i < superIO.Temperatures.Length; i++)
   723                     t.Add(new Temperature("Temperature #" + (i + 1), i));
   724                   for (int i = 0; i < superIO.Fans.Length; i++)
   725                     f.Add(new Fan("Fan #" + (i + 1), i));
   726                   break;
   727               }
   728               break;
   729             default:
   730               v.Add(new Voltage("VCC3V", 0, 150, 150));
   731               v.Add(new Voltage("CPU VCore", 1));
   732               v.Add(new Voltage("Voltage #3", 2, true));
   733               v.Add(new Voltage("Voltage #4", 3, true));
   734               v.Add(new Voltage("Voltage #5", 4, true));
   735               v.Add(new Voltage("Voltage #6", 5, true));
   736               if (superIO.Chip != Chip.F71808E) 
   737                   v.Add(new Voltage("Voltage #7", 6, true)); 
   738               v.Add(new Voltage("VSB3V", 7, 150, 150));
   739               v.Add(new Voltage("VBat", 8, 150, 150));
   740               for (int i = 0; i < superIO.Temperatures.Length; i++)
   741                 t.Add(new Temperature("Temperature #" + (i + 1), i));
   742               for (int i = 0; i < superIO.Fans.Length; i++)
   743                 f.Add(new Fan("Fan #" + (i + 1), i));
   744               break;
   745           }
   746           break;
   747 
   748         case Chip.W83627EHF:
   749           switch (manufacturer) {
   750             case Manufacturer.ASRock:
   751               switch (model) {
   752                 case Model.AOD790GX_128M: // W83627EHF
   753                   v.Add(new Voltage("CPU VCore", 0));
   754                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   755                   v.Add(new Voltage("+3.3V", 4, 10, 10));
   756                   v.Add(new Voltage("+5V", 5, 20, 10));
   757                   v.Add(new Voltage("+12V", 6, 28, 5));
   758                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   759                   v.Add(new Voltage("VBAT", 8, 34, 34));
   760                   t.Add(new Temperature("CPU", 0));
   761                   t.Add(new Temperature("Motherboard", 2));
   762                   f.Add(new Fan("CPU Fan", 0));
   763                   f.Add(new Fan("Chassis Fan", 1));                 
   764                   break;
   765                 default:
   766                   v.Add(new Voltage("CPU VCore", 0));
   767                   v.Add(new Voltage("Voltage #2", 1, true));
   768                   v.Add(new Voltage("AVCC", 2, 34, 34));
   769                   v.Add(new Voltage("3VCC", 3, 34, 34));
   770                   v.Add(new Voltage("Voltage #5", 4, true));
   771                   v.Add(new Voltage("Voltage #6", 5, true));
   772                   v.Add(new Voltage("Voltage #7", 6, true));
   773                   v.Add(new Voltage("3VSB", 7, 34, 34));
   774                   v.Add(new Voltage("VBAT", 8, 34, 34));
   775                   v.Add(new Voltage("Voltage #10", 9, true));
   776                   t.Add(new Temperature("CPU", 0));
   777                   t.Add(new Temperature("Auxiliary", 1));
   778                   t.Add(new Temperature("System", 2));
   779                   f.Add(new Fan("System Fan", 0));
   780                   f.Add(new Fan("CPU Fan", 1));
   781                   f.Add(new Fan("Auxiliary Fan", 2));
   782                   f.Add(new Fan("CPU Fan #2", 3));
   783                   f.Add(new Fan("Auxiliary Fan #2", 4));
   784                   break;
   785               } break;
   786             default:
   787               v.Add(new Voltage("CPU VCore", 0));
   788               v.Add(new Voltage("Voltage #2", 1, true));
   789               v.Add(new Voltage("AVCC", 2, 34, 34));
   790               v.Add(new Voltage("3VCC", 3, 34, 34));
   791               v.Add(new Voltage("Voltage #5", 4, true));
   792               v.Add(new Voltage("Voltage #6", 5, true));
   793               v.Add(new Voltage("Voltage #7", 6, true));
   794               v.Add(new Voltage("3VSB", 7, 34, 34));
   795               v.Add(new Voltage("VBAT", 8, 34, 34));
   796               v.Add(new Voltage("Voltage #10", 9, true));
   797               t.Add(new Temperature("CPU", 0));
   798               t.Add(new Temperature("Auxiliary", 1));
   799               t.Add(new Temperature("System", 2));
   800               f.Add(new Fan("System Fan", 0));
   801               f.Add(new Fan("CPU Fan", 1));
   802               f.Add(new Fan("Auxiliary Fan", 2));
   803               f.Add(new Fan("CPU Fan #2", 3));
   804               f.Add(new Fan("Auxiliary Fan #2", 4));
   805               break;
   806           }
   807           break;
   808         case Chip.W83627DHG: 
   809         case Chip.W83627DHGP:                      
   810         case Chip.W83667HG:
   811         case Chip.W83667HGB:
   812           switch (manufacturer) {
   813             case Manufacturer.ASRock:
   814               switch (model) {
   815                 case Model._880GMH_USB3: // W83627DHG-P
   816                   v.Add(new Voltage("CPU VCore", 0));
   817                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   818                   v.Add(new Voltage("+5V", 5, 15, 7.5f));
   819                   v.Add(new Voltage("+12V", 6, 56, 10));
   820                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   821                   v.Add(new Voltage("VBAT", 8, 34, 34));
   822                   t.Add(new Temperature("CPU", 0));
   823                   t.Add(new Temperature("Motherboard", 2));
   824                   f.Add(new Fan("Chassis Fan", 0));
   825                   f.Add(new Fan("CPU Fan", 1));
   826                   f.Add(new Fan("Power Fan", 2));
   827                   break;
   828                 default:
   829                   v.Add(new Voltage("CPU VCore", 0));
   830                   v.Add(new Voltage("Voltage #2", 1, true));
   831                   v.Add(new Voltage("AVCC", 2, 34, 34));
   832                   v.Add(new Voltage("3VCC", 3, 34, 34));
   833                   v.Add(new Voltage("Voltage #5", 4, true));
   834                   v.Add(new Voltage("Voltage #6", 5, true));
   835                   v.Add(new Voltage("Voltage #7", 6, true));
   836                   v.Add(new Voltage("3VSB", 7, 34, 34));
   837                   v.Add(new Voltage("VBAT", 8, 34, 34));
   838                   t.Add(new Temperature("CPU", 0));
   839                   t.Add(new Temperature("Auxiliary", 1));
   840                   t.Add(new Temperature("System", 2));
   841                   f.Add(new Fan("System Fan", 0));
   842                   f.Add(new Fan("CPU Fan", 1));
   843                   f.Add(new Fan("Auxiliary Fan", 2));
   844                   f.Add(new Fan("CPU Fan #2", 3));
   845                   f.Add(new Fan("Auxiliary Fan #2", 4));
   846                   break;
   847               }
   848               break;
   849             case Manufacturer.ASUS:
   850               switch (model) {
   851                 case Model.P6T: // W83667HG
   852                 case Model.P6X58D_E: // W83667HG                 
   853                 case Model.Rampage_II_GENE: // W83667HG 
   854                   v.Add(new Voltage("CPU VCore", 0));
   855                   v.Add(new Voltage("+12V", 1, 11.5f, 1.91f));
   856                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   857                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   858                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   859                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   860                   v.Add(new Voltage("VBAT", 8, 34, 34));
   861                   t.Add(new Temperature("CPU", 0));
   862                   t.Add(new Temperature("Motherboard", 2));
   863                   f.Add(new Fan("Chassis Fan #1", 0));
   864                   f.Add(new Fan("CPU Fan", 1));
   865                   f.Add(new Fan("Power Fan", 2));
   866                   f.Add(new Fan("Chassis Fan #2", 3));
   867                   f.Add(new Fan("Chassis Fan #3", 4));
   868                   break;
   869                 case Model.Rampage_Extreme: // W83667HG 
   870                   v.Add(new Voltage("CPU VCore", 0));
   871                   v.Add(new Voltage("+12V", 1, 12, 2));
   872                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   873                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   874                   v.Add(new Voltage("+5V", 4, 15, 7.5f));
   875                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   876                   v.Add(new Voltage("VBAT", 8, 34, 34));
   877                   t.Add(new Temperature("CPU", 0));
   878                   t.Add(new Temperature("Motherboard", 2));
   879                   f.Add(new Fan("Chassis Fan #1", 0));
   880                   f.Add(new Fan("CPU Fan", 1));
   881                   f.Add(new Fan("Power Fan", 2));
   882                   f.Add(new Fan("Chassis Fan #2", 3));
   883                   f.Add(new Fan("Chassis Fan #3", 4));
   884                   break;
   885                 default:
   886                   v.Add(new Voltage("CPU VCore", 0));
   887                   v.Add(new Voltage("Voltage #2", 1, true));
   888                   v.Add(new Voltage("AVCC", 2, 34, 34));
   889                   v.Add(new Voltage("3VCC", 3, 34, 34));
   890                   v.Add(new Voltage("Voltage #5", 4, true));
   891                   v.Add(new Voltage("Voltage #6", 5, true));
   892                   v.Add(new Voltage("Voltage #7", 6, true));
   893                   v.Add(new Voltage("3VSB", 7, 34, 34));
   894                   v.Add(new Voltage("VBAT", 8, 34, 34));
   895                   t.Add(new Temperature("CPU", 0));
   896                   t.Add(new Temperature("Auxiliary", 1));
   897                   t.Add(new Temperature("System", 2));
   898                   f.Add(new Fan("System Fan", 0));
   899                   f.Add(new Fan("CPU Fan", 1));
   900                   f.Add(new Fan("Auxiliary Fan", 2));
   901                   f.Add(new Fan("CPU Fan #2", 3));
   902                   f.Add(new Fan("Auxiliary Fan #2", 4));
   903                   break;
   904               }
   905               break;
   906             default:
   907               v.Add(new Voltage("CPU VCore", 0));
   908               v.Add(new Voltage("Voltage #2", 1, true));
   909               v.Add(new Voltage("AVCC", 2, 34, 34));
   910               v.Add(new Voltage("3VCC", 3, 34, 34));
   911               v.Add(new Voltage("Voltage #5", 4, true));
   912               v.Add(new Voltage("Voltage #6", 5, true));
   913               v.Add(new Voltage("Voltage #7", 6, true));
   914               v.Add(new Voltage("3VSB", 7, 34, 34));
   915               v.Add(new Voltage("VBAT", 8, 34, 34));
   916               t.Add(new Temperature("CPU", 0));
   917               t.Add(new Temperature("Auxiliary", 1));
   918               t.Add(new Temperature("System", 2));
   919               f.Add(new Fan("System Fan", 0));
   920               f.Add(new Fan("CPU Fan", 1));
   921               f.Add(new Fan("Auxiliary Fan", 2));
   922               f.Add(new Fan("CPU Fan #2", 3));
   923               f.Add(new Fan("Auxiliary Fan #2", 4));
   924               break;
   925           } 
   926           break;
   927         case Chip.W83627HF: 
   928         case Chip.W83627THF: 
   929         case Chip.W83687THF:
   930           v.Add(new Voltage("CPU VCore", 0));
   931           v.Add(new Voltage("Voltage #2", 1, true));
   932           v.Add(new Voltage("Voltage #3", 2, true));
   933           v.Add(new Voltage("AVCC", 3, 34, 51));
   934           v.Add(new Voltage("Voltage #5", 4, true));
   935           v.Add(new Voltage("5VSB", 5, 34, 51));
   936           v.Add(new Voltage("VBAT", 6));
   937           t.Add(new Temperature("CPU", 0));
   938           t.Add(new Temperature("Auxiliary", 1));
   939           t.Add(new Temperature("System", 2));
   940           f.Add(new Fan("System Fan", 0));
   941           f.Add(new Fan("CPU Fan", 1));
   942           f.Add(new Fan("Auxiliary Fan", 2));
   943           break;
   944         case Chip.NCT6771F:
   945         case Chip.NCT6776F:
   946           switch (manufacturer) {
   947             case Manufacturer.ASUS:
   948               switch (model) {
   949                 case Model.P8P67: // NCT6776F
   950                 case Model.P8P67_EVO: // NCT6776F
   951                 case Model.P8P67_PRO: // NCT6776F
   952                   v.Add(new Voltage("CPU VCore", 0));
   953                   v.Add(new Voltage("+12V", 1, 11, 1));
   954                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   955                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   956                   v.Add(new Voltage("+5V", 4, 12, 3));
   957                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   958                   v.Add(new Voltage("VBAT", 8, 34, 34));
   959                   t.Add(new Temperature("CPU", 0));
   960                   t.Add(new Temperature("Auxiliary", 2));
   961                   t.Add(new Temperature("Motherboard", 3));
   962                   f.Add(new Fan("Chassis Fan #1", 0));
   963                   f.Add(new Fan("CPU Fan", 1));
   964                   f.Add(new Fan("Power Fan", 2));
   965                   f.Add(new Fan("Chassis Fan #2", 3));
   966                   c.Add(new Ctrl("Chassis Fan #2", 0));
   967                   c.Add(new Ctrl("CPU Fan", 1));
   968                   c.Add(new Ctrl("Chassis Fan #1", 2));
   969                   break;
   970                 case Model.P8P67_M_PRO: // NCT6776F
   971                   v.Add(new Voltage("CPU VCore", 0));
   972                   v.Add(new Voltage("+12V", 1, 11, 1));
   973                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   974                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   975                   v.Add(new Voltage("+5V", 4, 12, 3));
   976                   v.Add(new Voltage("Voltage #6", 5, true));
   977                   v.Add(new Voltage("Voltage #7", 6, true));
   978                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   979                   v.Add(new Voltage("VBAT", 8, 34, 34));
   980                   t.Add(new Temperature("CPU", 0));
   981                   t.Add(new Temperature("Motherboard", 3));
   982                   f.Add(new Fan("Chassis Fan #1", 0));
   983                   f.Add(new Fan("CPU Fan", 1));
   984                   f.Add(new Fan("Chassis Fan #2", 2));
   985                   f.Add(new Fan("Power Fan", 3));
   986                   f.Add(new Fan("Auxiliary Fan", 4));
   987                   break;
   988                 case Model.P8Z68_V_PRO: // NCT6776F
   989                   v.Add(new Voltage("CPU VCore", 0));
   990                   v.Add(new Voltage("+12V", 1, 11, 1));
   991                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
   992                   v.Add(new Voltage("+3.3V", 3, 34, 34));
   993                   v.Add(new Voltage("+5V", 4, 12, 3));
   994                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
   995                   v.Add(new Voltage("VBAT", 8, 34, 34));
   996                   t.Add(new Temperature("CPU", 0));
   997                   t.Add(new Temperature("Auxiliary", 2));
   998                   t.Add(new Temperature("Motherboard", 3));
   999                   for (int i = 0; i < superIO.Fans.Length; i++)
  1000                     f.Add(new Fan("Fan #" + (i + 1), i));
  1001                   for (int i = 0; i < superIO.Controls.Length; i++)
  1002                     c.Add(new Ctrl("Fan #" + (i + 1), i));
  1003                   break;
  1004                 case Model.P9X79: // NCT6776F
  1005                   v.Add(new Voltage("CPU VCore", 0));
  1006                   v.Add(new Voltage("+12V", 1, 11, 1));
  1007                   v.Add(new Voltage("Analog +3.3V", 2, 34, 34));
  1008                   v.Add(new Voltage("+3.3V", 3, 34, 34));
  1009                   v.Add(new Voltage("+5V", 4, 12, 3));
  1010                   v.Add(new Voltage("Standby +3.3V", 7, 34, 34));
  1011                   v.Add(new Voltage("VBAT", 8, 34, 34));
  1012                   t.Add(new Temperature("CPU", 0));
  1013                   t.Add(new Temperature("Motherboard", 3));
  1014                   for (int i = 0; i < superIO.Fans.Length; i++)
  1015                     f.Add(new Fan("Fan #" + (i + 1), i));
  1016                   for (int i = 0; i < superIO.Controls.Length; i++)
  1017                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1018                   break;
  1019                 default:
  1020                   v.Add(new Voltage("CPU VCore", 0));
  1021                   v.Add(new Voltage("Voltage #2", 1, true));
  1022                   v.Add(new Voltage("AVCC", 2, 34, 34));
  1023                   v.Add(new Voltage("3VCC", 3, 34, 34));
  1024                   v.Add(new Voltage("Voltage #5", 4, true));
  1025                   v.Add(new Voltage("Voltage #6", 5, true));
  1026                   v.Add(new Voltage("Voltage #7", 6, true));
  1027                   v.Add(new Voltage("3VSB", 7, 34, 34));
  1028                   v.Add(new Voltage("VBAT", 8, 34, 34));
  1029                   t.Add(new Temperature("CPU Core", 0));                  
  1030                   t.Add(new Temperature("Temperature #1", 1));
  1031                   t.Add(new Temperature("Temperature #2", 2));
  1032                   t.Add(new Temperature("Temperature #3", 3));
  1033                   for (int i = 0; i < superIO.Fans.Length; i++)
  1034                     f.Add(new Fan("Fan #" + (i + 1), i));
  1035                   for (int i = 0; i < superIO.Controls.Length; i++)
  1036                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1037                   break;
  1038               }
  1039               break;
  1040             default:
  1041               v.Add(new Voltage("CPU VCore", 0));
  1042               v.Add(new Voltage("Voltage #2", 1, true));
  1043               v.Add(new Voltage("AVCC", 2, 34, 34));
  1044               v.Add(new Voltage("3VCC", 3, 34, 34));
  1045               v.Add(new Voltage("Voltage #5", 4, true));
  1046               v.Add(new Voltage("Voltage #6", 5, true));
  1047               v.Add(new Voltage("Voltage #7", 6, true));
  1048               v.Add(new Voltage("3VSB", 7, 34, 34));
  1049               v.Add(new Voltage("VBAT", 8, 34, 34));
  1050               t.Add(new Temperature("CPU Core", 0));
  1051               t.Add(new Temperature("Temperature #1", 1));
  1052               t.Add(new Temperature("Temperature #2", 2));
  1053               t.Add(new Temperature("Temperature #3", 3));
  1054               for (int i = 0; i < superIO.Fans.Length; i++)
  1055                 f.Add(new Fan("Fan #" + (i + 1), i));
  1056               for (int i = 0; i < superIO.Controls.Length; i++)
  1057                 c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1058               break;
  1059           }
  1060           break;
  1061         case Chip.NCT6779D:
  1062         case Chip.NCT6791D:
  1063           switch (manufacturer) {
  1064             case Manufacturer.ASUS:
  1065               switch (model) {
  1066                 case Model.P8Z77_V:
  1067                   v.Add(new Voltage("CPU VCore", 0));
  1068                   v.Add(new Voltage("Voltage #2", 1, true));
  1069                   v.Add(new Voltage("AVCC", 2, 34, 34));
  1070                   v.Add(new Voltage("3VCC", 3, 34, 34));
  1071                   v.Add(new Voltage("Voltage #5", 4, true));
  1072                   v.Add(new Voltage("Voltage #6", 5, true));
  1073                   v.Add(new Voltage("Voltage #7", 6, true));
  1074                   v.Add(new Voltage("3VSB", 7, 34, 34));
  1075                   v.Add(new Voltage("VBAT", 8, 34, 34));
  1076                   v.Add(new Voltage("VTT", 9));
  1077                   v.Add(new Voltage("Voltage #11", 10, true));
  1078                   v.Add(new Voltage("Voltage #12", 11, true));
  1079                   v.Add(new Voltage("Voltage #13", 12, true));
  1080                   v.Add(new Voltage("Voltage #14", 13, true));
  1081                   v.Add(new Voltage("Voltage #15", 14, true));
  1082                   t.Add(new Temperature("CPU Core", 0));
  1083                   t.Add(new Temperature("Auxiliary", 1));
  1084                   t.Add(new Temperature("Motherboard", 2));
  1085                   f.Add(new Fan("Chassis Fan #1", 0));
  1086                   f.Add(new Fan("CPU Fan", 1));
  1087                   f.Add(new Fan("Chassis Fan #2", 2));
  1088                   f.Add(new Fan("Chassis Fan #3", 3));
  1089                   c.Add(new Ctrl("Chassis Fan #1", 0));
  1090                   c.Add(new Ctrl("CPU  Fan", 1));
  1091                   c.Add(new Ctrl("Chassis Fan #2", 2));
  1092                   c.Add(new Ctrl("Chassis Fan #3", 3));
  1093                   break;
  1094                 default:
  1095                   v.Add(new Voltage("CPU VCore", 0));
  1096                   v.Add(new Voltage("Voltage #2", 1, true));
  1097                   v.Add(new Voltage("AVCC", 2, 34, 34));
  1098                   v.Add(new Voltage("3VCC", 3, 34, 34));
  1099                   v.Add(new Voltage("Voltage #5", 4, true));
  1100                   v.Add(new Voltage("Voltage #6", 5, true));
  1101                   v.Add(new Voltage("Voltage #7", 6, true));
  1102                   v.Add(new Voltage("3VSB", 7, 34, 34));
  1103                   v.Add(new Voltage("VBAT", 8, 34, 34));
  1104                   v.Add(new Voltage("VTT", 9));
  1105                   v.Add(new Voltage("Voltage #11", 10, true));
  1106                   v.Add(new Voltage("Voltage #12", 11, true));
  1107                   v.Add(new Voltage("Voltage #13", 12, true));
  1108                   v.Add(new Voltage("Voltage #14", 13, true));
  1109                   v.Add(new Voltage("Voltage #15", 14, true));
  1110                   t.Add(new Temperature("CPU Core", 0));
  1111                   t.Add(new Temperature("Temperature #1", 1));
  1112                   t.Add(new Temperature("Temperature #2", 2));
  1113                   t.Add(new Temperature("Temperature #3", 3));
  1114                   t.Add(new Temperature("Temperature #4", 4));
  1115                   t.Add(new Temperature("Temperature #5", 5));
  1116                   t.Add(new Temperature("Temperature #6", 6));
  1117                   for (int i = 0; i < superIO.Fans.Length; i++)
  1118                     f.Add(new Fan("Fan #" + (i + 1), i));
  1119                   for (int i = 0; i < superIO.Controls.Length; i++)
  1120                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1121                   break;
  1122               }
  1123               break;
  1124             default:
  1125               v.Add(new Voltage("CPU VCore", 0));
  1126               v.Add(new Voltage("Voltage #2", 1, true));
  1127               v.Add(new Voltage("AVCC", 2, 34, 34));
  1128               v.Add(new Voltage("3VCC", 3, 34, 34));
  1129               v.Add(new Voltage("Voltage #5", 4, true));
  1130               v.Add(new Voltage("Voltage #6", 5, true));
  1131               v.Add(new Voltage("Voltage #7", 6, true));
  1132               v.Add(new Voltage("3VSB", 7, 34, 34));
  1133               v.Add(new Voltage("VBAT", 8, 34, 34));
  1134               v.Add(new Voltage("VTT", 9));
  1135               v.Add(new Voltage("Voltage #11", 10, true));
  1136               v.Add(new Voltage("Voltage #12", 11, true));
  1137               v.Add(new Voltage("Voltage #13", 12, true));
  1138               v.Add(new Voltage("Voltage #14", 13, true));
  1139               v.Add(new Voltage("Voltage #15", 14, true));
  1140               t.Add(new Temperature("CPU Core", 0));
  1141               t.Add(new Temperature("Temperature #1", 1));
  1142               t.Add(new Temperature("Temperature #2", 2));
  1143               t.Add(new Temperature("Temperature #3", 3));
  1144               t.Add(new Temperature("Temperature #4", 4));
  1145               t.Add(new Temperature("Temperature #5", 5));
  1146               t.Add(new Temperature("Temperature #6", 6));
  1147               for (int i = 0; i < superIO.Fans.Length; i++)
  1148                 f.Add(new Fan("Fan #" + (i + 1), i));
  1149               for (int i = 0; i < superIO.Controls.Length; i++)
  1150                 c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1151               break;
  1152           }
  1153           break;
  1154         default:
  1155           for (int i = 0; i < superIO.Voltages.Length; i++)
  1156             v.Add(new Voltage("Voltage #" + (i + 1), i, true));
  1157           for (int i = 0; i < superIO.Temperatures.Length; i++)
  1158             t.Add(new Temperature("Temperature #" + (i + 1), i));
  1159           for (int i = 0; i < superIO.Fans.Length; i++)
  1160             f.Add(new Fan("Fan #" + (i + 1), i));
  1161           for (int i = 0; i < superIO.Controls.Length; i++)
  1162             c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1163           break;
  1164       }
  1165 
  1166       const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
  1167       foreach (Voltage voltage in v) 
  1168         if (voltage.Index < superIO.Voltages.Length) {
  1169           Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
  1170             voltage.Hidden, SensorType.Voltage, this, new [] {
  1171             new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
  1172               formula, voltage.Ri),
  1173             new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
  1174               formula, voltage.Rf),
  1175             new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
  1176               formula, voltage.Vf)
  1177             }, settings);
  1178           voltages.Add(sensor);
  1179       }
  1180 
  1181       foreach (Temperature temperature in t) 
  1182         if (temperature.Index < superIO.Temperatures.Length) {
  1183         Sensor sensor = new Sensor(temperature.Name, temperature.Index,
  1184           SensorType.Temperature, this, new [] {
  1185           new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
  1186         }, settings);
  1187         temperatures.Add(sensor);
  1188       }
  1189 
  1190       foreach (Fan fan in f)
  1191         if (fan.Index < superIO.Fans.Length) {
  1192           Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
  1193             this, settings);
  1194           fans.Add(sensor);
  1195         }
  1196 
  1197       foreach (Ctrl ctrl in c) {
  1198         int index = ctrl.Index;
  1199         if (index < superIO.Controls.Length) {
  1200           Sensor sensor = new Sensor(ctrl.Name, index, SensorType.Control,
  1201             this, settings);
  1202           Control control = new Control(sensor, settings, 0, 100);
  1203           control.ControlModeChanged += (cc) => {
  1204             if (cc.ControlMode == ControlMode.Default) {
  1205               superIO.SetControl(index, null);
  1206             } else {
  1207               superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
  1208             }
  1209           };
  1210           control.SoftwareControlValueChanged += (cc) => {
  1211             if (cc.ControlMode == ControlMode.Software) 
  1212               superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
  1213           };
  1214           if (control.ControlMode == ControlMode.Software) 
  1215             superIO.SetControl(index, (byte)(control.SoftwareValue * 2.55));
  1216           sensor.Control = control;
  1217           controls.Add(sensor);
  1218           ActivateSensor(sensor);
  1219         }
  1220       }
  1221     }
  1222 
  1223     public override HardwareType HardwareType {
  1224       get { return HardwareType.SuperIO; }
  1225     }
  1226 
  1227     public override IHardware Parent {
  1228       get { return mainboard; }
  1229     }
  1230 
  1231 
  1232     public override string GetReport() {
  1233       return superIO.GetReport();
  1234     }
  1235 
  1236     public override void Update() {
  1237       superIO.Update();
  1238 
  1239       foreach (Sensor sensor in voltages) {
  1240         float? value = readVoltage(sensor.Index);
  1241         if (value.HasValue) {
  1242           sensor.Value = value + (value - sensor.Parameters[2].Value) *
  1243             sensor.Parameters[0].Value / sensor.Parameters[1].Value;
  1244           ActivateSensor(sensor);
  1245         }
  1246       }
  1247 
  1248       foreach (Sensor sensor in temperatures) {
  1249         float? value = readTemperature(sensor.Index);
  1250         if (value.HasValue) {
  1251           sensor.Value = value + sensor.Parameters[0].Value;
  1252           ActivateSensor(sensor);
  1253         }
  1254       }
  1255 
  1256       foreach (Sensor sensor in fans) {
  1257         float? value = readFan(sensor.Index);
  1258         if (value.HasValue) {
  1259           sensor.Value = value;
  1260           if (value.Value > 0)
  1261             ActivateSensor(sensor);
  1262         }
  1263       }
  1264 
  1265       foreach (Sensor sensor in controls) {
  1266         float? value = readControl(sensor.Index);
  1267         sensor.Value = value;                
  1268       }
  1269 
  1270       postUpdate();
  1271     }
  1272 
  1273     public override void Close() {
  1274       foreach (Sensor sensor in controls) {
  1275         // restore all controls back to default
  1276         superIO.SetControl(sensor.Index, null);
  1277       }
  1278       base.Close();
  1279     }
  1280 
  1281     private class Voltage {
  1282       public readonly string Name;
  1283       public readonly int Index;
  1284       public readonly float Ri;
  1285       public readonly float Rf;
  1286       public readonly float Vf;
  1287       public readonly bool Hidden;
  1288 
  1289       public Voltage(string name, int index) :
  1290         this(name, index, false) { }
  1291       
  1292       public Voltage(string name, int index, bool hidden) :
  1293         this(name, index, 0, 1, 0, hidden) { }
  1294       
  1295       public Voltage(string name, int index, float ri, float rf) :
  1296         this(name, index, ri, rf, 0, false) { }
  1297       
  1298       // float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
  1299       
  1300       public Voltage(string name, int index, 
  1301         float ri, float rf, float vf, bool hidden) 
  1302       {
  1303         this.Name = name;
  1304         this.Index = index;
  1305         this.Ri = ri;
  1306         this.Rf = rf;
  1307         this.Vf = vf;
  1308         this.Hidden = hidden;
  1309       }
  1310     }
  1311 
  1312     private class Temperature {
  1313       public readonly string Name;
  1314       public readonly int Index;
  1315 
  1316       public Temperature(string name, int index) {
  1317         this.Name = name;
  1318         this.Index = index;
  1319       }
  1320     }
  1321 
  1322     private class Fan {
  1323       public readonly string Name;
  1324       public readonly int Index;
  1325 
  1326       public Fan(string name, int index) {
  1327         this.Name = name;
  1328         this.Index = index;
  1329       }
  1330     }
  1331 
  1332     private class Ctrl {
  1333       public readonly string Name;
  1334       public readonly int Index;
  1335 
  1336       public Ctrl(string name, int index) {
  1337         this.Name = name;
  1338         this.Index = index;
  1339       }
  1340     }
  1341   }
  1342 }