diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.c b/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.c deleted file mode 100644 index 269e5a3e83..0000000000 --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.c +++ /dev/null @@ -1,85 +0,0 @@ -/** @file - CPUID Leaf 0x15 for Core Crystal Clock frequency instance of Timer Library. - - Copyright (c) 2019 Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include - -extern GUID mCpuCrystalFrequencyHobGuid; - -/** - CPUID Leaf 0x15 for Core Crystal Clock Frequency. - - The TSC counting frequency is determined by using CPUID leaf 0x15. Frequency in MHz = Core XTAL frequency * EBX/EAX. - In newer flavors of the CPU, core xtal frequency is returned in ECX or 0 if not supported. - @return The number of TSC counts per second. - -**/ -UINT64 -CpuidCoreClockCalculateTscFrequency ( - VOID - ); - -// -// Cached CPU Crystal counter frequency -// -UINT64 mCpuCrystalCounterFrequency = 0; - - -/** - Internal function to retrieves the 64-bit frequency in Hz. - - Internal function to retrieves the 64-bit frequency in Hz. - - @return The frequency in Hz. - -**/ -UINT64 -InternalGetPerformanceCounterFrequency ( - VOID - ) -{ - return mCpuCrystalCounterFrequency; -} - -/** - The constructor function is to initialize CpuCrystalCounterFrequency. - - @param ImageHandle The firmware allocated handle for the EFI image. - @param SystemTable A pointer to the EFI System Table. - - @retval EFI_SUCCESS The constructor always returns RETURN_SUCCESS. - -**/ -EFI_STATUS -EFIAPI -DxeCpuTimerLibConstructor ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - EFI_HOB_GUID_TYPE *GuidHob; - - // - // Initialize CpuCrystalCounterFrequency - // - GuidHob = GetFirstGuidHob (&mCpuCrystalFrequencyHobGuid); - if (GuidHob != NULL) { - mCpuCrystalCounterFrequency = *(UINT64*)GET_GUID_HOB_DATA (GuidHob); - } else { - mCpuCrystalCounterFrequency = CpuidCoreClockCalculateTscFrequency (); - } - - if (mCpuCrystalCounterFrequency == 0) { - return EFI_UNSUPPORTED; - } - - return EFI_SUCCESS; -} - diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf b/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf deleted file mode 100644 index 6c83549c87..0000000000 --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf +++ /dev/null @@ -1,37 +0,0 @@ -## @file -# DXE CPU Timer Library -# -# Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. The performance -# counter features are provided by the processors time stamp counter. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = DxeCpuTimerLib - FILE_GUID = F22CC0DA-E7DB-4E4D-ABE2-A608188233A2 - MODULE_TYPE = DXE_DRIVER - VERSION_STRING = 1.0 - LIBRARY_CLASS = TimerLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE - CONSTRUCTOR = DxeCpuTimerLibConstructor - MODULE_UNI_FILE = DxeCpuTimerLib.uni - -[Sources] - CpuTimerLib.c - DxeCpuTimerLib.c - -[Packages] - MdePkg/MdePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - -[LibraryClasses] - BaseLib - PcdLib - DebugLib - HobLib - -[Pcd] - gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## CONSUMES diff --git a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni b/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni deleted file mode 100644 index f55b92abac..0000000000 --- a/UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.uni +++ /dev/null @@ -1,17 +0,0 @@ -// /** @file -// DXE CPU Timer Library -// -// Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. The performance -// counter features are provided by the processors time stamp counter. -// -// Copyright (c) 2019, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "CPU Timer Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Provides basic timer support using CPUID Leaf 0x15 XTAL frequency." - diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.c b/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.c deleted file mode 100644 index 91a7212056..0000000000 --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.c +++ /dev/null @@ -1,58 +0,0 @@ -/** @file - CPUID Leaf 0x15 for Core Crystal Clock frequency instance as PEI Timer Library. - - Copyright (c) 2019 Intel Corporation. All rights reserved.
- SPDX-License-Identifier: BSD-2-Clause-Patent - -**/ - -#include -#include -#include -#include -#include - -extern GUID mCpuCrystalFrequencyHobGuid; - -/** - CPUID Leaf 0x15 for Core Crystal Clock Frequency. - - The TSC counting frequency is determined by using CPUID leaf 0x15. Frequency in MHz = Core XTAL frequency * EBX/EAX. - In newer flavors of the CPU, core xtal frequency is returned in ECX or 0 if not supported. - @return The number of TSC counts per second. - -**/ -UINT64 -CpuidCoreClockCalculateTscFrequency ( - VOID - ); - -/** - Internal function to retrieves the 64-bit frequency in Hz. - - Internal function to retrieves the 64-bit frequency in Hz. - - @return The frequency in Hz. - -**/ -UINT64 -InternalGetPerformanceCounterFrequency ( - VOID - ) -{ - UINT64 *CpuCrystalCounterFrequency; - EFI_HOB_GUID_TYPE *GuidHob; - - CpuCrystalCounterFrequency = NULL; - GuidHob = GetFirstGuidHob (&mCpuCrystalFrequencyHobGuid); - if (GuidHob == NULL) { - CpuCrystalCounterFrequency = (UINT64*)BuildGuidHob(&mCpuCrystalFrequencyHobGuid, sizeof (*CpuCrystalCounterFrequency)); - ASSERT (CpuCrystalCounterFrequency != NULL); - *CpuCrystalCounterFrequency = CpuidCoreClockCalculateTscFrequency (); - } else { - CpuCrystalCounterFrequency = (UINT64*)GET_GUID_HOB_DATA (GuidHob); - } - - return *CpuCrystalCounterFrequency; -} - diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf b/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf deleted file mode 100644 index 7af0fc44a6..0000000000 --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf +++ /dev/null @@ -1,36 +0,0 @@ -## @file -# PEI CPU Timer Library -# -# Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. The performance -# counter features are provided by the processors time stamp counter. -# -# Copyright (c) 2019, Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: BSD-2-Clause-Patent -# -## - -[Defines] - INF_VERSION = 0x00010005 - BASE_NAME = PeiCpuTimerLib - FILE_GUID = 2B13DE00-1A5F-4DD7-A298-01B08AF1015A - MODULE_TYPE = BASE - VERSION_STRING = 1.0 - LIBRARY_CLASS = TimerLib|PEI_CORE PEIM - MODULE_UNI_FILE = PeiCpuTimerLib.uni - -[Sources] - CpuTimerLib.c - PeiCpuTimerLib.c - -[Packages] - MdePkg/MdePkg.dec - UefiCpuPkg/UefiCpuPkg.dec - -[LibraryClasses] - BaseLib - PcdLib - DebugLib - HobLib - -[Pcd] - gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## CONSUMES diff --git a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni b/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni deleted file mode 100644 index 49beb44908..0000000000 --- a/UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.uni +++ /dev/null @@ -1,17 +0,0 @@ -// /** @file -// PEI CPU Timer Library -// -// Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. The performance -// counter features are provided by the processors time stamp counter. -// -// Copyright (c) 2019, Intel Corporation. All rights reserved.
-// -// SPDX-License-Identifier: BSD-2-Clause-Patent -// -// **/ - - -#string STR_MODULE_ABSTRACT #language en-US "CPU Timer Library" - -#string STR_MODULE_DESCRIPTION #language en-US "Provides basic timer support using CPUID Leaf 0x15 XTAL frequency." - diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc index 98c4c53465..c16cf8d1b9 100644 --- a/UefiCpuPkg/UefiCpuPkg.dsc +++ b/UefiCpuPkg/UefiCpuPkg.dsc @@ -116,8 +116,6 @@ UefiCpuPkg/Library/SecPeiDxeTimerLibUefiCpu/SecPeiDxeTimerLibUefiCpu.inf UefiCpuPkg/Application/Cpuid/Cpuid.inf UefiCpuPkg/Library/CpuTimerLib/BaseCpuTimerLib.inf - UefiCpuPkg/Library/CpuTimerLib/DxeCpuTimerLib.inf - UefiCpuPkg/Library/CpuTimerLib/PeiCpuTimerLib.inf UefiCpuPkg/Library/CpuCacheInfoLib/PeiCpuCacheInfoLib.inf UefiCpuPkg/Library/CpuCacheInfoLib/DxeCpuCacheInfoLib.inf