TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiAcpiTimerLib.c
Go to the documentation of this file.
1
9#include <PiPei.h>
10#include <Library/TimerLib.h>
11#include <Library/BaseLib.h>
12#include <Library/HobLib.h>
13#include <Library/DebugLib.h>
14
15extern GUID mFrequencyHobGuid;
16
32UINT64
34 VOID
35 );
36
45UINT64
47 VOID
48 )
49{
50 UINT64 *PerformanceCounterFrequency;
51 EFI_HOB_GUID_TYPE *GuidHob;
52
53 PerformanceCounterFrequency = NULL;
54 GuidHob = GetFirstGuidHob (&mFrequencyHobGuid);
55 if (GuidHob == NULL) {
56 PerformanceCounterFrequency = (UINT64 *)BuildGuidHob (&mFrequencyHobGuid, sizeof (*PerformanceCounterFrequency));
57 ASSERT (PerformanceCounterFrequency != NULL);
58 *PerformanceCounterFrequency = InternalCalculateTscFrequency ();
59 } else {
60 PerformanceCounterFrequency = (UINT64 *)GET_GUID_HOB_DATA (GuidHob);
61 }
62
63 return *PerformanceCounterFrequency;
64}
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
Definition: HobLib.c:215
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
Definition: HobLib.c:336
#define NULL
Definition: Base.h:319
UINT64 InternalCalculateTscFrequency(VOID)
Definition: AcpiTimerLib.c:356
UINT64 InternalGetPerformanceCounterFrequency(VOID)
Definition: Base.h:213