From nobody Tue May 7 18:07:36 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 1513302030199320.21535593908504; Thu, 14 Dec 2017 17:40:30 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1DCA02216D8D2; Thu, 14 Dec 2017 17:35:47 -0800 (PST) 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 463F82216D8D0 for ; Thu, 14 Dec 2017 17:35:46 -0800 (PST) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Dec 2017 17:40:27 -0800 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.46]) by orsmga006.jf.intel.com with ESMTP; 14 Dec 2017 17:40:26 -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=192.55.52.43; helo=mga05.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,402,1508828400"; d="scan'208";a="2950418" From: Star Zeng To: edk2-devel@lists.01.org Date: Fri, 15 Dec 2017 09:40:24 +0800 Message-Id: <1513302024-10760-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 Subject: [edk2] [PATCH] MdeModulePkg PiSmmCore: Use SxDispatch in SmmEndOfDxeHandler() 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" As some implementation of SMM Child Dispatcher (including SxDispatch) may deny the handler registration after SmmReadyToLock, using SxDispatch in SmmReadyToBootHandler() will be too late. This patch updates code to use SxDispatch in SmmEndOfDxeHandler() instead of SmmReadyToBootHandler(). Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 65 +++++++++++++++++------------= ---- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c b/MdeModulePkg/Core/Pi= SmmCore/PiSmmCore.c index f136b5d5693b..d2f0207b5c83 100644 --- a/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c +++ b/MdeModulePkg/Core/PiSmmCore/PiSmmCore.c @@ -296,9 +296,6 @@ SmmReadyToBootHandler ( { EFI_STATUS Status; EFI_HANDLE SmmHandle; - EFI_SMM_SX_DISPATCH2_PROTOCOL *SxDispatch; - EFI_SMM_SX_REGISTER_CONTEXT EntryRegisterContext; - EFI_HANDLE S3EntryHandle; =20 // // Install SMM Ready To Boot protocol. @@ -313,31 +310,7 @@ SmmReadyToBootHandler ( =20 SmiHandlerUnRegister (DispatchHandle); =20 - // - // Locate SmmSxDispatch2 protocol. - // - Status =3D SmmLocateProtocol ( - &gEfiSmmSxDispatch2ProtocolGuid, - NULL, - (VOID **)&SxDispatch - ); - if (!EFI_ERROR (Status) && (SxDispatch !=3D NULL)) { - // - // Register a S3 entry callback function to - // determine if it will be during S3 resume. - // - EntryRegisterContext.Type =3D SxS3; - EntryRegisterContext.Phase =3D SxEntry; - Status =3D SxDispatch->Register ( - SxDispatch, - SmmS3EntryCallBack, - &EntryRegisterContext, - &S3EntryHandle - ); - ASSERT_EFI_ERROR (Status); - } - - return EFI_SUCCESS; + return Status; } =20 /** @@ -452,10 +425,14 @@ SmmEndOfDxeHandler ( IN OUT UINTN *CommBufferSize OPTIONAL ) { - EFI_STATUS Status; - EFI_HANDLE SmmHandle; + EFI_STATUS Status; + EFI_HANDLE SmmHandle; + EFI_SMM_SX_DISPATCH2_PROTOCOL *SxDispatch; + EFI_SMM_SX_REGISTER_CONTEXT EntryRegisterContext; + EFI_HANDLE S3EntryHandle; =20 DEBUG ((EFI_D_INFO, "SmmEndOfDxeHandler\n")); + // // Install SMM EndOfDxe protocol // @@ -466,7 +443,32 @@ SmmEndOfDxeHandler ( EFI_NATIVE_INTERFACE, NULL ); - return Status; + + // + // Locate SmmSxDispatch2 protocol. + // + Status =3D SmmLocateProtocol ( + &gEfiSmmSxDispatch2ProtocolGuid, + NULL, + (VOID **)&SxDispatch + ); + if (!EFI_ERROR (Status) && (SxDispatch !=3D NULL)) { + // + // Register a S3 entry callback function to + // determine if it will be during S3 resume. + // + EntryRegisterContext.Type =3D SxS3; + EntryRegisterContext.Phase =3D SxEntry; + Status =3D SxDispatch->Register ( + SxDispatch, + SmmS3EntryCallBack, + &EntryRegisterContext, + &S3EntryHandle + ); + ASSERT_EFI_ERROR (Status); + } + + return EFI_SUCCESS; } =20 /** @@ -526,7 +528,6 @@ SmmEndOfS3ResumeHandler ( ASSERT_EFI_ERROR (Status); =20 mDuringS3Resume =3D FALSE; - 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