From e12aefe81663d9dcfd2d91ec530010b4c61bf1ba Mon Sep 17 00:00:00 2001 From: SergeySlice Date: Thu, 24 Jun 2021 22:52:12 +0300 Subject: [PATCH 1/2] repaired taking SavingMode from config Signed-off-by: SergeySlice --- rEFIt_UEFI/Settings/ConfigManager.cpp | 33 ++++++++++++--------------- rEFIt_UEFI/refit/main.cpp | 3 ++- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/rEFIt_UEFI/Settings/ConfigManager.cpp b/rEFIt_UEFI/Settings/ConfigManager.cpp index 2b596abdb..7bda56e26 100644 --- a/rEFIt_UEFI/Settings/ConfigManager.cpp +++ b/rEFIt_UEFI/Settings/ConfigManager.cpp @@ -735,13 +735,14 @@ void ConfigManager::applySettings() const if ( !configPlist.ACPI.SSDT.getMinMultiplier().isDefined() ) gSettings.ACPI.SSDT.MinMultiplier = 7; } - // DBG("2: GlobalConfig.C3Latency=%x\n", GlobalConfig.C3Latency); if ( !configPlist.ACPI.SSDT.getC3Latency().isDefined() ) gSettings.ACPI.SSDT._C3Latency = 0x00FA; - // DBG("2: gSettings.ACPI.SSDT._C3Latency=%x\n", gSettings.ACPI.SSDT._C3Latency); + } //gSettings.CPU.Turbo = gCPUStructure.Turbo; - gSettings.CPU.SavingMode = 0xFF; //means not set + if (configPlist.CPU.dgetSavingMode() != 0xFF) { //means not set + gSettings.CPU.SavingMode = configPlist.CPU.dgetSavingMode(); + } if ( gCPUStructure.Model >= CPU_MODEL_SKYLAKE_D ) { if ( !configPlist.CPU.getUseARTFreq().isDefined() ) @@ -803,12 +804,6 @@ void ConfigManager::applySettings() const DBG("Set MaxRatio for QEMU: %d\n", gCPUStructure.MaxRatio); gCPUStructure.MaxRatio *= 10; gCPUStructure.MinRatio = 60; - /* AsmWriteMsr64(MSR_FLEX_RATIO, ((6ULL << 40) + //(1ULL << 16) + - (gCPUStructure.MaxRatio << 8))); - DBG("check if flex is RW\n"); - Msrflex = AsmReadMsr64(MSR_FLEX_RATIO); //0 == not Rw :( - DBG("MSR_FLEX_RATIO = %lx\n", Msrflex); - */ gCPUStructure.FSBFrequency = DivU64x32(MultU64x32(gCPUStructure.CPUFrequency, 10), (gCPUStructure.MaxRatio == 0) ? 1 : gCPUStructure.MaxRatio); gCPUStructure.ExternalClock = (UINT32)DivU64x32(gCPUStructure.FSBFrequency + Kilo - 1, Kilo); @@ -897,18 +892,16 @@ EFI_STATUS ConfigManager::LoadConfig(const XStringW& ConfName) /*Status = */ LoadSMBIOSPlist(L"smbios"_XSW); // we don't need Status. If not loaded correctly, smbiosPlist is !defined and will be ignored by AssignOldNewSettings() MACHINE_TYPES Model = iMac132; - if ( smbiosPlist.SMBIOS.isDefined() ) { - if ( smbiosPlist.SMBIOS.hasModel() ) { - Model = smbiosPlist.SMBIOS.getModel(); - } - } if ( configPlist.getSMBIOS().hasModel() ) { - Model = configPlist.getSMBIOS().getModel(); - }else{ + if ( smbiosPlist.SMBIOS.isDefined() && smbiosPlist.SMBIOS.hasModel()) { + Model = smbiosPlist.SMBIOS.getModel(); + } else if ( configPlist.getSMBIOS().hasModel() ) { + Model = configPlist.getSMBIOS().getModel(); + } else { Model = GetDefaultModel(); } - if ( !EFI_ERROR(Status) ) { - gSettings.takeValueFrom(configPlist); +// if ( !EFI_ERROR(Status) ) { +// gSettings.takeValueFrom(configPlist); // TODO improve this (avoid to delete settings to re-import them !) // restore default value for SMBIOS (delete values from configPlist) SetDMISettingsForModel(Model, &gSettings, &GlobalConfig); @@ -918,7 +911,8 @@ EFI_STATUS ConfigManager::LoadConfig(const XStringW& ConfName) // import values from smbiosPlist if they are defined FillSmbiosWithDefaultValue(Model, smbiosPlist.SMBIOS); } - } +// } + gSettings.takeValueFrom(configPlist); applySettings(); return Status; @@ -1021,6 +1015,7 @@ EFI_STATUS ConfigManager::InitialisePlatform() GetCPUProperties(); DiscoverDevices(); // GetMacAddress(&gConf.LanCardArrayNonConst); + //SavingMode if ( g_SmbiosDiscoveredSettings.EnabledCores ) { GlobalConfig.EnabledCores = g_SmbiosDiscoveredSettings.EnabledCores; diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index c7d42ede3..2aef84f5e 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -2956,6 +2956,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, } // DBG("0: GlobalConfig.C3Latency=%x\n", gSettings.ACPI.SSDT._C3Latency); GlobalConfig.C3Latency = gSettings.ACPI.SSDT._C3Latency; +// DBG("0: gSettings.CPU.SavingMode=%x\n", gSettings.CPU.SavingMode); // ThemeX.FillByEmbedded(); //init XTheme before EarlyUserSettings { void *Value = NULL; @@ -3069,7 +3070,6 @@ RefitMain (IN EFI_HANDLE ImageHandle, afterGetUserSettings(gSettings); - // dropDSM = 0xFFFF; //by default we drop all OEM _DSM. They have no sense for us. // if (defDSM) { // dropDSM = gSettings.DropOEM_DSM; //if set by user @@ -3113,6 +3113,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, gGuiIsReady = TRUE; GlobalConfig.gBootChanged = TRUE; GlobalConfig.gThemeChanged = TRUE; + do { if (GlobalConfig.gBootChanged && GlobalConfig.gThemeChanged) { // config changed GetListOfDsdts(); //only after GetUserSettings From adb880456de7b0d855c3aaa6590771c66cf00b4f Mon Sep 17 00:00:00 2001 From: SergeySlice Date: Fri, 25 Jun 2021 20:58:38 +0300 Subject: [PATCH 2/2] initial value for KernelPM to be in menu Signed-off-by: SergeySlice --- rEFIt_UEFI/refit/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 2aef84f5e..c25fb9591 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -2956,6 +2956,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, } // DBG("0: GlobalConfig.C3Latency=%x\n", gSettings.ACPI.SSDT._C3Latency); GlobalConfig.C3Latency = gSettings.ACPI.SSDT._C3Latency; + GlobalConfig.KPKernelPm = gSettings.KernelAndKextPatches._KPKernelPm; // DBG("0: gSettings.CPU.SavingMode=%x\n", gSettings.CPU.SavingMode); // ThemeX.FillByEmbedded(); //init XTheme before EarlyUserSettings {