From nobody Fri Nov 1 08:33:48 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 15199677661961015.8228072209353; Thu, 1 Mar 2018 21:16:06 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5A57922546BBF; Thu, 1 Mar 2018 21:09:52 -0800 (PST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 64D1E22546BB0 for ; Thu, 1 Mar 2018 21:09:50 -0800 (PST) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2018 21:15:59 -0800 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.46]) by orsmga008.jf.intel.com with ESMTP; 01 Mar 2018 21:15:58 -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: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.88; helo=mga01.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.47,409,1515484800"; d="scan'208";a="21960028" From: Star Zeng To: edk2-devel@lists.01.org Date: Fri, 2 Mar 2018 13:15:49 +0800 Message-Id: <1519967749-5112-4-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 In-Reply-To: <1519967749-5112-1-git-send-email-star.zeng@intel.com> References: <1519967749-5112-1-git-send-email-star.zeng@intel.com> Subject: [edk2] [PATCH 3/3] UefiCpuPkg S3ResumePei: Signal S3SmmInitDone X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laszlo Ersek , Jiewen Yao , Eric Dong , 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" Cc: Jiewen Yao Cc: Eric Dong Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Acked-by: Laszlo Ersek Reviewed-by: Jiewen.yao@intel.com --- UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 42 +++++++++++++++---= ---- .../Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf | 3 ++ 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg= /Universal/Acpi/S3Resume2Pei/S3Resume.c index 4d776891a72d..2cb7b429e59c 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -259,6 +260,12 @@ EFI_PEI_PPI_DESCRIPTOR mPpiListEndOfPeiTable =3D { 0 }; =20 +EFI_PEI_PPI_DESCRIPTOR mPpiListS3SmmInitDoneTable =3D { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEdkiiS3SmmInitDoneGuid, + 0 +}; + // // Global Descriptor Table (GDT) // @@ -322,13 +329,14 @@ IsLongModeWakingVector ( } =20 /** - Send EndOfS3Resume event to SmmCore through communication buffer way. + Signal to SMM through communication buffer way. + + @param[in] HandlerType SMI handler type to be signaled. =20 - @retval EFI_SUCCESS Return send the event success. **/ -EFI_STATUS -SignalEndOfS3Resume ( - VOID +VOID +SignalToSmmByCommunication ( + IN EFI_GUID *HandlerType ) { EFI_STATUS Status; @@ -338,7 +346,7 @@ SignalEndOfS3Resume ( SMM_COMMUNICATE_HEADER_64 Header64; VOID *CommBuffer; =20 - DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Enter\n")); + DEBUG ((DEBUG_INFO, "Signal %g to SMM - Enter\n", HandlerType)); =20 // // This buffer consumed in DXE phase, so base on DXE mode to prepare com= municate buffer. @@ -355,7 +363,7 @@ SignalEndOfS3Resume ( Header32.MessageLength =3D 0; CommSize =3D OFFSET_OF (SMM_COMMUNICATE_HEADER_32, Data); } - CopyGuid (CommBuffer, &gEdkiiEndOfS3ResumeGuid); + CopyGuid (CommBuffer, HandlerType); =20 Status =3D PeiServicesLocatePpi ( &gEfiPeiSmmCommunicationPpiGuid, @@ -365,7 +373,7 @@ SignalEndOfS3Resume ( ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "Locate Smm Communicate Ppi failed (%r)!\n", Stat= us)); - return Status; + return; } =20 Status =3D SmmCommunicationPpi->Communicate ( @@ -377,8 +385,8 @@ SignalEndOfS3Resume ( DEBUG ((DEBUG_ERROR, "SmmCommunicationPpi->Communicate return failure = (%r)!\n", Status)); } =20 - DEBUG ((DEBUG_INFO, "SignalEndOfS3Resume - Exit (%r)\n", Status)); - return Status; + DEBUG ((DEBUG_INFO, "Signal %g to SMM - Exit (%r)\n", HandlerType, Statu= s)); + return; } =20 /** @@ -464,11 +472,11 @@ S3ResumeBootOs ( PERF_END_EX (NULL, "EndOfPeiPpi", NULL, 0, PERF_INMODULE_END_ID); =20 // - // Signal EndOfS3Resume event. + // Signal EndOfS3Resume to SMM. // PERF_START_EX (NULL, "EndOfS3Resume", NULL, 0, PERF_INMODULE_START_ID); =20 - SignalEndOfS3Resume (); + SignalToSmmByCommunication (&gEdkiiEndOfS3ResumeGuid); =20 PERF_END_EX (NULL, "EndOfS3Resume", NULL, 0, PERF_INMODULE_END_ID); =20 @@ -787,6 +795,16 @@ S3ResumeExecuteBootScript ( Status =3D SmmAccess->Lock ((EFI_PEI_SERVICES **)GetPeiServicesTab= lePointer (), SmmAccess, Index); } } + + // + // Install S3SmmInitDone PPI. + // + Status =3D PeiServicesInstallPpi (&mPpiListS3SmmInitDoneTable); + ASSERT_EFI_ERROR (Status); + // + // Signal S3SmmInitDone to SMM. + // + SignalToSmmByCommunication (&gEdkiiS3SmmInitDoneGuid); } =20 if (FeaturePcdGet (PcdDxeIplSwitchToLongMode)) { diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/Uefi= CpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf index 9522ede726f4..47fecd7d6d80 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf @@ -78,6 +78,9 @@ [Guids] gEfiAcpiVariableGuid gEfiAcpiS3ContextGuid ## SOMETIMES_CONSUMES ## U= NDEFINED # LockBox gEdkiiEndOfS3ResumeGuid ## SOMETIMES_CONSUMES ## U= NDEFINED # Used to do smm communication + ## SOMETIMES_PRODUCES ## UNDEFINED # Install PPI + ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication + gEdkiiS3SmmInitDoneGuid =20 [Ppis] gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel