mirror of
				https://gitlab.com/qemu-project/edk2.git
				synced 2025-10-30 07:56:39 +08:00 
			
		
		
		
	UefiCpuPkg/CpuTimerDxeRiscV64: Use DT based timer frequency in Timer 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>
This commit is contained in:
		 Akshay Behl
					Akshay Behl
				
			
				
					committed by
					
						![mergify[bot]](/assets/img/avatar_default.png) mergify[bot]
						mergify[bot]
					
				
			
			
				
	
			
			
			![mergify[bot]](/assets/img/avatar_default.png) mergify[bot]
						mergify[bot]
					
				
			
						parent
						
							484930e0c6
						
					
				
				
					commit
					34d609402b
				
			| @ -32,6 +32,7 @@ | ||||
|   CpuLib | ||||
|   UefiBootServicesTableLib | ||||
|   UefiDriverEntryPoint | ||||
|   TimerLib | ||||
|  | ||||
| [LibraryClasses.RISCV64] | ||||
|   RiscVSbiLib | ||||
| @ -42,7 +43,6 @@ | ||||
|  | ||||
| [Pcd] | ||||
|   gEfiMdePkgTokenSpaceGuid.PcdRiscVFeatureOverride           ## CONSUMES | ||||
|   gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency  ## CONSUMES | ||||
|  | ||||
| [Protocols] | ||||
|   gEfiCpuArchProtocolGuid       ## CONSUMES | ||||
|  | ||||
| @ -10,6 +10,7 @@ | ||||
| #include <Library/BaseLib.h> | ||||
| #include <Library/BaseRiscVSbiLib.h> | ||||
| #include <Library/UefiLib.h> | ||||
| #include <Library/TimerLib.h> | ||||
| #include "Timer.h" | ||||
|  | ||||
| // | ||||
| @ -114,7 +115,7 @@ TimerInterruptHandler ( | ||||
|     mTimerNotifyFunction ( | ||||
|       DivU64x32 ( | ||||
|         EFI_TIMER_PERIOD_SECONDS (PeriodStart - mLastPeriodStart), | ||||
|         PcdGet64 (PcdCpuCoreCrystalClockFrequency) | ||||
|         GetPerformanceCounterProperties (NULL, NULL) | ||||
|         ) | ||||
|       ); | ||||
|   } | ||||
| @ -129,7 +130,7 @@ TimerInterruptHandler ( | ||||
|   PeriodStart     += DivU64x32 ( | ||||
|                        MultU64x32 ( | ||||
|                          mTimerPeriod, | ||||
|                          PcdGet64 (PcdCpuCoreCrystalClockFrequency) | ||||
|                          GetPerformanceCounterProperties (NULL, NULL) | ||||
|                          ), | ||||
|                        1000000u | ||||
|                        );  // convert to tick | ||||
| @ -232,7 +233,7 @@ TimerDriverSetTimerPeriod ( | ||||
|   PeriodStart     += DivU64x32 ( | ||||
|                        MultU64x32 ( | ||||
|                          mTimerPeriod, | ||||
|                          PcdGet64 (PcdCpuCoreCrystalClockFrequency) | ||||
|                          GetPerformanceCounterProperties (NULL, NULL) | ||||
|                          ), | ||||
|                        1000000u | ||||
|                        ); // convert to tick | ||||
|  | ||||
		Reference in New Issue
	
	Block a user