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
This commit is contained in:
Eric Dong 2014-06-18 02:19:50 +00:00 committed by ydong10
parent 885f7fd0c7
commit be9304f33f
11 changed files with 1567 additions and 511 deletions

View File

@ -378,3 +378,34 @@ EfiLibStrFromDatahub (
{ {
return NULL; 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;
}

View File

@ -168,9 +168,13 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
#define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1) #define CON_ERR_COM1_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM1)
#define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2) #define CON_ERR_COM2_VAR_OFFSET VAR_OFFSET (ConsoleErrorCOM2)
#define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode) #define CON_MODE_VAR_OFFSET VAR_OFFSET (ConsoleOutMode)
#define CON_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleCheck) #define CON_IN_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleInCheck)
#define OPTION_ORDER_VAR_OFFSET VAR_OFFSET (OptionOrder) #define CON_OUT_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleOutCheck)
#define OPTION_DEL_VAR_OFFSET VAR_OFFSET (OptionDel) #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 DRIVER_ADD_OPTION_VAR_OFFSET VAR_OFFSET (DriverAddHandleOptionalData)
#define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate) #define COM_BAUD_RATE_VAR_OFFSET VAR_OFFSET (COMBaudRate)
#define COM_DATA_RATE_VAR_OFFSET VAR_OFFSET (COMDataRate) #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_COM1_QUESTION_ID QUESTION_ID (ConsoleErrorCOM1)
#define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2) #define CON_ERR_COM2_QUESTION_ID QUESTION_ID (ConsoleErrorCOM2)
#define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode) #define CON_MODE_QUESTION_ID QUESTION_ID (ConsoleOutMode)
#define CON_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck) #define CON_IN_DEVICE_QUESTION_ID QUESTION_ID (ConsoleInCheck)
#define OPTION_ORDER_QUESTION_ID QUESTION_ID (OptionOrder) #define CON_OUT_DEVICE_QUESTION_ID QUESTION_ID (ConsoleOutCheck)
#define OPTION_DEL_QUESTION_ID QUESTION_ID (OptionDel) #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 DRIVER_ADD_OPTION_QUESTION_ID QUESTION_ID (DriverAddHandleOptionalData)
#define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate) #define COM_BAUD_RATE_QUESTION_ID QUESTION_ID (COMBaudRate)
#define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate) #define COM_DATA_RATE_QUESTION_ID QUESTION_ID (COMDataRate)
@ -939,7 +947,8 @@ Var_UpdateDriverOrder (
**/ **/
EFI_STATUS EFI_STATUS
Var_UpdateBBSOption ( Var_UpdateBBSOption (
IN BMM_CALLBACK_DATA *CallbackData IN BMM_CALLBACK_DATA *CallbackData,
IN EFI_FORM_ID FormId
); );
/** /**
@ -1247,23 +1256,6 @@ EfiLibStrFromDatahub (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath IN EFI_DEVICE_PATH_PROTOCOL *DevPath
); );
/**
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. Initialize the Boot Maintenance Utitliy.
@ -1445,6 +1437,47 @@ FileExplorerCallback (
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
); );
/**
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. Dispatch BMM formset and FileExplorer formset.
@ -1478,6 +1511,129 @@ EfiLibGetVariable (
IN EFI_GUID *VendorGuid 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) // Global variable in this program (defined in data.c)
// //

View File

@ -5,7 +5,7 @@
Boot option manipulation 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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);
}
}

View File

@ -1,7 +1,7 @@
/** @file /** @file
handles console redirection from boot manager 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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;
}
}

View File

@ -2,7 +2,7 @@
// //
// File Explorer Formset // 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 // This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License // 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 // 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); subtitle text = STRING_TOKEN(STR_NULL_STRING);
string varid = FeData.DescriptionData, string varid = FeData.BootDescriptionData,
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC), prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
help = STRING_TOKEN(STR_NULL_STRING), help = STRING_TOKEN(STR_NULL_STRING),
minsize = 6, minsize = 6,
maxsize = 75, maxsize = 75,
endstring; endstring;
string varid = FeData.OptionalData, string varid = FeData.BootOptionalData,
prompt = STRING_TOKEN(STR_OPTIONAL_DATA), prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
help = STRING_TOKEN(STR_NULL_STRING), help = STRING_TOKEN(STR_NULL_STRING),
minsize = 0, minsize = 0,
@ -83,14 +83,14 @@ formset
subtitle text = STRING_TOKEN(STR_NULL_STRING); subtitle text = STRING_TOKEN(STR_NULL_STRING);
string varid = FeData.DescriptionData, string varid = FeData.DriverDescriptionData,
prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC), prompt = STRING_TOKEN(STR_LOAD_OPTION_DESC),
help = STRING_TOKEN(STR_NULL_STRING), help = STRING_TOKEN(STR_NULL_STRING),
minsize = 6, minsize = 6,
maxsize = 75, maxsize = 75,
endstring; endstring;
string varid = FeData.OptionalData, string varid = FeData.DriverOptionalData,
prompt = STRING_TOKEN(STR_OPTIONAL_DATA), prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
help = STRING_TOKEN(STR_NULL_STRING), help = STRING_TOKEN(STR_NULL_STRING),
minsize = 0, minsize = 0,

View File

@ -216,6 +216,127 @@ UpdateFileExplorer (
return ExitFileExplorer; return ExitFileExplorer;
} }
/**
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. This function processes the results of changes in configuration.
When user select a interactive opcode, this callback will be triggered. When user select a interactive opcode, this callback will be triggered.
@ -295,8 +416,8 @@ FileExplorerCallback (
Status = Var_UpdateDriverOption ( Status = Var_UpdateDriverOption (
Private, Private,
Private->FeHiiHandle, Private->FeHiiHandle,
NvRamMap->DescriptionData, NvRamMap->DriverDescriptionData,
NvRamMap->OptionalData, NvRamMap->DriverOptionalData,
NvRamMap->ForceReconnect NvRamMap->ForceReconnect
); );
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
@ -308,14 +429,21 @@ FileExplorerCallback (
} }
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; *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 // Discard changes and exit formset
// //
NvRamMap->OptionalData[0] = 0x0000; NvRamMap->DriverOptionalData[0] = 0x0000;
NvRamMap->DescriptionData[0] = 0x0000; NvRamMap->DriverDescriptionData[0] = 0x0000;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
} else if (QuestionId < FILE_OPTION_OFFSET) { } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT) {
//
// Discard changes and exit formset
//
NvRamMap->BootOptionalData[0] = 0x0000;
NvRamMap->BootDescriptionData[0] = 0x0000;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
}else if (QuestionId < FILE_OPTION_OFFSET) {
// //
// Exit File Explorer formset // Exit File Explorer formset
// //

View File

@ -1,7 +1,7 @@
/** @file /** @file
Formset guids, form id and VarStore data structure for Boot Maintenance Manager. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 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 // At most 100 input/output/errorout device for console storage
// //
UINT8 ConsoleCheck[MAX_MENU_NUMBER]; 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 // The value is the OptionNumber+1 because the order list value cannot be 0
// Use UINT32 to hold the potential value 0xFFFF+1=0x10000 // Use UINT32 to hold the potential value 0xFFFF+1=0x10000
// //
UINT32 OptionOrder[MAX_MENU_NUMBER]; UINT32 BootOptionOrder[MAX_MENU_NUMBER];
// //
// Boot or Driver Option Delete storage // 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
// //
BOOLEAN OptionDel[MAX_MENU_NUMBER]; UINT32 DriverOptionOrder[MAX_MENU_NUMBER];
//
// Boot Option Delete storage
//
BOOLEAN BootOptionDel[MAX_MENU_NUMBER];
//
// Driver Option Delete storage
//
BOOLEAN DriverOptionDel[MAX_MENU_NUMBER];
// //
// This is the Terminal Attributes value storage // This is the Terminal Attributes value storage
// //
UINT8 COMBaudRate; UINT8 COMBaudRate[MAX_MENU_NUMBER];
UINT8 COMDataRate; UINT8 COMDataRate[MAX_MENU_NUMBER];
UINT8 COMStopBits; UINT8 COMStopBits[MAX_MENU_NUMBER];
UINT8 COMParity; UINT8 COMParity[MAX_MENU_NUMBER];
UINT8 COMTerminalType; UINT8 COMTerminalType[MAX_MENU_NUMBER];
UINT8 COMFlowControl; UINT8 COMFlowControl[MAX_MENU_NUMBER];
// //
// Legacy Device Order Selection Storage // Legacy Device Order Selection Storage
@ -199,8 +217,10 @@ typedef struct {
/// This is the data structure used by File Explorer formset /// This is the data structure used by File Explorer formset
/// ///
typedef struct { typedef struct {
UINT16 DescriptionData[75]; UINT16 BootDescriptionData[75];
UINT16 OptionalData[127]; UINT16 BootOptionalData[127];
UINT16 DriverDescriptionData[75];
UINT16 DriverOptionalData[127];
UINT8 Active; UINT8 Active;
UINT8 ForceReconnect; UINT8 ForceReconnect;
} FILE_EXPLORER_NV_DATA; } FILE_EXPLORER_NV_DATA;

View File

@ -1,7 +1,7 @@
/** @file /** @file
Dynamically update the pages. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -254,7 +254,7 @@ UpdateBootDelPage (
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu); 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++) { for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
@ -263,13 +263,13 @@ UpdateBootDelPage (
} }
NewLoadContext->Deleted = FALSE; NewLoadContext->Deleted = FALSE;
CallbackData->BmmFakeNvData.OptionDel[Index] = FALSE; //CallbackData->BmmFakeNvData.BootOptionDel[Index] = FALSE;
HiiCreateCheckBoxOpCode ( HiiCreateCheckBoxOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) (OPTION_DEL_QUESTION_ID + Index), (EFI_QUESTION_ID) (BOOT_OPTION_DEL_QUESTION_ID + Index),
VARSTORE_ID_BOOT_MAINT, VARSTORE_ID_BOOT_MAINT,
(UINT16) (OPTION_DEL_VAR_OFFSET + Index), (UINT16) (BOOT_OPTION_DEL_VAR_OFFSET + Index),
NewMenuEntry->DisplayStringToken, NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken, NewMenuEntry->HelpStringToken,
0, 0,
@ -337,19 +337,19 @@ UpdateDrvDelPage (
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &DriverOptionMenu); 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++) { for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&DriverOptionMenu, Index);
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
NewLoadContext->Deleted = FALSE; NewLoadContext->Deleted = FALSE;
CallbackData->BmmFakeNvData.OptionDel[Index] = FALSE; //CallbackData->BmmFakeNvData.DriverOptionDel[Index] = FALSE;
HiiCreateCheckBoxOpCode ( HiiCreateCheckBoxOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) (OPTION_DEL_QUESTION_ID + Index), (EFI_QUESTION_ID) (DRIVER_OPTION_DEL_QUESTION_ID + Index),
VARSTORE_ID_BOOT_MAINT, VARSTORE_ID_BOOT_MAINT,
(UINT16) (OPTION_DEL_VAR_OFFSET + Index), (UINT16) (DRIVER_OPTION_DEL_VAR_OFFSET + Index),
NewMenuEntry->DisplayStringToken, NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken, NewMenuEntry->HelpStringToken,
0, 0,
@ -449,71 +449,57 @@ UpdateConsolePage (
) )
{ {
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
BM_CONSOLE_CONTEXT *NewConsoleContext;
BM_TERMINAL_CONTEXT *NewTerminalContext;
UINT16 Index; UINT16 Index;
UINT16 Index2;
UINT8 CheckFlags; UINT8 CheckFlags;
UINT8 *ConsoleCheck;
CallbackData->BmmAskSaveOrNot = TRUE; EFI_QUESTION_ID QuestionIdBase;
UINT16 VariableOffsetBase;
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \ ConsoleCheck = NULL;
(Index < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))) ; Index++) { QuestionIdBase = 0;
NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index); VariableOffsetBase = 0;
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;
}
HiiCreateCheckBoxOpCode ( switch (UpdatePageId) {
mStartOpCodeHandle, case FORM_CON_IN_ID:
(EFI_QUESTION_ID) (CON_DEVICE_QUESTION_ID + Index), ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleInCheck[0];
VARSTORE_ID_BOOT_MAINT, QuestionIdBase = CON_IN_DEVICE_QUESTION_ID;
(UINT16) (CON_DEVICE_VAR_OFFSET + Index), VariableOffsetBase = CON_IN_DEVICE_VAR_OFFSET;
NewMenuEntry->DisplayStringToken, break;
NewMenuEntry->HelpStringToken,
0, case FORM_CON_OUT_ID:
CheckFlags, ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
NULL 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) && \ for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \
(Index2 < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))); Index2++) { (Index < MAX_MENU_NUMBER)) ; Index++) {
CheckFlags = 0; CheckFlags = 0;
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2); if (UpdatePageId != FORM_CON_ERR_ID) {
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))
) {
CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT; CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT;
CallbackData->BmmFakeNvData.ConsoleCheck[Index] = TRUE;
} else {
CallbackData->BmmFakeNvData.ConsoleCheck[Index] = FALSE;
} }
NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
HiiCreateCheckBoxOpCode ( HiiCreateCheckBoxOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) (CON_DEVICE_QUESTION_ID + Index), (EFI_QUESTION_ID) (QuestionIdBase + Index),
VARSTORE_ID_BOOT_MAINT, VARSTORE_ID_BOOT_MAINT,
(UINT16) (CON_DEVICE_VAR_OFFSET + Index), (UINT16) (VariableOffsetBase + Index),
NewMenuEntry->DisplayStringToken, NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken, NewMenuEntry->HelpStringToken,
0, 0,
CheckFlags, CheckFlags,
NULL NULL
); );
Index++;
} }
UpdatePageEnd (CallbackData); UpdatePageEnd (CallbackData);
@ -535,68 +521,73 @@ UpdateOrderPage (
IN BMM_CALLBACK_DATA *CallbackData IN BMM_CALLBACK_DATA *CallbackData
) )
{ {
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
UINT16 Index; UINT16 Index;
UINT16 OptionOrderIndex; UINT16 OptionIndex;
VOID *OptionsOpCodeHandle; VOID *OptionsOpCodeHandle;
UINTN DeviceType; BM_LOAD_CONTEXT *NewLoadContext;
BM_LOAD_CONTEXT *NewLoadContext; BOOLEAN BootOptionFound;
UINT32 *OptionOrder;
EFI_QUESTION_ID QuestionId;
UINT16 VarOffset;
DeviceType = (UINTN) -1;
CallbackData->BmmAskSaveOrNot = TRUE;
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, OptionMenu); 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 (); OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL); ASSERT (OptionsOpCodeHandle != NULL);
for ( NewMenuEntry = NULL;
Index = 0, OptionOrderIndex = 0; for (OptionIndex = 0; (OptionOrder[OptionIndex] != 0 && OptionIndex < MAX_MENU_NUMBER); OptionIndex++) {
( BootOptionFound = FALSE;
(Index < OptionMenu->MenuNumber) && for (Index = 0; Index < OptionMenu->MenuNumber; Index++) {
(OptionOrderIndex < NewMenuEntry = BOpt_GetMenuEntry (OptionMenu, Index);
( NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
sizeof (CallbackData->BmmFakeNvData.OptionOrder) / if ((UINT32) (NewMenuEntry->OptionNumber + 1) == OptionOrder[OptionIndex]) {
sizeof (CallbackData->BmmFakeNvData.OptionOrder[0]) BootOptionFound = TRUE;
) break;
)
);
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;
} }
} }
HiiCreateOneOfOptionOpCode ( if (BootOptionFound) {
OptionsOpCodeHandle, HiiCreateOneOfOptionOpCode (
NewMenuEntry->DisplayStringToken, OptionsOpCodeHandle,
0, NewMenuEntry->DisplayStringToken,
EFI_IFR_TYPE_NUM_SIZE_32, 0,
(UINT32) (NewMenuEntry->OptionNumber + 1) EFI_IFR_TYPE_NUM_SIZE_32,
); OptionOrder[OptionIndex]
CallbackData->BmmFakeNvData.OptionOrder[OptionOrderIndex++] = (UINT32) (NewMenuEntry->OptionNumber + 1); );
}
} }
if (OptionMenu->MenuNumber > 0) { if (OptionMenu->MenuNumber > 0) {
HiiCreateOrderedListOpCode ( HiiCreateOrderedListOpCode (
mStartOpCodeHandle, // Container for dynamic created opcodes mStartOpCodeHandle, // Container for dynamic created opcodes
(EFI_QUESTION_ID) OPTION_ORDER_QUESTION_ID, // Question ID QuestionId, // Question ID
VARSTORE_ID_BOOT_MAINT, // VarStore 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 prompt text
STRING_TOKEN (STR_CHANGE_ORDER), // Question help text STRING_TOKEN (STR_CHANGE_ORDER), // Question help text
0, // Question flag 0, // Question flag
@ -611,12 +602,6 @@ UpdateOrderPage (
HiiFreeOpCodeHandle (OptionsOpCodeHandle); HiiFreeOpCodeHandle (OptionsOpCodeHandle);
UpdatePageEnd (CallbackData); UpdatePageEnd (CallbackData);
CopyMem (
CallbackData->BmmOldFakeNVData.OptionOrder,
CallbackData->BmmFakeNvData.OptionOrder,
sizeof (CallbackData->BmmOldFakeNVData.OptionOrder)
);
} }
/** /**
@ -647,7 +632,7 @@ UpdateBootNextPage (
OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL); ASSERT (OptionsOpCodeHandle != NULL);
CallbackData->BmmFakeNvData.BootNext = (UINT16) (BootOptionMenu.MenuNumber); //CallbackData->BmmFakeNvData.BootNext = (UINT16) (BootOptionMenu.MenuNumber);
for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) {
NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (&BootOptionMenu, Index);
@ -661,7 +646,7 @@ UpdateBootNextPage (
EFI_IFR_TYPE_NUM_SIZE_16, EFI_IFR_TYPE_NUM_SIZE_16,
Index Index
); );
CallbackData->BmmFakeNvData.BootNext = Index; //CallbackData->BmmFakeNvData.BootNext = Index;
} else { } else {
HiiCreateOneOfOptionOpCode ( HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle, OptionsOpCodeHandle,
@ -751,7 +736,7 @@ UpdateTimeOutPage (
HiiFreeOpCodeHandle (DefaultOpCodeHandle); HiiFreeOpCodeHandle (DefaultOpCodeHandle);
CallbackData->BmmFakeNvData.BootTimeOut = BootTimeOut; //CallbackData->BmmFakeNvData.BootTimeOut = BootTimeOut;
UpdatePageEnd (CallbackData); UpdatePageEnd (CallbackData);
} }
@ -813,7 +798,7 @@ UpdateConModePage (
// //
// Determin which mode should be the first entry in menu // Determin which mode should be the first entry in menu
// //
GetConsoleOutMode (CallbackData); // GetConsoleOutMode (CallbackData);
// //
// Build text mode options // Build text mode options
@ -891,14 +876,14 @@ UpdateTerminalPage (
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
BM_TERMINAL_CONTEXT *NewTerminalContext; BM_TERMINAL_CONTEXT *NewTerminalContext;
VOID *OptionsOpCodeHandle; VOID *OptionsOpCodeHandle;
UINTN CurrentTerminal;
CallbackData->BmmAskSaveOrNot = TRUE;
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
CurrentTerminal = CallbackData->CurrentTerminal;
NewMenuEntry = BOpt_GetMenuEntry ( NewMenuEntry = BOpt_GetMenuEntry (
&TerminalMenu, &TerminalMenu,
CallbackData->CurrentTerminal CurrentTerminal
); );
if (NewMenuEntry == NULL) { if (NewMenuEntry == NULL) {
@ -912,12 +897,9 @@ UpdateTerminalPage (
for (Index = 0; Index < sizeof (BaudRateList) / sizeof (BaudRateList [0]); Index++) { for (Index = 0; Index < sizeof (BaudRateList) / sizeof (BaudRateList [0]); Index++) {
CheckFlags = 0; CheckFlags = 0;
if (NewTerminalContext->BaudRate == (UINT64) (BaudRateList[Index].Value)) { if (BaudRateList[Index].Value == 115200) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT; CheckFlags |= EFI_IFR_OPTION_DEFAULT;
NewTerminalContext->BaudRateIndex = Index;
CallbackData->BmmFakeNvData.COMBaudRate = NewTerminalContext->BaudRateIndex;
} }
HiiCreateOneOfOptionOpCode ( HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle, OptionsOpCodeHandle,
BaudRateList[Index].StringToken, BaudRateList[Index].StringToken,
@ -929,9 +911,9 @@ UpdateTerminalPage (
HiiCreateOneOfOpCode ( HiiCreateOneOfOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) COM_BAUD_RATE_QUESTION_ID, (EFI_QUESTION_ID) (COM_BAUD_RATE_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT, 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),
STRING_TOKEN (STR_COM_BAUD_RATE), STRING_TOKEN (STR_COM_BAUD_RATE),
0, 0,
@ -947,9 +929,7 @@ UpdateTerminalPage (
for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) { for (Index = 0; Index < sizeof (DataBitsList) / sizeof (DataBitsList[0]); Index++) {
CheckFlags = 0; CheckFlags = 0;
if (NewTerminalContext->DataBits == DataBitsList[Index].Value) { if (DataBitsList[Index].Value == 8) {
NewTerminalContext->DataBitsIndex = Index;
CallbackData->BmmFakeNvData.COMDataRate = NewTerminalContext->DataBitsIndex;
CheckFlags |= EFI_IFR_OPTION_DEFAULT; CheckFlags |= EFI_IFR_OPTION_DEFAULT;
} }
@ -964,9 +944,9 @@ UpdateTerminalPage (
HiiCreateOneOfOpCode ( HiiCreateOneOfOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) COM_DATA_RATE_QUESTION_ID, (EFI_QUESTION_ID) (COM_DATA_RATE_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT, 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),
STRING_TOKEN (STR_COM_DATA_BITS), STRING_TOKEN (STR_COM_DATA_BITS),
0, 0,
@ -981,10 +961,8 @@ UpdateTerminalPage (
for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) { for (Index = 0; Index < sizeof (ParityList) / sizeof (ParityList[0]); Index++) {
CheckFlags = 0; CheckFlags = 0;
if (NewTerminalContext->Parity == ParityList[Index].Value) { if (ParityList[Index].Value == NoParity) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT; CheckFlags |= EFI_IFR_OPTION_DEFAULT;
NewTerminalContext->ParityIndex = (UINT8) Index;
CallbackData->BmmFakeNvData.COMParity = NewTerminalContext->ParityIndex;
} }
HiiCreateOneOfOptionOpCode ( HiiCreateOneOfOptionOpCode (
@ -998,9 +976,9 @@ UpdateTerminalPage (
HiiCreateOneOfOpCode ( HiiCreateOneOfOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) COM_PARITY_QUESTION_ID, (EFI_QUESTION_ID) (COM_PARITY_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT, VARSTORE_ID_BOOT_MAINT,
COM_PARITY_VAR_OFFSET, (UINT16) (COM_PARITY_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_PARITY), STRING_TOKEN (STR_COM_PARITY),
STRING_TOKEN (STR_COM_PARITY), STRING_TOKEN (STR_COM_PARITY),
0, 0,
@ -1015,10 +993,8 @@ UpdateTerminalPage (
for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) { for (Index = 0; Index < sizeof (StopBitsList) / sizeof (StopBitsList[0]); Index++) {
CheckFlags = 0; CheckFlags = 0;
if (NewTerminalContext->StopBits == StopBitsList[Index].Value) { if (StopBitsList[Index].Value == OneStopBit) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT; CheckFlags |= EFI_IFR_OPTION_DEFAULT;
NewTerminalContext->StopBitsIndex = (UINT8) Index;
CallbackData->BmmFakeNvData.COMStopBits = NewTerminalContext->StopBitsIndex;
} }
HiiCreateOneOfOptionOpCode ( HiiCreateOneOfOptionOpCode (
@ -1032,9 +1008,9 @@ UpdateTerminalPage (
HiiCreateOneOfOpCode ( HiiCreateOneOfOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) COM_STOP_BITS_QUESTION_ID, (EFI_QUESTION_ID) (COM_STOP_BITS_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT, 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),
STRING_TOKEN (STR_COM_STOP_BITS), STRING_TOKEN (STR_COM_STOP_BITS),
0, 0,
@ -1049,9 +1025,8 @@ UpdateTerminalPage (
for (Index = 0; Index < 4; Index++) { for (Index = 0; Index < 4; Index++) {
CheckFlags = 0; CheckFlags = 0;
if (NewTerminalContext->TerminalType == Index) { if (Index == 0) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT; CheckFlags |= EFI_IFR_OPTION_DEFAULT;
CallbackData->BmmFakeNvData.COMTerminalType = NewTerminalContext->TerminalType;
} }
HiiCreateOneOfOptionOpCode ( HiiCreateOneOfOptionOpCode (
@ -1065,9 +1040,9 @@ UpdateTerminalPage (
HiiCreateOneOfOpCode ( HiiCreateOneOfOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) COM_TERMINAL_QUESTION_ID, (EFI_QUESTION_ID) (COM_TERMINAL_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT, 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),
STRING_TOKEN (STR_COM_TERMI_TYPE), STRING_TOKEN (STR_COM_TERMI_TYPE),
0, 0,
@ -1080,12 +1055,15 @@ UpdateTerminalPage (
OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL); ASSERT (OptionsOpCodeHandle != NULL);
CallbackData->BmmFakeNvData.COMFlowControl = NewTerminalContext->FlowControl;
for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) { for (Index = 0; Index < sizeof (mFlowControlType) / sizeof (mFlowControlType[0]); Index++) {
CheckFlags = 0;
if (Index == 0) {
CheckFlags |= EFI_IFR_OPTION_DEFAULT;
}
HiiCreateOneOfOptionOpCode ( HiiCreateOneOfOptionOpCode (
OptionsOpCodeHandle, OptionsOpCodeHandle,
(EFI_STRING_ID) mFlowControlType[Index], (EFI_STRING_ID) mFlowControlType[Index],
0, CheckFlags,
EFI_IFR_TYPE_NUM_SIZE_8, EFI_IFR_TYPE_NUM_SIZE_8,
mFlowControlValue[Index] mFlowControlValue[Index]
); );
@ -1093,9 +1071,9 @@ UpdateTerminalPage (
HiiCreateOneOfOpCode ( HiiCreateOneOfOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) COM_FLOWCONTROL_QUESTION_ID, (EFI_QUESTION_ID) (COM_FLOWCONTROL_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT, 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),
STRING_TOKEN (STR_COM_FLOW_CONTROL), STRING_TOKEN (STR_COM_FLOW_CONTROL),
0, 0,
@ -1150,92 +1128,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 Create a dynamic page so that Legacy Device boot order
can be set for specified device type. can be set for specified device type.
@ -1443,6 +1335,7 @@ UpdateSetLegacyDeviceOrderPage (
UpdatePageEnd (CallbackData); UpdatePageEnd (CallbackData);
} }
/** /**
Dispatch the display to the next page based on NewPageId. Dispatch the display to the next page based on NewPageId.

View File

@ -752,16 +752,16 @@ Var_UpdateBootOption (
Index = BOpt_GetBootOptionNumber () ; Index = BOpt_GetBootOptionNumber () ;
UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index); UnicodeSPrint (BootString, sizeof (BootString), L"Boot%04x", Index);
if (NvRamMap->DescriptionData[0] == 0x0000) { if (NvRamMap->BootDescriptionData[0] == 0x0000) {
StrCpy (NvRamMap->DescriptionData, BootString); 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); BufferSize += GetDevicePathSize (CallbackData->LoadContext->FilePathList);
if (NvRamMap->OptionalData[0] != 0x0000) { if (NvRamMap->BootOptionalData[0] != 0x0000) {
OptionalDataExist = TRUE; OptionalDataExist = TRUE;
BufferSize += StrSize (NvRamMap->OptionalData); BufferSize += StrSize (NvRamMap->BootOptionalData);
} }
Buffer = AllocateZeroPool (BufferSize); Buffer = AllocateZeroPool (BufferSize);
@ -791,21 +791,21 @@ Var_UpdateBootOption (
CopyMem ( CopyMem (
Ptr, Ptr,
NvRamMap->DescriptionData, NvRamMap->BootDescriptionData,
StrSize (NvRamMap->DescriptionData) StrSize (NvRamMap->BootDescriptionData)
); );
NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->DescriptionData)); NewLoadContext->Description = AllocateZeroPool (StrSize (NvRamMap->BootDescriptionData));
ASSERT (NewLoadContext->Description != NULL); ASSERT (NewLoadContext->Description != NULL);
NewMenuEntry->DisplayString = NewLoadContext->Description; NewMenuEntry->DisplayString = NewLoadContext->Description;
CopyMem ( CopyMem (
NewLoadContext->Description, NewLoadContext->Description,
(VOID *) Ptr, (VOID *) Ptr,
StrSize (NvRamMap->DescriptionData) StrSize (NvRamMap->BootDescriptionData)
); );
Ptr += StrSize (NvRamMap->DescriptionData); Ptr += StrSize (NvRamMap->BootDescriptionData);
CopyMem ( CopyMem (
Ptr, Ptr,
CallbackData->LoadContext->FilePathList, CallbackData->LoadContext->FilePathList,
@ -838,7 +838,7 @@ Var_UpdateBootOption (
if (OptionalDataExist) { if (OptionalDataExist) {
Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList); Ptr += (UINT8) GetDevicePathSize (CallbackData->LoadContext->FilePathList);
CopyMem (Ptr, NvRamMap->OptionalData, StrSize (NvRamMap->OptionalData)); CopyMem (Ptr, NvRamMap->BootOptionalData, StrSize (NvRamMap->BootOptionalData));
} }
Status = gRT->SetVariable ( Status = gRT->SetVariable (
@ -879,8 +879,8 @@ Var_UpdateBootOption (
InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link); InsertTailList (&BootOptionMenu.Head, &NewMenuEntry->Link);
BootOptionMenu.MenuNumber++; BootOptionMenu.MenuNumber++;
NvRamMap->DescriptionData[0] = 0x0000; NvRamMap->BootDescriptionData[0] = 0x0000;
NvRamMap->OptionalData[0] = 0x0000; NvRamMap->BootOptionalData[0] = 0x0000;
} }
} }
return EFI_SUCCESS; return EFI_SUCCESS;
@ -983,11 +983,11 @@ Var_UpdateBootOrder (
return EFI_OUT_OF_RESOURCES; 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++) { 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]; OptionNumber = BootOrderList[Index];
CopyMem (&BootOrderList[OrderIndex + 1], &BootOrderList[OrderIndex], (Index - OrderIndex) * sizeof (UINT16)); CopyMem (&BootOrderList[OrderIndex + 1], &BootOrderList[OrderIndex], (Index - OrderIndex) * sizeof (UINT16));
BootOrderList[OrderIndex] = OptionNumber; BootOrderList[OrderIndex] = OptionNumber;
@ -1065,9 +1065,9 @@ Var_UpdateDriverOrder (
FreePool (DriverOrderList); 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++) { 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 ( Status = gRT->SetVariable (
@ -1100,7 +1100,8 @@ Var_UpdateDriverOrder (
**/ **/
EFI_STATUS EFI_STATUS
Var_UpdateBBSOption ( Var_UpdateBBSOption (
IN BMM_CALLBACK_DATA *CallbackData IN BMM_CALLBACK_DATA *CallbackData,
IN EFI_FORM_ID FormId
) )
{ {
UINTN Index; UINTN Index;
@ -1129,7 +1130,7 @@ Var_UpdateBBSOption (
DisMap = NULL; DisMap = NULL;
NewOrder = NULL; NewOrder = NULL;
switch (CallbackData->BmmPreviousPageId) { switch (FormId) {
case FORM_SET_FD_ORDER_ID: case FORM_SET_FD_ORDER_ID:
OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu; OptionMenu = (BM_MENU_OPTION *) &LegacyFDMenu;
LegacyDev = CallbackData->BmmFakeNvData.LegacyFD; LegacyDev = CallbackData->BmmFakeNvData.LegacyFD;

View File

@ -1144,6 +1144,12 @@ PlatformBdsEnterFrontPage (
BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0); 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; Status = EFI_SUCCESS;
do { do {
// //
@ -1199,10 +1205,20 @@ PlatformBdsEnterFrontPage (
break; break;
case FRONT_PAGE_KEY_BOOT_MANAGER: case FRONT_PAGE_KEY_BOOT_MANAGER:
//
// Remove the installed BootMaint HiiPackages when exit.
//
FreeBMPackage ();
// //
// User chose to run the Boot Manager // User chose to run the Boot Manager
// //
CallBootManager (); CallBootManager ();
//
// Reinstall BootMaint HiiPackages after exiting from Boot Manager.
//
InitBMPackage ();
break; break;
case FRONT_PAGE_KEY_DEVICE_MANAGER: case FRONT_PAGE_KEY_DEVICE_MANAGER:
@ -1233,6 +1249,11 @@ PlatformBdsEnterFrontPage (
// //
SetupResetReminder (); SetupResetReminder ();
//
// Remove the installed BootMaint HiiPackages when exit.
//
FreeBMPackage ();
Exit: Exit:
// //
// Automatically load current entry // Automatically load current entry