summaryrefslogtreecommitdiff
path: root/sys/arch/octeon
diff options
context:
space:
mode:
authorVisa Hankala <visa@cvs.openbsd.org>2020-07-18 08:37:45 +0000
committerVisa Hankala <visa@cvs.openbsd.org>2020-07-18 08:37:45 +0000
commitb8e39666a5fab838c785939e76bff8c071a6eca8 (patch)
tree92b266dd5fbe763a1b7da28eebce02c3476fba3e /sys/arch/octeon
parent0e1dac87e7cfe9d38f19194836f95666c950ef8f (diff)
Userland timecounter implementation for octeon
OK naddy@; no objections from kettenis@
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r--sys/arch/octeon/include/timetc.h4
-rw-r--r--sys/arch/octeon/octeon/machdep.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/sys/arch/octeon/include/timetc.h b/sys/arch/octeon/include/timetc.h
index ec63af16d18..e5905d45fdb 100644
--- a/sys/arch/octeon/include/timetc.h
+++ b/sys/arch/octeon/include/timetc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: timetc.h,v 1.1 2020/07/06 13:33:08 pirofti Exp $ */
+/* $OpenBSD: timetc.h,v 1.2 2020/07/18 08:37:43 visa Exp $ */
/*
* Copyright (c) 2020 Paul Irofti <paul@irofti.net>
*
@@ -18,6 +18,6 @@
#ifndef _MACHINE_TIMETC_H_
#define _MACHINE_TIMETC_H_
-#define TC_LAST 0
+#include <mips64/timetc.h>
#endif /* _MACHINE_TIMETC_H_ */
diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c
index 8dbabe647fc..060f5acd8f7 100644
--- a/sys/arch/octeon/octeon/machdep.c
+++ b/sys/arch/octeon/octeon/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.126 2020/07/11 15:18:08 visa Exp $ */
+/* $OpenBSD: machdep.c,v 1.127 2020/07/18 08:37:44 visa Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
@@ -602,6 +602,7 @@ mips_init(register_t a0, register_t a1, register_t a2, register_t a3)
cpu_has_synced_cp0_count = 1;
cp0_timecounter.tc_quality = 1000;
+ cp0_timecounter.tc_user = TC_CP0_COUNT;
/*
* Return the new kernel stack pointer.
@@ -772,6 +773,9 @@ octeon_tlb_init(void)
frac = ((1ULL << 63) / imul) * 2;
octeon_sync_tc(PHYS_TO_XKPHYS(clk_reg, CCA_NC), cmul, frac);
+ /* Let userspace access the cycle counter. */
+ hwrena |= HWRENA_CC;
+
/*
* If the UserLocal register is available, let userspace
* access it using the RDHWR instruction.