return BmGetFileBufferFromLoadFiles (FilePath, FullPath, FileSize);\r
}\r
\r
+/**\r
+ Check if it's a Device Path pointing to BootMenuApp.\r
+\r
+ @param DevicePath Input device path.\r
+\r
+ @retval TRUE The device path is BootMenuApp File Device Path.\r
+ @retval FALSE The device path is NOT BootMenuApp File Device Path.\r
+**/\r
+BOOLEAN\r
+BmIsBootMenuAppFilePath (\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
+)\r
+{\r
+ EFI_HANDLE FvHandle;\r
+ VOID *NameGuid;\r
+ EFI_STATUS Status;\r
+\r
+ Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &DevicePath, &FvHandle);\r
+ if (!EFI_ERROR (Status)) {\r
+ NameGuid = EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) DevicePath);\r
+ if (NameGuid != NULL) {\r
+ return CompareGuid (NameGuid, PcdGetPtr (PcdBootManagerMenuFile));\r
+ }\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
/**\r
Attempt to boot the EFI boot option. This routine sets L"BootCurent" and\r
also signals the EFI ready to boot event. If the device path for the option\r
UINTN OptionNumber;\r
UINTN OriginalOptionNumber;\r
EFI_DEVICE_PATH_PROTOCOL *FilePath;\r
- EFI_DEVICE_PATH_PROTOCOL *Node;\r
EFI_DEVICE_PATH_PROTOCOL *RamDiskDevicePath;\r
- EFI_HANDLE FvHandle;\r
VOID *FileBuffer;\r
UINTN FileSize;\r
EFI_BOOT_LOGO_PROTOCOL *BootLogo;\r
// 3. Signal the EVT_SIGNAL_READY_TO_BOOT event when we are about to load and execute\r
// the boot option.\r
//\r
- Node = BootOption->FilePath;\r
- Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &Node, &FvHandle);\r
- if (!EFI_ERROR (Status) && CompareGuid (\r
- EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) Node),\r
- PcdGetPtr (PcdBootManagerMenuFile)\r
- )) {\r
+ if (BmIsBootMenuAppFilePath (BootOption->FilePath)) {\r
DEBUG ((EFI_D_INFO, "[Bds] Booting Boot Manager Menu.\n"));\r
BmStopHotkeyService (NULL, NULL);\r
} else {\r
UINTN BootOptionCount;\r
EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
UINTN Index;\r
- EFI_DEVICE_PATH_PROTOCOL *Node;\r
- EFI_HANDLE FvHandle;\r
\r
BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);\r
\r
for (Index = 0; Index < BootOptionCount; Index++) {\r
- Node = BootOptions[Index].FilePath;\r
- Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &Node, &FvHandle);\r
- if (!EFI_ERROR (Status)) {\r
- if (CompareGuid (\r
- EfiGetNameGuidFromFwVolDevicePathNode ((CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *) Node),\r
- PcdGetPtr (PcdBootManagerMenuFile)\r
- )\r
- ) { \r
+ if (BmIsBootMenuAppFilePath (BootOptions[Index].FilePath)) {\r
Status = EfiBootManagerInitializeLoadOption (\r
BootOption,\r
BootOptions[Index].OptionNumber,\r
);\r
ASSERT_EFI_ERROR (Status);\r
break;\r
- }\r
}\r
}\r
\r