Skip to content

Commit

Permalink
Add CoffeeLake, ApolloLake and Ryzen Support (#538)
Browse files Browse the repository at this point in the history
* 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 )
  • Loading branch information
dan-and authored and hirschmann committed Aug 20, 2018
1 parent 83793b4 commit c114bac
Show file tree
Hide file tree
Showing 12 changed files with 624 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: csharp
solution: NoteBookFanControl.sln
script:
- xbuild /t:Build /p:Configuration=ReleaseLinux NoteBookFanControl.sln
- msbuild /t:Clean,Build /p:Configuration=ReleaseLinux NoteBookFanControl.sln
23 changes: 20 additions & 3 deletions Core/Plugins/OpenHardwareMonitor/Hardware/CPU/AMD10CPU.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,16 @@ internal sealed class AMD10CPU : AMDCPU {
private const ushort FAMILY_15H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1603;
private const ushort FAMILY_15H_MODEL_10_MISC_CONTROL_DEVICE_ID = 0x1403;
private const ushort FAMILY_15H_MODEL_30_MISC_CONTROL_DEVICE_ID = 0x141D;
private const ushort FAMILY_15H_MODEL_60_MISC_CONTROL_DEVICE_ID = 0x1573;
private const ushort FAMILY_16H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1533;
private const ushort FAMILY_16H_MODEL_30_MISC_CONTROL_DEVICE_ID = 0x1583;
private const ushort FAMILY_17H_MODEL_00_MISC_CONTROL_DEVICE_ID = 0x1577;

private const uint REPORTED_TEMPERATURE_CONTROL_REGISTER = 0xA4;
private const uint CLOCK_POWER_TIMING_CONTROL_0_REGISTER = 0xD4;

private const uint F15H_M60H_REPORTED_TEMP_CTRL_OFFSET = 0xD8200CA4;

private readonly uint miscellaneousControlAddress;
private readonly ushort miscellaneousControlDeviceId;

Expand Down Expand Up @@ -79,6 +83,8 @@ public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
FAMILY_15H_MODEL_10_MISC_CONTROL_DEVICE_ID; break;
case 0x30: miscellaneousControlDeviceId =
FAMILY_15H_MODEL_30_MISC_CONTROL_DEVICE_ID; break;
case 0x60: miscellaneousControlDeviceId =
FAMILY_15H_MODEL_60_MISC_CONTROL_DEVICE_ID; break;
default: miscellaneousControlDeviceId = 0; break;
} break;
case 0x16:
Expand All @@ -89,6 +95,8 @@ public AMD10CPU(int processorIndex, CPUID[][] cpuid, ISettings settings)
FAMILY_16H_MODEL_30_MISC_CONTROL_DEVICE_ID; break;
default: miscellaneousControlDeviceId = 0; break;
} break;
case 0x17: miscellaneousControlDeviceId =
FAMILY_17H_MODEL_00_MISC_CONTROL_DEVICE_ID; break;
default: miscellaneousControlDeviceId = 0; break;
}

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

// the file reader for lm-sensors support on Linux
temperatureStream = null;
int p = (int)Environment.OSVersion.Platform;
if ((p == 4) || (p == 128)) {

if (Software.OperatingSystem.IsLinux) {
string[] devicePaths = Directory.GetDirectories("/sys/class/hwmon/");
foreach (string path in devicePaths) {
string name = null;
Expand Down Expand Up @@ -304,6 +312,15 @@ public override void Update() {
if (temperatureStream == null) {
if (miscellaneousControlAddress != Ring0.InvalidPciAddress) {
uint value;
if (miscellaneousControlAddress == FAMILY_15H_MODEL_60_MISC_CONTROL_DEVICE_ID) {
value = F15H_M60H_REPORTED_TEMP_CTRL_OFFSET;
Ring0.WritePciConfig(Ring0.GetPciAddress(0, 0, 0), 0xB8, value);
Ring0.ReadPciConfig(Ring0.GetPciAddress(0, 0, 0), 0xBC, out value);
coreTemperature.Value = ((value >> 21) & 0x7FF) * 0.125f +
coreTemperature.Parameters[0].Value;
ActivateSensor(coreTemperature);
return;
}
if (Ring0.ReadPciConfig(miscellaneousControlAddress,
REPORTED_TEMPERATURE_CONTROL_REGISTER, out value)) {
if (family == 0x15 && (value & 0x30000) == 0x30000) {
Expand Down Expand Up @@ -345,7 +362,7 @@ public override void Update() {
Thread.Sleep(1);

uint curEax, curEdx;
if (Ring0.Rdmsr(COFVID_STATUS, out curEax, out curEdx, cpuid[i][0].Thread))
if (Ring0.Rdmsr(COFVID_STATUS, out curEax, out curEdx, cpuid[i][0].Thread))
{
double multiplier;
multiplier = GetCoreMultiplier(curEax);
Expand Down
Loading

0 comments on commit c114bac

Please sign in to comment.