diff mbox

[edk2,11/12] OvmfPkg: VirtioLib: add constructor

Message ID 1409698598-9766-11-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/VirtioLib/VirtioLib.inf |  2 ++
 OvmfPkg/Library/VirtioLib/VirtioLib.c   | 11 +++++++++++
 2 files changed, 13 insertions(+)
diff mbox

Patch

diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.inf b/OvmfPkg/Library/VirtioLib/VirtioLib.inf
index fb5897a..10a9d6c 100644
--- a/OvmfPkg/Library/VirtioLib/VirtioLib.inf
+++ b/OvmfPkg/Library/VirtioLib/VirtioLib.inf
@@ -21,6 +21,8 @@ 
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = VirtioLib
 
+  CONSTRUCTOR                    = VirtioLibConstructor
+
 [Sources]
   VirtioLib.c
 
diff --git a/OvmfPkg/Library/VirtioLib/VirtioLib.c b/OvmfPkg/Library/VirtioLib/VirtioLib.c
index 54cf225..e471633 100644
--- a/OvmfPkg/Library/VirtioLib/VirtioLib.c
+++ b/OvmfPkg/Library/VirtioLib/VirtioLib.c
@@ -317,3 +317,14 @@  VirtioFlush (
   MemoryFence();
   return EFI_SUCCESS;
 }
+
+
+EFI_STATUS
+EFIAPI
+VirtioLibConstructor (
+  IN EFI_HANDLE       ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  return EFI_SUCCESS;
+}