From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 B824621A0483A for ; Tue, 11 Apr 2017 23:52:09 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2017 23:52:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,189,1488873600"; d="dat'59?scan'59,208,59";a="247578615" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 11 Apr 2017 23:52:08 -0700 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Apr 2017 23:52:08 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Apr 2017 23:52:08 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.117]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Wed, 12 Apr 2017 14:52:05 +0800 From: "Guo, Mang" To: "edk2-devel@lists.01.org" CC: "Wei, David" , "Lu, ShifeiX A" Thread-Topic: [Patch][edk2-platforms/devel-MinnowBoard3] Fix S3 resume failure Thread-Index: AdKzWUszpoIGoux4S/SSr4rw7zutDw== Date: Wed, 12 Apr 2017 06:52:04 +0000 Message-ID: <22D2C85ED001C54AA20BFE3B0E4751D152501751@SHSMSX103.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <22D2C85ED001C54AA20BFE3B0E4751D152501751@SHSMSX103.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 Subject: [Patch][edk2-platforms/devel-MinnowBoard3] Fix S3 resume failure 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: Wed, 12 Apr 2017 06:52:09 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable When restoring MSR for S3 setting, SmmStartupThisAp will return error if CP= U index is BSP. This issue caused S3 resume failed sometimes. This patch is= mainly fix this issue. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang --- .../PlatformDsc/PcdsFeatureFlag.dsc | 7 ++++++- .../Cpu/PowerManagement/Smm/PowerMgmtS3.c | 23 ++++++++++++------= ---- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc b/= Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc index 6762a41..19e27ad 100644 --- a/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc +++ b/Platform/BroxtonPlatformPkg/PlatformDsc/PcdsFeatureFlag.dsc @@ -1,7 +1,7 @@ ## @file # Platform Feature Pcd Description. # -# Copyright (c) 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -91,3 +91,8 @@ # new core to see if we can re-enable this gPlatformModuleTokenSpaceGuid.PcdDeprecatedFunctionRemove|FALSE =20 + ## Indicates if SMM Startup AP in a blocking fashion. + # TRUE - SMM Startup AP in a blocking fashion.
+ # FALSE - SMM Startup AP in a non-blocking fashion.
+ # @Prompt SMM Startup AP in a blocking fashion. + gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmBlockStartupThisAp|FALSE \ No newline at end of file diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerM= gmtS3.c b/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmt= S3.c index 4385320..eb36343 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/PowerManagement/Smm/PowerMgmtS3.c @@ -1,7 +1,7 @@ /** @file This is the SMM driver for saving and restoring the powermanagement rela= ted MSRs. =20 - Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -140,15 +140,18 @@ RunOnAllLogicalProcessors ( // Run the procedure on all logical processors. // (*Procedure) (Buffer); - for (Index =3D 1; Index < gSmst->NumberOfCpus; Index++) { - Status =3D EFI_NOT_READY; - while (Status !=3D EFI_SUCCESS) { - Status =3D gSmst->SmmStartupThisAp (Procedure, Index, Buffer); - if (Status !=3D EFI_SUCCESS) { - // - // SmmStartupThisAp might return failure if AP is busy executing s= ome other code. Let's wait for sometime and try again. - // - MicroSecondDelay (PPM_WAIT_PERIOD); + for (Index =3D 0; Index < gSmst->NumberOfCpus; Index++) { + if (Index !=3D gSmst->CurrentlyExecutingCpu) { + Status =3D EFI_NOT_READY; + while (Status !=3D EFI_SUCCESS) { + Status =3D gSmst->SmmStartupThisAp (Procedure, Index, Buffer); + ASSERT(Status !=3D EFI_INVALID_PARAMETER); + if (Status !=3D EFI_SUCCESS) { + // + // SmmStartupThisAp might return failure if AP is busy executing= some other code. Let's wait for sometime and try again. + // + MicroSecondDelay (PPM_WAIT_PERIOD); + } } } } --=20 2.10.1.windows.1