From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Permerror (SPF Permanent Error: More than 10 MX records returned) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org 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 7891F2214E324 for ; Mon, 11 Dec 2017 05:16:19 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2017 05:20:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,391,1508828400"; d="scan'208";a="11377305" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 11 Dec 2017 05:20:55 -0800 Received: from fmsmsx155.amr.corp.intel.com (10.18.116.71) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 11 Dec 2017 05:20:55 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX155.amr.corp.intel.com (10.18.116.71) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 11 Dec 2017 05:20:54 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Mon, 11 Dec 2017 21:20:53 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] MdeModulePkg PiSmmCore: Unregister each other for LegacyBoot and EBS Thread-Index: AQHTclsnKNna5jaHEUCU1Do+ZD9yKqM+IPcA Date: Mon, 11 Dec 2017 13:20:52 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AA42606@shsmsx102.ccr.corp.intel.com> References: <1512981378-16992-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1512981378-16992-1-git-send-email-star.zeng@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZDAxNDM2Y2UtNThlNy00ODhhLTg2YzAtOGY4YTgyN2FhMTE2IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJGVk1pT3ZtU2ZJUFZ5OGhTTzZjd05Lc0ZXYWdkOGFEMUxlaDhrRnlvbytVemlcL0l0Y1NNXC9VUHJVaWNVZVVuTzMifQ== x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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: , X-List-Received-Date: Mon, 11 Dec 2017 13:16:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: jiewen.yao@intel.com > -----Original Message----- > From: Zeng, Star > Sent: Monday, December 11, 2017 4:36 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Yao, Jiewen > Subject: [PATCH] MdeModulePkg PiSmmCore: Unregister each other for > LegacyBoot and EBS >=20 > Otherwise, LegacyBoot may be triggered wrongly by other code in UEFI OS, > or vice versa. >=20 > Cc: Jiewen Yao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 22 > ++++++++++++++++++++++ > 1 file changed, 22 insertions(+) >=20 > diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c > b/MdeModulePkg/Core/PiSmmCore/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; In= dex++) > { > + if (CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, > &gEfiEventExitBootServicesGuid)) { > + 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; In= dex++) > { > + if (CompareGuid (mSmmCoreSmiHandlers[Index].HandlerType, > &gEfiEventLegacyBootGuid)) { > + SmiHandlerUnRegister > (mSmmCoreSmiHandlers[Index].DispatchHandle); > + break; > + } > + } > + > return Status; > } >=20 > -- > 2.7.0.windows.1