/** @file\r
Library functions which relates with booting.\r
\r
-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
(C) Copyright 2015-2016 Hewlett Packard Enterprise Development LP<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
return FileBuffer;\r
}\r
\r
+ Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
//\r
- // For device boot option only pointing to the removable device handle, \r
- // should make sure all its children handles (its child partion or media handles) are created and connected. \r
+ // For device boot option only pointing to the removable device handle,\r
+ // should make sure all its children handles (its child partion or media handles)\r
+ // are created and connected.\r
//\r
gBS->ConnectController (Handle, NULL, NULL, TRUE);\r
\r
// returned. After the Block IO protocol is reinstalled, subsequent\r
// Block IO read/write will success.\r
//\r
- Status = gBS->LocateDevicePath (&gEfiBlockIoProtocolGuid, &TempDevicePath, &Handle);\r
- ASSERT_EFI_ERROR (Status);\r
Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);\r
ASSERT_EFI_ERROR (Status);\r
Buffer = AllocatePool (BlockIo->Media->BlockSize);\r
UINTN Removable;\r
UINTN Index;\r
CHAR16 *Description;\r
- UINT32 BootAttributes;\r
\r
ASSERT (BootOptionCount != NULL);\r
\r
&Handles\r
);\r
for (Index = 0; Index < HandleCount; Index++) {\r
+ //\r
+ // Ignore BootManagerMenu. its boot option will be created by EfiBootManagerGetBootManagerMenu().\r
+ //\r
+ if (BmIsBootManagerMenuFilePath (DevicePathFromHandle (Handles[Index]))) {\r
+ continue;\r
+ }\r
\r
Description = BmGetBootDescription (Handles[Index]);\r
BootOptions = ReallocatePool (\r
);\r
ASSERT (BootOptions != NULL);\r
\r
- //\r
- // If LoadFile includes BootManagerMenu, its boot attribue will be set to APP and HIDDEN.\r
- //\r
- BootAttributes = LOAD_OPTION_ACTIVE;\r
- if (BmIsBootManagerMenuFilePath (DevicePathFromHandle (Handles[Index]))) {\r
- BootAttributes = LOAD_OPTION_CATEGORY_APP | LOAD_OPTION_ACTIVE | LOAD_OPTION_HIDDEN;\r
- }\r
-\r
Status = EfiBootManagerInitializeLoadOption (\r
&BootOptions[(*BootOptionCount)++],\r
LoadOptionNumberUnassigned,\r
LoadOptionTypeBoot,\r
- BootAttributes,\r
+ LOAD_OPTION_ACTIVE,\r
Description,\r
DevicePathFromHandle (Handles[Index]),\r
NULL,\r
// Only check those added by BDS\r
// so that the boot options added by end-user or OS installer won't be deleted\r
//\r
- if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], BootOptions, BootOptionCount) == (UINTN) -1) {\r
+ if (EfiBootManagerFindLoadOption (&NvBootOptions[Index], BootOptions, BootOptionCount) == -1) {\r
Status = EfiBootManagerDeleteLoadOptionVariable (NvBootOptions[Index].OptionNumber, LoadOptionTypeBoot);\r
//\r
// Deleting variable with current variable implementation shouldn't fail.\r
// Add new EFI boot options to NV\r
//\r
for (Index = 0; Index < BootOptionCount; Index++) {\r
- if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == (UINTN) -1) {\r
+ if (EfiBootManagerFindLoadOption (&BootOptions[Index], NvBootOptions, NvBootOptionCount) == -1) {\r
EfiBootManagerAddLoadOptionVariable (&BootOptions[Index], (UINTN) -1);\r
//\r
// Try best to add the boot options so continue upon failure.\r