]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: AcpiS3SaveDxe: prepare for End-of-Dxe callback
authorLaszlo Ersek <lersek@redhat.com>
Sun, 26 Jul 2015 08:02:02 +0000 (08:02 +0000)
committerjljusten <jljusten@Edk2>
Sun, 26 Jul 2015 08:02:02 +0000 (08:02 +0000)
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 this specific implementation of
  EFI_ACPI_S3_SAVE_PROTOCOL.S3Save() in the edk2 tree pass a NULL
  LegacyMemoryAddress:

  BdsLibBootViaBootOption()
  [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.

This patch ports the identical change from IntelFrameworkModulePkg to
OvmfPkg.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18033 6f19259b-4bc3-4df7-8a09-765794883524

OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c

index f322981b536522ede3519b916d8e0b0e7ecdafc9..f05764af8bcb219911ed55f036c6142f8ad33392 100644 (file)
@@ -2,6 +2,7 @@
   This is an implementation of the ACPI S3 Save protocol.  This is defined in\r
   S3 boot path specification 0.9.\r
 \r
+Copyright (c) 2014-2015, Red Hat, Inc.<BR>\r
 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
@@ -402,6 +403,8 @@ LegacyGetS3MemorySize (
   OUT UINTN                       *Size\r
   )\r
 {\r
+  ASSERT (FALSE);\r
+\r
   if (Size == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -491,6 +494,8 @@ S3Ready (
   }\r
   AlreadyEntered = TRUE;\r
 \r
+  ASSERT (LegacyMemoryAddress == NULL);\r
+\r
   AcpiS3Context = AllocateMemoryBelow4G (EfiReservedMemoryType, sizeof(*AcpiS3Context));\r
   ASSERT (AcpiS3Context != NULL);\r
   AcpiS3ContextBuffer = (EFI_PHYSICAL_ADDRESS)(UINTN)AcpiS3Context;\r