diff options
author | mav <mav@FreeBSD.org> | 2013-02-28 13:46:03 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2013-02-28 13:46:03 +0000 |
commit | 6cf7cc6e4d8da1cf9aba1c481b914e4ca5e9f38f (patch) | |
tree | c8556591f85961643a9b4ddfaaa7c1008bb03d81 /sys/powerpc/booke | |
parent | 240074414d4919ebd889f27087c72783a7ed9b19 (diff) | |
download | FreeBSD-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/powerpc/booke')
-rw-r--r-- | sys/powerpc/booke/clock.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/sys/powerpc/booke/clock.c b/sys/powerpc/booke/clock.c index 9958160..5827e73 100644 --- a/sys/powerpc/booke/clock.c +++ b/sys/powerpc/booke/clock.c @@ -88,7 +88,7 @@ static u_long *decr_counts[MAXCPU]; #define DIFF19041970 2082844800 static int decr_et_start(struct eventtimer *et, - struct bintime *first, struct bintime *period); + sbintime_t first, sbintime_t period); static int decr_et_stop(struct eventtimer *et); static timecounter_get_t decr_get_timecount; @@ -193,12 +193,8 @@ decr_tc_init(void) ET_FLAGS_PERCPU; decr_et.et_quality = 1000; decr_et.et_frequency = ticks_per_sec; - decr_et.et_min_period.sec = 0; - decr_et.et_min_period.frac = - ((0x00000002LLU << 32) / ticks_per_sec) << 32; - decr_et.et_max_period.sec = 0xfffffffeLLU / ticks_per_sec; - decr_et.et_max_period.frac = - ((0xfffffffeLLU << 32) / ticks_per_sec) << 32; + decr_et.et_min_period = (0x00000002LLU << 32) / ticks_per_sec; + decr_et.et_max_period = (0xfffffffeLLU << 32) / ticks_per_sec; decr_et.et_start = decr_et_start; decr_et.et_stop = decr_et_stop; decr_et.et_priv = NULL; @@ -209,26 +205,21 @@ decr_tc_init(void) * Event timer start method. */ static int -decr_et_start(struct eventtimer *et, - struct bintime *first, struct bintime *period) +decr_et_start(struct eventtimer *et, sbintime_t first, sbintime_t period) { struct decr_state *s = DPCPU_PTR(decr_state); uint32_t fdiv, tcr; - if (period != NULL) { + if (period != 0) { s->mode = 1; - s->div = (decr_et.et_frequency * (period->frac >> 32)) >> 32; - if (period->sec != 0) - s->div += decr_et.et_frequency * period->sec; + s->div = (decr_et.et_frequency * period) >> 32; } else { s->mode = 2; - s->div = 0xffffffff; + s->div = 0; } - if (first != NULL) { - fdiv = (decr_et.et_frequency * (first->frac >> 32)) >> 32; - if (first->sec != 0) - fdiv += decr_et.et_frequency * first->sec; - } else + if (first != 0) + fdiv = (decr_et.et_frequency * first) >> 32; + else fdiv = s->div; tcr = mfspr(SPR_TCR); |