why the heck didn't it grab these files

This commit is contained in:
rawhide kobayashi 2025-03-14 14:31:45 -05:00
parent 5918685d93
commit 07212c5986
Signed by: rawhide_k
GPG Key ID: E71F77DDBC513FD7
5 changed files with 90 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
bin/
obj/

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "ryzen-smu-cli.sln"
}

22
ryzen-smu-cli.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ryzen-smu-cli", "ryzen-smu-cli\ryzen-smu-cli.csproj", "{F64F6F9E-E342-45AB-A064-92EE3DB730B6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F64F6F9E-E342-45AB-A064-92EE3DB730B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F64F6F9E-E342-45AB-A064-92EE3DB730B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F64F6F9E-E342-45AB-A064-92EE3DB730B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F64F6F9E-E342-45AB-A064-92EE3DB730B6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

40
ryzen-smu-cli/Program.cs Normal file
View File

@ -0,0 +1,40 @@
using System.CommandLine;
using ZenStates.Core;
class Program
{
private static readonly Cpu ryzen = new();
static int Main(string[] args)
{
var rootCommand = new RootCommand("A CLI for the Ryzen SMU.");
var pboOffset = new Option<string>("--offset", "Specify a core, or list of cores, and their PBO offset(s).");
rootCommand.AddOption(pboOffset);
// How to format this command and process it is to be decided.
rootCommand.SetHandler((core_values) =>
{
Console.WriteLine(core_values);
}, pboOffset);
// works
ApplySingleCorePBOOffset(0, -15);
return rootCommand.Invoke(args);
}
private static void ApplySingleCorePBOOffset(int coreNumber, int value)
{
// Magic numbers from SMUDebugTool
// This does some bitshifting calculations to get the mask for individual cores for chips with up to two CCDs
// I'm not sure if it would work with more, in theory. It's unclear to me based on the github issues.
int mapIndex = coreNumber < 8 ? 0 : 1;
if ((~ryzen.info.topology.coreDisableMap[mapIndex] >> coreNumber % 8 & 1) == 1)
{
ryzen.SetPsmMarginSingleCore((uint)(((mapIndex << 8) | coreNumber % 8 & 0xF) << 20), value);
}
}
}

View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>ryzen_smu_cli</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>0.0.1</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<!-- Included for the ZenStates-Core submodule...-->
<PackageReference Include="System.Management" Version="6.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="6.0.0" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="System.Threading.AccessControl" Version="6.0.0" />
</ItemGroup>
<Target Name="PostBuild" AfterTargets="AfterBuild" Condition="'$(OS)' == 'Windows_NT'">
<Exec Command="xcopy /s /d /y &quot;$(ProjectDir)include\ZenStates-Core\External\InpOut\x64\inpoutx64.dll&quot; &quot;$(OutDir)&quot;&#xD;&#xA;xcopy /s /d /y &quot;$(ProjectDir)include\ZenStates-Core\External\WinIo\WinIo32.dll&quot; &quot;$(OutDir)&quot;&#xD;&#xA;xcopy /s /d /y &quot;$(ProjectDir)include\ZenStates-Core\External\WinIo\WinIo32.sys&quot; &quot;$(OutDir)&quot;&#xD;&#xA;copy &quot;$(ProjectDir)include\ZenStates-Core\External\InpOut\license.txt&quot; &quot;$(OutDir)InpOut.LICENSE.txt&quot;&#xD;&#xA;copy &quot;$(ProjectDir)include\ZenStates-Core\External\WinIo\LICENSE.txt&quot; &quot;$(OutDir)WinIo32.LICENSE.txt&quot;&#xD;&#xA;copy &quot;$(ProjectDir)include\ZenStates-Core\External\WinRing0\LICENSE.txt&quot; &quot;$(OutDir)WinRing0.LICENSE.txt&quot;" />
</Target>
</Project>