ArmPkg/ArmArchTimerLib: Drop pointless constructor

Drop the pointless constructor in ArmArchTimerLib, which does nothing
useful, especially because AArch64 mandates the presence of the generic
timer, and 32-bit ARM is mostly obsolete these days.

To preserve the existing behavior in DEBUG builds when actually using
the timer, move the ASSERT () on a non-zero frequency to the associated
accessor helper function.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
This commit is contained in:
Ard Biesheuvel 2024-07-30 19:52:21 +02:00 committed by mergify[bot]
parent e76b248d8f
commit 12dc8d420b
2 changed files with 2 additions and 25 deletions

View File

@ -24,30 +24,6 @@
#define MULT_U64_X_N MultU64x64
#endif
RETURN_STATUS
EFIAPI
TimerConstructor (
VOID
)
{
//
// Check if the ARM Generic Timer Extension is implemented.
//
if (ArmIsArchTimerImplemented ()) {
//
// Architectural Timer Frequency must be set in Secure privileged
// mode (if secure extension is supported).
// If the reset value (0) is returned, just ASSERT.
//
ASSERT (ArmGenericTimerGetTimerFreq () != 0);
} else {
DEBUG ((DEBUG_ERROR, "ARM Architectural Timer is not available in the CPU, hence this library cannot be used.\n"));
ASSERT (0);
}
return RETURN_SUCCESS;
}
/**
A local utility function that returns the PCD value, if specified.
Otherwise it defaults to ArmGenericTimerGetTimerFreq.
@ -65,6 +41,8 @@ GetPlatformTimerFreq (
TimerFreq = ArmGenericTimerGetTimerFreq ();
ASSERT (TimerFreq != 0);
return TimerFreq;
}

View File

@ -12,7 +12,6 @@
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = TimerLib
CONSTRUCTOR = TimerConstructor
[Sources.common]
ArmArchTimerLib.c