MdeModulePkg:Full support F10 hot key in UiApp.

In current UiApp/Boot Maintenance manager,some pages don't support F10,
they use Commit Changes and Exit menu to save changes.Now support F10
in these pages.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18249 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Dandan Bi 2015-08-20 07:05:53 +00:00 committed by dandanbi
parent eb213f2f39
commit a22a50fa13
10 changed files with 804 additions and 357 deletions

View File

@ -296,9 +296,12 @@ BootMaintRouteConfig (
EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting; EFI_HII_CONFIG_ROUTING_PROTOCOL *ConfigRouting;
BMM_FAKE_NV_DATA *NewBmmData; BMM_FAKE_NV_DATA *NewBmmData;
BMM_FAKE_NV_DATA *OldBmmData; BMM_FAKE_NV_DATA *OldBmmData;
BM_CONSOLE_CONTEXT *NewConsoleContext;
BM_TERMINAL_CONTEXT *NewTerminalContext;
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
BM_LOAD_CONTEXT *NewLoadContext; BM_LOAD_CONTEXT *NewLoadContext;
UINT16 Index; UINT16 Index;
BOOLEAN TerminalAttChange;
BMM_CALLBACK_DATA *Private; BMM_CALLBACK_DATA *Private;
if (Progress == NULL) { if (Progress == NULL) {
@ -368,6 +371,7 @@ BootMaintRouteConfig (
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
NewLoadContext->Deleted = NewBmmData->BootOptionDel[Index]; NewLoadContext->Deleted = NewBmmData->BootOptionDel[Index];
NewBmmData->BootOptionDel[Index] = FALSE; NewBmmData->BootOptionDel[Index] = FALSE;
NewBmmData->BootOptionDelMark[Index] = FALSE;
} }
Var_DelBootOption (); Var_DelBootOption ();
@ -377,6 +381,19 @@ BootMaintRouteConfig (
Status = Var_UpdateBootOrder (Private); Status = Var_UpdateBootOrder (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);
Private->BmmOldFakeNVData.BootTimeOut = NewBmmData->BootTimeOut;
}
// //
// Check data which located in Driver Options Menu and save the settings if need // Check data which located in Driver Options Menu and save the settings if need
// //
@ -388,6 +405,7 @@ BootMaintRouteConfig (
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
NewLoadContext->Deleted = NewBmmData->DriverOptionDel[Index]; NewLoadContext->Deleted = NewBmmData->DriverOptionDel[Index];
NewBmmData->DriverOptionDel[Index] = FALSE; NewBmmData->DriverOptionDel[Index] = FALSE;
NewBmmData->DriverOptionDelMark[Index] = FALSE;
} }
Var_DelDriverOption (); Var_DelDriverOption ();
} }
@ -396,6 +414,104 @@ BootMaintRouteConfig (
Status = Var_UpdateDriverOrder (Private); Status = Var_UpdateDriverOrder (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];
}
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 = NewBmmData->ConsoleInCheck[Index + ConsoleInpMenu.MenuNumber];
}
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];
}
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 = NewBmmData->ConsoleOutCheck[Index + ConsoleOutMenu.MenuNumber];
}
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];
}
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 = NewBmmData->ConsoleErrCheck[Index + ConsoleErrMenu.MenuNumber];
}
Var_UpdateErrorOutOption();
}
// //
// After user do the save action, need to update OldBmmData. // After user do the save action, need to update OldBmmData.
// //
@ -436,7 +552,6 @@ BootMaintCallback (
BMM_CALLBACK_DATA *Private; BMM_CALLBACK_DATA *Private;
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
BMM_FAKE_NV_DATA *CurrentFakeNVMap; BMM_FAKE_NV_DATA *CurrentFakeNVMap;
EFI_STATUS Status;
UINTN OldValue; UINTN OldValue;
UINTN NewValue; UINTN NewValue;
UINTN Number; UINTN Number;
@ -583,24 +698,35 @@ BootMaintCallback (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if ((QuestionId >= BOOT_OPTION_DEL_QUESTION_ID) && (QuestionId < BOOT_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
if (Value->b){
//
// Means user try to delete this boot option but not press F10 or "Commit Changes and Exit" menu.
//
CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = TRUE;
} else {
//
// Means user remove the old check status.
//
CurrentFakeNVMap->BootOptionDelMark[QuestionId - BOOT_OPTION_DEL_QUESTION_ID] = FALSE;
}
} else if ((QuestionId >= DRIVER_OPTION_DEL_QUESTION_ID) && (QuestionId < DRIVER_OPTION_DEL_QUESTION_ID + MAX_MENU_NUMBER)) {
if (Value->b){
CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = TRUE;
} else {
CurrentFakeNVMap->DriverOptionDelMark[QuestionId - DRIVER_OPTION_DEL_QUESTION_ID] = FALSE;
}
} else {
switch (QuestionId) { switch (QuestionId) {
case KEY_VALUE_SAVE_AND_EXIT: case KEY_VALUE_SAVE_AND_EXIT:
case KEY_VALUE_NO_SAVE_AND_EXIT: case KEY_VALUE_NO_SAVE_AND_EXIT:
if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) { if (QuestionId == KEY_VALUE_SAVE_AND_EXIT) {
Status = ApplyChangeHandler (Private, CurrentFakeNVMap, Private->BmmPreviousPageId); *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
if (EFI_ERROR (Status)) {
return Status;
}
} else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) { } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT) {
DiscardChangeHandler (Private, CurrentFakeNVMap); DiscardChangeHandler (Private, CurrentFakeNVMap);
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
} }
//
// Tell browser not to ask for confirmation of changes,
// since we have already applied or discarded.
//
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
break; break;
case FORM_RESET: case FORM_RESET:
@ -611,6 +737,7 @@ BootMaintCallback (
break; break;
} }
} }
}
// //
// Pass changed uncommitted data back to Form Browser // Pass changed uncommitted data back to Form Browser
@ -620,198 +747,6 @@ BootMaintCallback (
return EFI_SUCCESS; return EFI_SUCCESS;
} }
/**
Function handling request to apply changes for BMM pages.
@param Private Pointer to callback data buffer.
@param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
@param FormId ID of the form which has sent the request to apply change.
@retval EFI_SUCCESS Change successfully applied.
@retval Other Error occurs while trying to apply changes.
**/
EFI_STATUS
ApplyChangeHandler (
IN BMM_CALLBACK_DATA *Private,
IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
IN EFI_FORM_ID FormId
)
{
BM_CONSOLE_CONTEXT *NewConsoleContext;
BM_TERMINAL_CONTEXT *NewTerminalContext;
BM_LOAD_CONTEXT *NewLoadContext;
BM_MENU_ENTRY *NewMenuEntry;
EFI_STATUS Status;
UINT16 Index;
Status = EFI_SUCCESS;
switch (FormId) {
case FORM_BOOT_DEL_ID:
for (Index = 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->BootOptionDel[Index];
CurrentFakeNVMap->BootOptionDel[Index] = FALSE;
}
Var_DelBootOption ();
break;
case FORM_DRV_DEL_ID:
for (Index = 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->DriverOptionDel[Index];
CurrentFakeNVMap->DriverOptionDel[Index] = FALSE;
}
Var_DelDriverOption ();
break;
case FORM_BOOT_CHG_ID:
Status = Var_UpdateBootOrder (Private);
break;
case FORM_DRV_CHG_ID:
Status = Var_UpdateDriverOrder (Private);
break;
case FORM_TIME_OUT_ID:
Status = gRT->SetVariable (
L"Timeout",
&gEfiGlobalVariableGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
sizeof (UINT16),
&(CurrentFakeNVMap->BootTimeOut)
);
ASSERT_EFI_ERROR(Status);
Private->BmmOldFakeNVData.BootTimeOut = CurrentFakeNVMap->BootTimeOut;
break;
case FORM_BOOT_NEXT_ID:
Status = Var_UpdateBootNext (Private);
break;
case FORM_CON_MODE_ID:
Status = Var_UpdateConMode (Private);
break;
case FORM_CON_COM_SETUP_ID:
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Private->CurrentTerminal);
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;
ChangeTerminalDevicePath (
NewTerminalContext->DevicePath,
FALSE
);
Var_UpdateConsoleInpOption ();
Var_UpdateConsoleOutOption ();
Var_UpdateErrorOutOption ();
break;
case FORM_CON_IN_ID:
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 = CurrentFakeNVMap->ConsoleCheck[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];
}
Var_UpdateConsoleInpOption ();
break;
case FORM_CON_OUT_ID:
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 = CurrentFakeNVMap->ConsoleCheck[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];
}
Var_UpdateConsoleOutOption ();
break;
case FORM_CON_ERR_ID:
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 = CurrentFakeNVMap->ConsoleCheck[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];
}
Var_UpdateErrorOutOption ();
break;
case FORM_DRV_ADD_HANDLE_DESC_ID:
Status = Var_UpdateDriverOption (
Private,
Private->BmmHiiHandle,
CurrentFakeNVMap->DriverAddHandleDesc,
CurrentFakeNVMap->DriverAddHandleOptionalData,
CurrentFakeNVMap->DriverAddForceReconnect
);
if (EFI_ERROR (Status)) {
goto Error;
}
BOpt_GetDriverOptions (Private);
CreateMenuStringToken (Private, Private->BmmHiiHandle, &DriverOptionMenu);
break;
default:
break;
}
Error:
return Status;
}
/** /**
Discard all changes done to the BMM pages such as Boot Order change, Discard all changes done to the BMM pages such as Boot Order change,
Driver order change. Driver order change.
@ -995,27 +930,65 @@ InitializeDrivers(
FreePool (HiiHandles); FreePool (HiiHandles);
} }
/** /**
Create dynamic code for BMM. Create dynamic code for BMM and initialize all of BMM configuration data in BmmFakeNvData and
BmmOldFakeNVData member in BMM context data.
@param BmmCallbackInfo The BMM context data. @param CallbackData The BMM context data.
**/ **/
VOID VOID
InitializeBmmConfig( InitializeBmmConfig (
IN BMM_CALLBACK_DATA *BmmCallbackInfo IN BMM_CALLBACK_DATA *CallbackData
) )
{ {
UpdateBootDelPage (BmmCallbackInfo); BM_MENU_ENTRY *NewMenuEntry;
UpdateDrvDelPage (BmmCallbackInfo); BM_LOAD_CONTEXT *NewLoadContext;
UINT16 Index;
if (TerminalMenu.MenuNumber > 0) { ASSERT (CallbackData != NULL);
BmmCallbackInfo->CurrentTerminal = 0;
UpdateTerminalPage (BmmCallbackInfo); InitializeDrivers (CallbackData);
//
// 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;
}
} }
InitializeDrivers (BmmCallbackInfo); CallbackData->BmmFakeNvData.BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
//
// Initialize data which located in Boot Options Menu
//
GetBootOrder (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));
} }
/** /**
@ -1273,7 +1246,7 @@ InitBootMaintenance(
BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID; BmmCallbackInfo->BmmPreviousPageId = FORM_MAIN_ID;
BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID; BmmCallbackInfo->BmmCurrentPageId = FORM_MAIN_ID;
BmmCallbackInfo->FeConfigAccess.ExtractConfig = FakeExtractConfig; BmmCallbackInfo->FeConfigAccess.ExtractConfig = FakeExtractConfig;
BmmCallbackInfo->FeConfigAccess.RouteConfig = FakeRouteConfig; BmmCallbackInfo->FeConfigAccess.RouteConfig = FileExplorerRouteConfig;
BmmCallbackInfo->FeConfigAccess.Callback = FileExplorerCallback; BmmCallbackInfo->FeConfigAccess.Callback = FileExplorerCallback;
BmmCallbackInfo->FeCurrentState = FileExplorerStateInActive; BmmCallbackInfo->FeCurrentState = FileExplorerStateInActive;
BmmCallbackInfo->FeDisplayContext = FileExplorerDisplayUnknown; BmmCallbackInfo->FeDisplayContext = FileExplorerDisplayUnknown;

View File

@ -179,6 +179,9 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
#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_DEVICE_VAR_OFFSET VAR_OFFSET (ConsoleCheck)
#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 BOOT_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (BootOptionOrder)
#define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder) #define DRIVER_OPTION_ORDER_VAR_OFFSET VAR_OFFSET (DriverOptionOrder)
#define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel) #define BOOT_OPTION_DEL_VAR_OFFSET VAR_OFFSET (BootOptionDel)
@ -189,6 +192,7 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
#define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits) #define COM_STOP_BITS_VAR_OFFSET VAR_OFFSET (COMStopBits)
#define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity) #define COM_PARITY_VAR_OFFSET VAR_OFFSET (COMParity)
#define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType) #define COM_TERMINAL_VAR_OFFSET VAR_OFFSET (COMTerminalType)
#define COM_FLOWCONTROL_VAR_OFFSET VAR_OFFSET (COMFlowControl)
#define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut) #define BOOT_TIME_OUT_QUESTION_ID QUESTION_ID (BootTimeOut)
#define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext) #define BOOT_NEXT_QUESTION_ID QUESTION_ID (BootNext)
@ -213,6 +217,9 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
#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_DEVICE_QUESTION_ID QUESTION_ID (ConsoleCheck)
#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 BOOT_OPTION_ORDER_QUESTION_ID QUESTION_ID (BootOptionOrder)
#define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder) #define DRIVER_OPTION_ORDER_QUESTION_ID QUESTION_ID (DriverOptionOrder)
#define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel) #define BOOT_OPTION_DEL_QUESTION_ID QUESTION_ID (BootOptionDel)
@ -223,6 +230,7 @@ typedef enum _FILE_EXPLORER_DISPLAY_CONTEXT {
#define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits) #define COM_STOP_BITS_QUESTION_ID QUESTION_ID (COMStopBits)
#define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity) #define COM_PARITY_QUESTION_ID QUESTION_ID (COMParity)
#define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType) #define COM_TERMINAL_QUESTION_ID QUESTION_ID (COMTerminalType)
#define COM_FLOWCONTROL_QUESTION_ID QUESTION_ID (COMFlowControl)
#define STRING_DEPOSITORY_NUMBER 8 #define STRING_DEPOSITORY_NUMBER 8
@ -247,6 +255,8 @@ typedef struct {
UINT8 ParityIndex; UINT8 ParityIndex;
UINT8 StopBitsIndex; UINT8 StopBitsIndex;
UINT8 FlowControl;
UINT8 IsConIn; UINT8 IsConIn;
UINT8 IsConOut; UINT8 IsConOut;
UINT8 IsStdErr; UINT8 IsStdErr;
@ -1309,24 +1319,6 @@ CleanUpStringDepository (
VOID VOID
); );
/**
Function handling request to apply changes for BMM pages.
@param Private Pointer to callback data buffer.
@param CurrentFakeNVMap Pointer to buffer holding data of various values used by BMM
@param FormId ID of the form which has sent the request to apply change.
@retval EFI_SUCCESS Change successfully applied.
@retval Other Error occurs while trying to apply changes.
**/
EFI_STATUS
ApplyChangeHandler (
IN BMM_CALLBACK_DATA *Private,
IN BMM_FAKE_NV_DATA *CurrentFakeNVMap,
IN EFI_FORM_ID FormId
);
/** /**
Discard all changes done to the BMM pages such as Boot Order change, Discard all changes done to the BMM pages such as Boot Order change,
Driver order change. Driver order change.
@ -1386,6 +1378,47 @@ UpdateFileExplorer (
IN UINT16 KeyValue IN UINT16 KeyValue
); );
/**
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
);
/** /**
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.
@ -1442,6 +1475,58 @@ InitBootMaintenance(
VOID VOID
); );
/**
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
);
// //
// Global variable in this program (defined in data.c) // Global variable in this program (defined in data.c)
// //
@ -1468,6 +1553,8 @@ extern STRING_DEPOSITORY *DriverOptionStrDepository;
extern STRING_DEPOSITORY *DriverOptionHelpStrDepository; extern STRING_DEPOSITORY *DriverOptionHelpStrDepository;
extern STRING_DEPOSITORY *TerminalStrDepository; extern STRING_DEPOSITORY *TerminalStrDepository;
extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[]; extern EFI_DEVICE_PATH_PROTOCOL EndDevicePath[];
extern UINT16 mFlowControlType[2];
extern UINT32 mFlowControlValue[2];
// //
// Shared IFR form update data // Shared IFR form update data

View File

@ -998,3 +998,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

@ -38,6 +38,19 @@ UINT16 TerminalType[] = {
STRING_TOKEN(STR_COM_TYPE_4), STRING_TOKEN(STR_COM_TYPE_4),
}; };
///
/// Flow Control type string token storage
///
UINT16 mFlowControlType[2] = {
STRING_TOKEN(STR_NONE_FLOW_CONTROL),
STRING_TOKEN(STR_HARDWARE_FLOW_CONTROL)
};
UINT32 mFlowControlValue[2] = {
0,
UART_FLOW_CONTROL_HARDWARE
};
/// ///
/// File system selection menu /// File system selection menu
/// ///

View File

@ -41,16 +41,20 @@ formset
subtitle text = STRING_TOKEN(STR_NULL_STRING); subtitle text = STRING_TOKEN(STR_NULL_STRING);
string varid = FeData.DescriptionData, string varid = FeData.BootDescriptionData,
questionid = KEY_VALUE_BOOT_DESCRIPTION,
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),
flags = INTERACTIVE,
minsize = 6, minsize = 6,
maxsize = 75, maxsize = 75,
endstring; endstring;
string varid = FeData.OptionalData, string varid = FeData.BootOptionalData,
questionid = KEY_VALUE_BOOT_OPTION,
prompt = STRING_TOKEN(STR_OPTIONAL_DATA), prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
help = STRING_TOKEN(STR_NULL_STRING), help = STRING_TOKEN(STR_NULL_STRING),
flags = INTERACTIVE,
minsize = 0, minsize = 0,
maxsize = 120, maxsize = 120,
endstring; endstring;
@ -81,16 +85,20 @@ formset
subtitle text = STRING_TOKEN(STR_NULL_STRING); subtitle text = STRING_TOKEN(STR_NULL_STRING);
string varid = FeData.DescriptionData, string varid = FeData.DriverDescriptionData,
questionid = KEY_VALUE_DRIVER_DESCRIPTION,
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),
flags = INTERACTIVE,
minsize = 6, minsize = 6,
maxsize = 75, maxsize = 75,
endstring; endstring;
string varid = FeData.OptionalData, string varid = FeData.DriverOptionalData,
questionid = KEY_VALUE_DRIVER_OPTION,
prompt = STRING_TOKEN(STR_OPTIONAL_DATA), prompt = STRING_TOKEN(STR_OPTIONAL_DATA),
help = STRING_TOKEN(STR_NULL_STRING), help = STRING_TOKEN(STR_NULL_STRING),
flags = INTERACTIVE,
minsize = 0, minsize = 0,
maxsize = 120, maxsize = 120,
endstring; endstring;

View File

@ -168,8 +168,16 @@ UpdateFileExplorer (
case FileExplorerStateAddDriverOptionState: case FileExplorerStateAddDriverOptionState:
if (FileExplorerStateAddBootOption == CallbackData->FeCurrentState) { if (FileExplorerStateAddBootOption == CallbackData->FeCurrentState) {
FormId = FORM_BOOT_ADD_DESCRIPTION_ID; FormId = FORM_BOOT_ADD_DESCRIPTION_ID;
if (!CallbackData->FeFakeNvData.BootOptionChanged) {
ZeroMem (CallbackData->FeFakeNvData.BootDescriptionData, sizeof (CallbackData->FeFakeNvData.BootDescriptionData));
ZeroMem (CallbackData->FeFakeNvData.BootOptionalData, sizeof (CallbackData->FeFakeNvData.BootOptionalData));
}
} else { } else {
FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID; FormId = FORM_DRIVER_ADD_FILE_DESCRIPTION_ID;
if (!CallbackData->FeFakeNvData.DriverOptionChanged) {
ZeroMem (CallbackData->FeFakeNvData.DriverDescriptionData, sizeof (CallbackData->FeFakeNvData.DriverDescriptionData));
ZeroMem (CallbackData->FeFakeNvData.DriverOptionalData, sizeof (CallbackData->FeFakeNvData.DriverOptionalData));
}
} }
CallbackData->MenuEntry = NewMenuEntry; CallbackData->MenuEntry = NewMenuEntry;
@ -207,6 +215,129 @@ 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, &mFileExplorerGuid, mFileExplorerStorageName)) {
return EFI_NOT_FOUND;
}
Status = gBS->LocateProtocol (
&gEfiHiiConfigRoutingProtocolGuid,
NULL,
(VOID**) &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);
Private->FeFakeNvData.BootOptionChanged = FALSE;
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
);
Private->FeFakeNvData.DriverOptionChanged = FALSE;
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.
@ -270,42 +401,29 @@ FileExplorerCallback (
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER) { if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_BOOT){
// NvRamMap->BootOptionChanged = FALSE;
// Apply changes and exit formset *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
// } else if (QuestionId == KEY_VALUE_SAVE_AND_EXIT_DRIVER){
if (FileExplorerStateAddBootOption == Private->FeCurrentState) { NvRamMap->DriverOptionChanged = FALSE;
Status = Var_UpdateBootOption (Private, NvRamMap); *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
if (EFI_ERROR (Status)) { } else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT) {
return Status;
}
BOpt_GetBootOptions (Private);
CreateMenuStringToken (Private, Private->FeHiiHandle, &BootOptionMenu);
} else if (FileExplorerStateAddDriverOptionState == Private->FeCurrentState) {
Status = Var_UpdateDriverOption (
Private,
Private->FeHiiHandle,
NvRamMap->DescriptionData,
NvRamMap->OptionalData,
NvRamMap->ForceReconnect
);
if (EFI_ERROR (Status)) {
return Status;
}
BOpt_GetDriverOptions (Private);
CreateMenuStringToken (Private, Private->FeHiiHandle, &DriverOptionMenu);
}
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
} else if (QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_BOOT || QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) {
// //
// Discard changes and exit formset // Discard changes and exit formset
// //
NvRamMap->OptionalData[0] = 0x0000; NvRamMap->BootOptionalData[0] = 0x0000;
NvRamMap->DescriptionData[0] = 0x0000; NvRamMap->BootDescriptionData[0] = 0x0000;
NvRamMap->BootOptionChanged = FALSE;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT; *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
} else if ( QuestionId == KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER){
NvRamMap->BootOptionalData[0] = 0x0000;
NvRamMap->BootDescriptionData[0] = 0x0000;
NvRamMap->DriverOptionChanged = FALSE;
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;
} else if (QuestionId == KEY_VALUE_BOOT_DESCRIPTION || QuestionId == KEY_VALUE_BOOT_OPTION){
NvRamMap->BootOptionChanged = TRUE;
} else if (QuestionId == KEY_VALUE_DRIVER_DESCRIPTION || QuestionId == KEY_VALUE_DRIVER_OPTION){
NvRamMap->DriverOptionChanged = TRUE;
} else if (QuestionId < FILE_OPTION_OFFSET) { } else if (QuestionId < FILE_OPTION_OFFSET) {
// //
// Exit File Explorer formset // Exit File Explorer formset
@ -322,5 +440,10 @@ FileExplorerCallback (
} }
} }
//
// Pass changed uncommitted data back to Form Browser
//
HiiSetBrowserData (&mFileExplorerGuid, mFileExplorerStorageName, sizeof (FILE_EXPLORER_NV_DATA), (UINT8 *) NvRamMap, NULL);
return Status; return Status;
} }

View File

@ -70,6 +70,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define KEY_VALUE_NO_SAVE_AND_EXIT 0x110C #define KEY_VALUE_NO_SAVE_AND_EXIT 0x110C
#define KEY_VALUE_BOOT_FROM_FILE 0x110D #define KEY_VALUE_BOOT_FROM_FILE 0x110D
#define FORM_RESET 0x110E #define FORM_RESET 0x110E
#define KEY_VALUE_BOOT_DESCRIPTION 0x110F
#define KEY_VALUE_BOOT_OPTION 0x1110
#define KEY_VALUE_DRIVER_DESCRIPTION 0x1111
#define KEY_VALUE_DRIVER_OPTION 0x1112
#define MAXIMUM_NORMAL_KEY_VALUE 0x11FF #define MAXIMUM_NORMAL_KEY_VALUE 0x11FF
@ -143,6 +147,13 @@ typedef struct {
// //
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 or Driver 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
@ -155,15 +166,18 @@ typedef struct {
// //
BOOLEAN BootOptionDel[MAX_MENU_NUMBER]; BOOLEAN BootOptionDel[MAX_MENU_NUMBER];
BOOLEAN DriverOptionDel[MAX_MENU_NUMBER]; BOOLEAN DriverOptionDel[MAX_MENU_NUMBER];
BOOLEAN BootOptionDelMark[MAX_MENU_NUMBER];
BOOLEAN DriverOptionDelMark[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[MAX_MENU_NUMBER];
// //
// We use DisableMap array to record the enable/disable state of each boot device // We use DisableMap array to record the enable/disable state of each boot device
@ -195,8 +209,12 @@ 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[MAX_MENU_NUMBER]; UINT16 BootDescriptionData[MAX_MENU_NUMBER];
UINT16 OptionalData[127]; UINT16 BootOptionalData[127];
UINT16 DriverDescriptionData[MAX_MENU_NUMBER];
UINT16 DriverOptionalData[127];
BOOLEAN BootOptionChanged;
BOOLEAN DriverOptionChanged;
UINT8 Active; UINT8 Active;
UINT8 ForceReconnect; UINT8 ForceReconnect;
} FILE_EXPLORER_NV_DATA; } FILE_EXPLORER_NV_DATA;

View File

@ -214,6 +214,8 @@ UpdateConCOMPage (
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
UINT16 Index; UINT16 Index;
CallbackData->BmmAskSaveOrNot = TRUE;
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) { for (Index = 0; Index < TerminalMenu.MenuNumber; Index++) {
@ -249,7 +251,7 @@ UpdateBootDelPage (
BM_LOAD_CONTEXT *NewLoadContext; BM_LOAD_CONTEXT *NewLoadContext;
UINT16 Index; UINT16 Index;
//CallbackData->BmmAskSaveOrNot = TRUE; CallbackData->BmmAskSaveOrNot = TRUE;
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu); CreateMenuStringToken (CallbackData, CallbackData->BmmHiiHandle, &BootOptionMenu);
@ -262,6 +264,18 @@ UpdateBootDelPage (
continue; continue;
} }
NewLoadContext->Deleted = FALSE;
if (CallbackData->BmmFakeNvData.BootOptionDel[Index] && !CallbackData->BmmFakeNvData.BootOptionDelMark[Index]) {
//
// CallbackData->BmmFakeNvData.BootOptionDel[Index] == TRUE means browser knows this boot option is selected
// CallbackData->BmmFakeNvData.BootOptionDelMark[Index] = FALSE means BDS knows the selected boot option has
// deleted, browser maintains old useless info. So clear this info here, and later update this info to browser
// through HiiSetBrowserData function.
//
CallbackData->BmmFakeNvData.BootOptionDel[Index] = FALSE;
}
// //
// Check to see if the current boot option devicepath is the ShellDevice // Check to see if the current boot option devicepath is the ShellDevice
// path. If it is keep only UEFI Shell in the delete boot option list // path. If it is keep only UEFI Shell in the delete boot option list
@ -278,7 +292,7 @@ UpdateBootDelPage (
(UINT16) (BOOT_OPTION_DEL_VAR_OFFSET + Index), (UINT16) (BOOT_OPTION_DEL_VAR_OFFSET + Index),
NewMenuEntry->DisplayStringToken, NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken, NewMenuEntry->HelpStringToken,
0, EFI_IFR_FLAG_CALLBACK,
0, 0,
NULL NULL
); );
@ -351,8 +365,16 @@ UpdateDrvDelPage (
NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext; NewLoadContext = (BM_LOAD_CONTEXT *) NewMenuEntry->VariableContext;
NewLoadContext->Deleted = FALSE; NewLoadContext->Deleted = FALSE;
CallbackData->BmmFakeNvData.DriverOptionDel[Index] = FALSE;
if (CallbackData->BmmFakeNvData.DriverOptionDel[Index] && !CallbackData->BmmFakeNvData.DriverOptionDelMark[Index]) {
//
// CallbackData->BmmFakeNvData.BootOptionDel[Index] == TRUE means browser knows this boot option is selected
// CallbackData->BmmFakeNvData.BootOptionDelMark[Index] = FALSE means BDS knows the selected boot option has
// deleted, browser maintains old useless info. So clear this info here, and later update this info to browser
// through HiiSetBrowserData function.
//
CallbackData->BmmFakeNvData.DriverOptionDel[Index] = FALSE;
}
HiiCreateCheckBoxOpCode ( HiiCreateCheckBoxOpCode (
mStartOpCodeHandle, mStartOpCodeHandle,
(EFI_QUESTION_ID) (DRIVER_OPTION_DEL_QUESTION_ID + Index), (EFI_QUESTION_ID) (DRIVER_OPTION_DEL_QUESTION_ID + Index),
@ -360,7 +382,7 @@ UpdateDrvDelPage (
(UINT16) (DRIVER_OPTION_DEL_VAR_OFFSET + Index), (UINT16) (DRIVER_OPTION_DEL_VAR_OFFSET + Index),
NewMenuEntry->DisplayStringToken, NewMenuEntry->DisplayStringToken,
NewMenuEntry->HelpStringToken, NewMenuEntry->HelpStringToken,
0, EFI_IFR_FLAG_CALLBACK,
0, 0,
NULL NULL
); );
@ -462,28 +484,63 @@ UpdateConsolePage (
UINT16 Index; UINT16 Index;
UINT16 Index2; UINT16 Index2;
UINT8 CheckFlags; UINT8 CheckFlags;
UINT8 *ConsoleCheck;
UINT8 *OldConsoleCheck;
UINTN ConsoleCheckSize;
EFI_QUESTION_ID QuestionIdBase;
UINT16 VariableOffsetBase;
CallbackData->BmmAskSaveOrNot = TRUE; CallbackData->BmmAskSaveOrNot = TRUE;
UpdatePageStart (CallbackData); UpdatePageStart (CallbackData);
ConsoleCheck = NULL;
QuestionIdBase = 0;
VariableOffsetBase = 0;
switch (UpdatePageId) {
case FORM_CON_IN_ID:
ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleInCheck[0];
OldConsoleCheck = &CallbackData->BmmOldFakeNVData.ConsoleInCheck[0];
ConsoleCheckSize = sizeof (CallbackData->BmmFakeNvData.ConsoleInCheck);
QuestionIdBase = CON_IN_DEVICE_QUESTION_ID;
VariableOffsetBase = CON_IN_DEVICE_VAR_OFFSET;
break;
case FORM_CON_OUT_ID:
ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleOutCheck[0];
OldConsoleCheck = &CallbackData->BmmOldFakeNVData.ConsoleOutCheck[0];
ConsoleCheckSize = sizeof (CallbackData->BmmFakeNvData.ConsoleOutCheck);
QuestionIdBase = CON_OUT_DEVICE_QUESTION_ID;
VariableOffsetBase = CON_OUT_DEVICE_VAR_OFFSET;
break;
case FORM_CON_ERR_ID:
ConsoleCheck = &CallbackData->BmmFakeNvData.ConsoleErrCheck[0];
OldConsoleCheck = &CallbackData->BmmOldFakeNVData.ConsoleErrCheck[0];
ConsoleCheckSize = sizeof (CallbackData->BmmFakeNvData.ConsoleErrCheck);
QuestionIdBase = CON_ERR_DEVICE_QUESTION_ID;
VariableOffsetBase = CON_ERR_DEVICE_VAR_OFFSET;
break;
}
ASSERT (ConsoleCheck != NULL);
for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \ for (Index = 0; ((Index < ConsoleMenu->MenuNumber) && \
(Index < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))) ; Index++) { (Index < MAX_MENU_NUMBER)) ; Index++) {
CheckFlags = 0;
NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index); NewMenuEntry = BOpt_GetMenuEntry (ConsoleMenu, Index);
NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext; NewConsoleContext = (BM_CONSOLE_CONTEXT *) NewMenuEntry->VariableContext;
CheckFlags = 0;
if (NewConsoleContext->IsActive) { if (NewConsoleContext->IsActive) {
CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT; CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT;
CallbackData->BmmFakeNvData.ConsoleCheck[Index] = TRUE; ConsoleCheck[Index] = TRUE;
} else { } else {
CallbackData->BmmFakeNvData.ConsoleCheck[Index] = FALSE; ConsoleCheck[Index] = FALSE;
} }
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,
@ -493,7 +550,7 @@ UpdateConsolePage (
} }
for (Index2 = 0; ((Index2 < TerminalMenu.MenuNumber) && \ for (Index2 = 0; ((Index2 < TerminalMenu.MenuNumber) && \
(Index2 < (sizeof (CallbackData->BmmFakeNvData.ConsoleCheck) / sizeof (UINT8)))); Index2++) { (Index2 < MAX_MENU_NUMBER)); Index2++) {
CheckFlags = 0; CheckFlags = 0;
NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2); NewMenuEntry = BOpt_GetMenuEntry (&TerminalMenu, Index2);
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext; NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
@ -504,16 +561,15 @@ UpdateConsolePage (
((NewTerminalContext->IsStdErr != 0) && (UpdatePageId == FORM_CON_ERR_ID)) ((NewTerminalContext->IsStdErr != 0) && (UpdatePageId == FORM_CON_ERR_ID))
) { ) {
CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT; CheckFlags |= EFI_IFR_CHECKBOX_DEFAULT;
CallbackData->BmmFakeNvData.ConsoleCheck[Index] = TRUE; ConsoleCheck[Index] = TRUE;
} else { } else {
CallbackData->BmmFakeNvData.ConsoleCheck[Index] = FALSE; ConsoleCheck[Index] = FALSE;
} }
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,
@ -524,6 +580,8 @@ UpdateConsolePage (
Index++; Index++;
} }
CopyMem (OldConsoleCheck, ConsoleCheck, ConsoleCheckSize);
UpdatePageEnd (CallbackData); UpdatePageEnd (CallbackData);
} }
@ -883,7 +941,7 @@ UpdateConModePage (
UpdatePageEnd (CallbackData); UpdatePageEnd (CallbackData);
} }
/** /**
Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits, Create the dynamic page which allows user to set the property such as Baud Rate, Data Bits,
Parity, Stop Bits, Terminal Type. Parity, Stop Bits, Terminal Type.
@ -898,35 +956,31 @@ UpdateTerminalPage (
UINT8 Index; UINT8 Index;
UINT8 CheckFlags; UINT8 CheckFlags;
BM_MENU_ENTRY *NewMenuEntry; BM_MENU_ENTRY *NewMenuEntry;
BM_TERMINAL_CONTEXT *NewTerminalContext;
VOID *OptionsOpCodeHandle; VOID *OptionsOpCodeHandle;
UINTN CurrentTerminal;
CallbackData->BmmAskSaveOrNot = TRUE; 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) {
return ; return ;
} }
NewTerminalContext = (BM_TERMINAL_CONTEXT *) NewMenuEntry->VariableContext;
OptionsOpCodeHandle = HiiAllocateOpCodeHandle (); OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL); ASSERT (OptionsOpCodeHandle != NULL);
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,
@ -938,9 +992,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,
@ -956,9 +1010,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;
} }
@ -973,9 +1025,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,
@ -990,10 +1042,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 (
@ -1007,9 +1057,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,
@ -1024,10 +1074,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 (
@ -1041,9 +1089,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,
@ -1058,9 +1106,8 @@ UpdateTerminalPage (
for (Index = 0; Index < sizeof (TerminalType) / sizeof (TerminalType[0]); Index++) { for (Index = 0; Index < sizeof (TerminalType) / sizeof (TerminalType[0]); 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 (
@ -1074,9 +1121,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,
@ -1085,6 +1132,37 @@ UpdateTerminalPage (
NULL NULL
); );
HiiFreeOpCodeHandle (OptionsOpCodeHandle);
OptionsOpCodeHandle = HiiAllocateOpCodeHandle ();
ASSERT (OptionsOpCodeHandle != NULL);
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],
CheckFlags,
EFI_IFR_TYPE_NUM_SIZE_8,
mFlowControlValue[Index]
);
}
HiiCreateOneOfOpCode (
mStartOpCodeHandle,
(EFI_QUESTION_ID) (COM_FLOWCONTROL_QUESTION_ID + CurrentTerminal),
VARSTORE_ID_BOOT_MAINT,
(UINT16) (COM_FLOWCONTROL_VAR_OFFSET + CurrentTerminal),
STRING_TOKEN (STR_COM_FLOW_CONTROL),
STRING_TOKEN (STR_COM_FLOW_CONTROL),
0,
EFI_IFR_NUMERIC_SIZE_1,
OptionsOpCodeHandle,
NULL
);
HiiFreeOpCodeHandle (OptionsOpCodeHandle); HiiFreeOpCodeHandle (OptionsOpCodeHandle);
UpdatePageEnd (CallbackData); UpdatePageEnd (CallbackData);

View File

@ -728,16 +728,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) {
StrCpyS (NvRamMap->DescriptionData, sizeof (NvRamMap->DescriptionData) / sizeof (NvRamMap->DescriptionData[0]), BootString); StrCpyS (NvRamMap->BootDescriptionData, sizeof (NvRamMap->BootDescriptionData) / sizeof (NvRamMap->BootDescriptionData[0]), 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);
@ -767,21 +767,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,
@ -814,7 +814,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 (
@ -852,8 +852,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;
} }