Page MenuHomeFreeBSD

D35460.diff
No OneTemporary

D35460.diff

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
@@ -46,52 +46,35 @@
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
-#include <sys/malloc.h>
-#include <sys/rman.h>
#include <sys/timeet.h>
#include <sys/timetc.h>
#include <sys/vdso.h>
#include <sys/watchdog.h>
-#include <sys/proc.h>
-
-#include <machine/bus.h>
-#include <machine/cpu.h>
#include <machine/cpufunc.h>
#include <machine/intr.h>
-#include <machine/asm.h>
-#include <machine/trap.h>
#include <machine/sbi.h>
-#include <dev/fdt/fdt_common.h>
-#include <dev/ofw/ofw_bus.h>
-#include <dev/ofw/ofw_bus_subr.h>
#include <dev/ofw/openfirm.h>
-#define TIMER_COUNTS 0x00
-#define TIMER_MTIMECMP(cpu) (cpu * 8)
-
struct riscv_timer_softc {
void *ih;
uint32_t clkfreq;
struct eventtimer et;
};
-
static struct riscv_timer_softc *riscv_timer_sc = NULL;
-static uint32_t riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th,
- struct timecounter *tc);
-
-static timecounter_get_t riscv_timer_get_timecount;
+static timecounter_get_t riscv_timer_tc_get_timecount;
+static timecounter_fill_vdso_timehands_t riscv_timer_tc_fill_vdso_timehands;
static struct timecounter riscv_timer_timecount = {
.tc_name = "RISC-V Timecounter",
- .tc_get_timecount = riscv_timer_get_timecount,
+ .tc_get_timecount = riscv_timer_tc_get_timecount,
.tc_poll_pps = NULL,
.tc_counter_mask = ~0u,
.tc_frequency = 0,
.tc_quality = 1000,
- .tc_fill_vdso_timehands = riscv_timer_fill_vdso_timehands,
+ .tc_fill_vdso_timehands = riscv_timer_tc_fill_vdso_timehands,
};
static inline uint64_t
@@ -111,8 +94,8 @@
return (counts);
}
-static unsigned
-riscv_timer_get_timecount(struct timecounter *tc)
+static u_int
+riscv_timer_tc_get_timecount(struct timecounter *tc)
{
struct riscv_timer_softc *sc;
@@ -121,8 +104,17 @@
return (get_counts(sc));
}
+static uint32_t
+riscv_timer_tc_fill_vdso_timehands(struct vdso_timehands *vdso_th,
+ struct timecounter *tc)
+{
+ vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME;
+ bzero(vdso_th->th_res, sizeof(vdso_th->th_res));
+ return (1);
+}
+
static int
-riscv_timer_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
+riscv_timer_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
{
uint64_t counts;
@@ -135,11 +127,10 @@
}
return (EINVAL);
-
}
static int
-riscv_timer_stop(struct eventtimer *et)
+riscv_timer_et_stop(struct eventtimer *et)
{
/* TODO */
@@ -204,7 +195,7 @@
int error;
sc = device_get_softc(dev);
- if (riscv_timer_sc)
+ if (riscv_timer_sc != NULL)
return (ENXIO);
if (device_get_unit(dev) != 0)
@@ -236,8 +227,8 @@
sc->et.et_frequency = sc->clkfreq;
sc->et.et_min_period = (0x00000002LLU << 32) / sc->et.et_frequency;
sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
- sc->et.et_start = riscv_timer_start;
- sc->et.et_stop = riscv_timer_stop;
+ sc->et.et_start = riscv_timer_et_start;
+ sc->et.et_stop = riscv_timer_et_stop;
sc->et.et_priv = sc;
et_register(&sc->et);
@@ -304,12 +295,3 @@
}
TSEXIT();
}
-
-static uint32_t
-riscv_timer_fill_vdso_timehands(struct vdso_timehands *vdso_th,
- struct timecounter *tc)
-{
- vdso_th->th_algo = VDSO_TH_ALGO_RISCV_RDTIME;
- bzero(vdso_th->th_res, sizeof(vdso_th->th_res));
- return (1);
-}

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 18, 8:14 AM (21 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14693235
Default Alt Text
D35460.diff (3 KB)

Event Timeline