1.1 --- a/Hardware/CPU/IntelCPU.cs Tue Mar 02 20:32:24 2010 +0000
1.2 +++ b/Hardware/CPU/IntelCPU.cs Tue Mar 02 22:26:07 2010 +0000
1.3 @@ -87,6 +87,13 @@
1.4 private static extern bool GetProcessAffinityMask(IntPtr handle,
1.5 out IntPtr processMask, out IntPtr systemMask);
1.6
1.7 + private float[] Floats(float f) {
1.8 + float[] result = new float[coreCount];
1.9 + for (int i = 0; i < coreCount; i++)
1.10 + result[i] = f;
1.11 + return result;
1.12 + }
1.13 +
1.14 public IntelCPU(string name, uint family, uint model, uint stepping,
1.15 uint[,] cpuidData, uint[,] cpuidExtData) {
1.16
1.17 @@ -146,7 +153,7 @@
1.18
1.19 coreCount = logicalProcessors / logicalProcessorsPerCore;
1.20
1.21 - float tjMax;
1.22 + float[] tjMax;
1.23 switch (family) {
1.24 case 0x06: {
1.25 switch (model) {
1.26 @@ -155,53 +162,59 @@
1.27 case 0x06: // B2
1.28 switch (coreCount) {
1.29 case 2:
1.30 - tjMax = 80 + 10; break;
1.31 + tjMax = Floats(80 + 10); break;
1.32 case 4:
1.33 - tjMax = 90 + 10; break;
1.34 + tjMax = Floats(90 + 10); break;
1.35 default:
1.36 - tjMax = 85 + 10; break;
1.37 + tjMax = Floats(85 + 10); break;
1.38 }
1.39 - tjMax = 80 + 10; break;
1.40 + tjMax = Floats(80 + 10); break;
1.41 case 0x0B: // G0
1.42 - tjMax = 90 + 10; break;
1.43 + tjMax = Floats(90 + 10); break;
1.44 case 0x0D: // M0
1.45 - tjMax = 85 + 10; break;
1.46 + tjMax = Floats(85 + 10); break;
1.47 default:
1.48 - tjMax = 85 + 10; break;
1.49 + tjMax = Floats(85 + 10); break;
1.50 } break;
1.51 case 0x17: // Intel Core (45nm)
1.52 - tjMax = 100; break;
1.53 + tjMax = Floats(100); break;
1.54 case 0x1C: // Intel Atom
1.55 - tjMax = 90; break;
1.56 + tjMax = Floats(90); break;
1.57 case 0x1A: // Intel Core i7 LGA1366 (45nm)
1.58 case 0x1E: // Intel Core i5, i7 LGA1156 (45nm)
1.59 case 0x25: // Intel Core i3, i5, i7 LGA1156 (32nm)
1.60 uint eax, edx;
1.61 - if (WinRing0.Rdmsr(IA32_TEMPERATURE_TARGET, out eax, out edx)) {
1.62 - tjMax = (eax >> 16) & 0xFF;
1.63 - } else {
1.64 - tjMax = 100;
1.65 + tjMax = new float[coreCount];
1.66 + for (int i = 0; i < coreCount; i++) {
1.67 + if (WinRing0.RdmsrTx(IA32_TEMPERATURE_TARGET, out eax,
1.68 + out edx, (UIntPtr)(
1.69 + 1 << (int)(logicalProcessorsPerCore * i))))
1.70 + {
1.71 + tjMax[i] = (eax >> 16) & 0xFF;
1.72 + } else {
1.73 + tjMax[i] = 100;
1.74 + }
1.75 }
1.76 if (WinRing0.Rdmsr(MSR_PLATFORM_INFO, out eax, out edx)) {
1.77 maxNehalemMultiplier = (eax >> 8) & 0xff;
1.78 }
1.79 break;
1.80 default:
1.81 - tjMax = 100; break;
1.82 + tjMax = Floats(100); break;
1.83 }
1.84 } break;
1.85 - default: tjMax = 100; break;
1.86 + default: tjMax = Floats(100); break;
1.87 }
1.88
1.89 // check if processor supports a digital thermal sensor
1.90 if (cpuidData.GetLength(0) > 6 && (cpuidData[6, 0] & 1) != 0) {
1.91 coreTemperatures = new Sensor[coreCount];
1.92 for (int i = 0; i < coreTemperatures.Length; i++) {
1.93 - coreTemperatures[i] = new Sensor(CoreString(i), i, tjMax,
1.94 + coreTemperatures[i] = new Sensor(CoreString(i), i, tjMax[i],
1.95 SensorType.Temperature, this, new ParameterDescription[] {
1.96 new ParameterDescription(
1.97 "TjMax", "TjMax temperature of the core.\n" +
1.98 - "Temperature = TjMax - TSlope * Value.", tjMax),
1.99 + "Temperature = TjMax - TSlope * Value.", tjMax[i]),
1.100 new ParameterDescription(
1.101 "TSlope", "Temperature slope of the digital thermal sensor.\n" +
1.102 "Temperature = TjMax - TSlope * Value.", 1)});