From nobody Fri Dec 27 04:36:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1500627392037615.1806644290142; Fri, 21 Jul 2017 01:56:32 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5194A21D1B282; Fri, 21 Jul 2017 01:54:33 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 90D1A21CE7479 for ; Fri, 21 Jul 2017 01:54:31 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 21 Jul 2017 01:56:28 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga004.fm.intel.com with ESMTP; 21 Jul 2017 01:56:27 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,389,1496127600"; d="scan'208";a="289651955" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 21 Jul 2017 16:56:01 +0800 Message-Id: <1500627363-171152-2-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1500627363-171152-1-git-send-email-dandan.bi@intel.com> References: <1500627363-171152-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [PATCH v2 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" After calling SendForm to enter front page, configuration change in some driver may require system reset. Currently the reset status is saved in SendForm level. Then SendForm can return the reset status. IsResetRequired API also can return the reset status before exiting browser. It return the reset status in current SendForm level now. But SendForm can be recursive called by some module.so the reset status in previous SendForm may be lost. Now change the IsResetRequired API to return the reset info no matter the reset is caught in any SendForm. Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Liming Gao for this serial. --- MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c | 9 ++++++--- MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 19 +++++++++++----= ---- MdeModulePkg/Universal/SetupBrowserDxe/Setup.h | 5 +++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c b/MdeMod= ulePkg/Universal/SetupBrowserDxe/Presentation.c index 08d46cf..97713eb 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c @@ -995,11 +995,12 @@ ProcessAction ( if ((Action & BROWSER_ACTION_SUBMIT) =3D=3D BROWSER_ACTION_SUBMIT) { SubmitForm (gCurrentSelection->FormSet, gCurrentSelection->Form, gBrow= serSettingScope); } =20 if ((Action & BROWSER_ACTION_RESET) =3D=3D BROWSER_ACTION_RESET) { - gResetRequired =3D TRUE; + gResetRequiredFormLevel =3D TRUE; + gResetRequiredSystemLevel =3D TRUE; } =20 if ((Action & BROWSER_ACTION_EXIT) =3D=3D BROWSER_ACTION_EXIT) { // // Form Exit without saving, Similar to ESC Key. @@ -2043,11 +2044,12 @@ ProcessCallBackFunction ( switch (Action) { case EFI_BROWSER_ACTION_CHANGED: switch (ActionRequest) { case EFI_BROWSER_ACTION_REQUEST_RESET: DiscardFormIsRequired =3D TRUE; - gResetRequired =3D TRUE; + gResetRequiredFormLevel =3D TRUE; + gResetRequiredSystemLevel =3D TRUE; NeedExit =3D TRUE; break; =20 case EFI_BROWSER_ACTION_REQUEST_SUBMIT: SubmitFormIsRequired =3D TRUE; @@ -2542,11 +2544,12 @@ SetupBrowser ( // and process question success till here, trig the gResetFlag/gFlag= Reconnect. // if ((Status =3D=3D EFI_SUCCESS) &&=20 (Statement->Storage =3D=3D NULL)) {=20 if ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) !=3D = 0) { - gResetRequired =3D TRUE; + gResetRequiredFormLevel =3D TRUE; + gResetRequiredSystemLevel =3D TRUE; } =20 if ((Statement->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != =3D 0) { gFlagReconnect =3D TRUE; } diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/= Universal/SetupBrowserDxe/Setup.c index 83dc2b8..89e06de 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -51,11 +51,12 @@ LIST_ENTRY gBrowserFormSetList =3D INITIALIZE_LIST= _HEAD_VARIABLE (gBrowserFor LIST_ENTRY gBrowserHotKeyList =3D INITIALIZE_LIST_HEAD_VARIABLE (gBr= owserHotKeyList); LIST_ENTRY gBrowserStorageList =3D INITIALIZE_LIST_HEAD_VARIABLE (gBr= owserStorageList); LIST_ENTRY gBrowserSaveFailFormSetList =3D INITIALIZE_LIST_HEAD_VARIA= BLE (gBrowserSaveFailFormSetList); =20 BOOLEAN mSystemSubmit =3D FALSE; -BOOLEAN gResetRequired; +BOOLEAN gResetRequiredFormLevel; +BOOLEAN gResetRequiredSystemLevel =3D FALSE; BOOLEAN gExitRequired; BOOLEAN gFlagReconnect; BOOLEAN gCallbackReconnect; BROWSER_SETTING_SCOPE gBrowserSettingScope =3D FormSetLevel; BOOLEAN mBrowserScopeFirstSet =3D TRUE; @@ -497,11 +498,11 @@ SendForm ( // Save globals used by SendForm() // SaveBrowserContext (); =20 gFlagReconnect =3D FALSE; - gResetRequired =3D FALSE; + gResetRequiredFormLevel =3D FALSE; gExitRequired =3D FALSE; gCallbackReconnect =3D FALSE; Status =3D EFI_SUCCESS; gEmptyString =3D L""; gDisplayFormData.ScreenDimensions =3D (EFI_SCREEN_DESCRIPTOR *) ScreenDi= mensions; @@ -577,11 +578,11 @@ SendForm ( FreePool (Selection); } =20 if (ActionRequest !=3D NULL) { *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_NONE; - if (gResetRequired) { + if (gResetRequiredFormLevel) { *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_RESET; } } =20 mFormDisplay->ExitDisplay(); @@ -2676,11 +2677,12 @@ UpdateFlagForForm ( // // Only the changed data has been saved, then need to set the reset fl= ag. // if (SetFlag && OldValue && !Question->ValueChanged) { if ((Question->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) !=3D 0) { - gResetRequired =3D TRUE; + gResetRequiredFormLevel =3D TRUE; + gResetRequiredSystemLevel =3D TRUE; } =20 if ((Question->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) !=3D= 0) { gFlagReconnect =3D TRUE; } @@ -5915,11 +5917,11 @@ SaveBrowserContext ( =20 // // Save FormBrowser context // Context->Selection =3D gCurrentSelection; - Context->ResetRequired =3D gResetRequired; + Context->ResetRequired =3D gResetRequiredFormLevel; Context->FlagReconnect =3D gFlagReconnect; Context->CallbackReconnect =3D gCallbackReconnect; Context->ExitRequired =3D gExitRequired; Context->HiiHandle =3D mCurrentHiiHandle; Context->FormId =3D mCurrentFormId; @@ -5988,11 +5990,11 @@ RestoreBrowserContext ( =20 // // Restore FormBrowser context // gCurrentSelection =3D Context->Selection; - gResetRequired =3D Context->ResetRequired; + gResetRequiredFormLevel =3D Context->ResetRequired; gFlagReconnect =3D Context->FlagReconnect; gCallbackReconnect =3D Context->CallbackReconnect; gExitRequired =3D Context->ExitRequired; mCurrentHiiHandle =3D Context->HiiHandle; mCurrentFormId =3D Context->FormId; @@ -6463,11 +6465,12 @@ ExecuteAction ( =20 // // Executet the reset action. // if ((Action & BROWSER_ACTION_RESET) !=3D 0) { - gResetRequired =3D TRUE; + gResetRequiredFormLevel =3D TRUE; + gResetRequiredSystemLevel =3D TRUE; } =20 // // Executet the exit action. // @@ -6563,8 +6566,8 @@ BOOLEAN EFIAPI IsResetRequired ( VOID ) { - return gResetRequired; + return gResetRequiredSystemLevel; } =20 diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h b/MdeModulePkg/= Universal/SetupBrowserDxe/Setup.h index f1accdf..de140e9 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.h @@ -1,9 +1,9 @@ /** @file Private MACRO, structure and function definitions for Setup Browser module. =20 -Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at http://opensource.org/licenses/bsd-license.php =20 @@ -578,11 +578,12 @@ extern EFI_HII_CONFIG_ROUTING_PROTOCOL *mHiiConfigR= outing; extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mPathFromText; extern EDKII_FORM_DISPLAY_ENGINE_PROTOCOL *mFormDisplay; =20 extern BOOLEAN gCallbackReconnect; extern BOOLEAN gFlagReconnect; -extern BOOLEAN gResetRequired; +extern BOOLEAN gResetRequiredFormLevel; +extern BOOLEAN gResetRequiredSystemLevel; extern BOOLEAN gExitRequired; extern LIST_ENTRY gBrowserFormSetList; extern LIST_ENTRY gBrowserHotKeyList; extern BROWSER_SETTING_SCOPE gBrowserSettingScope; extern EXIT_HANDLER ExitHandlerFunction; --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 04:36:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1500627401299189.91908746032266; Fri, 21 Jul 2017 01:56:41 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 97B3421D1B289; Fri, 21 Jul 2017 01:54:42 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CB54921D1B287 for ; Fri, 21 Jul 2017 01:54:40 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 21 Jul 2017 01:56:37 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga004.fm.intel.com with ESMTP; 21 Jul 2017 01:56:36 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,389,1496127600"; d="scan'208";a="289651979" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 21 Jul 2017 16:56:02 +0800 Message-Id: <1500627363-171152-3-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1500627363-171152-1-git-send-email-dandan.bi@intel.com> References: <1500627363-171152-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [PATCH v2 2/3] MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" V2: Refine the comments. In UI page, some configuration change may require system reset. BootManagerUiLib misses this check before exiting UiApp to boot other boot options. Now add the check. Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Liming Gao for this serial. --- .../Library/BootManagerUiLib/BootManager.c | 51 ++++++++++++++++++= +++- .../Library/BootManagerUiLib/BootManager.h | 4 +- .../Library/BootManagerUiLib/BootManagerUiLib.inf | 3 +- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c b/MdeModul= ePkg/Library/BootManagerUiLib/BootManager.c index bf872f8..8e77632 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c @@ -1,9 +1,9 @@ /** @file The boot manager reference implementation =20 -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availabl= e under the terms and conditions of the BSD License that accompanies this distribu= tion. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. =20 @@ -292,10 +292,54 @@ BmSetConsoleMode ( =20 return EFI_SUCCESS; } =20 /** + + Check whether a reset is needed,if reset is needed, Popup a menu to noti= ce user. + +**/ +VOID +BmSetupResetReminder ( + VOID + ) +{ + EFI_INPUT_KEY Key; + CHAR16 *StringBuffer1; + CHAR16 *StringBuffer2; + EFI_STATUS Status; + EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2; + + // + // Use BrowserEx2 protocol to check whether reset is required. + // + Status =3D gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL,= (VOID **) &FormBrowserEx2); + // + //check any reset required change is applied? if yes, reset system + // + if (!EFI_ERROR(Status) && FormBrowserEx2->IsResetRequired ()) { + StringBuffer1 =3D AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); + ASSERT (StringBuffer1 !=3D NULL); + StringBuffer2 =3D AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16)); + ASSERT (StringBuffer2 !=3D NULL); + StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset= to apply it Now."); + StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset"); + // + // Popup a menu to notice user + // + do { + CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer= 1, StringBuffer2, NULL); + } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); + + FreePool (StringBuffer1); + FreePool (StringBuffer2); + + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + } +} + +/** Group the legacy boot options in the BootOption. =20 The routine assumes the boot options in the beginning that covers all th= e device=20 types are ordered properly and re-position the following boot options ju= st after the corresponding boot options with the same device type. @@ -780,10 +824,15 @@ BootManagerCallback ( // gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EF= I_BLACK)); gST->ConOut->ClearScreen (gST->ConOut); =20 // + //check any reset required change is applied? if yes, reset system + // + BmSetupResetReminder (); + + // // parse the selected option // BmSetConsoleMode (FALSE); EfiBootManagerBoot (&BootOption[QuestionId - 1]); BmSetConsoleMode (TRUE); diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.h b/MdeModul= ePkg/Library/BootManagerUiLib/BootManager.h index 1bedff4..3adddf6 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.h +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.h @@ -1,9 +1,9 @@ /** @file The boot manager reference implementation =20 -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made availabl= e under the terms and conditions of the BSD License that accompanies this distribu= tion. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. =20 @@ -18,10 +18,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITH= ER EXPRESS OR IMPLIED. #include #include =20 #include #include +#include =20 #include #include #include #include @@ -53,10 +54,11 @@ typedef struct { =20 #define BOOT_MANAGER_FORM_ID 0x1000 =20 #define LABEL_BOOT_OPTION 0x00 #define LABEL_BOOT_OPTION_END 0x01 +#define MAX_STRING_LEN 200 =20 // // Variable created with this flag will be "Efi:...." // #define VAR_FLAG EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_A= CCESS | EFI_VARIABLE_NON_VOLATILE diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf b/M= deModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf index d2df24b..7983b07 100644 --- a/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf +++ b/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf @@ -1,9 +1,9 @@ ## @file # Boot Manager Library used by UiApp. # -# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials are licensed and made avail= able under # the terms and conditions of the BSD License that accompanies this distr= ibution. # The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php. # =20 @@ -54,10 +54,11 @@ gEfiIfrFrontPageGuid ## CONSUMES ## GUID =20 [Protocols] gEfiHiiConfigAccessProtocolGuid ## CONSUMES gEfiDevicePathToTextProtocolGuid ## CONSUMES + gEdkiiFormBrowserEx2ProtocolGuid ## CONSUMES =20 [FeaturePcd] =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## C= ONSUMES --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri Dec 27 04:36:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1500627405398203.17811509785236; Fri, 21 Jul 2017 01:56:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D03B421D1B28D; Fri, 21 Jul 2017 01:54:45 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 90B9C21D1B287 for ; Fri, 21 Jul 2017 01:54:44 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP; 21 Jul 2017 01:56:41 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga004.fm.intel.com with ESMTP; 21 Jul 2017 01:56:40 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,389,1496127600"; d="scan'208";a="289651987" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 21 Jul 2017 16:56:03 +0800 Message-Id: <1500627363-171152-4-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1500627363-171152-1-git-send-email-dandan.bi@intel.com> References: <1500627363-171152-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [PATCH v2 3/3] MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" V2: Refine the comments. In UI page, some configuration change may require system reset. BootMaintenanceManagerUiLib misses this check before exiting UiApp to boot other boot options. Now add the check. Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Liming Gao for this serial. --- .../BootMaintenanceManager.h | 1 + .../BootMaintenanceManagerUiLib.inf | 3 +- .../BootMaintenanceManagerUiLib/BootOption.c | 49 ++++++++++++++++++= ++++ 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenan= ceManager.h b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintena= nceManager.h index a8d7a0f..99d1656 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= er.h +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= er.h @@ -26,10 +26,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITH= ER EXPRESS OR IMPLIED. #include #include #include #include #include +#include =20 #include #include #include #include diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenan= ceManagerUiLib.inf b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootM= aintenanceManagerUiLib.inf index 6f2cda3..1c0c0e1 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= erUiLib.inf +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= erUiLib.inf @@ -1,9 +1,9 @@ ## @file # Boot Maintenance Manager Library used by UiApp. # -# Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials are licensed and made avail= able under # the terms and conditions of the BSD License that accompanies this distr= ibution. # The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php. # =20 @@ -89,10 +89,11 @@ gEfiSimpleFileSystemProtocolGuid ## CONSUMES gEfiLoadFileProtocolGuid ## CONSUMES gEfiHiiConfigAccessProtocolGuid ## CONSUMES gEfiSerialIoProtocolGuid ## CONSUMES gEfiDevicePathToTextProtocolGuid ## CONSUMES + gEdkiiFormBrowserEx2ProtocolGuid ## CONSUMES =20 [FeaturePcd] =20 [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow ## CONSUMES diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c = b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c index 890728a..8680a51 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c @@ -22,10 +22,55 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITH= ER EXPRESS OR IMPLIED. /// Define the maximum characters that will be accepted. /// #define MAX_CHAR 480 =20 /** + + Check whether a reset is needed, if reset is needed, Popup a menu to not= ice user. + +**/ +VOID +BmmSetupResetReminder ( + VOID + ) +{ + EFI_INPUT_KEY Key; + CHAR16 *StringBuffer1; + CHAR16 *StringBuffer2; + EFI_STATUS Status; + EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2; + + // + // Use BrowserEx2 protocol to check whether reset is required. + // + Status =3D gBS->LocateProtocol (&gEdkiiFormBrowserEx2ProtocolGuid, NULL,= (VOID **) &FormBrowserEx2); + + // + //check any reset required change is applied? if yes, reset system + // + if (!EFI_ERROR(Status) && FormBrowserEx2->IsResetRequired()) { + StringBuffer1 =3D AllocateZeroPool (MAX_CHAR * sizeof (CHAR16)); + ASSERT (StringBuffer1 !=3D NULL); + StringBuffer2 =3D AllocateZeroPool (MAX_CHAR * sizeof (CHAR16)); + ASSERT (StringBuffer2 !=3D NULL); + StrCpyS (StringBuffer1, MAX_CHAR, L"Configuration changed. Reset to ap= ply it Now."); + StrCpyS (StringBuffer2, MAX_CHAR, L"Press ENTER to reset"); + // + // Popup a menu to notice user + // + do { + CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer= 1, StringBuffer2, NULL); + } while (Key.UnicodeChar !=3D CHAR_CARRIAGE_RETURN); + + FreePool (StringBuffer1); + FreePool (StringBuffer2); + + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + } +} + +/** Create a menu entry by given menu type. =20 @param MenuType The Menu type to be created. =20 @retval NULL If failed to create the menu. @@ -881,10 +926,14 @@ BootFromFile ( ); // // Since current no boot from removable media directly is allowed */ // gST->ConOut->ClearScreen (gST->ConOut); + // + // Check whether need to reset system. + // + BmmSetupResetReminder (); =20 BmmSetConsoleMode (FALSE); EfiBootManagerBoot (&BootOption); BmmSetConsoleMode (TRUE); =20 --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel