Eugene,

On 2015/12/9 21:10, Cohen, Eugene wrote:
Star,


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.

I'm trying to understand what you mean but am struggling.  In the patch the 
install of the PPIs only occur if PeiServicesRegisterForShadow returns 
EFI_ALREADY_STARTED which means it only installs if permanent memory exists AND 
if the IPL PEIM is shadowed.

I meant what is the meaning of "defer publication"?, I think there is no "defer publication" as the PPIs will be always installed after memory discovered.


"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.

I see - this is not handled in the patch.  So let's review some pseudocode 
before I submit another patch that is wrong...

How about:
1. In the IPL entry point call NotifyPpi for gEfiPeiMemoryDiscoveredPpiGuid 
(with the EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH flag)
2. In the notify callback install the protocols

The result would be:

Pre-permanent memory: IPL would load and publish the IPL PPI and not 
decompression/extraction PPIs
Post-permanent memory with no shadow: IPL PPI callback fires and additional 
PPIs are installed
Post-permanent memory with shadow: Shadowed IPL entry point is called and the 
NotifyPpi callback occurs immediately (after entry point since it's a dispatch 
mode, not callback)

For the case with shadowing does anything special need to be done to clean up 
the pre-shadow PEIM PPI notifications or is this inherent in the shadow process?

I made a patch below just based on your V2 patch, I hope it could explain what is the expectation from me.


Thanks,

Eugene


cc8448ceb640ff9f2d4719c4d7deab183bc3c912
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.h  | 13 +++++---
MdeModulePkg/Core/DxeIplPeim/DxeLoad.c | 58 ++++++++++++++++++++++------------
 2 files changed, 47 insertions(+), 24 deletions(-)

diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
index 50c73cb..30e24bc 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
@@ -61,15 +61,20 @@ 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.
+   @param  PeiServices      Indirect reference to the PEI Services Table.
+ @param NotifyDescriptor Address of the notification descriptor data structure.
+   @param  Ppi              Address of the PPI that was installed.
+
+   @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
+  IN EFI_PEI_SERVICES           **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID                       *Ppi
   );

 /**
diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
index 0cc6e37..de9af68 100644
--- a/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
+++ b/MdeModulePkg/Core/DxeIplPeim/DxeLoad.c
@@ -55,6 +55,12 @@ CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi = {
   NULL
 };

+CONST EFI_PEI_NOTIFY_DESCRIPTOR mMemoryDiscoveredNotifyList = {
+ (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_DISPATCH | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+  &gEfiPeiMemoryDiscoveredPpiGuid,
+  InstallIplPermanentMemoryPpis
+};
+
 /**
   Entry point of DXE IPL PEIM.

@@ -77,7 +83,8 @@ PeimInitializeDxeIpl (
 {
   EFI_STATUS                                Status;
   EFI_BOOT_MODE                             BootMode;
-
+  VOID                                      *Dummy;
+
   BootMode = GetBootModeHob ();

   if (BootMode != BOOT_ON_S3_RESUME) {
@@ -88,19 +95,37 @@ PeimInitializeDxeIpl (
       //
       return Status;
     }
-
+
     //
     // Ensure that DXE IPL is shadowed to permanent memory.
     //
     ASSERT (Status == EFI_ALREADY_STARTED);

     //
+    // DXE core load requires permanent memory
+    //
+    Status = PeiServicesLocatePpi (
+               &gEfiPeiMemoryDiscoveredPpiGuid,
+               0,
+               NULL,
+               (VOID **)&Dummy
+               );
+    ASSERT_EFI_ERROR (Status);
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    //
// Now that permanent memory exists, install the PPIs for decompression
     // and section extraction.
     //
-    InstallIplPermanentMemoryPpis (FileHandle, PeiServices);
+    Status = InstallIplPermanentMemoryPpis (NULL, NULL, NULL);
+    ASSERT_EFI_ERROR (Status);
+  } else {
+    Status = PeiServicesNotifyPpi (&mMemoryDiscoveredNotifyList);
+    ASSERT_EFI_ERROR (Status);
   }
-
+
   //
   // Install DxeIpl PPI.
   //
@@ -110,19 +135,23 @@ PeimInitializeDxeIpl (
   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.
+   @param  PeiServices      Indirect reference to the PEI Services Table.
+ @param NotifyDescriptor Address of the notification descriptor data structure.
+   @param  Ppi              Address of the PPI that was installed.
+
+   @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
+  IN EFI_PEI_SERVICES           **PeiServices,
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,
+  IN VOID                       *Ppi
   )
 {
   EFI_STATUS                                Status;
@@ -229,7 +258,6 @@ DxeLoadCore (
   )
 {
   EFI_STATUS                                Status;
-  VOID                                      *Dummy;
   EFI_FV_FILE_INFO                          DxeCoreFileInfo;
   EFI_PHYSICAL_ADDRESS                      DxeCoreAddress;
   UINT64                                    DxeCoreSize;
@@ -310,16 +338,6 @@ 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.


_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to