Defines | |
#define | APIC_LVTERR 0x370 |
#define | APIC_TMICT 0x380 |
#define | APIC_TMCCT 0x390 |
#define | APIC_TDCR 0x3e0 |
Functions | |
UINTN EFIAPI | InternalX86GetApicBase (VOID) |
UINT32 EFIAPI | InternalX86GetTimerFrequency (IN UINTN ApicBase) |
INT32 EFIAPI | InternalX86GetTimerTick (IN UINTN ApicBase) |
UINT32 | InternalX86GetInitTimerCount (IN UINTN ApicBase) |
VOID EFIAPI | InternalX86Delay (IN UINTN ApicBase, IN UINT32 Delay) |
UINTN EFIAPI | MicroSecondDelay (IN UINTN MicroSeconds) |
UINTN EFIAPI | NanoSecondDelay (IN UINTN NanoSeconds) |
UINT64 EFIAPI | GetPerformanceCounter (VOID) |
UINT64 EFIAPI | GetPerformanceCounterProperties (OUT UINT64 *StartValue, OUT UINT64 *EndValue) |
UINT64 EFIAPI | GetTimeInNanoSecond (IN UINT64 Ticks) |
Variables | |
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 | mTimerLibLocalApicDivisor [] |
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#define APIC_LVTERR 0x370 |
#define APIC_TDCR 0x3e0 |
Referenced by InternalX86GetTimerFrequency().
#define APIC_TMCCT 0x390 |
Referenced by InternalX86GetTimerTick().
#define APIC_TMICT 0x380 |
Referenced by InternalX86GetInitTimerCount().
Retrieves the current value of a 64-bit free running performance counter.
The counter can either count up by 1 or count down by 1. If the physical performance counter counts by a larger increment, then the counter values must be translated. The properties of the counter can be retrieved from GetPerformanceCounterProperties().
References InternalX86GetApicBase(), and InternalX86GetTimerTick().
Referenced by AcquireSpinLock(), PeriodicSmiDispatchFunctionOnCpu(), and PeriodicSmiExecutionTime().
Retrieves the 64-bit frequency in Hz and the range of performance counter values.
If StartValue is not NULL, then the value that the performance counter starts with immediately after is it rolls over is returned in StartValue. If EndValue is not NULL, then the value that the performance counter end with immediately before it rolls over is returned in EndValue. The 64-bit frequency of the performance counter in Hz is always returned. If StartValue is less than EndValue, then the performance counter counts up. If StartValue is greater than EndValue, then the performance counter counts down. For example, a 64-bit free running counter that counts up would have a StartValue of 0 and an EndValue of 0xFFFFFFFFFFFFFFFF. A 24-bit free running counter that counts down would have a StartValue of 0xFFFFFF and an EndValue of 0.
StartValue | The value the performance counter starts with when it rolls over. | |
EndValue | The value that the performance counter ends with before it rolls over. |
References InternalX86GetApicBase(), InternalX86GetInitTimerCount(), InternalX86GetTimerFrequency(), and NULL.
Referenced by AcquireSpinLock(), GetTimeInNanoSecond(), MicroSecondDelay(), NanoSecondDelay(), and PeriodicSmiEnable().
Converts elapsed ticks of performance counter to time in nanoseconds.
This function converts the elapsed ticks of running performance counter to time value in unit of nanoseconds.
Ticks | The number of elapsed ticks of running performance counter. |
References DivU64x64Remainder(), GetPerformanceCounterProperties(), HighBitSet64(), MAX, MultU64x32(), NULL, and RShiftU64().
Stalls the CPU for at least the given number of ticks.
Stalls the CPU for at least the given number of ticks. It's invoked by MicroSecondDelay() and NanoSecondDelay().
ApicBase | The base address of memory mapped registers of local APIC. | |
Delay | A period of time to delay in ticks. |
References CpuPause(), InternalX86GetInitTimerCount(), and InternalX86GetTimerTick().
Referenced by MicroSecondDelay(), and NanoSecondDelay().
UINTN EFIAPI InternalX86GetApicBase | ( | VOID | ) |
Internal function to retrieve the base address of local APIC.
References AsmMsrBitFieldRead64().
Referenced by GetPerformanceCounter(), GetPerformanceCounterProperties(), MicroSecondDelay(), and NanoSecondDelay().
UINT32 InternalX86GetInitTimerCount | ( | IN UINTN | ApicBase | ) |
Internal function to read the initial timer count of local APIC.
ApicBase | The base address of memory mapped registers of local APIC. |
References APIC_TMICT, and MmioRead32().
Referenced by GetPerformanceCounterProperties(), and InternalX86Delay().
Internal function to return the frequency of the local APIC timer.
ApicBase | The base address of memory mapped registers of local APIC. |
References APIC_TDCR, MmioBitFieldRead32(), mTimerLibLocalApicDivisor, and PcdGet32.
Referenced by GetPerformanceCounterProperties(), MicroSecondDelay(), and NanoSecondDelay().
Internal function to read the current tick counter of local APIC.
ApicBase | The base address of memory mapped registers of local APIC. |
References APIC_TMCCT, and MmioRead32().
Referenced by GetPerformanceCounter(), and InternalX86Delay().
UINTN EFIAPI MicroSecondDelay | ( | IN UINTN | MicroSeconds | ) |
Stalls the CPU for at least the given number of microseconds.
Stalls the CPU for the number of microseconds specified by MicroSeconds.
MicroSeconds | The minimum number of microseconds to delay. |
References DivU64x32(), InternalX86Delay(), InternalX86GetApicBase(), InternalX86GetTimerFrequency(), and MultU64x64().
Referenced by S3Stall().
UINTN EFIAPI NanoSecondDelay | ( | IN UINTN | NanoSeconds | ) |
Stalls the CPU for at least the given number of nanoseconds.
Stalls the CPU for the number of nanoseconds specified by NanoSeconds.
NanoSeconds | The minimum number of nanoseconds to delay. |
References DivU64x32(), InternalX86Delay(), InternalX86GetApicBase(), InternalX86GetTimerFrequency(), and MultU64x64().
GLOBAL_REMOVE_IF_UNREFERENCED CONST UINT8 mTimerLibLocalApicDivisor[] |
Initial value:
{ 0x02, 0x04, 0x08, 0x10, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x01, 0x20, 0x40, 0x80, 0x01 }
Referenced by InternalX86GetTimerFrequency().