From nobody Tue Feb 10 05:10:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+93660+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93660+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1663002828; cv=none; d=zohomail.com; s=zohoarc; b=VPZe5l7VaH/ZFNJ4b81rLYAhh6EBmjCKkpBcdCErdLjwaGN7P+kgUXcdgwqScerIMFwEp3wyLNE7IDnRS3DZhyAL77dtOuVfJb90YNodkS9/YkVG7B1JAn7YN6DAmUXn107ZWy7fmY2Q48wlnYFSqx6+bZdGbtjRzH0+K9m+4/g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663002828; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=qDFHoL/ya0dGi16MJk1mhoS2pu6MZFNTlTXicHDNenY=; b=exzJrk639wV4B2X32ohHmbXM2aXZTLtON6QMZDAokWzh7KwBE3WLAoHYKbKlkVkfwAKM30odS5V7DLJLSieeJUwQCiXMKW8kYNrFvsNLLmhQceaQj01pXLyqpTULoKBtUj75PsL9GfWJzI7c8gGHKtnzvCAvSm/+ItvuJahEDRE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+93660+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1663002828877290.57432959149423; Mon, 12 Sep 2022 10:13:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 09iXYY1788612xbsP80QhnRx; Mon, 12 Sep 2022 10:13:48 -0700 X-Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mx.groups.io with SMTP id smtpd.web11.1284.1663002827717951297 for ; Mon, 12 Sep 2022 10:13:47 -0700 X-Received: by mail-qk1-f173.google.com with SMTP id d15so6510050qka.9 for ; Mon, 12 Sep 2022 10:13:47 -0700 (PDT) X-Gm-Message-State: wgcCfH2usNV1etdgRuEBO3bUx1787277AA= X-Google-Smtp-Source: AA6agR68lDeClu3mazkDyVRk6FWUl0QW559Xr6wvEap8G5YypeQcxnNVnIjQcOj45b2OGuCLQZ+RHA== X-Received: by 2002:a05:620a:15a1:b0:6cc:f925:7c89 with SMTP id f1-20020a05620a15a100b006ccf9257c89mr11487462qkk.319.1663002826619; Mon, 12 Sep 2022 10:13:46 -0700 (PDT) X-Received: from aturtleortwo-benjamindomain.. ([2607:f2c0:e98c:e:579e:d875:fc8f:d092]) by smtp.gmail.com with ESMTPSA id s5-20020ac87585000000b00346414a0ca1sm6863540qtq.1.2022.09.12.10.13.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 10:13:46 -0700 (PDT) From: "Benjamin Doron" To: devel@edk2.groups.io Cc: Chasel Chiu , Nate DeSimone , Ankit Sinha , Isaac Oram , Liming Gao , Eric Dong Subject: [edk2-devel] [edk2-platforms][PATCH v3 3/4] MinPlatformPkg: Implement working S3 resume Date: Mon, 12 Sep 2022 13:12:49 -0400 Message-Id: <20220912171250.1515536-4-benjamin.doron00@gmail.com> In-Reply-To: <20220912171250.1515536-1-benjamin.doron00@gmail.com> References: <20220912171250.1515536-1-benjamin.doron00@gmail.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,benjamin.doron00@gmail.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1663002828; bh=npVT0HBLBUZT4IVvBzLZ0uLwMyf+J+horz7fmzIAG0A=; h=Cc:Date:From:Reply-To:Subject:To; b=QIcMYHtg4BO8A0SMsA/h+u8u13gaKXx4yLp6wjlyhtBGp+KDzdFIOB8UT3fwy74c2Oe tjnTZrN+ZqWGZLLbU961Jp+pZyjgi/xaXhZdPTfHgkE86YIXqvr2bI/jX5yHXRjQt/EeZ h/XJXWt4qp1v8ISXGntGa6oqOfj2lbVaLR4= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1663002829177100011 Content-Type: text/plain; charset="utf-8" Consume S3 resume memory allocation on resume flow. Also, include complementary FirmwarePerformanceDataTablePei module in MinPlatform FV for S3 resume performance measurement. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Ankit Sinha Cc: Isaac Oram Cc: Liming Gao Cc: Eric Dong Signed-off-by: Benjamin Doron Reviewed-by: Isaac Oram --- .../FspWrapperHobProcessLib.c | 69 ++++++++++++++++++- .../PeiFspWrapperHobProcessLib.inf | 2 + .../Include/Dsc/CorePeiInclude.dsc | 2 + .../Include/Fdf/CorePostMemoryInclude.fdf | 4 ++ 4 files changed, 76 insertions(+), 1 deletion(-) diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/PeiFspWrapper= HobProcessLib/FspWrapperHobProcessLib.c b/Platform/Intel/MinPlatformPkg/Fsp= Wrapper/Library/PeiFspWrapperHobProcessLib/FspWrapperHobProcessLib.c index 7ee4d3a31c49..9bd6fe6290c5 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProc= essLib/FspWrapperHobProcessLib.c +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProc= essLib/FspWrapperHobProcessLib.c @@ -16,14 +16,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include #include #include #include +#include =20 #include +#include =20 // // Additional pages are used by DXE memory manager. @@ -130,6 +133,55 @@ GetPeiMemSize ( return MinSize + Size + PEI_ADDITIONAL_MEMORY_SIZE; } =20 +/** + Get S3 PEI memory information. + + @note At this point, memory is ready, and PeiServices are available to u= se. + Platform can get some data from SMRAM directly. + + @param[out] S3PeiMemSize PEI memory size to be installed in S3 phase. + @param[out] S3PeiMemBase PEI memory base to be installed in S3 phase. + + @return If S3 PEI memory information is got successfully. +**/ +EFI_STATUS +EFIAPI +GetS3MemoryInfo ( + OUT UINT64 *S3PeiMemSize, + OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase + ) +{ + EFI_STATUS Status; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi; + UINTN DataSize; + ACPI_S3_MEMORY S3MemoryInfo; + + *S3PeiMemBase =3D 0; + *S3PeiMemSize =3D 0; + + Status =3D PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NU= LL, (VOID **) &VariablePpi); + ASSERT_EFI_ERROR (Status); + + DataSize =3D sizeof (S3MemoryInfo); + Status =3D VariablePpi->GetVariable ( + VariablePpi, + ACPI_S3_MEMORY_NV_NAME, + &gEfiAcpiVariableGuid, + NULL, + &DataSize, + &S3MemoryInfo + ); + ASSERT_EFI_ERROR (Status); + + if (EFI_ERROR (Status)) { + return Status; + } + + *S3PeiMemBase =3D S3MemoryInfo.S3PeiMemBase; + *S3PeiMemSize =3D S3MemoryInfo.S3PeiMemSize; + return EFI_SUCCESS; +} + /** Post FSP-M HOB process for Memory Resource Descriptor. =20 @@ -280,7 +332,7 @@ PostFspmHobProcess ( 0x1000 ); =20 - + if (BootMode !=3D BOOT_ON_S3_RESUME) { // // Capsule mode // @@ -337,7 +389,22 @@ PostFspmHobProcess ( if (Capsule !=3D NULL) { Status =3D Capsule->CreateState ((EFI_PEI_SERVICES **)PeiServices, C= apsuleBuffer, CapsuleBufferLength); } + } else { + Status =3D GetS3MemoryInfo (&PeiMemSize, &PeiMemBase); + ASSERT_EFI_ERROR (Status); =20 + DEBUG ((DEBUG_INFO, "S3 resume PeiMemBase : 0x%08x\n", PeiMemBa= se)); + DEBUG ((DEBUG_INFO, "S3 resume PeiMemSize : 0x%08x\n", PeiMemSi= ze)); + + // + // Install efi memory + // + Status =3D PeiServicesInstallPeiMemory ( + PeiMemBase, + PeiMemSize + ); + ASSERT_EFI_ERROR (Status); + } =20 // // Create a memory allocation HOB at fixed location for MP Services PPI = AP wait loop. diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/PeiFspWrapper= HobProcessLib/PeiFspWrapperHobProcessLib.inf b/Platform/Intel/MinPlatformPk= g/FspWrapper/Library/PeiFspWrapperHobProcessLib/PeiFspWrapperHobProcessLib.= inf index b846e7af1d2d..e2aac36bf018 100644 --- a/Platform/Intel/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProc= essLib/PeiFspWrapperHobProcessLib.inf +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/Library/PeiFspWrapperHobProc= essLib/PeiFspWrapperHobProcessLib.inf @@ -75,7 +75,9 @@ gZeroGuid gEfiGraphicsInfoHobGuid gEfiGraphicsDeviceInfoHobGuid + gEfiAcpiVariableGuid =20 [Ppis] gEfiPeiCapsulePpiGuid ## CONSUMES + gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES gEdkiiSiliconInitializedPpiGuid ## PRODUCES diff --git a/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc b= /Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc index 08e50cac075f..f271fb26b189 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc +++ b/Platform/Intel/MinPlatformPkg/Include/Dsc/CorePeiInclude.dsc @@ -41,3 +41,5 @@ NULL|SecurityPkg/Library/HashInstanceLibSha256/HashInstanceLibSha256= .inf } !endif + + MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerf= ormancePei.inf diff --git a/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclud= e.fdf b/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf index 3c2716d6728a..3edc239e5264 100644 --- a/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf +++ b/Platform/Intel/MinPlatformPkg/Include/Fdf/CorePostMemoryInclude.fdf @@ -6,3 +6,7 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent # ## + +!if gMinPlatformPkgTokenSpaceGuid.PcdBootToShellOnly =3D=3D FALSE + INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/Firmwar= ePerformancePei.inf +!endif --=20 2.37.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#93660): https://edk2.groups.io/g/devel/message/93660 Mute This Topic: https://groups.io/mt/93637581/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-