Rather than calling AcpiS3Save->S3Save() (in three different places no
less), signal the End-of-Dxe event group in PlatformBdsInit(). With the
modified AcpiS3SaveDxe driver in IntelFrameworkModulePkg, this should have
the same effect.

The event is signaled in PlatformBdsInit() because this way:

- it occurs before InstallReadyToLock() is called from
  PlatformBdsPolicyBehavior(), and installs DxeSmmReadyToLock,

- we satisfy the requirement of the PI spec, volume 2, "5.1.2.1 End of DXE
  Event":

  Prior to invoking any UEFI drivers, applications, or connecting
  consoles, the platform should signal the event
  EFI_END_OF_DXE_EVENT_GUID.

Of the three preexistent AcpiS3Save->S3Save() calls, at least two must
have been ineffective anyway:

- AcpiPlatform called AcpiS3Save->S3Save() in a ready-to-boot callback,
  which was bound to run after PlatformBdsPolicyBehavior() called
  InstallReadyToLock(). InstallReadyToLock() would call
  AcpiS3Save->S3Save() first.

- Override/IntelFrameworkModulePkg/Library/GenericBdsLib called
  AcpiS3Save->S3Save() in BdsLibBootViaBootOption(), which occurred
  similarly after the call made by InstallReadyToLock().

Cc: Yao Jiewen <jiewen....@intel.com>
Cc: David Wei <david....@intel.com>
Cc: Tim He <tim...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <ler...@redhat.com>
---

Notes:
    This patch is completely untested; I can't even compile
    Vlv2TbltDevicePkg.

 Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf                                
            |  1 -
 Vlv2TbltDevicePkg/Library/PlatformBdsLib/PlatformBdsLib.inf                    
            |  2 +-
 
Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
 |  1 -
 Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.h                         
            |  1 -
 
Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
  |  1 -
 Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c                                  
            | 11 ----
 Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c                         
            | 53 ++++++++++++++------
 
Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
         | 10 ----
 Vlv2TbltDevicePkg/PlatformPkg.dec                                              
            |  1 -
 9 files changed, 40 insertions(+), 41 deletions(-)

diff --git a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf 
b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
index 24fa913..82fdde0 100644
--- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
+++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.inf
@@ -70,7 +70,6 @@ [Protocols]
   gEnhancedSpeedstepProtocolGuid
   gEfiPlatformCpuProtocolGuid
   gEfiAcpiSupportProtocolGuid
-  gEfiAcpiS3SaveProtocolGuid
   gEfiCpuIoProtocolGuid
   gEfiPs2PolicyProtocolGuid
   gEfiFirmwareVolume2ProtocolGuid
diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/PlatformBdsLib.inf 
b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/PlatformBdsLib.inf
index 45578e8..363978c 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/PlatformBdsLib.inf
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/PlatformBdsLib.inf
@@ -82,7 +82,6 @@ [Protocols]
   gEfiDxeSmmReadyToLockProtocolGuid
   gEfiUserManagerProtocolGuid
   gEfiDeferredImageLoadProtocolGuid
-  gEfiAcpiS3SaveProtocolGuid
   gEfiSpiProtocolGuid                           ## PROTOCOL CONSUMES
   gExitPmAuthProtocolGuid
   gEfiTdtOperationProtocolGuid
@@ -97,6 +96,7 @@ [Guids]
   gEfiGlobalVariableGuid
   gEfiNormalSetupGuid
   gEfiPartTypeSystemPartGuid
+  gEfiEndOfDxeEventGroupGuid
 
 [Pcd]
   gPlatformModuleTokenSpaceGuid.PcdFlashFvRecovery2Base
diff --git 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
index 33ca298..e9240f4 100644
--- 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
+++ 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
@@ -120,7 +120,6 @@ [Protocols]
   gEfiLegacyBiosProtocolGuid                    ## SOMETIMES_CONSUMES
   gEfiCpuArchProtocolGuid                       ## CONSUMES
   gEfiDevicePathProtocolGuid                    ## CONSUMES
-  gEfiAcpiS3SaveProtocolGuid                    ## SOMETIMES_CONSUMES
   gEfiGraphicsOutputProtocolGuid                ## SOMETIMES_CONSUMES
   gEfiUgaDrawProtocolGuid |gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport ## 
SOMETIMES_CONSUMES
   gEfiOEMBadgingProtocolGuid                    ## SOMETIMES_CONSUMES
diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.h 
b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.h
index d757243..572c71d 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.h
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.h
@@ -38,7 +38,6 @@ Abstract:
 #include <Protocol/DxeSmmReadyToLock.h>
 #include <Protocol/UserManager.h>
 #include <Protocol/DeferredImageLoad.h>
