unbreak i8254_get_timecount() in environments where the

clock interrupt is derived from other sources (e.g. lapic)
and the i8254 timer is running the full cycle without
being used as clock interrupt source.
This commit is contained in:
kardel 2008-01-19 15:06:52 +00:00
parent 4e4f6b2828
commit 7e076be4ab

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.24 2008/01/17 01:56:02 lukem Exp $ */
/* $NetBSD: clock.c,v 1.25 2008/01/19 15:06:52 kardel Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -121,7 +121,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.24 2008/01/17 01:56:02 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.25 2008/01/19 15:06:52 kardel Exp $");
/* #define CLOCKDEBUG */
/* #define CLOCK_PARANOIA */
@ -430,7 +430,8 @@ i8254_get_timecount(struct timecounter *tc)
/* insb to make the read atomic */
insb(IO_TIMER1+TIMER_CNTR0, &rdval, 2);
count = rtclock_tval - rdval;
if (rtclock_tval && (count < i8254_lastcount && !i8254_ticked)) {
if (rtclock_tval && (count < i8254_lastcount &&
(!i8254_ticked || rtclock_tval == 0xFFFF))) {
i8254_ticked = 1;
i8254_offset += rtclock_tval;
}