Hardware/Mainboard/SuperIOHardware.cs
author moel.mich
Sun, 30 Jun 2013 11:41:36 +0000
changeset 408 bbeb9004c491
parent 389 93cee0b9f619
child 413 362c5e77197d
permissions -rw-r--r--
Added support for the Fintek F71869A (F71868AD) 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           switch (manufacturer) {
  1063             case Manufacturer.ASUS:
  1064               switch (model) {
  1065                 case Model.P8Z77_V:
  1066                   v.Add(new Voltage("CPU VCore", 0));
  1067                   v.Add(new Voltage("Voltage #2", 1, true));
  1068                   v.Add(new Voltage("AVCC", 2, 34, 34));
  1069                   v.Add(new Voltage("3VCC", 3, 34, 34));
  1070                   v.Add(new Voltage("Voltage #5", 4, true));
  1071                   v.Add(new Voltage("Voltage #6", 5, true));
  1072                   v.Add(new Voltage("Voltage #7", 6, true));
  1073                   v.Add(new Voltage("3VSB", 7, 34, 34));
  1074                   v.Add(new Voltage("VBAT", 8, 34, 34));
  1075                   v.Add(new Voltage("VTT", 9));
  1076                   v.Add(new Voltage("Voltage #11", 10, true));
  1077                   v.Add(new Voltage("Voltage #12", 11, true));
  1078                   v.Add(new Voltage("Voltage #13", 12, true));
  1079                   v.Add(new Voltage("Voltage #14", 13, true));
  1080                   v.Add(new Voltage("Voltage #15", 14, true));
  1081                   t.Add(new Temperature("CPU Core", 0));
  1082                   t.Add(new Temperature("Auxiliary", 1));
  1083                   t.Add(new Temperature("Motherboard", 2));
  1084                   f.Add(new Fan("Chassis Fan #1", 0));
  1085                   f.Add(new Fan("CPU Fan", 1));
  1086                   f.Add(new Fan("Chassis Fan #2", 2));
  1087                   f.Add(new Fan("Chassis Fan #3", 3));
  1088                   c.Add(new Ctrl("Chassis Fan #1", 0));
  1089                   c.Add(new Ctrl("CPU  Fan", 1));
  1090                   c.Add(new Ctrl("Chassis Fan #2", 2));
  1091                   c.Add(new Ctrl("Chassis Fan #3", 3));
  1092                   break;
  1093                 default:
  1094                   v.Add(new Voltage("CPU VCore", 0));
  1095                   v.Add(new Voltage("Voltage #2", 1, true));
  1096                   v.Add(new Voltage("AVCC", 2, 34, 34));
  1097                   v.Add(new Voltage("3VCC", 3, 34, 34));
  1098                   v.Add(new Voltage("Voltage #5", 4, true));
  1099                   v.Add(new Voltage("Voltage #6", 5, true));
  1100                   v.Add(new Voltage("Voltage #7", 6, true));
  1101                   v.Add(new Voltage("3VSB", 7, 34, 34));
  1102                   v.Add(new Voltage("VBAT", 8, 34, 34));
  1103                   v.Add(new Voltage("VTT", 9));
  1104                   v.Add(new Voltage("Voltage #11", 10, true));
  1105                   v.Add(new Voltage("Voltage #12", 11, true));
  1106                   v.Add(new Voltage("Voltage #13", 12, true));
  1107                   v.Add(new Voltage("Voltage #14", 13, true));
  1108                   v.Add(new Voltage("Voltage #15", 14, true));
  1109                   t.Add(new Temperature("CPU Core", 0));
  1110                   t.Add(new Temperature("Temperature #1", 1));
  1111                   t.Add(new Temperature("Temperature #2", 2));
  1112                   t.Add(new Temperature("Temperature #3", 3));
  1113                   t.Add(new Temperature("Temperature #4", 4));
  1114                   t.Add(new Temperature("Temperature #5", 5));
  1115                   t.Add(new Temperature("Temperature #6", 6));
  1116                   for (int i = 0; i < superIO.Fans.Length; i++)
  1117                     f.Add(new Fan("Fan #" + (i + 1), i));
  1118                   for (int i = 0; i < superIO.Controls.Length; i++)
  1119                     c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1120                   break;
  1121               }
  1122               break;
  1123             default:
  1124               v.Add(new Voltage("CPU VCore", 0));
  1125               v.Add(new Voltage("Voltage #2", 1, true));
  1126               v.Add(new Voltage("AVCC", 2, 34, 34));
  1127               v.Add(new Voltage("3VCC", 3, 34, 34));
  1128               v.Add(new Voltage("Voltage #5", 4, true));
  1129               v.Add(new Voltage("Voltage #6", 5, true));
  1130               v.Add(new Voltage("Voltage #7", 6, true));
  1131               v.Add(new Voltage("3VSB", 7, 34, 34));
  1132               v.Add(new Voltage("VBAT", 8, 34, 34));
  1133               v.Add(new Voltage("VTT", 9));
  1134               v.Add(new Voltage("Voltage #11", 10, true));
  1135               v.Add(new Voltage("Voltage #12", 11, true));
  1136               v.Add(new Voltage("Voltage #13", 12, true));
  1137               v.Add(new Voltage("Voltage #14", 13, true));
  1138               v.Add(new Voltage("Voltage #15", 14, true));
  1139               t.Add(new Temperature("CPU Core", 0));
  1140               t.Add(new Temperature("Temperature #1", 1));
  1141               t.Add(new Temperature("Temperature #2", 2));
  1142               t.Add(new Temperature("Temperature #3", 3));
  1143               t.Add(new Temperature("Temperature #4", 4));
  1144               t.Add(new Temperature("Temperature #5", 5));
  1145               t.Add(new Temperature("Temperature #6", 6));
  1146               for (int i = 0; i < superIO.Fans.Length; i++)
  1147                 f.Add(new Fan("Fan #" + (i + 1), i));
  1148               for (int i = 0; i < superIO.Controls.Length; i++)
  1149                 c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1150               break;
  1151           }
  1152           break;
  1153         default:
  1154           for (int i = 0; i < superIO.Voltages.Length; i++)
  1155             v.Add(new Voltage("Voltage #" + (i + 1), i, true));
  1156           for (int i = 0; i < superIO.Temperatures.Length; i++)
  1157             t.Add(new Temperature("Temperature #" + (i + 1), i));
  1158           for (int i = 0; i < superIO.Fans.Length; i++)
  1159             f.Add(new Fan("Fan #" + (i + 1), i));
  1160           for (int i = 0; i < superIO.Controls.Length; i++)
  1161             c.Add(new Ctrl("Fan Control #" + (i + 1), i));
  1162           break;
  1163       }
  1164 
  1165       const string formula = "Voltage = value + (value - Vf) * Ri / Rf.";
  1166       foreach (Voltage voltage in v) 
  1167         if (voltage.Index < superIO.Voltages.Length) {
  1168           Sensor sensor = new Sensor(voltage.Name, voltage.Index, 
  1169             voltage.Hidden, SensorType.Voltage, this, new [] {
  1170             new ParameterDescription("Ri [kΩ]", "Input resistance.\n" + 
  1171               formula, voltage.Ri),
  1172             new ParameterDescription("Rf [kΩ]", "Reference resistance.\n" + 
  1173               formula, voltage.Rf),
  1174             new ParameterDescription("Vf [V]", "Reference voltage.\n" + 
  1175               formula, voltage.Vf)
  1176             }, settings);
  1177           voltages.Add(sensor);
  1178       }
  1179 
  1180       foreach (Temperature temperature in t) 
  1181         if (temperature.Index < superIO.Temperatures.Length) {
  1182         Sensor sensor = new Sensor(temperature.Name, temperature.Index,
  1183           SensorType.Temperature, this, new [] {
  1184           new ParameterDescription("Offset [°C]", "Temperature offset.", 0)
  1185         }, settings);
  1186         temperatures.Add(sensor);
  1187       }
  1188 
  1189       foreach (Fan fan in f)
  1190         if (fan.Index < superIO.Fans.Length) {
  1191           Sensor sensor = new Sensor(fan.Name, fan.Index, SensorType.Fan,
  1192             this, settings);
  1193           fans.Add(sensor);
  1194         }
  1195 
  1196       foreach (Ctrl ctrl in c) {
  1197         int index = ctrl.Index;
  1198         if (index < superIO.Controls.Length) {
  1199           Sensor sensor = new Sensor(ctrl.Name, index, SensorType.Control,
  1200             this, settings);
  1201           Control control = new Control(sensor, settings, 0, 100);
  1202           control.ControlModeChanged += (cc) => {
  1203             if (cc.ControlMode == ControlMode.Default) {
  1204               superIO.SetControl(index, null);
  1205             } else {
  1206               superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
  1207             }
  1208           };
  1209           control.SoftwareControlValueChanged += (cc) => {
  1210             if (cc.ControlMode == ControlMode.Software) 
  1211               superIO.SetControl(index, (byte)(cc.SoftwareValue * 2.55));
  1212           };
  1213           if (control.ControlMode == ControlMode.Software) 
  1214             superIO.SetControl(index, (byte)(control.SoftwareValue * 2.55));
  1215           sensor.Control = control;
  1216           controls.Add(sensor);
  1217           ActivateSensor(sensor);
  1218         }
  1219       }
  1220     }
  1221 
  1222     public override HardwareType HardwareType {
  1223       get { return HardwareType.SuperIO; }
  1224     }
  1225 
  1226     public override IHardware Parent {
  1227       get { return mainboard; }
  1228     }
  1229 
  1230 
  1231     public override string GetReport() {
  1232       return superIO.GetReport();
  1233     }
  1234 
  1235     public override void Update() {
  1236       superIO.Update();
  1237 
  1238       foreach (Sensor sensor in voltages) {
  1239         float? value = readVoltage(sensor.Index);
  1240         if (value.HasValue) {
  1241           sensor.Value = value + (value - sensor.Parameters[2].Value) *
  1242             sensor.Parameters[0].Value / sensor.Parameters[1].Value;
  1243           ActivateSensor(sensor);
  1244         }
  1245       }
  1246 
  1247       foreach (Sensor sensor in temperatures) {
  1248         float? value = readTemperature(sensor.Index);
  1249         if (value.HasValue) {
  1250           sensor.Value = value + sensor.Parameters[0].Value;
  1251           ActivateSensor(sensor);
  1252         }
  1253       }
  1254 
  1255       foreach (Sensor sensor in fans) {
  1256         float? value = readFan(sensor.Index);
  1257         if (value.HasValue) {
  1258           sensor.Value = value;
  1259           if (value.Value > 0)
  1260             ActivateSensor(sensor);
  1261         }
  1262       }
  1263 
  1264       foreach (Sensor sensor in controls) {
  1265         float? value = readControl(sensor.Index);
  1266         sensor.Value = value;                
  1267       }
  1268 
  1269       postUpdate();
  1270     }
  1271 
  1272     public override void Close() {
  1273       foreach (Sensor sensor in controls) {
  1274         // restore all controls back to default
  1275         superIO.SetControl(sensor.Index, null);
  1276       }
  1277       base.Close();
  1278     }
  1279 
  1280     private class Voltage {
  1281       public readonly string Name;
  1282       public readonly int Index;
  1283       public readonly float Ri;
  1284       public readonly float Rf;
  1285       public readonly float Vf;
  1286       public readonly bool Hidden;
  1287 
  1288       public Voltage(string name, int index) :
  1289         this(name, index, false) { }
  1290       
  1291       public Voltage(string name, int index, bool hidden) :
  1292         this(name, index, 0, 1, 0, hidden) { }
  1293       
  1294       public Voltage(string name, int index, float ri, float rf) :
  1295         this(name, index, ri, rf, 0, false) { }
  1296       
  1297       // float ri = 0, float rf = 1, float vf = 0, bool hidden = false) 
  1298       
  1299       public Voltage(string name, int index, 
  1300         float ri, float rf, float vf, bool hidden) 
  1301       {
  1302         this.Name = name;
  1303         this.Index = index;
  1304         this.Ri = ri;
  1305         this.Rf = rf;
  1306         this.Vf = vf;
  1307         this.Hidden = hidden;
  1308       }
  1309     }
  1310 
  1311     private class Temperature {
  1312       public readonly string Name;
  1313       public readonly int Index;
  1314 
  1315       public Temperature(string name, int index) {
  1316         this.Name = name;
  1317         this.Index = index;
  1318       }
  1319     }
  1320 
  1321     private class Fan {
  1322       public readonly string Name;
  1323       public readonly int Index;
  1324 
  1325       public Fan(string name, int index) {
  1326         this.Name = name;
  1327         this.Index = index;
  1328       }
  1329     }
  1330 
  1331     private class Ctrl {
  1332       public readonly string Name;
  1333       public readonly int Index;
  1334 
  1335       public Ctrl(string name, int index) {
  1336         this.Name = name;
  1337         this.Index = index;
  1338       }
  1339     }
  1340   }
  1341 }