From bc7fc4a8e94111094531e98ca36297394134b3c6 Mon Sep 17 00:00:00 2001 From: dakanji Date: Thu, 9 May 2024 09:22:03 +0300 Subject: [PATCH] Housekeeping --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/ISSUE_TEMPLATE/feature-request.yml | 7 +- .github/workflows/issues-lock.yml | 18 +-- BUILDING.md | 6 +- BootMaster/driver_support.h | 10 +- BootMaster/global.h | 4 +- BootMaster/install.c | 4 +- BootMaster/launch_efi.c | 8 +- BootMaster/lib.c | 67 ++++---- BootMaster/main.c | 37 +++-- BootMaster/menu.c | 128 ++++++++------- BootMaster/scan.c | 175 +++++++++++---------- Library/MemLogLib/GenericIch.h | 8 +- Library/MemLogLib/MemLogLib.h | 10 +- Library/RP_ApfsLib/RP_ApfsConnect.c | 2 +- NEWS.txt | 15 +- README-Dev.md | 5 +- config.conf-sample-Dev | 8 +- gptsync/AutoGen.h | 2 +- include/Handle.h | 46 +++--- include/PeImage.h | 10 +- include/PeImage2.h | 14 +- include/RemovableMedia.h | 29 ++-- include/tiano_includes.h | 4 +- libeg/image.c | 4 +- libeg/screen.c | 3 +- 26 files changed, 345 insertions(+), 283 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index eedc3c09..ff7512b3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -77,8 +77,8 @@ body: label: Debug Log description: | Please run the RefindPlus 'DBG' efi and add debug logs. - Kindly attach logs and do not paste the contents directly. - You can attach logs by dragging/dropping on the field below. + Please attach log files and do not paste their contents. + Attach log files by dragging/dropping on the field below. placeholder: | Reports not requiring log files are typically best under Discussions. Reports without log files will be automatically closed in most cases. diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml index 3ef341f8..136e87b4 100644 --- a/.github/ISSUE_TEMPLATE/feature-request.yml +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -29,4 +29,9 @@ body: id: extra-info attributes: label: Additional Context - description: Add any additional context that may facilitate understanding and implementing the feature + description: | + Add any additional context that may facilitate understanding and implementing the feature + placeholder: | + You can attach files by dragging/dropping them on this field. + You can also add screenshots to aid understanding the problem. + Screenshots can be saved by pressing the F10 key in RefindPlus. diff --git a/.github/workflows/issues-lock.yml b/.github/workflows/issues-lock.yml index 3b89f79f..79b16793 100644 --- a/.github/workflows/issues-lock.yml +++ b/.github/workflows/issues-lock.yml @@ -20,7 +20,7 @@ concurrency: jobs: - # Lock Threads - https://github.com/dessant/lock-threads + # Lock Threads - https://github.com/dakanji/lock-threads lock: name: Lock Threads runs-on: ubuntu-20.04 @@ -29,7 +29,7 @@ jobs: steps: - name: Lock Resolved issues - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} issue-lock-reason: '' @@ -47,7 +47,7 @@ jobs: sleep 96s - name: Lock Invalid/Not-Planned Issues - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} issue-lock-reason: '' @@ -65,7 +65,7 @@ jobs: sleep 96s - name: Lock Misc Issues - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} issue-lock-reason: '' @@ -84,7 +84,7 @@ jobs: sleep 96s - name: Lock Incomplete/Abandoned Issues - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} issue-lock-reason: '' @@ -103,7 +103,7 @@ jobs: sleep 96s - name: Lock Unclear Issues - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} issue-lock-reason: '' @@ -121,7 +121,7 @@ jobs: sleep 96s - name: Lock Inactive Issues - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} issue-lock-reason: '' @@ -141,7 +141,7 @@ jobs: sleep 96s - name: Lock Acknowledged/Known Issues - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} issue-lock-reason: '' @@ -160,7 +160,7 @@ jobs: sleep 96s - name: Lock Declined Pull Requests - uses: dessant/lock-threads@v5 + uses: dakanji/lock-threads@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} pr-lock-reason: '' diff --git a/BUILDING.md b/BUILDING.md index e2e7ffe5..150aa3c8 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -27,7 +27,8 @@ $ xcode-select --install #### Background While Xcode provides a full development environment as well as a suite of different utilities, it does not provide all the tools required for TianoCore EDK II development as required to build RefindPlus on macOS natively. -This guide focuses on using HomeBrew to provide the required tools but equivalent steps can be taken in MacPorts and Fink which, unlike HomeBrew, maintain support for older versions of macOS. Just substitute in the equivalent commands as required. +This guide focuses on using HomeBrew to provide the required tools but equivalent steps can be taken in MacPorts and Fink; which may offer better support for older versions of macOS. +Substitute equivalent commands in as required. You will find installation instructions on the HomeBrew website (https://brew.sh) @@ -69,6 +70,9 @@ $ brew uninstall mtoc && brew install ocmtoc && brew upgrade ocmtoc **NB:** Only install one of `mtoc` or `ocmtoc` at a time. +`mtoc` and `ocmtoc` are only available as packages on HomeBrew. +Prebuilt versions of `ocmtoc` can be found here: https://github.com/acidanthera/ocmtoc/releases + # Prepare RefindPlus Environment #### Fork the RefindPlus Repository Navigate to `https://github.com/dakanji/RefindPlus` and fork the repository. diff --git a/BootMaster/driver_support.h b/BootMaster/driver_support.h index 35e072cf..ce3f8b73 100644 --- a/BootMaster/driver_support.h +++ b/BootMaster/driver_support.h @@ -44,11 +44,11 @@ // Seems to have been replaced by ParseHandleDatabaseByRelationshipWithType(), but the latter is not working for me. EFI_STATUS LibScanHandleDatabase ( - EFI_HANDLE DriverBindingHandle, OPTIONAL - UINT32 *DriverBindingHandleIndex, OPTIONAL - EFI_HANDLE ControllerHandle, OPTIONAL - UINT32 *ControllerHandleIndex, OPTIONAL - UINTN *HandleCount, + EFI_HANDLE DriverBindingHandle OPTIONAL, + UINT32 *DriverBindingHandleIndex OPTIONAL, + EFI_HANDLE ControllerHandle OPTIONAL, + UINT32 *ControllerHandleIndex OPTIONAL, + UINTN *HandleCount, EFI_HANDLE **HandleBuffer, UINT32 **HandleType ); diff --git a/BootMaster/global.h b/BootMaster/global.h index 6e11ef73..7ac1d04f 100644 --- a/BootMaster/global.h +++ b/BootMaster/global.h @@ -186,6 +186,7 @@ #endif #define DEFAULT_ICONS_DIR L"icons" +#define HIDDEN_TAG_DELIMITER L" @@ " // NVRAM ACCESS FLAGS #define ACCESS_FLAGS_FULL EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS; @@ -604,9 +605,10 @@ extern BOOLEAN DevicePresence; extern EFI_FILE_PROTOCOL *SelfDir; extern EFI_FILE_PROTOCOL *SelfRootDir; +extern EFI_GUID GuidESP; extern EFI_GUID GlobalGuid; -extern EFI_GUID RefindPlusGuid; extern EFI_GUID AppleBootGuid; +extern EFI_GUID RefindPlusGuid; extern EFI_GUID gEfiLegacyBootProtocolGuid; extern EFI_HANDLE SelfImageHandle; diff --git a/BootMaster/install.c b/BootMaster/install.c index 8db8d622..af02fe37 100644 --- a/BootMaster/install.c +++ b/BootMaster/install.c @@ -69,7 +69,7 @@ ESP_LIST * FindAllESPs (VOID) { ESP_LIST *AllESPs; ESP_LIST *NewESP; UINTN VolumeIndex; - EFI_GUID ESPGuid = ESP_GUID_VALUE; + #if REFIT_DEBUG > 0 ALT_LOG(1, LOG_LINE_NORMAL, L"Search for ESPs"); @@ -78,7 +78,7 @@ ESP_LIST * FindAllESPs (VOID) { AllESPs = NULL; for (VolumeIndex = 0; VolumeIndex < VolumesCount; VolumeIndex++) { if (Volumes[VolumeIndex]->DiskKind == DISK_KIND_INTERNAL && - GuidsAreEqual (&(Volumes[VolumeIndex]->PartTypeGuid), &ESPGuid) && + GuidsAreEqual (&(Volumes[VolumeIndex]->PartTypeGuid), &GuidESP) && !GuidsAreEqual (&(Volumes[VolumeIndex]->PartGuid), &SelfVolume->PartGuid) ) { NewESP = AllocateZeroPool (sizeof (ESP_LIST)); diff --git a/BootMaster/launch_efi.c b/BootMaster/launch_efi.c index ee4be99c..87883b18 100644 --- a/BootMaster/launch_efi.c +++ b/BootMaster/launch_efi.c @@ -300,7 +300,7 @@ EFI_STATUS ApfsRecoveryBoot ( Status = ConstructBootEntry ( Entry->Volume->DeviceHandle, - Basename (Entry->EfiLoaderPath), + Basename (DevicePathToStr (Entry->EfiLoaderPath)), L"Mac Recovery", (CHAR8**) &Entry->EfiLoaderPath, &Size @@ -517,7 +517,7 @@ BOOLEAN IsValidLoader ( break; } - // Allow plain binaries on Apple Firmware + // Allow plain binaries on Apple firmware IsValid = AppleBinaryPlain = AppleFirmware; if (IsValid) { //LoaderType = LOADER_TYPE_EFI; @@ -848,7 +848,7 @@ EFI_STATUS StartEFIImage ( Status = EfivarSetRaw ( &SystemdGuid, L"LoaderDevicePartUUID", - EspGUID, StrLen (EspGUID) * 2 + 2, TRUE + EspGUID, StrLen (EspGUID) * 2 + 2, FALSE ); #if REFIT_DEBUG > 0 if (EFI_ERROR(Status)) { @@ -1137,7 +1137,7 @@ VOID RebootIntoLoader ( return; } - StoreLoaderName(Entry->me.Title); + StoreLoaderName (Entry->me.Title); #if REFIT_DEBUG > 0 OUT_TAG(); diff --git a/BootMaster/lib.c b/BootMaster/lib.c index 26574341..85b21556 100644 --- a/BootMaster/lib.c +++ b/BootMaster/lib.c @@ -622,7 +622,7 @@ EFI_STATUS FindVarsDir (VOID) { #if REFIT_DEBUG > 0 ALT_LOG(1, LOG_BLANK_LINE_SEP, L"X"); ALT_LOG(1, LOG_LINE_NORMAL, - L"Locate/Create Emulated Variable Storage for RefindPlus-Specific Items ... In Installation Folder:- '%r'", + L"Locate/Create Variable Storage (Emulated) for RefindPlus-Specific Items ... In Installation Folder:- '%r'", Status ); #endif @@ -640,7 +640,7 @@ EFI_STATUS FindVarsDir (VOID) { #if REFIT_DEBUG > 0 ALT_LOG(1, LOG_LINE_NORMAL, - L"Locate/Create Emulated Variable Storage for RefindPlus-Specific Items ... In First Available ESP:- '%r'", + L"Locate/Create Variable Storage (Emulated) for RefindPlus-Specific Items ... In First Available ESP:- '%r'", Status ); @@ -1949,7 +1949,7 @@ CHAR16 * GetVolumeName ( // Try to use fs type and size as name FileSystemInfoPtr = (Volume->RootDir != NULL) ? LibFileSystemInfo (Volume->RootDir) : NULL; - if (FileSystemInfoPtr) { + if (FileSystemInfoPtr != NULL) { SISize = SizeInIEEEUnits (FileSystemInfoPtr->VolumeSize); FoundName = PoolPrint (L"%s %s Volume", SISize, TypeName); MY_FREE_POOL(SISize); @@ -2766,13 +2766,6 @@ VOID ScanVolumes (VOID) { return; } - #if REFIT_DEBUG > 0 - ALT_LOG(1, LOG_LINE_NORMAL, - L"Found Handles for %d Volumes", - HandleCount - ); - #endif - UuidList = AllocateZeroPool (sizeof (EFI_GUID) * HandleCount); if (UuidList == NULL) { #if REFIT_DEBUG > 0 @@ -2806,13 +2799,7 @@ VOID ScanVolumes (VOID) { #endif for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) { - #if REFIT_DEBUG > 0 - /* Exception for LOG_LINE_THIN_SEP */ - ALT_LOG(1, LOG_LINE_THIN_SEP, L"NEXT VOLUME"); - #endif - Volume = AllocateZeroPool (sizeof (REFIT_VOLUME)); - Volume->VolRole = APFS_VOLUME_ROLE_UNKNOWN; if (Volume == NULL) { MY_FREE_POOL(UuidList); @@ -2834,6 +2821,7 @@ VOID ScanVolumes (VOID) { return; } + Volume->VolRole = APFS_VOLUME_ROLE_UNKNOWN; Volume->DeviceHandle = Handles[HandleIndex]; AddPartitionTable (Volume); ScanVolume (Volume); @@ -3739,6 +3727,7 @@ BOOLEAN RefitMetaiMatch ( #if defined (__MAKEWITH_GNUEFI) return MetaiMatch (String, Pattern); #elif defined(__MAKEWITH_TIANO) + EFI_STATUS Status; static EFI_UNICODE_COLLATION_PROTOCOL *UnicodeCollationEng = NULL; if (UnicodeCollationEng == NULL) { @@ -3748,9 +3737,9 @@ BOOLEAN RefitMetaiMatch ( return UnicodeCollationEng->MetaiMatch (UnicodeCollationEng, String, Pattern); } - // DA-TAG: Fallback on original inadequate upstream implementation + // DA-TAG: Fallback on original upstream implementation // Should not get here when support is present - EFI_STATUS Status = REFIT_CALL_3_WRAPPER( + Status = REFIT_CALL_3_WRAPPER( gBS->LocateProtocol, &gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID **) &UnicodeCollationEng ); @@ -3760,9 +3749,9 @@ BOOLEAN RefitMetaiMatch ( NULL, (VOID **) &UnicodeCollationEng ); } +#endif return FALSE; -#endif } // static BOOLEAN RefitMetaiMatch() BOOLEAN DirIterNext ( @@ -4241,21 +4230,26 @@ BOOLEAN VolumeMatchesDescription ( IN REFIT_VOLUME *Volume, IN CHAR16 *Description ) { - EFI_GUID TargetVolGuid = NULL_GUID_VALUE; + CHAR16 *FilteredDescription; + EFI_GUID TargetVolGuid = NULL_GUID_VALUE; if (Volume == NULL || Description == NULL) { return FALSE; } - if (!IsGuid (Description)) { + FilteredDescription = GetSubStrAfter (HIDDEN_TAG_DELIMITER, Description); + + if (!IsGuid (FilteredDescription)) { return ( - MyStriCmp (Description, Volume->VolName) || - MyStriCmp (Description, Volume->FsName) || - MyStriCmp (Description, Volume->PartName) + MyStriCmp (FilteredDescription, Volume->VolName) || + MyStriCmp (FilteredDescription, Volume->FsName) || + MyStriCmp (FilteredDescription, Volume->PartName) ); } - TargetVolGuid = StringAsGuid (Description); + TargetVolGuid = StringAsGuid (FilteredDescription); + FilteredDescription = NULL; + return GuidsAreEqual (&TargetVolGuid, &(Volume->PartGuid)); } // BOOLEAN VolumeMatchesDescription() @@ -4271,6 +4265,7 @@ BOOLEAN FilenameIn ( IN CHAR16 *List ) { UINTN i; + CHAR16 *AnElement; // Do *NOT* Free CHAR16 *OneElement; CHAR16 *TargetPath; CHAR16 *TargetVolName; @@ -4289,14 +4284,26 @@ BOOLEAN FilenameIn ( !Found && (OneElement = FindCommaDelimited (List, i++)) != NULL ) { - Found = TRUE; - SplitPathName (OneElement, &TargetVolName, &TargetPath, &TargetFilename); - if ((TargetVolName != NULL && !VolumeMatchesDescription (Volume, TargetVolName)) || - (TargetPath != NULL && !MyStriCmp (TargetPath, Directory)) || - (TargetFilename != NULL && !MyStriCmp (TargetFilename, Filename)) + AnElement = GetSubStrAfter (HIDDEN_TAG_DELIMITER, OneElement); + SplitPathName (AnElement, &TargetVolName, &TargetPath, &TargetFilename); + + if (TargetPath == NULL && + TargetVolName == NULL && + TargetFilename == NULL + ) { + return FALSE; + } + + if (MyStriCmp (TargetPath, Directory) && + MyStriCmp (TargetFilename, Filename) && + VolumeMatchesDescription (Volume, TargetVolName) ) { + Found = TRUE; + } + else { Found = FALSE; } + MY_FREE_POOL(OneElement); MY_FREE_POOL(TargetPath); MY_FREE_POOL(TargetVolName); diff --git a/BootMaster/main.c b/BootMaster/main.c index c7415296..157bbadd 100644 --- a/BootMaster/main.c +++ b/BootMaster/main.c @@ -592,7 +592,7 @@ EFI_STATUS EFIAPI gRTSetVariableEx ( BlockUEFI = FALSE; } else { - // DA-TAG: Always block UEFI Win stuff on Apple Firmware + // DA-TAG: Always block UEFI Win stuff on Apple firmware // That is, without considering storage volatility BlockUEFI = ( AppleFirmware && ( @@ -854,7 +854,7 @@ EFI_STATUS FilterCSR (VOID) { #if REFIT_DEBUG > 0 ALT_LOG(1, LOG_THREE_STAR_MID, L"Normalise CSR ... %r", Status); - LOG_MSG("%s * Normalise CSR ... %r", OffsetNext, Status); + LOG_MSG("%s * Status:- %r' ... Normalise CSR", OffsetNext, Status); #endif return Status; @@ -2036,6 +2036,13 @@ VOID RescanAll ( if (TmpLevel) { GlobalConfig.LogLevel = 0; } + + // Force LogLevel 0 + ThislogLevel = GlobalConfig.LogLevel; + TmpLevel = (ThislogLevel > 0) ? TRUE : FALSE; + if (TmpLevel) { + GlobalConfig.LogLevel = 0; + } #endif // Default UI Scale @@ -2068,11 +2075,17 @@ VOID RescanAll ( // Read Config #if REFIT_DEBUG > 0 MY_MUTELOGGER_SET; + + // Reset LogLevel + if (TmpLevel) { + GlobalConfig.LogLevel = ThislogLevel; + } #endif + ReadConfig (GlobalConfig.ConfigFilename); #if REFIT_DEBUG > 0 - // Force LogLevel 0 + // Re-Force LogLevel 0 ThislogLevel = GlobalConfig.LogLevel; TmpLevel = (ThislogLevel > 0) ? TRUE : FALSE; if (TmpLevel) { @@ -2264,7 +2277,7 @@ VOID SetConfigFilename ( } else { MY_FREE_POOL(FileName); - + MsgStr = L"** WARN: Specified Config File *NOT* Found"; #if REFIT_DEBUG > 0 LOG_MSG("%s", MsgStr); @@ -2530,7 +2543,7 @@ VOID LogBasicInfo (VOID) { else { if (AppleFirmware) { // DA-TAG: Investigate This - // Do not log output on Apple Firmware + // Do not log output on Apple firmware // Currently gives inaccurate output LOG_MSG("%s** Redacted Invalid Output from QVI **", OffsetNext); } @@ -2654,6 +2667,7 @@ EFI_STATUS EFIAPI efi_main ( BOOLEAN RunOurTool; BOOLEAN MokProtocol; BOOLEAN FoundVentoy; + BOOLEAN ForceContinue; BOOLEAN MainLoopRunning; BOOLEAN FoundInstallerMac; EG_PIXEL BGColor = COLOR_LIGHTBLUE; @@ -2666,7 +2680,6 @@ EFI_STATUS EFIAPI efi_main ( #if REFIT_DEBUG > 0 CHAR16 *SelfGUID; - BOOLEAN ForceContinue; #if REFIT_DEBUG > 1 UINTN ThislogLevel; @@ -3151,7 +3164,11 @@ EFI_STATUS EFIAPI efi_main ( // Further bootstrap (now with config available) SetupScreen(); + ForceContinue = (GlobalConfig.ContinueOnWarning) ? TRUE : FALSE; + GlobalConfig.ContinueOnWarning = TRUE; WarnIfLegacyProblems(); + GlobalConfig.ContinueOnWarning = ForceContinue; + ForceContinue = FALSE; #if REFIT_DEBUG > 0 /* Disable Forced Native Logging */ @@ -3247,9 +3264,6 @@ EFI_STATUS EFIAPI efi_main ( // Show Inconsistent UEFI 2.x Implementation Warning #if REFIT_DEBUG > 0 - // Prime ForceContinue - ForceContinue = FALSE; - if (WarnMissingQVInfo) { SwitchToText (FALSE); @@ -4126,6 +4140,7 @@ EFI_STATUS EFIAPI efi_main ( else { i = 0; while ( + !FoundVentoy && GlobalConfig.HandleVentoy && (VentoyName = FindCommaDelimited (VENTOY_NAMES, i++)) != NULL ) { @@ -4133,10 +4148,6 @@ EFI_STATUS EFIAPI efi_main ( FoundVentoy = TRUE; } MY_FREE_POOL(VentoyName); - - if (FoundVentoy) { - break; - } } // while #if REFIT_DEBUG > 0 diff --git a/BootMaster/menu.c b/BootMaster/menu.c index 7f394eec..b8349fd8 100644 --- a/BootMaster/menu.c +++ b/BootMaster/menu.c @@ -1068,15 +1068,15 @@ UINTN DrawMenuScreen ( TimeSinceKeystroke = 0; } else if (!EFI_ERROR(PointerStatus)) { + PointerActive = TRUE; + TimeSinceKeystroke = 0; + if (StyleFunc != MainMenuStyle && pdGetState().Press) { // Prevent user from getting stuck on submenus // Only the 'About' screen is currently reachable without a keyboard MenuExit = MENU_EXIT_ENTER; break; } - - PointerActive = TRUE; - TimeSinceKeystroke = 0; } else { if (HaveTimeout && TimeoutCountdown == 0) { @@ -3259,68 +3259,82 @@ BOOLEAN HideEfiTag ( AddMenuInfoLine (HideEfiMenu, L"Hide EFI Entry Below?", FALSE); AddMenuInfoLine (HideEfiMenu, PoolPrint (L"%s", TempPath), TRUE); - TagHidden = GetMenuEntryYesNo (&HideEfiMenu); - if (!TagHidden) { - FreeMenuScreen (&HideEfiMenu); + do { + TagHidden = GetMenuEntryYesNo (&HideEfiMenu); + if (!TagHidden) { + FreeMenuScreen (&HideEfiMenu); - // Early Return - return FALSE; - } + break; + } - DefaultEntry = 9999; // Use the Max Index - Style = (AllowGraphicsMode) ? GraphicsMenuStyle : TextMenuStyle; - MenuExit = DrawMenuScreen ( - HideEfiMenu, Style, - &DefaultEntry, &ChosenOption - ); + DefaultEntry = 9999; // Use the Max Index + Style = (AllowGraphicsMode) ? GraphicsMenuStyle : TextMenuStyle; + MenuExit = DrawMenuScreen ( + HideEfiMenu, Style, + &DefaultEntry, &ChosenOption + ); - #if REFIT_DEBUG > 0 - ALT_LOG(1, LOG_LINE_NORMAL, - L"Returned '%d' (%s) in 'HideEfiTag' from DrawMenuScreen Call on '%s'", - MenuExit, MenuExitInfo (MenuExit), ChosenOption->Title - ); - #endif + #if REFIT_DEBUG > 0 + ALT_LOG(1, LOG_LINE_NORMAL, + L"Returned '%d' (%s) in 'HideEfiTag' from DrawMenuScreen Call on '%s'", + MenuExit, MenuExitInfo (MenuExit), ChosenOption->Title + ); + #endif - if (MenuExit != MENU_EXIT_ENTER || - MyStriCmp (ChosenOption->Title, L"No") - ) { - TagHidden = FALSE; - } - else { - TagHidden = TRUE; + if (MenuExit != MENU_EXIT_ENTER || + MyStriCmp (ChosenOption->Title, L"No") + ) { + TagHidden = FALSE; + } + else { + TagHidden = TRUE; - do { - if (GotVolName && MyLoadPath) { - FullPath = TempPath; - break; - } + //do { + //if (GotVolName && MyLoadPath) { + // FullPath = TempPath; + // break; + //} - TestVolume = NULL; - GuidStr = GuidAsString (&Loader->Volume->PartGuid); - - if (FindVolume (&TestVolume, GuidStr) && - TestVolume->RootDir != NULL - ) { - FullPath = PoolPrint (L"%s:", GuidStr); - MergeStrings ( - &FullPath, - Loader->LoaderPath, - (Loader->LoaderPath[0] == L'\\' ? L'\0' : L'\\') - ); - } - else if (GotVolName) { - FullPath = PoolPrint (L"%s:", Loader->Volume->VolName); - } - else { - FullPath = StrDuplicate (L":"); - } + TestVolume = NULL; + GuidStr = GuidAsString (&Loader->Volume->PartGuid); + FindVolume (&TestVolume, GuidStr); - MY_FREE_POOL(GuidStr); - } while (0); // This 'loop' only runs once + if (TestVolume != NULL && TestVolume->RootDir != NULL) { + if (!GotVolName) { + FullPath = PoolPrint (L"%s:", GuidStr); + } + else { + FullPath = PoolPrint ( + L"%s%s%s:", + Loader->Volume->VolName, + HIDDEN_TAG_DELIMITER, GuidStr + ); + } - AddToHiddenTags (VarName, FullPath); - MY_FREE_POOL(FullPath); - } + if (MyLoadPath) { + MergeStrings ( + &FullPath, + Loader->LoaderPath, + (Loader->LoaderPath[0] == L'\\' ? L'\0' : L'\\') + ); + } + } + else if (GotVolName) { + FullPath = PoolPrint (L"%s:", Loader->Volume->VolName); + } + else { + FullPath = NULL; + } + + MY_FREE_POOL(GuidStr); + //} while (0); // This 'loop' only runs once + + if (FullPath != NULL) { + AddToHiddenTags (VarName, FullPath); + } + MY_FREE_POOL(FullPath); + } + } while (0); // This 'loop' only runs once MY_FREE_POOL(TempPath); diff --git a/BootMaster/scan.c b/BootMaster/scan.c index 30fb536f..6a5d91e7 100644 --- a/BootMaster/scan.c +++ b/BootMaster/scan.c @@ -861,7 +861,7 @@ VOID SetLoaderDefaults ( CHAR16 *OSIconName; CHAR16 *TmpIconName; CHAR16 *ThisIconName; - CHAR16 *TargetName; + CHAR16 *TargetName; // Do *NOT* Free CHAR16 *DisplayName; CHAR16 *NoExtension; CHAR16 *VentoyName; @@ -1084,8 +1084,6 @@ VOID SetLoaderDefaults ( if (Volume->FsName != NULL && Volume->FsName[0] != L'\0' ) { - MergeFsName = TRUE; - BREAD_CRUMB(L"%s: 3a 1b 3b 4a 1", FuncTag); if (GlobalConfig.SyncAPFS && FindSubStr (Volume->FsName, L"PreBoot") @@ -1093,6 +1091,10 @@ VOID SetLoaderDefaults ( BREAD_CRUMB(L"%s: 3a 1b 3b 4a 1a 1", FuncTag); MergeFsName = FALSE; } + else { + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 1b 1", FuncTag); + MergeFsName = TRUE; + } BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2", FuncTag); if (MergeFsName) { @@ -1101,12 +1103,12 @@ VOID SetLoaderDefaults ( BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 1", FuncTag); i = 0; while ( - !FoundVentoy && + !FoundVentoy && GlobalConfig.HandleVentoy && (VentoyName = FindCommaDelimited (VENTOY_NAMES, i++)) != NULL ) { BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 1a 1 - WHILE LOOP:- START ... Check for Ventoy Partition", FuncTag); - if (MyStrBegins (VentoyName, TargetName)) { + if (MyStrBegins (VentoyName, Volume->FsName)) { BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 1a 1a 1 - Found ... Set Ventoy Icon", FuncTag); FoundVentoy = TRUE; TargetName = L"ventoy"; @@ -1120,23 +1122,25 @@ VOID SetLoaderDefaults ( BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 1", FuncTag); if (GlobalConfig.HelpIcon && ( - MyStriCmp (Volume->FsName, L"EFI") || - MyStriCmp (Volume->FsName, L"ESP") || - MyStriCmp (Volume->FsName, L"EFI System Partition") + ( + GuidsAreEqual (&(Volume->PartTypeGuid), &GuidESP) + ) || ( + MyStriCmp (Volume->FsName, L"EFI") || + MyStriCmp (Volume->FsName, L"ESP") || + MyStriCmp (Volume->FsName, L"EFI System Partition") + ) ) ) { BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 1a 1", FuncTag); GotUEFI = TRUE; } - else { - BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 1b 1", FuncTag); - if (Volume->FsName != NULL) { - BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 1b 1a 1", FuncTag); - TargetName = Volume->FsName; - } - BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 1b 2", FuncTag); - } + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 2", FuncTag); + if (Volume->FsName != NULL) { + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 2a 1", FuncTag); + TargetName = Volume->FsName; + } + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 2a 3", FuncTag); } // if TargetName == NULL BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2a 1a 3", FuncTag); @@ -1173,7 +1177,8 @@ VOID SetLoaderDefaults ( } else { BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1", FuncTag); - if (Volume->VolName != NULL && + if (!FoundVentoy && + Volume->VolName != NULL && Volume->VolName[0] != L'\0' ) { BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 1", FuncTag); @@ -1196,6 +1201,7 @@ VOID SetLoaderDefaults ( BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 2", FuncTag); i = 0; while ( + !FoundVentoy && GlobalConfig.HandleVentoy && (VentoyName = FindCommaDelimited (VENTOY_NAMES, i++)) != NULL ) { @@ -1207,13 +1213,25 @@ VOID SetLoaderDefaults ( } MY_FREE_POOL(VentoyName); BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 2a 2 - WHILE LOOP:- END", FuncTag); - - if (FoundVentoy) { - break; - } } // while BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 3", FuncTag); + if (GlobalConfig.HelpIcon && + ( + ( + GuidsAreEqual (&(Volume->PartTypeGuid), &GuidESP) + ) || ( + MyStriCmp (TargetName, L"EFI") || + MyStriCmp (TargetName, L"ESP") || + MyStriCmp (TargetName, L"EFI System Partition") + ) + ) + ) { + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 3a 1", FuncTag); + GotUEFI = TRUE; + } + + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 4", FuncTag); #if REFIT_DEBUG > 0 if (TargetName != NULL) { ALT_LOG(1, LOG_LINE_NORMAL, @@ -1223,7 +1241,7 @@ VOID SetLoaderDefaults ( } #endif - BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 4", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 5", FuncTag); if (FoundVentoy) { BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 4a 1", FuncTag); MY_FREE_POOL(OSIconName); @@ -1241,7 +1259,7 @@ VOID SetLoaderDefaults ( BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 4b 3", FuncTag); } - BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 5", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 2a 6", FuncTag); } // if Entry->me.Image == NULL BREAD_CRUMB(L"%s: 3a 1b 3b 4a 2b 1a 3", FuncTag); MY_FREE_POOL(DisplayName); @@ -1283,25 +1301,29 @@ VOID SetLoaderDefaults ( BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 1", FuncTag); if (GlobalConfig.HelpIcon && ( - MyStriCmp (Volume->PartName, L"EFI") || - MyStriCmp (Volume->PartName, L"ESP") || - MyStriCmp (Volume->PartName, L"EFI System Partition") + ( + GuidsAreEqual (&(Volume->PartTypeGuid), &GuidESP) + ) || ( + MyStriCmp (Volume->PartName, L"EFI") || + MyStriCmp (Volume->PartName, L"ESP") || + MyStriCmp (Volume->PartName, L"EFI System Partition") + ) ) ) { BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 1a 1", FuncTag); GotUEFI = TRUE; } - else if ( - !GlobalConfig.HelpIcon || - ( - Volume->PartName != NULL && - !MyStrStr (Volume->PartName, L"Untitled") - ) + + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2", FuncTag); + if (!FoundVentoy && + Volume->PartName != NULL && + !MyStrStr (Volume->PartName, L"Untitled") ) { - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 1b 1", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2a 1", FuncTag); TargetName = Volume->PartName; } + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 3", FuncTag); #if REFIT_DEBUG > 0 if (TargetName != NULL) { ALT_LOG(1, LOG_LINE_NORMAL, @@ -1311,25 +1333,25 @@ VOID SetLoaderDefaults ( } #endif - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 4", FuncTag); if (FoundVentoy) { - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2a 1", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 4a 1", FuncTag); MY_FREE_POOL(OSIconName); OSIconName = StrDuplicate (TargetName); } else { - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2b 1", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 4b 1", FuncTag); if (GlobalConfig.HelpIcon) { - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2b 1a 1", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 4b 1a 1", FuncTag); MergeUniqueItems (&OSIconName, TargetName, L','); } - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2b 2", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 4b 2", FuncTag); MergeUniqueWords (&OSIconName, TargetName, L','); - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 2b 3", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 4b 3", FuncTag); } - BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 3", FuncTag); + BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 2a 5", FuncTag); } BREAD_CRUMB(L"%s: 3a 1b 3b 5a 1a 3", FuncTag); } @@ -1713,13 +1735,13 @@ LOADER_ENTRY * AddEfiLoaderEntry ( if (Entry == NULL) { return NULL; } - Entry->DiscoveryType = DISCOVERY_TYPE_AUTO; FullTitle = (LoaderTitle != NULL) ? PoolPrint (L"Reboot to %s", LoaderTitle) : NULL; Entry->me.Row = Row; Entry->me.Tag = TAG_FIRMWARE_LOADER; + Entry->DiscoveryType = DISCOVERY_TYPE_AUTO; Entry->me.Title = StrDuplicate ((FullTitle != NULL) ? FullTitle : L"Instance: Unknown"); Entry->Title = StrDuplicate ((LoaderTitle != NULL) ? LoaderTitle : L"Instance: Unknown"); // without "Reboot to" Entry->EfiLoaderPath = DuplicateDevicePath (EfiLoaderPath); @@ -1789,8 +1811,6 @@ LOADER_ENTRY * AddLoaderEntry ( return NULL; } - Entry->DiscoveryType = DISCOVERY_TYPE_AUTO; - CleanUpPathNameSlashes (LoaderPath); if (LoaderTitle != NULL) { @@ -1895,13 +1915,15 @@ LOADER_ENTRY * AddLoaderEntry ( L"Load %s", (LoaderTitle != NULL) ? LoaderTitle : LoaderPath ); + Entry->me.Row = 0; Entry->me.BadgeImage = egCopyImage (Volume->VolBadgeImage); + Entry->DiscoveryType = DISCOVERY_TYPE_AUTO; Entry->LoaderPath = (LoaderPath != NULL && (LoaderPath[0] != L'\\')) ? StrDuplicate (L"\\") : NULL; - MergeUniqueStrings (&(Entry->LoaderPath), LoaderPath, 0); + Entry->Volume = Volume; SetLoaderDefaults (Entry, LoaderPath, Volume); GenerateSubScreen (Entry, Volume, SubScreenReturn); @@ -1962,11 +1984,11 @@ INTN TimeComp ( + ((INT64) (Time2->Year - 1998) * 32140800); if (Time1InSeconds < Time2InSeconds) { - return (-1); + return -1; } if (Time1InSeconds > Time2InSeconds) { - return (1); + return 1; } return 0; @@ -2007,7 +2029,7 @@ LOADER_LIST * AddLoaderListEntry ( ) < 0 ) ) { - PrevEntry = CurrentEntry; + PrevEntry = CurrentEntry; CurrentEntry = CurrentEntry->NextEntry; } // while @@ -2052,16 +2074,16 @@ CHAR16 * SetVolKind ( if (0); - else if (VolumeFSType == FS_TYPE_FAT32 ) RetVal = L"" ; - else if (VolumeFSType == FS_TYPE_FAT16 ) RetVal = L"" ; - else if (VolumeFSType == FS_TYPE_FAT12 ) RetVal = L"" ; - else if (VolumeFSType == FS_TYPE_EXFAT ) RetVal = L"" ; - else if (MyStriCmp (VolumeName, L"EFI" )) RetVal = L"" ; - else if (MyStriCmp (VolumeName, L"ESP" )) RetVal = L"" ; - else if (MyStrStr (VolumeName, L"Volume" )) RetVal = L"" ; - else if (MyStrStr (VolumeName, L"Partition")) RetVal = L"" ; - else if (MyStrStr (InstanceName, L"Instance:")) RetVal = L"Volume:- "; - else RetVal = L"" ; + else if (VolumeFSType == FS_TYPE_FAT32 ) RetVal = L"" ; + else if (VolumeFSType == FS_TYPE_FAT16 ) RetVal = L"" ; + else if (VolumeFSType == FS_TYPE_FAT12 ) RetVal = L"" ; + else if (VolumeFSType == FS_TYPE_EXFAT ) RetVal = L"" ; + else if (MyStriCmp (VolumeName, L"EFI" )) RetVal = L"" ; + else if (MyStriCmp (VolumeName, L"ESP" )) RetVal = L"" ; + else if (MyStrStr (VolumeName, L"Volume" )) RetVal = L"" ; + else if (MyStrStr (VolumeName, L"Partition")) RetVal = L"" ; + else if (MyStrStr (InstanceName, L"Instance:")) RetVal = L"Volume:- "; + else RetVal = L"" ; return RetVal; } // CHAR16 * SetVolKind() @@ -2073,9 +2095,9 @@ CHAR16 * SetVolJoin ( if (0); - else if (MyStrStr (InstanceName, L"Manual Stanza:" )) RetVal = L"" ; - else if (MyStriCmp (InstanceName, L"Legacy Bootcode")) RetVal = L" for "; - else RetVal = L" on " ; + else if (MyStrStr (InstanceName, L"Manual Stanza:" )) RetVal = L"" ; + else if (MyStriCmp (InstanceName, L"Legacy Bootcode")) RetVal = L" for " ; + else RetVal = L" from "; return RetVal; } // CHAR16 * SetVolJoin() @@ -2193,6 +2215,7 @@ BOOLEAN ShouldScan ( ) { i = 0; while ( + !FoundVentoy && (VentoyName = FindCommaDelimited (VENTOY_NAMES, i++)) != NULL ) { if (MyStrBegins (VentoyName, Volume->VolName) || @@ -2202,10 +2225,6 @@ BOOLEAN ShouldScan ( FoundVentoy = TRUE; } MY_FREE_POOL(VentoyName); - - if (FoundVentoy) { - break; - } } // while } @@ -2760,9 +2779,9 @@ BOOLEAN ScanMacOsLoader ( CHAR16 *PathName; CHAR16 *FileName; BOOLEAN AddThisEntry; - BOOLEAN ScanFallbackLoader; + BOOLEAN CheckFallback; - ScanFallbackLoader = TRUE; + CheckFallback = TRUE; VolName = PathName = FileName = NULL; SplitPathName (FullFileName, &VolName, &PathName, &FileName); @@ -2802,7 +2821,7 @@ BOOLEAN ScanMacOsLoader ( } if (DuplicatesFallback (Volume, FullFileName)) { - ScanFallbackLoader = FALSE; + CheckFallback = FALSE; } } @@ -2810,7 +2829,7 @@ BOOLEAN ScanMacOsLoader ( MY_FREE_POOL(PathName); MY_FREE_POOL(FileName); - return ScanFallbackLoader; + return CheckFallback; } // static BOOLEAN ScanMacOsLoader() static @@ -2847,6 +2866,7 @@ VOID ScanEfiFiles ( i = 0; FoundVentoy = FALSE; while ( + !FoundVentoy && GlobalConfig.HandleVentoy && (VentoyName = FindCommaDelimited (VENTOY_NAMES, i++)) != NULL ) { @@ -2857,10 +2877,6 @@ VOID ScanEfiFiles ( FoundVentoy = TRUE; } MY_FREE_POOL(VentoyName); - - if (FoundVentoy) { - break; - } } // while // Skip Volumes in 'DontScanVolumes' List @@ -3385,11 +3401,11 @@ VOID ScanFirmwareDefined ( IN CHAR16 *MatchThis, IN EG_IMAGE *Icon ) { + EFI_STATUS Status; UINTN i; CHAR16 *OneElement; CHAR16 *DontScanFirmware; BOOLEAN ScanIt; - BOOLEAN FoundIt; BOOT_ENTRY_LIST *ThisEntry; BOOT_ENTRY_LIST *BootEntries; @@ -3459,8 +3475,8 @@ VOID ScanFirmwareDefined ( #endif BootEntries = FindBootOrderEntries(); - ThisEntry = BootEntries; - FoundIt = FALSE; + ThisEntry = BootEntries; + Status = EFI_NOT_FOUND; while (ThisEntry != NULL) { ScanIt = FALSE; @@ -3496,7 +3512,7 @@ VOID ScanFirmwareDefined ( ); #endif - FoundIt = TRUE; + Status = EFI_SUCCESS; AddEfiLoaderEntry ( ThisEntry->BootEntry.DevPath, ThisEntry->BootEntry.Label, @@ -3513,8 +3529,7 @@ VOID ScanFirmwareDefined ( #if REFIT_DEBUG > 0 ALT_LOG(1, LOG_THREE_STAR_END, - L"Evaluate Firmware Defined Options ... Relevant Options:- '%s'", - (FoundIt) ? L"Added" : L"None" + L"Evaluate and Add Firmware Defined Options:- '%r'", Status ); #endif @@ -3666,7 +3681,7 @@ VOID ScanForBootloaders (VOID) { if (HiddenTags && StrLen (HiddenTags) > 0) { #if REFIT_DEBUG > 0 ALT_LOG(1, LOG_LINE_NORMAL, - L"Merging HiddenTags into 'Dont Scan Files':- '%s'", + L"Merge HiddenTags into 'Dont Scan Files':- '%s'", HiddenTags ); ALT_LOG(1, LOG_BLANK_LINE_SEP, L"X"); @@ -3680,7 +3695,7 @@ VOID ScanForBootloaders (VOID) { if (HiddenLegacy && StrLen (HiddenLegacy) > 0) { #if REFIT_DEBUG > 0 ALT_LOG(1, LOG_LINE_NORMAL, - L"Merging HiddenLegacy into 'Dont Scan Volumes':- '%s'", + L"Merge HiddenLegacy into 'Dont Scan Volumes':- '%s'", HiddenLegacy ); ALT_LOG(1, LOG_BLANK_LINE_SEP, L"X"); diff --git a/Library/MemLogLib/GenericIch.h b/Library/MemLogLib/GenericIch.h index 697ea049..07987340 100644 --- a/Library/MemLogLib/GenericIch.h +++ b/Library/MemLogLib/GenericIch.h @@ -35,16 +35,16 @@ Definitions beginning with "V_" are meaningful values of bits within the registe /// IchAcpiCntr Control for the ICH's ACPI Counter. ///@{ #define R_ICH_LPC_ACPI_BASE 0x40 -#define B_ICH_LPC_ACPI_BASE_BAR 0x0000FF80 +#define B_ICH_LPC_ACPI_BASE_BAR 0x0000FF80 #define R_ICH_LPC_ACPI_CNT 0x44 -#define B_ICH_LPC_ACPI_CNT_ACPI_EN 0x80 +#define B_ICH_LPC_ACPI_CNT_ACPI_EN 0x80 ///@} /// IchAcpiTimer The ICH's ACPI Timer. ///@{ #define R_ACPI_PM1_TMR 0x08 -#define V_ACPI_TMR_FREQUENCY 3579545 -#define V_ACPI_PM1_TMR_MAX_VAL 0x1000000 ///< The timer is 24 bit overflow. +#define V_ACPI_TMR_FREQUENCY 3579545 +#define V_ACPI_PM1_TMR_MAX_VAL 0x1000000 ///< The timer is 24 bit overflow. ///@} /// Macro to generate the PCI address of any given ICH Register. diff --git a/Library/MemLogLib/MemLogLib.h b/Library/MemLogLib/MemLogLib.h index 0adb3588..cd282766 100644 --- a/Library/MemLogLib/MemLogLib.h +++ b/Library/MemLogLib/MemLogLib.h @@ -35,10 +35,10 @@ typedef VOID (EFIAPI *MEM_LOG_CALLBACK) (IN INTN DebugMode, IN CHAR8 *LastMessag **/ VOID EFIAPI MemLogVA ( - IN const BOOLEAN Timing, - IN const INTN DebugMode, + IN const BOOLEAN Timing, + IN const INTN DebugMode, IN const CHAR8 *Format, - IN VA_LIST Marker + IN VA_LIST Marker ); /** @@ -54,8 +54,8 @@ VOID EFIAPI MemLogVA ( **/ VOID EFIAPI MemLog ( - IN const BOOLEAN Timing, - IN const INTN DebugMode, + IN const BOOLEAN Timing, + IN const INTN DebugMode, IN const CHAR8 *Format, ... ); diff --git a/Library/RP_ApfsLib/RP_ApfsConnect.c b/Library/RP_ApfsLib/RP_ApfsConnect.c index 564204e2..ba406a37 100644 --- a/Library/RP_ApfsLib/RP_ApfsConnect.c +++ b/Library/RP_ApfsLib/RP_ApfsConnect.c @@ -144,7 +144,7 @@ EFI_STATUS ApfsStartDriver ( OcDisconnectDriversOnHandle (PrivateData->LocationInfo.ControllerHandle); if (!AppleFirmware) { - // Connect all devices on Non-Apple Firmware. + // Connect all devices on Non-Apple firmware. // REF: https://github.com/acidanthera/bugtracker/issues/960 OcConnectDrivers(); } diff --git a/NEWS.txt b/NEWS.txt index ac07ed42..7010f423 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -23,15 +23,10 @@ * Optimisations for speed had potentially disabled legacy BIOS boot on some Macs * This bug was introduced in v0.13.3.AB (Commit 66dbed0) - Fixes Potential Memory Conflict - * Eliminated buffer overrun in handling `showtools` - - The configuration resulted in a oversized memory allocation * Potential Memory Conflict - Some constants were passed to a function that reallocates memory - This bug was introduced in v0.14.0.AA (Commit 3fc36f5) - Extended in v0.14.0.AB (Commit 5cb1ed9) -- Fixes Hidden Entry Handling - * Some loaders in ESP locations were not hidden when selected on-screen (minus key) - * Was also the case when full paths were used in `dont_scan_files` - Fixes Display Resolution Handling * User defined resolutions were not being properly handled - Only the default, `max`, resolution was considered @@ -41,6 +36,16 @@ - Fixes `HelpScan` Handling * Rationalises implementation - Could be applied, when disabled, to some items that should be excluded +- Improves `SystemdVars` Handling + * The LoaderDevicePartUUID UEFI Variable is writen to vRAM and not nvRAM + * See: https://sf.net/p/refind/discussion/general/thread/d8dad2c475/ +- Improves `HiddenTags` Handling + * Shows volumes names along with GUID where only the GUID would have previously been shown + - Allows human friendly instance identification when viewing the `Restore Entries` screen + * Breaks backward compatibility with upstream when tags are hidden in RefindPlus + - Tags hidden upstream remain forward compatible with RefindPlus + * Fixes situation where some loaders in ESP locations were not hidden when selected on-screen (minus key) + - Was also the case when full paths were used in `dont_scan_files` - Improves License Presentation * Rationalises presentation to make clear it is on GPLv3/Later - Improves `MemTest` Handling diff --git a/README-Dev.md b/README-Dev.md index e43290fc..f578ec34 100644 --- a/README-Dev.md +++ b/README-Dev.md @@ -3,7 +3,8 @@ # RefindPlus ## Overview RefindPlus is a boot manager for Mac and PC. -It is a fork of [rEFInd](https://www.rodsbooks.com/refind) that incorporates several fixes and additional features. + +It is a fork of the [rEFInd Boot Manager](https://www.rodsbooks.com/refind) incorporating several fixes and additional features. The main development focus is on the following units: - **MacPro3,1**: Early 2008 Mac Pro @@ -108,7 +109,7 @@ In addition to the new functionality listed above, the following upstream tokens - **"use_graphics_for" Token:** OpenCore and Clover added as options that can be set to boot in graphics mode. - **"showtools" Token:** Additional tool added: - `clean_nvram` : Allows resetting nvram directly from RefindPlus. - - When run on Mac Firmware, RefindPlus will additionally trigger nvRAM garbage collection + - When run on Apple firmware, RefindPlus will additionally trigger nvRAM garbage collection - **"csr_values" Token:** A value of `0` can be set as the `Enabled` value to ensure `Over The Air` (OTA) updates when running macOS 11.x (Big Sur), or later, with SIP enabled. - This is equivalent to activating the `csr_normalise` token. - **"timeout" Token:** The default is no timeout unless explicitly set. diff --git a/config.conf-sample-Dev b/config.conf-sample-Dev index 6365551c..cc947e30 100644 --- a/config.conf-sample-Dev +++ b/config.conf-sample-Dev @@ -23,9 +23,9 @@ # is done when RefindPlus is loaded but users can manually toggle the set # values "ON" or "OFF" by using the "Rotate CSR" tool on the main menu. # The following options are available: -# 1 - Always Enable SIP (and SSV on macOS 11.x or later) +# 1 - Always Enable SIP/SSV # 0 - Take no Action -# -1 - Always Disable SIP (and SSV on macOS 11.x or later when configured in "csr_values") +# -1 - Always Disable SIP/SSV # # NOTES: # 1. This rotates the values defined under the 'csr_values' configuration token. @@ -544,7 +544,7 @@ # - opencore-version (macOS boots ... including installers) # # This token accepts these options: -# 0 - Sync is not attempted (Default/Base Option:- Y) +# 0 - Sync is never attempted (Default/Base Option:- Y) # 1 - Sync when current boot not as previous boot (Confirm Before Sync:- N) # 2 - Sync when current boot not as previous boot (Confirm Before Sync:- Y) # 3 - Sync before every boot (Confirm Before Sync:- Y) @@ -1416,7 +1416,7 @@ menuentry "Windows 7" { loader \EFI\Microsoft\Boot\bootmgfw.efi } -# uEFI shells are programs just like boot loaders, and can be +# As with boot loaders, uEFI shells are programs that can be # launched in the same way. A shell can be passed the name of # a script that it is to run on the "options" line. The script # could initialise hardware and then launch an OS, or it could diff --git a/gptsync/AutoGen.h b/gptsync/AutoGen.h index a07912ea..107494e6 100644 --- a/gptsync/AutoGen.h +++ b/gptsync/AutoGen.h @@ -36,7 +36,7 @@ extern const BOOLEAN _gPcd_FixedAtBuild_PcdUgaConsumeSupport; EFI_STATUS EFIAPI efi_main ( - IN EFI_HANDLE ImageHandle, + IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ); diff --git a/include/Handle.h b/include/Handle.h index 9d3a0825..5a35f9be 100644 --- a/include/Handle.h +++ b/include/Handle.h @@ -1,13 +1,13 @@ /*++ -Copyright (c) 2005, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2005, Intel Corporation +All rights reserved. This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. Module Name: @@ -16,7 +16,7 @@ Module Name: Abstract: Infomation about the handle function. - + Revision History --*/ @@ -45,22 +45,22 @@ EfiLibFileSystemInfo ( EFI_STATUS LibGetManagedChildControllerHandles ( - EFI_HANDLE DriverBindingHandle, - EFI_HANDLE ControllerHandle, - UINTN *ChildControllerHandleCount, + EFI_HANDLE DriverBindingHandle, + EFI_HANDLE ControllerHandle, + UINTN *ChildControllerHandleCount, EFI_HANDLE **ChildControllerHandleBuffer ); EFI_STATUS LibGetManagedControllerHandles ( - EFI_HANDLE DriverBindingHandle, - UINTN *ControllerHandleCount, + EFI_HANDLE DriverBindingHandle, + UINTN *ControllerHandleCount, EFI_HANDLE **ControllerHandleBuffer ); EFI_STATUS LibGetChildControllerHandles ( - EFI_HANDLE ControllerHandle, + EFI_HANDLE ControllerHandle, UINTN *HandleCount, EFI_HANDLE **HandleBuffer ); @@ -87,23 +87,23 @@ EFI_STATUS LibLocateHandleByDiskSignature ( IN UINT8 MBRType, IN UINT8 SignatureType, - IN VOID *Signature, - IN OUT UINTN *NoHandles, - OUT EFI_HANDLE **Buffer + IN VOID *Signature, + IN OUT UINTN *NoHandles, + OUT EFI_HANDLE **Buffer ); EFI_STATUS LibLocateHandle ( - IN EFI_LOCATE_SEARCH_TYPE SearchType, - IN EFI_GUID * Protocol OPTIONAL, + IN EFI_LOCATE_SEARCH_TYPE SearchType, + IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *NoHandles, - OUT EFI_HANDLE **Buffer + OUT EFI_HANDLE **Buffer ); EFI_STATUS LibLocateProtocol ( - IN EFI_GUID *ProtocolGuid, + IN EFI_GUID *ProtocolGuid, OUT VOID **Interface ); @@ -132,4 +132,4 @@ ShellGetHandleNum ( VOID ); -#endif \ No newline at end of file +#endif diff --git a/include/PeImage.h b/include/PeImage.h index 28a5f673..24b690bf 100644 --- a/include/PeImage.h +++ b/include/PeImage.h @@ -728,13 +728,13 @@ typedef struct { /// typedef struct { UINT16 Signature; ///< The signature for TE format = "VZ". - UINT16 Machine; ///< from the original file header. - UINT8 NumberOfSections; ///< from the original file header. - UINT8 Subsystem; ///< from original optional header. + UINT16 Machine; ///< From the original file header. + UINT8 NumberOfSections; ///< From the original file header. + UINT8 Subsystem; ///< From original optional header. UINT16 StrippedSize; ///< Number of bytes we removed from the header. UINT32 AddressOfEntryPoint; ///< Offset to entry point -- from original optional header. - UINT32 BaseOfCode; ///< from original image -- required for ITP debug. - UINT64 ImageBase; ///< from original file header. + UINT32 BaseOfCode; ///< From original image -- required for ITP debug. + UINT64 ImageBase; ///< From original file header. EFI_IMAGE_DATA_DIRECTORY DataDirectory[2]; ///< Only base relocation and debug directory. } EFI_TE_IMAGE_HEADER; diff --git a/include/PeImage2.h b/include/PeImage2.h index 496e97c9..683be921 100644 --- a/include/PeImage2.h +++ b/include/PeImage2.h @@ -30,16 +30,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. typedef struct _GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT { - UINT64 ImageAddress; - UINT64 ImageSize; - UINT64 EntryPoint; - UINTN SizeOfHeaders; - UINT16 ImageType; - UINT16 NumberOfSections; + UINT64 ImageAddress; + UINT64 ImageSize; + UINT64 EntryPoint; + UINTN SizeOfHeaders; + UINT16 ImageType; + UINT16 NumberOfSections; EFI_IMAGE_SECTION_HEADER *FirstSection; EFI_IMAGE_DATA_DIRECTORY *RelocDir; EFI_IMAGE_DATA_DIRECTORY *SecDir; - UINT64 NumberOfRvaAndSizes; + UINT64 NumberOfRvaAndSizes; EFI_IMAGE_OPTIONAL_HEADER_UNION *PEHdr; } GNUEFI_PE_COFF_LOADER_IMAGE_CONTEXT; diff --git a/include/RemovableMedia.h b/include/RemovableMedia.h index 75b2f623..67e60673 100644 --- a/include/RemovableMedia.h +++ b/include/RemovableMedia.h @@ -24,7 +24,7 @@ license, under Apple's copyrights in this original Apple software (the Software, with or without modifications, in source and/or binary forms; provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following -text and disclaimers in all such redistributions of the Apple Software. +text and disclaimers in all such redistributions of the Apple Software. Neither the name, trademarks, service marks or logos of Apple Computer, Inc. may be used to endorse or promote products derived from the Apple Software without specific prior written permission from Apple. Except @@ -48,7 +48,7 @@ AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Copyright © 2006 Apple Computer, Inc., All Rights Reserved +Copyright � 2006 Apple Computer, Inc., All Rights Reserved */ @@ -97,7 +97,7 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *APPLE_REMOVABLE_MEDIA_INJECT) ( - IN APPLE_REMOVABLE_MEDIA_PROTOCOL * This + IN APPLE_REMOVABLE_MEDIA_PROTOCOL *This ) /*++ @@ -119,7 +119,7 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *APPLE_REMOVABLE_MEDIA_ALLOW_REMOVAL) ( - IN APPLE_REMOVABLE_MEDIA_PROTOCOL * This + IN APPLE_REMOVABLE_MEDIA_PROTOCOL *This ) /*++ @@ -142,7 +142,7 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *APPLE_REMOVABLE_MEDIA_PREVENT_REMOVAL) ( - IN APPLE_REMOVABLE_MEDIA_PROTOCOL * This + IN APPLE_REMOVABLE_MEDIA_PROTOCOL *This ) /*++ @@ -165,8 +165,8 @@ EFI_STATUS typedef EFI_STATUS (EFIAPI *APPLE_REMOVABLE_MEDIA_DETECT_TRAY_STATE) ( - IN APPLE_REMOVABLE_MEDIA_PROTOCOL * This, - OUT BOOLEAN * TrayOpen + IN APPLE_REMOVABLE_MEDIA_PROTOCOL *This, + OUT BOOLEAN *TrayOpen ) /*++ @@ -187,17 +187,16 @@ EFI_STATUS // Protocol definition // struct _APPLE_REMOVABLE_MEDIA_PROTOCOL { - UINT32 Revision; - BOOLEAN RemovalAllowed; - APPLE_REMOVABLE_MEDIA_EJECT Eject; - APPLE_REMOVABLE_MEDIA_INJECT Inject; - APPLE_REMOVABLE_MEDIA_ALLOW_REMOVAL AllowRemoval; - APPLE_REMOVABLE_MEDIA_PREVENT_REMOVAL PreventRemoval; - APPLE_REMOVABLE_MEDIA_DETECT_TRAY_STATE DetectTrayState; + UINT32 Revision; + BOOLEAN RemovalAllowed; + APPLE_REMOVABLE_MEDIA_EJECT Eject; + APPLE_REMOVABLE_MEDIA_INJECT Inject; + APPLE_REMOVABLE_MEDIA_ALLOW_REMOVAL AllowRemoval; + APPLE_REMOVABLE_MEDIA_PREVENT_REMOVAL PreventRemoval; + APPLE_REMOVABLE_MEDIA_DETECT_TRAY_STATE DetectTrayState; }; //extern EFI_GUID gAppleRemovableMediaProtocolGuid; #endif - diff --git a/include/tiano_includes.h b/include/tiano_includes.h index cdf50d44..0a707151 100644 --- a/include/tiano_includes.h +++ b/include/tiano_includes.h @@ -116,7 +116,7 @@ BOOLEAN CheckError (IN EFI_STATUS Status, IN CHAR16 *where); extern EFI_STATUS EfiLibLocateProtocol ( IN EFI_GUID *ProtocolGuid, - OUT VOID **Interface + OUT VOID **Interface ); @@ -140,7 +140,7 @@ extern EFI_FILE_SYSTEM_INFO * EfiLibFileSystemInfo (IN EFI_FILE_HANDLE Root); extern VOID * EfiReallocatePool ( - IN VOID *OldPool, + IN VOID *OldPool, IN UINTN OldSize, IN UINTN NewSize ); diff --git a/libeg/image.c b/libeg/image.c index 56370f31..cc838a25 100644 --- a/libeg/image.c +++ b/libeg/image.c @@ -409,13 +409,13 @@ EFI_STATUS egFindESP ( EFI_STATUS Status; EFI_HANDLE *Handles; UINTN i, HandleCount; - EFI_GUID ESPGuid = ESP_GUID_VALUE; + HandleCount = 0; *RootDir = NULL; Status = LibLocateHandle ( ByProtocol, - &ESPGuid, NULL, + &GuidESP, NULL, &HandleCount, &Handles ); if (!EFI_ERROR(Status)) { diff --git a/libeg/screen.c b/libeg/screen.c index 629d3e79..87d64c0e 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -986,11 +986,10 @@ EFI_STATUS egDumpGOPVideoModes (VOID) { MY_FREE_POOL(MsgStr); MsgStr = PoolPrint ( - L"%02d GOP Mode%s ... 0x%lx %s 0x%lx Framebuffer", + L"%02d GOP Mode%s ... 0x%lx <<< -- >>> 0x%lx Framebuffer", MaxMode, (MaxMode != 1) ? L"s" : L"", GOPDraw->Mode->FrameBufferBase, - (MaxMode != 1) ? L"<<< -- >>>" : L"<<< --- >>>", GOPDraw->Mode->FrameBufferBase + GOPDraw->Mode->FrameBufferSize ); ALT_LOG(1, LOG_LINE_NORMAL, L"%s", MsgStr);