summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Behl <cap2k4@rivosinc.com>2025-06-08 23:06:52 +0530
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-07-08 18:35:46 +0000
commit484930e0c6b7991758a098b6e0fd31dec38e7d85 (patch)
treefab396d274aed6462690da510c4c689fecb05679
parent8c721d68ea04ea73af011e1726a9b2c42973a243 (diff)
downloadedk2-484930e0c6b7991758a098b6e0fd31dec38e7d85.zip
edk2-484930e0c6b7991758a098b6e0fd31dec38e7d85.tar.gz
edk2-484930e0c6b7991758a098b6e0fd31dec38e7d85.tar.bz2
UefiCpuPkg/CpuDxeRiscV64: Use DT based timer frequency for CPU driver
There is GetPerformanceCounterProperties() that relies on Device Tree to fetch timer frequency and removes the dependency from the PCDs, use that instead. Signed-off-by: Akshay Behl <cap2k4@rivosinc.com> Co-authored-by: Dhaval Sharma <dhaval@rivosinc.com>
-rw-r--r--UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c2
-rw-r--r--UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h1
-rw-r--r--UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV64.inf2
3 files changed, 3 insertions, 2 deletions
diff --git a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c
index 6a22e01..4f9d53e 100644
--- a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c
@@ -269,7 +269,7 @@ CpuGetTimerValue (
if (TimerPeriod != NULL) {
*TimerPeriod = DivU64x32 (
1000000000000000u,
- PcdGet64 (PcdCpuCoreCrystalClockFrequency)
+ GetPerformanceCounterProperties (NULL, NULL)
);
}
diff --git a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h
index 40077d6..0c4ef2e 100644
--- a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h
+++ b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h
@@ -17,6 +17,7 @@
#include <Library/BaseRiscVFpuLib.h>
#include <Library/BaseRiscVSbiLib.h>
#include <Library/BaseRiscVMmuLib.h>
+#include <Library/TimerLib.h>
#include <Library/BaseLib.h>
#include <Library/CacheMaintenanceLib.h>
#include <Library/CpuExceptionHandlerLib.h>
diff --git a/UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV64.inf b/UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV64.inf
index cb0f71e..7600c88 100644
--- a/UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV64.inf
+++ b/UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV64.inf
@@ -40,6 +40,7 @@
RiscVMmuLib
RiscVFpuLib
CacheMaintenanceLib
+ TimerLib
[Sources]
CpuDxe.c
@@ -62,7 +63,6 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdNullPointerDetectionPropertyMask ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuStackSwitchExceptionList ## CONSUMES
gUefiCpuPkgTokenSpaceGuid.PcdCpuKnownGoodStackSize ## CONSUMES
- gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency ## CONSUMES
[Depex]
TRUE