[riscv] Add support for RDTIME as a timer source

The Zicntr extension defines an unprivileged wall-clock time CSR that
roughly matches the behaviour of an invariant TSC on x86.  The nominal
frequency of this timer may be read from the "timebase-frequency"
property of the CPU node in the device tree.

Add a timer source using RDTIME to provide implementations of udelay()
and currticks(), modelled on the existing RDTSC-based timer for x86.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2024-10-28 13:48:11 +00:00
parent b0a8eabbf4
commit cd54e7c844
3 changed files with 197 additions and 0 deletions

View File

@@ -49,3 +49,6 @@ REQUIRE_OBJECT ( linux_timer );
#ifdef TIMER_ACPI
REQUIRE_OBJECT ( acpi_timer );
#endif
#ifdef TIMER_ZICNTR
REQUIRE_OBJECT ( zicntr );
#endif