Clarify myself. I have question on the sentence below: "In that case the new allocation will fall outside of the permanent RAM area that may have been reserved from the OS, for example as ACPI NVS memory."
1) ACPI Nvs is reserved from OS. BIOS *CAN* touch it. 2) "the new allocation will fall outside of the permanent RAM area that may have been reserved from the OS", this should *never* happen according to current design. All memory touched by S3 should be reserved. If you observe it happen, we should investigate and root-cause it at first. Thank you Yao Jiewen -----Original Message----- From: Yao, Jiewen Sent: Tuesday, December 10, 2013 12:52 PM To: edk2-devel@lists.sourceforge.net Subject: RE: [edk2] [RFC v2 22/24] UefiCpuPkg: S3Resume2Pei: allow preallocation of PEI_S3_RESUME_STATE Hi Laszlo Would you please clarify your concern? Does that real happen on some platforms? Or Do you think it MIGHT happen? If it does happen, would please clarify on which platform and why? I am trying to understand that... -----Original Message----- From: Laszlo Ersek [mailto:ler...@redhat.com] Sent: Tuesday, December 10, 2013 11:56 AM To: edk2-devel@lists.sourceforge.net Subject: [edk2] [RFC v2 22/24] UefiCpuPkg: S3Resume2Pei: allow preallocation of PEI_S3_RESUME_STATE This patch enables S3Resume2Pei to eliminate an could be invalid during S3 Resume. The concrete implementation allocates memory from the HOB heap: S3ResumeExecuteBootScript() [UefiCpuPkg/.../S3Resume2Pei/S3Resume.c] AllocatePool() [MdePkg/Library/PeiMemoryAllocationLib] PeiServicesAllocatePool() [MdePkg/Library/PeiServicesLib] PeiAllocatePool() [MdeModulePkg/Core/Pei/Memory/MemoryServices.c] PeiServicesCreateHob(EFI_HOB_TYPE_MEMORY_POOL) but we might already be past the migration from temporary RAM to permanent RAM. In that case the new allocation will fall outside of the permanent RAM area that may have been reserved from the OS, for example as ACPI NVS memory. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf | 1 + UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c | 5 ++++- UefiCpuPkg/UefiCpuPkg.dec | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf index db5d66e..85d6d3d 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume2Pei.inf @@ -85,6 +85,7 @@ [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable + gUefiCpuPkgTokenSpaceGuid.PcdPeiS3ResumeState [Depex] TRUE diff --git a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c index 426eef7..c5a3b66 100644 --- a/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c +++ b/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c @@ -851,7 +851,10 @@ S3ResumeExecuteBootScript ( // // Prepare data for return back // - PeiS3ResumeState = AllocatePool (sizeof(*PeiS3ResumeState)); + PeiS3ResumeState = (VOID *)(UINTN)PcdGet64 (PcdPeiS3ResumeState); if + (PeiS3ResumeState == NULL) { + PeiS3ResumeState = AllocatePool (sizeof(*PeiS3ResumeState)); } ASSERT (PeiS3ResumeState != NULL); DEBUG (( EFI_D_ERROR, "PeiS3ResumeState - %x\r\n", PeiS3ResumeState)); PeiS3ResumeState->ReturnCs = 0x10; diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index b3858b1..d962ef6 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -44,3 +44,10 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress|0xfee00000|UINT32|0x00000001 +[PcdsDynamic, PcdsDynamicEx] + ## The following PCD controls the allocation of "PeiS3ResumeState" in + # S3ResumeExecuteBootScript() + # [UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c]. When left at +NULL, + # "PeiS3ResumeState" will be allocated with AllocatePool(). +Otherwise the + # address specified in the PCD will be assigned to "PeiS3ResumeState". + gUefiCpuPkgTokenSpaceGuid.PcdPeiS3ResumeState|0x0|UINT64|0x00000002 -- 1.8.3.1 ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel