diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/edk2/MdePkg/Library/BaseS3StallLib | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/edk2/MdePkg/Library/BaseS3StallLib')
3 files changed, 101 insertions, 0 deletions
diff --git a/roms/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf b/roms/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf new file mode 100644 index 000000000..ae0350921 --- /dev/null +++ b/roms/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.inf @@ -0,0 +1,39 @@ +## @file
+# Instance of S3 Stall Library based on Timer and S3 BootScript Library.
+#
+# Stall Services that do stall and also enable the Stall operatation
+# to be replayed during an S3 resume.
+#
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = BaseS3StallLib
+ MODULE_UNI_FILE = BaseS3StallLib.uni
+ FILE_GUID = 498C6AC3-CC29-4821-BE6F-7C6F4ECF2C14
+ MODULE_TYPE = BASE
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = S3StallLib
+
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 EBC
+#
+
+[Sources]
+ S3StallLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ DebugLib
+ TimerLib
+ S3BootScriptLib
+
diff --git a/roms/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni b/roms/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni new file mode 100644 index 000000000..40ee09f10 --- /dev/null +++ b/roms/edk2/MdePkg/Library/BaseS3StallLib/BaseS3StallLib.uni @@ -0,0 +1,17 @@ +// /** @file
+// Instance of S3 Stall Library based on Timer and S3 BootScript Library.
+//
+// Stall Services that do stall and also enable the Stall operatation
+// to be replayed during an S3 resume.
+//
+// Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Instance of S3 Stall Library based on Timer and S3 BootScript Library"
+
+#string STR_MODULE_DESCRIPTION #language en-US "Stall Services that do stall and also enable the Stall operation to be replayed during an S3 resume."
+
diff --git a/roms/edk2/MdePkg/Library/BaseS3StallLib/S3StallLib.c b/roms/edk2/MdePkg/Library/BaseS3StallLib/S3StallLib.c new file mode 100644 index 000000000..f1f338844 --- /dev/null +++ b/roms/edk2/MdePkg/Library/BaseS3StallLib/S3StallLib.c @@ -0,0 +1,45 @@ +/** @file
+ Stall Services that do stall and also enable the Stall operatation
+ to be replayed during an S3 resume. This library class maps directly on top
+ of the Timer class.
+
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Base.h>
+
+#include <Library/TimerLib.h>
+#include <Library/DebugLib.h>
+#include <Library/S3BootScriptLib.h>
+#include <Library/S3StallLib.h>
+
+
+/**
+ Stalls the CPU for at least the given number of microseconds and and saves
+ the value in the S3 script to be replayed on S3 resume.
+
+ Stalls the CPU for the number of microseconds specified by MicroSeconds.
+
+ @param MicroSeconds The minimum number of microseconds to delay.
+
+ @return MicroSeconds
+
+**/
+UINTN
+EFIAPI
+S3Stall (
+ IN UINTN MicroSeconds
+ )
+{
+ RETURN_STATUS Status;
+
+ Status = S3BootScriptSaveStall (MicroSecondDelay (MicroSeconds));
+ ASSERT (Status == RETURN_SUCCESS);
+
+ return MicroSeconds;
+}
+
+
|