1.1 --- a/Hardware/CPU/AMD0FCPU.cs Sat Sep 18 19:56:39 2010 +0000
1.2 +++ b/Hardware/CPU/AMD0FCPU.cs Mon Sep 20 19:28:25 2010 +0000
1.3 @@ -35,39 +35,21 @@
1.4
1.5 */
1.6
1.7 -using System;
1.8 -using System.Globalization;
1.9 +namespace OpenHardwareMonitor.Hardware.CPU {
1.10 + internal sealed class AMD0FCPU : GenericCPU {
1.11
1.12 -namespace OpenHardwareMonitor.Hardware.CPU {
1.13 - internal sealed class AMD0FCPU : Hardware, IHardware {
1.14 -
1.15 - private string name;
1.16 -
1.17 - private int processorIndex;
1.18 private uint pciAddress;
1.19 -
1.20 private Sensor[] coreTemperatures;
1.21
1.22 - private Sensor totalLoad;
1.23 - private Sensor[] coreLoads;
1.24 -
1.25 - private CPULoad cpuLoad;
1.26 -
1.27 private const ushort PCI_AMD_VENDOR_ID = 0x1022;
1.28 private const ushort PCI_AMD_0FH_MISCELLANEOUS_DEVICE_ID = 0x1103;
1.29 private const uint THERMTRIP_STATUS_REGISTER = 0xE4;
1.30 private const byte THERM_SENSE_CORE_SEL_CPU0 = 0x4;
1.31 private const byte THERM_SENSE_CORE_SEL_CPU1 = 0x0;
1.32
1.33 - public AMD0FCPU(int processorIndex, CPUID[][] cpuid, ISettings settings) {
1.34 -
1.35 - this.processorIndex = processorIndex;
1.36 - this.name = cpuid[0][0].Name;
1.37 -
1.38 - int coreCount = cpuid.Length;
1.39 -
1.40 - totalLoad = new Sensor("CPU Total", 0, SensorType.Load, this, settings);
1.41 -
1.42 + public AMD0FCPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
1.43 + : base(processorIndex, cpuid, settings)
1.44 + {
1.45 float offset = -49.0f;
1.46
1.47 // AM2+ 65nm +21 offset
1.48 @@ -93,40 +75,19 @@
1.49 coreTemperatures = new Sensor[0];
1.50 }
1.51
1.52 - coreLoads = new Sensor[coreCount];
1.53 - for (int i = 0; i < coreCount; i++)
1.54 - coreLoads[i] = new Sensor("Core #" + (i + 1), i + 1,
1.55 - SensorType.Load, this, settings);
1.56 -
1.57 - cpuLoad = new CPULoad(cpuid);
1.58 - if (cpuLoad.IsAvailable) {
1.59 - foreach (Sensor sensor in coreLoads)
1.60 - ActivateSensor(sensor);
1.61 - ActivateSensor(totalLoad);
1.62 - }
1.63 -
1.64 pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID,
1.65 PCI_AMD_0FH_MISCELLANEOUS_DEVICE_ID, (byte)processorIndex);
1.66
1.67 Update();
1.68 }
1.69
1.70 - public override string Name {
1.71 - get { return name; }
1.72 - }
1.73 -
1.74 - public override Identifier Identifier {
1.75 - get {
1.76 - return new Identifier("amdcpu",
1.77 - processorIndex.ToString(CultureInfo.InvariantCulture));
1.78 - }
1.79 - }
1.80 -
1.81 - public override HardwareType HardwareType {
1.82 - get { return HardwareType.CPU; }
1.83 + protected override uint[] GetMSRs() {
1.84 + return new uint[] { };
1.85 }
1.86
1.87 public override void Update() {
1.88 + base.Update();
1.89 +
1.90 if (pciAddress != 0xFFFFFFFF) {
1.91 for (uint i = 0; i < coreTemperatures.Length; i++) {
1.92 if (WinRing0.WritePciConfigDwordEx(
1.93 @@ -144,13 +105,7 @@
1.94 }
1.95 }
1.96 }
1.97 -
1.98 - if (cpuLoad.IsAvailable) {
1.99 - cpuLoad.Update();
1.100 - for (int i = 0; i < coreLoads.Length; i++)
1.101 - coreLoads[i].Value = cpuLoad.GetCoreLoad(i);
1.102 - totalLoad.Value = cpuLoad.GetTotalLoad();
1.103 - }
1.104 - }
1.105 + }
1.106 +
1.107 }
1.108 }