We are preparing for detaching the S3Ready() functionality from the
EFI_ACPI_S3_SAVE_PROTOCOL.S3Save() protocol member function. Instead, we
will hook the same logic to the End-of-Dxe event group.

The EFI_ACPI_S3_SAVE_PROTOCOL has another member: GetLegacyMemorySize().
According to the documenation,

  This function returns the size of the legacy memory (meaning below 1 MB)
  that is required during an S3 resume. Before the Framework-based
  firmware transfers control to the OS, it has to transition from flat
  mode into real mode in case the OS supplies only a real-mode waking
  vector. This transition requires a certain amount of legacy memory.
  After getting the size of legacy memory below, the caller is responsible
  for allocating the legacy memory below 1 MB according to the size that
  is returned. The specific implementation of allocating the legacy memory
  is out of the scope of this specification.

When EFI_ACPI_S3_SAVE_PROTOCOL.S3Save() is called, the address of the
legacy memory allocated above must be passed to it, in the
LegacyMemoryAddress parameter.

In practice however:

- The S3Ready() function ignores the LegacyMemoryAddress completely.

- No code in the edk2 tree calls
  EFI_ACPI_S3_SAVE_PROTOCOL.GetLegacyMemorySize(), ever.

- All callers of EFI_ACPI_S3_SAVE_PROTOCOL.S3Save() in the edk2 tree pass
  a NULL LegacyMemoryAddress:

  BdsLibBootViaBootOption()
  [IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c]

  OnReadyToBoot()
  [Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c]

  InstallReadyToLock()
  [Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c]

  BdsLibBootViaBootOption()
  
[Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsBoot.c]

For this reason, ASSERT() explicitly that LegacyGetS3MemorySize() is never
called, and that the LegacyMemoryAddress parameter is always NULL.

This fact is important to capture in the code, because in the End-of-Dxe
callback, no LegacyMemoryAddress parameter can be taken. So let's make it
clear that we actually don't even have any use for that parameter.

Cc: Yao Jiewen <jiewen....@intel.com>
Cc: Jeff Fan <jeff....@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>
---
 IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c 
b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
index 6de1871..ac3e947 100644
--- a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
+++ b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
@@ -2,6 +2,7 @@
   This is an implementation of the ACPI S3 Save protocol.  This is defined in
   S3 boot path specification 0.9.
 
+Copyright (c) 2015, Red Hat, Inc.<BR>
 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
@@ -422,6 +423,8 @@ LegacyGetS3MemorySize (
   OUT UINTN                       *Size
   )
 {
+  ASSERT (FALSE);
+
   if (Size == NULL) {
     return EFI_INVALID_PARAMETER;
   }
@@ -469,6 +472,8 @@ S3Ready (
   }
   AlreadyEntered = TRUE;
 
+  ASSERT (LegacyMemoryAddress == NULL);
+
   AcpiS3Context = AllocateMemoryBelow4G (EfiReservedMemoryType, 
sizeof(*AcpiS3Context));
   ASSERT (AcpiS3Context != NULL);
   AcpiS3ContextBuffer = (EFI_PHYSICAL_ADDRESS)(UINTN)AcpiS3Context;
-- 
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