Changeset 105670 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
- Timestamp:
- Aug 14, 2024 1:16:30 PM (4 months ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-159268 /vendor/edk2/current 103735-103757,103769-103776,129194-164365
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c
r101291 r105670 881 881 EFI_DEVICE_PATH_PROTOCOL *Instance; 882 882 UINTN Size; 883 BOOLEAN MatchFound; 884 BOOLEAN ConnectAllAttempted; 883 885 884 886 // … … 975 977 // to search all devices in the system for a matched partition 976 978 // 977 EfiBootManagerConnectAll (); 978 Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer); 979 if (EFI_ERROR (Status)) { 980 BlockIoHandleCount = 0; 981 BlockIoBuffer = NULL; 982 } 983 984 // 985 // Loop through all the device handles that support the BLOCK_IO Protocol 986 // 987 for (Index = 0; Index < BlockIoHandleCount; Index++) { 988 BlockIoDevicePath = DevicePathFromHandle (BlockIoBuffer[Index]); 989 if (BlockIoDevicePath == NULL) { 990 continue; 991 } 992 993 if (BmMatchPartitionDevicePathNode (BlockIoDevicePath, (HARDDRIVE_DEVICE_PATH *)FilePath)) { 994 // 995 // Find the matched partition device path 996 // 997 TempDevicePath = AppendDevicePath (BlockIoDevicePath, NextDevicePathNode (FilePath)); 998 FullPath = BmGetNextLoadOptionDevicePath (TempDevicePath, NULL); 999 FreePool (TempDevicePath); 1000 1001 if (FullPath != NULL) { 1002 BmCachePartitionDevicePath (&CachedDevicePath, BlockIoDevicePath); 1003 979 BlockIoBuffer = NULL; 980 MatchFound = FALSE; 981 ConnectAllAttempted = FALSE; 982 do { 983 if (BlockIoBuffer != NULL) { 984 FreePool (BlockIoBuffer); 985 } 986 987 Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiBlockIoProtocolGuid, NULL, &BlockIoHandleCount, &BlockIoBuffer); 988 if (EFI_ERROR (Status)) { 989 BlockIoHandleCount = 0; 990 BlockIoBuffer = NULL; 991 } 992 993 // 994 // Loop through all the device handles that support the BLOCK_IO Protocol 995 // 996 for (Index = 0; Index < BlockIoHandleCount; Index++) { 997 BlockIoDevicePath = DevicePathFromHandle (BlockIoBuffer[Index]); 998 if (BlockIoDevicePath == NULL) { 999 continue; 1000 } 1001 1002 if (BmMatchPartitionDevicePathNode (BlockIoDevicePath, (HARDDRIVE_DEVICE_PATH *)FilePath)) { 1004 1003 // 1005 // Save the matching Device Path so we don't need to do a connect all next time 1006 // Failing to save only impacts performance next time expanding the short-form device path 1004 // Find the matched partition device path 1007 1005 // 1008 Status = gRT->SetVariable ( 1009 L"HDDP", 1010 &mBmHardDriveBootVariableGuid, 1011 EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE, 1012 GetDevicePathSize (CachedDevicePath), 1013 CachedDevicePath 1014 ); 1015 1016 break; 1006 TempDevicePath = AppendDevicePath (BlockIoDevicePath, NextDevicePathNode (FilePath)); 1007 FullPath = BmGetNextLoadOptionDevicePath (TempDevicePath, NULL); 1008 FreePool (TempDevicePath); 1009 1010 if (FullPath != NULL) { 1011 BmCachePartitionDevicePath (&CachedDevicePath, BlockIoDevicePath); 1012 1013 // 1014 // Save the matching Device Path so we don't need to do a connect all next time 1015 // Failing to save only impacts performance next time expanding the short-form device path 1016 // 1017 Status = gRT->SetVariable ( 1018 L"HDDP", 1019 &mBmHardDriveBootVariableGuid, 1020 EFI_VARIABLE_BOOTSERVICE_ACCESS | 1021 EFI_VARIABLE_NON_VOLATILE, 1022 GetDevicePathSize (CachedDevicePath), 1023 CachedDevicePath 1024 ); 1025 MatchFound = TRUE; 1026 break; 1027 } 1017 1028 } 1018 1029 } 1019 } 1030 1031 // 1032 // If we found a matching BLOCK_IO handle or we've already 1033 // tried a ConnectAll, we are done searching. 1034 // 1035 if (MatchFound || ConnectAllAttempted) { 1036 break; 1037 } 1038 1039 EfiBootManagerConnectAll (); 1040 ConnectAllAttempted = TRUE; 1041 } while (1); 1020 1042 1021 1043 if (CachedDevicePath != NULL) {
Note:
See TracChangeset
for help on using the changeset viewer.