# HG changeset patch # User moel.mich # Date 1272307882 0 # Node ID 25d18bbaa9cf32fec7c4c9aea566a861f2ca8ddf # Parent 6d8377af9fb1dd7e76801feda7d8f2dd2b2a860a Added a processorIndex to CPU classes for multi CPU support. diff -r 6d8377af9fb1 -r 25d18bbaa9cf Hardware/CPU/AMD0FCPU.cs --- a/Hardware/CPU/AMD0FCPU.cs Mon Apr 26 18:38:31 2010 +0000 +++ b/Hardware/CPU/AMD0FCPU.cs Mon Apr 26 18:51:22 2010 +0000 @@ -48,6 +48,7 @@ private string name; private Image icon; + private int processorIndex; private uint pciAddress; private Sensor[] coreTemperatures; @@ -63,8 +64,9 @@ private const byte THERM_SENSE_CORE_SEL_CPU0 = 0x4; private const byte THERM_SENSE_CORE_SEL_CPU1 = 0x0; - public AMD0FCPU(CPUID[][] cpuid) { + public AMD0FCPU(int processorIndex, CPUID[][] cpuid) { + this.processorIndex = processorIndex; this.name = cpuid[0][0].Name; this.icon = Utilities.EmbeddedResources.GetImage("cpu.png"); @@ -110,7 +112,7 @@ } pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID, - PCI_AMD_0FH_MISCELLANEOUS_DEVICE_ID, 0); + PCI_AMD_0FH_MISCELLANEOUS_DEVICE_ID, (byte)processorIndex); Update(); } @@ -120,7 +122,7 @@ } public string Identifier { - get { return "/amdcpu/0"; } + get { return "/amdcpu/" + processorIndex; } } public Image Icon { diff -r 6d8377af9fb1 -r 25d18bbaa9cf Hardware/CPU/AMD10CPU.cs --- a/Hardware/CPU/AMD10CPU.cs Mon Apr 26 18:38:31 2010 +0000 +++ b/Hardware/CPU/AMD10CPU.cs Mon Apr 26 18:51:22 2010 +0000 @@ -47,6 +47,7 @@ private string name; private Image icon; + private int processorIndex; private uint pciAddress; private Sensor coreTemperature; @@ -60,8 +61,9 @@ private const ushort PCI_AMD_11H_MISCELLANEOUS_DEVICE_ID = 0x1303; private const uint REPORTED_TEMPERATURE_CONTROL_REGISTER = 0xA4; - public AMD10CPU(CPUID[][] cpuid) { + public AMD10CPU(int processorIndex, CPUID[][] cpuid) { + this.processorIndex = processorIndex; this.name = cpuid[0][0].Name; this.icon = Utilities.EmbeddedResources.GetImage("cpu.png"); @@ -88,11 +90,11 @@ new ParameterDescription("Offset", "Temperature offset.", 0) }); - pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID, - PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID, 0); + pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID, + PCI_AMD_10H_MISCELLANEOUS_DEVICE_ID, (byte)processorIndex); if (pciAddress == 0xFFFFFFFF) pciAddress = WinRing0.FindPciDeviceById(PCI_AMD_VENDOR_ID, - PCI_AMD_11H_MISCELLANEOUS_DEVICE_ID, 0); + PCI_AMD_11H_MISCELLANEOUS_DEVICE_ID, (byte)processorIndex); Update(); } @@ -102,7 +104,7 @@ } public string Identifier { - get { return "/amdcpu/0"; } + get { return "/amdcpu/" + processorIndex; } } public Image Icon { diff -r 6d8377af9fb1 -r 25d18bbaa9cf Hardware/CPU/CPUGroup.cs --- a/Hardware/CPU/CPUGroup.cs Mon Apr 26 18:38:31 2010 +0000 +++ b/Hardware/CPU/CPUGroup.cs Mon Apr 26 18:51:22 2010 +0000 @@ -119,15 +119,15 @@ switch (threads[0].Vendor) { case Vendor.Intel: - hardware.Add(new IntelCPU(coreThreads)); + hardware.Add(new IntelCPU(index, coreThreads)); break; case Vendor.AMD: switch (threads[0].Family) { case 0x0F: - hardware.Add(new AMD0FCPU(coreThreads)); + hardware.Add(new AMD0FCPU(index, coreThreads)); break; case 0x10: - hardware.Add(new AMD10CPU(coreThreads)); + hardware.Add(new AMD10CPU(index, coreThreads)); break; default: break; diff -r 6d8377af9fb1 -r 25d18bbaa9cf Hardware/CPU/IntelCPU.cs --- a/Hardware/CPU/IntelCPU.cs Mon Apr 26 18:38:31 2010 +0000 +++ b/Hardware/CPU/IntelCPU.cs Mon Apr 26 18:51:22 2010 +0000 @@ -48,6 +48,7 @@ namespace OpenHardwareMonitor.Hardware.CPU { public class IntelCPU : Hardware, IHardware { + private int processorIndex; private CPUID[][] cpuid; private int coreCount; @@ -93,8 +94,9 @@ return result; } - public IntelCPU(CPUID[][] cpuid) { + public IntelCPU(int processorIndex, CPUID[][] cpuid) { + this.processorIndex = processorIndex; this.cpuid = cpuid; this.coreCount = cpuid.Length; this.name = cpuid[0][0].Name; @@ -236,7 +238,7 @@ } public string Identifier { - get { return "/intelcpu/0"; } + get { return "/intelcpu/" + processorIndex; } } public Image Icon {