summaryrefslogtreecommitdiffstats
path: root/sys/mips/rmi
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2013-02-28 13:46:03 +0000
committermav <mav@FreeBSD.org>2013-02-28 13:46:03 +0000
commit6cf7cc6e4d8da1cf9aba1c481b914e4ca5e9f38f (patch)
treec8556591f85961643a9b4ddfaaa7c1008bb03d81 /sys/mips/rmi
parent240074414d4919ebd889f27087c72783a7ed9b19 (diff)
downloadFreeBSD-src-6cf7cc6e4d8da1cf9aba1c481b914e4ca5e9f38f.zip
FreeBSD-src-6cf7cc6e4d8da1cf9aba1c481b914e4ca5e9f38f.tar.gz
MFcalloutng:
Switch eventtimers(9) from using struct bintime to sbintime_t. Even before this not a single driver really supported full dynamic range of struct bintime even in theory, not speaking about practical inexpediency. This change legitimates the status quo and cleans up the code.
Diffstat (limited to 'sys/mips/rmi')
-rw-r--r--sys/mips/rmi/tick.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/sys/mips/rmi/tick.c b/sys/mips/rmi/tick.c
index 39f0a04..adc8c89 100644
--- a/sys/mips/rmi/tick.c
+++ b/sys/mips/rmi/tick.c
@@ -219,22 +219,17 @@ DELAY(int n)
}
static int
-clock_start(struct eventtimer *et,
- struct bintime *first, struct bintime *period)
+clock_start(struct eventtimer *et, sbintime_t first, sbintime_t period)
{
uint32_t fdiv, div, next;
- if (period != NULL) {
- div = (et->et_frequency * (period->frac >> 32)) >> 32;
- if (period->sec != 0)
- div += et->et_frequency * period->sec;
- } else
+ if (period != 0)
+ div = (et->et_frequency * period) >> 32;
+ else
div = 0;
- if (first != NULL) {
- fdiv = (et->et_frequency * (first->frac >> 32)) >> 32;
- if (first->sec != 0)
- fdiv += et->et_frequency * first->sec;
- } else
+ if (first != 0)
+ fdiv = (et->et_frequency * first) >> 32;
+ else
fdiv = div;
DPCPU_SET(cycles_per_tick, div);
next = mips_rd_count() + fdiv;
@@ -351,11 +346,8 @@ clock_attach(device_t dev)
ET_FLAGS_PERCPU;
sc->et.et_quality = 800;
sc->et.et_frequency = counter_freq;
- sc->et.et_min_period.sec = 0;
- sc->et.et_min_period.frac = 0x00004000LLU << 32; /* To be safe. */
- sc->et.et_max_period.sec = 0xfffffffeU / sc->et.et_frequency;
- sc->et.et_max_period.frac =
- ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
+ sc->et.et_min_period = 0x00004000LLU; /* To be safe. */
+ sc->et.et_max_period = (0xfffffffeLLU << 32) / sc->et.et_frequency;
sc->et.et_start = clock_start;
sc->et.et_stop = clock_stop;
sc->et.et_priv = sc;
OpenPOWER on IntegriCloud