private void updateButton_Click(object sender, EventArgs e) { //Brazos merge next line from BT //for (int i = 0; i < 5; i++) for (int i = 0; i < 10; i++) { _pStates[i] = PState.Load(i); // disable the current P-state and all following ones in case the // first core's CPU VID is > than the previous P-state's //Brazos merge next line from BT //if ((i > 0 && _pStates[i].Msrs[0].Vid > _pStates[i - 1].Msrs[0].Vid) && (i < 3)) //ignore Vids from NB in comprison if ((i > 0 && _pStates[i].Msrs[0].Vid > _pStates[i - 1].Msrs[0].Vid) && (i < 8)) //ignore Vids from NB in comparison { //Brazos merge next line from BT //for (int j = i; j < 5; j++) for (int j = i; j < 8; j++) { _pStates[j] = null; } break; } } RefreshPStatesLabel(); }
/// <summary> /// Decodes a P-state from its string representation. /// </summary> /// <returns></returns> public static PState Decode(string text, int pstate) { if (string.IsNullOrEmpty(text)) { return(null); } string[] tokens = text.Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (tokens == null || tokens.Length != _numCores) { return(null); } var r = new PState(); for (int i = 0; i < _numCores; i++) { uint value = uint.Parse(tokens[i], System.Globalization.NumberStyles.HexNumber); r._msrs[i] = PStateMsr.Decode(value, pstate); } return(r); }
/// <summary> /// Loads the specified P-state from the cores' and NB MSRs. /// </summary> /// <param name="index">Index of the hardware P-state (0-7) to be loaded. Adding NB P-state (8,9)</param> public static PState Load(int index) { //Brazos merge next line from BT //if (index < 0 || index > 4) if (index < 0 || index > 9) throw new ArgumentOutOfRangeException("index"); var r = new PState(); for (int i = 0; i < _numCores; i++) r._msrs[i] = PStateMsr.Load(index, i); return r; }
/// <summary> /// Loads the specified P-state from the cores' and NB MSRs. /// </summary> /// <param name="index">Index of the hardware P-state (0-7) to be loaded. Adding NB P-state (8,9)</param> public static PState Load(int index) { //Brazos merge next line from BT //if (index < 0 || index > 4) if (index < 0 || index > 9) { throw new ArgumentOutOfRangeException("index"); } var r = new PState(); for (int i = 0; i < _numCores; i++) { r._msrs[i] = PStateMsr.Load(index, i); } return(r); }
/// <summary> /// Decodes a P-state from its string representation. /// </summary> /// <returns></returns> public static PState Decode(string text,int pstate) { if (string.IsNullOrEmpty(text)) return null; string[] tokens = text.Split(new char[1] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (tokens == null || tokens.Length != _numCores) return null; var r = new PState(); for (int i = 0; i < _numCores; i++) { uint value = uint.Parse(tokens[i], System.Globalization.NumberStyles.HexNumber); r._msrs[i] = PStateMsr.Decode(value,pstate); } return r; }
/// <summary> /// Loads the P-state settings from each core's MSR. /// </summary> public void LoadFromHardware() { if (_index < 0) throw new InvalidOperationException("The PStateIndex property needs to be initialized first."); if (_index < 8) //hardware loads for CPU { //FT if (_index <= K10Manager.GetHighestPState() + K10Manager.GetNumBoostedStates()) //skip, in case index is bigger than initialized CPU PStates if (_index <= 7)//_maxPstate) //skip, in case just 2 CPU PStates are initialized { _pState = PState.Load(_index); double maxCpuVid = 0; for (int i = 0; i < _pState.Msrs.Length; i++)//iterating through cores { var msr = _pState.Msrs[i]; var control = (NumericUpDown)flowLayoutPanel1.Controls[i]; control.Value = (decimal)msr.CPUMultNBDivider; maxCpuVid = Math.Max(maxCpuVid, msr.Vid); } VidNumericUpDown.Value = Math.Min(VidNumericUpDown.Maximum, (decimal)maxCpuVid); //int check = K10Manager.SetBIOSBusSpeed(80); pllfreq.Text = "P" + _index + " Freq (CPU): "; clockvalue.Text = K10Manager.GetBIOSBusSpeed() + "MHz"; freqvalue.Text = (int)_pState.Msrs[0].PLL + "MHz"; if ((Form1.family == 12) || (Form1.family == 16)) { //Llano + Kabini Cofstate.Text = "Mult = "; } else { //Brazos Cofstate.Text = "Mult = " + (K10Manager.CurrCOF() + 16) + " divided by ->"; } Form1.freq[_index] = (int)_pState.Msrs[0].PLL; if (PStateIndex <= _maxPstate) { checkBox_Penable.Checked = true; checkBox_Penable.Enabled = false; } else { checkBox_Penable.Checked = false; checkBox_Penable.Enabled = false; } } else { VidNumericUpDown.Value = (decimal)0.4; } } else if (_index == 8) { //hardware loads for NB P0 _pState = PState.Load(_index); var control = (NumericUpDown)flowLayoutPanel1.Controls[0]; control.Value = (decimal)K10Manager.GetNbDivPState0(); VidNumericUpDown.Value = (decimal)(1.55 - 0.0125 * K10Manager.GetNbVidPState0()); pllfreq.Text = "NB P0 Freq (GPU): "; Cofstate.Text = "Mult = " + (K10Manager.CurrCOF() + 16) + " divided by ->"; clockvalue.Text = K10Manager.GetBIOSBusSpeed() + "MHz"; freqvalue.Text = (int)_pState.Msrs[0].PLL + "MHz"; Form1.freq[_index] = (int)_pState.Msrs[0].PLL; checkBox_Penable.Checked = true; checkBox_Penable.Enabled = false; } else if (_index == 9) { //hardware loads for NB P1 _pState = PState.Load(_index); var control = (NumericUpDown)flowLayoutPanel1.Controls[0]; control.Value = (decimal)K10Manager.GetNbDivPState1(); VidNumericUpDown.Value = (decimal)(1.55 - 0.0125 * K10Manager.GetNbVidPState1()); pllfreq.Text = "NB P1 Freq (GPU): "; clockvalue.Text = K10Manager.GetBIOSBusSpeed() + "MHz"; freqvalue.Text = (int)_pState.Msrs[0].PLL + "MHz"; Cofstate.Text = "Mult = " + (K10Manager.CurrCOF() + 16) + " divided by ->"; Form1.freq[_index] = (int)_pState.Msrs[0].PLL; checkBox_Penable.Checked = true; checkBox_Penable.Enabled = false; } else if (_index == 10) //settings for displaying registers { VidNumericUpDown.Value = 1; } _modified = false; }
public ServiceDialog(System.Drawing.Icon icon) { InitializeComponent(); this.Icon = icon; makePermanentCheckBox.CheckedChanged += (s, e) => updateButton.Enabled = makePermanentCheckBox.Checked; turboCheckBox.CheckedChanged += (s, e) => { if (turboCheckBox.Checked) { enableCustomCnQCheckBox.Checked = false; enableCustomCnQCheckBox.Enabled = false; } else { enableCustomCnQCheckBox.Enabled = true; } }; enableCustomCnQCheckBox.CheckedChanged += (s, e) => tabControl1.Enabled = enableCustomCnQCheckBox.Checked; // select the current P-state settings as default settings updateButton_Click(updateButton, EventArgs.Empty); turboCheckBox.Enabled = K10Manager.IsTurboSupported(); turboCheckBox.Checked = K10Manager.IsTurboEnabled(); //Brazos merge line from BT //turboCheckBox.Checked = K10Manager.IsTurboSupported(); balancedProfileControl.LoadFromRegistry(); highPerformanceProfileControl.LoadFromRegistry(); powerSaverProfileControl.LoadFromRegistry(); var key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\FusionTweaker"); if (key == null) { return; } //Brazos merge ToDo line from BT , which sets only active PStates //for (int i = 0; i < (_maxPstate + 1); i++) for (int i = 0; i < 10; i++) { string text = (string)key.GetValue("P" + i); _pStates[i] = PState.Decode(text, i); } //Brazos merge ToDo line from BT , which sets only active PStates /*for (int i = 3; i < 5; i++) * { * string text = (string)key.GetValue("P" + i); * _pStates[i] = PState.Decode(text, i); * }*/ RefreshPStatesLabel(); makePermanentCheckBox.Checked = ((int)key.GetValue("EnableCustomPStates", 0) != 0); //Brazos merge next line only in FT turboCheckBox.Checked = (K10Manager.IsTurboEnabled()); enableCustomCnQCheckBox.Checked = ((int)key.GetValue("EnableCustomCnQ", 0) != 0); key.Close(); }
/// <summary> /// Loads the P-state settings from each core's MSR. /// </summary> public void LoadFromHardware() { if (_index < 0) { throw new InvalidOperationException("The PStateIndex property needs to be initialized first."); } if (_index < 8) //hardware loads for CPU { //FT if (_index <= K10Manager.GetHighestPState() + K10Manager.GetNumBoostedStates()) //skip, in case index is bigger than initialized CPU PStates if (_index <= 7)//_maxPstate) //skip, in case just 2 CPU PStates are initialized { _pState = PState.Load(_index); double maxCpuVid = 0; for (int i = 0; i < _pState.Msrs.Length; i++)//iterating through cores { var msr = _pState.Msrs[i]; var control = (NumericUpDown)flowLayoutPanel1.Controls[i]; control.Value = (decimal)msr.CPUMultNBDivider; maxCpuVid = Math.Max(maxCpuVid, msr.Vid); } VidNumericUpDown.Value = Math.Min(VidNumericUpDown.Maximum, (decimal)maxCpuVid); //int check = K10Manager.SetBIOSBusSpeed(80); pllfreq.Text = "P" + _index + " Freq (CPU): "; clockvalue.Text = K10Manager.GetBIOSBusSpeed() + "MHz"; freqvalue.Text = (int)_pState.Msrs[0].PLL + "MHz"; if ((Form1.family == 12) || (Form1.family == 16)) //Llano + Kabini { Cofstate.Text = "Mult = "; } else //Brazos { Cofstate.Text = "Mult = " + (K10Manager.CurrCOF() + 16) + " divided by ->"; } Form1.freq[_index] = (int)_pState.Msrs[0].PLL; if (PStateIndex <= _maxPstate) { checkBox_Penable.Checked = true; checkBox_Penable.Enabled = false; } else { checkBox_Penable.Checked = false; checkBox_Penable.Enabled = false; } } else { VidNumericUpDown.Value = (decimal)0.4; } } else if (_index == 8) { //hardware loads for NB P0 _pState = PState.Load(_index); var control = (NumericUpDown)flowLayoutPanel1.Controls[0]; control.Value = (decimal)K10Manager.GetNbDivPState0(); VidNumericUpDown.Value = (decimal)(1.55 - 0.0125 * K10Manager.GetNbVidPState0()); pllfreq.Text = "NB P0 Freq (GPU): "; Cofstate.Text = "Mult = " + (K10Manager.CurrCOF() + 16) + " divided by ->"; clockvalue.Text = K10Manager.GetBIOSBusSpeed() + "MHz"; freqvalue.Text = (int)_pState.Msrs[0].PLL + "MHz"; Form1.freq[_index] = (int)_pState.Msrs[0].PLL; checkBox_Penable.Checked = true; checkBox_Penable.Enabled = false; } else if (_index == 9) { //hardware loads for NB P1 _pState = PState.Load(_index); var control = (NumericUpDown)flowLayoutPanel1.Controls[0]; control.Value = (decimal)K10Manager.GetNbDivPState1(); VidNumericUpDown.Value = (decimal)(1.55 - 0.0125 * K10Manager.GetNbVidPState1()); pllfreq.Text = "NB P1 Freq (GPU): "; clockvalue.Text = K10Manager.GetBIOSBusSpeed() + "MHz"; freqvalue.Text = (int)_pState.Msrs[0].PLL + "MHz"; Cofstate.Text = "Mult = " + (K10Manager.CurrCOF() + 16) + " divided by ->"; Form1.freq[_index] = (int)_pState.Msrs[0].PLL; checkBox_Penable.Checked = true; checkBox_Penable.Enabled = false; } else if (_index == 10) //settings for displaying registers { VidNumericUpDown.Value = 1; } _modified = false; }