]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseS3StallLib/S3StallLib.c
MdePkg: Add S3 library interfaces and base implementations
[mirror_edk2.git] / MdePkg / Library / BaseS3StallLib / S3StallLib.c
diff --git a/MdePkg/Library/BaseS3StallLib/S3StallLib.c b/MdePkg/Library/BaseS3StallLib/S3StallLib.c
new file mode 100644 (file)
index 0000000..e5ebc87
--- /dev/null
@@ -0,0 +1,52 @@
+/** @file\r
+  Stall Services that do stall and also enable the Stall operatation\r
+  to be replayed during an S3 resume. This library class maps directly on top\r
+  of the Timer class. \r
+\r
+  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions\r
+  of the BSD License which accompanies this distribution.  The\r
+  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 <Base.h>\r
+\r
+#include <Library/TimerLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/S3BootScriptLib.h>\r
+#include <Library/S3StallLib.h>\r
+\r
+\r
+/**\r
+  Stalls the CPU for at least the given number of microseconds and and saves\r
+  the value in the S3 script to be replayed on S3 resume.\r
+\r
+  Stalls the CPU for the number of microseconds specified by MicroSeconds.\r
+\r
+  @param  MicroSeconds  The minimum number of microseconds to delay.\r
+\r
+  @return MicroSeconds\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+S3Stall (\r
+  IN UINTN                     MicroSeconds\r
+  )\r
+{\r
+  RETURN_STATUS    Status;\r
+  \r
+  Status = S3BootScriptSaveStall (MicroSecondDelay (MicroSeconds));\r
+  ASSERT (Status == RETURN_SUCCESS);\r
+  \r
+  return MicroSeconds;\r
+}\r
+\r
+\r