/** @file\r
The boot manager reference implementation\r
\r
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under\r
-the terms and conditions of the BSD License that accompanies this distribution.\r
-The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\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
\r
/**\r
This function will change video resolution and text mode\r
- according to defined setup mode or defined boot mode \r
+ according to defined setup mode or defined boot mode\r
\r
- @param IsSetupMode Indicate mode is changed to setup mode or boot mode. \r
+ @param IsSetupMode Indicate mode is changed to setup mode or boot mode.\r
\r
@retval EFI_SUCCESS Mode is changed successfully.\r
@retval Others Mode failed to be changed.\r
EFI_STATUS Status;\r
UINTN Index;\r
UINTN CurrentColumn;\r
- UINTN CurrentRow; \r
+ UINTN CurrentRow;\r
\r
MaxGopMode = 0;\r
MaxTextMode = 0;\r
\r
//\r
- // Get current video resolution and text mode \r
+ // Get current video resolution and text mode\r
//\r
Status = gBS->HandleProtocol (\r
gST->ConsoleOutHandle,\r
\r
if (IsSetupMode) {\r
//\r
- // The requried resolution and text mode is setup mode.\r
+ // The required resolution and text mode is setup mode.\r
//\r
NewHorizontalResolution = mBmSetupHorizontalResolution;\r
NewVerticalResolution = mBmSetupVerticalResolution;\r
NewHorizontalResolution = mBmBootHorizontalResolution;\r
NewVerticalResolution = mBmBootVerticalResolution;\r
NewColumns = mBmBootTextModeColumn;\r
- NewRows = mBmBootTextModeRow; \r
+ NewRows = mBmBootTextModeRow;\r
}\r
\r
if (GraphicsOutput != NULL) {\r
return EFI_SUCCESS;\r
} else {\r
//\r
- // If current text mode is different from requried text mode. Set new video mode\r
+ // If current text mode is different from required text mode. Set new video mode\r
//\r
for (Index = 0; Index < MaxTextMode; Index++) {\r
Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);\r
}\r
if (Index == MaxTextMode) {\r
//\r
- // If requried text mode is not supported, return error.\r
+ // If required text mode is not supported, return error.\r
//\r
FreePool (Info);\r
return EFI_UNSUPPORTED;\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+\r
+ Check whether a reset is needed,if reset is needed, Popup a menu to notice user.\r
+\r
+**/\r
+VOID\r
+BmSetupResetReminder (\r
+ VOID\r
+ )\r
+{\r
+ EFI_INPUT_KEY Key;\r
+ CHAR16 *StringBuffer1;\r
+ CHAR16 *StringBuffer2;\r
+ EFI_STATUS Status;\r
+ EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;\r
+\r
+ //\r
+ // Use BrowserEx2 protocol to check whether reset is required.\r
+ //\r
+ Status = gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL, (VOID **) &FormBrowserEx2);\r
+ //\r
+ //check any reset required change is applied? if yes, reset system\r
+ //\r
+ if (!EFI_ERROR(Status) && FormBrowserEx2->IsResetRequired ()) {\r
+ StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+ ASSERT (StringBuffer1 != NULL);\r
+ StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+ ASSERT (StringBuffer2 != NULL);\r
+ StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now.");\r
+ StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");\r
+ //\r
+ // Popup a menu to notice user\r
+ //\r
+ do {\r
+ CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);\r
+ } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+\r
+ FreePool (StringBuffer1);\r
+ FreePool (StringBuffer2);\r
+\r
+ gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
+ }\r
+}\r
+\r
/**\r
Group the legacy boot options in the BootOption.\r
\r
- The routine assumes the boot options in the beginning that covers all the device \r
+ The routine assumes the boot options in the beginning that covers all the device\r
types are ordered properly and re-position the following boot options just after\r
the corresponding boot options with the same device type.\r
For example:\r
//\r
// Legacy Boot Option\r
//\r
- DEBUG ((EFI_D_ERROR, "[BootManagerDxe] ==== Find Legacy Boot Option 0x%x! ==== \n", Index));\r
- ASSERT ((((BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType & 0xF) < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]));\r
+ DEBUG ((DEBUG_ERROR, "[BootManagerDxe] ==== Find Legacy Boot Option 0x%x! ==== \n", Index));\r
+ ASSERT ((((BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType & 0xF) < ARRAY_SIZE (DeviceTypeIndex));\r
NextIndex = &DeviceTypeIndex[((BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType & 0xF];\r
\r
if (*NextIndex == (UINTN) -1) {\r
//\r
// Update the DeviceTypeIndex array to reflect the right shift operation\r
//\r
- for (DeviceIndex = 0; DeviceIndex < sizeof (DeviceTypeIndex) / sizeof (DeviceTypeIndex[0]); DeviceIndex++) {\r
+ for (DeviceIndex = 0; DeviceIndex < ARRAY_SIZE (DeviceTypeIndex); DeviceIndex++) {\r
if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && DeviceTypeIndex[DeviceIndex] >= *NextIndex) {\r
DeviceTypeIndex[DeviceIndex]++;\r
}\r
This function invokes Boot Manager. 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
UpdateBootManager (\r
mKeyInput++;\r
\r
//\r
- // Don't display the hidden/inactive boot option\r
+ // Don't display hidden boot options, but retain inactive ones.\r
//\r
- if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) {\r
+ if ((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) {\r
continue;\r
}\r
\r
NeedEndOp = FALSE;\r
HiiCreateEndOpCode (StartOpCodeHandle);\r
}\r
- \r
+\r
if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->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
gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
gST->ConOut->ClearScreen (gST->ConOut);\r
\r
+ //\r
+ //check any reset required change is applied? if yes, reset system\r
+ //\r
+ BmSetupResetReminder ();\r
+\r
//\r
// parse the selected option\r
//\r
\r
return EFI_SUCCESS;\r
}\r
-\r