diff mbox

[edk2,12/12] OvmfPkg: VirtioMmioDeviceLib: add constructor

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

Patch

diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
index 2e266a9..600ba63 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDeviceLib.inf
@@ -22,6 +22,8 @@ 
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = VirtioMmioDeviceLib
 
+  CONSTRUCTOR                    = VirtioMmioDeviceLibConstructor
+
 [Sources]
   VirtioMmioDevice.c
   VirtioMmioDeviceFunctions.c
diff --git a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
index 4af9dd0..f36ba81 100644
--- a/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
+++ b/OvmfPkg/Library/VirtioMmioDeviceLib/VirtioMmioDevice.c
@@ -222,3 +222,14 @@  VirtioMmioUninstallDevice (
 
   return EFI_SUCCESS;
 }
+
+
+EFI_STATUS
+EFIAPI
+VirtioMmioDeviceLibConstructor (
+  IN EFI_HANDLE       ImageHandle,
+  IN EFI_SYSTEM_TABLE *SystemTable
+  )
+{
+  return EFI_SUCCESS;
+}