diff --git a/rEFIt_UEFI/Platform/Settings.h b/rEFIt_UEFI/Platform/Settings.h index f503c2e72b..39f13bf502 100644 --- a/rEFIt_UEFI/Platform/Settings.h +++ b/rEFIt_UEFI/Platform/Settings.h @@ -670,6 +670,7 @@ class SETTINGS_DATA { XBool NeverDoRecovery = false; XBool LastBootedVolume = false; XStringW DefaultVolume = XStringW(); + bool BootFirstAvailable = false; XStringW DefaultLoader = XStringW(); XBool DebugLog = false; XBool FastBoot = false; @@ -736,6 +737,7 @@ class SETTINGS_DATA { NeverDoRecovery = other.dgetNeverDoRecovery(); LastBootedVolume = other.dgetLastBootedVolume(); DefaultVolume = other.dgetDefaultVolume(); + BootFirstAvailable = other.dgetBootFirstAvailable(); DefaultLoader = other.dgetDefaultLoader(); DebugLog = other.dgetDebugLog(); FastBoot = other.dgetFastBoot(); diff --git a/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h b/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h index 1c1c942c7e..58e78bd04f 100644 --- a/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h +++ b/rEFIt_UEFI/Settings/ConfigPlist/Config_Boot.h @@ -141,7 +141,12 @@ class Boot_Class : public XmlDict const decltype(DefaultVolume)::ValueType& dgetDefaultVolume() const { if ( !DefaultVolume.isDefined() ) return DefaultVolume.nullValue; if ( DefaultVolume.value().isEqualIC("LastBootedVolume") ) return DefaultVolume.nullValue; - return DefaultVolume.isDefined() ? DefaultVolume.value() : DefaultVolume.nullValue; + if ( DefaultVolume.value().isEqualIC("FirstAvailable") ) return DefaultVolume.nullValue; + return DefaultVolume.value(); + }; + bool dgetBootFirstAvailable() const { + if ( !DefaultVolume.isDefined() ) return false; + return DefaultVolume.value().isEqualIC("FirstAvailable"); }; const XString8& dgetDefaultLoader() const { return DefaultLoader.isDefined() ? DefaultLoader.value() : NullXString8; }; XBool dgetDebugLog() const { return Debug.isDefined() ? Debug.value() : XBool(false); }; diff --git a/rEFIt_UEFI/cpp_foundation/XObjArray.h b/rEFIt_UEFI/cpp_foundation/XObjArray.h index 97ec97b359..71488bd71a 100644 --- a/rEFIt_UEFI/cpp_foundation/XObjArray.h +++ b/rEFIt_UEFI/cpp_foundation/XObjArray.h @@ -110,6 +110,14 @@ class XObjArrayNC template TYPE &operator[](IntegralType nIndex) { return ElementAt(nIndex); } + size_t indexOf(TYPE& e) const { + size_t i; + for ( i=0 ; i& other) const { if ( size() != other.size() ) return false; diff --git a/rEFIt_UEFI/entry_scan/legacy.cpp b/rEFIt_UEFI/entry_scan/legacy.cpp index 1bae783005..995ab443f2 100644 --- a/rEFIt_UEFI/entry_scan/legacy.cpp +++ b/rEFIt_UEFI/entry_scan/legacy.cpp @@ -310,7 +310,7 @@ void AddCustomLegacy(void) if (Custom.settings.VolumeType != 0) { if (((1ull<DiskKind) & Custom.settings.VolumeType) == 0) { - DBG("skipped because media is ignored\n"); + DBG("skipped because media is ignored (VolumeType=%d DiskKind=%d)\n", Custom.settings.VolumeType, Volume->DiskKind); continue; } } diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 583ef1ab75..cd3640a6c8 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -2406,7 +2406,7 @@ STATIC void AddCustomEntry(IN UINTN CustomIndex, } if (Custom.settings.VolumeType != 0 && ((1<DiskKind) & Custom.settings.VolumeType) == 0) { - DBG("skipped because media is ignored\n"); + DBG("skipped because media is ignored (VolumeType=%d DiskKind=%d)\n", Custom.settings.VolumeType, Volume->DiskKind); continue; } diff --git a/rEFIt_UEFI/entry_scan/tool.cpp b/rEFIt_UEFI/entry_scan/tool.cpp index 67e831a5eb..5694abebfc 100644 --- a/rEFIt_UEFI/entry_scan/tool.cpp +++ b/rEFIt_UEFI/entry_scan/tool.cpp @@ -278,7 +278,7 @@ void AddCustomTool(void) if (Custom.settings.VolumeType != 0) { if (((1ull<DiskKind) & Custom.settings.VolumeType) == 0) { - DBG("skipped because media is ignored\n"); + DBG("skipped because media is ignored (VolumeType=%d DiskKind=%d)\n", Custom.settings.VolumeType, Volume->DiskKind); continue; } } diff --git a/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp index 293606b7aa..5fa5d95698 100644 --- a/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MAINMENU_SCREEN.cpp @@ -169,6 +169,10 @@ void REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align) // Display Clover boot volume if (SelfVolume->VolLabel.notEmpty() && SelfVolume->VolLabel[0] != L'#') { Text = SWPrintf("%ls, booted from %ls %ls", gFirmwareRevision, SelfVolume->VolLabel.wc_str(), self.getCloverDirFullPath().wc_str()); + }else{ + if ( SelfVolume->VolName.notEmpty() ) { + Text = SWPrintf("%ls %ls%ls", gFirmwareRevision, SelfVolume->VolName.wc_str(), self.getCloverDirFullPath().wc_str()); + } } if (Text.isEmpty()) { Text = SWPrintf("%ls %ls", gFirmwareRevision, /*SelfVolume->VolName.wc_str(),*/ self.getCloverDirFullPath().wc_str()); diff --git a/rEFIt_UEFI/refit/lib.cpp b/rEFIt_UEFI/refit/lib.cpp index 5725965abd..a357d8ba79 100644 --- a/rEFIt_UEFI/refit/lib.cpp +++ b/rEFIt_UEFI/refit/lib.cpp @@ -584,16 +584,9 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) Volume->DevicePathString = FileDevicePathToXStringW(Volume->DevicePath); } -#if REFIT_DEBUG > 0 if (Volume->DevicePath != NULL) { DBG(" %ls\n", FileDevicePathToXStringW(Volume->DevicePath).wc_str()); - //#if REFIT_DEBUG >= 2 - // DumpHex(1, 0, GetDevicePathSize(Volume->DevicePath), Volume->DevicePath); - //#endif } -#else - DBG("\n"); -#endif Volume->ApfsFileSystemUUID = APFSPartitionUUIDExtract(Volume->DevicePath); // NullXString8 if it's not an APFS volume Volume->DiskKind = DISK_KIND_INTERNAL; // default @@ -996,6 +989,10 @@ void ScanVolumes(void) Volume->Hidden = false; // default to not hidden Status = ScanVolume(Volume); +#ifdef JIEF_DEBUG + DBG(" kind=%d\n", Volume->DiskKind); +#endif + if (!EFI_ERROR(Status)) { Volume->Index = HandleIndex; Volumes.AddReference(Volume, true); diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 20c69bc68e..b667f9a66d 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -873,11 +873,6 @@ void LOADER_ENTRY::DelegateKernelPatches() OC_DATA_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Replace, kextPatch.Replace.data(), kextPatch.Replace.size()); OC_DATA_ASSIGN_N(mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->ReplaceMask, kextPatch.MaskReplace.data(), kextPatch.MaskReplace.size()); mOpenCoreConfiguration.Kernel.Patch.Values[kextPatchIdx]->Skip = (UINT32)kextPatch.Skip; -#ifdef JIEF_DEBUG -if ( kextPatch.Label == "algrey - cpuid_set_info - ryzen cores and logicals count - part 3 - 10.14"_XS8 ) { - DEBUG (( DEBUG_INFO, "" )); -} -#endif } } @@ -1159,9 +1154,11 @@ void LOADER_ENTRY::StartLoader() mOpenCoreConfiguration.Kernel.Scheme.FuzzyMatch = gSettings.Quirks.FuzzyMatch; memset(&mOpenCoreConfiguration.Kernel.Quirks, 0, sizeof(mOpenCoreConfiguration.Kernel.Quirks)); - mOpenCoreConfiguration.Kernel.Quirks.SetApfsTrimTimeout = -1; // Jief: Slice modified OcConfigurationLib.h to set -1 by default instead of 999. I prefer the modification here to minimize commts in OC submodule. Makes it easier to upgrade submodule. + + mOpenCoreConfiguration.Kernel.Quirks.SetApfsTrimTimeout = -1; // Jief: Slice modified OcConfigurationLib.h to set -1 by default instead of 999. I prefer the modification here to minimize commits in OC submodule. Makes it easier to upgrade submodule. mOpenCoreConfiguration.Kernel.Quirks.AppleCpuPmCfgLock = GlobalConfig.KPAppleIntelCPUPM || GlobalConfig.NeedPMfix ; mOpenCoreConfiguration.Kernel.Quirks.AppleXcpmCfgLock = GlobalConfig.KPKernelPm || GlobalConfig.NeedPMfix ; + mOpenCoreConfiguration.Kernel.Quirks.AppleXcpmExtraMsrs = gSettings.Quirks.OcKernelQuirks.AppleXcpmExtraMsrs; mOpenCoreConfiguration.Kernel.Quirks.AppleXcpmForceBoost = gSettings.Quirks.OcKernelQuirks.AppleXcpmForceBoost; #ifndef USE_OC_SECTION_PlatformInfo @@ -1193,6 +1190,10 @@ void LOADER_ENTRY::StartLoader() pos = setKextAtPos(&kextArray, "VirtualSMC.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "FakeSMC.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "WhateverGreen.kext"_XS8, pos); +// pos = setKextAtPos(&kextArray, "AppleMCEReporterDisabler.kext"_XS8, pos); +// pos = setKextAtPos(&kextArray, "AppleIntelI210Ethernet.kext"_XS8, pos); +// pos = setKextAtPos(&kextArray, "USBWakeFixup.kext"_XS8, pos); +// pos = setKextAtPos(&kextArray, "FeatureUnlock.kext"_XS8, pos); // pos = setKextAtPos(&kextArray, "vecLib.kext"_XS8, pos); // pos = setKextAtPos(&kextArray, "IOAudioFamily.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "IOSkywalkFamily.kext"_XS8, pos); @@ -1203,7 +1204,6 @@ void LOADER_ENTRY::StartLoader() pos = setKextAtPos(&kextArray, "AppleALC.kext"_XS8, pos); // pos = setKextAtPos(&kextArray, "IntelMausi.kext"_XS8, pos); // not needed special order? pos = setKextAtPos(&kextArray, "SMCProcessor.kext"_XS8, pos); - pos = setKextAtPos(&kextArray, "SMCSuperIO.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "USBPorts.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "VoodooGPIO.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "VoodooI2CServices.kext"_XS8, pos); @@ -1220,6 +1220,8 @@ void LOADER_ENTRY::StartLoader() pos = setKextAtPos(&kextArray, "corecaptureElCap.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "IO80211ElCap.kext"_XS8, pos); pos = setKextAtPos(&kextArray, "AirPortAtheros40.kext"_XS8, pos); + pos = setKextAtPos(&kextArray, "SMCProcessorAMD.kext"_XS8, pos); + pos = setKextAtPos(&kextArray, "SMCSuperIO.kext"_XS8, pos); for (size_t kextIdx = 0 ; kextIdx < kextArray.size() ; kextIdx++ ) { const SIDELOAD_KEXT& KextEntry = kextArray[kextIdx]; @@ -1388,7 +1390,7 @@ void LOADER_ENTRY::StartLoader() memset(mOpenCoreConfiguration.Kernel.Block.Values[0], 0, mOpenCoreConfiguration.Kernel.Block.ValueSize); mOpenCoreConfiguration.Kernel.Block.Values[0]->Enabled = 1; OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Block.Values[0]->Arch, OC_BLOB_GET(&mOpenCoreConfiguration.Kernel.Scheme.KernelArch)); - OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Block.Values[0]->Comment, ""); + OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Block.Values[0]->Comment, "Allow IOSkywalk Downgrade"); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Block.Values[0]->MaxKernel, ""); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Block.Values[0]->MinKernel, "23"); OC_STRING_ASSIGN(mOpenCoreConfiguration.Kernel.Block.Values[0]->Identifier, "com.apple.iokit.IOSkywalkFamily"); @@ -2519,6 +2521,8 @@ INTN FindDefaultEntry(void) // DBG("FindDefaultEntry ...\n"); //DbgHeader("FindDefaultEntry"); + if ( gSettings.Boot.BootFirstAvailable ) return 0; + // // try to detect volume set by Startup Disk or previous Clover selection // with broken nvram this requires emulation to be installed. @@ -3379,7 +3383,7 @@ displayFreeMemory("Before RunMainMenu"_XS8); #endif MenuExit = MainMenu.RunMainMenu(DefaultIndex, &ChosenEntry); } - // DBG("exit from MainMenu %llu\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3 +// DBG("exit from MainMenu %llu ChosenEntry=%zu\n", MenuExit, MainMenu.Entries.indexOf(*ChosenEntry)); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3 // disable default boot - have sense only in the first run gSettings.Boot.Timeout = -1; if ((DefaultEntry != NULL) && (MenuExit == MENU_EXIT_TIMEOUT)) {