From nobody Sat Nov 2 14:28:47 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.zoho.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 1487567182317731.9044314626603; Sun, 19 Feb 2017 21:06:22 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6266D821E6; Sun, 19 Feb 2017 21:06:20 -0800 (PST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 2F7B7821C5 for ; Sun, 19 Feb 2017 21:06:19 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Feb 2017 21:06:18 -0800 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga002.fm.intel.com with ESMTP; 19 Feb 2017 21:06:17 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,184,1484035200"; d="scan'208";a="1132212639" From: Dandan Bi To: edk2-devel@lists.01.org Date: Mon, 20 Feb 2017 13:05:48 +0800 Message-Id: <1487567149-274444-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [patch] MdeModulePkg/BMMUiLib: Remove old useless data before new save action X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 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" There exits the case that when saving changes in form A, the old saved data in form B are not cleaned, will be saved again with the new save. Thus incorrect UI behavior will be shown. This patch is to remove some useless data. https://bugzilla.tianocore.org/show_bug.cgi?id=3D385 Cc: Eric Dong Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi Reviewed-by: Eric Dong --- .../BootMaintenanceManagerUiLib/BootMaintenance.c | 35 ++++++++++++++++++= +++- .../BootMaintenanceManager.h | 14 ++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenan= ce.c b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c index e49ab98..3ff23a5 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenance.c @@ -1,9 +1,9 @@ /** @file The functions for Boot Maintainence Main menu. =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 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 @@ -1212,13 +1212,15 @@ BootMaintCallback ( if ((Value =3D=3D NULL) || (ActionRequest =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 if (QuestionId =3D=3D KEY_VALUE_SAVE_AND_EXIT_BOOT) { + CleanUselessBeforeSubmit (Private); CurrentFakeNVMap->BootOptionChanged =3D FALSE; *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId =3D=3D KEY_VALUE_SAVE_AND_EXIT_DRIVER) { + CleanUselessBeforeSubmit (Private); CurrentFakeNVMap->DriverOptionChanged =3D FALSE; *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId =3D=3D KEY_VALUE_NO_SAVE_AND_EXIT_DRIVER) { // // Discard changes and exit formset @@ -1267,10 +1269,11 @@ BootMaintCallback ( } else { switch (QuestionId) { case KEY_VALUE_SAVE_AND_EXIT: case KEY_VALUE_NO_SAVE_AND_EXIT: if (QuestionId =3D=3D KEY_VALUE_SAVE_AND_EXIT) { + CleanUselessBeforeSubmit (Private); *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT; } else if (QuestionId =3D=3D KEY_VALUE_NO_SAVE_AND_EXIT) { DiscardChangeHandler (Private, CurrentFakeNVMap); *ActionRequest =3D EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT; } @@ -1369,10 +1372,40 @@ DiscardChangeHandler ( break; } } =20 /** + This function is to clean some useless data before submit changes. + + @param Private The BMM context data. + +**/ +VOID +CleanUselessBeforeSubmit ( + IN BMM_CALLBACK_DATA *Private + ) +{ + UINT16 Index; + if (Private->BmmPreviousPageId !=3D FORM_BOOT_DEL_ID) { + for (Index =3D 0; Index < BootOptionMenu.MenuNumber; Index++) { + if (Private->BmmFakeNvData.BootOptionDel[Index] && !Private->BmmFake= NvData.BootOptionDelMark[Index]) { + Private->BmmFakeNvData.BootOptionDel[Index] =3D FALSE; + Private->BmmOldFakeNVData.BootOptionDel[Index] =3D FALSE; + } + } + } + if (Private->BmmPreviousPageId !=3D FORM_DRV_DEL_ID) { + for (Index =3D 0; Index < DriverOptionMenu.MenuNumber; Index++) { + if (Private->BmmFakeNvData.DriverOptionDel[Index] && !Private->BmmFa= keNvData.DriverOptionDelMark[Index]) { + Private->BmmFakeNvData.DriverOptionDel[Index] =3D FALSE; + Private->BmmOldFakeNVData.DriverOptionDel[Index] =3D FALSE; + } + } + } +} + +/** =20 Update the menus in the BMM page. =20 **/ VOID diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenan= ceManager.h b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintena= nceManager.h index 0665c78..532b75b 100644 --- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= er.h +++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManag= er.h @@ -1,9 +1,9 @@ /** @file Header file for boot maintenance module. =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 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 @@ -1047,10 +1047,22 @@ VOID DiscardChangeHandler ( IN BMM_CALLBACK_DATA *Private, IN BMM_FAKE_NV_DATA *CurrentFakeNVMap ); =20 + +/** + This function is to clean some useless data before submit changes. + + @param Private The BMM context data. + +**/ +VOID +CleanUselessBeforeSubmit ( + IN BMM_CALLBACK_DATA *Private + ); + /** Dispatch the display to the next page based on NewPageId. =20 @param Private The BMM context data. @param NewPageId The original page ID. --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel