Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/emips/ebus - don't truncate tv_sec to uint32_t in e...
details: https://anonhg.NetBSD.org/src/rev/006b9d161313
branches: trunk
changeset: 765965:006b9d161313
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jun 12 04:33:29 2011 +0000
description:
- don't truncate tv_sec to uint32_t in eclock_settime()
(I guess this has no longer been critical since timecounter(9) support)
- add prefix to reload member in softc
diffstat:
sys/arch/emips/ebus/clock_ebus.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diffs (83 lines):
diff -r e3155f8ffcb3 -r 006b9d161313 sys/arch/emips/ebus/clock_ebus.c
--- a/sys/arch/emips/ebus/clock_ebus.c Sun Jun 12 04:22:18 2011 +0000
+++ b/sys/arch/emips/ebus/clock_ebus.c Sun Jun 12 04:33:29 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clock_ebus.c,v 1.3 2011/06/12 04:22:18 tsutsui Exp $ */
+/* $NetBSD: clock_ebus.c,v 1.4 2011/06/12 04:33:29 tsutsui Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: clock_ebus.c,v 1.3 2011/06/12 04:22:18 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock_ebus.c,v 1.4 2011/06/12 04:33:29 tsutsui Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -51,7 +51,7 @@
struct eclock_softc {
struct device sc_dev;
struct _Tc *sc_dp;
- uint32_t reload;
+ uint32_t sc_reload;
struct timecounter sc_tc;
struct todr_chip_handle sc_todr;
};
@@ -89,7 +89,7 @@
{
struct eclock_softc *sc = (struct eclock_softc *)dev;
struct _Tc *tc = sc->sc_dp;
- uint32_t reload = 10*1000000; /* 1sec in 100ns units (10MHz clock) */
+ uint32_t reload = 10 * 1000000; /* 1sec in 100ns units (10MHz clock) */
/*
* Compute reload according to whatever value passed in,
@@ -104,11 +104,11 @@
reload = r;
}
- sc->reload = reload;
+ sc->sc_reload = reload;
/* Start the counter */
tc->DownCounterHigh = 0;
- tc->DownCounter = sc->reload;
+ tc->DownCounter = sc->sc_reload;
tc->Control = TCCT_ENABLE | TCCT_INT_ENABLE;
}
@@ -188,18 +188,18 @@
{
struct eclock_softc *sc = todr->cookie;
struct _Tc *tc = sc->sc_dp;
- uint64_t free;
- uint32_t su, uu;
+ uint64_t free, su;
+ uint32_t uu;
int s;
/* Careful with what we do here, else the compilerbugs hit hard */
s = splhigh();
- su = (uint32_t)tv->tv_sec; /* 0(tv) */
- uu = (uint32_t)tv->tv_usec; /* 4(tv) */
+ su = (uint64_t)tv->tv_sec; /* 0(tv) */
+ uu = (uint32_t)tv->tv_usec; /* 8(tv) */
- free = 10 * 1000 * 1000 * (uint64_t)su;
+ free = su * 10 * 1000 * 1000;
free += uu * 10;
tc->FreeRunning = free;
@@ -264,7 +264,7 @@
x = tc->Control;
tc->DownCounterHigh = 0;
- tc->DownCounter = sc->reload;
+ tc->DownCounter = sc->sc_reload;
hardclock(cf);
emips_clock_evcnt.ev_count++;
Home |
Main Index |
Thread Index |
Old Index