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