riscvarchive / riscv-edk2-platforms

Port of EDK2 implementation of UEFI to RISC-V. See documentation at:
https://github.com/riscv/riscv-uefi-edk2-docs
Other
18 stars 7 forks source link

Fix timer on all platforms #19

Open JohnAZoidberg opened 3 years ago

JohnAZoidberg commented 3 years ago

The countdown in the shell to run autostart.nsh says it's counting down from 5s but it's much faster.

JohnAZoidberg commented 3 years ago

Other platforms still use the SiFive timer, too. They shouldn't.

JohnAZoidberg commented 3 years ago

On U540 it seems to be off by a factor of 10. If I change PcdRiscVMachineTimerFrequencyInHerz from 1_000_000 to 10_000_000 the countdown to skip startup.sh seems to be roughly 5 seconds. However the device tree of the U540 indicates that the frequency is 1_000_000.

Maybe there's something wrong in Silicon/RISC-V/ProcessorPkg/Library/RiscVTimerLib/RiscVTimerLib.c?