-#include <Protocol/AcpiS3Save.h>
 #include <Protocol/ExitPmAuth.h>
 #include <Protocol/MmioDevice.h>
 #include <Protocol/I2cBusMcg.h>
diff --git 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
index c32579b..7201d8a 100644
--- 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
+++ 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
@@ -33,7 +33,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include <Protocol/SimpleNetwork.h>
 #include <Protocol/FirmwareVolume2.h>
 #include <Protocol/PciIo.h>
-#include <Protocol/AcpiS3Save.h>
 #include <Protocol/OEMBadging.h>
 #include <Protocol/GraphicsOutput.h>
 #include <Protocol/UgaDraw.h>
diff --git a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c 
b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
index c39c36d..05104fe 100644
--- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
+++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
@@ -49,7 +49,6 @@ Abstract:
 #include <Protocol/CpuIo.h>
 #include <Guid/BoardFeatures.h>
 #include <Protocol/AcpiSupport.h>
-#include <Protocol/AcpiS3Save.h>
 #include <Protocol/Ps2Policy.h>
 #include <Library/CpuIA32.h>
 #include <SetupMode.h>
@@ -642,7 +641,6 @@ OnReadyToBoot (
   EFI_STATUS                  Status;
   EFI_ACPI_TABLE_VERSION      TableVersion;
   EFI_ACPI_SUPPORT_PROTOCOL   *AcpiSupport;
-  EFI_ACPI_S3_SAVE_PROTOCOL   *AcpiS3Save;
   SYSTEM_CONFIGURATION        SetupVarBuffer;
   UINTN                       VariableSize;
   EFI_PLATFORM_CPU_INFO       *PlatformCpuInfoPtr = NULL;
@@ -726,15 +724,6 @@ OnReadyToBoot (
                           TableVersion
                           );
   ASSERT_EFI_ERROR (Status);
-
-  //
-  // S3 script save.
-  //
-  Status = gBS->LocateProtocol (&gEfiAcpiS3SaveProtocolGuid, NULL, (VOID **) 
&AcpiS3Save);
-  if (!EFI_ERROR (Status)) {
-    AcpiS3Save->S3Save (AcpiS3Save, NULL);
-  }
-
 }
 
 VOID
diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c 
b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
index 195d734..8652d4f 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -1,5 +1,7 @@
 /** @file
 
+  Copyright (c) 2015, Red Hat, Inc.<BR>
+  Copyright (c) 2015, Linaro Ltd.<BR>
   Copyright (c) 2004  - 2015, Intel Corporation. All rights reserved.<BR>
                                                                                
    
   This program and the accompanying materials are licensed and made available 
under
@@ -26,6 +28,7 @@ Abstract:
 #include "BdsPlatform.h"
 #include "SetupMode.h"
 #include <Guid/SetupVariable.h>
+#include <Guid/EventGroup.h>
 #include <Library/TcgPhysicalPresenceLib.h>
 #include <Library/TrEEPhysicalPresenceLib.h>
 #include <Protocol/I2cMasterMcg.h>
@@ -148,7 +151,6 @@ InstallReadyToLock (
   EFI_STATUS                Status;
   EFI_HANDLE                Handle;
   EFI_SMM_ACCESS2_PROTOCOL  *SmmAccess;
-  EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
 
   //
   // Install DxeSmmReadyToLock protocol prior to the processing of boot options
@@ -159,19 +161,6 @@ InstallReadyToLock (
                   (VOID **) &SmmAccess
                   );
   if (!EFI_ERROR (Status)) {
-
-    //
-    // Prepare S3 information, this MUST be done before DxeSmmReadyToLock
-    //
-    Status = gBS->LocateProtocol (
-                    &gEfiAcpiS3SaveProtocolGuid,
-                    NULL,
-                    (VOID **)&AcpiS3Save
-                    );
-    if (!EFI_ERROR (Status)) {
-      AcpiS3Save->S3Save (AcpiS3Save, NULL);
-    }
-
     Handle = NULL;
     Status = gBS->InstallProtocolInterface (
                     &Handle,
@@ -205,6 +194,25 @@ ShellImageCallback (
  DEBUG ((EFI_D_INFO, "BdsEntry ShellImageCallback \n"));
 }
 
+/**
+  Empty callback function executed when the EndOfDxe event group is signaled.
+
+  We only need this function because we'd like to signal EndOfDxe, and for that
+  we need to create an event, with a callback function.
+
+  @param[in] Event    Event whose notification function is being invoked.
+  @param[in] Context  The pointer to the notification function's context, which
+                      is implementation-dependent.
+**/
+VOID
+EFIAPI
+OnEndOfDxe (
+  IN EFI_EVENT Event,
+  IN VOID      *Context
+  )
+{
+}
+
 //
 // BDS Platform Functions
 //
