Skip to content

Commit c114bac

Browse files
dan-andhirschmann
authored andcommitted
Add CoffeeLake, ApolloLake and Ryzen Support (hirschmann#538)
* Added Ryzen Support * added ThreadAffinity to Ring0 * build fix * added OperatingSystem Detection * Added HP Envy 13 X360 13-ag0xxx Ryzen Silent-Fan * Update HP Envy X360 13 AMD, Add HP Envy X360 15 Intel * Aligned travis CI * aligned core 2 duo m0 stepping tjMax from Floats(85 + 10) to Floats(90 + 10) * removed RdmsrTX * removed configs ( will be send separately )
1 parent 83793b4 commit c114bac

File tree

12 files changed

+624
-17
lines changed

12 files changed

+624
-17
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language: csharp
22
solution: NoteBookFanControl.sln
33
script:
4-
- xbuild /t:Build /p:Configuration=ReleaseLinux NoteBookFanControl.sln
4+
- msbuild /t:Clean,Build /p:Configuration=ReleaseLinux NoteBookFanControl.sln

Core/Plugins/OpenHardwareMonitor/Hardware/CPU/AMD10CPU.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,16 @@ internal sealed class AMD10CPU : AMDCPU {
3838
private const ushort FAMILY_15H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1603;
3939
private const ushort FAMILY_15H_MODEL_10_MISC_CONTROL_DEVICE_ID = 0x1403;
4040
private const ushort FAMILY_15H_MODEL_30_MISC_CONTROL_DEVICE_ID = 0x141D;
41+
private const ushort FAMILY_15H_MODEL_60_MISC_CONTROL_DEVICE_ID = 0x1573;
4142
private const ushort FAMILY_16H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1533;
4243
private const ushort FAMILY_16H_MODEL_30_MISC_CONTROL_DEVICE_ID = 0x1583;
44+
private const ushort FAMILY_17H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1577;
4345

4446
private const uint REPORTED_TEMPERATURE_CONTROL_REGISTER = 0xA4;
4547
private const uint CLOCK_POWER_TIMING_CONTROL_0_REGISTER = 0xD4;
4648

49+
private const uint F15H_M60H_REPORTED_TEMP_CTRL_OFFSET = 0xD8200CA4;
50+
4751
private readonly uint miscellaneousControlAddress;
4852
private readonly ushort miscellaneousControlDeviceId;
4953

@@ -79,6 +83,8 @@ public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
7983
FAMILY_15H_MODEL_10_MISC_CONTROL_DEVICE_ID; break;
8084
case 0x30: miscellaneousControlDeviceId =
8185
FAMILY_15H_MODEL_30_MISC_CONTROL_DEVICE_ID; break;
86+
case 0x60: miscellaneousControlDeviceId =
87+
FAMILY_15H_MODEL_60_MISC_CONTROL_DEVICE_ID; break;
8288
default: miscellaneousControlDeviceId = 0; break;
8389
} break;
8490
case 0x16:
@@ -89,6 +95,8 @@ public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
8995
FAMILY_16H_MODEL_30_MISC_CONTROL_DEVICE_ID; break;
9096
default: miscellaneousControlDeviceId = 0; break;
9197
} break;
98+
case 0x17: miscellaneousControlDeviceId =
99+
FAMILY_17H_MODEL_00_MISC_CONTROL_DEVICE_ID; break;
92100
default: miscellaneousControlDeviceId = 0; break;
93101
}
94102

@@ -136,8 +144,8 @@ public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
136144

137145
// the file reader for lm-sensors support on Linux
138146
temperatureStream = null;
139-
int p = (int)Environment.OSVersion.Platform;
140-
if ((p == 4) || (p == 128)) {
147+
148+
if (Software.OperatingSystem.IsLinux) {
141149
string[] devicePaths = Directory.GetDirectories("/sys/class/hwmon/");
142150
foreach (string path in devicePaths) {
143151
string name = null;
@@ -304,6 +312,15 @@ public override void Update() {
304312
if (temperatureStream == null) {
305313
if (miscellaneousControlAddress != Ring0.InvalidPciAddress) {
306314
uint value;
315+
if (miscellaneousControlAddress == FAMILY_15H_MODEL_60_MISC_CONTROL_DEVICE_ID) {
316+
value = F15H_M60H_REPORTED_TEMP_CTRL_OFFSET;
317+
Ring0.WritePciConfig(Ring0.GetPciAddress(0, 0, 0), 0xB8, value);
318+
Ring0.ReadPciConfig(Ring0.GetPciAddress(0, 0, 0), 0xBC, out value);
319+
coreTemperature.Value = ((value >> 21) & 0x7FF) * 0.125f +
320+
coreTemperature.Parameters[0].Value;
321+
ActivateSensor(coreTemperature);
322+
return;
323+
}
307324
if (Ring0.ReadPciConfig(miscellaneousControlAddress,
308325
REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
309326
if (family == 0x15 && (value & 0x30000) == 0x30000) {
@@ -345,7 +362,7 @@ public override void Update() {
345362
Thread.Sleep(1);
346363

347364
uint curEax, curEdx;
348-
if (Ring0.Rdmsr(COFVID_STATUS, out curEax, out curEdx, cpuid[i][0].Thread))
365+
if (Ring0.Rdmsr(COFVID_STATUS, out curEax, out curEdx, cpuid[i][0].Thread))
349366
{
350367
double multiplier;
351368
multiplier = GetCoreMultiplier(curEax);

0 commit comments

Comments
 (0)