/// <summary> /// /// </summary> /// <param name="ry"></param> /// <param name="id"></param> /// <param name="value"></param> /// <returns></returns> public bool ServiceRequest(ryzen_access ry, Messages id, int value) { // TODO: Ensure that the ryzen access object is suitable for use // (check all properties of the ryzen_access struct). if (initialised) { smu_service_args_t args = new smu_service_args_t(); args.arg0 = (uint)value; smu_response smuResp = accessSmu.SMUServiceReq(ry.mp1_smu, id, args); if (smuResp.response == 0x01) { Console.WriteLine("Successful SMU request - Response: {0}", smuResp.response); return(true); } Console.WriteLine("Failed SMU request - Response: {0}", smuResp.response); return(false); } Console.WriteLine("RyzenApi not initialised."); return(false); }
/// <summary> /// /// </summary> /// <returns></returns> public ryzen_access GetRyzenAccess() { // ryzen_access ry = new ryzen_access(); ry.use = true; if (!initialised) { ry.use = false; Console.WriteLine("RyzenApi not initialised."); return(ry); } // smu_service_args_t args = new smu_service_args_t(); // If the ryzen_access object is unusable, // then the pci_obj will be set to false. ry.pci_obj = accessSmu.InitialisePCIObj(); if (!ry.pci_obj) { ry.use = false; Console.WriteLine("Unable to get PCI Obj."); //return ry; } // GetNB will always return the same pci address (0x0)?. ry.nb = (uint)accessSmu.GetNB(ry.pci_obj); if (ry.nb != 0x0) { ry.use = false; Console.WriteLine("Unable to get NB Obj."); //return ry; } // TODO: smu_t will never be null, so check contents before continuing. // Set ry.mp1_smu.nb to 1 by default, GetSMU will provide new SMU set to 0. // If the get failed then nb will still be set to 1. ry.mp1_smu.nb = 1; ry.mp1_smu = accessSmu.GetSMU(ry.nb, SMU_TYPE.TYPE_MP1); if (ry.mp1_smu.nb == 1) { ry.use = false; Console.WriteLine("MP1_SMU nb still set to 1."); //return ry; } Console.WriteLine("PSMU nb set to: " + ry.mp1_smu.nb); // Similar process with psmu. ry.psmu.nb = 1; ry.psmu = accessSmu.GetSMU(ry.nb, SMU_TYPE.TYPE_PSMU); if (ry.psmu.nb == 1) { ry.use = false; Console.WriteLine("PSMU nb still set to 1."); //return ry; } Console.WriteLine("PSMU nb set to: " + ry.psmu.nb); // Check if the device is a Ryzen nb SMU. args = accessSmu.SMUServiceReq(ry.mp1_smu, Definitions.Messages.GetBiosIfVersion, args).args; Console.WriteLine(args.arg0); if (args.arg0 < 0x5) { ry.use = false; Console.WriteLine("Not a Ryzen NB SMU, BIOS Interface Version: 0x{0}", args.arg0); } // Return the ryzen access object. Console.WriteLine("Initialised and returning ryzen_access object."); return(ry); }
public bool SetMinLClk(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetSoftMaxLclk, value)); }
public bool SetMinVcn(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetSoftMinVcn, value)); }
public bool SetMinFClkFreq(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetSoftMinFclkByFreq, value)); }
public bool SetMaxGfxClkFreq(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetSoftMaxGfxClk, value)); }
public bool SetPsi0SoCCurrentLimit(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetPSI0SocCurrentLimit, value)); }
public bool SetVrmSoCMaxCurrentLimit(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetVrmSocMaximumCurrentLimit, value)); }
public bool SetTemperatureLimit(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetTctlMax, value)); }
/// <summary> /// /// </summary> /// <param name="ry"></param> /// <param name="value"></param> /// <returns></returns> public bool SetStapmTime(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetStapmTimeConstant, value)); }
/// <summary> /// /// </summary> /// <param name="ry"></param> /// <param name="value"></param> /// <returns></returns> public bool SetSlowLimit(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetSlowPPTLimit, value)); }
/// <summary> /// /// </summary> /// <param name="ry"></param> /// <param name="value"></param> /// <returns></returns> public bool SetStapmLimit(ryzen_access ry, int value) { return(ServiceRequest(ry, Messages.SetSustainedPowerLimit, value)); }