Hi Eugene,
Thanks for the updated patch, but it seems not resolve my concern.
On 2015/12/8 22:42, Cohen, Eugene wrote:
[This patch is updated from v1 to defer publication of the decompression and
extraction PPIs
until after permanent memory is installed. Tested for normal boots and our
temporary
memory S3 resume path.]
This description should be not correct as before the PPIs are also
installed after permanent memory is installed because of the
gEfiPeiMemoryDiscoveredPpiGuid depex. There is no deference of the
publication.
Another, I have given comments below to the v1 patch thread.
"S3 still need the PPIs in case platform have InstallPeiMemory() call
and compressed PEIM even at S3 path. So the code can't to do not install
the PPIs at S3 path."
More information to confirm the above argument is
gEfiMdeModulePkgTokenSpaceGuid.PcdShadowPeimOnS3Boot.
So I also gave the comments below to the v1 patch thread.
"Then should the code be also updated to *install Decompress and
Extraction PPI in memory discovered ppi notify with
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH*?"
Notice I said NOTIFY_DISPATCH but not NOTIFY_CALLBACK because I think
NOTIFY_DISPATCH could let the code behavior to be more close to before
with the gEfiPeiMemoryDiscoveredPpiGuid depex.
Thanks,
Star
This enable S3 resume from temporary memory. The normal boot path
still enforces the permanent memory requirement.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eug...@hp.com>
---
MdeModulePkg/Core/DxeIplPeim/DxeIpl.h | 13 ++++++
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf | 3 +-
MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 83 ++++++++++++++++++++++++++-------
MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 6 ++-
4 files changed, 84 insertions(+), 21 deletions(-)
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
index 75372ac..50c73cb 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
@@ -58,6 +58,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED.
//
extern CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi;
+/**
+ This function installs the PPIs that require permanent memory.
+
+ @return EFI_SUCCESS The PPIs were installed successfully.
+ @return Others Some error occurs during the execution of this
function.
+
+**/
+EFI_STATUS
+EFIAPI
+InstallIplPermanentMemoryPpis (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ );
/**
Searches DxeCore in all firmware Volumes and loads the first
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
index 04ad928..9623f96 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
@@ -93,6 +93,7 @@
## SOMETIMES_CONSUMES
## UNDEFINED # HOB
gEfiVectorHandoffInfoPpiGuid
+ gEfiPeiMemoryDiscoveredPpiGuid ## SOMETIMES_CONSUMES # Consumed on normal
path
[Guids]
## SOMETIMES_CONSUMES ## Variable:L"MemoryTypeInformation"
@@ -115,7 +116,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack ##
SOMETIMES_CONSUMES
[Depex]
- gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiLoadFilePpiGuid AND
gEfiPeiMasterBootModePpiGuid
+ gEfiPeiLoadFilePpiGuid AND gEfiPeiMasterBootModePpiGuid
#
# [BootMode]
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index d7d693f..0cc6e37 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -2,6 +2,7 @@
Last PEIM.
Responsibility of this module is to load the DXE Core from a Firmware
Volume.
+Copyright (c) 2015 HP Development Company, L.P.
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD
License
@@ -32,16 +33,19 @@ CONST EFI_PEI_DECOMPRESS_PPI mDecompressPpi = {
Decompress
};
-CONST EFI_PEI_PPI_DESCRIPTOR mPpiList[] = {
+CONST EFI_PEI_PPI_DESCRIPTOR mDxeIplPpiList[] = {
{
- EFI_PEI_PPI_DESCRIPTOR_PPI,
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
&gEfiDxeIplPpiGuid,
- (VOID *) &mDxeIplPpi
- },
+ (VOID *)&mDxeIplPpi
+ }
+};
+
+CONST EFI_PEI_PPI_DESCRIPTOR mDecompressPpiList[] = {
{
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiDecompressPpiGuid,
- (VOID *) &mDecompressPpi
+ (VOID *)&mDecompressPpi
}
};
@@ -73,9 +77,6 @@ PeimInitializeDxeIpl (
{
EFI_STATUS Status;
EFI_BOOT_MODE BootMode;
- EFI_GUID *ExtractHandlerGuidTable;
- UINTN ExtractHandlerNumber;
- EFI_PEI_PPI_DESCRIPTOR *GuidPpi;
BootMode = GetBootModeHob ();
@@ -92,32 +93,67 @@ PeimInitializeDxeIpl (
// Ensure that DXE IPL is shadowed to permanent memory.
//
ASSERT (Status == EFI_ALREADY_STARTED);
+
+ //
+ // Now that permanent memory exists, install the PPIs for decompression
+ // and section extraction.
+ //
+ InstallIplPermanentMemoryPpis (FileHandle, PeiServices);
}
//
+ // Install DxeIpl PPI.
+ //
+ Status = PeiServicesInstallPpi(mDxeIplPpiList);
+ ASSERT_EFI_ERROR(Status);
+
+ return Status;
+}
+
+
+/**
+ This function installs the PPIs that require permanent memory.
+
+ @return EFI_SUCCESS The PPIs were installed successfully.
+ @return Others Some error occurs during the execution of this
function.
+
+**/
+EFI_STATUS
+EFIAPI
+InstallIplPermanentMemoryPpis (
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
+ )
+{
+ EFI_STATUS Status;
+ EFI_GUID *ExtractHandlerGuidTable;
+ UINTN ExtractHandlerNumber;
+ EFI_PEI_PPI_DESCRIPTOR *GuidPpi;
+
+ //
// Get custom extract guided section method guid list
//
- ExtractHandlerNumber = ExtractGuidedSectionGetGuidList
(&ExtractHandlerGuidTable);
-
+ ExtractHandlerNumber =
ExtractGuidedSectionGetGuidList(&ExtractHandlerGuidTable);
+
//
// Install custom extraction guid PPI
//
if (ExtractHandlerNumber > 0) {
- GuidPpi = (EFI_PEI_PPI_DESCRIPTOR *) AllocatePool (ExtractHandlerNumber *
sizeof (EFI_PEI_PPI_DESCRIPTOR));
- ASSERT (GuidPpi != NULL);
+ GuidPpi = (EFI_PEI_PPI_DESCRIPTOR *)AllocatePool(ExtractHandlerNumber *
sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ ASSERT(GuidPpi != NULL);
while (ExtractHandlerNumber-- > 0) {
GuidPpi->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI |
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
- GuidPpi->Ppi = (VOID *) &mCustomGuidedSectionExtractionPpi;
- GuidPpi->Guid = &ExtractHandlerGuidTable[ExtractHandlerNumber];
- Status = PeiServicesInstallPpi (GuidPpi++);
+ GuidPpi->Ppi = (VOID *)&mCustomGuidedSectionExtractionPpi;
+ GuidPpi->Guid = &ExtractHandlerGuidTable[ExtractHandlerNumber];
+ Status = PeiServicesInstallPpi(GuidPpi++);
ASSERT_EFI_ERROR(Status);
}
}
-
+
//
- // Install DxeIpl and Decompress PPIs.
+ // Install Decompress PPIs.
//
- Status = PeiServicesInstallPpi (mPpiList);
+ Status = PeiServicesInstallPpi(mDecompressPpiList);
ASSERT_EFI_ERROR(Status);
return Status;
@@ -193,6 +229,7 @@ DxeLoadCore (
)
{
EFI_STATUS Status;
+ VOID *Dummy;
EFI_FV_FILE_INFO DxeCoreFileInfo;
EFI_PHYSICAL_ADDRESS DxeCoreAddress;
UINT64 DxeCoreSize;
@@ -273,6 +310,16 @@ DxeLoadCore (
//
}
+ // DXE core load requires permanent memory
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiMemoryDiscoveredPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&Dummy
+ );
+ ASSERT_EFI_ERROR (Status);
+ if( EFI_ERROR(Status)) return Status;
+
if (GetFirstGuidHob ((CONST EFI_GUID *)&gEfiMemoryTypeInformationGuid) ==
NULL) {
//
// Don't build GuidHob if GuidHob has been installed.
diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
index d36f89c..8f2dfa3 100644
--- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
+++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c
@@ -421,9 +421,11 @@ PeiCore (
PeiDispatcher (SecCoreData, &PrivateData);
//
- // Check if InstallPeiMemory service was called.
+ // If we're not doing S3 resume then we require permanent memory
//
- ASSERT(PrivateData.PeiMemoryInstalled == TRUE);
+ if(PrivateData.HobList.HandoffInformationTable->BootMode !=
BOOT_ON_S3_RESUME) {
+ ASSERT(PrivateData.PeiMemoryInstalled == TRUE);
+ }
//
// Measure PEI Core execution time.
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel