Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <[email protected]>
---
.../Universal/SetupBrowserDxe/Presentation.c | 44 +++++++++++++++++++---
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 25 +++++++++++-
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 13 +++++++
3 files changed, 75 insertions(+), 7 deletions(-)
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index 251025b..08d6a1c 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -1883,10 +1883,29 @@ FindNextMenu (
return TRUE;
}
/**
+ Reconnect the controller.
+
+ @param DriverHandle The controller handle which need to be
reconnect.
+
+**/
+VOID
+ReconnectController (
+ IN EFI_HANDLE DriverHandle
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->DisconnectController(DriverHandle, NULL, NULL);
+ if (!EFI_ERROR (Status)) {
+ gBS->ConnectController(DriverHandle, NULL, NULL, FALSE);
+ }
+}
+
+/**
Call the call back function for the question and process the return action.
@param Selection On input, Selection tell setup browser the
information
about the Selection, form and formset to be
displayed.
On output, Selection return the screen item
that is selected
@@ -1923,19 +1942,21 @@ ProcessCallBackFunction (
LIST_ENTRY *Link;
BROWSER_SETTING_SCOPE SettingLevel;
EFI_IFR_TYPE_VALUE BackUpValue;
UINT8 *BackUpBuffer;
CHAR16 *NewString;
+ BOOLEAN Reconnect;
ConfigAccess = FormSet->ConfigAccess;
SubmitFormIsRequired = FALSE;
SettingLevel = FormSetLevel;
DiscardFormIsRequired = FALSE;
NeedExit = FALSE;
Status = EFI_SUCCESS;
ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
BackUpBuffer = NULL;
+ Reconnect = FALSE;
if (ConfigAccess == NULL) {
return EFI_SUCCESS;
}
@@ -2053,10 +2074,14 @@ ProcessCallBackFunction (
case EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD:
DiscardFormIsRequired = TRUE;
SettingLevel = FormLevel;
break;
+ case EFI_BROWSER_ACTION_REQUEST_RECONNECT:
+ Reconnect = TRUE;
+ break;
+
default:
break;
}
break;
@@ -2155,10 +2180,14 @@ ProcessCallBackFunction (
if (NeedExit) {
FindNextMenu (Selection, SettingLevel);
}
+ if (Reconnect) {
+ ReconnectController (FormSet->DriverHandle);
+ }
+
return Status;
}
/**
Call the retrieve type call back function for one question to get the
initialize data.
@@ -2463,17 +2492,22 @@ SetupBrowser (
IsQuestionValueChanged(gCurrentSelection->FormSet,
gCurrentSelection->Form, Statement, GetSetValueWithBuffer);
}
}
//
- // If question has EFI_IFR_FLAG_RESET_REQUIRED flag and without storage
and process question success till here,
- // trig the gResetFlag.
+ // If question has
EFI_IFR_FLAG_RESET_REQUIRED/EFI_IFR_FLAG_RECONNECT_REQUIRED flag and without
storage
+ // and process question success till here, trig the
gResetFlag/gReconnectRequired.
//
if ((Status == EFI_SUCCESS) &&
- (Statement->Storage == NULL) &&
- ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0)) {
- gResetRequired = TRUE;
+ (Statement->Storage == NULL)) {
+ if ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) {
+ gResetRequired = TRUE;
+ }
+
+ if ((Statement->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0)
{
+ gReconnectRequired = TRUE;
+ }
}
}
//
// Check whether Exit flag is TRUE.
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index ea9205a..5cf6adf 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -53,10 +53,11 @@ LIST_ENTRY gBrowserStorageList =
INITIALIZE_LIST_HEAD_VARIABLE (gBrowserSto
LIST_ENTRY gBrowserSaveFailFormSetList = INITIALIZE_LIST_HEAD_VARIABLE
(gBrowserSaveFailFormSetList);
BOOLEAN mSystemSubmit = FALSE;
BOOLEAN gResetRequired;
BOOLEAN gExitRequired;
+BOOLEAN gReconnectRequired;
BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel;
BOOLEAN mBrowserScopeFirstSet = TRUE;
EXIT_HANDLER ExitHandlerFunction = NULL;
FORM_BROWSER_FORMSET *mSystemLevelFormSet;
@@ -481,10 +482,11 @@ SendForm (
EFI_STATUS Status;
UI_MENU_SELECTION *Selection;
UINTN Index;
FORM_BROWSER_FORMSET *FormSet;
FORM_ENTRY_INFO *MenuList;
+ EFI_HANDLE Controller;
//
// If EDKII_FORM_DISPLAY_ENGINE_PROTOCOL not found, return EFI_UNSUPPORTED.
//
if (mFormDisplay == NULL) {
@@ -494,10 +496,12 @@ SendForm (
//
// Save globals used by SendForm()
//
SaveBrowserContext ();
+ Controller = NULL;
+ gReconnectRequired = FALSE;
gResetRequired = FALSE;
gExitRequired = FALSE;
Status = EFI_SUCCESS;
gEmptyString = L"";
gDisplayFormData.ScreenDimensions = (EFI_SCREEN_DESCRIPTOR *)
ScreenDimensions;
@@ -545,10 +549,14 @@ SendForm (
Status = SetupBrowser (Selection);
gCurrentSelection = NULL;
mSystemLevelFormSet = NULL;
+ if (gReconnectRequired) {
+ Controller = FormSet->DriverHandle;
+ }
+
//
// If no data is changed, don't need to save current FormSet into the
maintain list.
//
if (!IsNvUpdateRequiredForFormSet (FormSet)) {
CleanBrowserStorage(FormSet);
@@ -559,10 +567,15 @@ SendForm (
if (EFI_ERROR (Status)) {
break;
}
} while (Selection->Action == UI_ACTION_REFRESH_FORMSET);
+ if (gReconnectRequired && Controller != NULL) {
+ ReconnectController (Controller);
+ gReconnectRequired = FALSE;
+ }
+
FreePool (Selection);
}
if (ActionRequest != NULL) {
*ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
@@ -2521,12 +2534,18 @@ UpdateFlagForForm (
Question->ValueChanged = IsQuestionValueChanged(FormSet, Form, Question,
GetSetValueWithBothBuffer);
//
// Only the changed data has been saved, then need to set the reset flag.
//
- if (SetFlag && OldValue && !Question->ValueChanged &&
((Question->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0)) {
- gResetRequired = TRUE;
+ if (SetFlag && OldValue && !Question->ValueChanged) {
+ if ((Question->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) {
+ gResetRequired = TRUE;
+ }
+
+ if ((Question->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0) {
+ gReconnectRequired = TRUE;
+ }
}
}
}
/**
@@ -5522,10 +5541,11 @@ SaveBrowserContext (
//
// Save FormBrowser context
//
Context->Selection = gCurrentSelection;
Context->ResetRequired = gResetRequired;
+ Context->ReconnectRequired = gReconnectRequired;
Context->ExitRequired = gExitRequired;
Context->HiiHandle = mCurrentHiiHandle;
Context->FormId = mCurrentFormId;
CopyGuid (&Context->FormSetGuid, &mCurrentFormSetGuid);
@@ -5577,10 +5597,11 @@ RestoreBrowserContext (
//
// Restore FormBrowser context
//
gCurrentSelection = Context->Selection;
gResetRequired = Context->ResetRequired;
+ gReconnectRequired = Context->ReconnectRequired;
gExitRequired = Context->ExitRequired;
mCurrentHiiHandle = Context->HiiHandle;
mCurrentFormId = Context->FormId;
CopyGuid (&mCurrentFormSetGuid, &Context->FormSetGuid);
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
index 8fabf6f..52c0c3b 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
@@ -526,10 +526,11 @@ typedef struct {
LIST_ENTRY Link;
//
// Globals defined in Setup.c
//
+ BOOLEAN ReconnectRequired;
BOOLEAN ResetRequired;
BOOLEAN ExitRequired;
EFI_HII_HANDLE HiiHandle;
EFI_GUID FormSetGuid;
EFI_FORM_ID FormId;
@@ -564,10 +565,11 @@ typedef enum {
extern EFI_HII_DATABASE_PROTOCOL *mHiiDatabase;
extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigRouting;
extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText;
extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay;
+extern BOOLEAN gReconnectRequired;
extern BOOLEAN gResetRequired;
extern BOOLEAN gExitRequired;
extern LIST_ENTRY gBrowserFormSetList;
extern LIST_ENTRY gBrowserHotKeyList;
extern BROWSER_SETTING_SCOPE gBrowserSettingScope;
@@ -1829,6 +1831,17 @@ GetFstStgFromVarId (
FORMSET_STORAGE *
GetFstStgFromBrsStg (
IN BROWSER_STORAGE *Storage
);
+/**
+ Reconnect the controller.
+
+ @param DriverHandle The controller handle which need to be
reconnect.
+
+**/
+VOID
+ReconnectController (
+ IN EFI_HANDLE DriverHandle
+ );
+
#endif
--
1.9.5.msysgit.1
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel