From nobody Sat Nov 2 06:25:24 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 1500615576553442.4608124001908; Thu, 20 Jul 2017 22:39:36 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id F033621D1B280; Thu, 20 Jul 2017 22:37:37 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 3915B21D0DE6A for ; Thu, 20 Jul 2017 22:37:37 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2017 22:39:33 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga006.fm.intel.com with ESMTP; 20 Jul 2017 22:39:32 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,388,1496127600"; d="scan'208";a="130029704" From: Dandan Bi To: edk2-devel@lists.01.org Date: Fri, 21 Jul 2017 13:39:02 +0800 Message-Id: <1500615542-168644-4-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1500615542-168644-1-git-send-email-dandan.bi@intel.com> References: <1500615542-168644-1-git-send-email-dandan.bi@intel.com> Subject: [edk2] [patch 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" 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 --- .../BootMaintenanceManager.h | 1 + .../BootMaintenanceManagerUiLib.inf | 3 +- .../BootMaintenanceManagerUiLib/BootOption.c | 50 ++++++++++++++++++= ++++ 3 files changed, 53 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..0a08573 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c @@ -22,10 +22,56 @@ 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, and finish the reset reminder feature. + If a reset is needed, Popup a menu to notice user, and finish the feature + according to the user selection. + +**/ +VOID +BmmSetupResetReminder ( + VOID + ) +{ + EFI_INPUT_KEY Key; + CHAR16 *StringBuffer1; + CHAR16 *StringBuffer2; + EFI_STATUS Status; + EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2; + + // + // Use BrowserEx2 protocol to register HotKey. + // + 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 +927,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