From 53dd04e2190529fe4a27fac70c195544989542e1 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Sun, 11 Feb 2024 16:00:17 +0100 Subject: [PATCH] Kernel/riscv64: Read the timebase-frequency from the device tree --- Kernel/Arch/riscv64/Timer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Kernel/Arch/riscv64/Timer.cpp b/Kernel/Arch/riscv64/Timer.cpp index 96a595a0b6..cd2d679de3 100644 --- a/Kernel/Arch/riscv64/Timer.cpp +++ b/Kernel/Arch/riscv64/Timer.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -14,10 +15,7 @@ namespace Kernel::RISCV64 { Timer::Timer() : HardwareTimer(to_underlying(CSR::SCAUSE::SupervisorTimerInterrupt) & ~CSR::SCAUSE_INTERRUPT_MASK) { - // FIXME: Actually query the frequency of the timer from the device tree. - - // Based on the "/cpus/timebase-frequency" device tree node for the QEMU virt machine - m_frequency = 10'000'000; // in Hz + m_frequency = DeviceTree::get().resolve_property("/cpus/timebase-frequency"sv).value().as(); m_interrupt_interval = m_frequency / OPTIMAL_TICKS_PER_SECOND_RATE;