]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.c
EdkCompatibilityPkg: Remove EdkCompatibilityPkg
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / SmmAccess2OnSmmAccessThunk / SmmAccess2OnSmmAccessThunk.c
diff --git a/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.c b/EdkCompatibilityPkg/Compatibility/SmmAccess2OnSmmAccessThunk/SmmAccess2OnSmmAccessThunk.c
deleted file mode 100644 (file)
index 0275bd7..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/** @file\r
-  SMM Access2 Protocol on SMM Access Protocol Thunk driver.\r
-\r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "SmmAccess2OnSmmAccessThunk.h"\r
-\r
-EFI_SMM_ACCESS2_PROTOCOL gSmmAccess2 = {\r
-  SmmAccess2Open,\r
-  SmmAccess2Close,\r
-  SmmAccess2Lock,\r
-  SmmAccess2GetCapabilities,\r
-  FALSE,\r
-  FALSE\r
-};\r
-\r
-EFI_SMM_ACCESS_PROTOCOL  *mSmmAccess;\r
-UINTN                     mSmramRegionNumber;\r
-\r
-/**\r
-  Opens the SMRAM area to be accessible by a boot-service driver.\r
-\r
-  This function "opens" SMRAM so that it is visible while not inside of SMM. The function should \r
-  return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM. The function \r
-  should return EFI_DEVICE_ERROR if the SMRAM configuration is locked.\r
-\r
-  @param[in] This           The EFI_SMM_ACCESS2_PROTOCOL instance.\r
-\r
-  @retval EFI_SUCCESS       The operation was successful.\r
-  @retval EFI_UNSUPPORTED   The system does not support opening and closing of SMRAM.\r
-  @retval EFI_DEVICE_ERROR  SMRAM cannot be opened, perhaps because it is locked.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmmAccess2Open (\r
-  IN EFI_SMM_ACCESS2_PROTOCOL  *This\r
-  )\r
-{\r
-  EFI_STATUS Status;\r
-  UINTN      DescriptorIndex;\r
-\r
-  ///\r
-  /// Open all SMRAM regions via SMM Access Protocol\r
-  ///\r
-\r
-  Status = EFI_SUCCESS;\r
-  for (DescriptorIndex = 0; DescriptorIndex < mSmramRegionNumber && !EFI_ERROR (Status); DescriptorIndex++) {\r
-    Status = mSmmAccess->Open (mSmmAccess, DescriptorIndex);\r
-  }\r
-  if (!EFI_ERROR (Status)) {\r
-    gSmmAccess2.OpenState = TRUE;\r
-  }\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Inhibits access to the SMRAM.\r
-\r
-  This function "closes" SMRAM so that it is not visible while outside of SMM. The function should \r
-  return EFI_UNSUPPORTED if the hardware does not support hiding of SMRAM.\r
-\r
-  @param [in] This           The EFI_SMM_ACCESS2_PROTOCOL instance.\r
-\r
-  @retval EFI_SUCCESS       The operation was successful.\r
-  @retval EFI_UNSUPPORTED   The system does not support opening and closing of SMRAM.\r
-  @retval EFI_DEVICE_ERROR  SMRAM cannot be closed.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmmAccess2Close (\r
-  IN EFI_SMM_ACCESS2_PROTOCOL  *This\r
-  )\r
-{\r
-  EFI_STATUS Status;\r
-  UINTN      DescriptorIndex;\r
-\r
-  ///\r
-  /// Close all SMRAM regions via SMM Access Protocol\r
-  ///\r
-\r
-  Status = EFI_SUCCESS;\r
-  for (DescriptorIndex = 0; DescriptorIndex < mSmramRegionNumber && !EFI_ERROR (Status); DescriptorIndex++) {\r
-    Status = mSmmAccess->Close (mSmmAccess, DescriptorIndex);\r
-  }\r
-  if (!EFI_ERROR (Status)) {\r
-    gSmmAccess2.OpenState = FALSE;\r
-  }\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Inhibits access to the SMRAM.\r
-\r
-  This function prohibits access to the SMRAM region.  This function is usually implemented such \r
-  that it is a write-once operation. \r
-\r
-  @param[in] This          The EFI_SMM_ACCESS2_PROTOCOL instance.\r
-\r
-  @retval EFI_SUCCESS      The device was successfully locked.\r
-  @retval EFI_UNSUPPORTED  The system does not support locking of SMRAM.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmmAccess2Lock (\r
-  IN EFI_SMM_ACCESS2_PROTOCOL  *This\r
-  )\r
-{\r
-  EFI_STATUS Status;\r
-  UINTN      DescriptorIndex;\r
-\r
-  ///\r
-  /// Lock all SMRAM regions via SMM Access Protocol\r
-  ///\r
-\r
-  Status = EFI_SUCCESS;\r
-  for (DescriptorIndex = 0; DescriptorIndex < mSmramRegionNumber && !EFI_ERROR (Status); DescriptorIndex++) {\r
-    Status = mSmmAccess->Lock (mSmmAccess, DescriptorIndex);\r
-  }\r
-  if (!EFI_ERROR (Status)) {\r
-    gSmmAccess2.LockState = TRUE;\r
-  }\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Queries the memory controller for the possible regions that will support SMRAM.\r
-\r
-  @param[in]     This           The EFI_SMM_ACCESS2_PROTOCOL instance.\r
-  @param[in, out] SmramMapSize   A pointer to the size, in bytes, of the SmramMemoryMap buffer.\r
-  @param[in, out] SmramMap       A pointer to the buffer in which firmware places the current memory map.\r
-\r
-  @retval EFI_SUCCESS           The chipset supported the given resource.\r
-  @retval EFI_BUFFER_TOO_SMALL  The SmramMap parameter was too small.  The current buffer size \r
-                                needed to hold the memory map is returned in SmramMapSize.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmmAccess2GetCapabilities (\r
-  IN CONST EFI_SMM_ACCESS2_PROTOCOL  *This,\r
-  IN OUT UINTN                       *SmramMapSize,\r
-  IN OUT EFI_SMRAM_DESCRIPTOR        *SmramMap\r
-  )\r
-{\r
-  return mSmmAccess->GetCapabilities (mSmmAccess, SmramMapSize, SmramMap);\r
-}\r
-\r
-/**\r
-  Entry Point for SMM Access2 On SMM Access Thunk driver.\r
-\r
-  @param[in] ImageHandle  Image handle of this driver.\r
-  @param[in] SystemTable  A Pointer to the EFI System Table.\r
-\r
-  @retval EFI_SUCCESS  The entry point is executed successfully.\r
-  @retval other        Some error occurred when executing this entry point.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-SmmAccess2ThunkMain (\r
-  IN EFI_HANDLE        ImageHandle,\r
-  IN EFI_SYSTEM_TABLE  *SystemTable\r
-  )\r
-{\r
-  EFI_STATUS            Status;\r
-  UINTN                 SmramMapSize;\r
-\r
-  ///\r
-  /// Locate SMM Access Protocol\r
-  ///\r
-  Status = gBS->LocateProtocol (&gEfiSmmAccessProtocolGuid, NULL, (VOID **)&mSmmAccess);\r
-  ASSERT_EFI_ERROR (Status);\r
-\r
-  ///\r
-  /// Calculate number of SMRAM regions\r
-  ///\r
-  SmramMapSize = 0;\r
-  Status = mSmmAccess->GetCapabilities (mSmmAccess, &SmramMapSize, NULL);\r
-  ASSERT (Status == EFI_BUFFER_TOO_SMALL);\r
-\r
-  mSmramRegionNumber =  SmramMapSize/sizeof (EFI_SMRAM_DESCRIPTOR);\r
-  ASSERT (mSmramRegionNumber > 0);\r
-\r
-  ///\r
-  /// Assume all SMRAM regions have consistent OPEN and LOCK states\r
-  ///\r
-  gSmmAccess2.OpenState = mSmmAccess->OpenState;\r
-  gSmmAccess2.LockState = mSmmAccess->LockState;\r
-\r
-  ///\r
-  /// Publish PI SMM Access2 Protocol\r
-  ///\r
-  Status = gBS->InstallProtocolInterface (\r
-                  &ImageHandle,\r
-                  &gEfiSmmAccess2ProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &gSmmAccess2\r
-                  );\r
-  return Status;\r
-}\r
-\r