diff options
author | Eric Dong <eric.dong@intel.com> | 2014-06-18 02:19:50 +0000 |
---|---|---|
committer | ydong10 <ydong10@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-06-18 02:19:50 +0000 |
commit | be9304f33f78a645512e76e6d44a69198d5f3c06 (patch) | |
tree | ff0b9c9b8de6a1716f817f37b28b4587a51512b0 /IntelFrameworkModulePkg | |
parent | 885f7fd0c767c2b39e6b60d20b575e7e95d4638d (diff) | |
download | edk2-platforms-be9304f33f78a645512e76e6d44a69198d5f3c06.tar.xz |
Support RouteConfig function for BdsDxe driver.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Gao, Liming <liming,gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15563 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg')
11 files changed, 1564 insertions, 508 deletions
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c index 5fe5388f9e..4424831859 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BmLib.c @@ -378,3 +378,34 @@ EfiLibStrFromDatahub ( {
return NULL;
}
+
+/**
+
+ Find the first instance of this Protocol
+ in the system and return it's interface.
+
+
+ @param ProtocolGuid Provides the protocol to search for
+ @param Interface On return, a pointer to the first interface
+ that matches ProtocolGuid
+
+ @retval EFI_SUCCESS A protocol instance matching ProtocolGuid was found
+ @retval EFI_NOT_FOUND No protocol instances were found that match ProtocolGuid
+
+**/
+EFI_STATUS
+EfiLibLocateProtocol (
+ IN EFI_GUID *ProtocolGuid,
+ OUT VOID **Interface
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ ProtocolGuid,
+ NULL,
+ (VOID **) Interface
+ );
+ return Status;
+}
+
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c index b974a67ea5..6f5b56ec8a 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.c @@ -74,6 +74,7 @@ HII_VENDOR_DEVICE_PATH mFeHiiVendorDevicePath = { CHAR16 mBootMaintStorageName[] = L"BmmData";
CHAR16 mFileExplorerStorageName[] = L"FeData";
+BMM_CALLBACK_DATA *mBmmCallbackInfo = NULL;
/**
Init all memu.
@@ -96,6 +97,66 @@ FreeAllMenu ( );
/**
+ Initialize all of BMM configuration data in BmmFakeNvData and BmmOldFakeNVData member
+ in BMM context data and create all of dynamic OP code for BMM.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+InitializeBmmConfig (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ BM_MENU_ENTRY *NewMenuEntry;
+ BM_LOAD_CONTEXT *NewLoadContext;
+ UINT16 Index;
+
+ ASSERT (CallbackData != NULL);
+
+ //
+ // Initialize data which located in BMM main page
+ //
+ CallbackData->BmmFakeNvData.BootNext = (UINT16) (BootOptionMenu.MenuNumber);
+ for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
+ NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
+
+ if (NewLoadContext->IsBootNext) {
+ CallbackData->BmmFakeNvData.BootNext = Index;
+ break;
+ }
+ }
+
+ CallbackData->BmmFakeNvData.BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
+
+ //
+ // Initialize data which located in Boot Options Menu
+ //
+ GetBootOrder (CallbackData);
+ GetLegacyDeviceOrder (CallbackData);
+
+ //
+ // Initialize data which located in Driver Options Menu
+ //
+ GetDriverOrder (CallbackData);
+
+ //
+ // Initialize data which located in Console Options Menu
+ //
+ GetConsoleOutMode (CallbackData);
+ GetConsoleInCheck (CallbackData);
+ GetConsoleOutCheck (CallbackData);
+ GetConsoleErrCheck (CallbackData);
+ GetTerminalAttribute (CallbackData);
+
+ //
+ // Backup Initialize BMM configuartion data to BmmOldFakeNVData
+ //
+ CopyMem (&CallbackData->BmmOldFakeNVData, &CallbackData->BmmFakeNvData, sizeof (BMM_FAKE_NV_DATA));
+}
+
+/**
Create string tokens for a menu from its help strings and display strings
@param CallbackData The BMM context data.
@@ -242,6 +303,353 @@ BootMaintExtractConfig ( }
/**
+ This function applies changes in a driver's configuration.
+ Input is a Configuration, which has the routing data for this
+ driver followed by name / value configuration pairs. The driver
+ must apply those pairs to its configurable storage. If the
+ driver's configuration is stored in a linear block of data
+ and the driver's name / value pairs are in <BlockConfig>
+ format, it may use the ConfigToBlock helper function (above) to
+ simplify the job. Currently not implemented.
+
+ @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param[in] Configuration A null-terminated Unicode string in
+ <ConfigString> format.
+ @param[out] Progress A pointer to a string filled in with the
+ offset of the most recent '&' before the
+ first failing name / value pair (or the
+ beginn ing of the string if the failure
+ is in the first name / value pair) or
+ the terminating NULL if all was
+ successful.
+
+ @retval EFI_SUCCESS The results have been distributed or are
+ awaiting distribution.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
+ parts of the results that must be
+ stored awaiting possible future
+ protocols.
+ @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
+ Results parameter would result
+ in this type of error.
+ @retval EFI_NOT_FOUND Target for the specified routing data
+ was not found.
+**/
+EFI_STATUS
+EFIAPI
+BootMaintRouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
+ BMM_FAKE_NV_DATA *NewBmmData;
+ BMM_FAKE_NV_DATA *OldBmmData;
+ BM_CONSOLE_CONTEXT *NewConsoleContext;
+ BM_TERMINAL_CONTEXT *NewTerminalContext;
+ BM_MENU_ENTRY *NewMenuEntry;
+ BM_LOAD_CONTEXT *NewLoadContext;
+ UINT16 Index;
+ BOOLEAN TerminalAttChange;
+ BMM_CALLBACK_DATA *Private;
+
+ if (Progress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ *Progress = Configuration;
+
+ if (Configuration == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Check routing data in <ConfigHdr>.
+ // Note: there is no name for Name/Value storage, only GUID will be checked
+ //
+ if (!HiiIsConfigHdrMatch (Configuration, &gBootMaintFormSetGuid, mBootMaintStorageName)) {
+ return EFI_NOT_FOUND;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiConfigRoutingProtocolGuid,
+ NULL,
+ &ConfigRouting
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Private = BMM_CALLBACK_DATA_FROM_THIS (This);
+ //
+ // Get Buffer Storage data from EFI variable
+ //
+ BufferSize = sizeof (BMM_FAKE_NV_DATA);
+ OldBmmData = &Private->BmmOldFakeNVData;
+ NewBmmData = &Private->BmmFakeNvData;
+ //
+ // Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
+ //
+ Status = ConfigRouting->ConfigToBlock (
+ ConfigRouting,
+ Configuration,
+ (UINT8 *) NewBmmData,
+ &BufferSize,
+ Progress
+ );
+ ASSERT_EFI_ERROR (Status);
+ //
+ // Compare new and old BMM configuration data and only do action for modified item to
+ // avoid setting unnecessary non-volatile variable
+ //
+
+ //
+ // Check data which located in BMM main page and save the settings if need
+ //
+ if (CompareMem (NewBmmData->LegacyFD, OldBmmData->LegacyFD, sizeof (NewBmmData->LegacyFD)) != 0) {
+ Var_UpdateBBSOption (Private, FORM_SET_FD_ORDER_ID);
+ }
+
+ if (CompareMem (NewBmmData->LegacyHD, OldBmmData->LegacyHD, sizeof (NewBmmData->LegacyHD)) != 0) {
+ Var_UpdateBBSOption (Private, FORM_SET_HD_ORDER_ID);
+ }
+
+ if (CompareMem (NewBmmData->LegacyCD, OldBmmData->LegacyCD, sizeof (NewBmmData->LegacyCD)) != 0) {
+ Var_UpdateBBSOption (Private, FORM_SET_CD_ORDER_ID);
+ }
+
+ if (CompareMem (NewBmmData->LegacyNET, OldBmmData->LegacyNET, sizeof (NewBmmData->LegacyNET)) != 0) {
+ Var_UpdateBBSOption (Private, FORM_SET_NET_ORDER_ID);
+ }
+
+ if (CompareMem (NewBmmData->LegacyBEV, OldBmmData->LegacyBEV, sizeof (NewBmmData->LegacyBEV)) != 0) {
+ Var_UpdateBBSOption (Private, FORM_SET_BEV_ORDER_ID);
+ }
+
+ //
+ // Check data which located in Boot Options Menu and save the settings if need
+ //
+ if (CompareMem (NewBmmData->BootOptionDel, OldBmmData->BootOptionDel, sizeof (NewBmmData->BootOptionDel)) != 0) {
+ for (Index = 0;
+ ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (NewBmmData->BootOptionDel) / sizeof (NewBmmData->BootOptionDel[0]))));
+ Index ++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
+ NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
+ NewLoadContext->Deleted = NewBmmData->BootOptionDel[Index];
+ }
+
+ Var_DelBootOption ();
+ }
+
+ //
+ // Check data which located in Driver Options Menu and save the settings if need
+ //
+ if (CompareMem (NewBmmData->DriverOptionDel, OldBmmData->DriverOptionDel, sizeof (NewBmmData->DriverOptionDel)) != 0) {
+ for (Index = 0;
+ ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (NewBmmData->DriverOptionDel) / sizeof (NewBmmData->DriverOptionDel[0]))));
+ Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
+ NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
+ NewLoadContext->Deleted = NewBmmData->DriverOptionDel[Index];
+ }
+ Var_DelDriverOption ();
+ }
+
+ if (CompareMem (NewBmmData->BootOptionOrder, OldBmmData->BootOptionOrder, sizeof (NewBmmData->BootOptionOrder)) != 0) {
+ Status = Var_UpdateBootOrder (Private);
+ }
+
+ if (CompareMem (NewBmmData->DriverOptionOrder, OldBmmData->DriverOptionOrder, sizeof (NewBmmData->DriverOptionOrder)) != 0) {
+ Status = Var_UpdateDriverOrder (Private);
+ }
+
+ if (CompareMem (&NewBmmData->BootTimeOut, &OldBmmData->BootTimeOut, sizeof (NewBmmData->BootTimeOut)) != 0) {
+ Status = gRT->SetVariable (
+ L"Timeout",
+ &gEfiGlobalVariableGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (UINT16),
+ &(NewBmmData->BootTimeOut)
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ //
+ // Bugbug: code not exit in UiApp but in IntelFrameworkModulePkg, need do more check.
+ //
+ Private->BmmOldFakeNVData.BootTimeOut = NewBmmData->BootTimeOut;
+ }
+
+ if (CompareMem (&NewBmmData->BootNext, &OldBmmData->BootNext, sizeof (NewBmmData->BootNext)) != 0) {
+ Status = Var_UpdateBootNext (Private);
+ }
+
+ if (CompareMem (&NewBmmData->ConsoleOutMode, &OldBmmData->ConsoleOutMode, sizeof (NewBmmData->ConsoleOutMode)) != 0) {
+ Var_UpdateConMode (Private);
+ }
+
+ TerminalAttChange = FALSE;
+ for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
+
+ //
+ // only need update modified items
+ //
+ if (CompareMem (&NewBmmData->COMBaudRate[Index], &OldBmmData->COMBaudRate[Index], sizeof (NewBmmData->COMBaudRate[Index])) == 0 &&
+ CompareMem (&NewBmmData->COMDataRate[Index], &OldBmmData->COMDataRate[Index], sizeof (NewBmmData->COMDataRate[Index])) == 0 &&
+ CompareMem (&NewBmmData->COMStopBits[Index], &OldBmmData->COMStopBits[Index], sizeof (NewBmmData->COMStopBits[Index])) == 0 &&
+ CompareMem (&NewBmmData->COMParity[Index], &OldBmmData->COMParity[Index], sizeof (NewBmmData->COMParity[Index])) == 0 &&
+ CompareMem (&NewBmmData->COMTerminalType[Index], &OldBmmData->COMTerminalType[Index], sizeof (NewBmmData->COMTerminalType[Index])) == 0 &&
+ CompareMem (&NewBmmData->COMFlowControl[Index], &OldBmmData->COMFlowControl[Index], sizeof (NewBmmData->COMFlowControl[Index])) == 0) {
+ continue;
+ }
+
+ NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
+ ASSERT (NewMenuEntry != NULL);
+ NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
+ NewTerminalContext->BaudRateIndex = NewBmmData->COMBaudRate[Index];
+ ASSERT (NewBmmData->COMBaudRate[Index] < (sizeof (BaudRateList) / sizeof (BaudRateList[0])));
+ NewTerminalContext->BaudRate = BaudRateList[NewBmmData->COMBaudRate[Index]].Value;
+ NewTerminalContext->DataBitsIndex = NewBmmData->COMDataRate[Index];
+ ASSERT (NewBmmData->COMDataRate[Index] < (sizeof (DataBitsList) / sizeof (DataBitsList[0])));
+ NewTerminalContext->DataBits = (UINT8) DataBitsList[NewBmmData->COMDataRate[Index]].Value;
+ NewTerminalContext->StopBitsIndex = NewBmmData->COMStopBits[Index];
+ ASSERT (NewBmmData->COMStopBits[Index] < (sizeof (StopBitsList) / sizeof (StopBitsList[0])));
+ NewTerminalContext->StopBits = (UINT8) StopBitsList[NewBmmData->COMStopBits[Index]].Value;
+ NewTerminalContext->ParityIndex = NewBmmData->COMParity[Index];
+ ASSERT (NewBmmData->COMParity[Index] < (sizeof (ParityList) / sizeof (ParityList[0])));
+ NewTerminalContext->Parity = (UINT8) ParityList[NewBmmData->COMParity[Index]].Value;
+ NewTerminalContext->TerminalType = NewBmmData->COMTerminalType[Index];
+ NewTerminalContext->FlowControl = NewBmmData->COMFlowControl[Index];
+ ChangeTerminalDevicePath (
+ &(NewTerminalContext->DevicePath),
+ FALSE
+ );
+ TerminalAttChange = TRUE;
+ }
+ if (TerminalAttChange) {
+ Var_UpdateConsoleInpOption ();
+ Var_UpdateConsoleOutOption ();
+ Var_UpdateErrorOutOption ();
+ }
+
+ //
+ // Check data which located in Console Options Menu and save the settings if need
+ //
+ if (CompareMem (NewBmmData->ConsoleInCheck, OldBmmData->ConsoleInCheck, sizeof (NewBmmData->ConsoleInCheck)) != 0) {
+ for (Index = 0; Index < ConsoleInpMenu.MenuNumber; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
+ NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
+ ASSERT (Index < MAX_MENU_NUMBER);
+ NewConsoleContext->IsActive = NewBmmData->ConsoleInCheck[Index];
+ }
+
+ Var_UpdateConsoleInpOption ();
+ }
+
+ if (CompareMem (NewBmmData->ConsoleOutCheck, OldBmmData->ConsoleOutCheck, sizeof (NewBmmData->ConsoleOutCheck)) != 0) {
+ for (Index = 0; Index < ConsoleOutMenu.MenuNumber; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
+ NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
+ ASSERT (Index < MAX_MENU_NUMBER);
+ NewConsoleContext->IsActive = NewBmmData->ConsoleOutCheck[Index];
+ }
+
+ Var_UpdateConsoleOutOption ();
+ }
+
+ if (CompareMem (NewBmmData->ConsoleErrCheck, OldBmmData->ConsoleErrCheck, sizeof (NewBmmData->ConsoleErrCheck)) != 0) {
+ for (Index = 0; Index < ConsoleErrMenu.MenuNumber; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
+ NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
+ ASSERT (Index < MAX_MENU_NUMBER);
+ NewConsoleContext->IsActive = NewBmmData->ConsoleErrCheck[Index];
+ }
+
+ Var_UpdateErrorOutOption ();
+ }
+
+ //
+ // After user do the save action, need to update OldBmmData.
+ //
+ CopyMem (OldBmmData, NewBmmData, sizeof (BMM_FAKE_NV_DATA));
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Create GoTo OP code into FORM_BOOT_LEGACY_DEVICE label for legacy boot option.
+
+**/
+EFI_STATUS
+InitializeLegacyBootOption (
+ VOID
+ )
+{
+ RefreshUpdateData ();
+ mStartLabel->Number = FORM_BOOT_LEGACY_DEVICE_ID;
+
+ //
+ // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
+ // in BootOption form: legacy FD/HD/CD/NET/BEV
+ //
+ HiiCreateGotoOpCode (
+ mStartOpCodeHandle,
+ FORM_SET_FD_ORDER_ID,
+ STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
+ STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
+ EFI_IFR_FLAG_CALLBACK,
+ FORM_SET_FD_ORDER_ID
+ );
+
+ HiiCreateGotoOpCode (
+ mStartOpCodeHandle,
+ FORM_SET_HD_ORDER_ID,
+ STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
+ STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
+ EFI_IFR_FLAG_CALLBACK,
+ FORM_SET_HD_ORDER_ID
+ );
+
+ HiiCreateGotoOpCode (
+ mStartOpCodeHandle,
+ FORM_SET_CD_ORDER_ID,
+ STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
+ STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
+ EFI_IFR_FLAG_CALLBACK,
+ FORM_SET_CD_ORDER_ID
+ );
+
+ HiiCreateGotoOpCode (
+ mStartOpCodeHandle,
+ FORM_SET_NET_ORDER_ID,
+ STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
+ STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
+ EFI_IFR_FLAG_CALLBACK,
+ FORM_SET_NET_ORDER_ID
+ );
+
+ HiiCreateGotoOpCode (
+ mStartOpCodeHandle,
+ FORM_SET_BEV_ORDER_ID,
+ STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
+ STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
+ EFI_IFR_FLAG_CALLBACK,
+ FORM_SET_BEV_ORDER_ID
+ );
+
+ HiiUpdateForm (
+ mBmmCallbackInfo->BmmHiiHandle,
+ &gBootMaintFormSetGuid,
+ FORM_BOOT_SETUP_ID,
+ mStartOpCodeHandle, // Label FORM_BOOT_LEGACY_DEVICE_ID
+ mEndOpCodeHandle // LABEL_END
+ );
+
+ return EFI_SUCCESS;
+}
+
+/**
This function processes the results of changes in configuration.
@@ -286,6 +694,20 @@ BootMaintCallback ( UINT8 *OldLegacyDev;
UINT8 *NewLegacyDev;
UINT8 *DisMap;
+ EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
+
+ Private = BMM_CALLBACK_DATA_FROM_THIS (This);
+ if (Action == EFI_BROWSER_ACTION_FORM_OPEN && QuestionId == FORM_BOOT_SETUP_ID) {
+ //
+ // Initilize Form for legacy boot option.
+ //
+ Status = EfiLibLocateProtocol (&gEfiLegacyBiosProtocolGuid, (VOID **) &LegacyBios);
+ if (!EFI_ERROR (Status)) {
+ InitializeLegacyBootOption ();
+ }
+
+ return EFI_SUCCESS;
+ }
if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {
//
@@ -636,16 +1058,16 @@ ApplyChangeHandler ( case FORM_SET_CD_ORDER_ID:
case FORM_SET_NET_ORDER_ID:
case FORM_SET_BEV_ORDER_ID:
- Var_UpdateBBSOption (Private);
+ Var_UpdateBBSOption (Private, FormId);
break;
case FORM_BOOT_DEL_ID:
for (Index = 0;
- ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0]))));
+ ((Index < BootOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0]))));
Index ++) {
NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = CurrentFakeNVMap->OptionDel[Index];
+ NewLoadContext->Deleted = CurrentFakeNVMap->BootOptionDel[Index];
}
Var_DelBootOption ();
@@ -653,11 +1075,11 @@ ApplyChangeHandler ( case FORM_DRV_DEL_ID:
for (Index = 0;
- ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0]))));
+ ((Index < DriverOptionMenu.MenuNumber) && (Index < (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0]))));
Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
- NewLoadContext->Deleted = CurrentFakeNVMap->OptionDel[Index];
+ NewLoadContext->Deleted = CurrentFakeNVMap->DriverOptionDel[Index];
}
Var_DelDriverOption ();
@@ -692,26 +1114,27 @@ ApplyChangeHandler ( break;
case FORM_CON_COM_SETUP_ID:
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Private->CurrentTerminal);
+ Index = (UINT16)Private->CurrentTerminal;
+ NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
ASSERT (NewMenuEntry != NULL);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
- NewTerminalContext->BaudRateIndex = CurrentFakeNVMap->COMBaudRate;
- ASSERT (CurrentFakeNVMap->COMBaudRate < (sizeof (BaudRateList) / sizeof (BaudRateList[0])));
- NewTerminalContext->BaudRate = BaudRateList[CurrentFakeNVMap->COMBaudRate].Value;
- NewTerminalContext->DataBitsIndex = CurrentFakeNVMap->COMDataRate;
- ASSERT (CurrentFakeNVMap->COMDataRate < (sizeof (DataBitsList) / sizeof (DataBitsList[0])));
- NewTerminalContext->DataBits = (UINT8) DataBitsList[CurrentFakeNVMap->COMDataRate].Value;
- NewTerminalContext->StopBitsIndex = CurrentFakeNVMap->COMStopBits;
- ASSERT (CurrentFakeNVMap->COMStopBits < (sizeof (StopBitsList) / sizeof (StopBitsList[0])));
- NewTerminalContext->StopBits = (UINT8) StopBitsList[CurrentFakeNVMap->COMStopBits].Value;
- NewTerminalContext->ParityIndex = CurrentFakeNVMap->COMParity;
- ASSERT (CurrentFakeNVMap->COMParity < (sizeof (ParityList) / sizeof (ParityList[0])));
- NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity].Value;
- NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType;
- NewTerminalContext->FlowControl = CurrentFakeNVMap->COMFlowControl;
+ NewTerminalContext->BaudRateIndex = CurrentFakeNVMap->COMBaudRate[Index];
+ ASSERT (CurrentFakeNVMap->COMBaudRate[Index] < (sizeof (BaudRateList) / sizeof (BaudRateList[0])));
+ NewTerminalContext->BaudRate = BaudRateList[CurrentFakeNVMap->COMBaudRate[Index]].Value;
+ NewTerminalContext->DataBitsIndex = CurrentFakeNVMap->COMDataRate[Index];
+ ASSERT (CurrentFakeNVMap->COMDataRate[Index] < (sizeof (DataBitsList) / sizeof (DataBitsList[0])));
+ NewTerminalContext->DataBits = (UINT8) DataBitsList[CurrentFakeNVMap->COMDataRate[Index]].Value;
+ NewTerminalContext->StopBitsIndex = CurrentFakeNVMap->COMStopBits[Index];
+ ASSERT (CurrentFakeNVMap->COMStopBits[Index] < (sizeof (StopBitsList) / sizeof (StopBitsList[0])));
+ NewTerminalContext->StopBits = (UINT8) StopBitsList[CurrentFakeNVMap->COMStopBits[Index]].Value;
+ NewTerminalContext->ParityIndex = CurrentFakeNVMap->COMParity[Index];
+ ASSERT (CurrentFakeNVMap->COMParity[Index] < (sizeof (ParityList) / sizeof (ParityList[0])));
+ NewTerminalContext->Parity = (UINT8) ParityList[CurrentFakeNVMap->COMParity[Index]].Value;
+ NewTerminalContext->TerminalType = CurrentFakeNVMap->COMTerminalType[Index];
+ NewTerminalContext->FlowControl = CurrentFakeNVMap->COMFlowControl[Index];
ChangeTerminalDevicePath (
&(NewTerminalContext->DevicePath),
@@ -728,14 +1151,14 @@ ApplyChangeHandler ( NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index < MAX_MENU_NUMBER);
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
+ NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleInCheck[Index];
}
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index + ConsoleInpMenu.MenuNumber < MAX_MENU_NUMBER);
- NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleInpMenu.MenuNumber];
+ NewTerminalContext->IsConIn = CurrentFakeNVMap->ConsoleInCheck[Index + ConsoleInpMenu.MenuNumber];
}
Var_UpdateConsoleInpOption ();
@@ -746,14 +1169,14 @@ ApplyChangeHandler ( NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index < MAX_MENU_NUMBER);
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
+ NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleOutCheck[Index];
}
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index + ConsoleOutMenu.MenuNumber < MAX_MENU_NUMBER);
- NewTerminalContext->IsConOut = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleOutMenu.MenuNumber];
+ NewTerminalContext->IsConOut = CurrentFakeNVMap->ConsoleOutCheck[Index + ConsoleOutMenu.MenuNumber];
}
Var_UpdateConsoleOutOption ();
@@ -764,14 +1187,14 @@ ApplyChangeHandler ( NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index < MAX_MENU_NUMBER);
- NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleCheck[Index];
+ NewConsoleContext->IsActive = CurrentFakeNVMap->ConsoleErrCheck[Index];
}
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
ASSERT (Index + ConsoleErrMenu.MenuNumber < MAX_MENU_NUMBER);
- NewTerminalContext->IsStdErr = CurrentFakeNVMap->ConsoleCheck[Index + ConsoleErrMenu.MenuNumber];
+ NewTerminalContext->IsStdErr = CurrentFakeNVMap->ConsoleErrCheck[Index + ConsoleErrMenu.MenuNumber];
}
Var_UpdateErrorOutOption ();
@@ -819,21 +1242,24 @@ DiscardChangeHandler ( switch (Private->BmmPreviousPageId) {
case FORM_BOOT_CHG_ID:
+ CopyMem (CurrentFakeNVMap->BootOptionOrder, Private->BmmOldFakeNVData.BootOptionOrder, sizeof (CurrentFakeNVMap->BootOptionOrder));
+ break;
+
case FORM_DRV_CHG_ID:
- CopyMem (CurrentFakeNVMap->OptionOrder, Private->BmmOldFakeNVData.OptionOrder, sizeof (CurrentFakeNVMap->OptionOrder));
+ CopyMem (CurrentFakeNVMap->DriverOptionOrder, Private->BmmOldFakeNVData.DriverOptionOrder, sizeof (CurrentFakeNVMap->DriverOptionOrder));
break;
case FORM_BOOT_DEL_ID:
- ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])));
+ ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->BootOptionDel) / sizeof (CurrentFakeNVMap->BootOptionDel[0])));
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->OptionDel[Index] = FALSE;
+ CurrentFakeNVMap->BootOptionDel[Index] = FALSE;
}
break;
case FORM_DRV_DEL_ID:
- ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->OptionDel) / sizeof (CurrentFakeNVMap->OptionDel[0])));
+ ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CurrentFakeNVMap->DriverOptionDel) / sizeof (CurrentFakeNVMap->DriverOptionDel[0])));
for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- CurrentFakeNVMap->OptionDel[Index] = FALSE;
+ CurrentFakeNVMap->DriverOptionDel[Index] = FALSE;
}
break;
@@ -870,109 +1296,78 @@ InitializeBM ( VOID
)
{
- EFI_LEGACY_BIOS_PROTOCOL *LegacyBios;
BMM_CALLBACK_DATA *BmmCallbackInfo;
EFI_STATUS Status;
- UINT8 *Ptr;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
+ UINT32 Length;
+ UINT8 *Data;
Status = EFI_SUCCESS;
+ BmmCallbackInfo = mBmmCallbackInfo;
+
+ BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
+ BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
+ BmmCallbackInfo->FeCurrentState = FileExplorerStateInActive;
+ BmmCallbackInfo->FeDisplayContext = FileExplorerDisplayUnknown;
//
- // Create CallbackData structures for Driver Callback
+ // Reinstall String packages to include more new strings.
//
- BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));
- if (BmmCallbackInfo == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
-
+
//
- // Create LoadOption in BmmCallbackInfo for Driver Callback
+ // String package size
//
- Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));
- if (Ptr == NULL) {
- FreePool (BmmCallbackInfo);
- return EFI_OUT_OF_RESOURCES;
- }
+ Length = ReadUnaligned32 ((UINT32 *) BdsDxeStrings) - sizeof (UINT32);
//
- // Initialize Bmm callback data.
+ // Add the length of the Package List Header and the terminating Package Header
//
- BmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *) Ptr;
- Ptr += sizeof (BM_LOAD_CONTEXT);
-
- BmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_FILE_CONTEXT);
-
- BmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *) Ptr;
- Ptr += sizeof (BM_HANDLE_CONTEXT);
-
- BmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr;
-
- BmmCallbackInfo->Signature = BMM_CALLBACK_DATA_SIGNATURE;
- BmmCallbackInfo->BmmConfigAccess.ExtractConfig = BootMaintExtractConfig;
- BmmCallbackInfo->BmmConfigAccess.RouteConfig = FakeRouteConfig;
- BmmCallbackInfo->BmmConfigAccess.Callback = BootMaintCallback;
- BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
- BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
- BmmCallbackInfo->FeConfigAccess.ExtractConfig = FakeExtractConfig;
- BmmCallbackInfo->FeConfigAccess.RouteConfig = FakeRouteConfig;
- BmmCallbackInfo->FeConfigAccess.Callback = FileExplorerCallback;
- BmmCallbackInfo->FeCurrentState = FileExplorerStateInActive;
- BmmCallbackInfo->FeDisplayContext = FileExplorerDisplayUnknown;
+ Length += sizeof (EFI_HII_PACKAGE_LIST_HEADER) + sizeof (EFI_HII_PACKAGE_HEADER);
+
+ //
+ // Allocate the storage for the entire Package List
+ //
+ PackageListHeader = AllocateZeroPool (Length);
//
- // Install Device Path Protocol and Config Access protocol to driver handle
+ // If the Package List can not be allocated, then return a NULL HII Handle
//
- Status = gBS->InstallMultipleProtocolInterfaces (
- &BmmCallbackInfo->BmmDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mBmmHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->BmmConfigAccess,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Exit;
+ if (PackageListHeader == NULL) {
+ return EFI_OUT_OF_RESOURCES;
}
//
- // Install Device Path Protocol and Config Access protocol to driver handle
+ // Fill in the GUID and Length of the Package List Header
//
- Status = gBS->InstallMultipleProtocolInterfaces (
- &BmmCallbackInfo->FeDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mFeHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->FeConfigAccess,
- NULL
- );
- if (EFI_ERROR (Status)) {
- goto Exit;
- }
+ PackageListHeader->PackageLength = Length;
//
- // Post our Boot Maint VFR binary to the HII database.
+ // Copy String Data into Package list.
//
- BmmCallbackInfo->BmmHiiHandle = HiiAddPackages (
- &gBootMaintFormSetGuid,
- BmmCallbackInfo->BmmDriverHandle,
- BmBin,
- BdsDxeStrings,
- NULL
- );
- ASSERT (BmmCallbackInfo->BmmHiiHandle != NULL);
+ Data = (UINT8 *)(PackageListHeader + 1);
+ Length = ReadUnaligned32 ((UINT32 *) BdsDxeStrings) - sizeof (UINT32);
+ CopyMem (Data, (UINT8 *) BdsDxeStrings + sizeof (UINT32), Length);
+
+ //
+ // Add End type HII package.
+ //
+ Data += Length;
+ ((EFI_HII_PACKAGE_HEADER *) Data)->Type = EFI_HII_PACKAGE_END;
+ ((EFI_HII_PACKAGE_HEADER *) Data)->Length = sizeof (EFI_HII_PACKAGE_HEADER);
//
- // Post our File Explorer VFR binary to the HII database.
+ // Update String package for BM
//
- BmmCallbackInfo->FeHiiHandle = HiiAddPackages (
- &gFileExploreFormSetGuid,
- BmmCallbackInfo->FeDriverHandle,
- FEBin,
- BdsDxeStrings,
- NULL
- );
- ASSERT (BmmCallbackInfo->FeHiiHandle != NULL);
+ CopyGuid (&PackageListHeader->PackageListGuid, &gBootMaintFormSetGuid);
+ Status = gHiiDatabase->UpdatePackageList (gHiiDatabase, BmmCallbackInfo->BmmHiiHandle, PackageListHeader);
+
+ //
+ // Update String package for FE.
+ //
+ CopyGuid (&PackageListHeader->PackageListGuid, &gFileExploreFormSetGuid);
+ Status = gHiiDatabase->UpdatePackageList (gHiiDatabase, BmmCallbackInfo->FeHiiHandle, PackageListHeader);
+
+ FreePool (PackageListHeader);
//
// Init OpCode Handle and Allocate space for creation of Buffer
@@ -1013,77 +1408,8 @@ InitializeBM ( CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverOptionMenu);
CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &TerminalMenu);
CreateMenuStringToken (BmmCallbackInfo, BmmCallbackInfo->BmmHiiHandle, &DriverMenu);
-
- UpdateBootDelPage (BmmCallbackInfo);
- UpdateDrvDelPage (BmmCallbackInfo);
-
- if (TerminalMenu.MenuNumber > 0) {
- BmmCallbackInfo->CurrentTerminal = 0;
- UpdateTerminalPage (BmmCallbackInfo);
- }
-
- Status = gBS->LocateProtocol (&gEfiLegacyBiosProtocolGuid, NULL, (VOID **) &LegacyBios);
- if (!EFI_ERROR (Status)) {
- RefreshUpdateData ();
- mStartLabel->Number = FORM_BOOT_LEGACY_DEVICE_ID;
-
- //
- // If LegacyBios Protocol is installed, add 3 tags about legacy boot option
- // in BootOption form: legacy FD/HD/CD/NET/BEV
- //
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_FD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_FD_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_FD_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_HD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_HD_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_HD_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_CD_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_CD_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_CD_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_NET_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_NET_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_NET_ORDER_ID
- );
-
- HiiCreateGotoOpCode (
- mStartOpCodeHandle,
- FORM_SET_BEV_ORDER_ID,
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- STRING_TOKEN (STR_FORM_SET_BEV_ORDER_TITLE),
- EFI_IFR_FLAG_CALLBACK,
- FORM_SET_BEV_ORDER_ID
- );
-
- HiiUpdateForm (
- BmmCallbackInfo->BmmHiiHandle,
- &gBootMaintFormSetGuid,
- FORM_BOOT_SETUP_ID,
- mStartOpCodeHandle, // Label FORM_BOOT_LEGACY_DEVICE_ID
- mEndOpCodeHandle // LABEL_END
- );
- }
+
+ InitializeBmmConfig (BmmCallbackInfo);
//
// Dispatch BMM main formset and File Explorer formset.
@@ -1091,13 +1417,10 @@ InitializeBM ( FormSetDispatcher (BmmCallbackInfo);
//
- // Remove our IFR data from HII database
+ // Clean up.
//
- HiiRemovePackages (BmmCallbackInfo->BmmHiiHandle);
- HiiRemovePackages (BmmCallbackInfo->FeHiiHandle);
-
CleanUpStringDepository ();
-
+
FreeAllMenu ();
Exit:
@@ -1109,34 +1432,10 @@ Exit: HiiFreeOpCodeHandle (mEndOpCodeHandle);
}
- if (BmmCallbackInfo->FeDriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- BmmCallbackInfo->FeDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mFeHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->FeConfigAccess,
- NULL
- );
- }
-
- if (BmmCallbackInfo->BmmDriverHandle != NULL) {
- gBS->UninstallMultipleProtocolInterfaces (
- BmmCallbackInfo->BmmDriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mBmmHiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- &BmmCallbackInfo->BmmConfigAccess,
- NULL
- );
- }
-
- FreePool (BmmCallbackInfo->LoadContext);
- FreePool (BmmCallbackInfo);
-
return Status;
}
+
/**
Initialized all Menu Option List.
@@ -1415,3 +1714,159 @@ FormSetDispatcher ( return Status;
}
+/**
+ Intall BootMaint and FileExplorer HiiPackages.
+
+**/
+EFI_STATUS
+InitBMPackage (
+ VOID
+ )
+{
+ BMM_CALLBACK_DATA *BmmCallbackInfo;
+ EFI_STATUS Status;
+ UINT8 *Ptr;
+
+ //
+ // Create CallbackData structures for Driver Callback
+ //
+ BmmCallbackInfo = AllocateZeroPool (sizeof (BMM_CALLBACK_DATA));
+ if (BmmCallbackInfo == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Create LoadOption in BmmCallbackInfo for Driver Callback
+ //
+ Ptr = AllocateZeroPool (sizeof (BM_LOAD_CONTEXT) + sizeof (BM_FILE_CONTEXT) + sizeof (BM_HANDLE_CONTEXT) + sizeof (BM_MENU_ENTRY));
+ if (Ptr == NULL) {
+ FreePool (BmmCallbackInfo);
+ BmmCallbackInfo = NULL;
+ return EFI_OUT_OF_RESOURCES;
+ }
+ //
+ // Initialize Bmm callback data.
+ //
+ BmmCallbackInfo->LoadContext = (BM_LOAD_CONTEXT *) Ptr;
+ Ptr += sizeof (BM_LOAD_CONTEXT);
+
+ BmmCallbackInfo->FileContext = (BM_FILE_CONTEXT *) Ptr;
+ Ptr += sizeof (BM_FILE_CONTEXT);
+
+ BmmCallbackInfo->HandleContext = (BM_HANDLE_CONTEXT *) Ptr;
+ Ptr += sizeof (BM_HANDLE_CONTEXT);
+
+ BmmCallbackInfo->MenuEntry = (BM_MENU_ENTRY *) Ptr;
+
+ BmmCallbackInfo->Signature = BMM_CALLBACK_DATA_SIGNATURE;
+ BmmCallbackInfo->BmmConfigAccess.ExtractConfig = BootMaintExtractConfig;
+ BmmCallbackInfo->BmmConfigAccess.RouteConfig = BootMaintRouteConfig;
+ BmmCallbackInfo->BmmConfigAccess.Callback = BootMaintCallback;
+ BmmCallbackInfo->FeConfigAccess.ExtractConfig = FakeExtractConfig;
+ BmmCallbackInfo->FeConfigAccess.RouteConfig = FileExplorerRouteConfig;
+ BmmCallbackInfo->FeConfigAccess.Callback = FileExplorerCallback;
+
+ //
+ // Install Device Path Protocol and Config Access protocol to driver handle
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &BmmCallbackInfo->BmmDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mBmmHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &BmmCallbackInfo->BmmConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Install Device Path Protocol and Config Access protocol to driver handle
+ //
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &BmmCallbackInfo->FeDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mFeHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &BmmCallbackInfo->FeConfigAccess,
+ NULL
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Post our Boot Maint VFR binary to the HII database.
+ //
+ BmmCallbackInfo->BmmHiiHandle = HiiAddPackages (
+ &gBootMaintFormSetGuid,
+ BmmCallbackInfo->BmmDriverHandle,
+ BmBin,
+ BdsDxeStrings,
+ NULL
+ );
+ ASSERT (BmmCallbackInfo->BmmHiiHandle != NULL);
+
+ //
+ // Post our File Explorer VFR binary to the HII database.
+ //
+ BmmCallbackInfo->FeHiiHandle = HiiAddPackages (
+ &gFileExploreFormSetGuid,
+ BmmCallbackInfo->FeDriverHandle,
+ FEBin,
+ BdsDxeStrings,
+ NULL
+ );
+ ASSERT (BmmCallbackInfo->FeHiiHandle != NULL);
+
+ mBmmCallbackInfo = BmmCallbackInfo;
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Remvoe the intalled BootMaint and FileExplorer HiiPackages.
+
+**/
+VOID
+FreeBMPackage (
+ VOID
+ )
+{
+ BMM_CALLBACK_DATA *BmmCallbackInfo;
+
+ BmmCallbackInfo = mBmmCallbackInfo;
+
+ //
+ // Remove our IFR data from HII database
+ //
+ HiiRemovePackages (BmmCallbackInfo->BmmHiiHandle);
+ HiiRemovePackages (BmmCallbackInfo->FeHiiHandle);
+
+ if (BmmCallbackInfo->FeDriverHandle != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ BmmCallbackInfo->FeDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mFeHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &BmmCallbackInfo->FeConfigAccess,
+ NULL
+ );
+ }
+
+ if (BmmCallbackInfo->BmmDriverHandle != NULL) {
+ gBS->UninstallMultipleProtocolInterfaces (
+ BmmCallbackInfo->BmmDriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mBmmHiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ &BmmCallbackInfo->BmmConfigAccess,
+ NULL
+ );
+ }
+
+ FreePool (BmmCallbackInfo->LoadContext);
+ FreePool (BmmCallbackInfo);
+
+ mBmmCallbackInfo = NULL;
+
+ return;
+}
+
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h index f9be0308ee..35cb3262a7 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootMaint.h @@ -168,9 +168,13 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT { #define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)
#define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)
#define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)
-#define CON_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleCheck)
-#define OPTION_ORDER_VAR_OFFSET VAR_OFFSET (OptionOrder)
-#define OPTION_DEL_VAR_OFFSET VAR_OFFSET (OptionDel)
+#define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)
+#define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)
+#define CON_ERR_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleErrCheck)
+#define BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)
+#define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)
+#define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)
+#define DRIVER_OPTION_DEL_VAR_OFFSET VAR_OFFSET (DriverOptionDel)
#define DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)
#define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)
#define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate)
@@ -206,9 +210,13 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT { #define CON_ERR_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
#define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
#define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)
-#define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)
-#define OPTION_ORDER_QUESTION_ID QUESTION_ID (OptionOrder)
-#define OPTION_DEL_QUESTION_ID QUESTION_ID (OptionDel)
+#define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)
+#define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)
+#define CON_ERR_DEVICE_QUESTION_ID QUESTION_ID (ConsoleErrCheck)
+#define BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)
+#define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)
+#define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
+#define DRIVER_OPTION_DEL_QUESTION_ID QUESTION_ID (DriverOptionDel)
#define DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
#define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
#define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
@@ -939,7 +947,8 @@ Var_UpdateDriverOrder ( **/
EFI_STATUS
Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData
+ IN BMM_CALLBACK_DATA *CallbackData,
+ IN EFI_FORM_ID FormId
);
/**
@@ -1248,23 +1257,6 @@ EfiLibStrFromDatahub ( );
/**
- Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type
- specified by DeviceType.
-
- @param DeviceType The legacy device type. It can be floppy, network, harddisk, cdrom,
- etc.
- @param OptionIndex Returns the index number (#### in Boot####).
- @param OptionSize Return the size of the Boot### variable.
-
-**/
-VOID *
-GetLegacyBootOptionVar (
- IN UINTN DeviceType,
- OUT UINTN *OptionIndex,
- OUT UINTN *OptionSize
- );
-
-/**
Initialize the Boot Maintenance Utitliy.
@retval EFI_SUCCESS utility ended successfully.
@@ -1446,6 +1438,47 @@ FileExplorerCallback ( );
/**
+ This function applies changes in a driver's configuration.
+ Input is a Configuration, which has the routing data for this
+ driver followed by name / value configuration pairs. The driver
+ must apply those pairs to its configurable storage. If the
+ driver's configuration is stored in a linear block of data
+ and the driver's name / value pairs are in <BlockConfig>
+ format, it may use the ConfigToBlock helper function (above) to
+ simplify the job. Currently not implemented.
+
+ @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param[in] Configuration A null-terminated Unicode string in
+ <ConfigString> format.
+ @param[out] Progress A pointer to a string filled in with the
+ offset of the most recent '&' before the
+ first failing name / value pair (or the
+ beginn ing of the string if the failure
+ is in the first name / value pair) or
+ the terminating NULL if all was
+ successful.
+
+ @retval EFI_SUCCESS The results have been distributed or are
+ awaiting distribution.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
+ parts of the results that must be
+ stored awaiting possible future
+ protocols.
+ @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
+ Results parameter would result
+ in this type of error.
+ @retval EFI_NOT_FOUND Target for the specified routing data
+ was not found.
+**/
+EFI_STATUS
+EFIAPI
+FileExplorerRouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ );
+
+/**
Dispatch BMM formset and FileExplorer formset.
@@ -1478,6 +1511,129 @@ EfiLibGetVariable ( IN EFI_GUID *VendorGuid
);
+/**
+ Get option number according to Boot#### and BootOrder variable.
+ The value is saved as #### + 1.
+
+ @param CallbackData The BMM context data.
+**/
+VOID
+GetBootOrder (
+ IN BMM_CALLBACK_DATA *CallbackData
+ );
+
+/**
+ Get driver option order from globalc DriverOptionMenu.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetDriverOrder (
+ IN BMM_CALLBACK_DATA *CallbackData
+ );
+
+/**
+ Intall BootMaint and FileExplorer HiiPackages.
+
+**/
+EFI_STATUS
+InitBMPackage (
+ VOID
+ );
+
+/**
+ Remvoe the intalled BootMaint and FileExplorer HiiPackages.
+
+**/
+VOID
+FreeBMPackage (
+ VOID
+ );
+
+/**
+ According to LegacyDevOrder variable to get legacy FD\HD\CD\NET\BEV
+ devices list .
+
+ @param CallbackData The BMM context data.
+**/
+VOID
+GetLegacyDeviceOrder (
+ IN BMM_CALLBACK_DATA *CallbackData
+ );
+
+/**
+
+ Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
+ in BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetConsoleInCheck (
+ IN BMM_CALLBACK_DATA *CallbackData
+ );
+
+/**
+
+ Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
+ in BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetConsoleOutCheck (
+ IN BMM_CALLBACK_DATA *CallbackData
+ );
+
+/**
+
+ Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
+ in BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetConsoleErrCheck (
+ IN BMM_CALLBACK_DATA *CallbackData
+ );
+
+/**
+
+ Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
+ to BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetTerminalAttribute (
+ IN BMM_CALLBACK_DATA *CallbackData
+ );
+
+/**
+
+ Find the first instance of this Protocol
+ in the system and return it's interface.
+
+
+ @param ProtocolGuid Provides the protocol to search for
+ @param Interface On return, a pointer to the first interface
+ that matches ProtocolGuid
+
+ @retval EFI_SUCCESS A protocol instance matching ProtocolGuid was found
+ @retval EFI_NOT_FOUND No protocol instances were found that match ProtocolGuid
+
+**/
+EFI_STATUS
+EfiLibLocateProtocol (
+ IN EFI_GUID *ProtocolGuid,
+ OUT VOID **Interface
+ );
+
//
// Global variable in this program (defined in data.c)
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c index 37d2350d56..591f884a94 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/BootOption.c @@ -5,7 +5,7 @@ Boot option manipulation
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1621,3 +1621,207 @@ BOpt_GetDriverOptions ( }
+/**
+ Get option number according to Boot#### and BootOrder variable.
+ The value is saved as #### + 1.
+
+ @param CallbackData The BMM context data.
+**/
+VOID
+GetBootOrder (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ BMM_FAKE_NV_DATA *BmmConfig;
+ UINT16 Index;
+ UINT16 OptionOrderIndex;
+ UINTN DeviceType;
+ BM_MENU_ENTRY *NewMenuEntry;
+ BM_LOAD_CONTEXT *NewLoadContext;
+
+ ASSERT (CallbackData != NULL);
+
+ DeviceType = (UINTN) -1;
+ BmmConfig = &CallbackData->BmmFakeNvData;
+ ZeroMem (BmmConfig->BootOptionOrder, sizeof (BmmConfig->BootOptionOrder));
+
+ for (Index = 0, OptionOrderIndex = 0; ((Index < BootOptionMenu.MenuNumber) &&
+ (OptionOrderIndex < (sizeof (BmmConfig->BootOptionOrder) / sizeof (BmmConfig->BootOptionOrder[0]))));
+ Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
+ NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
+
+ if (NewLoadContext->IsLegacy) {
+ if (((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType != DeviceType) {
+ DeviceType = ((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType;
+ } else {
+ //
+ // Only show one legacy boot option for the same device type
+ // assuming the boot options are grouped by the device type
+ //
+ continue;
+ }
+ }
+ BmmConfig->BootOptionOrder[OptionOrderIndex++] = (UINT32) (NewMenuEntry->OptionNumber + 1);
+ }
+}
+
+/**
+ According to LegacyDevOrder variable to get legacy FD\HD\CD\NET\BEV
+ devices list .
+
+ @param CallbackData The BMM context data.
+**/
+VOID
+GetLegacyDeviceOrder (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ UINTN Index;
+ UINTN OptionIndex;
+ UINT16 PageIdList [] = {FORM_SET_FD_ORDER_ID, FORM_SET_HD_ORDER_ID,
+ FORM_SET_CD_ORDER_ID, FORM_SET_NET_ORDER_ID,
+ FORM_SET_BEV_ORDER_ID};
+ UINTN PageNum;
+ UINTN VarSize;
+ UINT8 *VarData;
+ UINT8 *WorkingVarData;
+ LEGACY_DEV_ORDER_ENTRY *DevOrder;
+ UINT16 VarDevOrder;
+ UINT8 *DisMap;
+ BM_MENU_OPTION *OptionMenu;
+ BBS_TYPE BbsType;
+ UINT8 *LegacyOrder;
+ UINT8 *OldData;
+ UINTN Pos;
+ UINTN Bit;
+
+ ASSERT (CallbackData != NULL);
+
+ OptionMenu = NULL;
+ BbsType = 0;
+ LegacyOrder = NULL;
+ OldData = NULL;
+ DisMap = ZeroMem (CallbackData->BmmFakeNvData.DisableMap, sizeof (CallbackData->BmmFakeNvData.DisableMap));
+ PageNum = sizeof (PageIdList) / sizeof (PageIdList[0]);
+ VarData = BdsLibGetVariableAndSize (
+ VAR_LEGACY_DEV_ORDER,
+ &gEfiLegacyDevOrderVariableGuid,
+ &VarSize
+ );
+
+ for (Index = 0; Index < PageNum; Index++) {
+ switch (PageIdList[Index]) {
+
+ case FORM_SET_FD_ORDER_ID:
+ OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
+ BbsType = BBS_FLOPPY;
+ LegacyOrder = CallbackData->BmmFakeNvData.LegacyFD;
+ OldData = CallbackData->BmmOldFakeNVData.LegacyFD;
+ break;
+
+ case FORM_SET_HD_ORDER_ID:
+ OptionMenu = (BM_MENU_OPTION *) &LegacyHDMenu;
+ BbsType = BBS_HARDDISK;
+ LegacyOrder = CallbackData->BmmFakeNvData.LegacyHD;
+ OldData = CallbackData->BmmOldFakeNVData.LegacyHD;
+ break;
+
+ case FORM_SET_CD_ORDER_ID:
+ OptionMenu = (BM_MENU_OPTION *) &LegacyCDMenu;
+ BbsType = BBS_CDROM;
+ LegacyOrder = CallbackData->BmmFakeNvData.LegacyCD;
+ OldData = CallbackData->BmmOldFakeNVData.LegacyCD;
+ break;
+
+ case FORM_SET_NET_ORDER_ID:
+ OptionMenu = (BM_MENU_OPTION *) &LegacyNETMenu;
+ BbsType = BBS_EMBED_NETWORK;
+ LegacyOrder = CallbackData->BmmFakeNvData.LegacyNET;
+ OldData = CallbackData->BmmOldFakeNVData.LegacyNET;
+ break;
+
+ case FORM_SET_BEV_ORDER_ID:
+ OptionMenu = (BM_MENU_OPTION *) &LegacyBEVMenu;
+ BbsType = BBS_BEV_DEVICE;
+ LegacyOrder = CallbackData->BmmFakeNvData.LegacyBEV;
+ OldData = CallbackData->BmmOldFakeNVData.LegacyBEV;
+ break;
+
+ default:
+ DEBUG ((DEBUG_ERROR, "Invalid command ID for updating page!\n"));
+ break;
+ }
+
+ if (NULL != VarData) {
+ WorkingVarData = VarData;
+ DevOrder = (LEGACY_DEV_ORDER_ENTRY *) WorkingVarData;
+ while (WorkingVarData < VarData + VarSize) {
+ if (DevOrder->BbsType == BbsType) {
+ break;
+ }
+
+ WorkingVarData += sizeof (BBS_TYPE);
+ WorkingVarData += *(UINT16 *) WorkingVarData;
+ DevOrder = (LEGACY_DEV_ORDER_ENTRY *) WorkingVarData;
+ }
+ for (OptionIndex = 0; OptionIndex < OptionMenu->MenuNumber; OptionIndex++) {
+ VarDevOrder = *(UINT16 *) ((UINT8 *) DevOrder + sizeof (BBS_TYPE) + sizeof (UINT16) + OptionIndex * sizeof (UINT16));
+ if (0xFF00 == (VarDevOrder & 0xFF00)) {
+ LegacyOrder[OptionIndex] = 0xFF;
+ Pos = (VarDevOrder & 0xFF) / 8;
+ Bit = 7 - ((VarDevOrder & 0xFF) % 8);
+ DisMap[Pos] = (UINT8) (DisMap[Pos] | (UINT8) (1 << Bit));
+ } else {
+ LegacyOrder[OptionIndex] = (UINT8) (VarDevOrder & 0xFF);
+ }
+ }
+ CopyMem (OldData, LegacyOrder, 100);
+ }
+ }
+}
+
+/**
+ Get driver option order from globalc DriverOptionMenu.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetDriverOrder (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ BMM_FAKE_NV_DATA *BmmConfig;
+ UINT16 Index;
+ UINT16 OptionOrderIndex;
+ UINTN DeviceType;
+ BM_MENU_ENTRY *NewMenuEntry;
+ BM_LOAD_CONTEXT *NewLoadContext;
+
+ ASSERT (CallbackData != NULL);
+
+ DeviceType = (UINTN) -1;
+ BmmConfig = &CallbackData->BmmFakeNvData;
+ ZeroMem (BmmConfig->DriverOptionOrder, sizeof (BmmConfig->DriverOptionOrder));
+
+ for (Index = 0, OptionOrderIndex = 0; ((Index < DriverOptionMenu.MenuNumber) &&
+ (OptionOrderIndex < (sizeof (BmmConfig->DriverOptionOrder) / sizeof (BmmConfig->DriverOptionOrder[0]))));
+ Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
+ NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
+
+ if (NewLoadContext->IsLegacy) {
+ if (((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType != DeviceType) {
+ DeviceType = ((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType;
+ } else {
+ //
+ // Only show one legacy boot option for the same device type
+ // assuming the boot options are grouped by the device type
+ //
+ continue;
+ }
+ }
+ BmmConfig->DriverOptionOrder[OptionOrderIndex++] = (UINT32) (NewMenuEntry->OptionNumber + 1);
+ }
+}
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c index f216b4a03f..1854b98c36 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/ConsoleOption.c @@ -1,7 +1,7 @@ /** @file
handles console redirection from boot manager
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -1049,3 +1049,150 @@ GetConsoleOutMode ( }
}
}
+
+/**
+
+ Initialize console input device check box to ConsoleInCheck[MAX_MENU_NUMBER]
+ in BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetConsoleInCheck (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ UINT16 Index;
+ BM_MENU_ENTRY *NewMenuEntry;
+ UINT8 *ConInCheck;
+ BM_CONSOLE_CONTEXT *NewConsoleContext;
+
+ ASSERT (CallbackData != NULL);
+
+ ConInCheck = &CallbackData->BmmFakeNvData.ConsoleInCheck[0];
+ for (Index = 0; ((Index < ConsoleInpMenu.MenuNumber) && \
+ (Index < MAX_MENU_NUMBER)) ; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&ConsoleInpMenu, Index);
+ NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
+ ConInCheck[Index] = NewConsoleContext->IsActive;
+ }
+}
+
+/**
+
+ Initialize console output device check box to ConsoleOutCheck[MAX_MENU_NUMBER]
+ in BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetConsoleOutCheck (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ UINT16 Index;
+ BM_MENU_ENTRY *NewMenuEntry;
+ UINT8 *ConOutCheck;
+ BM_CONSOLE_CONTEXT *NewConsoleContext;
+
+ ASSERT (CallbackData != NULL);
+ ConOutCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
+ for (Index = 0; ((Index < ConsoleOutMenu.MenuNumber) && \
+ (Index < MAX_MENU_NUMBER)) ; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&ConsoleOutMenu, Index);
+ NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
+ ConOutCheck[Index] = NewConsoleContext->IsActive;
+ }
+}
+
+/**
+
+ Initialize standard error output device check box to ConsoleErrCheck[MAX_MENU_NUMBER]
+ in BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetConsoleErrCheck (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ UINT16 Index;
+ BM_MENU_ENTRY *NewMenuEntry;
+ UINT8 *ConErrCheck;
+ BM_CONSOLE_CONTEXT *NewConsoleContext;
+
+ ASSERT (CallbackData != NULL);
+ ConErrCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0];
+ for (Index = 0; ((Index < ConsoleErrMenu.MenuNumber) && \
+ (Index < MAX_MENU_NUMBER)) ; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&ConsoleErrMenu, Index);
+ NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
+ ConErrCheck[Index] = NewConsoleContext->IsActive;
+ }
+}
+
+/**
+
+ Initialize terminal attributes (baudrate, data rate, stop bits, parity and terminal type)
+ to BMM_FAKE_NV_DATA structure.
+
+ @param CallbackData The BMM context data.
+
+**/
+VOID
+GetTerminalAttribute (
+ IN BMM_CALLBACK_DATA *CallbackData
+ )
+{
+ BMM_FAKE_NV_DATA *CurrentFakeNVMap;
+ BM_MENU_ENTRY *NewMenuEntry;
+ BM_TERMINAL_CONTEXT *NewTerminalContext;
+ UINT16 TerminalIndex;
+ UINT8 AttributeIndex;
+
+ ASSERT (CallbackData != NULL);
+
+ CurrentFakeNVMap = &CallbackData->BmmFakeNvData;
+ for (TerminalIndex = 0; ((TerminalIndex < TerminalMenu.MenuNumber) && \
+ (TerminalIndex < MAX_MENU_NUMBER)); TerminalIndex++) {
+ NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, TerminalIndex);
+ NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
+ for (AttributeIndex = 0; AttributeIndex < sizeof (BaudRateList) / sizeof (BaudRateList [0]); AttributeIndex++) {
+ if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[AttributeIndex].Value)) {
+ NewTerminalContext->BaudRateIndex = AttributeIndex;
+ break;
+ }
+ }
+ for (AttributeIndex = 0; AttributeIndex < sizeof (DataBitsList) / sizeof (DataBitsList[0]); AttributeIndex++) {
+ if (NewTerminalContext->DataBits == (UINT64) (DataBitsList[AttributeIndex].Value)) {
+ NewTerminalContext->DataBitsIndex = AttributeIndex;
+ break;
+ }
+ }
+
+ for (AttributeIndex = 0; AttributeIndex < sizeof (ParityList) / sizeof (ParityList[0]); AttributeIndex++) {
+ if (NewTerminalContext->Parity == (UINT64) (ParityList[AttributeIndex].Value)) {
+ NewTerminalContext->ParityIndex = AttributeIndex;
+ break;
+ }
+ }
+
+ for (AttributeIndex = 0; AttributeIndex < sizeof (StopBitsList) / sizeof (StopBitsList[0]); AttributeIndex++) {
+ if (NewTerminalContext->StopBits == (UINT64) (StopBitsList[AttributeIndex].Value)) {
+ NewTerminalContext->StopBitsIndex = AttributeIndex;
+ break;
+ }
+ }
+ CurrentFakeNVMap->COMBaudRate[TerminalIndex] = NewTerminalContext->BaudRateIndex;
+ CurrentFakeNVMap->COMDataRate[TerminalIndex] = NewTerminalContext->DataBitsIndex;
+ CurrentFakeNVMap->COMStopBits[TerminalIndex] = NewTerminalContext->StopBitsIndex;
+ CurrentFakeNVMap->COMParity[TerminalIndex] = NewTerminalContext->ParityIndex;
+ CurrentFakeNVMap->COMTerminalType[TerminalIndex] = NewTerminalContext->TerminalType;
+ CurrentFakeNVMap->COMFlowControl[TerminalIndex] = NewTerminalContext->FlowControl;
+ }
+}
+
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr index 40fa01baf6..ee181babca 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FE.vfr @@ -2,7 +2,7 @@ //
// File Explorer Formset
//
-// Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
+// Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
@@ -43,14 +43,14 @@ formset subtitle text = STRING_TOKEN(STR_NULL_STRING);
- string varid = FeData.DescriptionData,
+ string varid = FeData.BootDescriptionData,
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
help = STRING_TOKEN(STR_NULL_STRING),
minsize = 6,
maxsize = 75,
endstring;
- string varid = FeData.OptionalData,
+ string varid = FeData.BootOptionalData,
prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
help = STRING_TOKEN(STR_NULL_STRING),
minsize = 0,
@@ -83,14 +83,14 @@ formset subtitle text = STRING_TOKEN(STR_NULL_STRING);
- string varid = FeData.DescriptionData,
+ string varid = FeData.DriverDescriptionData,
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
help = STRING_TOKEN(STR_NULL_STRING),
minsize = 6,
maxsize = 75,
endstring;
- string varid = FeData.OptionalData,
+ string varid = FeData.DriverOptionalData,
prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
help = STRING_TOKEN(STR_NULL_STRING),
minsize = 0,
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c index 72a5e2daa7..2d728cbb7f 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FileExplorer.c @@ -217,6 +217,127 @@ UpdateFileExplorer ( }
/**
+ This function applies changes in a driver's configuration.
+ Input is a Configuration, which has the routing data for this
+ driver followed by name / value configuration pairs. The driver
+ must apply those pairs to its configurable storage. If the
+ driver's configuration is stored in a linear block of data
+ and the driver's name / value pairs are in <BlockConfig>
+ format, it may use the ConfigToBlock helper function (above) to
+ simplify the job. Currently not implemented.
+
+ @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
+ @param[in] Configuration A null-terminated Unicode string in
+ <ConfigString> format.
+ @param[out] Progress A pointer to a string filled in with the
+ offset of the most recent '&' before the
+ first failing name / value pair (or the
+ beginn ing of the string if the failure
+ is in the first name / value pair) or
+ the terminating NULL if all was
+ successful.
+
+ @retval EFI_SUCCESS The results have been distributed or are
+ awaiting distribution.
+ @retval EFI_OUT_OF_RESOURCES Not enough memory to store the
+ parts of the results that must be
+ stored awaiting possible future
+ protocols.
+ @retval EFI_INVALID_PARAMETERS Passing in a NULL for the
+ Results parameter would result
+ in this type of error.
+ @retval EFI_NOT_FOUND Target for the specified routing data
+ was not found.
+**/
+EFI_STATUS
+EFIAPI
+FileExplorerRouteConfig (
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
+ )
+{
+ EFI_STATUS Status;
+ UINTN BufferSize;
+ EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
+ FILE_EXPLORER_NV_DATA *FeData;
+ BMM_CALLBACK_DATA *Private;
+
+ if (Progress == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+ *Progress = Configuration;
+
+ if (Configuration == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Check routing data in <ConfigHdr>.
+ // Note: there is no name for Name/Value storage, only GUID will be checked
+ //
+ if (!HiiIsConfigHdrMatch (Configuration, &gFileExploreFormSetGuid, mFileExplorerStorageName)) {
+ return EFI_NOT_FOUND;
+ }
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiConfigRoutingProtocolGuid,
+ NULL,
+ &ConfigRouting
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Private = FE_CALLBACK_DATA_FROM_THIS (This);
+ //
+ // Get Buffer Storage data from EFI variable
+ //
+ BufferSize = sizeof (FILE_EXPLORER_NV_DATA );
+ FeData = &Private->FeFakeNvData;
+
+ //
+ // Convert <ConfigResp> to buffer data by helper function ConfigToBlock()
+ //
+ Status = ConfigRouting->ConfigToBlock (
+ ConfigRouting,
+ Configuration,
+ (UINT8 *) FeData,
+ &BufferSize,
+ Progress
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ if (FeData->BootDescriptionData[0] != 0x00 || FeData->BootOptionalData[0] != 0x00) {
+ Status = Var_UpdateBootOption (Private, FeData);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ BOpt_GetBootOptions (Private);
+ CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);
+ }
+
+ if (FeData->DriverDescriptionData[0] != 0x00 || FeData->DriverOptionalData[0] != 0x00) {
+ Status = Var_UpdateDriverOption (
+ Private,
+ Private->FeHiiHandle,
+ FeData->DriverDescriptionData,
+ FeData->DriverOptionalData,
+ FeData->ForceReconnect
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ BOpt_GetDriverOptions (Private);
+ CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
This function processes the results of changes in configuration.
When user select a interactive opcode, this callback will be triggered.
Based on the Question(QuestionId) that triggers the callback, the corresponding
@@ -295,8 +416,8 @@ FileExplorerCallback ( Status = Var_UpdateDriverOption (
Private,
Private->FeHiiHandle,
- NvRamMap->DescriptionData,
- NvRamMap->OptionalData,
+ NvRamMap->DriverDescriptionData,
+ NvRamMap->DriverOptionalData,
NvRamMap->ForceReconnect
);
if (EFI_ERROR (Status)) {
@@ -308,14 +429,21 @@ FileExplorerCallback ( }
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
+ } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
+ //
+ // Discard changes and exit formset
+ //
+ NvRamMap->DriverOptionalData[0] = 0x0000;
+ NvRamMap->DriverDescriptionData[0] = 0x0000;
+ *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
+ } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT) {
//
// Discard changes and exit formset
//
- NvRamMap->OptionalData[0] = 0x0000;
- NvRamMap->DescriptionData[0] = 0x0000;
+ NvRamMap->BootOptionalData[0] = 0x0000;
+ NvRamMap->BootDescriptionData[0] = 0x0000;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
- } else if (QuestionId < FILE_OPTION_OFFSET) {
+ }else if (QuestionId < FILE_OPTION_OFFSET) {
//
// Exit File Explorer formset
//
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h index f0049a3043..6f65307d06 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/FormGuid.h @@ -1,7 +1,7 @@ /** @file
Formset guids, form id and VarStore data structure for Boot Maintenance Manager.
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -137,28 +137,46 @@ typedef struct { // At most 100 input/output/errorout device for console storage
//
UINT8 ConsoleCheck[MAX_MENU_NUMBER];
+ //
+ // At most 100 input/output/errorout device for console storage
+ //
+ UINT8 ConsoleInCheck[MAX_MENU_NUMBER];
+ UINT8 ConsoleOutCheck[MAX_MENU_NUMBER];
+ UINT8 ConsoleErrCheck[MAX_MENU_NUMBER];
//
- // Boot or Driver Option Order storage
+ // Boot Option Order storage
// The value is the OptionNumber+1 because the order list value cannot be 0
// Use UINT32 to hold the potential value 0xFFFF+1=0x10000
//
- UINT32 OptionOrder[MAX_MENU_NUMBER];
+ UINT32 BootOptionOrder[MAX_MENU_NUMBER];
+
+ //
+ // Driver Option Order storage
+ // The value is the OptionNumber+1 because the order list value cannot be 0
+ // Use UINT32 to hold the potential value 0xFFFF+1=0x10000
+ //
+ UINT32 DriverOptionOrder[MAX_MENU_NUMBER];
+
+ //
+ // Boot Option Delete storage
+ //
+ BOOLEAN BootOptionDel[MAX_MENU_NUMBER];
//
- // Boot or Driver Option Delete storage
+ // Driver Option Delete storage
//
- BOOLEAN OptionDel[MAX_MENU_NUMBER];
+ BOOLEAN DriverOptionDel[MAX_MENU_NUMBER];
//
// This is the Terminal Attributes value storage
//
- UINT8 COMBaudRate;
- UINT8 COMDataRate;
- UINT8 COMStopBits;
- UINT8 COMParity;
- UINT8 COMTerminalType;
- UINT8 COMFlowControl;
+ UINT8 COMBaudRate[MAX_MENU_NUMBER];
+ UINT8 COMDataRate[MAX_MENU_NUMBER];
+ UINT8 COMStopBits[MAX_MENU_NUMBER];
+ UINT8 COMParity[MAX_MENU_NUMBER];
+ UINT8 COMTerminalType[MAX_MENU_NUMBER];
+ UINT8 COMFlowControl[MAX_MENU_NUMBER];
//
// Legacy Device Order Selection Storage
@@ -199,8 +217,10 @@ typedef struct { /// This is the data structure used by File Explorer formset
///
typedef struct {
- UINT16 DescriptionData[75];
- UINT16 OptionalData[127];
+ UINT16 BootDescriptionData[75];
+ UINT16 BootOptionalData[127];
+ UINT16 DriverDescriptionData[75];
+ UINT16 DriverOptionalData[127];
UINT8 Active;
UINT8 ForceReconnect;
} FILE_EXPLORER_NV_DATA;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c index 7317767c00..91a38ec702 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c @@ -1,7 +1,7 @@ /** @file
Dynamically update the pages.
-Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -254,7 +254,7 @@ UpdateBootDelPage ( UpdatePageStart (CallbackData);
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
- ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.OptionDel) / sizeof (CallbackData->BmmFakeNvData.OptionDel[0])));
+ ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.BootOptionDel) / sizeof (CallbackData->BmmFakeNvData.BootOptionDel[0])));
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
@@ -263,13 +263,13 @@ UpdateBootDelPage ( }
NewLoadContext->Deleted = FALSE;
- CallbackData->BmmFakeNvData.OptionDel[Index] = FALSE;
+ //CallbackData->BmmFakeNvData.BootOptionDel[Index] = FALSE;
HiiCreateCheckBoxOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) (OPTION_DEL_QUESTION_ID + Index),
+ (EFI_QUESTION_ID) (BOOT_OPTION_DEL_QUESTION_ID + Index),
VARSTORE_ID_BOOT_MAINT,
- (UINT16) (OPTION_DEL_VAR_OFFSET + Index),
+ (UINT16) (BOOT_OPTION_DEL_VAR_OFFSET + Index),
NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken,
0,
@@ -337,19 +337,19 @@ UpdateDrvDelPage ( CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu);
- ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.OptionDel) / sizeof (CallbackData->BmmFakeNvData.OptionDel[0])));
+ ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.DriverOptionDel) / sizeof (CallbackData->BmmFakeNvData.DriverOptionDel[0])));
for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
NewLoadContext->Deleted = FALSE;
- CallbackData->BmmFakeNvData.OptionDel[Index] = FALSE;
+ //CallbackData->BmmFakeNvData.DriverOptionDel[Index] = FALSE;
HiiCreateCheckBoxOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) (OPTION_DEL_QUESTION_ID + Index),
+ (EFI_QUESTION_ID) (DRIVER_OPTION_DEL_QUESTION_ID + Index),
VARSTORE_ID_BOOT_MAINT,
- (UINT16) (OPTION_DEL_VAR_OFFSET + Index),
+ (UINT16) (DRIVER_OPTION_DEL_VAR_OFFSET + Index),
NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken,
0,
@@ -449,71 +449,57 @@ UpdateConsolePage ( )
{
BM_MENU_ENTRY *NewMenuEntry;
- BM_CONSOLE_CONTEXT *NewConsoleContext;
- BM_TERMINAL_CONTEXT *NewTerminalContext;
UINT16 Index;
- UINT16 Index2;
UINT8 CheckFlags;
-
- CallbackData->BmmAskSaveOrNot = TRUE;
+ UINT8 *ConsoleCheck;
+ EFI_QUESTION_ID QuestionIdBase;
+ UINT16 VariableOffsetBase;
UpdatePageStart (CallbackData);
- for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \
- (Index < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))) ; Index++) {
- NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
- NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
- CheckFlags = 0;
- if (NewConsoleContext->IsActive) {
- CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT;
- CallbackData->BmmFakeNvData.ConsoleCheck[Index] = TRUE;
- } else {
- CallbackData->BmmFakeNvData.ConsoleCheck[Index] = FALSE;
- }
+ ConsoleCheck = NULL;
+ QuestionIdBase = 0;
+ VariableOffsetBase = 0;
- HiiCreateCheckBoxOpCode (
- mStartOpCodeHandle,
- (EFI_QUESTION_ID) (CON_DEVICE_QUESTION_ID + Index),
- VARSTORE_ID_BOOT_MAINT,
- (UINT16) (CON_DEVICE_VAR_OFFSET + Index),
- NewMenuEntry->DisplayStringToken,
- NewMenuEntry->HelpStringToken,
- 0,
- CheckFlags,
- NULL
- );
+ switch (UpdatePageId) {
+ case FORM_CON_IN_ID:
+ ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleInCheck[0];
+ QuestionIdBase = CON_IN_DEVICE_QUESTION_ID;
+ VariableOffsetBase = CON_IN_DEVICE_VAR_OFFSET;
+ break;
+
+ case FORM_CON_OUT_ID:
+ ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
+ QuestionIdBase = CON_OUT_DEVICE_QUESTION_ID;
+ VariableOffsetBase = CON_OUT_DEVICE_VAR_OFFSET;
+ break;
+
+ case FORM_CON_ERR_ID:
+ ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0];
+ QuestionIdBase = CON_ERR_DEVICE_QUESTION_ID;
+ VariableOffsetBase = CON_ERR_DEVICE_VAR_OFFSET;
+ break;
}
+ ASSERT (ConsoleCheck != NULL);
- for (Index2 = 0; ((Index2 < TerminalMenu.MenuNumber) && \
- (Index2 < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))); Index2++) {
- CheckFlags = 0;
- NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2);
- NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
-
- ASSERT (Index < MAX_MENU_NUMBER);
- if (((NewTerminalContext->IsConIn != 0) && (UpdatePageId == FORM_CON_IN_ID)) ||
- ((NewTerminalContext->IsConOut != 0) && (UpdatePageId == FORM_CON_OUT_ID)) ||
- ((NewTerminalContext->IsStdErr != 0) && (UpdatePageId == FORM_CON_ERR_ID))
- ) {
+ for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \
+ (Index < MAX_MENU_NUMBER)) ; Index++) {
+ CheckFlags = 0;
+ if (UpdatePageId != FORM_CON_ERR_ID) {
CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT;
- CallbackData->BmmFakeNvData.ConsoleCheck[Index] = TRUE;
- } else {
- CallbackData->BmmFakeNvData.ConsoleCheck[Index] = FALSE;
}
-
+ NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
HiiCreateCheckBoxOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) (CON_DEVICE_QUESTION_ID + Index),
+ (EFI_QUESTION_ID) (QuestionIdBase + Index),
VARSTORE_ID_BOOT_MAINT,
- (UINT16) (CON_DEVICE_VAR_OFFSET + Index),
+ (UINT16) (VariableOffsetBase + Index),
NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken,
0,
CheckFlags,
NULL
);
-
- Index++;
}
UpdatePageEnd (CallbackData);
@@ -535,68 +521,73 @@ UpdateOrderPage ( IN BMM_CALLBACK_DATA *CallbackData
)
{
- BM_MENU_ENTRY *NewMenuEntry;
- UINT16 Index;
- UINT16 OptionOrderIndex;
- VOID *OptionsOpCodeHandle;
- UINTN DeviceType;
- BM_LOAD_CONTEXT *NewLoadContext;
+ BM_MENU_ENTRY *NewMenuEntry;
+ UINT16 Index;
+ UINT16 OptionIndex;
+ VOID *OptionsOpCodeHandle;
+ BM_LOAD_CONTEXT *NewLoadContext;
+ BOOLEAN BootOptionFound;
+ UINT32 *OptionOrder;
+ EFI_QUESTION_ID QuestionId;
+ UINT16 VarOffset;
- DeviceType = (UINTN) -1;
- CallbackData->BmmAskSaveOrNot = TRUE;
UpdatePageStart (CallbackData);
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu);
+
+ OptionOrder = NULL;
+ QuestionId = 0;
+ VarOffset = 0;
+ switch (UpdatePageId) {
- ZeroMem (CallbackData->BmmFakeNvData.OptionOrder, sizeof (CallbackData->BmmFakeNvData.OptionOrder));
+ case FORM_BOOT_CHG_ID:
+ //GetBootOrder (CallbackData);
+ OptionOrder = CallbackData->BmmFakeNvData.BootOptionOrder;
+ QuestionId = BOOT_OPTION_ORDER_QUESTION_ID;
+ VarOffset = BOOT_OPTION_ORDER_VAR_OFFSET;
+ break;
+
+ case FORM_DRV_CHG_ID:
+ //GetDriverOrder (CallbackData);
+ OptionOrder = CallbackData->BmmFakeNvData.DriverOptionOrder;
+ QuestionId = DRIVER_OPTION_ORDER_QUESTION_ID;
+ VarOffset = DRIVER_OPTION_ORDER_VAR_OFFSET;
+ break;
+ }
+ ASSERT (OptionOrder != NULL);
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
- for (
- Index = 0, OptionOrderIndex = 0;
- (
- (Index < OptionMenu->MenuNumber) &&
- (OptionOrderIndex <
- (
- sizeof (CallbackData->BmmFakeNvData.OptionOrder) /
- sizeof (CallbackData->BmmFakeNvData.OptionOrder[0])
- )
- )
- );
- Index++
- ) {
- NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
- NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
-
- if (NewLoadContext->IsLegacy) {
- if (((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType != DeviceType) {
- DeviceType = ((BBS_BBS_DEVICE_PATH *) NewLoadContext->FilePathList)->DeviceType;
- } else {
- //
- // Only show one legacy boot option for the same device type
- // assuming the boot options are grouped by the device type
- //
- continue;
+ NewMenuEntry = NULL;
+ for (OptionIndex = 0; (OptionOrder[OptionIndex] != 0 && OptionIndex < MAX_MENU_NUMBER); OptionIndex++) {
+ BootOptionFound = FALSE;
+ for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
+ NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
+ NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
+ if ((UINT32) (NewMenuEntry->OptionNumber + 1) == OptionOrder[OptionIndex]) {
+ BootOptionFound = TRUE;
+ break;
}
}
- HiiCreateOneOfOptionOpCode (
- OptionsOpCodeHandle,
- NewMenuEntry->DisplayStringToken,
- 0,
- EFI_IFR_TYPE_NUM_SIZE_32,
- (UINT32) (NewMenuEntry->OptionNumber + 1)
- );
- CallbackData->BmmFakeNvData.OptionOrder[OptionOrderIndex++] = (UINT32) (NewMenuEntry->OptionNumber + 1);
+ if (BootOptionFound) {
+ HiiCreateOneOfOptionOpCode (
+ OptionsOpCodeHandle,
+ NewMenuEntry->DisplayStringToken,
+ 0,
+ EFI_IFR_TYPE_NUM_SIZE_32,
+ OptionOrder[OptionIndex]
+ );
+ }
}
-
+
if (OptionMenu->MenuNumber > 0) {
HiiCreateOrderedListOpCode (
mStartOpCodeHandle, // Container for dynamic created opcodes
- (EFI_QUESTION_ID) OPTION_ORDER_QUESTION_ID, // Question ID
+ QuestionId, // Question ID
VARSTORE_ID_BOOT_MAINT, // VarStore ID
- OPTION_ORDER_VAR_OFFSET, // Offset in Buffer Storage
+ VarOffset, // Offset in Buffer Storage
STRING_TOKEN (STR_CHANGE_ORDER), // Question prompt text
STRING_TOKEN (STR_CHANGE_ORDER), // Question help text
0, // Question flag
@@ -611,12 +602,6 @@ UpdateOrderPage ( HiiFreeOpCodeHandle (OptionsOpCodeHandle);
UpdatePageEnd (CallbackData);
-
- CopyMem (
- CallbackData->BmmOldFakeNVData.OptionOrder,
- CallbackData->BmmFakeNvData.OptionOrder,
- sizeof (CallbackData->BmmOldFakeNVData.OptionOrder)
- );
}
/**
@@ -647,7 +632,7 @@ UpdateBootNextPage ( OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
- CallbackData->BmmFakeNvData.BootNext = (UINT16) (BootOptionMenu.MenuNumber);
+ //CallbackData->BmmFakeNvData.BootNext = (UINT16) (BootOptionMenu.MenuNumber);
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
@@ -661,7 +646,7 @@ UpdateBootNextPage ( EFI_IFR_TYPE_NUM_SIZE_16,
Index
);
- CallbackData->BmmFakeNvData.BootNext = Index;
+ //CallbackData->BmmFakeNvData.BootNext = Index;
} else {
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
@@ -751,7 +736,7 @@ UpdateTimeOutPage ( HiiFreeOpCodeHandle (DefaultOpCodeHandle);
- CallbackData->BmmFakeNvData.BootTimeOut = BootTimeOut;
+ //CallbackData->BmmFakeNvData.BootTimeOut = BootTimeOut;
UpdatePageEnd (CallbackData);
}
@@ -813,7 +798,7 @@ UpdateConModePage ( //
// Determin which mode should be the first entry in menu
//
- GetConsoleOutMode (CallbackData);
+ // GetConsoleOutMode (CallbackData);
//
// Build text mode options
@@ -891,14 +876,14 @@ UpdateTerminalPage ( BM_MENU_ENTRY *NewMenuEntry;
BM_TERMINAL_CONTEXT *NewTerminalContext;
VOID *OptionsOpCodeHandle;
-
- CallbackData->BmmAskSaveOrNot = TRUE;
+ UINTN CurrentTerminal;
UpdatePageStart (CallbackData);
+ CurrentTerminal = CallbackData->CurrentTerminal;
NewMenuEntry = BOpt_GetMenuEntry (
&TerminalMenu,
- CallbackData->CurrentTerminal
+ CurrentTerminal
);
if (NewMenuEntry == NULL) {
@@ -912,12 +897,9 @@ UpdateTerminalPage ( for (Index = 0; Index < sizeof (BaudRateList) / sizeof (BaudRateList [0]); Index++) {
CheckFlags = 0;
- if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[Index].Value)) {
+ if (BaudRateList[Index].Value == 115200) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- NewTerminalContext->BaudRateIndex = Index;
- CallbackData->BmmFakeNvData.COMBaudRate = NewTerminalContext->BaudRateIndex;
}
-
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
BaudRateList[Index].StringToken,
@@ -929,9 +911,9 @@ UpdateTerminalPage ( HiiCreateOneOfOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) COM_BAUD_RATE_QUESTION_ID,
+ (EFI_QUESTION_ID) (COM_BAUD_RATE_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT,
- COM_BAUD_RATE_VAR_OFFSET,
+ (UINT16) (COM_BAUD_RATE_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_BAUD_RATE),
STRING_TOKEN (STR_COM_BAUD_RATE),
0,
@@ -947,9 +929,7 @@ UpdateTerminalPage ( for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) {
CheckFlags = 0;
- if (NewTerminalContext->DataBits == DataBitsList[Index].Value) {
- NewTerminalContext->DataBitsIndex = Index;
- CallbackData->BmmFakeNvData.COMDataRate = NewTerminalContext->DataBitsIndex;
+ if (DataBitsList[Index].Value == 8) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
}
@@ -964,9 +944,9 @@ UpdateTerminalPage ( HiiCreateOneOfOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) COM_DATA_RATE_QUESTION_ID,
+ (EFI_QUESTION_ID) (COM_DATA_RATE_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT,
- COM_DATA_RATE_VAR_OFFSET,
+ (UINT16) (COM_DATA_RATE_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_DATA_BITS),
STRING_TOKEN (STR_COM_DATA_BITS),
0,
@@ -981,10 +961,8 @@ UpdateTerminalPage ( for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) {
CheckFlags = 0;
- if (NewTerminalContext->Parity == ParityList[Index].Value) {
+ if (ParityList[Index].Value == NoParity) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- NewTerminalContext->ParityIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData.COMParity = NewTerminalContext->ParityIndex;
}
HiiCreateOneOfOptionOpCode (
@@ -998,9 +976,9 @@ UpdateTerminalPage ( HiiCreateOneOfOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) COM_PARITY_QUESTION_ID,
+ (EFI_QUESTION_ID) (COM_PARITY_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT,
- COM_PARITY_VAR_OFFSET,
+ (UINT16) (COM_PARITY_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_PARITY),
STRING_TOKEN (STR_COM_PARITY),
0,
@@ -1015,10 +993,8 @@ UpdateTerminalPage ( for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) {
CheckFlags = 0;
- if (NewTerminalContext->StopBits == StopBitsList[Index].Value) {
+ if (StopBitsList[Index].Value == OneStopBit) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- NewTerminalContext->StopBitsIndex = (UINT8) Index;
- CallbackData->BmmFakeNvData.COMStopBits = NewTerminalContext->StopBitsIndex;
}
HiiCreateOneOfOptionOpCode (
@@ -1032,9 +1008,9 @@ UpdateTerminalPage ( HiiCreateOneOfOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) COM_STOP_BITS_QUESTION_ID,
+ (EFI_QUESTION_ID) (COM_STOP_BITS_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT,
- COM_STOP_BITS_VAR_OFFSET,
+ (UINT16) (COM_STOP_BITS_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_STOP_BITS),
STRING_TOKEN (STR_COM_STOP_BITS),
0,
@@ -1049,9 +1025,8 @@ UpdateTerminalPage ( for (Index = 0; Index < 4; Index++) {
CheckFlags = 0;
- if (NewTerminalContext->TerminalType == Index) {
+ if (Index == 0) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
- CallbackData->BmmFakeNvData.COMTerminalType = NewTerminalContext->TerminalType;
}
HiiCreateOneOfOptionOpCode (
@@ -1065,9 +1040,9 @@ UpdateTerminalPage ( HiiCreateOneOfOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) COM_TERMINAL_QUESTION_ID,
+ (EFI_QUESTION_ID) (COM_TERMINAL_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT,
- COM_TERMINAL_VAR_OFFSET,
+ (UINT16) (COM_TERMINAL_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_TERMI_TYPE),
STRING_TOKEN (STR_COM_TERMI_TYPE),
0,
@@ -1080,12 +1055,15 @@ UpdateTerminalPage ( OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
- CallbackData->BmmFakeNvData.COMFlowControl = NewTerminalContext->FlowControl;
for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {
+ CheckFlags = 0;
+ if (Index == 0) {
+ CheckFlags |= EFI_IFR_OPTION_DEFAULT;
+ }
HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle,
(EFI_STRING_ID) mFlowControlType[Index],
- 0,
+ CheckFlags,
EFI_IFR_TYPE_NUM_SIZE_8,
mFlowControlValue[Index]
);
@@ -1093,9 +1071,9 @@ UpdateTerminalPage ( HiiCreateOneOfOpCode (
mStartOpCodeHandle,
- (EFI_QUESTION_ID) COM_FLOWCONTROL_QUESTION_ID,
+ (EFI_QUESTION_ID) (COM_FLOWCONTROL_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT,
- COM_FLOWCONTROL_VAR_OFFSET,
+ (UINT16) (COM_FLOWCONTROL_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_FLOW_CONTROL),
STRING_TOKEN (STR_COM_FLOW_CONTROL),
0,
@@ -1151,92 +1129,6 @@ UpdatePageBody ( }
/**
- Get the index number (#### in Boot####) for the boot option pointed to a BBS legacy device type
- specified by DeviceType.
-
- @param DeviceType The legacy device type. It can be floppy, network, harddisk, cdrom,
- etc.
- @param OptionIndex Returns the index number (#### in Boot####).
- @param OptionSize Return the size of the Boot### variable.
-
-**/
-VOID *
-GetLegacyBootOptionVar (
- IN UINTN DeviceType,
- OUT UINTN *OptionIndex,
- OUT UINTN *OptionSize
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;
- VOID *OptionBuffer;
- UINTN OrderSize;
- UINTN Index;
- UINT16 *OrderBuffer;
- CHAR16 StrTemp[100];
- UINT16 FilePathSize;
- UINT8 *Ptr;
- UINT8 *OptionalData;
-
- //
- // Get Boot Option number from the size of BootOrder
- //
- OrderBuffer = BdsLibGetVariableAndSize (
- L"BootOrder",
- &gEfiGlobalVariableGuid,
- &OrderSize
- );
-
- if (OrderBuffer == NULL) {
- return NULL;
- }
-
- for (Index = 0; Index < OrderSize / sizeof (UINT16); Index++) {
- UnicodeSPrint (StrTemp, sizeof (StrTemp), L"Boot%04x", OrderBuffer[Index]);
- OptionBuffer = BdsLibGetVariableAndSize (
- StrTemp,
- &gEfiGlobalVariableGuid,
- OptionSize
- );
- if (NULL == OptionBuffer) {
- continue;
- }
-
- Ptr = (UINT8 *) OptionBuffer;
- Ptr += sizeof (UINT32);
-
- FilePathSize = *(UINT16 *) Ptr;
- Ptr += sizeof (UINT16);
-
- Ptr += StrSize ((CHAR16 *) Ptr);
-
- //
- // Now Ptr point to Device Path
- //
- DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) Ptr;
- Ptr += FilePathSize;
-
- //
- // Now Ptr point to Optional Data
- //
- OptionalData = Ptr;
-
- if ((DeviceType == ((BBS_TABLE *) OptionalData)->DeviceType) &&
- (BBS_DEVICE_PATH == DevicePath->Type) &&
- (BBS_BBS_DP == DevicePath->SubType)
- ) {
- *OptionIndex = OrderBuffer[Index];
- FreePool (OrderBuffer);
- return OptionBuffer;
- } else {
- FreePool (OptionBuffer);
- }
- }
-
- FreePool (OrderBuffer);
- return NULL;
-}
-
-/**
Create a dynamic page so that Legacy Device boot order
can be set for specified device type.
@@ -1443,6 +1335,7 @@ UpdateSetLegacyDeviceOrderPage ( UpdatePageEnd (CallbackData);
}
+
/**
Dispatch the display to the next page based on NewPageId.
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c index 529fdaea2a..63eeb54ccf 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/Variable.c @@ -752,16 +752,16 @@ Var_UpdateBootOption ( Index = BOpt_GetBootOptionNumber () ;
UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);
- if (NvRamMap->DescriptionData[0] == 0x0000) {
- StrCpy (NvRamMap->DescriptionData, BootString);
+ if (NvRamMap->BootDescriptionData[0] == 0x0000) {
+ StrCpy (NvRamMap->BootDescriptionData, BootString);
}
- BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (NvRamMap->DescriptionData);
+ BufferSize = sizeof (UINT32) + sizeof (UINT16) + StrSize (NvRamMap->BootDescriptionData);
BufferSize += GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- if (NvRamMap->OptionalData[0] != 0x0000) {
+ if (NvRamMap->BootOptionalData[0] != 0x0000) {
OptionalDataExist = TRUE;
- BufferSize += StrSize (NvRamMap->OptionalData);
+ BufferSize += StrSize (NvRamMap->BootOptionalData);
}
Buffer = AllocateZeroPool (BufferSize);
@@ -791,21 +791,21 @@ Var_UpdateBootOption ( CopyMem (
Ptr,
- NvRamMap->DescriptionData,
- StrSize (NvRamMap->DescriptionData)
+ NvRamMap->BootDescriptionData,
+ StrSize (NvRamMap->BootDescriptionData)
);
- NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->DescriptionData));
+ NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->BootDescriptionData));
ASSERT (NewLoadContext->Description != NULL);
NewMenuEntry->DisplayString = NewLoadContext->Description;
CopyMem (
NewLoadContext->Description,
(VOID *) Ptr,
- StrSize (NvRamMap->DescriptionData)
+ StrSize (NvRamMap->BootDescriptionData)
);
- Ptr += StrSize (NvRamMap->DescriptionData);
+ Ptr += StrSize (NvRamMap->BootDescriptionData);
CopyMem (
Ptr,
CallbackData->LoadContext->FilePathList,
@@ -838,7 +838,7 @@ Var_UpdateBootOption ( if (OptionalDataExist) {
Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
- CopyMem (Ptr, NvRamMap->OptionalData, StrSize (NvRamMap->OptionalData));
+ CopyMem (Ptr, NvRamMap->BootOptionalData, StrSize (NvRamMap->BootOptionalData));
}
Status = gRT->SetVariable (
@@ -879,8 +879,8 @@ Var_UpdateBootOption ( InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
BootOptionMenu.MenuNumber++;
- NvRamMap->DescriptionData[0] = 0x0000;
- NvRamMap->OptionalData[0] = 0x0000;
+ NvRamMap->BootDescriptionData[0] = 0x0000;
+ NvRamMap->BootOptionalData[0] = 0x0000;
}
}
return EFI_SUCCESS;
@@ -983,11 +983,11 @@ Var_UpdateBootOrder ( return EFI_OUT_OF_RESOURCES;
}
- ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.OptionOrder) / sizeof (CallbackData->BmmFakeNvData.OptionOrder[0])));
+ ASSERT (BootOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.BootOptionOrder) / sizeof (CallbackData->BmmFakeNvData.BootOptionOrder[0])));
- for (OrderIndex = 0; (OrderIndex < BootOptionMenu.MenuNumber) && (CallbackData->BmmFakeNvData.OptionOrder[OrderIndex] != 0); OrderIndex++) {
+ for (OrderIndex = 0; (OrderIndex < BootOptionMenu.MenuNumber) && (CallbackData->BmmFakeNvData.BootOptionOrder[OrderIndex] != 0); OrderIndex++) {
for (Index = OrderIndex; Index < BootOrderListSize / sizeof (UINT16); Index++) {
- if ((BootOrderList[Index] == (UINT16) (CallbackData->BmmFakeNvData.OptionOrder[OrderIndex] - 1)) && (OrderIndex != Index)) {
+ if ((BootOrderList[Index] == (UINT16) (CallbackData->BmmFakeNvData.BootOptionOrder[OrderIndex] - 1)) && (OrderIndex != Index)) {
OptionNumber = BootOrderList[Index];
CopyMem (&BootOrderList[OrderIndex + 1], &BootOrderList[OrderIndex], (Index - OrderIndex) * sizeof (UINT16));
BootOrderList[OrderIndex] = OptionNumber;
@@ -1065,9 +1065,9 @@ Var_UpdateDriverOrder ( FreePool (DriverOrderList);
}
- ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.OptionOrder) / sizeof (CallbackData->BmmFakeNvData.OptionOrder[0])));
+ ASSERT (DriverOptionMenu.MenuNumber <= (sizeof (CallbackData->BmmFakeNvData.DriverOptionOrder) / sizeof (CallbackData->BmmFakeNvData.DriverOptionOrder[0])));
for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
- NewDriverOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.OptionOrder[Index] - 1);
+ NewDriverOrderList[Index] = (UINT16) (CallbackData->BmmFakeNvData.DriverOptionOrder[Index] - 1);
}
Status = gRT->SetVariable (
@@ -1100,7 +1100,8 @@ Var_UpdateDriverOrder ( **/
EFI_STATUS
Var_UpdateBBSOption (
- IN BMM_CALLBACK_DATA *CallbackData
+ IN BMM_CALLBACK_DATA *CallbackData,
+ IN EFI_FORM_ID FormId
)
{
UINTN Index;
@@ -1129,7 +1130,7 @@ Var_UpdateBBSOption ( DisMap = NULL;
NewOrder = NULL;
- switch (CallbackData->BmmPreviousPageId) {
+ switch (FormId) {
case FORM_SET_FD_ORDER_ID:
OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
LegacyDev = CallbackData->BmmFakeNvData.LegacyFD;
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 3bbe71a8fe..aaada9738f 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -1144,6 +1144,12 @@ PlatformBdsEnterFrontPage ( BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);
}
+ //
+ // Install BM HiiPackages.
+ // Keep BootMaint HiiPackage, so that it can be covered by global setting.
+ //
+ InitBMPackage ();
+
Status = EFI_SUCCESS;
do {
//
@@ -1200,9 +1206,19 @@ PlatformBdsEnterFrontPage ( case FRONT_PAGE_KEY_BOOT_MANAGER:
//
+ // Remove the installed BootMaint HiiPackages when exit.
+ //
+ FreeBMPackage ();
+
+ //
// User chose to run the Boot Manager
//
CallBootManager ();
+
+ //
+ // Reinstall BootMaint HiiPackages after exiting from Boot Manager.
+ //
+ InitBMPackage ();
break;
case FRONT_PAGE_KEY_DEVICE_MANAGER:
@@ -1233,6 +1249,11 @@ PlatformBdsEnterFrontPage ( //
SetupResetReminder ();
+ //
+ // Remove the installed BootMaint HiiPackages when exit.
+ //
+ FreeBMPackage ();
+
Exit:
//
// Automatically load current entry
|