diff mbox

[edk2,09/12] OvmfPkg: ResetSystemLib: add constructor

Message ID 1409698598-9766-9-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek Sept. 2, 2014, 10:56 p.m. UTC
Calls to constructors of interdependent library instances are generated in
the correct order only if all library instances in question have
constructors. If some have no constructors, then the rest may see their
constructors called out of order.

Cycle detection also only works when all library instances have
constructors.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf |  4 +++-
 OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c   | 10 ++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
index b6a3ffe..ab5838e 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.inf
@@ -20,6 +20,8 @@ 
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = ResetSystemLib
 
+  CONSTRUCTOR                    = ResetSystemLibConstructor
+
 #
 # The following information is for reference only and not required by the build tools.
 #
@@ -39,4 +41,4 @@ 
   TimerLib
 
 [Pcd]
-  gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress
\ No newline at end of file
+  gUefiOvmfPkgTokenSpaceGuid.PcdAcpiPmBaseAddress
diff --git a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
index 6d149e8..2d177f7 100644
--- a/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/OvmfPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -106,3 +106,13 @@  EnterS3WithImmediateWake (
   AcpiPmControl (1);
   ASSERT (FALSE);
 }
+
+
+RETURN_STATUS
+EFIAPI
+ResetSystemLibConstructor (
+  VOID
+  )
+{
+  return RETURN_SUCCESS;
+}