1.1 --- a/Hardware/CPU/AMD0FCPU.cs Mon Apr 05 21:31:21 2010 +0000
1.2 +++ b/Hardware/CPU/AMD0FCPU.cs Sat Apr 24 19:59:52 2010 +0000
1.3 @@ -63,41 +63,46 @@
1.4 private const byte THERM_SENSE_CORE_SEL_CPU0 = 0x4;
1.5 private const byte THERM_SENSE_CORE_SEL_CPU1 = 0x0;
1.6
1.7 - public AMD0FCPU(string name, uint family, uint model, uint stepping,
1.8 - uint[,] cpuidData, uint[,] cpuidExtData) {
1.9 -
1.10 - this.name = name;
1.11 - this.icon = Utilities.EmbeddedResources.GetImage("cpu.png");
1.12 + public AMD0FCPU(CPUID[][] cpuid) {
1.13
1.14 - uint coreCount = 1;
1.15 - if (cpuidExtData.GetLength(0) > 8)
1.16 - coreCount = (cpuidExtData[8, 2] & 0xFF) + 1;
1.17 + this.name = cpuid[0][0].Name;
1.18 + this.icon = Utilities.EmbeddedResources.GetImage("cpu.png");
1.19
1.20 - // max two cores
1.21 - coreCount = coreCount > 2 ? 2 : coreCount;
1.22 + int coreCount = cpuid.Length;
1.23
1.24 totalLoad = new Sensor("CPU Total", 0, SensorType.Load, this);
1.25
1.26 float offset = -49.0f;
1.27
1.28 // AM2+ 65nm +21 offset
1.29 + uint model = cpuid[0][0].Model;
1.30 if (model >= 0x69 && model != 0xc1 && model != 0x6c && model != 0x7c)
1.31 offset += 21;
1.32
1.33 - coreTemperatures = new Sensor[coreCount];
1.34 - coreLoads = new Sensor[coreCount];
1.35 - for (int i = 0; i < coreCount; i++) {
1.36 - coreTemperatures[i] =
1.37 - new Sensor("Core #" + (i + 1), i, null, SensorType.Temperature, this,
1.38 - new ParameterDescription[] { new ParameterDescription("Offset",
1.39 - "Temperature offset of the thermal sensor.\n" +
1.40 - "Temperature = Value + Offset.", offset)
1.41 + // check if processor supports a digital thermal sensor
1.42 + if (cpuid[0][0].ExtData.GetLength(0) > 7 &&
1.43 + (cpuid[0][0].ExtData[7, 3] & 1) != 0)
1.44 + {
1.45 + coreTemperatures = new Sensor[coreCount];
1.46 + for (int i = 0; i < coreCount; i++) {
1.47 + coreTemperatures[i] =
1.48 + new Sensor("Core #" + (i + 1), i, null, SensorType.Temperature,
1.49 + this, new ParameterDescription[] {
1.50 + new ParameterDescription("Offset",
1.51 + "Temperature offset of the thermal sensor.\n" +
1.52 + "Temperature = Value + Offset.", offset)
1.53 });
1.54 - coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1,
1.55 - SensorType.Load, this);
1.56 + }
1.57 + } else {
1.58 + coreTemperatures = new Sensor[0];
1.59 }
1.60
1.61 - cpuLoad = new CPULoad(coreCount, 1);
1.62 + coreLoads = new Sensor[coreCount];
1.63 + for (int i = 0; i < coreCount; i++)
1.64 + coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1,
1.65 + SensorType.Load, this);
1.66 +
1.67 + cpuLoad = new CPULoad(cpuid);
1.68 if (cpuLoad.IsAvailable) {
1.69 foreach (Sensor sensor in coreLoads)
1.70 ActivateSensor(sensor);
1.71 @@ -128,7 +133,6 @@
1.72
1.73 public void Update() {
1.74 if (pciAddress != 0xFFFFFFFF) {
1.75 -
1.76 for (uint i = 0; i < coreTemperatures.Length; i++) {
1.77 if (WinRing0.WritePciConfigDwordEx(
1.78 pciAddress, THERMTRIP_STATUS_REGISTER,