MdePkg: Add deprecated warning to BaseRngLibTimer

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.gondois@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Kun Qin <kun.qin@microsoft.com>
This commit is contained in:
Pierre Gondois 2023-08-11 16:33:03 +02:00 committed by mergify[bot]
parent 2f981bddcb
commit e93468442b
2 changed files with 23 additions and 0 deletions

View File

@ -23,6 +23,7 @@
MODULE_TYPE = BASE MODULE_TYPE = BASE
VERSION_STRING = 1.0 VERSION_STRING = 1.0
LIBRARY_CLASS = RngLib LIBRARY_CLASS = RngLib
CONSTRUCTOR = BaseRngLibTimerConstructor
[Sources] [Sources]
RngLibTimer.c RngLibTimer.c

View File

@ -13,6 +13,28 @@
#define DEFAULT_DELAY_TIME_IN_MICROSECONDS 10 #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 Using the TimerLib GetPerformanceCounterProperties() we delay
for enough time for the PerformanceCounter to increment. for enough time for the PerformanceCounter to increment.