From: Pierre Gondois <pierre.gond...@arm.com>

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4504

To keep the MdePkg self-contained and avoid dependencies on GUIDs
defined in other packages, the BaseRngLibTimer was moved to the
MdePkg.
Add a constructor to warn and request to use the MdeModulePkg
implementation.

Signed-off-by: Pierre Gondois <pierre.gond...@arm.com>
---
 .../BaseRngLibTimerLib/BaseRngLibTimerLib.inf |  1 +
 .../Library/BaseRngLibTimerLib/RngLibTimer.c  | 22 +++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf 
b/MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
index f857290e823b..96c90db63f6f 100644
--- a/MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
+++ b/MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.inf
@@ -23,6 +23,7 @@ [Defines]
   MODULE_TYPE                    = BASE
   VERSION_STRING                 = 1.0
   LIBRARY_CLASS                  = RngLib
+  CONSTRUCTOR                    = BaseRngLibTimerConstructor
 
 [Sources]
   RngLibTimer.c
diff --git a/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c 
b/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
index 980854d67b72..c4fdd1df68d3 100644
--- a/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
+++ b/MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c
@@ -13,6 +13,28 @@
 
 #define DEFAULT_DELAY_TIME_IN_MICROSECONDS  10
 
+/**
+  This implementation is to be replaced by its MdeModulePkg copy.
+  The cause being that some GUIDs (gEdkiiRngAlgorithmUnSafe) cannot
+  be defined in the MdePkg.
+
+  @retval EFI_SUCCESS   The constructor always returns EFI_SUCCESS.
+**/
+RETURN_STATUS
+EFIAPI
+BaseRngLibTimerConstructor (
+  VOID
+  )
+{
+  DEBUG ((
+    DEBUG_WARN,
+    "Warning: This BaseRngTimerLib implementation will be deprecated. "
+    "Please use the MdeModulePkg implementation equivalent.\n"
+    ));
+
+  return RETURN_SUCCESS;
+}
+
 /**
  Using the TimerLib GetPerformanceCounterProperties() we delay
  for enough time for the PerformanceCounter to increment.
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107009): https://edk2.groups.io/g/devel/message/107009
Mute This Topic: https://groups.io/mt/100213729/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to