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

Go to the source code of this file.

Functions

RETURN_STATUS EFIAPI AcpiTimerLibConstructor (VOID)
 
UINT64 InternalCalculateTscFrequency (VOID)
 
UINT64 InternalGetPerformanceCounterFrequency (VOID)
 
EFI_STATUS CommonAcpiTimerLibConstructor (VOID)
 

Variables

GUID mFrequencyHobGuid
 

Detailed Description

ACPI Timer implements one instance of Timer Library.

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

Definition in file DxeStandaloneMmAcpiTimerLib.c.

Function Documentation

◆ AcpiTimerLibConstructor()

RETURN_STATUS EFIAPI AcpiTimerLibConstructor ( VOID  )

The constructor function enables ACPI IO space.

If ACPI I/O space not enabled, this function will enable it. It will always return RETURN_SUCCESS.

Return values
EFI_SUCCESSThe constructor always returns RETURN_SUCCESS.

The constructor function caches the ACPI tick counter address, and, if necessary, enables ACPI IO space.

Return values
EFI_SUCCESSThe constructor always returns RETURN_SUCCESS.

The constructor function caches the ACPI tick counter address

At the time this constructor runs (DXE_CORE or later), ACPI IO space has already been enabled by either PlatformPei or by the "Base" instance of this library. In order to avoid querying the underlying platform type during each tick counter read operation, we cache the counter address during initialization of this instance of the Timer Library.

Return values
EFI_SUCCESSThe constructor always returns RETURN_SUCCESS.

Definition at line 28 of file BaseAcpiTimerLib.c.

◆ CommonAcpiTimerLibConstructor()

EFI_STATUS CommonAcpiTimerLibConstructor ( VOID  )

The constructor function enables ACPI IO space, and caches PerformanceCounterFrequency.

Return values
EFI_SUCCESSThe constructor always returns RETURN_SUCCESS.

Definition at line 79 of file DxeStandaloneMmAcpiTimerLib.c.

◆ 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 65 of file DxeStandaloneMmAcpiTimerLib.c.

Variable Documentation

◆ mFrequencyHobGuid

GUID mFrequencyHobGuid
extern

Definition at line 18 of file AcpiTimerLib.c.