@@ -224,6 +232,7 @@ PlatformBdsInit (
   )
 {
   EFI_STATUS  Status;
+  EFI_EVENT   EndOfDxeEvent;
   EFI_EVENT   ShellImageEvent;
   EFI_GUID    ShellEnvProtocol = SHELL_ENVIRONMENT_INTERFACE_PROTOCOL;
 
@@ -235,6 +244,22 @@ PlatformBdsInit (
   BdsLibSaveMemoryTypeInformation ();
 
   //
+  // Signal the EndOfDxe event group.
+  //
+  Status = gBS->CreateEventEx (
+                  EVT_NOTIFY_SIGNAL,
+                  TPL_CALLBACK,
+                  OnEndOfDxe,
+                  NULL, /* NotifyContext */
+                  &gEfiEndOfDxeEventGroupGuid,
+                  &EndOfDxeEvent
+                  );
+  if (!EFI_ERROR (Status)) {
+    gBS->SignalEvent (EndOfDxeEvent);
+    gBS->CloseEvent (EndOfDxeEvent);
+  }
+
+  //
   // Before user authentication, the user identification devices need be 
connected
   // from the platform customized device paths
   //
diff --git 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
index 6ada862..0d3e077 100644
--- 
a/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
+++ 
b/Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c
@@ -2235,7 +2235,6 @@ BdsLibBootViaBootOption (
   EFI_DEVICE_PATH_PROTOCOL  *FilePath;
   EFI_LOADED_IMAGE_PROTOCOL *ImageInfo;
   EFI_DEVICE_PATH_PROTOCOL  *WorkingDevicePath;
-  EFI_ACPI_S3_SAVE_PROTOCOL *AcpiS3Save;
   LIST_ENTRY                TempBootLists;
   EFI_BOOT_LOGO_PROTOCOL    *BootLogo;
 
@@ -2243,15 +2242,6 @@ BdsLibBootViaBootOption (
   *ExitData     = NULL;
 
   //
-  // Notes: this code can be remove after the s3 script table
-  // hook on the event EVT_SIGNAL_READY_TO_BOOT or
-  // EVT_SIGNAL_LEGACY_BOOT
-  //
-  Status = gBS->LocateProtocol (&gEfiAcpiS3SaveProtocolGuid, NULL, (VOID **) 
&AcpiS3Save);
-  if (!EFI_ERROR (Status)) {
-    AcpiS3Save->S3Save (AcpiS3Save, NULL);
-  }
-  //
   // If it's Device Path that starts with a hard drive path, append it with 
the front part to compose a
   // full device path
   //
diff --git a/Vlv2TbltDevicePkg/PlatformPkg.dec 
b/Vlv2TbltDevicePkg/PlatformPkg.dec
index 378cb53..b220239 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.dec
+++ b/Vlv2TbltDevicePkg/PlatformPkg.dec
@@ -84,7 +84,6 @@ [Protocols]
   gEfiPciPlatformProtocolGuid             = { 0x07d75280, 0x27d4, 0x4d69, { 
0x90, 0xd0, 0x56, 0x43, 0xe2, 0x38, 0xb3, 0x41 } }
   gEnhancedSpeedstepProtocolGuid          = { 0x91a1ddcf, 0x5374, 0x4939, { 
0x89, 0x51, 0xd7, 0x29, 0x3f, 0x1a, 0x78, 0x6f } }
   gEfiAcpiSupportProtocolGuid             = { 0xdbff9d55, 0x89b7, 0x46da, { 
0xbd, 0xdf, 0x67, 0x7d, 0x3d, 0xc0, 0x24, 0x1d } }
-  gEfiAcpiS3SaveProtocolGuid              = { 0x125f2de1, 0xfb85, 0x440c, { 
0xa5, 0x4c, 0x4d, 0x99, 0x35, 0x8a, 0x8d, 0x38 } }
   gEfiCpuIoProtocolGuid                   = { 0xB0732526, 0x38C8, 0x4b40, { 
0x88, 0x77, 0x61, 0xC7, 0xB0, 0x6A, 0xAC, 0x45 } }
   gPlatformGOPPolicyGuid                  = { 0xec2e931b, 0x3281, 0x48a5, { 
0x81, 0x07, 0xdf, 0x8a, 0x8b, 0xed, 0x3c, 0x5d } }
   gEfiGopDisplayBrightnessProtocolGuid    = { 0x6ff23f1d, 0x877c, 0x4b1b, { 
0x93, 0xfc, 0xf1, 0x42, 0xb2, 0xee, 0xa6, 0xa7 } }
-- 
1.8.3.1



------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to