Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F110746528
D40241.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
786 B
Referenced Files
None
Subscribers
None
D40241.diff
View Options
diff --git a/sys/riscv/riscv/timer.c b/sys/riscv/riscv/timer.c
--- a/sys/riscv/riscv/timer.c
+++ b/sys/riscv/riscv/timer.c
@@ -53,6 +53,7 @@
#include <machine/cpufunc.h>
#include <machine/intr.h>
+#include <machine/md_var.h>
#include <machine/sbi.h>
#include <dev/ofw/openfirm.h>
@@ -84,6 +85,16 @@
return (rdtime());
}
+static inline void
+set_timecmp(uint64_t timecmp)
+{
+
+ if (has_sstc)
+ csr_write(stimecmp, timecmp);
+ else
+ sbi_set_timer(timecmp);
+}
+
static u_int
riscv_timer_tc_get_timecount(struct timecounter *tc __unused)
{
@@ -107,7 +118,7 @@
if (first != 0) {
counts = ((uint32_t)et->et_frequency * first) >> 32;
- sbi_set_timer(get_timecount() + counts);
+ set_timecmp(get_timecount() + counts);
csr_set(sie, SIE_STIE);
return (0);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 23, 2:20 PM (7 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16798923
Default Alt Text
D40241.diff (786 B)
Attached To
Mode
D40241: riscv timer: use stimecmp CSR when available
Attached
Detach File
Event Timeline
Log In to Comment