12#include <Library/VariablePolicyHelperLib.h>
15CHAR16 *mBmLoadOptionName[] = {
23CHAR16 *mBmLoadOptionOrderName[] = {
48 NameSize =
sizeof (CHAR16);
50 ASSERT (Name !=
NULL);
52 NewNameSize = NameSize;
53 Status =
gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
54 if (Status == EFI_BUFFER_TOO_SMALL) {
56 ASSERT (Name !=
NULL);
57 Status =
gRT->GetNextVariableName (&NewNameSize, Name, &Guid);
58 NameSize = NewNameSize;
61 if (Status == EFI_NOT_FOUND) {
67 Visitor (Name, &Guid, Context);
86 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType,
87 OUT UINT16 *FreeOptionNumber
93 UINTN OptionOrderSize;
96 ASSERT (FreeOptionNumber !=
NULL);
98 LoadOptionType == LoadOptionTypeDriver ||
99 LoadOptionType == LoadOptionTypeBoot ||
100 LoadOptionType == LoadOptionTypeSysPrep
103 GetEfiGlobalVariable2 (mBmLoadOptionOrderName[LoadOptionType], (VOID **)&OptionOrder, &OptionOrderSize);
104 ASSERT ((OptionOrder !=
NULL && OptionOrderSize != 0) || (OptionOrder ==
NULL && OptionOrderSize == 0));
107 if (LoadOptionType == LoadOptionTypeBoot) {
111 for (OptionNumber = 0;
112 OptionNumber < OptionOrderSize /
sizeof (UINT16)
113 + ((BootNext !=
NULL) ? 1 : 0);
120 for (Index = 0; Index < OptionOrderSize /
sizeof (UINT16); Index++) {
121 if (OptionNumber == OptionOrder[Index]) {
130 if ((Index == OptionOrderSize /
sizeof (UINT16)) &&
131 ((BootNext ==
NULL) || (OptionNumber != *BootNext))
138 if (OptionOrder !=
NULL) {
142 if (BootNext !=
NULL) {
150 ASSERT (OptionNumber <= 0x10000);
151 if (OptionNumber == 0x10000) {
152 return EFI_OUT_OF_RESOURCES;
154 *FreeOptionNumber = (UINT16)OptionNumber;
178 CHAR16 OptionName[BM_OPTION_NAME_LEN];
182 UINT32 VariableAttributes;
184 if ((Option->OptionNumber == LoadOptionNumberUnassigned) ||
185 (Option->FilePath ==
NULL) ||
186 ((UINT32)Option->OptionType >= LoadOptionTypeMax)
189 return EFI_INVALID_PARAMETER;
196 Description = Option->Description;
197 if (Description ==
NULL) {
198 Description = &NullChar;
216 VariableSize =
sizeof (Option->Attributes)
220 + Option->OptionalDataSize;
223 ASSERT (Variable !=
NULL);
227 Ptr +=
sizeof (Option->Attributes);
230 Ptr +=
sizeof (UINT16);
238 CopyMem (Ptr, Option->OptionalData, Option->OptionalDataSize);
240 UnicodeSPrint (OptionName,
sizeof (OptionName), L
"%s%04x", mBmLoadOptionName[Option->OptionType], Option->OptionNumber);
243 if (Option->OptionType == LoadOptionTypePlatformRecovery) {
247 Status =
gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid,
NULL, (VOID **)&VariablePolicy);
248 if (!EFI_ERROR (Status)) {
249 Status = RegisterBasicVariablePolicy (
251 &gEfiGlobalVariableGuid,
253 VARIABLE_POLICY_NO_MIN_SIZE,
254 VARIABLE_POLICY_NO_MAX_SIZE,
255 VARIABLE_POLICY_NO_MUST_ATTR,
256 VARIABLE_POLICY_NO_CANT_ATTR,
257 VARIABLE_POLICY_TYPE_LOCK_NOW
262 VariableAttributes = EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS;
265 Status =
gRT->SetVariable (
267 &gEfiGlobalVariableGuid,
291 IN CHAR16 *OptionOrderName,
292 IN UINT16 OptionNumber,
299 UINT16 *NewOptionOrder;
300 UINTN OptionOrderSize;
306 ASSERT ((OptionOrder !=
NULL && OptionOrderSize != 0) || (OptionOrder ==
NULL && OptionOrderSize == 0));
309 for (Index = 0; Index < OptionOrderSize /
sizeof (UINT16); Index++) {
310 if (OptionOrder[Index] == OptionNumber) {
311 Status = EFI_ALREADY_STARTED;
316 if (!EFI_ERROR (Status)) {
317 Position =
MIN (Position, OptionOrderSize /
sizeof (UINT16));
319 NewOptionOrder =
AllocatePool (OptionOrderSize +
sizeof (UINT16));
320 ASSERT (NewOptionOrder !=
NULL);
321 if (OptionOrderSize != 0) {
322 CopyMem (NewOptionOrder, OptionOrder, Position *
sizeof (UINT16));
323 CopyMem (&NewOptionOrder[Position + 1], &OptionOrder[Position], OptionOrderSize - Position *
sizeof (UINT16));
326 NewOptionOrder[Position] = OptionNumber;
328 Status =
gRT->SetVariable (
330 &gEfiGlobalVariableGuid,
332 OptionOrderSize +
sizeof (UINT16),
338 if (OptionOrder !=
NULL) {
375 if (Option ==
NULL) {
376 return EFI_INVALID_PARAMETER;
379 if ((Option->OptionType != LoadOptionTypeDriver) &&
380 (Option->OptionType != LoadOptionTypeSysPrep) &&
381 (Option->OptionType != LoadOptionTypeBoot)
384 return EFI_INVALID_PARAMETER;
390 if (Option->OptionNumber == LoadOptionNumberUnassigned) {
392 if (EFI_ERROR (Status)) {
396 Option->OptionNumber = OptionNumber;
399 if (Option->OptionNumber >= LoadOptionNumberMax) {
400 return EFI_INVALID_PARAMETER;
404 if (!EFI_ERROR (Status)) {
409 if (EFI_ERROR (Status)) {
430 EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,
431 SORT_COMPARE CompareFunction
436 UINTN LoadOptionCount;
455 OptionOrder =
AllocatePool (LoadOptionCount *
sizeof (UINT16));
456 ASSERT (OptionOrder !=
NULL);
457 for (Index = 0; Index < LoadOptionCount; Index++) {
458 OptionOrder[Index] = (UINT16)LoadOption[Index].OptionNumber;
461 Status =
gRT->SetVariable (
462 mBmLoadOptionOrderName[OptionType],
463 &gEfiGlobalVariableGuid,
465 LoadOptionCount *
sizeof (UINT16),
497 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType,
498 IN UINT32 Attributes,
499 IN CHAR16 *Description,
501 IN UINT8 *OptionalData OPTIONAL,
502 IN UINT32 OptionalDataSize
505 if ((Option ==
NULL) || (Description ==
NULL) || (FilePath ==
NULL)) {
506 return EFI_INVALID_PARAMETER;
509 if (((OptionalData !=
NULL) && (OptionalDataSize == 0)) ||
510 ((OptionalData ==
NULL) && (OptionalDataSize != 0)))
512 return EFI_INVALID_PARAMETER;
515 if ((UINT32)OptionType >= LoadOptionTypeMax) {
516 return EFI_INVALID_PARAMETER;
520 Option->OptionNumber = OptionNumber;
521 Option->OptionType = OptionType;
522 Option->Attributes = Attributes;
525 if (OptionalData !=
NULL) {
527 Option->OptionalDataSize = OptionalDataSize;
556 for (Index = 0; Index < Count; Index++) {
557 if ((Key->OptionType == Array[Index].OptionType) &&
558 (Key->Attributes == Array[Index].Attributes) &&
559 (
StrCmp (Key->Description, Array[Index].Description) == 0) &&
561 (Key->OptionalDataSize == Array[Index].OptionalDataSize) &&
562 (
CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->OptionalDataSize) == 0))
586 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType
590 UINTN OptionOrderSize;
592 CHAR16 OptionName[BM_OPTION_NAME_LEN];
594 if (((UINT32)OptionType >= LoadOptionTypeMax) || (OptionNumber >= LoadOptionNumberMax)) {
595 return EFI_INVALID_PARAMETER;
598 if ((OptionType == LoadOptionTypeDriver) || (OptionType == LoadOptionTypeSysPrep) || (OptionType == LoadOptionTypeBoot)) {
604 ASSERT ((OptionOrder !=
NULL && OptionOrderSize != 0) || (OptionOrder ==
NULL && OptionOrderSize == 0));
606 for (Index = 0; Index < OptionOrderSize /
sizeof (UINT16); Index++) {
607 if (OptionOrder[Index] == OptionNumber) {
608 OptionOrderSize -=
sizeof (UINT16);
609 CopyMem (&OptionOrder[Index], &OptionOrder[Index + 1], OptionOrderSize - Index *
sizeof (UINT16));
611 mBmLoadOptionOrderName[OptionType],
612 &gEfiGlobalVariableGuid,
621 if (OptionOrder !=
NULL) {
629 UnicodeSPrint (OptionName,
sizeof (OptionName), L
"%s%04x", mBmLoadOptionName[OptionType], OptionNumber);
630 return gRT->SetVariable (
632 &gEfiGlobalVariableGuid,
664 if (DevicePath ==
NULL) {
679 if (Size > MaxSize) {
687 if (Size > MaxSize) {
720 ASSERT (String !=
NULL && MaxStringLen != 0);
721 ASSERT (((
UINTN)String & BIT0) == 0);
723 for (Length = 0; *String != L
'\0' && MaxStringLen != Length; String++, Length += 2) {
726 if ((*String != L
'\0') && (MaxStringLen == Length)) {
752 UINTN DescriptionSize;
754 if (VariableSize <=
sizeof (UINT16) +
sizeof (UINT32)) {
761 Variable +=
sizeof (UINT32);
767 Variable +=
sizeof (UINT16);
772 DescriptionSize =
BmStrSizeEx ((CHAR16 *)Variable, VariableSize -
sizeof (UINT16) -
sizeof (UINT32));
773 Variable += DescriptionSize;
783 if ((FilePathSize == 0) || (DescriptionSize == 0)) {
787 if (
sizeof (UINT32) +
sizeof (UINT16) + DescriptionSize + FilePathSize > VariableSize) {
809 IN CHAR16 *VariableName,
810 OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL,
811 OUT UINT16 *OptionNumber OPTIONAL
814 UINTN VariableNameLen;
817 EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LocalOptionType;
818 UINT16 LocalOptionNumber;
820 if (VariableName ==
NULL) {
824 VariableNameLen =
StrLen (VariableName);
829 if (VariableNameLen <= 4) {
836 for (LocalOptionType = 0; LocalOptionType <
ARRAY_SIZE (mBmLoadOptionName); LocalOptionType++) {
837 if ((VariableNameLen - 4 ==
StrLen (mBmLoadOptionName[LocalOptionType])) &&
838 (
StrnCmp (VariableName, mBmLoadOptionName[LocalOptionType], VariableNameLen - 4) == 0)
845 if (LocalOptionType ==
ARRAY_SIZE (mBmLoadOptionName)) {
852 LocalOptionNumber = 0;
853 for (Index = VariableNameLen - 4; Index < VariableNameLen; Index++) {
858 LocalOptionNumber = (UINT16)Uint + LocalOptionNumber * 0x10;
862 if (Index != VariableNameLen) {
866 if (OptionType !=
NULL) {
867 *OptionType = LocalOptionType;
870 if (OptionNumber !=
NULL) {
871 *OptionNumber = LocalOptionNumber;
891 IN CHAR16 *VariableName,
904 UINT32 OptionalDataSize;
906 EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType;
909 if ((VariableName ==
NULL) || (Option ==
NULL)) {
910 return EFI_INVALID_PARAMETER;
914 return EFI_INVALID_PARAMETER;
920 GetVariable2 (VariableName, VendorGuid, (VOID **)&Variable, &VariableSize);
921 if (Variable ==
NULL) {
922 return EFI_NOT_FOUND;
930 return EFI_INVALID_PARAMETER;
936 VariablePtr = Variable;
938 VariablePtr +=
sizeof (UINT32);
944 VariablePtr +=
sizeof (UINT16);
949 Description = (CHAR16 *)VariablePtr;
954 VariablePtr +=
StrSize ((CHAR16 *)VariablePtr);
960 VariablePtr += FilePathSize;
962 OptionalDataSize = (UINT32)(VariableSize - ((
UINTN)VariablePtr - (
UINTN)Variable));
963 if (OptionalDataSize == 0) {
966 OptionalData = VariablePtr;
981 CopyGuid (&Option->VendorGuid, VendorGuid);
999 IN CHAR16 *VariableName,
1007 EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType;
1029 EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType;
1030 UINT16 OptionNumber;
1038 (Param->OptionType == LoadOptionTypePlatformRecovery) &&
1040 (OptionType == LoadOptionTypePlatformRecovery)
1044 if (!EFI_ERROR (Status)) {
1045 for (Index = 0; Index < Param->OptionCount; Index++) {
1046 if (Param->Options[Index].OptionNumber > Option.OptionNumber) {
1056 ASSERT (Param->Options !=
NULL);
1059 Param->OptionCount++;
1080 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType
1084 UINT16 *OptionOrder;
1085 UINTN OptionOrderSize;
1089 CHAR16 OptionName[BM_OPTION_NAME_LEN];
1090 UINT16 OptionNumber;
1096 if ((LoadOptionType == LoadOptionTypeDriver) || (LoadOptionType == LoadOptionTypeSysPrep) || (LoadOptionType == LoadOptionTypeBoot)) {
1100 GetEfiGlobalVariable2 (mBmLoadOptionOrderName[LoadOptionType], (VOID **)&OptionOrder, &OptionOrderSize);
1101 if (OptionOrder ==
NULL) {
1105 *OptionCount = OptionOrderSize /
sizeof (UINT16);
1108 ASSERT (Options !=
NULL);
1111 for (Index = 0; Index < *OptionCount; Index++) {
1112 OptionNumber = OptionOrder[Index];
1113 UnicodeSPrint (OptionName,
sizeof (OptionName), L
"%s%04x", mBmLoadOptionName[LoadOptionType], OptionNumber);
1116 if (EFI_ERROR (Status)) {
1117 DEBUG ((DEBUG_INFO,
"[Bds] %s doesn't exist - Update ****Order variable to remove the reference!!", OptionName));
1120 ASSERT (Options[OptionIndex].OptionNumber == OptionNumber);
1125 if (OptionOrder !=
NULL) {
1129 if (OptionIndex < *OptionCount) {
1131 ASSERT (Options !=
NULL);
1132 *OptionCount = OptionIndex;
1134 }
else if (LoadOptionType == LoadOptionTypePlatformRecovery) {
1135 Param.OptionType = LoadOptionTypePlatformRecovery;
1136 Param.Options =
NULL;
1137 Param.OptionCount = 0;
1138 Param.Guid = &gEfiGlobalVariableGuid;
1142 *OptionCount = Param.OptionCount;
1143 Options = Param.Options;
1164 if (LoadOption ==
NULL) {
1165 return EFI_NOT_FOUND;
1168 if (LoadOption->Description !=
NULL) {
1169 FreePool (LoadOption->Description);
1172 if (LoadOption->FilePath !=
NULL) {
1176 if (LoadOption->OptionalData !=
NULL) {
1177 FreePool (LoadOption->OptionalData);
1203 if (Option ==
NULL) {
1204 return EFI_NOT_FOUND;
1207 for (Index = 0; Index < OptionCount; Index++) {
1232 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE Type,
1233 IN VOID *FileBuffer,
1242 if ((FileBuffer ==
NULL) || (FileSize == 0)) {
1251 (FileSize > DosHeader->
e_lfanew) && (DosHeader->
e_magic == EFI_IMAGE_DOS_SIGNATURE)
1259 (PeHeader->Pe32.Signature == EFI_IMAGE_NT_SIGNATURE)
1274 Subsystem = OptionalHeader->Subsystem;
1275 if ((Type == LoadOptionTypeMax) ||
1276 ((Type == LoadOptionTypeDriver) && (Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER)) ||
1277 ((Type == LoadOptionTypeDriver) && (Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)) ||
1278 ((Type == LoadOptionTypeSysPrep) && (Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) ||
1279 ((Type == LoadOptionTypeBoot) && (Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION)) ||
1280 ((Type == LoadOptionTypePlatformRecovery) && (Subsystem == EFI_IMAGE_SUBSYSTEM_EFI_APPLICATION))
1314 IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE Type,
1323 UINTN LocalFileSize;
1324 UINT32 AuthenticationStatus;
1329 CurFullPath = *FullPath;
1331 PreFullPath = CurFullPath;
1336 if ((PreFullPath !=
NULL) && (PreFullPath != *FullPath)) {
1340 if (CurFullPath ==
NULL) {
1350 if (RamDiskDevicePath !=
NULL) {
1361 }
while (FileBuffer ==
NULL);
1363 if (FileBuffer ==
NULL) {
1368 DEBUG ((DEBUG_INFO,
"[Bds] Expand "));
1370 DEBUG ((DEBUG_INFO,
" -> "));
1372 DEBUG ((DEBUG_INFO,
"\n"));
1374 *FullPath = CurFullPath;
1375 *FileSize = LocalFileSize;
1403 if ((UINT32)LoadOption->OptionType >= LoadOptionTypeMax) {
1404 return EFI_INVALID_PARAMETER;
1407 if (LoadOption->OptionType == LoadOptionTypeBoot) {
1408 return EFI_UNSUPPORTED;
1415 if ((LoadOption->Attributes & LOAD_OPTION_ACTIVE) == 0) {
1419 if (LoadOption->OptionType == LoadOptionTypePlatformRecovery) {
1434 DEBUG_INFO | DEBUG_LOAD,
1435 "Process %s%04x (%s) ...\n",
1436 mBmLoadOptionName[LoadOption->OptionType],
1437 LoadOption->OptionNumber,
1438 LoadOption->Description
1448 Status = EFI_INVALID_PARAMETER;
1449 PreFullPath = CurFullPath;
1451 if (PreFullPath !=
NULL) {
1455 if (FileBuffer ==
NULL) {
1459 Status =
gBS->LoadImage (
1469 if (EFI_ERROR (Status)) {
1476 if (Status == EFI_SECURITY_VIOLATION) {
1477 gBS->UnloadImage (ImageHandle);
1480 Status =
gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **)&ImageInfo);
1483 ImageInfo->LoadOptionsSize = LoadOption->OptionalDataSize;
1484 ImageInfo->LoadOptions = LoadOption->OptionalData;
1488 gBS->SetWatchdogTimer (5 * 60, 0, 0,
NULL);
1490 LoadOption->Status =
gBS->StartImage (ImageHandle, &LoadOption->ExitDataSize, &LoadOption->ExitData);
1492 DEBUG_INFO | DEBUG_LOAD,
1493 "%s%04x Return Status = %r\n",
1494 mBmLoadOptionName[LoadOption->OptionType],
1495 LoadOption->OptionNumber,
1502 gBS->SetWatchdogTimer (0, 0, 0,
NULL);
1504 if ((LoadOption->OptionType != LoadOptionTypePlatformRecovery) || (LoadOption->Status ==
EFI_SUCCESS)) {
1510 if (CurFullPath !=
NULL) {
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
UINT16 EFIAPI ReadUnaligned16(IN CONST UINT16 *Buffer)
INTN EFIAPI StrnCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length)
UINT32 EFIAPI WriteUnaligned32(OUT UINT32 *Buffer, IN UINT32 Value)
UINT16 EFIAPI WriteUnaligned16(OUT UINT16 *Buffer, IN UINT16 Value)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
UINT32 EFIAPI ReadUnaligned32(IN CONST UINT32 *Buffer)
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)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_DEVICE_PATH_PROTOCOL * BmGetNextLoadOptionDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN EFI_DEVICE_PATH_PROTOCOL *FullPath)
EFI_DEVICE_PATH_PROTOCOL * BmGetRamDiskDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
VOID BmDestroyRamDisk(IN EFI_DEVICE_PATH_PROTOCOL *RamDiskDevicePath)
VOID BmForEachVariable(BM_VARIABLE_VISITOR Visitor, VOID *Context)
EFI_STATUS EFIAPI EfiBootManagerFreeLoadOption(IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption)
VOID * BmGetNextLoadOptionBuffer(IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE Type, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, OUT EFI_DEVICE_PATH_PROTOCOL **FullPath, OUT UINTN *FileSize)
BOOLEAN BmValidateOption(UINT8 *Variable, UINTN VariableSize)
UINTN BmGetDevicePathSizeEx(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINTN MaxSize)
EFI_STATUS EFIAPI EfiBootManagerAddLoadOptionVariable(IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, IN UINTN Position)
INTN EFIAPI EfiBootManagerFindLoadOption(IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key, IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array, IN UINTN Count)
VOID EFIAPI EfiBootManagerSortLoadOptionVariable(EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType, SORT_COMPARE CompareFunction)
EFI_STATUS BmAddOptionNumberToOrderVariable(IN CHAR16 *OptionOrderName, IN UINT16 OptionNumber, IN UINTN Position)
EFI_BOOT_MANAGER_LOAD_OPTION *EFIAPI EfiBootManagerGetLoadOptions(OUT UINTN *OptionCount, IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType)
EFI_STATUS EFIAPI EfiBootManagerDeleteLoadOptionVariable(IN UINTN OptionNumber, IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType)
EFI_STATUS EFIAPI EfiBootManagerVariableToLoadOptionEx(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid, IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option)
BOOLEAN EFIAPI EfiBootManagerIsValidLoadOptionVariableName(IN CHAR16 *VariableName, OUT EFI_BOOT_MANAGER_LOAD_OPTION_TYPE *OptionType OPTIONAL, OUT UINT16 *OptionNumber OPTIONAL)
EFI_STATUS EFIAPI EfiBootManagerVariableToLoadOption(IN CHAR16 *VariableName, IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option)
EFI_STATUS EFIAPI EfiBootManagerProcessLoadOption(IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption)
UINTN BmStrSizeEx(IN CONST CHAR16 *String, IN UINTN MaxStringLen)
VOID BmCollectLoadOptions(IN CHAR16 *Name, IN EFI_GUID *Guid, IN VOID *Context)
EFI_STATUS EFIAPI EfiBootManagerLoadOptionToVariable(IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Option)
EFI_STATUS EFIAPI EfiBootManagerFreeLoadOptions(IN EFI_BOOT_MANAGER_LOAD_OPTION *Option, IN UINTN OptionCount)
EFI_STATUS EFIAPI EfiBootManagerInitializeLoadOption(IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, IN UINTN OptionNumber, IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType, IN UINT32 Attributes, IN CHAR16 *Description, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN UINT8 *OptionalData OPTIONAL, IN UINT32 OptionalDataSize)
EFI_STATUS BmGetFreeOptionNumber(IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE LoadOptionType, OUT UINT16 *FreeOptionNumber)
BOOLEAN BmIsLoadOptionPeHeaderValid(IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE Type, IN VOID *FileBuffer, IN UINTN FileSize)
VOID BmPrintDp(EFI_DEVICE_PATH_PROTOCOL *DevicePath)
UINTN BmCharToUint(IN CHAR16 Char)
UINTN EFIAPI DevicePathNodeLength(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID *EFIAPI GetFileBufferByFilePath(IN BOOLEAN BootPolicy, IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath, OUT UINTN *FileSize, OUT UINT32 *AuthenticationStatus)
VOID *EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define EFI_BOOT_ORDER_VARIABLE_NAME
#define EFI_SYS_PREP_ORDER_VARIABLE_NAME
#define EFI_DRIVER_ORDER_VARIABLE_NAME
VOID(* BM_VARIABLE_VISITOR)(CHAR16 *Name, EFI_GUID *Guid, VOID *Context)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
EFI_RUNTIME_SERVICES * gRT
#define ARRAY_SIZE(Array)
#define GLOBAL_REMOVE_IF_UNREFERENCED
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define REPORT_STATUS_CODE(Type, Value)
#define EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC
#define EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC
#define EFI_PROGRESS_CODE
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID EFIAPI PerformQuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN SORT_COMPARE CompareFunction)
EFI_STATUS EFIAPI EfiBootManagerConnectDevicePath(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect, OUT EFI_HANDLE *MatchingHandle OPTIONAL)
EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
VOID EFIAPI EfiSignalEventReadyToBoot(VOID)
#define EFI_VARIABLE_NON_VOLATILE
UINT32 e_lfanew
File address of new exe header.
UINT16 e_magic
Magic number.