]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
Remove IntelFrameworkModulePkg
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / Acpi / AcpiS3SaveDxe / AcpiS3Save.c
diff --git a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
deleted file mode 100644 (file)
index 366ada9..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/** @file\r
-  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) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
-\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include <PiDxe.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Protocol/AcpiS3Save.h>\r
-\r
-#include "AcpiS3Save.h"\r
-\r
-/**\r
-  Hook point for AcpiVariableThunkPlatform for InstallAcpiS3Save.\r
-**/\r
-VOID\r
-InstallAcpiS3SaveThunk (\r
-  VOID\r
-  );\r
-\r
-/**\r
-  Hook point for AcpiVariableThunkPlatform for S3Ready.\r
-\r
-**/\r
-VOID\r
-S3ReadyThunkPlatform (\r
-  VOID\r
-  );\r
-\r
-UINTN     mLegacyRegionSize;\r
-\r
-EFI_ACPI_S3_SAVE_PROTOCOL mS3Save = {\r
-  LegacyGetS3MemorySize,\r
-  S3Ready,\r
-};\r
-\r
-/**\r
-  Allocate memory below 4G memory address.\r
-\r
-  This function allocates memory below 4G memory address.\r
-\r
-  @param  MemoryType   Memory type of memory to allocate.\r
-  @param  Size         Size of memory to allocate.\r
-\r
-  @return Allocated address for output.\r
-\r
-**/\r
-VOID*\r
-AllocateMemoryBelow4G (\r
-  IN EFI_MEMORY_TYPE    MemoryType,\r
-  IN UINTN              Size\r
-  )\r
-{\r
-  UINTN                 Pages;\r
-  EFI_PHYSICAL_ADDRESS  Address;\r
-  EFI_STATUS            Status;\r
-  VOID*                 Buffer;\r
-\r
-  Pages = EFI_SIZE_TO_PAGES (Size);\r
-  Address = 0xffffffff;\r
-\r
-  Status  = gBS->AllocatePages (\r
-                   AllocateMaxAddress,\r
-                   MemoryType,\r
-                   Pages,\r
-                   &Address\r
-                   );\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  Buffer = (VOID *) (UINTN) Address;\r
-  ZeroMem (Buffer, Size);\r
-\r
-  return Buffer;\r
-}\r
-\r
-/**\r
-  Gets the buffer of legacy memory below 1 MB\r
-  This function is to get the buffer in legacy memory below 1MB that is required during S3 resume.\r
-\r
-  @param This           A pointer to the EFI_ACPI_S3_SAVE_PROTOCOL instance.\r
-  @param Size           The returned size of legacy memory below 1 MB.\r
-\r
-  @retval EFI_SUCCESS           Size is successfully returned.\r
-  @retval EFI_INVALID_PARAMETER The pointer Size is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LegacyGetS3MemorySize (\r
-  IN  EFI_ACPI_S3_SAVE_PROTOCOL   *This,\r
-  OUT UINTN                       *Size\r
-  )\r
-{\r
-  if (Size == NULL) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  *Size = mLegacyRegionSize;\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Prepares all information that is needed in the S3 resume boot path.\r
-\r
-  Allocate the resources or prepare informations and save in ACPI variable set for S3 resume boot path\r
-\r
-  @param This                 A pointer to the EFI_ACPI_S3_SAVE_PROTOCOL instance.\r
-  @param LegacyMemoryAddress  The base address of legacy memory.\r
-\r
-  @retval EFI_NOT_FOUND         Some necessary information cannot be found.\r
-  @retval EFI_SUCCESS           All information was saved successfully.\r
-  @retval EFI_OUT_OF_RESOURCES  Resources were insufficient to save all the information.\r
-  @retval EFI_INVALID_PARAMETER The memory range is not located below 1 MB.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-S3Ready (\r
-  IN EFI_ACPI_S3_SAVE_PROTOCOL    *This,\r
-  IN VOID                         *LegacyMemoryAddress\r
-  )\r
-{\r
-  STATIC BOOLEAN                  AlreadyEntered;\r
-\r
-  DEBUG ((EFI_D_INFO, "S3Ready!\n"));\r
-\r
-  //\r
-  // Platform may invoke AcpiS3Save->S3Save() before ExitPmAuth, because we need save S3 information there, while BDS ReadyToBoot may invoke it again.\r
-  // So if 2nd S3Save() is triggered later, we need ignore it.\r
-  //\r
-  if (AlreadyEntered) {\r
-    return EFI_SUCCESS;\r
-  }\r
-  AlreadyEntered = TRUE;\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  The Driver Entry Point.\r
-\r
-  The function is the driver Entry point which will produce AcpiS3SaveProtocol.\r
-\r
-  @param ImageHandle   A handle for the image that is initializing this driver\r
-  @param SystemTable   A pointer to the EFI system table\r
-\r
-  @retval EFI_SUCCESS               Driver initialized successfully\r
-  @retval EFI_UNSUPPORTED           Do not support ACPI S3\r
-  @retval EFI_OUT_OF_RESOURCES      Could not allocate needed resources\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-InstallAcpiS3Save (\r
-  IN EFI_HANDLE           ImageHandle,\r
-  IN EFI_SYSTEM_TABLE     *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS        Status;\r
-\r
-  if (!PcdGetBool (PcdAcpiS3Enable)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  if (!FeaturePcdGet(PcdPlatformCsmSupport)) {\r
-    //\r
-    // More memory for no CSM tip, because GDT need relocation\r
-    //\r
-    mLegacyRegionSize = 0x250;\r
-  } else {\r
-    mLegacyRegionSize = 0x100;\r
-  }\r
-\r
-  Status = gBS->InstallProtocolInterface (\r
-                  &ImageHandle,\r
-                  &gEfiAcpiS3SaveProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &mS3Save\r
-                  );\r
-  ASSERT_EFI_ERROR (Status);\r
-  return Status;\r
-}\r