UefiCpuPkg: Add LoongArch64 CPU Timer instance

Add the LoongArch64 CPU Timer instance to CpuTimerLib, using CPUCFG 0x4
and 0x5 for Stable Counter frequency.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4734

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Chao Li
2024-03-20 15:33:49 +08:00
committed by mergify[bot]
parent cc63e04afc
commit 439030bc37
3 changed files with 266 additions and 2 deletions

View File

@@ -1,10 +1,15 @@
## @file
# Base CPU Timer Library
#
# Provides basic timer support using CPUID Leaf 0x15 XTAL frequency. The performance
# Provides basic timer support.
#
# In x86, using CPUID Leaf 0x15 XTAL frequency. The performance
# counter features are provided by the processors time stamp counter.
#
# In LoongArch64, using CPUCFG 0x4 and 0x5 for Stable Counter frequency.
#
# Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -18,10 +23,13 @@
LIBRARY_CLASS = TimerLib
MODULE_UNI_FILE = BaseCpuTimerLib.uni
[Sources]
[Sources.IA32, Sources.X64]
CpuTimerLib.c
BaseCpuTimerLib.c
[Sources.LoongArch64]
LoongArch64/CpuTimerLib.c
[Packages]
MdePkg/MdePkg.dec
UefiCpuPkg/UefiCpuPkg.dec
@@ -31,5 +39,8 @@
DebugLib
PcdLib
[LibraryClasses.LoongArch64]
SafeIntLib
[Pcd]
gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## CONSUMES