]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / Library / CpuTimerLib / BaseCpuTimerLib.c
1 /** @file
2 CPUID Leaf 0x15 for Core Crystal Clock frequency instance as Base Timer Library.
3
4 Copyright (c) 2019 Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <Base.h>
10 #include <Library/TimerLib.h>
11 #include <Library/BaseLib.h>
12
13 /**
14 CPUID Leaf 0x15 for Core Crystal Clock Frequency.
15
16 The TSC counting frequency is determined by using CPUID leaf 0x15. Frequency in MHz = Core XTAL frequency * EBX/EAX.
17 In newer flavors of the CPU, core xtal frequency is returned in ECX or 0 if not supported.
18 @return The number of TSC counts per second.
19
20 **/
21 UINT64
22 CpuidCoreClockCalculateTscFrequency (
23 VOID
24 );
25
26 /**
27 Internal function to retrieves the 64-bit frequency in Hz.
28
29 Internal function to retrieves the 64-bit frequency in Hz.
30
31 @return The frequency in Hz.
32
33 **/
34 UINT64
35 InternalGetPerformanceCounterFrequency (
36 VOID
37 )
38 {
39 return CpuidCoreClockCalculateTscFrequency ();
40 }