+++ /dev/null
-/** @file\r
- The boot manager reference implementation\r
-\r
-Copyright (c) 2004 - 2015, 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
-\r
-**/\r
-\r
-#include "BootManager.h"\r
-\r
-UINT16 mKeyInput;\r
-EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;\r
-//\r
-// Boot video resolution and text mode.\r
-//\r
-UINT32 mBmBootHorizontalResolution = 0;\r
-UINT32 mBmBootVerticalResolution = 0;\r
-UINT32 mBmBootTextModeColumn = 0;\r
-UINT32 mBmBootTextModeRow = 0;\r
-//\r
-// BIOS setup video resolution and text mode.\r
-//\r
-UINT32 mBmSetupTextModeColumn = 0;\r
-UINT32 mBmSetupTextModeRow = 0;\r
-UINT32 mBmSetupHorizontalResolution = 0;\r
-UINT32 mBmSetupVerticalResolution = 0;\r
-\r
-CHAR16 *mDeviceTypeStr[] = {\r
- L"Legacy BEV",\r
- L"Legacy Floppy",\r
- L"Legacy Hard Drive",\r
- L"Legacy CD ROM",\r
- L"Legacy PCMCIA",\r
- L"Legacy USB",\r
- L"Legacy Embedded Network",\r
- L"Legacy Unknown Device"\r
-};\r
-\r
-HII_VENDOR_DEVICE_PATH mBootManagerHiiVendorDevicePath = {\r
- {\r
- {\r
- HARDWARE_DEVICE_PATH,\r
- HW_VENDOR_DP,\r
- {\r
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\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
- },\r
- {\r
- END_DEVICE_PATH_TYPE,\r
- END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
- { \r
- (UINT8) (END_DEVICE_PATH_LENGTH),\r
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
- }\r
- }\r
-};\r
-\r
-BOOT_MANAGER_CALLBACK_DATA gBootManagerPrivate = {\r
- BOOT_MANAGER_CALLBACK_DATA_SIGNATURE,\r
- NULL,\r
- NULL,\r
- {\r
- BootManagerExtractConfig,\r
- BootManagerRouteConfig,\r
- BootManagerCallback\r
- }\r
-};\r
-\r
-/**\r
- This function will change video resolution and text 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
-\r
- @retval EFI_SUCCESS Mode is changed successfully.\r
- @retval Others Mode failed to be changed.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BmBdsSetConsoleMode (\r
- BOOLEAN IsSetupMode\r
- )\r
-{\r
- EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
- EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;\r
- UINTN SizeOfInfo;\r
- EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
- UINT32 MaxGopMode;\r
- UINT32 MaxTextMode;\r
- UINT32 ModeNumber;\r
- UINT32 NewHorizontalResolution;\r
- UINT32 NewVerticalResolution;\r
- UINT32 NewColumns;\r
- UINT32 NewRows;\r
- UINTN HandleCount;\r
- EFI_HANDLE *HandleBuffer;\r
- EFI_STATUS Status;\r
- UINTN Index;\r
- UINTN CurrentColumn;\r
- UINTN CurrentRow; \r
-\r
- MaxGopMode = 0;\r
- MaxTextMode = 0;\r
-\r
- //\r
- // Get current video resolution and text mode \r
- //\r
- Status = gBS->HandleProtocol (\r
- gST->ConsoleOutHandle,\r
- &gEfiGraphicsOutputProtocolGuid,\r
- (VOID**)&GraphicsOutput\r
- );\r
- if (EFI_ERROR (Status)) {\r
- GraphicsOutput = NULL;\r
- }\r
-\r
- Status = gBS->HandleProtocol (\r
- gST->ConsoleOutHandle,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- (VOID**)&SimpleTextOut\r
- );\r
- if (EFI_ERROR (Status)) {\r
- SimpleTextOut = NULL;\r
- }\r
-\r
- if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- if (IsSetupMode) {\r
- //\r
- // The requried resolution and text mode is setup mode.\r
- //\r
- NewHorizontalResolution = mBmSetupHorizontalResolution;\r
- NewVerticalResolution = mBmSetupVerticalResolution;\r
- NewColumns = mBmSetupTextModeColumn;\r
- NewRows = mBmSetupTextModeRow;\r
- } else {\r
- //\r
- // The required resolution and text mode is boot mode.\r
- //\r
- NewHorizontalResolution = mBmBootHorizontalResolution;\r
- NewVerticalResolution = mBmBootVerticalResolution;\r
- NewColumns = mBmBootTextModeColumn;\r
- NewRows = mBmBootTextModeRow; \r
- }\r
-\r
- if (GraphicsOutput != NULL) {\r
- MaxGopMode = GraphicsOutput->Mode->MaxMode;\r
- }\r
-\r
- if (SimpleTextOut != NULL) {\r
- MaxTextMode = SimpleTextOut->Mode->MaxMode;\r
- }\r
-\r
- //\r
- // 1. If current video resolution is same with required video resolution,\r
- // video resolution need not be changed.\r
- // 1.1. If current text mode is same with required text mode, text mode need not be changed.\r
- // 1.2. If current text mode is different from required text mode, text mode need be changed.\r
- // 2. If current video resolution is different from required video resolution, we need restart whole console drivers.\r
- //\r
- for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {\r
- Status = GraphicsOutput->QueryMode (\r
- GraphicsOutput,\r
- ModeNumber,\r
- &SizeOfInfo,\r
- &Info\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- if ((Info->HorizontalResolution == NewHorizontalResolution) &&\r
- (Info->VerticalResolution == NewVerticalResolution)) {\r
- if ((GraphicsOutput->Mode->Info->HorizontalResolution == NewHorizontalResolution) &&\r
- (GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution)) {\r
- //\r
- // Current resolution is same with required resolution, check if text mode need be set\r
- //\r
- Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);\r
- ASSERT_EFI_ERROR (Status);\r
- if (CurrentColumn == NewColumns && CurrentRow == NewRows) {\r
- //\r
- // If current text mode is same with required text mode. Do nothing\r
- //\r
- FreePool (Info);\r
- return EFI_SUCCESS;\r
- } else {\r
- //\r
- // If current text mode is different from requried text mode. Set new video mode\r
- //\r
- for (Index = 0; Index < MaxTextMode; Index++) {\r
- Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);\r
- if (!EFI_ERROR(Status)) {\r
- if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {\r
- //\r
- // Required text mode is supported, set it.\r
- //\r
- Status = SimpleTextOut->SetMode (SimpleTextOut, Index);\r
- ASSERT_EFI_ERROR (Status);\r
- //\r
- // Update text mode PCD.\r
- //\r
- Status = PcdSet32S (PcdConOutColumn, mBmSetupTextModeColumn);\r
- ASSERT_EFI_ERROR (Status);\r
- Status = PcdSet32S (PcdConOutRow, mBmSetupTextModeRow);\r
- ASSERT_EFI_ERROR (Status);\r
- FreePool (Info);\r
- return EFI_SUCCESS;\r
- }\r
- }\r
- }\r
- if (Index == MaxTextMode) {\r
- //\r
- // If requried text mode is not supported, return error.\r
- //\r
- FreePool (Info);\r
- return EFI_UNSUPPORTED;\r
- }\r
- }\r
- } else {\r
- //\r
- // If current video resolution is not same with the new one, set new video resolution.\r
- // In this case, the driver which produces simple text out need be restarted.\r
- //\r
- Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);\r
- if (!EFI_ERROR (Status)) {\r
- FreePool (Info);\r
- break;\r
- }\r
- }\r
- }\r
- FreePool (Info);\r
- }\r
- }\r
-\r
- if (ModeNumber == MaxGopMode) {\r
- //\r
- // If the resolution is not supported, return error.\r
- //\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- //\r
- // Set PCD to Inform GraphicsConsole to change video resolution.\r
- // Set PCD to Inform Consplitter to change text mode.\r
- //\r
- Status = PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);\r
- ASSERT_EFI_ERROR (Status);\r
- Status = PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);\r
- ASSERT_EFI_ERROR (Status);\r
- Status = PcdSet32S (PcdConOutColumn, NewColumns);\r
- ASSERT_EFI_ERROR (Status);\r
- Status = PcdSet32S (PcdConOutRow, NewRows);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Video mode is changed, so restart graphics console driver and higher level driver.\r
- // Reconnect graphics console driver and higher level driver.\r
- // Locate all the handles with GOP protocol and reconnect it.\r
- //\r
- Status = gBS->LocateHandleBuffer (\r
- ByProtocol,\r
- &gEfiSimpleTextOutProtocolGuid,\r
- NULL,\r
- &HandleCount,\r
- &HandleBuffer\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- for (Index = 0; Index < HandleCount; Index++) {\r
- gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);\r
- }\r
- for (Index = 0; Index < HandleCount; Index++) {\r
- gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);\r
- }\r
- if (HandleBuffer != NULL) {\r
- FreePool (HandleBuffer);\r
- }\r
- }\r
-\r
- return EFI_SUCCESS;\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
- 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
- 1. Input = [Harddisk1 CdRom2 Efi1 Harddisk0 CdRom0 CdRom1 Harddisk2 Efi0]\r
- Assuming [Harddisk1 CdRom2 Efi1] is ordered properly\r
- Output = [Harddisk1 Harddisk0 Harddisk2 CdRom2 CdRom0 CdRom1 Efi1 Efi0]\r
-\r
- 2. Input = [Efi1 Efi0 CdRom1 Harddisk0 Harddisk1 Harddisk2 CdRom0 CdRom2]\r
- Assuming [Efi1 Efi0 CdRom1 Harddisk0] is ordered properly\r
- Output = [Efi1 Efi0 CdRom1 CdRom0 CdRom2 Harddisk0 Harddisk1 Harddisk2]\r
-\r
-**/\r
-VOID\r
-GroupMultipleLegacyBootOption4SameType (\r
- VOID\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINTN Index;\r
- UINTN DeviceIndex;\r
- UINTN DeviceTypeIndex[7];\r
- UINTN *NextIndex;\r
- UINT16 OptionNumber;\r
- UINT16 *BootOrder;\r
- UINTN BootOrderSize;\r
- CHAR16 OptionName[sizeof ("Boot####")];\r
- EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
-\r
- SetMem (DeviceTypeIndex, sizeof (DeviceTypeIndex), 0xff);\r
-\r
- GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSize);\r
- if (BootOrder == NULL) {\r
- return;\r
- }\r
-\r
- for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {\r
- UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]);\r
- Status = EfiBootManagerVariableToLoadOption (OptionName, &BootOption);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- if ((DevicePathType (BootOption.FilePath) == BBS_DEVICE_PATH) &&\r
- (DevicePathSubType (BootOption.FilePath) == BBS_BBS_DP)) {\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
- NextIndex = &DeviceTypeIndex[((BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType & 0xF];\r
-\r
- if (*NextIndex == (UINTN) -1) {\r
- //\r
- // *NextIndex is the Index in BootOrder to put the next Option Number for the same type\r
- //\r
- *NextIndex = Index + 1;\r
- } else {\r
- //\r
- // insert the current boot option before *NextIndex, causing [*Next .. Index] shift right one position\r
- //\r
- OptionNumber = BootOrder[Index];\r
- CopyMem (&BootOrder[*NextIndex + 1], &BootOrder[*NextIndex], (Index - *NextIndex) * sizeof (UINT16));\r
- BootOrder[*NextIndex] = OptionNumber;\r
-\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
- if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && DeviceTypeIndex[DeviceIndex] >= *NextIndex) {\r
- DeviceTypeIndex[DeviceIndex]++;\r
- }\r
- }\r
- }\r
- }\r
- EfiBootManagerFreeLoadOption (&BootOption);\r
- }\r
-\r
- gRT->SetVariable (\r
- L"BootOrder",\r
- &gEfiGlobalVariableGuid,\r
- VAR_FLAG,\r
- BootOrderSize,\r
- BootOrder\r
- );\r
- FreePool (BootOrder);\r
-}\r
-\r
-/**\r
- This function converts an input device structure to a Unicode string.\r
-\r
- @param DevPath A pointer to the device path structure.\r
-\r
- @return A new allocated Unicode string that represents the device path.\r
-\r
-**/\r
-CHAR16 *\r
-BmDevicePathToStr (\r
- IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
- )\r
-{\r
- EFI_STATUS Status;\r
- CHAR16 *ToText;\r
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;\r
-\r
- if (DevPath == NULL) {\r
- return NULL;\r
- }\r
-\r
- Status = gBS->LocateProtocol (\r
- &gEfiDevicePathToTextProtocolGuid,\r
- NULL,\r
- (VOID **) &DevPathToText\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- ToText = DevPathToText->ConvertDevicePathToText (\r
- DevPath,\r
- FALSE,\r
- TRUE\r
- );\r
- ASSERT (ToText != NULL);\r
- return ToText;\r
-}\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
- a boot option from the Boot Manager page is selected, Boot Manager will boot\r
- from this boot option.\r
- \r
-**/\r
-VOID\r
-UpdateBootManager (\r
- VOID\r
- )\r
-{\r
- UINTN Index;\r
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;\r
- UINTN BootOptionCount;\r
- EFI_STRING_ID Token;\r
- CHAR16 *HelpString;\r
- EFI_STRING_ID HelpToken;\r
- UINT16 *TempStr;\r
- EFI_HII_HANDLE HiiHandle;\r
- UINTN TempSize;\r
- VOID *StartOpCodeHandle;\r
- VOID *EndOpCodeHandle;\r
- EFI_IFR_GUID_LABEL *StartLabel;\r
- EFI_IFR_GUID_LABEL *EndLabel;\r
- UINT16 DeviceType;\r
- BOOLEAN IsLegacyOption;\r
- BOOLEAN NeedEndOp;\r
- UINTN MaxLen;\r
-\r
- DeviceType = (UINT16) -1;\r
-\r
- EfiBootManagerConnectAll ();\r
-\r
- //\r
- // for better user experience\r
- // 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option\r
- // 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option\r
- //\r
- EfiBootManagerRefreshAllBootOption ();\r
-\r
- //\r
- // BdsDxe doesn't group the legacy boot options for the same device type\r
- // It's UI's choice.\r
- //\r
- GroupMultipleLegacyBootOption4SameType ();\r
-\r
- BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);\r
-\r
- HiiHandle = gBootManagerPrivate.HiiHandle;\r
-\r
- //\r
- // Allocate space for creation of UpdateData Buffer\r
- //\r
- StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r
- ASSERT (StartOpCodeHandle != NULL);\r
-\r
- EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r
- ASSERT (EndOpCodeHandle != NULL);\r
-\r
- //\r
- // Create Hii Extend Label OpCode as the start opcode\r
- //\r
- StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
- StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
- StartLabel->Number = LABEL_BOOT_OPTION;\r
-\r
- //\r
- // Create Hii Extend Label OpCode as the end opcode\r
- //\r
- EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
- EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
- EndLabel->Number = LABEL_BOOT_OPTION_END;\r
- mKeyInput = 0;\r
- NeedEndOp = FALSE;\r
- for (Index = 0; Index < BootOptionCount; Index++) {\r
- //\r
- // At this stage we are creating a menu entry, thus the Keys are reproduceable\r
- //\r
- mKeyInput++;\r
-\r
- //\r
- // Don't display the hidden/inactive boot option\r
- //\r
- if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) {\r
- continue;\r
- }\r
-\r
- //\r
- // Group the legacy boot option in the sub title created dynamically\r
- //\r
- IsLegacyOption = (BOOLEAN) (\r
- (DevicePathType (BootOption[Index].FilePath) == BBS_DEVICE_PATH) &&\r
- (DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP)\r
- );\r
-\r
- if (!IsLegacyOption && NeedEndOp) {\r
- NeedEndOp = FALSE;\r
- HiiCreateEndOpCode (StartOpCodeHandle);\r
- }\r
- \r
- if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType) {\r
- if (NeedEndOp) {\r
- HiiCreateEndOpCode (StartOpCodeHandle);\r
- }\r
-\r
- DeviceType = ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType;\r
- Token = HiiSetString (\r
- HiiHandle,\r
- 0,\r
- mDeviceTypeStr[\r
- MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1)\r
- ],\r
- NULL\r
- );\r
- HiiCreateSubTitleOpCode (StartOpCodeHandle, Token, 0, 0, 1);\r
- NeedEndOp = TRUE;\r
- }\r
-\r
- ASSERT (BootOption[Index].Description != NULL);\r
-\r
- Token = HiiSetString (HiiHandle, 0, BootOption[Index].Description, NULL);\r
-\r
- TempStr = BmDevicePathToStr (BootOption[Index].FilePath);\r
- TempSize = StrSize (TempStr);\r
- HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : "));\r
- MaxLen = (TempSize + StrSize (L"Device Path : "))/sizeof(CHAR16);\r
- ASSERT (HelpString != NULL);\r
- StrCatS (HelpString, MaxLen, L"Device Path : ");\r
- StrCatS (HelpString, MaxLen, TempStr);\r
-\r
- HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);\r
-\r
- HiiCreateActionOpCode (\r
- StartOpCodeHandle,\r
- mKeyInput,\r
- Token,\r
- HelpToken,\r
- EFI_IFR_FLAG_CALLBACK,\r
- 0\r
- );\r
- }\r
-\r
- if (NeedEndOp) {\r
- HiiCreateEndOpCode (StartOpCodeHandle);\r
- }\r
-\r
- HiiUpdateForm (\r
- HiiHandle,\r
- &mBootManagerGuid,\r
- BOOT_MANAGER_FORM_ID,\r
- StartOpCodeHandle,\r
- EndOpCodeHandle\r
- );\r
-\r
- HiiFreeOpCodeHandle (StartOpCodeHandle);\r
- HiiFreeOpCodeHandle (EndOpCodeHandle);\r
-\r
- EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);\r
-}\r
-\r
-/**\r
- This function allows a caller to extract the current configuration for one\r
- or more named elements from the target driver.\r
-\r
-\r
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Request A null-terminated Unicode string in <ConfigRequest> format.\r
- @param Progress On return, points to a character in the Request string.\r
- Points to the string's null terminator if request was successful.\r
- Points to the most recent '&' before the first failing name/value\r
- pair (or the beginning of the string if the failure is in the\r
- first name/value pair) if the request was not successful.\r
- @param Results A null-terminated Unicode string in <ConfigAltResp> format which\r
- has all values filled in for the names in the Request string.\r
- String to be allocated by the called function.\r
-\r
- @retval EFI_SUCCESS The Results is filled with the requested values.\r
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerExtractConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Request,\r
- OUT EFI_STRING *Progress,\r
- OUT EFI_STRING *Results\r
- )\r
-{\r
- if (Progress == NULL || Results == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- *Progress = Request;\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- This function processes the results of changes in configuration.\r
-\r
-\r
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Configuration A null-terminated Unicode string in <ConfigResp> format.\r
- @param Progress A pointer to a string filled in with the offset of the most\r
- recent '&' before the first failing name/value pair (or the\r
- beginning of the string if the failure is in the first\r
- name/value pair) or the terminating NULL if all was successful.\r
-\r
- @retval EFI_SUCCESS The Results is processed successfully.\r
- @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerRouteConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Configuration,\r
- OUT EFI_STRING *Progress\r
- )\r
-{\r
- if (Configuration == NULL || Progress == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- *Progress = Configuration;\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- This call back function is registered with Boot Manager formset.\r
- When user selects a boot option, this call back function will\r
- be triggered. The boot option is saved for later processing.\r
-\r
-\r
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Action Specifies the type of action taken by the browser.\r
- @param QuestionId A unique value which is sent to the original exporting driver\r
- so that it can identify the type of data to expect.\r
- @param Type The type of value for the question.\r
- @param Value A pointer to the data being sent to the original exporting driver.\r
- @param ActionRequest On return, points to the action requested by the callback function.\r
-\r
- @retval EFI_SUCCESS The callback successfully handled the action.\r
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerCallback (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN EFI_BROWSER_ACTION Action,\r
- IN EFI_QUESTION_ID QuestionId,\r
- IN UINT8 Type,\r
- IN EFI_IFR_TYPE_VALUE *Value,\r
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
- )\r
-{\r
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;\r
- UINTN BootOptionCount;\r
- EFI_INPUT_KEY Key;\r
-\r
- if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {\r
- //\r
- //Means enter the boot manager form.\r
- //Update the boot manage page,because the boot option may changed.\r
- //\r
- if (QuestionId == 0x1212){\r
- UpdateBootManager();\r
- }\r
- return EFI_SUCCESS;\r
- }\r
-\r
- if (Action != EFI_BROWSER_ACTION_CHANGED) {\r
- //\r
- // Do nothing for other UEFI Action. Only do call back when data is changed.\r
- //\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- if ((Value == NULL) || (ActionRequest == NULL)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);\r
-\r
- //\r
- // Clear the screen before.\r
- //\r
- gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
- gST->ConOut->ClearScreen (gST->ConOut);\r
-\r
- //\r
- // parse the selected option\r
- //\r
- BmBdsSetConsoleMode (FALSE);\r
- EfiBootManagerBoot (&BootOption[QuestionId - 1]);\r
- BmBdsSetConsoleMode (TRUE);\r
-\r
- if (EFI_ERROR (BootOption[QuestionId - 1].Status)) {\r
- gST->ConOut->OutputString (\r
- gST->ConOut,\r
- HiiGetString (gBootManagerPrivate.HiiHandle, STRING_TOKEN (STR_ANY_KEY_CONTINUE), NULL)\r
- );\r
- gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
- }\r
-\r
- EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-\r
- Install Boot Manager Menu driver.\r
-\r
- @param ImageHandle The image handle.\r
- @param SystemTable The system table.\r
-\r
- @retval EFI_SUCEESS Install Boot manager menu success.\r
- @retval Other Return error status.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerLibConstructor (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- //\r
- // Install Device Path Protocol and Config Access protocol to driver handle\r
- //\r
- gBootManagerPrivate.DriverHandle = NULL;\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &gBootManagerPrivate.DriverHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- &mBootManagerHiiVendorDevicePath,\r
- &gEfiHiiConfigAccessProtocolGuid,\r
- &gBootManagerPrivate.ConfigAccess,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Publish our HII data\r
- //\r
- gBootManagerPrivate.HiiHandle = HiiAddPackages (\r
- &mBootManagerGuid,\r
- gBootManagerPrivate.DriverHandle,\r
- BootManagerVfrBin,\r
- BootManagerLibStrings,\r
- NULL\r
- );\r
- ASSERT (gBootManagerPrivate.HiiHandle != NULL);\r
-\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- Unloads the application and its installed protocol.\r
-\r
- @param[in] ImageHandle Handle that identifies the image to be unloaded.\r
- @param[in] SystemTable System Table\r
-\r
- @retval EFI_SUCCESS The image has been unloaded.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerLibDestructor (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = gBS->UninstallMultipleProtocolInterfaces (\r
- gBootManagerPrivate.DriverHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- &mBootManagerHiiVendorDevicePath,\r
- &gEfiHiiConfigAccessProtocolGuid,\r
- &gBootManagerPrivate.ConfigAccess,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- HiiRemovePackages (gBootManagerPrivate.HiiHandle);\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
+++ /dev/null
-/** @file\r
- The boot manager reference implementation\r
-\r
-Copyright (c) 2004 - 2015, 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
-\r
-**/\r
-\r
-#ifndef _EFI_BOOT_MANAGER_H_\r
-#define _EFI_BOOT_MANAGER_H_\r
-\r
-#include <Guid/MdeModuleHii.h>\r
-#include <Guid/GlobalVariable.h>\r
-\r
-#include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/DevicePathToText.h>\r
-\r
-#include <Library/PrintLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/UefiBootManagerLib.h>\r
-\r
-#pragma pack(1)\r
-\r
-///\r
-/// HII specific Vendor Device Path definition.\r
-///\r
-typedef struct {\r
- VENDOR_DEVICE_PATH VendorDevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL End;\r
-} HII_VENDOR_DEVICE_PATH;\r
-#pragma pack()\r
-\r
-//\r
-// These are defined as the same with vfr file\r
-//\r
-#define BOOT_MANAGER_FORMSET_GUID \\r
- { \\r
- 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \\r
- }\r
-\r
-#define BOOT_MANAGER_FORM_ID 0x1000\r
-\r
-#define LABEL_BOOT_OPTION 0x00\r
-#define LABEL_BOOT_OPTION_END 0x01\r
-\r
-//\r
-// Variable created with this flag will be "Efi:...."\r
-//\r
-#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE\r
-\r
-//\r
-// These are the VFR compiler generated data representing our VFR data.\r
-//\r
-extern UINT8 BootManagerVfrBin[];\r
-\r
-#define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'M', 'C', 'B')\r
-\r
-typedef struct {\r
- UINTN Signature;\r
-\r
- //\r
- // HII relative handles\r
- //\r
- EFI_HII_HANDLE HiiHandle;\r
- EFI_HANDLE DriverHandle;\r
-\r
- //\r
- // Produced protocols\r
- //\r
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
-} BOOT_MANAGER_CALLBACK_DATA;\r
-\r
-/**\r
- This call back function is registered with Boot Manager formset.\r
- When user selects a boot option, this call back function will\r
- be triggered. The boot option is saved for later processing.\r
-\r
-\r
- @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Action Specifies the type of action taken by the browser.\r
- @param QuestionId A unique value which is sent to the original exporting driver\r
- so that it can identify the type of data to expect.\r
- @param Type The type of value for the question.\r
- @param Value A pointer to the data being sent to the original exporting driver.\r
- @param ActionRequest On return, points to the action requested by the callback function.\r
-\r
- @retval EFI_SUCCESS The callback successfully handled the action.\r
- @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerCallback (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN EFI_BROWSER_ACTION Action,\r
- IN EFI_QUESTION_ID QuestionId,\r
- IN UINT8 Type,\r
- IN EFI_IFR_TYPE_VALUE *Value,\r
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
- );\r
-\r
-/**\r
- This function allows a caller to extract the current configuration for one\r
- or more named elements from the target driver.\r
-\r
-\r
- @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Request - A null-terminated Unicode string in <ConfigRequest> format.\r
- @param Progress - On return, points to a character in the Request string.\r
- Points to the string's null terminator if request was successful.\r
- Points to the most recent '&' before the first failing name/value\r
- pair (or the beginning of the string if the failure is in the\r
- first name/value pair) if the request was not successful.\r
- @param Results - A null-terminated Unicode string in <ConfigAltResp> format which\r
- has all values filled in for the names in the Request string.\r
- String to be allocated by the called function.\r
-\r
- @retval EFI_SUCCESS The Results is filled with the requested values.\r
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
- @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerExtractConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Request,\r
- OUT EFI_STRING *Progress,\r
- OUT EFI_STRING *Results\r
- );\r
-\r
-/**\r
- This function processes the results of changes in configuration.\r
-\r
-\r
- @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
- @param Progress - A pointer to a string filled in with the offset of the most\r
- recent '&' before the first failing name/value pair (or the\r
- beginning of the string if the failure is in the first\r
- name/value pair) or the terminating NULL if all was successful.\r
-\r
- @retval EFI_SUCCESS The Results is processed successfully.\r
- @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-BootManagerRouteConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Configuration,\r
- OUT EFI_STRING *Progress\r
- );\r
-\r
-#endif\r
+++ /dev/null
-## @file\r
-# Boot Manager Library used by UiApp.\r
-#\r
-# Copyright (c) 2011 - 2015, 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
-#\r
-##\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = BootManagerLib\r
- MODULE_UNI_FILE = BootManagerLib.uni\r
- FILE_GUID = CCB2DCE1-4FC8-41CB-88C5-D349E134C9FC\r
- MODULE_TYPE = DXE_DRIVER\r
- VERSION_STRING = 1.0\r
- LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION\r
- CONSTRUCTOR = BootManagerLibConstructor\r
- DESTRUCTOR = BootManagerLibDestructor\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources]\r
- BootManager.h\r
- BootManagerVfr.Vfr\r
- BootManagerStrings.uni\r
- BootManager.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
-\r
-[LibraryClasses]\r
- UefiRuntimeServicesTableLib\r
- ReportStatusCodeLib\r
- MemoryAllocationLib\r
- UefiLib\r
- UefiBootServicesTableLib\r
- BaseMemoryLib\r
- DebugLib\r
- PrintLib\r
- HiiLib\r
- UefiBootManagerLib\r
-\r
-[Guids]\r
- gEfiIfrTianoGuid ## CONSUMES ## GUID (Extended IFR Guid Opcode)\r
- gEfiIfrFrontPageGuid ## CONSUMES ## GUID\r
-\r
-[Protocols]\r
- gEfiHiiConfigAccessProtocolGuid ## CONSUMES\r
- gEfiDevicePathToTextProtocolGuid ## CONSUMES\r
-\r
-[FeaturePcd]\r
-\r
-[Pcd]\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## CONSUMES\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## CONSUMES\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## CONSUMES\r
- gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## CONSUMES\r
-\r
+++ /dev/null
-// /** @file\r
-// Boot Manager Library used by UiApp.\r
-//\r
-// Boot Manager Library used by UiApp.\r
-//\r
-// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
-//\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
-//\r
-// **/\r
-\r
-#string STR_MODULE_ABSTRACT\r
-#language en-US\r
-"Boot Manager Library used by UiApp."\r
-\r
-#string STR_MODULE_DESCRIPTION\r
-#language en-US\r
-"Boot Manager Library used by UiApp."\r
-\r
-\r
+++ /dev/null
-///** @file\r
-//\r
-// Copyright (c) 2007 - 2015, 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
-// 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
-// \r
-// Module Name:\r
-//\r
-// BootManagerStrings.uni\r
-// \r
-// Abstract:\r
-// \r
-// String definitions for Boot Manager formset.\r
-// \r
-// Revision History:\r
-// \r
-// --*/\r
-\r
-/=#\r
-#langdef en-US "English"\r
-#langdef fr-FR "Français"\r
-\r
-#string STR_BM_BANNER #language en-US "Boot Manager"\r
- #language fr-FR "Boot Manager"\r
-#string STR_BOOT_MANAGER_HELP #language en-US "This selection will take you to the Boot Manager"\r
- #language fr-FR "This selection will take you to the Boot Manager"\r
-#string STR_HELP_FOOTER #language en-US "Use the <↑> and <↓> keys to choose a boot option, the <Enter> key to select a boot option, and the <Esc> key to exit the Boot Manager Menu."\r
- #language fr-FR "<↑> pour <↓> changer l'option, <ENTRER> choisir une option, <ESC> pour sortir"\r
-#string STR_AND #language en-US " and "\r
- #language fr-FR " et "\r
-#string STR_BOOT_OPTION_BANNER #language en-US "Boot Manager Menu"\r
- #language fr-FR "le Menu d'Option de Botte"\r
-#string STR_ANY_KEY_CONTINUE #language en-US "Press any key to continue..."\r
- #language fr-FR "Appuie n'importe quelle pour continuer..."\r
-#string STR_LAST_STRING #language en-US ""\r
- #language fr-FR ""\r
-\r
+++ /dev/null
-///** @file\r
-//\r
-// Boot Manager formset.\r
-//\r
-// Copyright (c) 2004 - 2015, 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
-// 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
-//\r
-//**/\r
-#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b }\r
-\r
-#define BOOT_MANAGER_FORM_ID 0x1000\r
-\r
-#define LABEL_BOOT_OPTION 0x00\r
-#define LABEL_BOOT_OPTION_END 0x01\r
-\r
-formset\r
- guid = FORMSET_GUID,\r
- title = STRING_TOKEN(STR_BM_BANNER),\r
- help = STRING_TOKEN(STR_BOOT_MANAGER_HELP),\r
- classguid = gEfiIfrFrontPageGuid,\r
-\r
- form formid = BOOT_MANAGER_FORM_ID,\r
- title = STRING_TOKEN(STR_BM_BANNER);\r
-\r
- subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
- subtitle text = STRING_TOKEN(STR_BOOT_OPTION_BANNER);\r
- subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
-\r
- //\r
- //Add this invisable text in order to indicate enter Boot Manager form.\r
- //\r
- suppressif TRUE;\r
- text\r
- help = STRING_TOKEN(STR_LAST_STRING ),\r
- text = STRING_TOKEN(STR_LAST_STRING ),\r
- flags = INTERACTIVE,\r
- key = 0x1212;\r
- endif;\r
-\r
- //\r
- // This is where we will dynamically add choices for the Boot Manager\r
- //\r
- label LABEL_BOOT_OPTION;\r
- label LABEL_BOOT_OPTION_END;\r
-\r
- subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
- subtitle text = STRING_TOKEN(STR_HELP_FOOTER);\r
-\r
- endform;\r
-\r
-endformset;\r
--- /dev/null
+/** @file\r
+ The boot manager reference implementation\r
+\r
+Copyright (c) 2004 - 2015, 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
+\r
+**/\r
+\r
+#include "BootManager.h"\r
+\r
+UINT16 mKeyInput;\r
+EFI_GUID mBootManagerGuid = BOOT_MANAGER_FORMSET_GUID;\r
+//\r
+// Boot video resolution and text mode.\r
+//\r
+UINT32 mBmBootHorizontalResolution = 0;\r
+UINT32 mBmBootVerticalResolution = 0;\r
+UINT32 mBmBootTextModeColumn = 0;\r
+UINT32 mBmBootTextModeRow = 0;\r
+//\r
+// BIOS setup video resolution and text mode.\r
+//\r
+UINT32 mBmSetupTextModeColumn = 0;\r
+UINT32 mBmSetupTextModeRow = 0;\r
+UINT32 mBmSetupHorizontalResolution = 0;\r
+UINT32 mBmSetupVerticalResolution = 0;\r
+\r
+CHAR16 *mDeviceTypeStr[] = {\r
+ L"Legacy BEV",\r
+ L"Legacy Floppy",\r
+ L"Legacy Hard Drive",\r
+ L"Legacy CD ROM",\r
+ L"Legacy PCMCIA",\r
+ L"Legacy USB",\r
+ L"Legacy Embedded Network",\r
+ L"Legacy Unknown Device"\r
+};\r
+\r
+HII_VENDOR_DEVICE_PATH mBootManagerHiiVendorDevicePath = {\r
+ {\r
+ {\r
+ HARDWARE_DEVICE_PATH,\r
+ HW_VENDOR_DP,\r
+ {\r
+ (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\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
+ },\r
+ {\r
+ END_DEVICE_PATH_TYPE,\r
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
+ { \r
+ (UINT8) (END_DEVICE_PATH_LENGTH),\r
+ (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
+ }\r
+ }\r
+};\r
+\r
+BOOT_MANAGER_CALLBACK_DATA gBootManagerPrivate = {\r
+ BOOT_MANAGER_CALLBACK_DATA_SIGNATURE,\r
+ NULL,\r
+ NULL,\r
+ {\r
+ BootManagerExtractConfig,\r
+ BootManagerRouteConfig,\r
+ BootManagerCallback\r
+ }\r
+};\r
+\r
+/**\r
+ This function will change video resolution and text 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
+\r
+ @retval EFI_SUCCESS Mode is changed successfully.\r
+ @retval Others Mode failed to be changed.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BmBdsSetConsoleMode (\r
+ BOOLEAN IsSetupMode\r
+ )\r
+{\r
+ EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
+ EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *SimpleTextOut;\r
+ UINTN SizeOfInfo;\r
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;\r
+ UINT32 MaxGopMode;\r
+ UINT32 MaxTextMode;\r
+ UINT32 ModeNumber;\r
+ UINT32 NewHorizontalResolution;\r
+ UINT32 NewVerticalResolution;\r
+ UINT32 NewColumns;\r
+ UINT32 NewRows;\r
+ UINTN HandleCount;\r
+ EFI_HANDLE *HandleBuffer;\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ UINTN CurrentColumn;\r
+ UINTN CurrentRow; \r
+\r
+ MaxGopMode = 0;\r
+ MaxTextMode = 0;\r
+\r
+ //\r
+ // Get current video resolution and text mode \r
+ //\r
+ Status = gBS->HandleProtocol (\r
+ gST->ConsoleOutHandle,\r
+ &gEfiGraphicsOutputProtocolGuid,\r
+ (VOID**)&GraphicsOutput\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ GraphicsOutput = NULL;\r
+ }\r
+\r
+ Status = gBS->HandleProtocol (\r
+ gST->ConsoleOutHandle,\r
+ &gEfiSimpleTextOutProtocolGuid,\r
+ (VOID**)&SimpleTextOut\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ SimpleTextOut = NULL;\r
+ }\r
+\r
+ if ((GraphicsOutput == NULL) || (SimpleTextOut == NULL)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ if (IsSetupMode) {\r
+ //\r
+ // The requried resolution and text mode is setup mode.\r
+ //\r
+ NewHorizontalResolution = mBmSetupHorizontalResolution;\r
+ NewVerticalResolution = mBmSetupVerticalResolution;\r
+ NewColumns = mBmSetupTextModeColumn;\r
+ NewRows = mBmSetupTextModeRow;\r
+ } else {\r
+ //\r
+ // The required resolution and text mode is boot mode.\r
+ //\r
+ NewHorizontalResolution = mBmBootHorizontalResolution;\r
+ NewVerticalResolution = mBmBootVerticalResolution;\r
+ NewColumns = mBmBootTextModeColumn;\r
+ NewRows = mBmBootTextModeRow; \r
+ }\r
+\r
+ if (GraphicsOutput != NULL) {\r
+ MaxGopMode = GraphicsOutput->Mode->MaxMode;\r
+ }\r
+\r
+ if (SimpleTextOut != NULL) {\r
+ MaxTextMode = SimpleTextOut->Mode->MaxMode;\r
+ }\r
+\r
+ //\r
+ // 1. If current video resolution is same with required video resolution,\r
+ // video resolution need not be changed.\r
+ // 1.1. If current text mode is same with required text mode, text mode need not be changed.\r
+ // 1.2. If current text mode is different from required text mode, text mode need be changed.\r
+ // 2. If current video resolution is different from required video resolution, we need restart whole console drivers.\r
+ //\r
+ for (ModeNumber = 0; ModeNumber < MaxGopMode; ModeNumber++) {\r
+ Status = GraphicsOutput->QueryMode (\r
+ GraphicsOutput,\r
+ ModeNumber,\r
+ &SizeOfInfo,\r
+ &Info\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ if ((Info->HorizontalResolution == NewHorizontalResolution) &&\r
+ (Info->VerticalResolution == NewVerticalResolution)) {\r
+ if ((GraphicsOutput->Mode->Info->HorizontalResolution == NewHorizontalResolution) &&\r
+ (GraphicsOutput->Mode->Info->VerticalResolution == NewVerticalResolution)) {\r
+ //\r
+ // Current resolution is same with required resolution, check if text mode need be set\r
+ //\r
+ Status = SimpleTextOut->QueryMode (SimpleTextOut, SimpleTextOut->Mode->Mode, &CurrentColumn, &CurrentRow);\r
+ ASSERT_EFI_ERROR (Status);\r
+ if (CurrentColumn == NewColumns && CurrentRow == NewRows) {\r
+ //\r
+ // If current text mode is same with required text mode. Do nothing\r
+ //\r
+ FreePool (Info);\r
+ return EFI_SUCCESS;\r
+ } else {\r
+ //\r
+ // If current text mode is different from requried text mode. Set new video mode\r
+ //\r
+ for (Index = 0; Index < MaxTextMode; Index++) {\r
+ Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);\r
+ if (!EFI_ERROR(Status)) {\r
+ if ((CurrentColumn == NewColumns) && (CurrentRow == NewRows)) {\r
+ //\r
+ // Required text mode is supported, set it.\r
+ //\r
+ Status = SimpleTextOut->SetMode (SimpleTextOut, Index);\r
+ ASSERT_EFI_ERROR (Status);\r
+ //\r
+ // Update text mode PCD.\r
+ //\r
+ Status = PcdSet32S (PcdConOutColumn, mBmSetupTextModeColumn);\r
+ ASSERT_EFI_ERROR (Status);\r
+ Status = PcdSet32S (PcdConOutRow, mBmSetupTextModeRow);\r
+ ASSERT_EFI_ERROR (Status);\r
+ FreePool (Info);\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+ }\r
+ if (Index == MaxTextMode) {\r
+ //\r
+ // If requried text mode is not supported, return error.\r
+ //\r
+ FreePool (Info);\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ }\r
+ } else {\r
+ //\r
+ // If current video resolution is not same with the new one, set new video resolution.\r
+ // In this case, the driver which produces simple text out need be restarted.\r
+ //\r
+ Status = GraphicsOutput->SetMode (GraphicsOutput, ModeNumber);\r
+ if (!EFI_ERROR (Status)) {\r
+ FreePool (Info);\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ FreePool (Info);\r
+ }\r
+ }\r
+\r
+ if (ModeNumber == MaxGopMode) {\r
+ //\r
+ // If the resolution is not supported, return error.\r
+ //\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ //\r
+ // Set PCD to Inform GraphicsConsole to change video resolution.\r
+ // Set PCD to Inform Consplitter to change text mode.\r
+ //\r
+ Status = PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);\r
+ ASSERT_EFI_ERROR (Status);\r
+ Status = PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);\r
+ ASSERT_EFI_ERROR (Status);\r
+ Status = PcdSet32S (PcdConOutColumn, NewColumns);\r
+ ASSERT_EFI_ERROR (Status);\r
+ Status = PcdSet32S (PcdConOutRow, NewRows);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Video mode is changed, so restart graphics console driver and higher level driver.\r
+ // Reconnect graphics console driver and higher level driver.\r
+ // Locate all the handles with GOP protocol and reconnect it.\r
+ //\r
+ Status = gBS->LocateHandleBuffer (\r
+ ByProtocol,\r
+ &gEfiSimpleTextOutProtocolGuid,\r
+ NULL,\r
+ &HandleCount,\r
+ &HandleBuffer\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ for (Index = 0; Index < HandleCount; Index++) {\r
+ gBS->DisconnectController (HandleBuffer[Index], NULL, NULL);\r
+ }\r
+ for (Index = 0; Index < HandleCount; Index++) {\r
+ gBS->ConnectController (HandleBuffer[Index], NULL, NULL, TRUE);\r
+ }\r
+ if (HandleBuffer != NULL) {\r
+ FreePool (HandleBuffer);\r
+ }\r
+ }\r
+\r
+ return EFI_SUCCESS;\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
+ 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
+ 1. Input = [Harddisk1 CdRom2 Efi1 Harddisk0 CdRom0 CdRom1 Harddisk2 Efi0]\r
+ Assuming [Harddisk1 CdRom2 Efi1] is ordered properly\r
+ Output = [Harddisk1 Harddisk0 Harddisk2 CdRom2 CdRom0 CdRom1 Efi1 Efi0]\r
+\r
+ 2. Input = [Efi1 Efi0 CdRom1 Harddisk0 Harddisk1 Harddisk2 CdRom0 CdRom2]\r
+ Assuming [Efi1 Efi0 CdRom1 Harddisk0] is ordered properly\r
+ Output = [Efi1 Efi0 CdRom1 CdRom0 CdRom2 Harddisk0 Harddisk1 Harddisk2]\r
+\r
+**/\r
+VOID\r
+GroupMultipleLegacyBootOption4SameType (\r
+ VOID\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ UINTN DeviceIndex;\r
+ UINTN DeviceTypeIndex[7];\r
+ UINTN *NextIndex;\r
+ UINT16 OptionNumber;\r
+ UINT16 *BootOrder;\r
+ UINTN BootOrderSize;\r
+ CHAR16 OptionName[sizeof ("Boot####")];\r
+ EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
+\r
+ SetMem (DeviceTypeIndex, sizeof (DeviceTypeIndex), 0xff);\r
+\r
+ GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSize);\r
+ if (BootOrder == NULL) {\r
+ return;\r
+ }\r
+\r
+ for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) {\r
+ UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]);\r
+ Status = EfiBootManagerVariableToLoadOption (OptionName, &BootOption);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ if ((DevicePathType (BootOption.FilePath) == BBS_DEVICE_PATH) &&\r
+ (DevicePathSubType (BootOption.FilePath) == BBS_BBS_DP)) {\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
+ NextIndex = &DeviceTypeIndex[((BBS_BBS_DEVICE_PATH *) BootOption.FilePath)->DeviceType & 0xF];\r
+\r
+ if (*NextIndex == (UINTN) -1) {\r
+ //\r
+ // *NextIndex is the Index in BootOrder to put the next Option Number for the same type\r
+ //\r
+ *NextIndex = Index + 1;\r
+ } else {\r
+ //\r
+ // insert the current boot option before *NextIndex, causing [*Next .. Index] shift right one position\r
+ //\r
+ OptionNumber = BootOrder[Index];\r
+ CopyMem (&BootOrder[*NextIndex + 1], &BootOrder[*NextIndex], (Index - *NextIndex) * sizeof (UINT16));\r
+ BootOrder[*NextIndex] = OptionNumber;\r
+\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
+ if (DeviceTypeIndex[DeviceIndex] != (UINTN) -1 && DeviceTypeIndex[DeviceIndex] >= *NextIndex) {\r
+ DeviceTypeIndex[DeviceIndex]++;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ EfiBootManagerFreeLoadOption (&BootOption);\r
+ }\r
+\r
+ gRT->SetVariable (\r
+ L"BootOrder",\r
+ &gEfiGlobalVariableGuid,\r
+ VAR_FLAG,\r
+ BootOrderSize,\r
+ BootOrder\r
+ );\r
+ FreePool (BootOrder);\r
+}\r
+\r
+/**\r
+ This function converts an input device structure to a Unicode string.\r
+\r
+ @param DevPath A pointer to the device path structure.\r
+\r
+ @return A new allocated Unicode string that represents the device path.\r
+\r
+**/\r
+CHAR16 *\r
+BmDevicePathToStr (\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevPath\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ CHAR16 *ToText;\r
+ EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;\r
+\r
+ if (DevPath == NULL) {\r
+ return NULL;\r
+ }\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiDevicePathToTextProtocolGuid,\r
+ NULL,\r
+ (VOID **) &DevPathToText\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ ToText = DevPathToText->ConvertDevicePathToText (\r
+ DevPath,\r
+ FALSE,\r
+ TRUE\r
+ );\r
+ ASSERT (ToText != NULL);\r
+ return ToText;\r
+}\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
+ a boot option from the Boot Manager page is selected, Boot Manager will boot\r
+ from this boot option.\r
+ \r
+**/\r
+VOID\r
+UpdateBootManager (\r
+ VOID\r
+ )\r
+{\r
+ UINTN Index;\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;\r
+ UINTN BootOptionCount;\r
+ EFI_STRING_ID Token;\r
+ CHAR16 *HelpString;\r
+ EFI_STRING_ID HelpToken;\r
+ UINT16 *TempStr;\r
+ EFI_HII_HANDLE HiiHandle;\r
+ UINTN TempSize;\r
+ VOID *StartOpCodeHandle;\r
+ VOID *EndOpCodeHandle;\r
+ EFI_IFR_GUID_LABEL *StartLabel;\r
+ EFI_IFR_GUID_LABEL *EndLabel;\r
+ UINT16 DeviceType;\r
+ BOOLEAN IsLegacyOption;\r
+ BOOLEAN NeedEndOp;\r
+ UINTN MaxLen;\r
+\r
+ DeviceType = (UINT16) -1;\r
+\r
+ EfiBootManagerConnectAll ();\r
+\r
+ //\r
+ // for better user experience\r
+ // 1. User changes HD configuration (e.g.: unplug HDD), here we have a chance to remove the HDD boot option\r
+ // 2. User enables/disables UEFI PXE, here we have a chance to add/remove EFI Network boot option\r
+ //\r
+ EfiBootManagerRefreshAllBootOption ();\r
+\r
+ //\r
+ // BdsDxe doesn't group the legacy boot options for the same device type\r
+ // It's UI's choice.\r
+ //\r
+ GroupMultipleLegacyBootOption4SameType ();\r
+\r
+ BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);\r
+\r
+ HiiHandle = gBootManagerPrivate.HiiHandle;\r
+\r
+ //\r
+ // Allocate space for creation of UpdateData Buffer\r
+ //\r
+ StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r
+ ASSERT (StartOpCodeHandle != NULL);\r
+\r
+ EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r
+ ASSERT (EndOpCodeHandle != NULL);\r
+\r
+ //\r
+ // Create Hii Extend Label OpCode as the start opcode\r
+ //\r
+ StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+ StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+ StartLabel->Number = LABEL_BOOT_OPTION;\r
+\r
+ //\r
+ // Create Hii Extend Label OpCode as the end opcode\r
+ //\r
+ EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+ EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+ EndLabel->Number = LABEL_BOOT_OPTION_END;\r
+ mKeyInput = 0;\r
+ NeedEndOp = FALSE;\r
+ for (Index = 0; Index < BootOptionCount; Index++) {\r
+ //\r
+ // At this stage we are creating a menu entry, thus the Keys are reproduceable\r
+ //\r
+ mKeyInput++;\r
+\r
+ //\r
+ // Don't display the hidden/inactive boot option\r
+ //\r
+ if (((BootOption[Index].Attributes & LOAD_OPTION_HIDDEN) != 0) || ((BootOption[Index].Attributes & LOAD_OPTION_ACTIVE) == 0)) {\r
+ continue;\r
+ }\r
+\r
+ //\r
+ // Group the legacy boot option in the sub title created dynamically\r
+ //\r
+ IsLegacyOption = (BOOLEAN) (\r
+ (DevicePathType (BootOption[Index].FilePath) == BBS_DEVICE_PATH) &&\r
+ (DevicePathSubType (BootOption[Index].FilePath) == BBS_BBS_DP)\r
+ );\r
+\r
+ if (!IsLegacyOption && NeedEndOp) {\r
+ NeedEndOp = FALSE;\r
+ HiiCreateEndOpCode (StartOpCodeHandle);\r
+ }\r
+ \r
+ if (IsLegacyOption && DeviceType != ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType) {\r
+ if (NeedEndOp) {\r
+ HiiCreateEndOpCode (StartOpCodeHandle);\r
+ }\r
+\r
+ DeviceType = ((BBS_BBS_DEVICE_PATH *) BootOption[Index].FilePath)->DeviceType;\r
+ Token = HiiSetString (\r
+ HiiHandle,\r
+ 0,\r
+ mDeviceTypeStr[\r
+ MIN (DeviceType & 0xF, sizeof (mDeviceTypeStr) / sizeof (mDeviceTypeStr[0]) - 1)\r
+ ],\r
+ NULL\r
+ );\r
+ HiiCreateSubTitleOpCode (StartOpCodeHandle, Token, 0, 0, 1);\r
+ NeedEndOp = TRUE;\r
+ }\r
+\r
+ ASSERT (BootOption[Index].Description != NULL);\r
+\r
+ Token = HiiSetString (HiiHandle, 0, BootOption[Index].Description, NULL);\r
+\r
+ TempStr = BmDevicePathToStr (BootOption[Index].FilePath);\r
+ TempSize = StrSize (TempStr);\r
+ HelpString = AllocateZeroPool (TempSize + StrSize (L"Device Path : "));\r
+ MaxLen = (TempSize + StrSize (L"Device Path : "))/sizeof(CHAR16);\r
+ ASSERT (HelpString != NULL);\r
+ StrCatS (HelpString, MaxLen, L"Device Path : ");\r
+ StrCatS (HelpString, MaxLen, TempStr);\r
+\r
+ HelpToken = HiiSetString (HiiHandle, 0, HelpString, NULL);\r
+\r
+ HiiCreateActionOpCode (\r
+ StartOpCodeHandle,\r
+ mKeyInput,\r
+ Token,\r
+ HelpToken,\r
+ EFI_IFR_FLAG_CALLBACK,\r
+ 0\r
+ );\r
+ }\r
+\r
+ if (NeedEndOp) {\r
+ HiiCreateEndOpCode (StartOpCodeHandle);\r
+ }\r
+\r
+ HiiUpdateForm (\r
+ HiiHandle,\r
+ &mBootManagerGuid,\r
+ BOOT_MANAGER_FORM_ID,\r
+ StartOpCodeHandle,\r
+ EndOpCodeHandle\r
+ );\r
+\r
+ HiiFreeOpCodeHandle (StartOpCodeHandle);\r
+ HiiFreeOpCodeHandle (EndOpCodeHandle);\r
+\r
+ EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);\r
+}\r
+\r
+/**\r
+ This function allows a caller to extract the current configuration for one\r
+ or more named elements from the target driver.\r
+\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Request A null-terminated Unicode string in <ConfigRequest> format.\r
+ @param Progress On return, points to a character in the Request string.\r
+ Points to the string's null terminator if request was successful.\r
+ Points to the most recent '&' before the first failing name/value\r
+ pair (or the beginning of the string if the failure is in the\r
+ first name/value pair) if the request was not successful.\r
+ @param Results A null-terminated Unicode string in <ConfigAltResp> format which\r
+ has all values filled in for the names in the Request string.\r
+ String to be allocated by the called function.\r
+\r
+ @retval EFI_SUCCESS The Results is filled with the requested values.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
+ @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerExtractConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Request,\r
+ OUT EFI_STRING *Progress,\r
+ OUT EFI_STRING *Results\r
+ )\r
+{\r
+ if (Progress == NULL || Results == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ *Progress = Request;\r
+ return EFI_NOT_FOUND;\r
+}\r
+\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Configuration A null-terminated Unicode string in <ConfigResp> format.\r
+ @param Progress A pointer to a string filled in with the offset of the most\r
+ recent '&' before the first failing name/value pair (or the\r
+ beginning of the string if the failure is in the first\r
+ name/value pair) or the terminating NULL if all was successful.\r
+\r
+ @retval EFI_SUCCESS The Results is processed successfully.\r
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerRouteConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Configuration,\r
+ OUT EFI_STRING *Progress\r
+ )\r
+{\r
+ if (Configuration == NULL || Progress == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ *Progress = Configuration;\r
+\r
+ return EFI_NOT_FOUND;\r
+}\r
+\r
+/**\r
+ This call back function is registered with Boot Manager formset.\r
+ When user selects a boot option, this call back function will\r
+ be triggered. The boot option is saved for later processing.\r
+\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Action Specifies the type of action taken by the browser.\r
+ @param QuestionId A unique value which is sent to the original exporting driver\r
+ so that it can identify the type of data to expect.\r
+ @param Type The type of value for the question.\r
+ @param Value A pointer to the data being sent to the original exporting driver.\r
+ @param ActionRequest On return, points to the action requested by the callback function.\r
+\r
+ @retval EFI_SUCCESS The callback successfully handled the action.\r
+ @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerCallback (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN EFI_BROWSER_ACTION Action,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN UINT8 Type,\r
+ IN EFI_IFR_TYPE_VALUE *Value,\r
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
+ )\r
+{\r
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOption;\r
+ UINTN BootOptionCount;\r
+ EFI_INPUT_KEY Key;\r
+\r
+ if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {\r
+ //\r
+ //Means enter the boot manager form.\r
+ //Update the boot manage page,because the boot option may changed.\r
+ //\r
+ if (QuestionId == 0x1212){\r
+ UpdateBootManager();\r
+ }\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ if (Action != EFI_BROWSER_ACTION_CHANGED) {\r
+ //\r
+ // Do nothing for other UEFI Action. Only do call back when data is changed.\r
+ //\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ if ((Value == NULL) || (ActionRequest == NULL)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ BootOption = EfiBootManagerGetLoadOptions (&BootOptionCount, LoadOptionTypeBoot);\r
+\r
+ //\r
+ // Clear the screen before.\r
+ //\r
+ gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
+ gST->ConOut->ClearScreen (gST->ConOut);\r
+\r
+ //\r
+ // parse the selected option\r
+ //\r
+ BmBdsSetConsoleMode (FALSE);\r
+ EfiBootManagerBoot (&BootOption[QuestionId - 1]);\r
+ BmBdsSetConsoleMode (TRUE);\r
+\r
+ if (EFI_ERROR (BootOption[QuestionId - 1].Status)) {\r
+ gST->ConOut->OutputString (\r
+ gST->ConOut,\r
+ HiiGetString (gBootManagerPrivate.HiiHandle, STRING_TOKEN (STR_ANY_KEY_CONTINUE), NULL)\r
+ );\r
+ gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
+ }\r
+\r
+ EfiBootManagerFreeLoadOptions (BootOption, BootOptionCount);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+\r
+ Install Boot Manager Menu driver.\r
+\r
+ @param ImageHandle The image handle.\r
+ @param SystemTable The system table.\r
+\r
+ @retval EFI_SUCEESS Install Boot manager menu success.\r
+ @retval Other Return error status.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Install Device Path Protocol and Config Access protocol to driver handle\r
+ //\r
+ gBootManagerPrivate.DriverHandle = NULL;\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &gBootManagerPrivate.DriverHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ &mBootManagerHiiVendorDevicePath,\r
+ &gEfiHiiConfigAccessProtocolGuid,\r
+ &gBootManagerPrivate.ConfigAccess,\r
+ NULL\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Publish our HII data\r
+ //\r
+ gBootManagerPrivate.HiiHandle = HiiAddPackages (\r
+ &mBootManagerGuid,\r
+ gBootManagerPrivate.DriverHandle,\r
+ BootManagerVfrBin,\r
+ BootManagerLibStrings,\r
+ NULL\r
+ );\r
+ ASSERT (gBootManagerPrivate.HiiHandle != NULL);\r
+\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ Unloads the application and its installed protocol.\r
+\r
+ @param[in] ImageHandle Handle that identifies the image to be unloaded.\r
+ @param[in] SystemTable System Table\r
+\r
+ @retval EFI_SUCCESS The image has been unloaded.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerLibDestructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = gBS->UninstallMultipleProtocolInterfaces (\r
+ gBootManagerPrivate.DriverHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ &mBootManagerHiiVendorDevicePath,\r
+ &gEfiHiiConfigAccessProtocolGuid,\r
+ &gBootManagerPrivate.ConfigAccess,\r
+ NULL\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ HiiRemovePackages (gBootManagerPrivate.HiiHandle);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
--- /dev/null
+/** @file\r
+ The boot manager reference implementation\r
+\r
+Copyright (c) 2004 - 2015, 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
+\r
+**/\r
+\r
+#ifndef _EFI_BOOT_MANAGER_H_\r
+#define _EFI_BOOT_MANAGER_H_\r
+\r
+#include <Guid/MdeModuleHii.h>\r
+#include <Guid/GlobalVariable.h>\r
+\r
+#include <Protocol/HiiConfigAccess.h>\r
+#include <Protocol/DevicePathToText.h>\r
+\r
+#include <Library/PrintLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/UefiBootManagerLib.h>\r
+\r
+#pragma pack(1)\r
+\r
+///\r
+/// HII specific Vendor Device Path definition.\r
+///\r
+typedef struct {\r
+ VENDOR_DEVICE_PATH VendorDevicePath;\r
+ EFI_DEVICE_PATH_PROTOCOL End;\r
+} HII_VENDOR_DEVICE_PATH;\r
+#pragma pack()\r
+\r
+//\r
+// These are defined as the same with vfr file\r
+//\r
+#define BOOT_MANAGER_FORMSET_GUID \\r
+ { \\r
+ 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \\r
+ }\r
+\r
+#define BOOT_MANAGER_FORM_ID 0x1000\r
+\r
+#define LABEL_BOOT_OPTION 0x00\r
+#define LABEL_BOOT_OPTION_END 0x01\r
+\r
+//\r
+// Variable created with this flag will be "Efi:...."\r
+//\r
+#define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE\r
+\r
+//\r
+// These are the VFR compiler generated data representing our VFR data.\r
+//\r
+extern UINT8 BootManagerVfrBin[];\r
+\r
+#define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'M', 'C', 'B')\r
+\r
+typedef struct {\r
+ UINTN Signature;\r
+\r
+ //\r
+ // HII relative handles\r
+ //\r
+ EFI_HII_HANDLE HiiHandle;\r
+ EFI_HANDLE DriverHandle;\r
+\r
+ //\r
+ // Produced protocols\r
+ //\r
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
+} BOOT_MANAGER_CALLBACK_DATA;\r
+\r
+/**\r
+ This call back function is registered with Boot Manager formset.\r
+ When user selects a boot option, this call back function will\r
+ be triggered. The boot option is saved for later processing.\r
+\r
+\r
+ @param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Action Specifies the type of action taken by the browser.\r
+ @param QuestionId A unique value which is sent to the original exporting driver\r
+ so that it can identify the type of data to expect.\r
+ @param Type The type of value for the question.\r
+ @param Value A pointer to the data being sent to the original exporting driver.\r
+ @param ActionRequest On return, points to the action requested by the callback function.\r
+\r
+ @retval EFI_SUCCESS The callback successfully handled the action.\r
+ @retval EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerCallback (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN EFI_BROWSER_ACTION Action,\r
+ IN EFI_QUESTION_ID QuestionId,\r
+ IN UINT8 Type,\r
+ IN EFI_IFR_TYPE_VALUE *Value,\r
+ OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
+ );\r
+\r
+/**\r
+ This function allows a caller to extract the current configuration for one\r
+ or more named elements from the target driver.\r
+\r
+\r
+ @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Request - A null-terminated Unicode string in <ConfigRequest> format.\r
+ @param Progress - On return, points to a character in the Request string.\r
+ Points to the string's null terminator if request was successful.\r
+ Points to the most recent '&' before the first failing name/value\r
+ pair (or the beginning of the string if the failure is in the\r
+ first name/value pair) if the request was not successful.\r
+ @param Results - A null-terminated Unicode string in <ConfigAltResp> format which\r
+ has all values filled in for the names in the Request string.\r
+ String to be allocated by the called function.\r
+\r
+ @retval EFI_SUCCESS The Results is filled with the requested values.\r
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
+ @retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerExtractConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Request,\r
+ OUT EFI_STRING *Progress,\r
+ OUT EFI_STRING *Results\r
+ );\r
+\r
+/**\r
+ This function processes the results of changes in configuration.\r
+\r
+\r
+ @param This - Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+ @param Configuration - A null-terminated Unicode string in <ConfigResp> format.\r
+ @param Progress - A pointer to a string filled in with the offset of the most\r
+ recent '&' before the first failing name/value pair (or the\r
+ beginning of the string if the failure is in the first\r
+ name/value pair) or the terminating NULL if all was successful.\r
+\r
+ @retval EFI_SUCCESS The Results is processed successfully.\r
+ @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
+ @retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+BootManagerRouteConfig (\r
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
+ IN CONST EFI_STRING Configuration,\r
+ OUT EFI_STRING *Progress\r
+ );\r
+\r
+#endif\r
--- /dev/null
+///** @file\r
+//\r
+// Copyright (c) 2007 - 2015, 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
+// 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
+// \r
+// Module Name:\r
+//\r
+// BootManagerStrings.uni\r
+// \r
+// Abstract:\r
+// \r
+// String definitions for Boot Manager formset.\r
+// \r
+// Revision History:\r
+// \r
+// --*/\r
+\r
+/=#\r
+#langdef en-US "English"\r
+#langdef fr-FR "Français"\r
+\r
+#string STR_BM_BANNER #language en-US "Boot Manager"\r
+ #language fr-FR "Boot Manager"\r
+#string STR_BOOT_MANAGER_HELP #language en-US "This selection will take you to the Boot Manager"\r
+ #language fr-FR "This selection will take you to the Boot Manager"\r
+#string STR_HELP_FOOTER #language en-US "Use the <↑> and <↓> keys to choose a boot option, the <Enter> key to select a boot option, and the <Esc> key to exit the Boot Manager Menu."\r
+ #language fr-FR "<↑> pour <↓> changer l'option, <ENTRER> choisir une option, <ESC> pour sortir"\r
+#string STR_AND #language en-US " and "\r
+ #language fr-FR " et "\r
+#string STR_BOOT_OPTION_BANNER #language en-US "Boot Manager Menu"\r
+ #language fr-FR "le Menu d'Option de Botte"\r
+#string STR_ANY_KEY_CONTINUE #language en-US "Press any key to continue..."\r
+ #language fr-FR "Appuie n'importe quelle pour continuer..."\r
+#string STR_LAST_STRING #language en-US ""\r
+ #language fr-FR ""\r
+\r
--- /dev/null
+## @file\r
+# Boot Manager Library used by UiApp.\r
+#\r
+# Copyright (c) 2011 - 2015, 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
+#\r
+##\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = BootManagerLib\r
+ MODULE_UNI_FILE = BootManagerLib.uni\r
+ FILE_GUID = CCB2DCE1-4FC8-41CB-88C5-D349E134C9FC\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = NULL|DXE_DRIVER UEFI_APPLICATION\r
+ CONSTRUCTOR = BootManagerLibConstructor\r
+ DESTRUCTOR = BootManagerLibDestructor\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+ BootManager.h\r
+ BootManagerVfr.Vfr\r
+ BootManagerStrings.uni\r
+ BootManager.c\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+ UefiRuntimeServicesTableLib\r
+ ReportStatusCodeLib\r
+ MemoryAllocationLib\r
+ UefiLib\r
+ UefiBootServicesTableLib\r
+ BaseMemoryLib\r
+ DebugLib\r
+ PrintLib\r
+ HiiLib\r
+ UefiBootManagerLib\r
+\r
+[Guids]\r
+ gEfiIfrTianoGuid ## CONSUMES ## GUID (Extended IFR Guid Opcode)\r
+ gEfiIfrFrontPageGuid ## CONSUMES ## GUID\r
+\r
+[Protocols]\r
+ gEfiHiiConfigAccessProtocolGuid ## CONSUMES\r
+ gEfiDevicePathToTextProtocolGuid ## CONSUMES\r
+\r
+[FeaturePcd]\r
+\r
+[Pcd]\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## CONSUMES\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn ## CONSUMES\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution ## CONSUMES\r
+ gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution ## CONSUMES\r
+\r
--- /dev/null
+// /** @file\r
+// Boot Manager Library used by UiApp.\r
+//\r
+// Boot Manager Library used by UiApp.\r
+//\r
+// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+//\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
+//\r
+// **/\r
+\r
+#string STR_MODULE_ABSTRACT\r
+#language en-US\r
+"Boot Manager Library used by UiApp."\r
+\r
+#string STR_MODULE_DESCRIPTION\r
+#language en-US\r
+"Boot Manager Library used by UiApp."\r
+\r
+\r
--- /dev/null
+///** @file\r
+//\r
+// Boot Manager formset.\r
+//\r
+// Copyright (c) 2004 - 2015, 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
+// 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
+//\r
+//**/\r
+#define FORMSET_GUID { 0x847bc3fe, 0xb974, 0x446d, 0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b }\r
+\r
+#define BOOT_MANAGER_FORM_ID 0x1000\r
+\r
+#define LABEL_BOOT_OPTION 0x00\r
+#define LABEL_BOOT_OPTION_END 0x01\r
+\r
+formset\r
+ guid = FORMSET_GUID,\r
+ title = STRING_TOKEN(STR_BM_BANNER),\r
+ help = STRING_TOKEN(STR_BOOT_MANAGER_HELP),\r
+ classguid = gEfiIfrFrontPageGuid,\r
+\r
+ form formid = BOOT_MANAGER_FORM_ID,\r
+ title = STRING_TOKEN(STR_BM_BANNER);\r
+\r
+ subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
+ subtitle text = STRING_TOKEN(STR_BOOT_OPTION_BANNER);\r
+ subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
+\r
+ //\r
+ //Add this invisable text in order to indicate enter Boot Manager form.\r
+ //\r
+ suppressif TRUE;\r
+ text\r
+ help = STRING_TOKEN(STR_LAST_STRING ),\r
+ text = STRING_TOKEN(STR_LAST_STRING ),\r
+ flags = INTERACTIVE,\r
+ key = 0x1212;\r
+ endif;\r
+\r
+ //\r
+ // This is where we will dynamically add choices for the Boot Manager\r
+ //\r
+ label LABEL_BOOT_OPTION;\r
+ label LABEL_BOOT_OPTION_END;\r
+\r
+ subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
+ subtitle text = STRING_TOKEN(STR_HELP_FOOTER);\r
+\r
+ endform;\r
+\r
+endformset;\r