/** @file\r
The platform boot manager reference implementation\r
\r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
#include "BootManager.h"\r
\r
UINT16 mKeyInput;\r
-EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;\r
LIST_ENTRY mBootOptionsList;\r
BDS_COMMON_OPTION *gOption;\r
CHAR16 *mDeviceTypeStr[] = {\r
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
}\r
},\r
- //\r
- // {1DDDBE15-481D-4d2b-8277-B191EAF66525}\r
- //\r
- { 0x1dddbe15, 0x481d, 0x4d2b, { 0x82, 0x77, 0xb1, 0x91, 0xea, 0xf6, 0x65, 0x25 } }\r
+ BOOT_MANAGER_FORMSET_GUID\r
},\r
{\r
END_DEVICE_PATH_TYPE,\r
END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
- { \r
+ {\r
(UINT8) (END_DEVICE_PATH_LENGTH),\r
(UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
}\r
LIST_ENTRY *Link;\r
UINT16 KeyCount;\r
\r
- if ((Action == EFI_BROWSER_ACTION_FORM_OPEN) || (Action == EFI_BROWSER_ACTION_FORM_CLOSE)) {\r
+ if (Action == EFI_BROWSER_ACTION_CHANGED) {\r
+ if ((Value == NULL) || (ActionRequest == NULL)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
//\r
- // Do nothing for UEFI OPEN/CLOSE Action\r
+ // Initialize the key count\r
//\r
- return EFI_SUCCESS;\r
- }\r
-\r
- if ((Value == NULL) || (ActionRequest == NULL)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
+ KeyCount = 0;\r
\r
- //\r
- // Initialize the key count\r
- //\r
- KeyCount = 0;\r
-\r
- for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) {\r
- Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);\r
+ for (Link = GetFirstNode (&mBootOptionsList); !IsNull (&mBootOptionsList, Link); Link = GetNextNode (&mBootOptionsList, Link)) {\r
+ Option = CR (Link, BDS_COMMON_OPTION, Link, BDS_LOAD_OPTION_SIGNATURE);\r
\r
- KeyCount++;\r
+ KeyCount++;\r
\r
- gOption = Option;\r
+ gOption = Option;\r
\r
- //\r
- // Is this device the one chosen?\r
- //\r
- if (KeyCount == QuestionId) {\r
//\r
- // Assigning the returned Key to a global allows the original routine to know what was chosen\r
- //\r
- mKeyInput = QuestionId;\r
-\r
+ // Is this device the one chosen?\r
//\r
- // Request to exit SendForm(), so that we could boot the selected option\r
- //\r
- *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
- break;\r
+ if (KeyCount == QuestionId) {\r
+ //\r
+ // Assigning the returned Key to a global allows the original routine to know what was chosen\r
+ //\r
+ mKeyInput = QuestionId;\r
+\r
+ //\r
+ // Request to exit SendForm(), so that we could boot the selected option\r
+ //\r
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+ break;\r
+ }\r
}\r
+\r
+ return EFI_SUCCESS;\r
}\r
\r
- return EFI_SUCCESS;\r
+ //\r
+ // All other action return unsupported.\r
+ //\r
+ return EFI_UNSUPPORTED;\r
}\r
\r
/**\r
// Publish our HII data\r
//\r
gBootManagerPrivate.HiiHandle = HiiAddPackages (\r
- &mBootManagerGuid,\r
+ &gBootManagerFormSetGuid,\r
gBootManagerPrivate.DriverHandle,\r
BootManagerVfrBin,\r
BdsDxeStrings,\r
\r
/**\r
This function invokes Boot Manager. If all devices have not a chance to be connected,\r
- the connect all will be triggered. It then enumerate all boot options. If \r
+ the connect all will be triggered. It then enumerate all boot options. If\r
a boot option from the Boot Manager page is selected, Boot Manager will boot\r
from this boot option.\r
- \r
+\r
**/\r
VOID\r
CallBootManager (\r
EFI_STRING_ID Token;\r
EFI_INPUT_KEY Key;\r
CHAR16 *HelpString;\r
+ UINTN HelpSize;\r
EFI_STRING_ID HelpToken;\r
UINT16 *TempStr;\r
EFI_HII_HANDLE HiiHandle;\r
EFI_BROWSER_ACTION_REQUEST ActionRequest;\r
- UINTN TempSize;\r
VOID *StartOpCodeHandle;\r
VOID *EndOpCodeHandle;\r
EFI_IFR_GUID_LABEL *StartLabel;\r
\r
BdsLibEnumerateAllBootOption (&mBootOptionsList);\r
\r
+ //\r
+ // Group the legacy boot options for the same device type\r
+ //\r
+ GroupMultipleLegacyBootOption4SameType ();\r
+\r
+ InitializeListHead (&mBootOptionsList);\r
+ BdsLibBuildOptionFromVar (&mBootOptionsList, L"BootOrder");\r
+\r
HiiHandle = gBootManagerPrivate.HiiHandle;\r
\r
//\r
mKeyInput++;\r
\r
//\r
- // Don't display the boot option marked as LOAD_OPTION_HIDDEN\r
+ // Don't display the hidden/inactive boot option\r
//\r
- if ((Option->Attribute & LOAD_OPTION_HIDDEN) != 0) {\r
+ if (((Option->Attribute & LOAD_OPTION_HIDDEN) != 0) || ((Option->Attribute & LOAD_OPTION_ACTIVE) == 0)) {\r
continue;\r
}\r
\r
NeedEndOp = FALSE;\r
HiiCreateEndOpCode (StartOpCodeHandle);\r
}\r
- \r
+\r
if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) Option->DevicePath)->DeviceType) {\r
if (NeedEndOp) {\r
HiiCreateEndOpCode (StartOpCodeHandle);\r
HiiHandle,\r
0,\r
mDeviceTypeStr[\r
- MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1)\r
+ MIN (DeviceType & 0xF, ARRAY_SIZE (mDeviceTypeStr) - 1)\r
],\r
NULL\r
);\r
}\r
\r
ASSERT (Option->Description != NULL);\r
- \r
+\r
Token = HiiSetString (HiiHandle, 0, Option->Description, NULL);\r
\r
TempStr = DevicePathToStr (Option->DevicePath);\r
- TempSize = StrSize (TempStr);\r
- HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : "));\r
+ HelpSize = StrSize (TempStr) + StrSize (L"Device Path : ");\r
+ HelpString = AllocateZeroPool (HelpSize);\r
ASSERT (HelpString != NULL);\r
- StrCat (HelpString, L"Device Path : ");\r
- StrCat (HelpString, TempStr);\r
+ StrCatS (HelpString, HelpSize / sizeof (CHAR16), L"Device Path : ");\r
+ StrCatS (HelpString, HelpSize / sizeof (CHAR16), TempStr);\r
\r
HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);\r
\r
\r
HiiUpdateForm (\r
HiiHandle,\r
- &mBootManagerGuid,\r
+ &gBootManagerFormSetGuid,\r
BOOT_MANAGER_FORM_ID,\r
StartOpCodeHandle,\r
EndOpCodeHandle\r
gFormBrowser2,\r
&HiiHandle,\r
1,\r
- &mBootManagerGuid,\r
+ &gBootManagerFormSetGuid,\r
0,\r
NULL,\r
&ActionRequest\r
//\r
SetupResetReminder ();\r
\r
+ //\r
+ // Restore to original mode before launching boot option.\r
+ //\r
+ BdsSetConsoleMode (FALSE);\r
+\r
//\r
// parse the selected option\r
//\r