8#include <Protocol/DevicePath.h>
9#include <Protocol/SimpleFileSystem.h>
14#include <Guid/FileInfo.h>
15#include <Guid/GlobalVariable.h>
19#include <Library/BaseLib.h>
20#include <Library/BaseMemoryLib.h>
21#include <Library/DevicePathLib.h>
22#include <Library/MemoryAllocationLib.h>
30#include <Library/PrintLib.h>
31#include <Library/UefiBootServicesTableLib.h>
32#include <Library/UefiLib.h>
33#include <Library/UefiRuntimeServicesTableLib.h>
50EFI_DEVICE_PATH_PROTOCOL *
53 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
61 EFI_DEVICE_PATH_PROTOCOL *FullDevicePath;
62 EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
63 EFI_DEVICE_PATH_PROTOCOL *PrevDevicePath;
65 EFI_HANDLE FileSystemHandle;
66 EFI_FILE_PROTOCOL *File;
67 EFI_FILE_INFO *FileInfo;
71 ASSERT (BootContext != NULL);
72 ASSERT (DevicePath != NULL);
73 ASSERT (FileSystem != NULL);
81 PrevDevicePath = NULL;
89 if (PrevDevicePath != NULL) {
90 FreePool (PrevDevicePath);
97 if (FullDevicePath == NULL) {
98 DEBUG ((DEBUG_INFO,
"OCB: Short-form DP could not be expanded\n"));
102 PrevDevicePath = FullDevicePath;
113 RemainingDevicePath = FullDevicePath;
114 Status =
gBS->LocateDevicePath (
116 &RemainingDevicePath,
119 if (EFI_ERROR (Status)) {
125 "OCB: Expanded DP remainder",
133 if (*FileSystem == NULL) {
147 if (EFI_ERROR (Status)) {
157 sizeof (EFI_FILE_INFO),
165 if (FileInfo != NULL) {
166 IsDirectory = (FileInfo->Attribute & EFI_FILE_DIRECTORY) != 0;
177 IsRootPath = IsDevicePathEnd (RemainingDevicePath);
178 if (IsRootPath || !IsDirectory) {
179 ASSERT (FullDevicePath != NULL);
180 ASSERT (*FileSystem != NULL);
182 *IsRoot = IsDirectory;
183 return FullDevicePath;
204 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
209 CHAR8 *VisibilityCommand;
211 UINTN IdentifierLength;
220 L
".contentVisibility",
224 (VOID **)&Visibility,
230 if (EFI_ERROR (Status)) {
238 Walker = AsciiStrStr (Visibility,
"\r");
239 if (Walker != NULL) {
243 Walker = AsciiStrStr (Visibility,
"\n");
244 if (Walker != NULL) {
248 Walker = AsciiStrStr (Visibility,
":");
249 if (Walker == NULL) {
250 VisibilityCommand = Visibility;
252 if (*(Context->InstanceIdentifier) ==
'\0') {
253 DEBUG ((DEBUG_INFO,
"OCB: No InstanceIdentifier, ignoring qualified visibility\n"));
254 FreePool (Visibility);
259 VisibilityCommand = Walker;
262 IdentifierLength = AsciiStrLen (Context->InstanceIdentifier);
263 Status = EFI_NOT_FOUND;
265 if ( (AsciiStrnCmp (Walker, Context->InstanceIdentifier, IdentifierLength) == 0)
266 && ((Walker[IdentifierLength] ==
'\0') || (Walker[IdentifierLength] ==
',')))
268 Status = EFI_SUCCESS;
272 Walker = AsciiStrStr (Walker,
",");
273 if (Walker != NULL) {
276 }
while (Walker != NULL);
278 if (EFI_ERROR (Status)) {
279 DEBUG ((DEBUG_INFO,
"OCB: \"%a\" not present in \"%a\" ignoring visibility\n", Context->InstanceIdentifier, Visibility));
280 FreePool (Visibility);
285 if (AsciiStrCmp (VisibilityCommand,
"Disabled") == 0) {
286 FreePool (Visibility);
290 if (AsciiStrCmp (VisibilityCommand,
"Auxiliary") == 0) {
291 FreePool (Visibility);
295 DEBUG ((DEBUG_INFO,
"OCB: Discovered unsupported visibility \"%a\"\n", VisibilityCommand));
297 FreePool (Visibility);
316 CHAR16 *TextDevicePath;
320 if (BootEntry->DevicePath != NULL) {
321 TextDevicePath = ConvertDevicePathToText (BootEntry->DevicePath, FALSE, FALSE);
323 TextDevicePath = NULL;
328 "OCB: Registering entry %s [%a] (T:%d|F:%d|G:%d|E:%d|B:%d) - %s\n",
333 BootEntry->IsGeneric,
334 BootEntry->IsExternal,
335 BootEntry->IsBootEntryProtocol,
339 if (TextDevicePath != NULL) {
340 FreePool (TextDevicePath);
349 InsertTailList (&FileSystem->BootEntries, &BootEntry->Link);
350 ++BootContext->BootEntryCount;
356 if ( (BootContext->DefaultEntry == NULL)
363 BootContext->DefaultEntry = BootEntry;
380 BootContext->DefaultEntry = BootEntry;
401 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
402 IN BOOLEAN RecoveryPart,
403 IN BOOLEAN Deduplicate
411 CHAR16 *TextDevicePath;
415 BOOLEAN IsReallocated;
422 IsReallocated = TRUE;
423 DEBUG ((DEBUG_INFO,
"OCB: Switching DMG boot path to boot.efi due to policy\n"));
424 if (DevicePath == NULL) {
425 return EFI_OUT_OF_RESOURCES;
428 IsReallocated = FALSE;
433 TextDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
437 "OCB: Adding entry type (T:%u|F:%d|G:%d) - %s\n",
444 if (TextDevicePath != NULL) {
445 FreePool (TextDevicePath);
454 FileSystem->HasSelfRecovery = TRUE;
461 DEBUG ((DEBUG_INFO,
"OCB: Discarding recovery entry due to auxiliary\n"));
463 FreePool (DevicePath);
466 return EFI_UNSUPPORTED;
473 DEBUG ((DEBUG_INFO,
"OCB: Discarding time machine entry due to auxiliary\n"));
475 FreePool (DevicePath);
478 return EFI_UNSUPPORTED;
486 DEBUG ((DEBUG_INFO,
"OCB: Discarding disabled entry by visibility\n"));
488 FreePool (DevicePath);
491 return EFI_UNSUPPORTED;
497 if ((Visibility ==
BootEntryAuxiliary) && BootContext->PickerContext->HideAuxiliary) {
498 DEBUG ((DEBUG_INFO,
"OCB: Discarding auxiliary entry by visibility\n"));
500 FreePool (DevicePath);
503 return EFI_UNSUPPORTED;
513 Link = GetFirstNode (&FileSystem->BootEntries);
514 !IsNull (&FileSystem->BootEntries, Link);
515 Link = GetNextNode (&FileSystem->BootEntries, Link))
523 DEBUG ((DEBUG_INFO,
"OCB: Discarding already present DP\n"));
539 RemoveEntryList (Link);
540 InsertTailList (&FileSystem->BootEntries, Link);
542 FreePool (DevicePath);
545 return EFI_ALREADY_STARTED;
553 BootEntry = AllocateZeroPool (
sizeof (*BootEntry));
554 if (BootEntry == NULL) {
556 FreePool (DevicePath);
559 return EFI_OUT_OF_RESOURCES;
563 BootEntry->
Type = EntryType;
566 BootEntry->
IsExternal = RecoveryPart ? FileSystem->RecoveryFs->External : FileSystem->External;
569 if (EFI_ERROR (Status)) {
570 FreePool (BootEntry);
572 FreePool (DevicePath);
598 if (BootEntry->DevicePath != NULL) {
599 FreePool (BootEntry->DevicePath);
600 BootEntry->DevicePath = NULL;
603 if (BootEntry->Id != NULL) {
604 FreePool (BootEntry->Id);
605 BootEntry->Id = NULL;
608 if (BootEntry->Name != NULL) {
609 FreePool (BootEntry->Name);
610 BootEntry->Name = NULL;
613 if (BootEntry->PathName != NULL) {
614 FreePool (BootEntry->PathName);
615 BootEntry->PathName = NULL;
618 if (BootEntry->LoadOptions != NULL) {
619 FreePool (BootEntry->LoadOptions);
620 BootEntry->LoadOptions = NULL;
621 BootEntry->LoadOptionsSize = 0;
624 if (BootEntry->Flavour != NULL) {
625 FreePool (BootEntry->Flavour);
626 BootEntry->Flavour = NULL;
629 FreePool (BootEntry);
646 IN BOOLEAN IsBootEntryProtocol
653 CHAR8 *ContentFlavour;
654 CHAR16 *BootDirectoryName;
655 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
656 CONST EFI_PARTITION_ENTRY *PartitionEntry;
658 if (CustomEntry->Auxiliary && BootContext->PickerContext->HideAuxiliary) {
661 "OCB: Not adding hidden auxiliary entry %a (%a|B:%d) -> %a\n",
663 CustomEntry->Tool ?
"tool" :
"os",
667 return EFI_UNSUPPORTED;
673 BootEntry = AllocateZeroPool (
sizeof (*BootEntry));
674 if (BootEntry == NULL) {
675 return EFI_OUT_OF_RESOURCES;
679 BootEntry->
CustomRead = CustomEntry->CustomRead;
680 BootEntry->
CustomFree = CustomEntry->CustomFree;
682 if (CustomEntry->Id != NULL) {
684 if (BootEntry->
Id == NULL) {
686 return EFI_OUT_OF_RESOURCES;
690 ASSERT (CustomEntry->Name != NULL);
692 if (BootEntry->
Name == NULL) {
694 return EFI_OUT_OF_RESOURCES;
697 if (!CustomEntry->UnmanagedBootAction && !CustomEntry->SystemAction && !CustomEntry->UnmanagedDevicePath) {
698 ASSERT (CustomEntry->Path != NULL);
702 return EFI_OUT_OF_RESOURCES;
705 ASSERT (CustomEntry->Path == NULL);
709 ASSERT (CustomEntry->Flavour != NULL);
710 BootEntry->
Flavour = AllocateCopyPool (AsciiStrSize (CustomEntry->Flavour), CustomEntry->Flavour);
711 if (BootEntry->
Flavour == NULL) {
713 return EFI_OUT_OF_RESOURCES;
718 "OCB: Adding custom entry %s (%a|B:%d) -> %a\n",
720 CustomEntry->UnmanagedBootAction != NULL ?
"unmanaged" : (CustomEntry->SystemAction != NULL ?
"action" : (CustomEntry->Tool ?
"tool" :
"os")),
725 if (CustomEntry->UnmanagedBootAction) {
731 BootEntry->
IsExternal = CustomEntry->External;
732 BootEntry->
DevicePath = DuplicateDevicePath (CustomEntry->UnmanagedDevicePath);
736 return EFI_OUT_OF_RESOURCES;
738 }
else if (CustomEntry->SystemAction) {
743 }
else if (CustomEntry->Tool) {
744 ASSERT (CustomEntry->CustomRead == NULL && CustomEntry->CustomFree == NULL);
746 BootEntry->
CustomRead = BootContext->PickerContext->CustomRead;
757 if (IsBootEntryProtocol) {
758 if (CustomEntry->UnmanagedDevicePath) {
759 BootEntry->
DevicePath = DuplicateDevicePath (CustomEntry->UnmanagedDevicePath);
766 ASSERT (CustomEntry->UnmanagedDevicePath == NULL);
773 return EFI_OUT_OF_RESOURCES;
776 FilePath = (FILEPATH_DEVICE_PATH *)(
787 "OCB: Invalid device path, not adding entry %a\n",
791 return EFI_UNSUPPORTED;
794 BootEntry->
PathName = AllocateCopyPool (
800 return EFI_OUT_OF_RESOURCES;
827 if (!EFI_ERROR (Status)) {
830 if (ContentFlavour != NULL) {
835 FreePool (ContentFlavour);
837 if (BootEntry->
Flavour != NULL) {
841 BootEntry->
Flavour = ContentFlavour;
850 FreePool (BootDirectoryName);
860 ASSERT (CustomEntry->Arguments == NULL);
862 ASSERT (CustomEntry->Arguments != NULL);
863 BootEntry->
LoadOptionsSize = (UINT32)AsciiStrLen (CustomEntry->Arguments);
867 CustomEntry->Arguments
879 if (PartitionEntry == NULL) {
914 IN CONST CHAR16 **PredefinedPaths,
915 IN UINTN NumPredefinedPaths,
917 IN BOOLEAN Deduplicate
921 EFI_STATUS PrimaryStatus;
922 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFs;
923 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
924 EFI_DEVICE_PATH_PROTOCOL *DevicePathWalker;
925 EFI_DEVICE_PATH_PROTOCOL *NewDevicePath;
926 UINTN NewDevicePathSize;
927 EFI_DEVICE_PATH_PROTOCOL *HdDevicePath;
930 EFI_FILE_PROTOCOL *Root;
931 CHAR16 *RecoveryPath;
932 EFI_FILE_PROTOCOL *RecoveryRoot;
933 EFI_HANDLE RecoveryDeviceHandle;
939 Status =
gBS->HandleProtocol (
942 (VOID **)&HdDevicePath
944 if (EFI_ERROR (Status)) {
945 return EFI_UNSUPPORTED;
950 HdPrefixSize = GetDevicePathSize (HdDevicePath) - END_DEVICE_PATH_LENGTH;
955 if (BootContext->PickerContext->NumCustomBootPaths > 0) {
956 Status =
gBS->HandleProtocol (
962 if (!EFI_ERROR (Status)) {
963 Status = SimpleFs->OpenVolume (SimpleFs, &Root);
964 if (!EFI_ERROR (Status)) {
968 (CONST CHAR16 **)BootContext->PickerContext->CustomBootPaths,
969 BootContext->PickerContext->NumCustomBootPaths,
978 Status = EFI_NOT_FOUND;
984 if (EFI_ERROR (Status)) {
996 if (EFI_ERROR (Status)) {
1003 Status = EFI_NOT_FOUND;
1004 DevicePathWalker = DevicePath;
1006 NewDevicePath = GetNextDevicePathInstance (&DevicePathWalker, &NewDevicePathSize);
1007 if (NewDevicePath == NULL) {
1014 if (NewDevicePathSize - END_DEVICE_PATH_LENGTH < HdPrefixSize) {
1015 FreePool (NewDevicePath);
1027 if (CmpResult != 0) {
1030 "OCB: Skipping handle %p instance due to self trust violation\n",
1045 FreePool (NewDevicePath);
1072 if (FileSystem->HasSelfRecovery || BootContext->PickerContext->HideAuxiliary) {
1073 if (EFI_ERROR (PrimaryStatus)) {
1074 FreePool (NewDevicePath);
1077 Status = PrimaryStatus;
1091 &RecoveryDeviceHandle
1097 if (EFI_ERROR (PrimaryStatus)) {
1098 FreePool (NewDevicePath);
1101 if (EFI_ERROR (Status)) {
1102 DEBUG ((DEBUG_INFO,
"OCB: APFS recovery is not present - %r\n", Status));
1106 RecoveryRoot->Close (RecoveryRoot);
1111 if (FileSystem->RecoveryFs == NULL) {
1119 if ((FileSystem->RecoveryFs == NULL) || (FileSystem->RecoveryFs->Handle != RecoveryDeviceHandle)) {
1120 FreePool (RecoveryPath);
1124 NewDevicePath = FileDevicePath (RecoveryDeviceHandle, RecoveryPath);
1125 FreePool (RecoveryPath);
1126 if (NewDevicePath == NULL) {
1140 if (EFI_ERROR (Status)) {
1141 FreePool (NewDevicePath);
1145 FreePool (DevicePath);
1166 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
1172 if (FileSystem->HasSelfRecovery || BootContext->PickerContext->HideAuxiliary) {
1173 return EFI_UNSUPPORTED;
1181 if (EFI_ERROR (Status)) {
1196 if (EFI_ERROR (Status)) {
1197 FreePool (DevicePath);
1225 IN UINT16 BootOption,
1226 IN BOOLEAN LazyScan,
1228 OUT UINT32 *CustomIndex, OPTIONAL
1229 IN EFI_HANDLE *EntryProtocolHandles,
1230 IN UINTN EntryProtocolHandleCount,
1231 OUT EFI_GUID *EntryProtocolPartuuid, OPTIONAL
1232 OUT CHAR16 **EntryProtocolId OPTIONAL
1236 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
1237 EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath;
1238 EFI_DEVICE_PATH_PROTOCOL *ExpandedDevicePath;
1239 EFI_HANDLE FileSystemHandle;
1241 UINTN DevicePathSize;
1242 CHAR16 *TextDevicePath;
1243 INTN NumPatchedNodes;
1244 BOOLEAN IsAppleLegacy;
1245 BOOLEAN IsAppleLegacyHandled;
1247 EFI_LOAD_OPTION *LoadOption;
1248 UINTN LoadOptionSize;
1252 EFI_HANDLE *Handles;
1254 CONST EFI_PARTITION_ENTRY *PartitionEntry;
1258 DEBUG ((DEBUG_INFO,
"OCB: Building entry from Boot%04x\n", BootOption));
1268 BootContext->BootVariableGuid
1270 if (LoadOption == NULL) {
1271 return EFI_NOT_FOUND;
1278 if (DevicePath == NULL) {
1279 FreePool (LoadOption);
1280 return EFI_NOT_FOUND;
1286 CopyMem (LoadOption, DevicePath, LoadOption->FilePathListLength);
1287 DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)LoadOption;
1294 if (IsAppleLegacy) {
1295 FreePool (DevicePath);
1296 Status = GetVariable2 (
1299 (VOID **)&DevicePath,
1303 if (EFI_ERROR (Status) || !IsDevicePathValid (DevicePath, DevicePathSize)) {
1304 DEBUG ((DEBUG_INFO,
"OCB: Legacy DP invalid - %r\n", Status));
1305 if (!EFI_ERROR (Status)) {
1306 FreePool (DevicePath);
1309 return EFI_NOT_FOUND;
1324 &RemainingDevicePath
1326 if (NumPatchedNodes > 0) {
1330 DevicePathSize = GetDevicePathSize (DevicePath);
1337 IsAppleLegacyHandled = FALSE;
1338 if (IsAppleLegacy) {
1343 if (NumPatchedNodes == -1) {
1344 DEBUG ((DEBUG_INFO,
"OCB: Ignoring broken legacy DP\n"));
1345 FreePool (DevicePath);
1346 return EFI_NOT_FOUND;
1352 RemainingDevicePath = DevicePath;
1362 if (DevicePath != NULL) {
1363 TextDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
1364 if (TextDevicePath != NULL) {
1372 EntryProtocolHandles,
1373 EntryProtocolHandleCount,
1378 if (!EFI_ERROR (Status)) {
1379 if (EntryProtocolId != NULL) {
1380 *EntryProtocolId = TextDevicePath;
1383 FileSystem = CustomFileSystem;
1384 IsAppleLegacyHandled = TRUE;
1386 FreePool (TextDevicePath);
1391 if (!IsAppleLegacyHandled) {
1400 RemainingDevicePath,
1408 if (DevicePath != NULL) {
1410 if (FileSystem == NULL) {
1416 FreePool (RemainingDevicePath);
1427 if (DevicePath != NULL) {
1428 DevicePath = AllocateCopyPool (DevicePathSize, DevicePath);
1431 if (DevicePath == NULL) {
1432 return EFI_NOT_FOUND;
1439 ASSERT (DevicePathSize > END_DEVICE_PATH_LENGTH);
1440 DevicePathSize -= END_DEVICE_PATH_LENGTH;
1441 RemainingDevicePath = (EFI_DEVICE_PATH_PROTOCOL *)((UINTN)DevicePath + DevicePathSize);
1442 }
else if (DevicePath == RemainingDevicePath) {
1448 DEBUG ((DEBUG_INFO,
"OCB: Assuming DP is short-form (prefix)\n"));
1464 if (ExpandedDevicePath != NULL) {
1474 &RemainingDevicePath,
1478 }
while (NumPatchedNodes > 0);
1480 Status = EFI_NOT_FOUND;
1481 if ((ExpandedDevicePath == NULL) && (CustomFileSystem != NULL)) {
1486 ASSERT (CustomIndex == NULL || *CustomIndex == MAX_UINT32);
1490 if (CustomDevPath != NULL) {
1491 for (Index = 0; Index < BootContext->PickerContext->AllCustomEntryCount; ++Index) {
1493 CustomDevPath->EntryName.PathName,
1494 BootContext->PickerContext->CustomEntries[Index].Name
1496 if (CmpResult == 0) {
1497 if (CustomIndex != NULL) {
1498 *CustomIndex = Index;
1504 &BootContext->PickerContext->CustomEntries[Index],
1515 ASSERT (EntryProtocolId == NULL || *EntryProtocolId == NULL);
1516 ASSERT ((EntryProtocolPartuuid == NULL) == (EntryProtocolId == NULL));
1520 if (EntryProtocolDevPath != NULL) {
1526 if (
CompareGuid (&gEfiPartTypeUnusedGuid, &EntryProtocolDevPath->Partuuid)) {
1530 EntryProtocolHandles,
1531 EntryProtocolHandleCount,
1532 EntryProtocolDevPath->EntryName.PathName,
1536 if (!EFI_ERROR (Status)) {
1537 if (EntryProtocolPartuuid != NULL) {
1538 CopyGuid (EntryProtocolPartuuid, &gEfiPartTypeUnusedGuid);
1541 if (EntryProtocolId != NULL) {
1542 *EntryProtocolId = AllocateCopyPool (StrSize (EntryProtocolDevPath->EntryName.PathName), EntryProtocolDevPath->EntryName.PathName);
1545 EntryProtocolDevPath = NULL;
1550 if (EntryProtocolDevPath != NULL) {
1557 Status =
gBS->LocateHandleBuffer (
1565 if (!EFI_ERROR (Status)) {
1566 for (Index = 0; Index < NoHandles; ++Index) {
1570 (PartitionEntry == NULL) ? &gEfiPartTypeUnusedGuid : &PartitionEntry->UniquePartitionGUID,
1571 &EntryProtocolDevPath->Partuuid
1576 if (FileSystem == NULL) {
1583 EntryProtocolHandles,
1584 EntryProtocolHandleCount,
1585 EntryProtocolDevPath->EntryName.PathName,
1590 if (!EFI_ERROR (Status)) {
1591 if (EntryProtocolPartuuid != NULL) {
1592 if (PartitionEntry == NULL) {
1593 CopyGuid (EntryProtocolPartuuid, &gEfiPartTypeUnusedGuid);
1595 CopyGuid (EntryProtocolPartuuid, &PartitionEntry->UniquePartitionGUID);
1599 if (EntryProtocolId != NULL) {
1600 *EntryProtocolId = AllocateCopyPool (StrSize (EntryProtocolDevPath->EntryName.PathName), EntryProtocolDevPath->EntryName.PathName);
1617 FreePool (DevicePath);
1618 DevicePath = ExpandedDevicePath;
1620 if (DevicePath == NULL) {
1623 }
else if (NumPatchedNodes == -1) {
1628 DEBUG ((DEBUG_INFO,
"OCB: Ignoring broken normal DP\n"));
1629 FreePool (DevicePath);
1630 return EFI_NOT_FOUND;
1637 DEBUG ((DEBUG_INFO,
"OCB: Assuming DP is full-form or lacks suffix\n"));
1639 RemainingDevicePath = DevicePath;
1642 RemainingDevicePath,
1648 FreePool (RemainingDevicePath);
1650 if (DevicePath == NULL) {
1651 return EFI_NOT_FOUND;
1658 ASSERT (FileSystem != NULL);
1659 ASSERT (DevicePath != NULL);
1673 Status = EFI_UNSUPPORTED;
1676 if (EFI_ERROR (Status)) {
1677 FreePool (DevicePath);
1680 if (IsAppleLegacyHandled) {
1728 IN EFI_HANDLE FileSystemHandle,
1733 EFI_STATUS TmpStatus;
1737 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
1738 CHAR16 *TextDevicePath;
1742 BootContext->PickerContext->ScanPolicy,
1746 LoaderFs = BootContext->PickerContext->LoaderHandle == FileSystemHandle;
1748 DEBUG_CODE_BEGIN ();
1750 TmpStatus =
gBS->HandleProtocol (
1753 (VOID **)&DevicePath
1755 if (!EFI_ERROR (TmpStatus)) {
1756 TextDevicePath = ConvertDevicePathToText (DevicePath, FALSE, FALSE);
1758 TextDevicePath = NULL;
1763 "OCB: Adding fs %p (E:%d|L:%d|P:%r) - %s\n",
1771 if (TextDevicePath != NULL) {
1772 FreePool (TextDevicePath);
1777 if (EFI_ERROR (Status)) {
1781 Entry = AllocatePool (
sizeof (*Entry));
1782 if (Entry == NULL) {
1783 return EFI_OUT_OF_RESOURCES;
1786 Entry->
Handle = FileSystemHandle;
1792 InsertTailList (&BootContext->FileSystems, &Entry->
Link);
1793 ++BootContext->FileSystemCount;
1795 if (FileSystemEntry != NULL) {
1796 *FileSystemEntry = Entry;
1810 FileSystem = AllocateZeroPool (
sizeof (*FileSystem));
1811 if (FileSystem == NULL) {
1820 "OCB: Adding fs %p for %u custom entries and BEP%a\n",
1822 BootContext->PickerContext->AllCustomEntryCount,
1823 BootContext->PickerContext->HideAuxiliary ?
" (aux hidden)" :
" (aux shown)"
1838 IN UINT32 PrecreatedCustomIndex
1841 EFI_STATUS ReturnStatus;
1845 ReturnStatus = EFI_NOT_FOUND;
1847 for (Index = 0; Index < BootContext->PickerContext->AllCustomEntryCount; ++Index) {
1851 if (Index == PrecreatedCustomIndex) {
1858 &BootContext->PickerContext->CustomEntries[Index],
1862 if (!EFI_ERROR (Status)) {
1863 ReturnStatus = EFI_SUCCESS;
1867 return ReturnStatus;
1880 RemoveEntryList (&FileSystemEntry->Link);
1881 --BootContext->FileSystemCount;
1883 while (!IsListEmpty (&FileSystemEntry->BootEntries)) {
1884 Link = GetFirstNode (&FileSystemEntry->BootEntries);
1886 RemoveEntryList (Link);
1890 FreePool (FileSystemEntry);
1896 IN EFI_HANDLE FileSystemHandle,
1897 IN BOOLEAN LazyScan,
1898 OUT BOOLEAN *AlreadySeen OPTIONAL
1905 if (AlreadySeen != NULL) {
1906 *AlreadySeen = FALSE;
1910 Link = GetFirstNode (&BootContext->FileSystems);
1911 !IsNull (&BootContext->FileSystems, Link);
1912 Link = GetNextNode (&BootContext->FileSystems, Link))
1916 if (FileSystem->
Handle == FileSystemHandle) {
1917 DEBUG ((DEBUG_INFO,
"OCB: Matched fs %p%a\n", FileSystemHandle, LazyScan ?
" (lazy)" :
""));
1918 if (AlreadySeen != NULL) {
1919 *AlreadySeen = TRUE;
1930 DEBUG ((DEBUG_INFO,
"OCB: Restricted fs %p access\n", FileSystemHandle));
1935 if (!EFI_ERROR (Status)) {
1952 EFI_HANDLE *Handles;
1955 BootContext = AllocatePool (
sizeof (*BootContext));
1956 if (BootContext == NULL) {
1963 if (Context->CustomBootGuid) {
1976 Status =
gBS->LocateHandleBuffer (
1983 if (EFI_ERROR (Status)) {
1987 for (Index = 0; Index < NoHandles; ++Index) {
2007 while (!IsListEmpty (&Context->FileSystems)) {
2008 Link = GetFirstNode (&Context->FileSystems);
2027 BOOLEAN UseInitiator;
2029 FirstRecovery = NULL;
2030 UseInitiator = BootContext->PickerContext->RecoveryInitiator != NULL;
2037 FsLink = GetFirstNode (&BootContext->FileSystems);
2038 !IsNull (&BootContext->FileSystems, FsLink);
2039 FsLink = GetNextNode (&BootContext->FileSystems, FsLink))
2043 RecoveryInitiator = NULL;
2048 EnLink = GetNextNode (&FileSystem->
BootEntries, EnLink))
2056 FirstRecovery = BootEntry;
2059 if (!UseInitiator) {
2061 BootContext->DefaultEntry = FirstRecovery;
2070 BootContext->DefaultEntry = BootEntry;
2077 BootContext->PickerContext->RecoveryInitiator,
2082 RecoveryInitiator = BootEntry;
2086 if (RecoveryInitiator != NULL) {
2087 if (FirstRecovery != NULL) {
2088 DEBUG ((DEBUG_INFO,
"OCB: Using first recovery path for no initiator"));
2089 BootContext->DefaultEntry = FirstRecovery;
2093 DEBUG ((DEBUG_INFO,
"OCB: Looking for any first recovery due to no initiator"));
2094 UseInitiator = FALSE;
2098 return EFI_NOT_FOUND;
2112 UINT32 DefaultCustomIndex;
2113 CHAR16 *DefaultEntryId;
2114 EFI_GUID DefaultEntryPartuuid;
2115 BOOLEAN IsDefaultEntryProtocolPartition;
2116 EFI_HANDLE *EntryProtocolHandles;
2117 UINTN EntryProtocolHandleCount;
2118 CONST EFI_PARTITION_ENTRY *PartitionEntry;
2127 if (BootContext == NULL) {
2131 DEBUG ((DEBUG_INFO,
"OCB: Found %u potentially bootable filesystems\n", (UINT32)BootContext->
FileSystemCount));
2141 if (Context->BootOrder == NULL) {
2144 Context->BlacklistAppleUpdate,
2145 &Context->BootOrderCount,
2156 DefaultCustomIndex = MAX_UINT32;
2157 DefaultEntryId = NULL;
2159 if (Context->BootOrder != NULL) {
2160 CustomFileSystemDefault = CustomFileSystem;
2162 for (Index = 0; Index < Context->BootOrderCount; ++Index) {
2165 Context->BootOrder[Index],
2167 CustomFileSystemDefault,
2168 &DefaultCustomIndex,
2169 EntryProtocolHandles,
2170 EntryProtocolHandleCount,
2171 &DefaultEntryPartuuid,
2179 if ((DefaultCustomIndex != MAX_UINT32) || (DefaultEntryId != NULL)) {
2180 CustomFileSystemDefault = NULL;
2185 DEBUG ((DEBUG_INFO,
"OCB: Processing blessed list\n"));
2194 Link = GetNextNode (&BootContext->
FileSystems, Link))
2199 IsDefaultEntryProtocolPartition = (
2200 (DefaultEntryId != NULL)
2202 &DefaultEntryPartuuid,
2203 (PartitionEntry == NULL) ? &gEfiPartTypeUnusedGuid : &PartitionEntry->UniquePartitionGUID
2211 if (IsDefaultEntryProtocolPartition || IsListEmpty (&FileSystem->
BootEntries)) {
2231 EntryProtocolHandles,
2232 EntryProtocolHandleCount,
2233 IsDefaultEntryProtocolPartition ? DefaultEntryId : NULL,
2244 if (CustomFileSystem != NULL) {
2262 EntryProtocolHandles,
2263 EntryProtocolHandleCount,
2270 if (DefaultEntryId != NULL) {
2271 FreePool (DefaultEntryId);
2272 DefaultEntryId = NULL;
2295 IN BOOLEAN UseBootNextOnly
2301 BOOLEAN AlreadySeen;
2304 EFI_HANDLE *Handles;
2306 EFI_HANDLE *EntryProtocolHandles;
2307 UINTN EntryProtocolHandleCount;
2313 if (BootContext == NULL) {
2318 if (CustomFileSystem != NULL) {
2326 DEBUG ((DEBUG_INFO,
"OCB: Looking for default entry (%d:%a)\n", Context->PickerCommand, Context->HotKeyEntryId));
2337 if (Context->BootOrder == NULL) {
2340 Context->BlacklistAppleUpdate,
2341 &Context->BootOrderCount,
2346 if (Context->BootOrder != NULL) {
2347 for (Index = 0; Index < Context->BootOrderCount; ++Index) {
2354 Context->BootOrder[Index],
2358 EntryProtocolHandles,
2359 EntryProtocolHandleCount,
2374 if (UseBootNextOnly) {
2384 Status =
gBS->LocateHandleBuffer (
2392 DEBUG ((DEBUG_INFO,
"OCB: Processing %u blessed list - %r\n", (UINT32)NoHandles, Status));
2394 if (!EFI_ERROR (Status)) {
2395 for (Index = 0; Index < NoHandles; ++Index) {
2401 if (FileSystem == NULL) {
2428 EntryProtocolHandles,
2429 EntryProtocolHandleCount,
2451 if (CustomFileSystem != NULL) {
2468 EntryProtocolHandles,
2469 EntryProtocolHandleCount,
2484 &Context->HotKeyProtocolHandle,
2486 Context->HotKeyEntryId,
2490 if (EFI_ERROR (Status)) {
2491 DEBUG ((DEBUG_WARN,
"OCB: Missing boot entry protocol entry for hotkey %a - %r\n", Context->HotKeyEntryId, Status));
2517 Entries = AllocatePool (
sizeof (*Entries) * BootContext->BootEntryCount);
2518 if (Entries == NULL) {
2524 FsLink = GetFirstNode (&BootContext->FileSystems);
2525 !IsNull (&BootContext->FileSystems, FsLink);
2526 FsLink = GetNextNode (&BootContext->FileSystems, FsLink))
2533 EnLink = GetNextNode (&FileSystem->
BootEntries, EnLink))
2537 ASSERT (EntryIndex < BootContext->BootEntryCount);
2538 Entries[EntryIndex] = BootEntry;
2543 ASSERT (EntryIndex == BootContext->BootEntryCount);
2544 ASSERT (BootContext->DefaultEntry == NULL || BootContext->DefaultEntry->EntryIndex > 0);
2552 IN EFI_HANDLE ParentHandle
2556 EFI_HANDLE EntryHandle;
2558 VOID *CustomFreeContext;
2561 ASSERT (BootEntry->UnmanagedBootAction != NULL);
2562 return BootEntry->UnmanagedBootAction (Context, BootEntry->DevicePath);
2566 ASSERT (BootEntry->SystemAction != NULL);
2567 return BootEntry->SystemAction (Context);
2578 if (!EFI_ERROR (Status)) {
2587 if (BootEntry->IsAppleInstaller) {
2591 Status = Context->StartImage (BootEntry, EntryHandle, NULL, NULL, BootEntry->LaunchInText);
2592 if (EFI_ERROR (Status)) {
2593 DEBUG ((DEBUG_WARN,
"OCB: StartImage failed - %r\n", Status));
2601 gBS->UnloadImage (EntryHandle);
2612 if (BootEntry->CustomFree != NULL) {
2613 BootEntry->CustomFree (CustomFreeContext);
2616 DEBUG ((DEBUG_WARN,
"OCB: LoadImage failed - %r\n", Status));
EFI_GUID gAppleBootVariableGuid
#define APPLE_BOOT_CAMP_HD_VARIABLE_NAME
EFI_STATUS InternalGetRecoveryOsBooter(IN EFI_HANDLE Device, OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, IN BOOLEAN Basic)
EFI_STATUS InternalDescribeBootEntry(IN OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_ENTRY *BootEntry)
CHAR8 * InternalGetContentFlavour(IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem, IN CONST CHAR16 *BootDirectoryName)
STATIC EFI_DEVICE_PATH_PROTOCOL * ExpandShortFormBootPath(IN OC_BOOT_CONTEXT *BootContext, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN LazyScan, OUT OC_BOOT_FILESYSTEM **FileSystem, OUT BOOLEAN *IsRoot)
EFI_STATUS OcSetDefaultBootRecovery(IN OUT OC_BOOT_CONTEXT *BootContext)
STATIC VOID FreeFileSystemEntry(IN OUT OC_BOOT_CONTEXT *BootContext, IN OC_BOOT_FILESYSTEM *FileSystemEntry)
OC_BOOT_FILESYSTEM * InternalFileSystemForHandle(IN OC_BOOT_CONTEXT *BootContext, IN EFI_HANDLE FileSystemHandle, IN BOOLEAN LazyScan, OUT BOOLEAN *AlreadySeen OPTIONAL)
STATIC VOID FreeBootEntry(IN OC_BOOT_ENTRY *BootEntry)
STATIC EFI_STATUS AddBootEntryOnFileSystem(IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN RecoveryPart, IN BOOLEAN Deduplicate)
OC_BOOT_CONTEXT * OcScanForBootEntries(IN OC_PICKER_CONTEXT *Context)
OC_BOOT_CONTEXT * OcScanForDefaultBootEntry(IN OC_PICKER_CONTEXT *Context, IN BOOLEAN UseBootNextOnly)
STATIC EFI_STATUS AddBootEntryFromBless(IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, IN BOOLEAN LazyScan, IN BOOLEAN Deduplicate)
STATIC EFI_STATUS AddBootEntryFromBootOption(IN OUT OC_BOOT_CONTEXT *BootContext, IN UINT16 BootOption, IN BOOLEAN LazyScan, IN OUT OC_BOOT_FILESYSTEM *CustomFileSystem, OUT UINT32 *CustomIndex, OPTIONAL IN EFI_HANDLE *EntryProtocolHandles, IN UINTN EntryProtocolHandleCount, OUT EFI_GUID *EntryProtocolPartuuid, OPTIONAL OUT CHAR16 **EntryProtocolId OPTIONAL)
STATIC OC_BOOT_CONTEXT * BuildFileSystemList(IN OC_PICKER_CONTEXT *Context, IN BOOLEAN Empty)
STATIC OC_BOOT_FILESYSTEM * CreateFileSystemForCustom(IN OUT CONST OC_BOOT_CONTEXT *BootContext)
STATIC EFI_STATUS AddBootEntryFromSelfRecovery(IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem)
STATIC EFI_STATUS AddFileSystemEntryForCustom(IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem, IN UINT32 PrecreatedCustomIndex)
EFI_STATUS InternalAddBootEntryFromCustomEntry(IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem, IN OC_PICKER_ENTRY *CustomEntry, IN BOOLEAN IsBootEntryProtocol)
STATIC VOID RegisterBootOption(IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem, IN OC_BOOT_ENTRY *BootEntry)
STATIC INTERNAL_ENTRY_VISIBILITY ReadEntryVisibility(IN OC_PICKER_CONTEXT *Context, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
OC_BOOT_ENTRY ** OcEnumerateEntries(IN OC_BOOT_CONTEXT *BootContext)
STATIC EFI_STATUS AddFileSystemEntry(IN OUT OC_BOOT_CONTEXT *BootContext, IN EFI_HANDLE FileSystemHandle, OUT OC_BOOT_FILESYSTEM **FileSystemEntry OPTIONAL)
EFI_STATUS OcLoadBootEntry(IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, IN EFI_HANDLE ParentHandle)
VOID OcFreeBootContext(IN OUT OC_BOOT_CONTEXT *Context)
#define OC_CUSTOM_FS_HANDLE
CONST OC_ENTRY_PROTOCOL_DEVICE_PATH * InternalGetOcEntryProtocolDevPath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
PACKED struct @90 OC_ENTRY_PROTOCOL_DEVICE_PATH
EFI_STATUS InternalLoadBootEntry(IN OC_PICKER_CONTEXT *Context, IN OC_BOOT_ENTRY *BootEntry, IN EFI_HANDLE ParentHandle, OUT EFI_HANDLE *EntryHandle, OUT INTERNAL_DMG_LOAD_CONTEXT *DmgLoadContext, OUT VOID **CustomFreeContext)
INTERNAL_ENTRY_VISIBILITY
PACKED struct @89 OC_CUSTOM_BOOT_DEVICE_PATH
UINT16 * InternalGetBootOrderForBooting(IN EFI_GUID *BootVariableGuid, IN BOOLEAN BlacklistAppleUpdate, OUT UINTN *BootOrderCount, IN BOOLEAN UseBootNextOnly)
EFI_DEVICE_PATH_PROTOCOL * InternalGetBootOptionPath(IN EFI_LOAD_OPTION *LoadOption, IN UINTN LoadOptionSize)
BOOLEAN InternalIsAppleLegacyLoadApp(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
CONST OC_CUSTOM_BOOT_DEVICE_PATH * InternalGetOcCustomDevPath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS InternalCheckScanPolicy(IN EFI_HANDLE Handle, IN UINT32 Policy, OUT BOOLEAN *External OPTIONAL)
VOID InternalUnloadDmg(IN INTERNAL_DMG_LOAD_CONTEXT *DmgLoadContext)
CONST CHAR16 * gAppleBootPolicyPredefinedPaths[]
CONST UINTN gAppleBootPolicyNumPredefinedPaths
EFI_STATUS OcGetBooterFromPredefinedPathList(IN EFI_HANDLE Device, IN EFI_FILE_PROTOCOL *Root, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath OPTIONAL, IN CHAR16 *Prefix OPTIONAL)
EFI_STATUS OcBootPolicyGetBootFileEx(IN EFI_HANDLE Device, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT EFI_DEVICE_PATH_PROTOCOL **FilePath)
EFI_STATUS OcBootPolicyDevicePathToDirPath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT CHAR16 **BootPathName, OUT EFI_SIMPLE_FILE_SYSTEM_PROTOCOL **FileSystem)
EFI_STATUS OcBootPolicyGetApfsRecoveryFilePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *PathName, IN CONST CHAR16 **PredefinedPaths, IN UINTN NumPredefinedPaths, OUT CHAR16 **FullPathName, OUT EFI_FILE_PROTOCOL **Root, OUT EFI_HANDLE *DeviceHandle)
CONST UINTN gAppleBootPolicyCoreNumPredefinedPaths
CHAR16 PathName[DMG_FILE_PATH_LEN]
DMG_FILEPATH_DEVICE_PATH FilePath
@ OcPickerBootAppleRecovery
VOID OcLocateBootEntryProtocolHandles(IN OUT EFI_HANDLE **EntryProtocolHandles, IN OUT UINTN *EntryProtocolHandleCount)
#define OC_BOOT_APPLE_TIME_MACHINE
#define OC_BOOT_EXTERNAL_TOOL
VOID OcFreeBootEntryProtocolHandles(EFI_HANDLE **EntryProtocolHandles)
#define OC_BOOT_EXTERNAL_OS
EFI_STATUS EFIAPI OcGetBootEntryFileFromDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CONST CHAR16 *FileName, IN CONST CHAR8 *DebugFileType, IN UINT32 MaxFileSize, IN UINT32 MinFileSize, OUT VOID **FileData, OUT UINT32 *DataLength OPTIONAL, IN BOOLEAN SearchAtLeaf, IN BOOLEAN SearchAtRoot)
UINT32 OC_BOOT_ENTRY_TYPE
#define OC_ATTR_USE_FLAVOUR_ICON
OC_BOOT_ENTRY_TYPE OcGetBootDevicePathType(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, OUT BOOLEAN *IsFolder OPTIONAL, OUT BOOLEAN *IsGeneric OPTIONAL)
#define OC_BOOT_APPLE_RECOVERY
#define OC_MAX_CONTENT_VISIBILITY_SIZE
#define OC_BOOT_UNMANAGED
EFI_STATUS OcAddEntriesFromBootEntryProtocol(IN OUT OC_BOOT_CONTEXT *BootContext, IN OUT OC_BOOT_FILESYSTEM *FileSystem, IN EFI_HANDLE *EntryProtocolHandles, IN UINTN EntryProtocolHandleCount, IN CONST VOID *DefaultEntryId, OPTIONAL IN BOOLEAN CreateDefault, IN BOOLEAN CreateForHotKey)
#define OC_HUMAN_STRING(TextDevicePath)
VOID DebugPrintDevicePath(IN UINTN ErrorLevel, IN CONST CHAR8 *Message, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL)
EFI_DEVICE_PATH_PROTOCOL * OcGetNextLoadOptionDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath)
INTN OcFixAppleBootDevicePath(IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_DEVICE_PATH_PROTOCOL **RemainingDevicePath)
UINTN OcFileDevicePathNameSize(IN CONST FILEPATH_DEVICE_PATH *FilePath)
INTN OcFixAppleBootDevicePathNode(IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT APPLE_BOOT_DP_PATCH_CONTEXT *RestoreContext OPTIONAL, IN EFI_HANDLE ValidDevice OPTIONAL)
EFI_DEVICE_PATH_PROTOCOL * FindDevicePathNodeWithType(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINT8 Type, IN UINT8 SubType OPTIONAL)
EFI_DEVICE_PATH_PROTOCOL * AppendFileNameDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN CHAR16 *FileName)
BOOLEAN EFIAPI IsDevicePathEqual(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath1, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath2)
EFI_DEVICE_PATH_PROTOCOL * OcDiskFindSystemPartitionPath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINTN *EspDevicePathSize, OUT EFI_HANDLE *EspDeviceHandle)
VOID * OcGetFileInfo(IN EFI_FILE_PROTOCOL *File, IN EFI_GUID *InformationType, IN UINTN MinFileInfoSize, OUT UINTN *RealFileInfoSize OPTIONAL)
EFI_DEVICE_PATH_PROTOCOL * OcDiskFindActiveMbrPartitionPath(IN EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINTN *PartitionDevicePathSize, OUT EFI_HANDLE *PartitionDeviceHandle)
CONST EFI_PARTITION_ENTRY * OcGetGptPartitionEntry(IN EFI_HANDLE FsHandle)
EFI_STATUS EFIAPI OcOpenFileByRemainingDevicePath(IN EFI_HANDLE FileSystemHandle, IN CONST EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OUT EFI_FILE_PROTOCOL **File, IN UINT64 OpenMode, IN UINT64 Attributes)
INTN MixedStrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR8 *SecondString)
VOID UnicodeUefiSlashes(IN OUT CHAR16 *String)
CHAR16 * AsciiStrCopyToUnicode(IN CONST CHAR8 *String, IN UINTN Length)
EFI_GUID gOcVendorVariableGuid
VOID EFIAPI OcSwitchToFallbackLegacyNvram(VOID)
EFI_LOAD_OPTION * OcGetBootOptionData(OUT UINTN *OptionSize, IN UINT16 BootOption, IN CONST EFI_GUID *BootGuid)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
EFI_GUID gEfiFileInfoGuid
EFI_GUID gEfiSimpleFileSystemProtocolGuid
EFI_GUID gEfiGlobalVariableGuid
EFI_GUID gEfiDevicePathProtocolGuid
OC_BOOT_ENTRY * DefaultEntry
OC_PICKER_CONTEXT * PickerContext
EFI_GUID * BootVariableGuid
OC_BOOT_SYSTEM_ACTION SystemAction
EFI_DEVICE_PATH_PROTOCOL * DevicePath
EFI_GUID UniquePartitionGUID
BOOLEAN IsBootEntryProtocol
OC_CUSTOM_READ CustomRead
OC_BOOT_UNMANAGED_ACTION UnmanagedBootAction
OC_CUSTOM_FREE CustomFree
OC_BOOT_UNMANAGED_GET_FINAL_DP UnmanagedBootGetFinalDevicePath
OC_BOOT_FILESYSTEM * RecoveryFs
OC_PICKER_CMD PickerCommand