Hardware/CPU/IntelCPU.cs
changeset 350 6de77245e32b
parent 344 3145aadca3d2
     1.1 --- a/Hardware/CPU/IntelCPU.cs	Sun May 27 20:22:06 2012 +0000
     1.2 +++ b/Hardware/CPU/IntelCPU.cs	Mon May 28 10:39:30 2012 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4    License, v. 2.0. If a copy of the MPL was not distributed with this
     1.5    file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.6   
     1.7 -  Copyright (C) 2009-2011 Michael Möller <mmoeller@openhardwaremonitor.org>
     1.8 +  Copyright (C) 2009-2012 Michael Möller <mmoeller@openhardwaremonitor.org>
     1.9  	
    1.10  */
    1.11  
    1.12 @@ -21,7 +21,8 @@
    1.13        Core,
    1.14        Atom,
    1.15        Nehalem,
    1.16 -      SandyBridge
    1.17 +      SandyBridge,
    1.18 +      IvyBridge
    1.19      }
    1.20  
    1.21      private readonly Sensor[] coreTemperatures;
    1.22 @@ -119,15 +120,20 @@
    1.23                case 0x1F: // Intel Core i5, i7 
    1.24                case 0x25: // Intel Core i3, i5, i7 LGA1156 (32nm)
    1.25                case 0x2C: // Intel Core i7 LGA1366 (32nm) 6 Core
    1.26 -              case 0x2E: // Intel Xeon Processor 7500 series
    1.27 +              case 0x2E: // Intel Xeon Processor 7500 series (45nm)
    1.28 +              case 0x2F: // Intel Xeon Processor (32nm)
    1.29                  microarchitecture = Microarchitecture.Nehalem;
    1.30                  tjMax = GetTjMaxFromMSR();
    1.31                  break;
    1.32                case 0x2A: // Intel Core i5, i7 2xxx LGA1155 (32nm)
    1.33 -              case 0x2D: // Next Generation Intel Xeon Processor
    1.34 +              case 0x2D: // Next Generation Intel Xeon, i7 3xxx LGA2011 (32nm)
    1.35                  microarchitecture = Microarchitecture.SandyBridge;
    1.36                  tjMax = GetTjMaxFromMSR();
    1.37                  break;
    1.38 +              case 0x3A: // Intel Core i5, i7 3xxx LGA1155 (22nm)
    1.39 +                microarchitecture = Microarchitecture.IvyBridge;
    1.40 +                tjMax = GetTjMaxFromMSR();
    1.41 +                break;
    1.42                default:
    1.43                  microarchitecture = Microarchitecture.Unknown;
    1.44                  tjMax = Floats(100);
    1.45 @@ -169,25 +175,23 @@
    1.46              }
    1.47            } break;
    1.48          case Microarchitecture.Nehalem:
    1.49 -        case Microarchitecture.SandyBridge: {
    1.50 +        case Microarchitecture.SandyBridge:
    1.51 +        case Microarchitecture.IvyBridge: {
    1.52              uint eax, edx;
    1.53              if (Ring0.Rdmsr(MSR_PLATFORM_INFO, out eax, out edx)) {
    1.54                timeStampCounterMultiplier = (eax >> 8) & 0xff;
    1.55              }
    1.56            } break;
    1.57 -        default: {
    1.58 -            timeStampCounterMultiplier = 1;
    1.59 -            uint eax, edx;
    1.60 -            if (Ring0.Rdmsr(IA32_PERF_STATUS, out eax, out edx)) {
    1.61 -              timeStampCounterMultiplier =
    1.62 -                ((edx >> 8) & 0x1f) + 0.5 * ((edx >> 14) & 1);
    1.63 -            }
    1.64 -          } break;
    1.65 +        default: 
    1.66 +          timeStampCounterMultiplier = 0;
    1.67 +          break;
    1.68        }
    1.69  
    1.70        // check if processor supports a digital thermal sensor at core level
    1.71        if (cpuid[0][0].Data.GetLength(0) > 6 &&
    1.72 -        (cpuid[0][0].Data[6, 0] & 1) != 0) {
    1.73 +        (cpuid[0][0].Data[6, 0] & 1) != 0 && 
    1.74 +        microarchitecture != Microarchitecture.Unknown) 
    1.75 +      {
    1.76          coreTemperatures = new Sensor[coreCount];
    1.77          for (int i = 0; i < coreTemperatures.Length; i++) {
    1.78            coreTemperatures[i] = new Sensor(CoreString(i), i,
    1.79 @@ -206,7 +210,9 @@
    1.80  
    1.81        // check if processor supports a digital thermal sensor at package level
    1.82        if (cpuid[0][0].Data.GetLength(0) > 6 &&
    1.83 -        (cpuid[0][0].Data[6, 0] & 0x40) != 0) {
    1.84 +        (cpuid[0][0].Data[6, 0] & 0x40) != 0 && 
    1.85 +        microarchitecture != Microarchitecture.Unknown) 
    1.86 +      {
    1.87          packageTemperature = new Sensor("CPU Package",
    1.88            coreTemperatures.Length, SensorType.Temperature, this, new[] { 
    1.89                new ParameterDescription(
    1.90 @@ -223,12 +229,13 @@
    1.91        for (int i = 0; i < coreClocks.Length; i++) {
    1.92          coreClocks[i] =
    1.93            new Sensor(CoreString(i), i + 1, SensorType.Clock, this, settings);
    1.94 -        if (HasTimeStampCounter)
    1.95 +        if (HasTimeStampCounter && microarchitecture != Microarchitecture.Unknown)
    1.96            ActivateSensor(coreClocks[i]);
    1.97        }
    1.98  
    1.99 -      if (microarchitecture == Microarchitecture.SandyBridge) {
   1.100 -
   1.101 +      if (microarchitecture == Microarchitecture.SandyBridge ||
   1.102 +          microarchitecture == Microarchitecture.IvyBridge) 
   1.103 +      {
   1.104          powerSensors = new Sensor[energyStatusMSRs.Length];
   1.105          lastEnergyTime = new DateTime[energyStatusMSRs.Length];
   1.106          lastEnergyConsumed = new uint[energyStatusMSRs.Length];
   1.107 @@ -319,7 +326,7 @@
   1.108          }
   1.109        }
   1.110  
   1.111 -      if (HasTimeStampCounter) {
   1.112 +      if (HasTimeStampCounter && timeStampCounterMultiplier > 0) {
   1.113          double newBusClock = 0;
   1.114          uint eax, edx;
   1.115          for (int i = 0; i < coreClocks.Length; i++) {
   1.116 @@ -333,7 +340,8 @@
   1.117                    uint multiplier = eax & 0xff;
   1.118                    coreClocks[i].Value = (float)(multiplier * newBusClock);
   1.119                  } break;
   1.120 -              case Microarchitecture.SandyBridge: {
   1.121 +              case Microarchitecture.SandyBridge:
   1.122 +              case Microarchitecture.IvyBridge: {
   1.123                    uint multiplier = (eax >> 8) & 0xff;
   1.124                    coreClocks[i].Value = (float)(multiplier * newBusClock);
   1.125                  } break;