From nobody Mon May 6 07:40:28 2024 Delivered-To: importer@patchew.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 1512981383841455.70210467362665; Mon, 11 Dec 2017 00:36:23 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9277B221EA0A2; Mon, 11 Dec 2017 00:31:45 -0800 (PST) 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 CEF812214E358 for ; Mon, 11 Dec 2017 00:31:43 -0800 (PST) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2017 00:36:20 -0800 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.46]) by fmsmga006.fm.intel.com with ESMTP; 11 Dec 2017 00:36:19 -0800 X-Original-To: edk2-devel@lists.01.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; Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,391,1508828400"; d="scan'208";a="185883894" From: Star Zeng To: edk2-devel@lists.01.org Date: Mon, 11 Dec 2017 16:36:18 +0800 Message-Id: <1512981378-16992-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [PATCH] MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS 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: Jiewen Yao , Star Zeng 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" Otherwise, LegacyBoot may be triggered wrongly by other code in UEFI OS, or vice versa. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: jiewen.yao@intel.com --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.c index 6d266933868d..d516e9dcea34 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c @@ -157,6 +157,7 @@ SmmLegacyBootHandler ( { EFI_STATUS Status; EFI_HANDLE SmmHandle; + UINTN Index; =20 // // Install SMM Legacy Boot protocol. @@ -173,6 +174,16 @@ SmmLegacyBootHandler ( =20 SmiHandlerUnRegister (DispatchHandle); =20 + // + // It is legacy boot, unregister ExitBootService SMI handler. + // + for (Index =3D 0; mSmmCoreSmiHandlers[Index].HandlerType !=3D NULL; Inde= x++) { + if (CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, &gEfiEventExi= tBootServicesGuid)) { + SmiHandlerUnRegister (mSmmCoreSmiHandlers[Index].DispatchHandle); + break; + } + } + return Status; } =20 @@ -201,6 +212,7 @@ SmmExitBootServicesHandler ( { EFI_STATUS Status; EFI_HANDLE SmmHandle; + UINTN Index; =20 // // Install SMM Exit Boot Services protocol. @@ -215,6 +227,16 @@ SmmExitBootServicesHandler ( =20 SmiHandlerUnRegister (DispatchHandle); =20 + // + // It is UEFI boot, unregister LegacyBoot SMI handler. + // + for (Index =3D 0; mSmmCoreSmiHandlers[Index].HandlerType !=3D NULL; Inde= x++) { + if (CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, &gEfiEventLeg= acyBootGuid)) { + SmiHandlerUnRegister (mSmmCoreSmiHandlers[Index].DispatchHandle); + break; + } + } + return Status; } =20 --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel