TianoCore EDK2 master
Loading...
Searching...
No Matches
PeiAcpiTimerLib.c File Reference
#include <PiPei.h>
#include <Library/TimerLib.h>
#include <Library/BaseLib.h>
#include <Library/HobLib.h>
#include <Library/DebugLib.h>

Go to the source code of this file.

Functions

UINT64 InternalCalculateTscFrequency (VOID)
 
UINT64 InternalGetPerformanceCounterFrequency (VOID)
 

Variables

GUID mFrequencyHobGuid
 

Detailed Description

ACPI Timer implements one instance of Timer Library.

Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file PeiAcpiTimerLib.c.

Function Documentation

◆ InternalCalculateTscFrequency()

UINT64 InternalCalculateTscFrequency ( VOID  )

Calculate TSC frequency.

The TSC counting frequency is determined by comparing how far it counts during a 101.4 us period as determined by the ACPI timer. The ACPI timer is used because it counts at a known frequency. The TSC is sampled, followed by waiting 363 counts of the ACPI timer, or 101.4 us. The TSC is then sampled again. The difference multiplied by 9861 is the TSC frequency. There will be a small error because of the overhead of reading the ACPI timer. An attempt is made to determine and compensate for this error.

Returns
The number of TSC counts per second.

Definition at line 356 of file AcpiTimerLib.c.

◆ InternalGetPerformanceCounterFrequency()

UINT64 InternalGetPerformanceCounterFrequency ( VOID  )

Internal function to retrieves the 64-bit frequency in Hz.

Internal function to retrieves the 64-bit frequency in Hz.

Returns
The frequency in Hz.

Definition at line 46 of file PeiAcpiTimerLib.c.

Variable Documentation

◆ mFrequencyHobGuid

GUID mFrequencyHobGuid
extern

Definition at line 18 of file AcpiTimerLib.c.