]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c
Add IntelFsp2Pkg and IntelFsp2WrapperPkg.
[mirror_edk2.git] / IntelFsp2WrapperPkg / Library / SecFspWrapperPlatformSecLibSample / SecTempRamDone.c
diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c
new file mode 100644 (file)
index 0000000..76d2f42
--- /dev/null
@@ -0,0 +1,52 @@
+/** @file\r
+  Sample to provide SecTemporaryRamDone function.\r
+\r
+  Copyright (c) 2014 - 2016, 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 <PiPei.h>\r
+\r
+#include <Ppi/TemporaryRamDone.h>\r
+\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/DebugAgentLib.h>\r
+#include <Library/FspPlatformInfoLib.h>\r
+#include <Library/FspApiLib.h>\r
+\r
+/**\r
+This interface disables temporary memory in SEC Phase.\r
+**/\r
+VOID\r
+EFIAPI\r
+SecPlatformDisableTemporaryMemory (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  VOID                      *TempRamExitParam;\r
+  FSP_INFO_HEADER           *FspHeader;\r
+\r
+  FspHeader = FspFindFspHeader (PcdGet32(PcdFspmBaseAddress));\r
+  if (FspHeader == NULL) {\r
+    return ;\r
+  }\r
+\r
+  DEBUG((DEBUG_INFO, "SecPlatformDisableTemporaryMemory enter\n"));\r
+\r
+  TempRamExitParam = GetTempRamExitParam ();\r
+  Status = CallTempRamExit (FspHeader, TempRamExitParam);\r
+  DEBUG((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status));\r
+  ASSERT_EFI_ERROR(Status);\r
+\r
+  return ;\r
+}\r